@camstack/types 1.2.111 → 1.2.113

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.
@@ -102,6 +102,321 @@ declare const SetSiteLocationInputSchema: z.ZodNullable<z.ZodObject<{
102
102
  latitude: z.ZodNumber;
103
103
  longitude: z.ZodNumber;
104
104
  }, z.core.$strip>>;
105
+ /**
106
+ * One `(procedure, user-agent, ip, principal)` tuple of the HTTP request
107
+ * census. `principal` is the DERIVED identity (`apocaliss92 (admin)`,
108
+ * `scoped:1a2b3c4d (scoped-token)`, `anonymous`) that the tRPC error log
109
+ * already prints - never a token, never an `Authorization` header.
110
+ */
111
+ declare const RequestCensusGroupSchema: z.ZodObject<{
112
+ procedure: z.ZodString;
113
+ userAgent: z.ZodString;
114
+ ip: z.ZodString;
115
+ principal: z.ZodString;
116
+ calls: z.ZodNumber;
117
+ perMin: z.ZodNumber;
118
+ }, z.core.$strip>;
119
+ /**
120
+ * A procedure's TOTAL over the window, across every caller.
121
+ *
122
+ * This block, not the group list, is what answers "did these calls arrive over
123
+ * HTTP at all". A total far BELOW what a store-side census counted over the
124
+ * same window excludes the HTTP plane, which is a result, not a failure.
125
+ */
126
+ declare const RequestCensusProcedureSchema: z.ZodObject<{
127
+ procedure: z.ZodString;
128
+ calls: z.ZodNumber;
129
+ perMin: z.ZodNumber;
130
+ }, z.core.$strip>;
131
+ /** What one armed window measured. Mirrors `HttpRequestCensus.snapshot()`. */
132
+ declare const RequestCensusSnapshotSchema: z.ZodObject<{
133
+ armed: z.ZodBoolean;
134
+ elapsedMs: z.ZodNumber;
135
+ windowMs: z.ZodNumber;
136
+ armedUntilMs: z.ZodNumber;
137
+ httpRequests: z.ZodNumber;
138
+ batchedRequests: z.ZodNumber;
139
+ procedureCalls: z.ZodNumber;
140
+ wsConnections: z.ZodNumber;
141
+ distinctGroups: z.ZodNumber;
142
+ unattributedCalls: z.ZodNumber;
143
+ procedures: z.ZodReadonly<z.ZodArray<z.ZodObject<{
144
+ procedure: z.ZodString;
145
+ calls: z.ZodNumber;
146
+ perMin: z.ZodNumber;
147
+ }, z.core.$strip>>>;
148
+ groups: z.ZodReadonly<z.ZodArray<z.ZodObject<{
149
+ procedure: z.ZodString;
150
+ userAgent: z.ZodString;
151
+ ip: z.ZodString;
152
+ principal: z.ZodString;
153
+ calls: z.ZodNumber;
154
+ perMin: z.ZodNumber;
155
+ }, z.core.$strip>>>;
156
+ }, z.core.$strip>;
157
+ /**
158
+ * The census as an operator sees it.
159
+ *
160
+ * `persisted` is the honest answer to "will this survive the restart I am
161
+ * about to do": the arm deadline is written to `system-settings` so a window
162
+ * armed now can measure the NEXT boot, and a write that failed must not look
163
+ * like one that succeeded.
164
+ */
165
+ declare const RequestCensusStatusSchema: z.ZodObject<{
166
+ armed: z.ZodBoolean;
167
+ elapsedMs: z.ZodNumber;
168
+ windowMs: z.ZodNumber;
169
+ armedUntilMs: z.ZodNumber;
170
+ httpRequests: z.ZodNumber;
171
+ batchedRequests: z.ZodNumber;
172
+ procedureCalls: z.ZodNumber;
173
+ wsConnections: z.ZodNumber;
174
+ distinctGroups: z.ZodNumber;
175
+ unattributedCalls: z.ZodNumber;
176
+ procedures: z.ZodReadonly<z.ZodArray<z.ZodObject<{
177
+ procedure: z.ZodString;
178
+ calls: z.ZodNumber;
179
+ perMin: z.ZodNumber;
180
+ }, z.core.$strip>>>;
181
+ groups: z.ZodReadonly<z.ZodArray<z.ZodObject<{
182
+ procedure: z.ZodString;
183
+ userAgent: z.ZodString;
184
+ ip: z.ZodString;
185
+ principal: z.ZodString;
186
+ calls: z.ZodNumber;
187
+ perMin: z.ZodNumber;
188
+ }, z.core.$strip>>>;
189
+ persisted: z.ZodBoolean;
190
+ }, z.core.$strip>;
191
+ /** Severity vocabulary. Mirrors `LogLevel` in `interfaces/logging.ts`. */
192
+ declare const LogLevelSchema: z.ZodEnum<{
193
+ error: "error";
194
+ debug: "debug";
195
+ info: "info";
196
+ warn: "warn";
197
+ }>;
198
+ /**
199
+ * The diagnostics that can be ARMED for a window. Exactly one today.
200
+ *
201
+ * A diagnostic is anything whose cost is only worth paying while a question is
202
+ * open. It never persists as a boolean: see {@link DiagnosticWindowSchema}.
203
+ */
204
+ declare const DiagnosticIdSchema: z.ZodEnum<{
205
+ "request-census": "request-census";
206
+ }>;
207
+ /**
208
+ * The layers of the level hierarchy, general → specific. The most specific
209
+ * layer that carries an explicit value wins.
210
+ *
211
+ * `component` is DECLARED and not yet resolvable: the per-component channels
212
+ * are a later slice of the same plan, and a `levelSource` enum that has to
213
+ * grow later would force every consumer of this document to change with it.
214
+ * Nothing returns `component` today.
215
+ */
216
+ declare const LoggingScopeKindSchema: z.ZodEnum<{
217
+ node: "node";
218
+ cluster: "cluster";
219
+ component: "component";
220
+ }>;
221
+ /** Where an effective level came from. `default` = nothing is set anywhere. */
222
+ declare const LoggingLevelSourceSchema: z.ZodEnum<{
223
+ default: "default";
224
+ node: "node";
225
+ cluster: "cluster";
226
+ component: "component";
227
+ }>;
228
+ /**
229
+ * One layer of the hierarchy as it actually STANDS.
230
+ *
231
+ * `level: null` is the whole reason this array is returned: it is the
232
+ * difference between "this node is at `info` because I decided it" and
233
+ * "...because it inherits". An operator who clears an override believing they
234
+ * are clearing an inherited value has been handed the same defect as the two
235
+ * contradicting knobs this document exists to remove, moved one floor up.
236
+ */
237
+ declare const LoggingLevelLayerSchema: z.ZodObject<{
238
+ scope: z.ZodEnum<{
239
+ node: "node";
240
+ cluster: "cluster";
241
+ component: "component";
242
+ }>;
243
+ nodeId: z.ZodNullable<z.ZodString>;
244
+ level: z.ZodNullable<z.ZodEnum<{
245
+ error: "error";
246
+ debug: "debug";
247
+ info: "info";
248
+ warn: "warn";
249
+ }>>;
250
+ }, z.core.$strip>;
251
+ /** What a line is judged against, and WHICH layer decided it. */
252
+ declare const LoggingEffectiveSchema: z.ZodObject<{
253
+ level: z.ZodEnum<{
254
+ error: "error";
255
+ debug: "debug";
256
+ info: "info";
257
+ warn: "warn";
258
+ }>;
259
+ levelSource: z.ZodEnum<{
260
+ default: "default";
261
+ node: "node";
262
+ cluster: "cluster";
263
+ component: "component";
264
+ }>;
265
+ }, z.core.$strip>;
266
+ /** Every layer, general → specific. Never collapsed into the effective value. */
267
+ declare const LoggingExplicitSchema: z.ZodObject<{
268
+ layers: z.ZodReadonly<z.ZodArray<z.ZodObject<{
269
+ scope: z.ZodEnum<{
270
+ node: "node";
271
+ cluster: "cluster";
272
+ component: "component";
273
+ }>;
274
+ nodeId: z.ZodNullable<z.ZodString>;
275
+ level: z.ZodNullable<z.ZodEnum<{
276
+ error: "error";
277
+ debug: "debug";
278
+ info: "info";
279
+ warn: "warn";
280
+ }>>;
281
+ }, z.core.$strip>>>;
282
+ }, z.core.$strip>;
283
+ /**
284
+ * An armed diagnostic, with its DEADLINE.
285
+ *
286
+ * The shape of ADR-0244: what is stored is a deadline and never a flag, so a
287
+ * diagnostic somebody forgot expires by itself, and a boot-window measurement
288
+ * survives the restart it exists to measure. `remainingMs` is 0 whenever
289
+ * `armed` is false — a window is never reported as slightly expired.
290
+ */
291
+ declare const DiagnosticWindowSchema: z.ZodObject<{
292
+ id: z.ZodEnum<{
293
+ "request-census": "request-census";
294
+ }>;
295
+ armed: z.ZodBoolean;
296
+ armedUntilMs: z.ZodNumber;
297
+ remainingMs: z.ZodNumber;
298
+ persisted: z.ZodBoolean;
299
+ }, z.core.$strip>;
300
+ /**
301
+ * `armMs: 0` DISARMS. Any positive value arms for that long, clamped by the
302
+ * server — there is no maximum here on purpose: a bound repeated in a schema
303
+ * is a second knob that disagrees with the first the day one of them moves.
304
+ */
305
+ declare const DiagnosticWindowPatchSchema: z.ZodObject<{
306
+ id: z.ZodEnum<{
307
+ "request-census": "request-census";
308
+ }>;
309
+ armMs: z.ZodNumber;
310
+ reportEveryMs: z.ZodOptional<z.ZodNumber>;
311
+ }, z.core.$strip>;
312
+ /**
313
+ * A PATCH, and patches MERGE.
314
+ *
315
+ * A field absent from the patch is left exactly as it was — arming a
316
+ * diagnostic never resets a level, and setting a level never disarms a window.
317
+ * The provider must not reconstruct the document as `{ ...snapshot, ...patch }`:
318
+ * `setAll` already merges, and rebuilding the object is how an absent field
319
+ * turns into an erased one.
320
+ */
321
+ declare const LoggingSettingsPatchSchema: z.ZodObject<{
322
+ level: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
323
+ error: "error";
324
+ debug: "debug";
325
+ info: "info";
326
+ warn: "warn";
327
+ }>>>;
328
+ diagnostics: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
329
+ id: z.ZodEnum<{
330
+ "request-census": "request-census";
331
+ }>;
332
+ armMs: z.ZodNumber;
333
+ reportEveryMs: z.ZodOptional<z.ZodNumber>;
334
+ }, z.core.$strip>>>>;
335
+ }, z.core.$strip>;
336
+ /**
337
+ * Which LAYER of the hierarchy is addressed. Absent = the cluster layer.
338
+ *
339
+ * Deliberately NOT called `nodeId`: that key is reserved on every cap method
340
+ * input — the generated router strips it and uses it to resolve the PROVIDER
341
+ * on that node (`resolveProvider(cap, nodeId, …)`). A document about
342
+ * `agent-1` addressed as `nodeId` would be forwarded to agent-1 and answered
343
+ * by an agent that holds no cluster document at all. The hub is the single
344
+ * authority over the whole hierarchy and answers for every layer, so the
345
+ * layer selector needs a name the transport does not already own.
346
+ */
347
+ declare const GetLoggingSettingsInputSchema: z.ZodObject<{
348
+ scopeNodeId: z.ZodOptional<z.ZodString>;
349
+ }, z.core.$strip>;
350
+ declare const SetLoggingSettingsInputSchema: z.ZodObject<{
351
+ scopeNodeId: z.ZodOptional<z.ZodString>;
352
+ patch: z.ZodObject<{
353
+ level: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
354
+ error: "error";
355
+ debug: "debug";
356
+ info: "info";
357
+ warn: "warn";
358
+ }>>>;
359
+ diagnostics: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
360
+ id: z.ZodEnum<{
361
+ "request-census": "request-census";
362
+ }>;
363
+ armMs: z.ZodNumber;
364
+ reportEveryMs: z.ZodOptional<z.ZodNumber>;
365
+ }, z.core.$strip>>>>;
366
+ }, z.core.$strip>;
367
+ }, z.core.$strip>;
368
+ /**
369
+ * The whole document, as read and as returned after every write.
370
+ *
371
+ * `persisted: false` means the settings store could not be read or written.
372
+ * The in-memory mirror still governs behaviour and is unchanged by the
373
+ * failure — a read that fails neither switches a level nor disarms a window
374
+ * (D49) — but the operator is told that what they are looking at would not
375
+ * survive a restart.
376
+ */
377
+ declare const LoggingSettingsStateSchema: z.ZodObject<{
378
+ scopeNodeId: z.ZodNullable<z.ZodString>;
379
+ effective: z.ZodObject<{
380
+ level: z.ZodEnum<{
381
+ error: "error";
382
+ debug: "debug";
383
+ info: "info";
384
+ warn: "warn";
385
+ }>;
386
+ levelSource: z.ZodEnum<{
387
+ default: "default";
388
+ node: "node";
389
+ cluster: "cluster";
390
+ component: "component";
391
+ }>;
392
+ }, z.core.$strip>;
393
+ explicit: z.ZodObject<{
394
+ layers: z.ZodReadonly<z.ZodArray<z.ZodObject<{
395
+ scope: z.ZodEnum<{
396
+ node: "node";
397
+ cluster: "cluster";
398
+ component: "component";
399
+ }>;
400
+ nodeId: z.ZodNullable<z.ZodString>;
401
+ level: z.ZodNullable<z.ZodEnum<{
402
+ error: "error";
403
+ debug: "debug";
404
+ info: "info";
405
+ warn: "warn";
406
+ }>>;
407
+ }, z.core.$strip>>>;
408
+ }, z.core.$strip>;
409
+ activeWindows: z.ZodReadonly<z.ZodArray<z.ZodObject<{
410
+ id: z.ZodEnum<{
411
+ "request-census": "request-census";
412
+ }>;
413
+ armed: z.ZodBoolean;
414
+ armedUntilMs: z.ZodNumber;
415
+ remainingMs: z.ZodNumber;
416
+ persisted: z.ZodBoolean;
417
+ }, z.core.$strip>>>;
418
+ persisted: z.ZodBoolean;
419
+ }, z.core.$strip>;
105
420
  export declare const systemCapability: {
106
421
  readonly name: "system";
107
422
  readonly scope: "system";
@@ -204,6 +519,163 @@ export declare const systemCapability: {
204
519
  derivationAttemptedAt: z.ZodNullable<z.ZodNumber>;
205
520
  derivationError: z.ZodNullable<z.ZodString>;
206
521
  }, z.core.$strip>, "mutation">;
522
+ /**
523
+ * Read the HTTP request census - which caller, from which address, with
524
+ * which user-agent, invoked which tRPC procedure, and how often.
525
+ *
526
+ * Reading NEVER re-arms: re-arming clears the counts, which would throw
527
+ * away exactly the numbers being asked for. A closed window may be read as
528
+ * many times as the operator likes and always describes the same window.
529
+ *
530
+ * Admin-only: the rows carry source addresses and principal names.
531
+ */
532
+ readonly getRequestCensus: import("./capability-definition.js").CapabilityMethodSchema<z.ZodVoid, z.ZodObject<{
533
+ armed: z.ZodBoolean;
534
+ elapsedMs: z.ZodNumber;
535
+ windowMs: z.ZodNumber;
536
+ armedUntilMs: z.ZodNumber;
537
+ httpRequests: z.ZodNumber;
538
+ batchedRequests: z.ZodNumber;
539
+ procedureCalls: z.ZodNumber;
540
+ wsConnections: z.ZodNumber;
541
+ distinctGroups: z.ZodNumber;
542
+ unattributedCalls: z.ZodNumber;
543
+ procedures: z.ZodReadonly<z.ZodArray<z.ZodObject<{
544
+ procedure: z.ZodString;
545
+ calls: z.ZodNumber;
546
+ perMin: z.ZodNumber;
547
+ }, z.core.$strip>>>;
548
+ groups: z.ZodReadonly<z.ZodArray<z.ZodObject<{
549
+ procedure: z.ZodString;
550
+ userAgent: z.ZodString;
551
+ ip: z.ZodString;
552
+ principal: z.ZodString;
553
+ calls: z.ZodNumber;
554
+ perMin: z.ZodNumber;
555
+ }, z.core.$strip>>>;
556
+ persisted: z.ZodBoolean;
557
+ }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
558
+ /**
559
+ * The logging settings document — levels and armed diagnostics — resolved
560
+ * for `nodeId`, or for the cluster when `nodeId` is absent.
561
+ *
562
+ * Returns BOTH `effective` and `explicit`. See
563
+ * {@link LoggingLevelLayerSchema} for why collapsing them is the defect.
564
+ */
565
+ readonly getLoggingSettings: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
566
+ scopeNodeId: z.ZodOptional<z.ZodString>;
567
+ }, z.core.$strip>, z.ZodObject<{
568
+ scopeNodeId: z.ZodNullable<z.ZodString>;
569
+ effective: z.ZodObject<{
570
+ level: z.ZodEnum<{
571
+ error: "error";
572
+ debug: "debug";
573
+ info: "info";
574
+ warn: "warn";
575
+ }>;
576
+ levelSource: z.ZodEnum<{
577
+ default: "default";
578
+ node: "node";
579
+ cluster: "cluster";
580
+ component: "component";
581
+ }>;
582
+ }, z.core.$strip>;
583
+ explicit: z.ZodObject<{
584
+ layers: z.ZodReadonly<z.ZodArray<z.ZodObject<{
585
+ scope: z.ZodEnum<{
586
+ node: "node";
587
+ cluster: "cluster";
588
+ component: "component";
589
+ }>;
590
+ nodeId: z.ZodNullable<z.ZodString>;
591
+ level: z.ZodNullable<z.ZodEnum<{
592
+ error: "error";
593
+ debug: "debug";
594
+ info: "info";
595
+ warn: "warn";
596
+ }>>;
597
+ }, z.core.$strip>>>;
598
+ }, z.core.$strip>;
599
+ activeWindows: z.ZodReadonly<z.ZodArray<z.ZodObject<{
600
+ id: z.ZodEnum<{
601
+ "request-census": "request-census";
602
+ }>;
603
+ armed: z.ZodBoolean;
604
+ armedUntilMs: z.ZodNumber;
605
+ remainingMs: z.ZodNumber;
606
+ persisted: z.ZodBoolean;
607
+ }, z.core.$strip>>>;
608
+ persisted: z.ZodBoolean;
609
+ }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
610
+ /**
611
+ * Write the logging settings document. The ONLY write authority over log
612
+ * levels and diagnostic windows — arming the request census went through
613
+ * `system.setRequestCensus` until 2026-08-27 and no longer does, because
614
+ * two writes that disagree about the same window is exactly the defect
615
+ * this document exists to remove (D245).
616
+ *
617
+ * The patch MERGES: see {@link LoggingSettingsPatchSchema}.
618
+ */
619
+ readonly setLoggingSettings: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
620
+ scopeNodeId: z.ZodOptional<z.ZodString>;
621
+ patch: z.ZodObject<{
622
+ level: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
623
+ error: "error";
624
+ debug: "debug";
625
+ info: "info";
626
+ warn: "warn";
627
+ }>>>;
628
+ diagnostics: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
629
+ id: z.ZodEnum<{
630
+ "request-census": "request-census";
631
+ }>;
632
+ armMs: z.ZodNumber;
633
+ reportEveryMs: z.ZodOptional<z.ZodNumber>;
634
+ }, z.core.$strip>>>>;
635
+ }, z.core.$strip>;
636
+ }, z.core.$strip>, z.ZodObject<{
637
+ scopeNodeId: z.ZodNullable<z.ZodString>;
638
+ effective: z.ZodObject<{
639
+ level: z.ZodEnum<{
640
+ error: "error";
641
+ debug: "debug";
642
+ info: "info";
643
+ warn: "warn";
644
+ }>;
645
+ levelSource: z.ZodEnum<{
646
+ default: "default";
647
+ node: "node";
648
+ cluster: "cluster";
649
+ component: "component";
650
+ }>;
651
+ }, z.core.$strip>;
652
+ explicit: z.ZodObject<{
653
+ layers: z.ZodReadonly<z.ZodArray<z.ZodObject<{
654
+ scope: z.ZodEnum<{
655
+ node: "node";
656
+ cluster: "cluster";
657
+ component: "component";
658
+ }>;
659
+ nodeId: z.ZodNullable<z.ZodString>;
660
+ level: z.ZodNullable<z.ZodEnum<{
661
+ error: "error";
662
+ debug: "debug";
663
+ info: "info";
664
+ warn: "warn";
665
+ }>>;
666
+ }, z.core.$strip>>>;
667
+ }, z.core.$strip>;
668
+ activeWindows: z.ZodReadonly<z.ZodArray<z.ZodObject<{
669
+ id: z.ZodEnum<{
670
+ "request-census": "request-census";
671
+ }>;
672
+ armed: z.ZodBoolean;
673
+ armedUntilMs: z.ZodNumber;
674
+ remainingMs: z.ZodNumber;
675
+ persisted: z.ZodBoolean;
676
+ }, z.core.$strip>>>;
677
+ persisted: z.ZodBoolean;
678
+ }, z.core.$strip>, "mutation">;
207
679
  };
