@camstack/types 1.2.8 → 1.2.9

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.
@@ -6,7 +6,7 @@ import type { ICapabilityHandle } from './readiness.js';
6
6
  import type { CapabilityDeclaration } from './capability.js';
7
7
  import type { ICapabilityRegistry } from './kernel-abstractions.js';
8
8
  import type { CapabilityDefinition, InferProvider } from '../capabilities/capability-definition.js';
9
- import type { CustomActionsSpec } from '../capabilities/custom-actions.js';
9
+ import type { CustomActionCaller, CustomActionsSpec } from '../capabilities/custom-actions.js';
10
10
  import type { AddonDataPlane } from './addon-data-plane.js';
11
11
  import type { StorageLocationDeclaration } from './storage-location-declaration.js';
12
12
  import type { z } from 'zod';
@@ -186,7 +186,7 @@ export interface AddonInitResult<TCatalog extends CustomActionsSpec = CustomActi
186
186
  * per-action return type, so the map form is strictly more typeable).
187
187
  */
188
188
  readonly actionHandlers?: {
189
- readonly [K in keyof TCatalog & string]: (input: z.infer<TCatalog[K]['input']>) => Promise<z.infer<TCatalog[K]['output']>>;
189
+ readonly [K in keyof TCatalog & string]: (input: z.infer<TCatalog[K]['input']>, caller?: CustomActionCaller) => Promise<z.infer<TCatalog[K]['output']>>;
190
190
  };
191
191
  }
