@camstack/types 1.2.221 → 1.2.223

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.
@@ -89,13 +89,13 @@ declare const GridProfileOfferSchema: z.ZodObject<{
89
89
  }>;
90
90
  offered: z.ZodBoolean;
91
91
  missingSources: z.ZodArray<z.ZodNumber>;
92
+ canvas: z.ZodString;
93
+ published: z.ZodBoolean;
92
94
  }, z.core.$strip>;
93
95
  export declare const GridLayoutViewSchema: z.ZodObject<{
94
96
  instanceId: z.ZodString;
95
97
  deviceId: z.ZodNumber;
96
98
  name: z.ZodString;
97
- width: z.ZodNumber;
98
- height: z.ZodNumber;
99
99
  fps: z.ZodNumber;
100
100
  cells: z.ZodArray<z.ZodObject<{
101
101
  deviceId: z.ZodNumber;
@@ -120,6 +120,8 @@ export declare const GridLayoutViewSchema: z.ZodObject<{
120
120
  }>;
121
121
  offered: z.ZodBoolean;
122
122
  missingSources: z.ZodArray<z.ZodNumber>;
123
+ canvas: z.ZodString;
124
+ published: z.ZodBoolean;
123
125
  }, z.core.$strip>>;
124
126
  }, z.core.$strip>;
125
127
  export type GridNormalizedRect = z.infer<typeof GridNormalizedRectSchema>;