208
680
  /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
209
681
  readonly mount: {
@@ -211,8 +683,24 @@ export declare const systemCapability: {
211
683
  };
212
684
  };
213
685
  export type ISystemProvider = InferProvider<typeof systemCapability>;
686
+ export type RequestCensusGroup = z.infer<typeof RequestCensusGroupSchema>;
687
+ export type RequestCensusProcedure = z.infer<typeof RequestCensusProcedureSchema>;
688
+ export type RequestCensusSnapshot = z.infer<typeof RequestCensusSnapshotSchema>;
689
+ export type RequestCensusStatus = z.infer<typeof RequestCensusStatusSchema>;
690
+ export type DiagnosticId = z.infer<typeof DiagnosticIdSchema>;
691
+ export type DiagnosticWindow = z.infer<typeof DiagnosticWindowSchema>;
692
+ export type DiagnosticWindowPatch = z.infer<typeof DiagnosticWindowPatchSchema>;
693
+ export type GetLoggingSettingsInput = z.infer<typeof GetLoggingSettingsInputSchema>;
694
+ export type LoggingEffective = z.infer<typeof LoggingEffectiveSchema>;
695
+ export type LoggingExplicit = z.infer<typeof LoggingExplicitSchema>;
696
+ export type LoggingLevelLayer = z.infer<typeof LoggingLevelLayerSchema>;
697
+ export type LoggingLevelSource = z.infer<typeof LoggingLevelSourceSchema>;
698
+ export type LoggingScopeKind = z.infer<typeof LoggingScopeKindSchema>;
699
+ export type LoggingSettingsPatch = z.infer<typeof LoggingSettingsPatchSchema>;
700
+ export type LoggingSettingsState = z.infer<typeof LoggingSettingsStateSchema>;
701
+ export type SetLoggingSettingsInput = z.infer<typeof SetLoggingSettingsInputSchema>;
214
702
  export type SiteLocation = z.infer<typeof SiteLocationSchema>;