192
192
  /**
@@ -141,7 +141,6 @@ export interface CapabilityProviderMap {
141
141
  alerts: InferProvider<typeof import('../capabilities/alerts.cap.js').alertsCapability>;
142
142
  backup: InferProvider<typeof import('../capabilities/backup.cap.js').backupCapability>;
143
143
  'network-access': InferProvider<typeof import('../capabilities/network-access.cap.js').networkAccessCapability>;
144
- 'advanced-notifier': InferProvider<typeof import('../capabilities/advanced-notifier.cap.js').advancedNotifierCapability>;
145
144
  'pipeline-executor': IPipelineExecutorProvider;
146
145
  'detection-pipeline': InferProvider<typeof import('../capabilities/detection-pipeline.cap.js').detectionPipelineCapability>;
147
146
  'pipeline-orchestrator': IPipelineOrchestratorProvider;
@@ -748,22 +748,6 @@ export interface EventCatalog {
748
748
  deletedCount?: number;
749
749
  freedMB?: number;
750
750
  };
751
- /**
752
- * A runner-sampled scrub thumbnail off the already-decoded detection frame
753
- * (~1 JPEG / 5 s / camera; zero extra decode). The recorder (single
754
- * designated node) subscribes, accumulates a 5-minute window into ONE sprite
755
- * sheet + index, and serves it write-once. Cross-node this rides the event
756
- * bus (Moleculer broadcast) exactly like other telemetry — a lost thumb is a
757
- * scrub gap the keyframe backfill fills, so RPC delivery is not required (D8).
758
- * `jpeg` is a ~320px-wide JPEG (Uint8Array survives msgpack over UDS + Moleculer).
759
- */
760
- 'recording.thumb-sampled': {
761
- readonly deviceId: number;
762
- readonly capturedAt: number;
763
- readonly width: number;
764
- readonly height: number;
765
- readonly jpeg: Uint8Array;
766
- };
767
751
  'detection.event': {
768
752
  deviceId: number;
769
753
  detections?: unknown[];
@@ -1,4 +1,4 @@
1
- const require_event_category = require("./event-category-CGj9fI4L.js");
1
+ const require_event_category = require("./event-category-Cdyife4p.js");
2
2
  let zod = require("zod");
3
3
  //#region src/disposer-chain.ts
4
4
  var DisposerChain = class {
@@ -1,4 +1,4 @@
1
- import { t as EventCategory } from "./event-category-D4HJq7Mw.mjs";
1
+ import { t as EventCategory } from "./event-category-BLcNejAE.mjs";
2
2
  import { z } from "zod";
3
3
  //#region src/disposer-chain.ts
4
4
  var DisposerChain = class {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",
@@ -1,256 +0,0 @@
1
- import { z } from 'zod';
2
- import { type InferProvider } from './capability-definition.js';
3
- declare const NotificationRuleConditionsSchema: z.ZodObject<{
4
- deviceIds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodNumber>>>;
5
- classNames: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
6
- zoneIds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
7
- minConfidence: z.ZodOptional<z.ZodNumber>;
8
- source: z.ZodOptional<z.ZodEnum<{
9
- any: "any";
10
- pipeline: "pipeline";
11
- onboard: "onboard";
12
- }>>;
13
- schedule: z.ZodOptional<z.ZodObject<{
14
- days: z.ZodReadonly<z.ZodArray<z.ZodNumber>>;
15
- startHour: z.ZodNumber;
16
- endHour: z.ZodNumber;
17
- }, z.core.$strip>>;
18
- cooldownSeconds: z.ZodOptional<z.ZodNumber>;
19
- minDwellSeconds: z.ZodOptional<z.ZodNumber>;
20
- eventTypeTokens: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
21
- clipDescription: z.ZodOptional<z.ZodObject<{
22
- text: z.ZodString;
23
- minSimilarity: z.ZodNumber;
24
- }, z.core.$strip>>;
25
- labels: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
26
- }, z.core.$strip>;
27
- declare const NotificationRuleTemplateSchema: z.ZodObject<{
28
- title: z.ZodString;
29
- body: z.ZodString;
30
- imageMode: z.ZodEnum<{
31
- none: "none";
32
- full: "full";
33
- crop: "crop";
34
- annotated: "annotated";
35
- }>;
36
- }, z.core.$strip>;
37
- declare const NotificationRuleSchema: z.ZodObject<{
38
- id: z.ZodString;
39
- name: z.ZodString;
40
- enabled: z.ZodBoolean;
41
- eventTypes: z.ZodReadonly<z.ZodArray<z.ZodString>>;
42
- conditions: z.ZodObject<{
43
- deviceIds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodNumber>>>;
44
- classNames: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
45
- zoneIds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
46
- minConfidence: z.ZodOptional<z.ZodNumber>;
47
- source: z.ZodOptional<z.ZodEnum<{
48
- any: "any";
49
- pipeline: "pipeline";
50
- onboard: "onboard";
51
- }>>;
52
- schedule: z.ZodOptional<z.ZodObject<{
53
- days: z.ZodReadonly<z.ZodArray<z.ZodNumber>>;
54
- startHour: z.ZodNumber;
55
- endHour: z.ZodNumber;
56
- }, z.core.$strip>>;
57
- cooldownSeconds: z.ZodOptional<z.ZodNumber>;
58
- minDwellSeconds: z.ZodOptional<z.ZodNumber>;
59
- eventTypeTokens: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
60
- clipDescription: z.ZodOptional<z.ZodObject<{
61
- text: z.ZodString;
62
- minSimilarity: z.ZodNumber;
63
- }, z.core.$strip>>;
64
- labels: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
65
- }, z.core.$strip>;
66
- outputs: z.ZodReadonly<z.ZodArray<z.ZodString>>;
67
- template: z.ZodOptional<z.ZodObject<{
68
- title: z.ZodString;
69
- body: z.ZodString;
70
- imageMode: z.ZodEnum<{
71
- none: "none";
72
- full: "full";
73
- crop: "crop";
74
- annotated: "annotated";
75
- }>;
76
- }, z.core.$strip>>;
77
- priority: z.ZodEnum<{
78
- high: "high";
79
- low: "low";
80
- normal: "normal";
81
- critical: "critical";
82
- }>;
83
- }, z.core.$strip>;
84
- declare const NotificationTestResultSchema: z.ZodObject<{
85
- ruleId: z.ZodString;
86
- eventId: z.ZodString;
87
- timestamp: z.ZodNumber;
88
- wouldFire: z.ZodBoolean;
89
- reason: z.ZodOptional<z.ZodString>;
90
- }, z.core.$strip>;
91
- declare const NotificationHistoryEntrySchema: z.ZodObject<{
92
- id: z.ZodString;
93
- ruleId: z.ZodString;
94
- ruleName: z.ZodString;
95
- eventId: z.ZodString;
96
- timestamp: z.ZodNumber;
97
- outputs: z.ZodReadonly<z.ZodArray<z.ZodString>>;
98
- success: z.ZodBoolean;
99
- error: z.ZodOptional<z.ZodString>;
100
- deviceId: z.ZodOptional<z.ZodNumber>;
101
- }, z.core.$strip>;
102
- declare const NotificationHistoryFilterSchema: z.ZodObject<{
103
- ruleId: z.ZodOptional<z.ZodString>;
104
- deviceId: z.ZodOptional<z.ZodNumber>;
105
- from: z.ZodOptional<z.ZodNumber>;
106
- to: z.ZodOptional<z.ZodNumber>;
107
- limit: z.ZodOptional<z.ZodNumber>;
108
- }, z.core.$strip>;
109
- export declare const advancedNotifierCapability: {
110
- readonly name: "advanced-notifier";
111
- readonly scope: "system";
112
- readonly mode: "singleton";
113
- readonly internal: true;
114
- readonly methods: {
115
- readonly getRules: import("./capability-definition.js").CapabilityMethodSchema<z.ZodVoid, z.ZodObject<{
116
- rules: z.ZodReadonly<z.ZodArray<z.ZodObject<{
117
- id: z.ZodString;
118
- name: z.ZodString;
119
- enabled: z.ZodBoolean;
120
- eventTypes: z.ZodReadonly<z.ZodArray<z.ZodString>>;
121
- conditions: z.ZodObject<{
122
- deviceIds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodNumber>>>;
123
- classNames: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
124
- zoneIds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
125
- minConfidence: z.ZodOptional<z.ZodNumber>;
126
- source: z.ZodOptional<z.ZodEnum<{
127
- any: "any";
128
- pipeline: "pipeline";
129
- onboard: "onboard";
130
- }>>;
131
- schedule: z.ZodOptional<z.ZodObject<{
132
- days: z.ZodReadonly<z.ZodArray<z.ZodNumber>>;
133
- startHour: z.ZodNumber;
134
- endHour: z.ZodNumber;
135
- }, z.core.$strip>>;
136
- cooldownSeconds: z.ZodOptional<z.ZodNumber>;
137
- minDwellSeconds: z.ZodOptional<z.ZodNumber>;
138
- eventTypeTokens: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
139
- clipDescription: z.ZodOptional<z.ZodObject<{
140
- text: z.ZodString;
141
- minSimilarity: z.ZodNumber;
142
- }, z.core.$strip>>;
143
- labels: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
144
- }, z.core.$strip>;
145
- outputs: z.ZodReadonly<z.ZodArray<z.ZodString>>;
146
- template: z.ZodOptional<z.ZodObject<{
147
- title: z.ZodString;
148
- body: z.ZodString;
149
- imageMode: z.ZodEnum<{
150
- none: "none";
151
- full: "full";
152
- crop: "crop";
153
- annotated: "annotated";
154
- }>;
155
- }, z.core.$strip>>;
156
- priority: z.ZodEnum<{
157
- high: "high";
158
- low: "low";
159
- normal: "normal";
160
- critical: "critical";
161
- }>;
162
- }, z.core.$strip>>>;
163
- }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
164
- readonly upsertRule: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
165
- rule: z.ZodObject<{
166
- id: z.ZodString;
167
- name: z.ZodString;
168
- enabled: z.ZodBoolean;
169
- eventTypes: z.ZodReadonly<z.ZodArray<z.ZodString>>;
170
- conditions: z.ZodObject<{
171
- deviceIds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodNumber>>>;
172
- classNames: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
173
- zoneIds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
174
- minConfidence: z.ZodOptional<z.ZodNumber>;
175
- source: z.ZodOptional<z.ZodEnum<{
176
- any: "any";
177
- pipeline: "pipeline";
178
- onboard: "onboard";
179
- }>>;
180
- schedule: z.ZodOptional<z.ZodObject<{
181
- days: z.ZodReadonly<z.ZodArray<z.ZodNumber>>;
182
- startHour: z.ZodNumber;
183
- endHour: z.ZodNumber;
184
- }, z.core.$strip>>;
185
- cooldownSeconds: z.ZodOptional<z.ZodNumber>;
186
- minDwellSeconds: z.ZodOptional<z.ZodNumber>;
187
- eventTypeTokens: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
188
- clipDescription: z.ZodOptional<z.ZodObject<{
189
- text: z.ZodString;
190
- minSimilarity: z.ZodNumber;
191
- }, z.core.$strip>>;
192
- labels: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
193
- }, z.core.$strip>;
194
- outputs: z.ZodReadonly<z.ZodArray<z.ZodString>>;
195
- template: z.ZodOptional<z.ZodObject<{
196
- title: z.ZodString;
197
- body: z.ZodString;
198
- imageMode: z.ZodEnum<{
199
- none: "none";
200
- full: "full";
201
- crop: "crop";
202
- annotated: "annotated";
203
- }>;
204
- }, z.core.$strip>>;
205
- priority: z.ZodEnum<{
206
- high: "high";
207
- low: "low";
208
- normal: "normal";
209
- critical: "critical";
210
- }>;
211
- }, z.core.$strip>;
212
- }, z.core.$strip>, z.ZodObject<{
213
- success: z.ZodLiteral<true>;
214
- }, z.core.$strip>, "mutation">;
215
- readonly deleteRule: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
216
- ruleId: z.ZodString;
217
- }, z.core.$strip>, z.ZodObject<{
218
- success: z.ZodLiteral<true>;
219
- }, z.core.$strip>, "mutation">;
220
- readonly testRule: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
221
- ruleId: z.ZodString;
222
- lookbackMinutes: z.ZodNumber;
223
- }, z.core.$strip>, z.ZodObject<{
224
- results: z.ZodReadonly<z.ZodArray<z.ZodObject<{
225
- ruleId: z.ZodString;
226
- eventId: z.ZodString;
227
- timestamp: z.ZodNumber;
228
- wouldFire: z.ZodBoolean;
229
- reason: z.ZodOptional<z.ZodString>;
230
- }, z.core.$strip>>>;
231
- }, z.core.$strip>, "mutation">;
232
- readonly getHistory: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
233
- filter: z.ZodOptional<z.ZodObject<{
234
- ruleId: z.ZodOptional<z.ZodString>;
235
- deviceId: z.ZodOptional<z.ZodNumber>;
236
- from: z.ZodOptional<z.ZodNumber>;
237
- to: z.ZodOptional<z.ZodNumber>;
238
- limit: z.ZodOptional<z.ZodNumber>;
239
- }, z.core.$strip>>;
240
- }, z.core.$strip>, z.ZodObject<{
241
- entries: z.ZodReadonly<z.ZodArray<z.ZodObject<{
242
- id: z.ZodString;
243
- ruleId: z.ZodString;
244
- ruleName: z.ZodString;
245
- eventId: z.ZodString;
246
- timestamp: z.ZodNumber;
247
- outputs: z.ZodReadonly<z.ZodArray<z.ZodString>>;
248
- success: z.ZodBoolean;
249
- error: z.ZodOptional<z.ZodString>;
250
- deviceId: z.ZodOptional<z.ZodNumber>;
251
- }, z.core.$strip>>>;
252
- }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
253
- };
254
- };
255
- export type IAdvancedNotifierProvider = InferProvider<typeof advancedNotifierCapability>;
256
- export { NotificationRuleSchema, NotificationRuleConditionsSchema, NotificationRuleTemplateSchema, NotificationTestResultSchema, NotificationHistoryEntrySchema, NotificationHistoryFilterSchema, };
@@ -1,73 +0,0 @@
1
- export interface NotificationRule {
2
- readonly id: string;
3
- readonly name: string;
4
- readonly enabled: boolean;
5
- readonly eventTypes: readonly string[];
6
- readonly conditions: {
7
- readonly deviceIds?: readonly number[];
8
- readonly classNames?: readonly string[];
9
- readonly zoneIds?: readonly string[];
10
- readonly minConfidence?: number;
11
- readonly source?: 'pipeline' | 'onboard' | 'any';
12
- readonly schedule?: {
13
- readonly days: readonly number[];
14
- readonly startHour: number;
15
- readonly endHour: number;
16
- };
17
- readonly cooldownSeconds?: number;
18
- readonly minDwellSeconds?: number;
19
- /** Match against `event.data.eventType` token (e.g. `'press_long'`). When non-empty, only events
20
- * carrying a matching `data.eventType` string pass this condition. Rules without this field are
21
- * unaffected (back-compat). Distinct from `eventTypes` which holds EventCategory strings. */
22
- readonly eventTypeTokens?: readonly string[];
23
- /** Match detections whose CLIP image embedding is semantically similar to this free-text
24
- * description. Requires the embedding-encoder cap to have pre-warmed the text vector.
25
- * `minSimilarity` is the cosine similarity threshold in [0, 1]. */
26
- readonly clipDescription?: {
27
- readonly text: string;
28
- readonly minSimilarity: number;
29
- };
30
- /** Recognized-entity label match (face identity / plate vehicle name). */
31
- readonly labels?: readonly string[];
32
- };
33
- readonly outputs: readonly string[];
34
- readonly template?: {
35
- readonly title: string;
36
- readonly body: string;
37
- readonly imageMode: 'crop' | 'annotated' | 'full' | 'none';
38
- };
39
- readonly priority: 'low' | 'normal' | 'high' | 'critical';
40
- }
41
- export interface NotificationTestResult {
42
- readonly ruleId: string;
43
- readonly eventId: string;
44
- readonly timestamp: number;
45
- readonly wouldFire: boolean;
46
- readonly reason?: string;
47
- }
48
- export interface NotificationHistoryFilter {
49
- readonly ruleId?: string;
50
- readonly deviceId?: number;
51
- readonly from?: number;
52
- readonly to?: number;
53
- readonly limit?: number;
54
- }
55
- export interface NotificationHistoryEntry {
56
- readonly id: string;
57
- readonly ruleId: string;
58
- readonly ruleName: string;
59
- readonly eventId: string;
60
- readonly timestamp: number;
61
- readonly outputs: readonly string[];
62
- readonly success: boolean;
63
- readonly error?: string;
64
- readonly deviceId?: number;
65
- }
66
- /**
67
- * Legacy interface — superseded by `InferProvider<typeof advancedNotifierCapability>`.
68
- * Kept as a type-alias re-export so any external code that still imports
69
- * `IAdvancedNotifier` keeps compiling. The actual provider contract lives
70
- * in `packages/types/src/capabilities/advanced-notifier.cap.ts` and is
71
- * inferred from Zod schemas at the use site.
72
- */
73
- export type IAdvancedNotifier = import('../capabilities/advanced-notifier.cap.js').IAdvancedNotifierProvider;