@@ -129,9 +131,12 @@ export type GridLayoutView = z.infer<typeof GridLayoutViewSchema>;
129
131
  export declare const GridLayoutPatchSchema: z.ZodObject<{
130
132
  deviceId: z.ZodNumber;
131
133
  name: z.ZodOptional<z.ZodString>;
132
- width: z.ZodOptional<z.ZodNumber>;
133
- height: z.ZodOptional<z.ZodNumber>;
134
134
  fps: z.ZodOptional<z.ZodNumber>;
135
+ publishedProfiles: z.ZodOptional<z.ZodArray<z.ZodEnum<{
136
+ high: "high";
137
+ mid: "mid";
138
+ low: "low";
139
+ }>>>;
135
140
  cells: z.ZodArray<z.ZodObject<{
136
141
  deviceId: z.ZodNumber;
137
142
  source: z.ZodObject<{
@@ -187,8 +192,6 @@ export declare const cameraGridLayoutCapability: {
187
192
  instanceId: z.ZodString;
188
193
  deviceId: z.ZodNumber;
189
194
  name: z.ZodString;
190
- width: z.ZodNumber;
191
- height: z.ZodNumber;
192
195
  fps: z.ZodNumber;
193
196
  cells: z.ZodArray<z.ZodObject<{
194
197
  deviceId: z.ZodNumber;
@@ -213,15 +216,20 @@ export declare const cameraGridLayoutCapability: {
213
216
  }>;
214
217
  offered: z.ZodBoolean;
215
218
  missingSources: z.ZodArray<z.ZodNumber>;
219
+ canvas: z.ZodString;
220
+ published: z.ZodBoolean;
216
221
  }, z.core.$strip>>;
217
222
  }, z.core.$strip>>, import("./capability-definition.js").CapabilityMethodKind>;
218
223
  /** Write the geometry back. Returns the grid as it now stands, profiles included. */
219
224
  readonly saveLayout: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
220
225
  deviceId: z.ZodNumber;
221
226
  name: z.ZodOptional<z.ZodString>;
222
- width: z.ZodOptional<z.ZodNumber>;
223
- height: z.ZodOptional<z.ZodNumber>;
224
227
  fps: z.ZodOptional<z.ZodNumber>;
228
+ publishedProfiles: z.ZodOptional<z.ZodArray<z.ZodEnum<{
229
+ high: "high";
230
+ mid: "mid";
231
+ low: "low";
232
+ }>>>;
225
233
  cells: z.ZodArray<z.ZodObject<{
226
234
  deviceId: z.ZodNumber;
227
235
  source: z.ZodObject<{
@@ -241,8 +249,6 @@ export declare const cameraGridLayoutCapability: {
241
249
  instanceId: z.ZodString;
242
250
  deviceId: z.ZodNumber;
243
251
  name: z.ZodString;
244
- width: z.ZodNumber;
245
- height: z.ZodNumber;
246
252
  fps: z.ZodNumber;
247
253
  cells: z.ZodArray<z.ZodObject<{
248
254
  deviceId: z.ZodNumber;
@@ -267,6 +273,8 @@ export declare const cameraGridLayoutCapability: {
267
273
  }>;
268
274
  offered: z.ZodBoolean;
269
275
  missingSources: z.ZodArray<z.ZodNumber>;
276
+ canvas: z.ZodString;
277
+ published: z.ZodBoolean;
270
278
  }, z.core.$strip>>;
271
279
  }, z.core.$strip>, "mutation">;
272
280
  };
@@ -81,6 +81,18 @@ export interface FfmpegProcessOptions {
81
81
  * it is bounded by {@link maxRestarts} regardless of what this returns.
82
82
  */
83
83
  readonly onExit?: (exit: FfmpegExit) => void;
84
+ /**
85
+ * Called ONCE, when the wrapper stops restarting and the child is gone for
86
+ * good.
87
+ *
88
+ * `onExit` cannot answer this: it fires on every exit, including the ones
89
+ * that are about to be respawned, so a caller using it to tear down would
90
+ * tear down on the first hiccup. And the `start()` promise cannot answer it
91
+ * either — its `reject` is spent the moment the child first goes live, so a
92
+ * give-up AFTER that reached nobody at all. A camera-grid tile that died an
93
+ * hour in was indistinguishable, to its owner, from one that never started.
94
+ */
95
+ readonly onGiveUp?: (error: Error) => void;
84
96
  /** Wall-clock budget for the first output byte. `0` disables the deadline. */
85
97
  readonly firstDataTimeoutMs?: number;
86
98
  /** `0` ⇒ never restart (a run-to-completion job). */
package/dist/index.js CHANGED
@@ -32551,16 +32551,37 @@ var GridProfileOfferSchema = zod.z.object({
32551
32551
  ]),
32552
32552
  offered: zod.z.boolean(),
32553
32553
  /** Sources that cannot serve it. Empty when it is offered, or when there are no cells. */
32554
- missingSources: zod.z.array(zod.z.number().int().positive())
32554
+ missingSources: zod.z.array(zod.z.number().int().positive()),
32555
+ /**
32556
+ * The canvas this profile composes onto, `WxH`, or empty when it is not
32557
+ * offered. DERIVED from the cells and the sources' own size at this profile —
32558
+ * it is reported because nothing else in the system would ever say what the
32559
+ * grid came out as, and because it is the number an operator would otherwise
32560
+ * expect to type.
32561
+ */
32562
+ canvas: zod.z.string(),
32563
+ /**
32564
+ * Whether this profile is PUBLISHED, of the ones the grid could serve.
32565
+ *
32566
+ * A grid's `high` is composed of its sources' `high`, so on a 4K fleet it is
32567
+ * a 4K canvas built from 4K decodes — something to opt into, not something a
32568
+ * viewer's adaptive should be handed by climbing to the top rung it can see.
32569
+ * Default is `mid` + `low`.
32570
+ */
32571
+ published: zod.z.boolean()
32555
32572
  });
32556
32573
  var GridLayoutViewSchema = zod.z.object({
32557
32574
  /** The persisted grid row this camera was declared from. */
32558
32575
  instanceId: zod.z.string(),
32559
32576
  deviceId: zod.z.number().int().nonnegative(),
32560
32577
  name: zod.z.string(),
32561
- /** The canvas the operator laid out — this grid's `high`. mid/low are scaled from it. */
32562
- width: zod.z.number().int(),
32563
- height: zod.z.number().int(),
32578
+ /**
32579
+ * NO canvas size. A grid's resolution is not authored: each profile derives
32580
+ * its own from the cells and its sources' dimensions. The two numbers that
32581
+ * used to be here were a text field that silently decided both how much the
32582
+ * composite cost and how sharp it was — see `profiles[].canvas` for what it
32583
+ * came out as.
32584
+ */
32564
32585
  fps: zod.z.number().int(),
32565
32586
  cells: zod.z.array(GridLayoutCellSchema),
32566
32587
  /** What the catalog will publish, and what it refuses to. Read-only. */
@@ -32569,9 +32590,13 @@ var GridLayoutViewSchema = zod.z.object({
32569
32590
  var GridLayoutPatchSchema = zod.z.object({
32570
32591
  deviceId: zod.z.number().int().nonnegative(),
32571
32592
  name: zod.z.string().min(1).max(160).optional(),
32572
- width: zod.z.number().int().min(160).max(7680).optional(),
32573
- height: zod.z.number().int().min(120).max(4320).optional(),
32574
32593
  fps: zod.z.number().int().min(1).max(60).optional(),
32594
+ /** Which profiles to publish. See `GridProfileOffer.published`. */
32595
+ publishedProfiles: zod.z.array(zod.z.enum([
32596
+ "high",
32597
+ "mid",
32598
+ "low"
32599
+ ])).max(3).optional(),
32575
32600
  /**
32576
32601
  * The whole cell list at once. A per-cell patch would need an ordering the
32577
32602
  * editor does not have, and a half-applied layout is a picture nobody asked
package/dist/index.mjs CHANGED
@@ -32550,16 +32550,37 @@ var GridProfileOfferSchema = z.object({
32550
32550
  ]),
32551
32551
  offered: z.boolean(),
32552
32552
  /** Sources that cannot serve it. Empty when it is offered, or when there are no cells. */
32553
- missingSources: z.array(z.number().int().positive())
32553
+ missingSources: z.array(z.number().int().positive()),
32554
+ /**
32555
+ * The canvas this profile composes onto, `WxH`, or empty when it is not
32556
+ * offered. DERIVED from the cells and the sources' own size at this profile —
32557
+ * it is reported because nothing else in the system would ever say what the
32558
+ * grid came out as, and because it is the number an operator would otherwise
32559
+ * expect to type.
32560
+ */
32561
+ canvas: z.string(),
32562
+ /**
32563
+ * Whether this profile is PUBLISHED, of the ones the grid could serve.
32564
+ *
32565
+ * A grid's `high` is composed of its sources' `high`, so on a 4K fleet it is
32566
+ * a 4K canvas built from 4K decodes — something to opt into, not something a
32567
+ * viewer's adaptive should be handed by climbing to the top rung it can see.
32568
+ * Default is `mid` + `low`.
32569
+ */
32570
+ published: z.boolean()
32554
32571
  });
32555
32572
  var GridLayoutViewSchema = z.object({
32556
32573
  /** The persisted grid row this camera was declared from. */
32557
32574
  instanceId: z.string(),
32558
32575
  deviceId: z.number().int().nonnegative(),
32559
32576
  name: z.string(),
32560
- /** The canvas the operator laid out — this grid's `high`. mid/low are scaled from it. */
32561
- width: z.number().int(),
32562
- height: z.number().int(),
32577
+ /**
32578
+ * NO canvas size. A grid's resolution is not authored: each profile derives
32579
+ * its own from the cells and its sources' dimensions. The two numbers that
32580
+ * used to be here were a text field that silently decided both how much the
32581
+ * composite cost and how sharp it was — see `profiles[].canvas` for what it
32582
+ * came out as.
32583
+ */
32563
32584
  fps: z.number().int(),
32564
32585
  cells: z.array(GridLayoutCellSchema),
32565
32586
  /** What the catalog will publish, and what it refuses to. Read-only. */
@@ -32568,9 +32589,13 @@ var GridLayoutViewSchema = z.object({
32568
32589
  var GridLayoutPatchSchema = z.object({
32569
32590
  deviceId: z.number().int().nonnegative(),
32570
32591
  name: z.string().min(1).max(160).optional(),
32571
- width: z.number().int().min(160).max(7680).optional(),
32572
- height: z.number().int().min(120).max(4320).optional(),
32573
32592
  fps: z.number().int().min(1).max(60).optional(),
32593
+ /** Which profiles to publish. See `GridProfileOffer.published`. */
32594
+ publishedProfiles: z.array(z.enum([
32595
+ "high",
32596
+ "mid",
32597
+ "low"
32598
+ ])).max(3).optional(),
32574
32599
  /**
32575
32600
  * The whole cell list at once. A per-cell patch would need an ordering the
32576
32601
  * editor does not have, and a half-applied layout is a picture nobody asked
package/dist/node.js CHANGED
@@ -1158,7 +1158,9 @@ var FfmpegProcess = class {
1158
1158
  tags: this.logTags,
1159
1159
  meta: { stderrTail: this.stderrTail }
1160
1160
  });
1161
- onDead(new Error(reason));
1161
+ const error = new Error(reason);
1162
+ onDead(error);
1163
+ this.opts.onGiveUp?.(error);
1162
1164
  return;
1163
1165
  }
1164
1166
  this.scheduleRestart(onLive, onDead);
@@ -1166,7 +1168,10 @@ var FfmpegProcess = class {
1166
1168
  scheduleRestart(onLive, onDead) {
1167
1169
  if (this.stopped) return;
1168
1170
  const maxRestarts = this.opts.maxRestarts ?? 0;
1169
- if (maxRestarts === 0) return;
1171
+ if (maxRestarts === 0) {
1172
+ this.opts.onGiveUp?.(/* @__PURE__ */ new Error(`ffmpeg ${this.opts.role} ended and restarts are disabled`));
1173
+ return;
1174
+ }
1170
1175
  if (this.producedOutput && this.now - this.startedAtMs >= (this.opts.stableRunMs ?? DEFAULT_STABLE_RUN_MS)) this.consecutiveFailures = 0;
1171
1176
  if (this.consecutiveFailures > maxRestarts) return;
1172
1177
  (this.opts.setTimeoutFn ?? setTimeout)(() => {
package/dist/node.mjs CHANGED
@@ -1135,7 +1135,9 @@ var FfmpegProcess = class {
1135
1135
  tags: this.logTags,
1136
1136
  meta: { stderrTail: this.stderrTail }
1137
1137
  });
1138
- onDead(new Error(reason));
1138
+ const error = new Error(reason);
1139
+ onDead(error);
1140
+ this.opts.onGiveUp?.(error);
1139
1141
  return;
1140
1142
  }
1141
1143
  this.scheduleRestart(onLive, onDead);
@@ -1143,7 +1145,10 @@ var FfmpegProcess = class {
1143
1145
  scheduleRestart(onLive, onDead) {
1144
1146
  if (this.stopped) return;
1145
1147
  const maxRestarts = this.opts.maxRestarts ?? 0;
1146
- if (maxRestarts === 0) return;
1148
+ if (maxRestarts === 0) {
1149
+ this.opts.onGiveUp?.(/* @__PURE__ */ new Error(`ffmpeg ${this.opts.role} ended and restarts are disabled`));
1150
+ return;
1151
+ }
1147
1152
  if (this.producedOutput && this.now - this.startedAtMs >= (this.opts.stableRunMs ?? DEFAULT_STABLE_RUN_MS)) this.consecutiveFailures = 0;
1148
1153
  if (this.consecutiveFailures > maxRestarts) return;
1149
1154
  (this.opts.setTimeoutFn ?? setTimeout)(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.2.221",
3
+ "version": "1.2.223",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",