215
703
  export type SiteLocationSource = z.infer<typeof SiteLocationSourceSchema>;
216
704
  export type SiteLocationStatus = z.infer<typeof SiteLocationStatusSchema>;
217
705
  export type SetSiteLocationInput = z.infer<typeof SetSiteLocationInputSchema>;
218
- export { FeatureManifestSchema, HealthStatusSchema, NetworkAddressSchema, SetSiteLocationInputSchema, SiteLocationSchema, SiteLocationSourceSchema, SiteLocationStatusSchema, };
706
+ export { DiagnosticIdSchema, DiagnosticWindowPatchSchema, DiagnosticWindowSchema, FeatureManifestSchema, GetLoggingSettingsInputSchema, HealthStatusSchema, LogLevelSchema, LoggingEffectiveSchema, LoggingExplicitSchema, LoggingLevelLayerSchema, LoggingLevelSourceSchema, LoggingScopeKindSchema, LoggingSettingsPatchSchema, LoggingSettingsStateSchema, NetworkAddressSchema, RequestCensusGroupSchema, RequestCensusProcedureSchema, RequestCensusSnapshotSchema, RequestCensusStatusSchema, SetLoggingSettingsInputSchema, SetSiteLocationInputSchema, SiteLocationSchema, SiteLocationSourceSchema, SiteLocationStatusSchema, };
@@ -1,3 +1,4 @@
1
1
  export * from './coco-classmap.js';
