@camstack/types 1.2.542 → 1.2.543
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/CHANGELOG.md +6 -0
- package/dist/automation/condition-eval.d.ts +13 -0
- package/dist/automation/hold.d.ts +171 -0
- package/dist/automation/index.d.ts +3 -1
- package/dist/automation/step-condition.d.ts +13 -2
- package/dist/automation/trace.d.ts +45 -0
- package/dist/automation/when.d.ts +35 -0
- package/dist/capabilities/actions.cap.d.ts +15 -0
- package/dist/capabilities/core-blocks.cap.d.ts +45 -0
- package/dist/capabilities/schedulers.cap.d.ts +15 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1052 -518
- package/dist/index.mjs +1042 -519
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.2.543] - 2026-11-11
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Automations: a condition can now be held ("for N s", held or stable ± tolerance) on a device value that becomes, a device state and an expression; thresholds and ranges are supported, a hold fires once per episode at its deadline, and a hold survives a restart without firing
|
|
15
|
+
|
|
10
16
|
## [1.2.542] - 2026-11-10
|
|
11
17
|
|
|
12
18
|
### Changed
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* ones a short-circuit never reached) with a stable path and a human reason, so
|
|
13
13
|
* the editor can paint each block.
|
|
14
14
|
*/
|
|
15
|
+
import { type HoldTracker } from './hold.js';
|
|
15
16
|
import { type LegacyCondition } from './legacy-recipe.js';
|
|
16
17
|
import { type AutomationWhen } from './when.js';
|
|
17
18
|
import type { AutomationConditionTraceNode } from './trace.js';
|
|
@@ -88,15 +89,27 @@ export interface ConditionEvaluation {
|
|
|
88
89
|
readonly unknown: boolean;
|
|
89
90
|
/** Pre-order: a container, then its children. */
|
|
90
91
|
readonly nodes: readonly AutomationConditionTraceNode[];
|
|
92
|
+
/** The soonest a pending `for` completes (ms from now); absent when none is pending. */
|
|
93
|
+
readonly holdDueInMs?: number;
|
|
91
94
|
}
|
|
92
95
|
/** Options of one evaluation of a `when` tree. */
|
|
93
96
|
export interface WhenEvaluationOptions {
|
|
94
97
|
/** The path of the event leaf that occurred (`when.0`); absent for a state-only tree. */
|
|
95
98
|
readonly firedPath?: string;
|
|
99
|
+
/** Keeps the clock of every `for` in the tree. Without it a hold cannot be judged (unknown). */
|
|
100
|
+
readonly holds?: HoldTracker;
|
|
96
101
|
/** The root path (default `when`; the legacy wrapper keeps `conditions`). */
|
|
97
102
|
readonly rootPath?: string;
|
|
98
103
|
}
|
|
99
104
|
/** Evaluate a `when` tree: the fired event leaf is true, every other event leaf false. */
|
|
100
105
|
export declare function evaluateWhenTree(when: AutomationWhen, reader: ConditionReader, now: number, options?: WhenEvaluationOptions): ConditionEvaluation;
|
|
106
|
+
/** Does any state leaf of the tree carry a `for`? */
|
|
107
|
+
export declare function hasHoldLeaves(when: AutomationWhen): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Feed the clock of EVERY `for` leaf, each on its own: a short-circuit in the
|
|
110
|
+
* tree (an event leaf that is false right now) must not stop a hold from
|
|
111
|
+
* counting. Returns the soonest a pending hold completes (ms), or undefined.
|
|
112
|
+
*/
|
|
113
|
+
export declare function observeHoldLeaves(when: AutomationWhen, reader: ConditionReader, now: number, holds: HoldTracker, rootPath?: string): number | undefined;
|
|
101
114
|
/** Legacy name, for blocks generated before the single tree. No tree is a pass with no nodes. */
|
|
102
115
|
export declare function evaluateConditionTree(cond: LegacyCondition | undefined, reader: ConditionReader, now: number): ConditionEvaluation;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hold semantics — "for N seconds" on a leaf of the `when` tree (#498).
|
|
3
|
+
*
|
|
4
|
+
* ONE primitive, `for: { ms, mode, tolerance? }`, shared by `device-becomes`,
|
|
5
|
+
* `device-is` and `expression`:
|
|
6
|
+
*
|
|
7
|
+
* - `held`: the condition stays true for `ms`;
|
|
8
|
+
* - `stable`: the value does not move by more than `tolerance` (absolute, in
|
|
9
|
+
* the field's base unit) for `ms` while the condition holds.
|
|
10
|
+
*
|
|
11
|
+
* {@link HoldCore} is the pure state machine (an input observation → a reading).
|
|
12
|
+
* {@link HoldTracker} keys cores by a leaf path for the STATE leaves the tree
|
|
13
|
+
* evaluator judges. {@link BecomesWatch} wraps a core with a timer for the
|
|
14
|
+
* `device-becomes` EVENT leaf: the deadline is armed when the hold starts and
|
|
15
|
+
* cancelled when it breaks, and the leaf fires ONCE per episode.
|
|
16
|
+
*
|
|
17
|
+
* Hold state is memory only. A hold that is already running when the watcher
|
|
18
|
+
* first looks (a restart) is INHERITED: nobody knows when it began, so it never
|
|
19
|
+
* fires for that episode and a state leaf reads it as unknown until the window
|
|
20
|
+
* has elapsed from the moment the watcher started (D49: not-known is not false).
|
|
21
|
+
*/
|
|
22
|
+
import { z } from 'zod';
|
|
23
|
+
import type { AutomationConditionOperator } from './when.js';
|
|
24
|
+
export declare const HOLD_MAX_MS = 86400000;
|
|
25
|
+
export declare const HoldModeSchema: z.ZodEnum<{
|
|
26
|
+
held: "held";
|
|
27
|
+
stable: "stable";
|
|
28
|
+
}>;
|
|
29
|
+
export type HoldMode = z.infer<typeof HoldModeSchema>;
|
|
30
|
+
export declare const HoldSpecSchema: z.ZodObject<{
|
|
31
|
+
ms: z.ZodNumber;
|
|
32
|
+
mode: z.ZodEnum<{
|
|
33
|
+
held: "held";
|
|
34
|
+
stable: "stable";
|
|
35
|
+
}>;
|
|
36
|
+
tolerance: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
export type HoldSpec = z.infer<typeof HoldSpecSchema>;
|
|
39
|
+
/** What a trace says about a hold. */
|
|
40
|
+
export declare const HoldTraceSchema: z.ZodObject<{
|
|
41
|
+
phase: z.ZodEnum<{
|
|
42
|
+
cancelled: "cancelled";
|
|
43
|
+
fired: "fired";
|
|
44
|
+
pending: "pending";
|
|
45
|
+
reseeded: "reseeded";
|
|
46
|
+
}>;
|
|
47
|
+
ms: z.ZodNumber;
|
|
48
|
+
mode: z.ZodEnum<{
|
|
49
|
+
held: "held";
|
|
50
|
+
stable: "stable";
|
|
51
|
+
}>;
|
|
52
|
+
since: z.ZodOptional<z.ZodNumber>;
|
|
53
|
+
deadline: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export type HoldTrace = z.infer<typeof HoldTraceSchema>;
|
|
56
|
+
/** The legacy fields of a `device-becomes` leaf, read through {@link holdOf}. */
|
|
57
|
+
export interface LegacyHoldFields {
|
|
58
|
+
readonly for?: HoldSpec;
|
|
59
|
+
readonly forMs?: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The ONE reader of a leaf's hold. A leaf stored before #498 carries `forMs`
|
|
63
|
+
* (a `held` window); it reads as `for: { ms, mode: 'held' }`. `0` is no hold.
|
|
64
|
+
*/
|
|
65
|
+
export declare function holdOf(leaf: LegacyHoldFields): HoldSpec | undefined;
|
|
66
|
+
/** `30 s`, `5 min`, `1 h 5 min` — a hold window for a human. */
|
|
67
|
+
export declare function describeHoldMs(ms: number): string;
|
|
68
|
+
/** The operators a `device-becomes` leaf may carry: a threshold or a range. */
|
|
69
|
+
export declare const BecomesOperatorSchema: z.ZodEnum<{
|
|
70
|
+
between: "between";
|
|
71
|
+
eq: "eq";
|
|
72
|
+
gt: "gt";
|
|
73
|
+
gte: "gte";
|
|
74
|
+
lt: "lt";
|
|
75
|
+
lte: "lte";
|
|
76
|
+
ne: "ne";
|
|
77
|
+
outside: "outside";
|
|
78
|
+
}>;
|
|
79
|
+
export type BecomesOperator = z.infer<typeof BecomesOperatorSchema>;
|
|
80
|
+
export declare function compareValues(actual: unknown, operator: AutomationConditionOperator | BecomesOperator, expected: unknown): boolean;
|
|
81
|
+
export type HoldPhase = 'idle' | 'pending' | 'inherited' | 'met';
|
|
82
|
+
export interface HoldReading {
|
|
83
|
+
readonly phase: HoldPhase;
|
|
84
|
+
/** When the hold started; null while idle. For an inherited hold: when it was first SEEN. */
|
|
85
|
+
readonly since: number | null;
|
|
86
|
+
readonly remainingMs: number;
|
|
87
|
+
/** What this observation did to the hold. */
|
|
88
|
+
readonly transition: 'started' | 'cancelled' | 'none';
|
|
89
|
+
}
|
|
90
|
+
export declare class HoldCore {
|
|
91
|
+
private readonly spec;
|
|
92
|
+
private seen;
|
|
93
|
+
private since;
|
|
94
|
+
private inherited;
|
|
95
|
+
private anchor;
|
|
96
|
+
constructor(spec: HoldSpec);
|
|
97
|
+
/**
|
|
98
|
+
* One KNOWN observation. `holds` is whether the condition is true now; `value`
|
|
99
|
+
* is the field (used by `stable`). A read that failed is not an observation —
|
|
100
|
+
* the caller simply does not call this (D49: it never cancels a hold).
|
|
101
|
+
*/
|
|
102
|
+
observe(holds: boolean, value: unknown, now: number): HoldReading;
|
|
103
|
+
/** The reading at `now` with no new observation. */
|
|
104
|
+
read(now: number): Omit<HoldReading, 'transition'>;
|
|
105
|
+
}
|
|
106
|
+
/** Hold cores of the state leaves of one tree, keyed by the leaf's path. */
|
|
107
|
+
export declare class HoldTracker {
|
|
108
|
+
private readonly cores;
|
|
109
|
+
observe(key: string, spec: HoldSpec, input: {
|
|
110
|
+
readonly holds: boolean;
|
|
111
|
+
readonly value: unknown;
|
|
112
|
+
}, now: number): HoldReading;
|
|
113
|
+
}
|
|
114
|
+
export interface BecomesSpec {
|
|
115
|
+
readonly becomes?: string | number | boolean;
|
|
116
|
+
readonly operator?: BecomesOperator;
|
|
117
|
+
readonly value?: unknown;
|
|
118
|
+
readonly hold?: HoldSpec;
|
|
119
|
+
}
|
|
120
|
+
export type BecomesRead = {
|
|
121
|
+
readonly ok: true;
|
|
122
|
+
readonly value: unknown;
|
|
123
|
+
} | {
|
|
124
|
+
readonly ok: false;
|
|
125
|
+
};
|
|
126
|
+
export type BecomesEffect = {
|
|
127
|
+
readonly kind: 'fire';
|
|
128
|
+
readonly value: unknown;
|
|
129
|
+
readonly hold?: HoldTrace;
|
|
130
|
+
} | {
|
|
131
|
+
readonly kind: 'hold';
|
|
132
|
+
readonly hold: HoldTrace;
|
|
133
|
+
readonly value: unknown;
|
|
134
|
+
};
|
|
135
|
+
export type TimerHandle = ReturnType<typeof setTimeout>;
|
|
136
|
+
export interface BecomesTimers {
|
|
137
|
+
readonly set: (fn: () => void, ms: number) => TimerHandle;
|
|
138
|
+
readonly clear: (handle: TimerHandle) => void;
|
|
139
|
+
readonly now: () => number;
|
|
140
|
+
}
|
|
141
|
+
export interface BecomesDeps {
|
|
142
|
+
readonly timers: BecomesTimers;
|
|
143
|
+
/** A fresh read of the leaf's field, taken when a hold's deadline is due. */
|
|
144
|
+
readonly read: () => Promise<BecomesRead>;
|
|
145
|
+
readonly emit: (effect: BecomesEffect) => void;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The runtime of a `device-becomes` leaf. It fires on a TRANSITION and never on a
|
|
149
|
+
* re-report; with a hold it arms a timer for the deadline and fires once per
|
|
150
|
+
* episode.
|
|
151
|
+
*/
|
|
152
|
+
export declare class BecomesWatch {
|
|
153
|
+
private readonly spec;
|
|
154
|
+
private readonly deps;
|
|
155
|
+
private previous;
|
|
156
|
+
private seeded;
|
|
157
|
+
private readonly core;
|
|
158
|
+
private handle;
|
|
159
|
+
private consumed;
|
|
160
|
+
private disposed;
|
|
161
|
+
constructor(spec: BecomesSpec, deps: BecomesDeps);
|
|
162
|
+
dispose(): void;
|
|
163
|
+
private disarm;
|
|
164
|
+
private trace;
|
|
165
|
+
/** A KNOWN value. A failed read is not one: do not call this with it. */
|
|
166
|
+
observe(value: unknown): void;
|
|
167
|
+
/** The deadline: re-read the field (a missed event must not fire a broken hold), then fire once. */
|
|
168
|
+
private due;
|
|
169
|
+
}
|
|
170
|
+
/** One line for a trace or a log: what a hold did. */
|
|
171
|
+
export declare function describeHold(hold: HoldTrace): string;
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
export type { GenerateAutomationBlockInput } from './codegen.js';
|
|
12
12
|
export { generateAutomationBlock } from './codegen.js';
|
|
13
13
|
export type { ConditionEvaluation, ConditionReader, MirrorRefreshFetchers, MirrorRefreshReport, MirrorSource, } from './condition-eval.js';
|
|
14
|
-
export { collectMirrorSources, collectWhenMirrorSources, ConditionMirror, stableIdKey, stableIdMapOf, evaluateConditionTree, evaluateWhenTree, } from './condition-eval.js';
|
|
14
|
+
export { collectMirrorSources, collectWhenMirrorSources, ConditionMirror, stableIdKey, stableIdMapOf, evaluateConditionTree, evaluateWhenTree, hasHoldLeaves, observeHoldLeaves, } from './condition-eval.js';
|
|
15
|
+
export type { BecomesDeps, BecomesEffect, BecomesOperator, BecomesSpec, HoldMode, HoldReading, HoldSpec, HoldTrace, LegacyHoldFields, } from './hold.js';
|
|
16
|
+
export { BecomesOperatorSchema, BecomesWatch, describeHold, describeHoldMs, HoldCore, HoldSpecSchema, HoldTraceSchema, HoldTracker, holdOf, } from './hold.js';
|
|
15
17
|
export type { DetectionDecision, DetectionTrigger, DetectionVars, TrackLifecycleInput, } from './detection-trigger.js';
|
|
16
18
|
export { DetectionTriggerFilter, detectionClassMatches, FIRED_MAX, FIRED_TTL_MS, } from './detection-trigger.js';
|
|
17
19
|
export type { StationaryChangedInput, StationaryDecision, StationaryTrigger, StationaryVars, } from './stationary-trigger.js';
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* read is UNKNOWN, and unknown runs neither side (D49: a failed read changes
|
|
6
6
|
* nothing, and never decides a branch).
|
|
7
7
|
*/
|
|
8
|
-
import { type MirrorRefreshFetchers } from './condition-eval.js';
|
|
8
|
+
import { ConditionMirror, type MirrorRefreshFetchers } from './condition-eval.js';
|
|
9
|
+
import type { HoldTracker } from './hold.js';
|
|
9
10
|
import type { AutomationWhen } from './when.js';
|
|
10
11
|
export type StepConditionResult = 'true' | 'false' | 'unknown';
|
|
11
12
|
export interface StepConditionVerdict {
|
|
@@ -15,5 +16,15 @@ export interface StepConditionVerdict {
|
|
|
15
16
|
}
|
|
16
17
|
/** What a consumer provides to evaluate a step's `if`. */
|
|
17
18
|
export type EvaluateStepCondition = (when: AutomationWhen) => Promise<StepConditionVerdict>;
|
|
19
|
+
/**
|
|
20
|
+
* A `for` in a guard needs history, which a mirror built for one evaluation
|
|
21
|
+
* cannot have: the caller hands in the long-lived mirror and hold tracker it
|
|
22
|
+
* has been feeding, and the path the tree is fed under.
|
|
23
|
+
*/
|
|
24
|
+
export interface StepConditionHistory {
|
|
25
|
+
readonly mirror: ConditionMirror;
|
|
26
|
+
readonly holds: HoldTracker;
|
|
27
|
+
readonly rootPath: string;
|
|
28
|
+
}
|
|
18
29
|
/** Fill a mirror for the tree's leaves from `fetchers` and judge it NOW. */
|
|
19
|
-
export declare function evaluateStepCondition(when: AutomationWhen, fetchers: MirrorRefreshFetchers, now?: () => number): Promise<StepConditionVerdict>;
|
|
30
|
+
export declare function evaluateStepCondition(when: AutomationWhen, fetchers: MirrorRefreshFetchers, now?: () => number, history?: StepConditionHistory): Promise<StepConditionVerdict>;
|
|
@@ -44,6 +44,21 @@ export declare const AutomationTriggerTraceSchema: z.ZodObject<{
|
|
|
44
44
|
}>;
|
|
45
45
|
reason: z.ZodString;
|
|
46
46
|
vars: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>>;
|
|
47
|
+
hold: z.ZodOptional<z.ZodObject<{
|
|
48
|
+
phase: z.ZodEnum<{
|
|
49
|
+
cancelled: "cancelled";
|
|
50
|
+
fired: "fired";
|
|
51
|
+
pending: "pending";
|
|
52
|
+
reseeded: "reseeded";
|
|
53
|
+
}>;
|
|
54
|
+
ms: z.ZodNumber;
|
|
55
|
+
mode: z.ZodEnum<{
|
|
56
|
+
held: "held";
|
|
57
|
+
stable: "stable";
|
|
58
|
+
}>;
|
|
59
|
+
since: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
deadline: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
}, z.core.$strip>>;
|
|
47
62
|
}, z.core.$strip>;
|
|
48
63
|
export type AutomationTriggerTrace = z.infer<typeof AutomationTriggerTraceSchema>;
|
|
49
64
|
export declare const AutomationConditionTraceNodeSchema: z.ZodObject<{
|
|
@@ -202,6 +217,21 @@ export declare const AutomationRunTraceSchema: z.ZodObject<{
|
|
|
202
217
|
}>;
|
|
203
218
|
reason: z.ZodString;
|
|
204
219
|
vars: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>>;
|
|
220
|
+
hold: z.ZodOptional<z.ZodObject<{
|
|
221
|
+
phase: z.ZodEnum<{
|
|
222
|
+
cancelled: "cancelled";
|
|
223
|
+
fired: "fired";
|
|
224
|
+
pending: "pending";
|
|
225
|
+
reseeded: "reseeded";
|
|
226
|
+
}>;
|
|
227
|
+
ms: z.ZodNumber;
|
|
228
|
+
mode: z.ZodEnum<{
|
|
229
|
+
held: "held";
|
|
230
|
+
stable: "stable";
|
|
231
|
+
}>;
|
|
232
|
+
since: z.ZodOptional<z.ZodNumber>;
|
|
233
|
+
deadline: z.ZodOptional<z.ZodNumber>;
|
|
234
|
+
}, z.core.$strip>>;
|
|
205
235
|
}, z.core.$strip>;
|
|
206
236
|
conditions: z.ZodArray<z.ZodObject<{
|
|
207
237
|
path: z.ZodString;
|
|
@@ -371,6 +401,21 @@ export declare const AutomationStateDocSchema: z.ZodObject<{
|
|
|
371
401
|
}>;
|
|
372
402
|
reason: z.ZodString;
|
|
373
403
|
vars: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>>;
|
|
404
|
+
hold: z.ZodOptional<z.ZodObject<{
|
|
405
|
+
phase: z.ZodEnum<{
|
|
406
|
+
cancelled: "cancelled";
|
|
407
|
+
fired: "fired";
|
|
408
|
+
pending: "pending";
|
|
409
|
+
reseeded: "reseeded";
|
|
410
|
+
}>;
|
|
411
|
+
ms: z.ZodNumber;
|
|
412
|
+
mode: z.ZodEnum<{
|
|
413
|
+
held: "held";
|
|
414
|
+
stable: "stable";
|
|
415
|
+
}>;
|
|
416
|
+
since: z.ZodOptional<z.ZodNumber>;
|
|
417
|
+
deadline: z.ZodOptional<z.ZodNumber>;
|
|
418
|
+
}, z.core.$strip>>;
|
|
374
419
|
}, z.core.$strip>;
|
|
375
420
|
conditions: z.ZodArray<z.ZodObject<{
|
|
376
421
|
path: z.ZodString;
|
|
@@ -57,6 +57,25 @@ declare const DeviceBecomesLeafSchema: z.ZodObject<{
|
|
|
57
57
|
cap: z.ZodString;
|
|
58
58
|
fieldPath: z.ZodString;
|
|
59
59
|
becomes: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
60
|
+
operator: z.ZodOptional<z.ZodEnum<{
|
|
61
|
+
between: "between";
|
|
62
|
+
eq: "eq";
|
|
63
|
+
gt: "gt";
|
|
64
|
+
gte: "gte";
|
|
65
|
+
lt: "lt";
|
|
66
|
+
lte: "lte";
|
|
67
|
+
ne: "ne";
|
|
68
|
+
outside: "outside";
|
|
69
|
+
}>>;
|
|
70
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodNumber>]>>;
|
|
71
|
+
for: z.ZodOptional<z.ZodObject<{
|
|
72
|
+
ms: z.ZodNumber;
|
|
73
|
+
mode: z.ZodEnum<{
|
|
74
|
+
held: "held";
|
|
75
|
+
stable: "stable";
|
|
76
|
+
}>;
|
|
77
|
+
tolerance: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
}, z.core.$strip>>;
|
|
60
79
|
edge: z.ZodOptional<z.ZodBoolean>;
|
|
61
80
|
forMs: z.ZodOptional<z.ZodNumber>;
|
|
62
81
|
debounceMs: z.ZodOptional<z.ZodNumber>;
|
|
@@ -209,6 +228,14 @@ declare const DeviceIsLeafSchema: z.ZodObject<{
|
|
|
209
228
|
unit: z.ZodString;
|
|
210
229
|
}, z.core.$strip>]>;
|
|
211
230
|
unit: z.ZodOptional<z.ZodString>;
|
|
231
|
+
for: z.ZodOptional<z.ZodObject<{
|
|
232
|
+
ms: z.ZodNumber;
|
|
233
|
+
mode: z.ZodEnum<{
|
|
234
|
+
held: "held";
|
|
235
|
+
stable: "stable";
|
|
236
|
+
}>;
|
|
237
|
+
tolerance: z.ZodOptional<z.ZodNumber>;
|
|
238
|
+
}, z.core.$strip>>;
|
|
212
239
|
}, z.core.$strip>;
|
|
213
240
|
/**
|
|
214
241
|
* True when the camera currently has a PARKED object matching `subjects` in at
|
|
@@ -276,6 +303,14 @@ declare const ExpressionLeafSchema: z.ZodObject<{
|
|
|
276
303
|
cap: z.ZodString;
|
|
277
304
|
fieldPath: z.ZodString;
|
|
278
305
|
}, z.core.$strip>]>>;
|
|
306
|
+
for: z.ZodOptional<z.ZodObject<{
|
|
307
|
+
ms: z.ZodNumber;
|
|
308
|
+
mode: z.ZodEnum<{
|
|
309
|
+
held: "held";
|
|
310
|
+
stable: "stable";
|
|
311
|
+
}>;
|
|
312
|
+
tolerance: z.ZodOptional<z.ZodNumber>;
|
|
313
|
+
}, z.core.$strip>>;
|
|
279
314
|
}, z.core.$strip>;
|
|
280
315
|
export type AutomationEventLeaf = z.infer<typeof DeviceBecomesLeafSchema> | z.infer<typeof DeviceEventLeafSchema> | z.infer<typeof ScheduleLeafSchema> | z.infer<typeof ManualLeafSchema> | z.infer<typeof IntervalLeafSchema> | z.infer<typeof DetectionLeafSchema> | z.infer<typeof StationaryLeafSchema>;
|
|
281
316
|
export type AutomationStateLeaf = z.infer<typeof DeviceIsLeafSchema> | z.infer<typeof StationaryPresentLeafSchema> | z.infer<typeof ExpressionLeafSchema>;
|
|
@@ -283,6 +283,21 @@ export declare const actionsCapability: {
|
|
|
283
283
|
}>;
|
|
284
284
|
reason: z.ZodString;
|
|
285
285
|
vars: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>>;
|
|
286
|
+
hold: z.ZodOptional<z.ZodObject<{
|
|
287
|
+
phase: z.ZodEnum<{
|
|
288
|
+
cancelled: "cancelled";
|
|
289
|
+
fired: "fired";
|
|
290
|
+
pending: "pending";
|
|
291
|
+
reseeded: "reseeded";
|
|
292
|
+
}>;
|
|
293
|
+
ms: z.ZodNumber;
|
|
294
|
+
mode: z.ZodEnum<{
|
|
295
|
+
held: "held";
|
|
296
|
+
stable: "stable";
|
|
297
|
+
}>;
|
|
298
|
+
since: z.ZodOptional<z.ZodNumber>;
|
|
299
|
+
deadline: z.ZodOptional<z.ZodNumber>;
|
|
300
|
+
}, z.core.$strip>>;
|
|
286
301
|
}, z.core.$strip>;
|
|
287
302
|
conditions: z.ZodArray<z.ZodObject<{
|
|
288
303
|
path: z.ZodString;
|
|
@@ -14134,6 +14134,21 @@ export declare const coreBlocksCapability: {
|
|
|
14134
14134
|
}>;
|
|
14135
14135
|
reason: z.ZodString;
|
|
14136
14136
|
vars: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>>;
|
|
14137
|
+
hold: z.ZodOptional<z.ZodObject<{
|
|
14138
|
+
phase: z.ZodEnum<{
|
|
14139
|
+
cancelled: "cancelled";
|
|
14140
|
+
fired: "fired";
|
|
14141
|
+
pending: "pending";
|
|
14142
|
+
reseeded: "reseeded";
|
|
14143
|
+
}>;
|
|
14144
|
+
ms: z.ZodNumber;
|
|
14145
|
+
mode: z.ZodEnum<{
|
|
14146
|
+
held: "held";
|
|
14147
|
+
stable: "stable";
|
|
14148
|
+
}>;
|
|
14149
|
+
since: z.ZodOptional<z.ZodNumber>;
|
|
14150
|
+
deadline: z.ZodOptional<z.ZodNumber>;
|
|
14151
|
+
}, z.core.$strip>>;
|
|
14137
14152
|
}, z.core.$strip>;
|
|
14138
14153
|
conditions: z.ZodArray<z.ZodObject<{
|
|
14139
14154
|
path: z.ZodString;
|
|
@@ -14304,6 +14319,21 @@ export declare const coreBlocksCapability: {
|
|
|
14304
14319
|
}>;
|
|
14305
14320
|
reason: z.ZodString;
|
|
14306
14321
|
vars: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>>;
|
|
14322
|
+
hold: z.ZodOptional<z.ZodObject<{
|
|
14323
|
+
phase: z.ZodEnum<{
|
|
14324
|
+
cancelled: "cancelled";
|
|
14325
|
+
fired: "fired";
|
|
14326
|
+
pending: "pending";
|
|
14327
|
+
reseeded: "reseeded";
|
|
14328
|
+
}>;
|
|
14329
|
+
ms: z.ZodNumber;
|
|
14330
|
+
mode: z.ZodEnum<{
|
|
14331
|
+
held: "held";
|
|
14332
|
+
stable: "stable";
|
|
14333
|
+
}>;
|
|
14334
|
+
since: z.ZodOptional<z.ZodNumber>;
|
|
14335
|
+
deadline: z.ZodOptional<z.ZodNumber>;
|
|
14336
|
+
}, z.core.$strip>>;
|
|
14307
14337
|
}, z.core.$strip>;
|
|
14308
14338
|
conditions: z.ZodArray<z.ZodObject<{
|
|
14309
14339
|
path: z.ZodString;
|
|
@@ -14470,6 +14500,21 @@ export declare const coreBlocksCapability: {
|
|
|
14470
14500
|
}>;
|
|
14471
14501
|
reason: z.ZodString;
|
|
14472
14502
|
vars: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>>;
|
|
14503
|
+
hold: z.ZodOptional<z.ZodObject<{
|
|
14504
|
+
phase: z.ZodEnum<{
|
|
14505
|
+
cancelled: "cancelled";
|
|
14506
|
+
fired: "fired";
|
|
14507
|
+
pending: "pending";
|
|
14508
|
+
reseeded: "reseeded";
|
|
14509
|
+
}>;
|
|
14510
|
+
ms: z.ZodNumber;
|
|
14511
|
+
mode: z.ZodEnum<{
|
|
14512
|
+
held: "held";
|
|
14513
|
+
stable: "stable";
|
|
14514
|
+
}>;
|
|
14515
|
+
since: z.ZodOptional<z.ZodNumber>;
|
|
14516
|
+
deadline: z.ZodOptional<z.ZodNumber>;
|
|
14517
|
+
}, z.core.$strip>>;
|
|
14473
14518
|
}, z.core.$strip>;
|
|
14474
14519
|
conditions: z.ZodArray<z.ZodObject<{
|
|
14475
14520
|
path: z.ZodString;
|
|
@@ -1504,6 +1504,21 @@ export declare const schedulersCapability: {
|
|
|
1504
1504
|
}>;
|
|
1505
1505
|
reason: z.ZodString;
|
|
1506
1506
|
vars: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>>;
|
|
1507
|
+
hold: z.ZodOptional<z.ZodObject<{
|
|
1508
|
+
phase: z.ZodEnum<{
|
|
1509
|
+
cancelled: "cancelled";
|
|
1510
|
+
fired: "fired";
|
|
1511
|
+
pending: "pending";
|
|
1512
|
+
reseeded: "reseeded";
|
|
1513
|
+
}>;
|
|
1514
|
+
ms: z.ZodNumber;
|
|
1515
|
+
mode: z.ZodEnum<{
|
|
1516
|
+
held: "held";
|
|
1517
|
+
stable: "stable";
|
|
1518
|
+
}>;
|
|
1519
|
+
since: z.ZodOptional<z.ZodNumber>;
|
|
1520
|
+
deadline: z.ZodOptional<z.ZodNumber>;
|
|
1521
|
+
}, z.core.$strip>>;
|
|
1507
1522
|
}, z.core.$strip>;
|
|
1508
1523
|
conditions: z.ZodArray<z.ZodObject<{
|
|
1509
1524
|
path: z.ZodString;
|
package/dist/index.d.ts
CHANGED
|
@@ -191,8 +191,8 @@ export { APP_FLOW_DEFAULT_REDIRECT, APP_FLOW_REFUSAL_MESSAGES, APP_FLOW_STATE_PR
|
|
|
191
191
|
export { SSO_STATE_COOKIE, SSO_STATE_COOKIE_MAX_AGE_SEC } from './auth/sso-state.js';
|
|
192
192
|
export { buildDeviceEnrollmentLink, buildDeviceSignatureMessage, type CompleteEnrollmentInput, CompleteEnrollmentInputSchema, type CompleteEnrollmentOutput, CompleteEnrollmentOutputSchema, DEVICE_CERT_RENEW_WINDOW_DAYS, DEVICE_CERT_SIGNATURE, DEVICE_CERT_VALIDITY_DAYS, DEVICE_ENROLLMENT_TTL_MS, DEVICE_NONCE_TTL_MS, DEVICE_SAN_CREDENTIAL_PREFIX, DEVICE_SAN_USER_PREFIX, DEVICE_SIGNATURE_MESSAGE_VERSION, type DeviceCertificateLoginMethod, DeviceCertificateLoginMethodSchema, type DeviceChallenge, DeviceChallengeSchema, type DeviceCredential, DeviceCredentialSchema, type DeviceCredentialStatus, DeviceCredentialStatusSchema, type DevicePlatform, DevicePlatformSchema, type DeviceProofInput, DeviceProofInputSchema, type CompleteEnrollmentResult, CompleteEnrollmentResultSchema, DEFINITIVE_DEVICE_REFUSALS, DEVICE_DEFINITIVE_REFUSALS_BEFORE_DELETE, DEVICE_REFRESH_REFUSAL_PREFIX, deviceRefusalFromMessage, type DeviceChallengeResult, DeviceChallengeResultSchema, DeviceEnrollProofSchema, type DeviceRefusal, type DeviceRefusalReason, DeviceRefusalReasonSchema, DeviceRefusalSchema, type DeviceRevoker, type EnrollSelfInput, EnrollSelfInputSchema, formatDeviceRevoker, isDefinitiveDeviceRefusal, type RenewDeviceCertificateResult, RenewDeviceCertificateResultSchema, type RevokeOwnDeviceCertificateResult, RevokeOwnDeviceCertificateResultSchema, type DeviceSignaturePurpose, DeviceSignaturePurposeSchema, type RenewDeviceCertificateOutput, RenewDeviceCertificateOutputSchema, type StartEnrollmentOutput, StartEnrollmentOutputSchema, parseDeviceEnrollmentLink, } from './auth/device-certificate.js';
|
|
193
193
|
export { advertisedHubOrigins, claimedRequestOrigins, normalizeOrigin, pickRequestOrigin, type RequestHeaders, requestMountPrefix, } from './auth/request-origin.js';
|
|
194
|
-
export type { ActionStep, AutomationAction, AutomationAll, AutomationAny, AutomationCapStep, AutomationConditionOperator, AutomationConditionTraceNode, AutomationEventLeaf, AutomationLeaf, AutomationNot, AutomationStateLeaf, AutomationWhen, DetectionLabelSource, DetectionLeaf, DetectionSubject, DeviceBecomesLeaf, DeviceIsLeaf, ExpressionLeaf, IdentityLabel, LegacyAutomationRecipe, NormalizedCapStep, StepDeviceTrace, LegacyCondition, LegacyTrigger, PlateLabel, StationaryLeaf, StationaryPresentLeaf, SubClassLabel, SubjectObservation, SubjectVerdict, AutomationRecipe, AutomationRunMode, AutomationRunOutcome, AutomationRunTrace, AutomationRunVerdict, AutomationStateDoc, AutomationStepTrace, AutomationTriggerTrace, ConditionEvaluation, ConditionReader, DetectionDecision, DetectionTrigger, DetectionVars, GenerateAutomationBlockInput, MirrorRefreshFetchers, MirrorRefreshReport, MirrorSource, StationaryChangedInput, StationaryDecision, StationaryTrigger, StationaryVars, TraceNodeOutcome, TraceValue, TrackLifecycleInput, TriggerVariable, } from './automation/index.js';
|
|
195
|
-
export { ActionStepSchema, AutomationActionSchema, AutomationCapStepSchema, AutomationWaitStepSchema, EMPTY_AUTOMATION_STATE, mergeSkipTraces, AutomationConditionOperatorSchema, AutomationConditionTraceNodeSchema, AutomationRecipeSchema, AutomationWhenSchema, CurrentAutomationRecipeSchema, DETECTION_LABEL_SOURCES, DetectionSubjectSchema, LegacyAutomationRecipeSchema, LegacyConditionSchema, LegacyTriggerSchema, MAX_TRACE_ARG_LENGTH, MAX_STEP_DEVICE_OUTCOMES, MAX_TRACE_ARGS, MAX_WHEN_DEPTH, normalizeCapStep, normalizeStepTargets, StepDeviceTraceSchema, MAX_WHEN_LEAVES, REDACTED_ARG, StationarySubjectSchema, anySubjectMatches, buildStepArgsTrace, collectWhenMirrorSources, convertLegacyCondition, convertLegacyRecipe, convertLegacyWhen, countWhenLeaves, describeSubject, evaluateWhenTree, forEachLeaf, hasEventLeaves, isEventLeaf, isLeaf, subClassesOf, subjectFromClassName, subjectMatches, validateWhenTree, whenDepth, AutomationRunModeSchema, AutomationRunOutcomeSchema, AutomationRunTraceSchema, AutomationRunVerdictSchema, AutomationStateDocSchema, AutomationStepTraceSchema, AutomationTriggerTraceSchema, appendTrace, buildTriggerTrace, collectMirrorSources, ConditionMirror, stableIdKey, stableIdMapOf, DEFAULT_TRACE_KEEP, DetectionTriggerFilter, detectionClassMatches, evaluateConditionTree, evaluateStationaryTrigger, generateAutomationBlock, isSkippedTrace, MAX_CONDITION_DEPTH, MAX_CONDITION_LEAVES, MAX_TRACE_KEEP, RunGate, skipSignature, TraceNodeOutcomeSchema, TraceValueSchema, triggerLeafVariables, triggerVariablesOf, validateRecipeBounds, } from './automation/index.js';
|
|
194
|
+
export type { ActionStep, AutomationAction, AutomationAll, AutomationAny, AutomationCapStep, AutomationConditionOperator, AutomationConditionTraceNode, AutomationEventLeaf, AutomationLeaf, AutomationNot, AutomationStateLeaf, AutomationWhen, DetectionLabelSource, DetectionLeaf, DetectionSubject, DeviceBecomesLeaf, BecomesDeps, BecomesEffect, BecomesOperator, BecomesSpec, DeviceIsLeaf, ExpressionLeaf, HoldMode, HoldReading, HoldSpec, HoldTrace, IdentityLabel, LegacyAutomationRecipe, NormalizedCapStep, StepDeviceTrace, LegacyCondition, LegacyTrigger, PlateLabel, StationaryLeaf, StationaryPresentLeaf, SubClassLabel, SubjectObservation, SubjectVerdict, AutomationRecipe, AutomationRunMode, AutomationRunOutcome, AutomationRunTrace, AutomationRunVerdict, AutomationStateDoc, AutomationStepTrace, AutomationTriggerTrace, ConditionEvaluation, ConditionReader, DetectionDecision, DetectionTrigger, DetectionVars, GenerateAutomationBlockInput, MirrorRefreshFetchers, MirrorRefreshReport, MirrorSource, StationaryChangedInput, StationaryDecision, StationaryTrigger, StationaryVars, TraceNodeOutcome, TraceValue, TrackLifecycleInput, TriggerVariable, } from './automation/index.js';
|
|
195
|
+
export { ActionStepSchema, AutomationActionSchema, AutomationCapStepSchema, AutomationWaitStepSchema, EMPTY_AUTOMATION_STATE, mergeSkipTraces, AutomationConditionOperatorSchema, AutomationConditionTraceNodeSchema, AutomationRecipeSchema, AutomationWhenSchema, CurrentAutomationRecipeSchema, DETECTION_LABEL_SOURCES, DetectionSubjectSchema, LegacyAutomationRecipeSchema, LegacyConditionSchema, LegacyTriggerSchema, MAX_TRACE_ARG_LENGTH, MAX_STEP_DEVICE_OUTCOMES, MAX_TRACE_ARGS, MAX_WHEN_DEPTH, normalizeCapStep, normalizeStepTargets, StepDeviceTraceSchema, MAX_WHEN_LEAVES, REDACTED_ARG, StationarySubjectSchema, anySubjectMatches, buildStepArgsTrace, collectWhenMirrorSources, convertLegacyCondition, convertLegacyRecipe, convertLegacyWhen, countWhenLeaves, describeSubject, evaluateWhenTree, forEachLeaf, BecomesOperatorSchema, BecomesWatch, HoldCore, HoldSpecSchema, HoldTraceSchema, HoldTracker, describeHold, describeHoldMs, hasEventLeaves, hasHoldLeaves, holdOf, observeHoldLeaves, isEventLeaf, isLeaf, subClassesOf, subjectFromClassName, subjectMatches, validateWhenTree, whenDepth, AutomationRunModeSchema, AutomationRunOutcomeSchema, AutomationRunTraceSchema, AutomationRunVerdictSchema, AutomationStateDocSchema, AutomationStepTraceSchema, AutomationTriggerTraceSchema, appendTrace, buildTriggerTrace, collectMirrorSources, ConditionMirror, stableIdKey, stableIdMapOf, DEFAULT_TRACE_KEEP, DetectionTriggerFilter, detectionClassMatches, evaluateConditionTree, evaluateStationaryTrigger, generateAutomationBlock, isSkippedTrace, MAX_CONDITION_DEPTH, MAX_CONDITION_LEAVES, MAX_TRACE_KEEP, RunGate, skipSignature, TraceNodeOutcomeSchema, TraceValueSchema, triggerLeafVariables, triggerVariablesOf, validateRecipeBounds, } from './automation/index.js';
|
|
196
196
|
export { UnitWarningSchema, capUnitResolver, normalizeActionUnits, normalizeConditionUnits, normalizeRecipeUnits, prepareRecipeUnits, } from './automation/index.js';
|
|
197
197
|
export type { PreparedRecipe, UnitResolver, UnitWarning, UnitsNormalized, } from './automation/index.js';
|
|
198
198
|
export * from './automation/action.js';
|