2
+ export * from './sensor-active-state.js';
2
3
  export * from './audio-classmap.js';
3
4
  export * from './event-taxonomy.js';
@@ -0,0 +1,130 @@
1
+ /**
2
+ * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
3
+ * valutatore puro del suo FRONTE.
4
+ *
5
+ * Viveva dentro il builtin virtual-doorbell
6
+ * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
7
+ * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
8
+ * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
9
+ * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
10
+ * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
11
+ * SPOSTA qui e il doorbell la ri-esporta.
12
+ *
13
+ * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
14
+ * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
15
+ * regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
16
+ * booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
17
+ */
18
+ /**
19
+ * Known binary / switch source caps → the boolean slice field whose
20
+ * false→true rise counts as ACTIVE. Every entry is "fire on active".
21
+ * Sensors whose "active" reading is not a plain boolean (presence's string
22
+ * state, connectivity's connected flag) are deliberately excluded — a
23
+ * reconnect is not a doorbell press, and it is not a recording either.
24
+ */
25
+ export declare const SOURCE_CAP_ACTIVE_FIELD: Readonly<Record<string, string>>;
26
+ /**
27
+ * The same caps → the slice field carrying the ms-epoch timestamp of the
28
+ * last transition. Every source cap MUST appear here (guarded by a spec):
29
+ * without a transition timestamp the evaluator cannot tell a genuine rise
30
+ * from a boot-time hydration when the FIRST slice it ever sees is already
31
+ * active, and errs towards silence — swallowing the rise.
32
+ *
33
+ * These timestamps are UPSTREAM ones, not ingest ones: the Home Assistant
34
+ * provider derives them from `state.last_changed`, so they survive our own
35
+ * restarts and correctly read as "hours ago" for a state that has been
36
+ * active for hours. `motion` names its rise timestamp `lastDetectedAt`.
37
+ */
38
+ export declare const SOURCE_CAP_CHANGED_AT_FIELD: Readonly<Record<string, string>>;
39
+ /** Cap names whose presence in a device's bindings qualify it as a source. */
40
+ export declare const SOURCE_CAPS: readonly string[];
41
+ /**
42
+ * Device `type` values (from `DeviceType`) that can host a binary/switch
43
+ * source cap. Used by the camera's `device-multiselect` picker as the
44
+ * CLIENT-SIDE filter, alongside `SOURCE_CAPS`.
45
+ *
46
+ * Why types and not caps alone: the shared picker filters
47
+ * `deviceManager.listAll` rows client-side, and those rows carry only the
48
+ * device's advertised `features` — NOT its registered cap list. On the live
49
+ * cluster binary sensors and switches advertise EMPTY features (features
50
+ * mirror only a handful of caps like `motion-trigger`), so a caps-only
51
+ * filter matched against `features` would list nothing (the very bug this
52
+ * replaced, which relied on the now-empty `getAllBindings`). Matching by
53
+ * `type` is the reliable client-side signal; the union with `SOURCE_CAPS`
54
+ * still captures any device that DOES advertise a source-cap feature.
55
+ * `sensor` covers contact/motion/flood/gas/smoke/CO/vibration/tamper,
56
+ * `switch` covers switches, `control` covers generic binary actuators.
57
+ */
58
+ export declare const SOURCE_DEVICE_TYPES: readonly string[];
59
+ /** True when a cap is a recognised binary/switch source. */
60
+ export declare function isSourceCap(capName: string): boolean;
61
+ /** Extract the "active" boolean a source cap's slice carries, or null when
62
+ * the cap is unknown or the field is missing / non-boolean. */
63
+ export declare function sliceActiveValue(capName: string, slice: Readonly<Record<string, unknown>>): boolean | null;
64
+ /** Ms-epoch transition timestamp a source cap's slice carries, or null when
65
+ * it is absent, non-numeric or the zero "never observed" sentinel. */
66
+ export declare function sliceChangedAt(capName: string, slice: Readonly<Record<string, unknown>>): number | null;
67
+ /**
68
+ * Perché una slice non ha portato un fronte alto. Stesso vocabolario che il
69
+ * virtual-doorbell riporta dal 2026-08-05: UN enum, così "perché non è scattato
70
+ * niente" ha una risposta sola, chiunque lo chieda.
71
+ */
72
+ export type SensorEdgeIgnoreReason =
73
+ /** Not a recognised binary/switch source cap. */
74
+ 'unknown-cap'
75
+ /** Recognised cap, but its active field is missing or not a boolean. */
76
+ | 'non-boolean-value'
77
+ /** First sighting, INACTIVE — nothing can have been lost. */
78
+ | 'baseline-seeded-inactive'
79
+ /** First sighting, ALREADY ACTIVE, and we could not prove it is a fresh
80
+ * transition. A genuine rise MAY have been swallowed here. */
81
+ | 'baseline-seeded-stale-active'
82
+ /** Re-emission carrying the same binary value. */
83
+ | 'no-change'
84
+ /** The falling edge — switch-off / contact-close never fires. */
85
+ | 'falling-edge';
86
+ export interface SensorEdgeInput {
87
+ readonly capName: string;
88
+ readonly slice: Readonly<Record<string, unknown>>;
89
+ /** Ultimo booleano osservato per questa `(device, cap)`; `undefined` = mai vista. */
90
+ readonly prior: boolean | undefined;
91
+ /** Quando l'OSSERVATORE ha iniziato a guardare — il pavimento per una prima
92
+ * osservazione già attiva. Ogni osservatore ha il suo. */
93
+ readonly startedAtMs: number;
94
+ readonly nowMs: number;
95
+ readonly firstSightingFreshnessMs: number;
96
+ }
97
+ /**
98
+ * `value` è restituito su ogni cammino in cui la slice PORTAVA un booleano,
99
+ * anche quando non c'è fronte: il chiamante aggiorna la sua memoria con quello
100
+ * e non rilegge la slice. Su `unknown-cap` / `non-boolean-value` è `null` e la
101
+ * memoria non va toccata.
102
+ */
103
+ export type SensorEdgeVerdict = {
104
+ readonly edge: 'rising';
105
+ readonly value: true;
106
+ } | {
107
+ readonly edge: 'none';
108
+ readonly value: boolean | null;
109
+ readonly reason: SensorEdgeIgnoreReason;
110
+ };
111
+ /**
112
+ * How recent a source's own transition timestamp must be for a FIRST
113
+ * sighting that is already active to count as a genuine rise rather than a
114
+ * hydration of long-standing state.
115
+ */
116
+ export declare const DEFAULT_FIRST_SIGHTING_FRESHNESS_MS = 30000;
117
+ /**
118
+ * IL fronte. Puro: nessun orologio proprio, nessuna memoria — il chiamante
119
+ * porta `prior`, `nowMs` e il proprio `startedAtMs`.
120
+ *
121
+ * Il caso della PRIMA slice già attiva è trattato esplicitamente e vale come
122
+ * fronte solo se il timestamp UPSTREAM della transizione è posteriore a
123
+ * `startedAtMs` **e** entro `firstSightingFreshnessMs`. Entrambe le metà
124
+ * servono: la sola freschezza scatterebbe su un'idratazione al boot di uno
125
+ * stato flippato pochi secondi prima del riavvio, e il solo "dopo che abbiamo
126
+ * iniziato" scatterebbe, su un processo di lunga vita, per una sorgente
127
+ * adottata oggi il cui stato è cambiato ieri. Il caso ambiguo ERRA VERSO IL
128
+ * SILENZIO e lo dichiara (`baseline-seeded-stale-active`).
129
+ */
130
+ export declare function evaluateSensorEdge(input: SensorEdgeInput): SensorEdgeVerdict;