@camstack/types 1.2.318 → 1.2.320

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.
Files changed (31) hide show
  1. package/dist/addon.js +13 -4
  2. package/dist/addon.mjs +13 -4
  3. package/dist/capabilities/pipeline-executor.cap.d.ts +1 -1
  4. package/dist/capabilities/pipeline-orchestrator.cap.d.ts +133 -79
  5. package/dist/client.js +5 -2
  6. package/dist/client.mjs +5 -2
  7. package/dist/generated/addon-api.d.ts +27 -6
  8. package/dist/generated/device-proxy.d.ts +1 -1
  9. package/dist/generated/method-access-map.d.ts +1 -1
  10. package/dist/generated/method-device-selectors.d.ts +2 -2
  11. package/dist/generated/system-proxy.d.ts +1 -1
  12. package/dist/index.d.ts +2 -1
  13. package/dist/index.js +734 -346
  14. package/dist/index.mjs +697 -335
  15. package/dist/pipeline/{best-settings → auto-tune}/hardware-class.d.ts +1 -1
  16. package/dist/pipeline/auto-tune/index.d.ts +9 -0
  17. package/dist/pipeline/{best-settings → auto-tune}/plan-schemas.d.ts +74 -166
  18. package/dist/pipeline/{best-settings → auto-tune}/recommend.d.ts +23 -13
  19. package/dist/pipeline/load-balancing/capacity-shares.d.ts +37 -0
  20. package/dist/pipeline/load-balancing/effective-shares.d.ts +33 -0
  21. package/dist/pipeline/load-balancing/index.d.ts +5 -2
  22. package/dist/pipeline/load-balancing/schemas.d.ts +157 -2
  23. package/dist/pipeline/model-bound-settings.d.ts +1 -1
  24. package/dist/pipeline/step-settings-layers.d.ts +69 -0
  25. package/dist/{sleep-DyF95STh.js → sleep-AalHiRYL.js} +1 -0
  26. package/dist/{sleep-C16NCZR2.mjs → sleep-DAJ9Er57.mjs} +1 -0
  27. package/dist/types/agent-pipeline-settings.d.ts +11 -0
  28. package/package.json +1 -1
  29. package/dist/pipeline/best-settings/demand.d.ts +0 -75
  30. package/dist/pipeline/best-settings/index.d.ts +0 -10
  31. /package/dist/pipeline/{best-settings → auto-tune}/detector-performance.d.ts +0 -0
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-DyF95STh.js");
2
+ const require_sleep = require("./sleep-AalHiRYL.js");
3
3
  const require_event_category = require("./event-category-DmS_tLsU.js");
4
4
  const require_composition = require("./composition-BLWAivB2.js");
5
5
  const require_err_msg = require("./err-msg-Dx2Kor0g.js");
@@ -26870,7 +26870,7 @@ var pipelineExecutorCapability = {
26870
26870
  auth: "admin"
26871
26871
  }),
26872
26872
  /**
26873
- * Best settings (D745): the MODEL-BOUND thresholds (`bindsToModel` keys of
26873
+ * Auto tune (D745): the MODEL-BOUND thresholds (`bindsToModel` keys of
26874
26874
  * the object-detection root, and their binding keys) stored in THIS node's
26875
26875
  * per-camera detector settings — and, unless `dryRun`, remove them so the
26876
26876
  * running model's own defaults apply. Every other key of a camera's store
@@ -27242,115 +27242,21 @@ var pipelineExecutorCapability = {
27242
27242
  }
27243
27243
  };
27244
27244
  //#endregion
27245
- //#region src/pipeline/load-balancing/schemas.ts
27246
- /**
27247
- * Wire shapes of the Load balancing surface (D748): the session placement
27248
- * policy, the atomic share write, the observed placement statistics, the
27249
- * hardware share suggestion and the stale device pins.
27250
- */
27245
+ //#region src/pipeline/auto-tune/plan-schemas.ts
27251
27246
  /**
27252
- * How a new detection session picks its node and device.
27253
- * - `least-loaded` — the historical rule: lowest `attached / weight`, a
27254
- * constant node order at a tie (D37). An idle node always ties at 0, so a
27255
- * weight only bites once a node already holds a session.
27256
- * - `share` — the share of PARALLEL sessions is held to the weights, and a
27257
- * full or drowning node yields to a free one (D748).
27258
- */
27259
- var SessionPlacementPolicySchema = zod.z.enum(["least-loaded", "share"]);
27260
- var DEFAULT_SESSION_PLACEMENT_POLICY = "least-loaded";
27261
- /** The global-settings key the policy is stored under (orchestrator `load` section). */
27262
- var SESSION_PLACEMENT_SETTING_KEY = "sessionPlacement";
27263
- /** Parse a stored value; anything unknown is the default (nothing changes on deploy). */
27264
- function parseSessionPlacementPolicy(value) {
27265
- const parsed = SessionPlacementPolicySchema.safeParse(value);
27266
- return parsed.success ? parsed.data : DEFAULT_SESSION_PLACEMENT_POLICY;
27267
- }
27268
- var LoadBalancingSharesInputSchema = zod.z.object({
27269
- /** nodeId → share (> 0). A node left out keeps its weight. */
27270
- nodes: zod.z.record(zod.z.string(), zod.z.number().positive()).default({}),
27271
- /** nodeId → deviceKey → share (> 0). A device left out keeps its weight. */
27272
- devices: zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.number().positive())).default({})
27273
- });
27274
- var PlacementStatsInputSchema = zod.z.object({
27275
- /** Window the observed shares are averaged over (default 1 h, max 24 h). */
27276
- windowMs: zod.z.number().int().min(6e4).max(1440 * 60 * 1e3).default(3600 * 1e3) });
27277
- var PlacementDeviceStatsSchema = zod.z.object({
27278
- deviceKey: zod.z.string(),
27279
- /** Sessions running on this device now. */
27280
- sessionsNow: zod.z.number(),
27281
- /** Sessions started on this device inside the window. */
27282
- sessionsStarted: zod.z.number(),
27283
- /** Time-weighted share of the node's parallel sessions over the window (0–1); null = no session ran. */
27284
- observedShare: zod.z.number().nullable()
27285
- });
27286
- var PlacementNodeStatsSchema = zod.z.object({
27287
- nodeId: zod.z.string(),
27288
- sessionsNow: zod.z.number(),
27289
- sessionsStarted: zod.z.number(),
27290
- /** Time-weighted share of the cluster's parallel sessions over the window (0–1); null = none ran. */
27291
- observedShare: zod.z.number().nullable(),
27292
- /** Most sessions this node ran at once inside the window. */
27293
- peakSessions: zod.z.number(),
27294
- /** Sessions a share election handed elsewhere because this node was full or drowning. */
27295
- yieldsAway: zod.z.number(),
27296
- devices: zod.z.array(PlacementDeviceStatsSchema).readonly()
27297
- });
27298
- /** A camera's device pin that the session path cannot honour. */
27299
- var StaleDevicePinSchema = zod.z.object({
27300
- deviceId: zod.z.number(),
27301
- deviceKey: zod.z.string(),
27302
- /** `disabled` — the key exists on some node but is not enabled anywhere; `absent` — no node has it. */
27303
- reason: zod.z.enum(["disabled", "absent"])
27304
- });
27305
- var PlacementStatsSchema = zod.z.object({
27306
- policy: SessionPlacementPolicySchema,
27307
- windowMs: zod.z.number(),
27308
- /** How much of the window was actually observed (the hub keeps it in memory). */
27309
- observedForMs: zod.z.number(),
27310
- sessionsNow: zod.z.number(),
27311
- /** Most parallel sessions across the cluster inside the window. */
27312
- clusterPeakSessions: zod.z.number(),
27313
- nodes: zod.z.array(PlacementNodeStatsSchema).readonly(),
27314
- stalePins: zod.z.array(StaleDevicePinSchema).readonly()
27315
- });
27316
- var SuggestSharesInputSchema = zod.z.object({ headroom: zod.z.number().min(.3).max(.5).default(.4) });
27317
- var SuggestedDeviceShareSchema = zod.z.object({
27318
- deviceKey: zod.z.string(),
27319
- /** Share of the node (0–100, rounded). */
27320
- share: zod.z.number(),
27321
- modelId: zod.z.string().nullable(),
27322
- /** Inferences per second at that model, from the measured table. */
27323
- fps: zod.z.number().nullable(),
27324
- measured: zod.z.boolean(),
27325
- /** Advisory session cap: ⌊fps × (1 − headroom) / camera fps⌋. Never enforced. */
27326
- suggestedMaxSessions: zod.z.number().nullable()
27327
- });
27328
- var SuggestedNodeShareSchema = zod.z.object({
27329
- nodeId: zod.z.string(),
27330
- /** Share of the cluster (0–100, rounded); null = node skipped (offline, unknown hardware). */
27331
- share: zod.z.number().nullable(),
27332
- /** Parallel sessions the node sustains at the suggested models with the headroom kept free. */
27333
- capacitySessions: zod.z.number(),
27334
- devices: zod.z.array(SuggestedDeviceShareSchema).readonly(),
27335
- skippedReason: zod.z.string().nullable()
27336
- });
27337
- var SuggestSharesResultSchema = zod.z.object({
27338
- headroom: zod.z.number(),
27339
- /** Camera detection rate the capacity is counted in (the fastest camera's fps). */
27340
- cameraFps: zod.z.number(),
27341
- /** How many share → model → capacity rounds ran before the shares stopped moving (≤ 3). */
27342
- iterations: zod.z.number(),
27343
- nodes: zod.z.array(SuggestedNodeShareSchema).readonly()
27344
- });
27345
- //#endregion
27346
- //#region src/pipeline/best-settings/plan-schemas.ts
27347
- /**
27348
- * The wire shapes of the Best settings plan and apply (D745), used by the
27247
+ * The wire shapes of the Auto tune plan and apply (D745), used by the
27349
27248
  * `pipeline-orchestrator` cap. The recommender's own types
27350
- * (`recommend.ts`, `demand.ts`) are the TS face of the same data; these
27249
+ * (`recommend.ts`) are the TS face of the same data; these
27351
27250
  * schemas are what crosses the cap boundary.
27352
27251
  */
27353
27252
  var ModelFormatSchema$1 = zod.z.enum(MODEL_FORMATS);
27253
+ /** Default least number of parallel sessions per device Auto tune keeps (D755). */
27254
+ var DEFAULT_MIN_SESSIONS_PER_DEVICE = 2;
27255
+ /** The operator's range for it. */
27256
+ var MIN_SESSIONS_PER_DEVICE_RANGE = {
27257
+ min: 1,
27258
+ max: 8
27259
+ };
27354
27260
  var HardwareClassIdSchema = zod.z.enum([
27355
27261
  "intel-core-ultra",
27356
27262
  "intel-n-series",
@@ -27368,8 +27274,9 @@ var AcceleratorKindSchema = zod.z.enum([
27368
27274
  ]);
27369
27275
  var RecommendationReasonSchema = zod.z.discriminatedUnion("kind", [
27370
27276
  zod.z.object({
27371
- kind: zod.z.literal("fits"),
27372
- utilisation: zod.z.number()
27277
+ kind: zod.z.literal("capacity"),
27278
+ sessions: zod.z.number(),
27279
+ minSessions: zod.z.number()
27373
27280
  }),
27374
27281
  zod.z.object({
27375
27282
  kind: zod.z.literal("tie-faster"),
@@ -27384,16 +27291,13 @@ var RecommendationReasonSchema = zod.z.discriminatedUnion("kind", [
27384
27291
  }),
27385
27292
  zod.z.object({
27386
27293
  kind: zod.z.literal("no-fit-lightest"),
27387
- utilisation: zod.z.number()
27294
+ sessions: zod.z.number(),
27295
+ minSessions: zod.z.number()
27388
27296
  }),
27389
27297
  zod.z.object({
27390
27298
  kind: zod.z.literal("derived-latency"),
27391
27299
  modelId: zod.z.string()
27392
27300
  }),
27393
- zod.z.object({
27394
- kind: zod.z.literal("estimated-load"),
27395
- observedForMs: zod.z.number().nullable()
27396
- }),
27397
27301
  zod.z.object({ kind: zod.z.literal("cpu-device") }),
27398
27302
  zod.z.object({ kind: zod.z.literal("coral-untouched") }),
27399
27303
  zod.z.object({ kind: zod.z.literal("device-disabled") }),
@@ -27409,28 +27313,13 @@ var RecommendationReasonSchema = zod.z.discriminatedUnion("kind", [
27409
27313
  format: ModelFormatSchema$1
27410
27314
  })
27411
27315
  ]);
27412
- var DeviceDemandSchema = zod.z.object({
27413
- nodeId: zod.z.string(),
27414
- deviceKey: zod.z.string(),
27415
- demandFps: zod.z.number(),
27416
- maxCameraFps: zod.z.number(),
27417
- alwaysOnCameras: zod.z.number(),
27418
- onMotionSessions: zod.z.number(),
27419
- onMotionSource: zod.z.enum([
27420
- "observed-24h",
27421
- "estimate",
27422
- "none"
27423
- ]),
27424
- observedForMs: zod.z.number().nullable(),
27425
- /** How on-motion sessions were charged: per-device observation, or split by share (D748). */
27426
- placement: SessionPlacementPolicySchema
27427
- });
27428
27316
  var DeviceModelChoiceSchema = zod.z.object({
27429
27317
  modelId: zod.z.string(),
27430
27318
  p50Ms: zod.z.number(),
27431
27319
  fps: zod.z.number(),
27432
27320
  measured: zod.z.boolean(),
27433
- utilisation: zod.z.number(),
27321
+ /** Parallel sessions at the camera rate with the headroom kept free: ⌊fps × (1 − headroom) / camera fps⌋. */
27322
+ capacitySessions: zod.z.number(),
27434
27323
  personRecall: zod.z.number()
27435
27324
  });
27436
27325
  var DeviceRecommendationSchema = zod.z.object({
@@ -27438,7 +27327,6 @@ var DeviceRecommendationSchema = zod.z.object({
27438
27327
  accelerator: AcceleratorKindSchema.nullable(),
27439
27328
  enabled: zod.z.boolean(),
27440
27329
  available: zod.z.boolean(),
27441
- demand: DeviceDemandSchema.nullable(),
27442
27330
  chosen: DeviceModelChoiceSchema.nullable(),
27443
27331
  reasons: zod.z.array(RecommendationReasonSchema).readonly()
27444
27332
  });
@@ -27480,7 +27368,7 @@ var DetectorStoreClearSchema = zod.z.object({
27480
27368
  deviceId: zod.z.number(),
27481
27369
  keys: zod.z.array(zod.z.string()).readonly()
27482
27370
  });
27483
- var BestSettingsWarningSchema = zod.z.discriminatedUnion("kind", [
27371
+ var AutoTuneWarningSchema = zod.z.discriminatedUnion("kind", [
27484
27372
  zod.z.object({
27485
27373
  kind: zod.z.literal("detector-store-cluster-wide"),
27486
27374
  skippedNodes: zod.z.array(zod.z.string()).readonly()
@@ -27495,36 +27383,37 @@ var BestSettingsWarningSchema = zod.z.discriminatedUnion("kind", [
27495
27383
  deviceKey: zod.z.string()
27496
27384
  })
27497
27385
  ]);
27498
- var BestSettingsOptionsSchema = zod.z.object({
27386
+ var AutoTuneOptionsSchema = zod.z.object({
27499
27387
  /** Share of each accelerator's throughput kept free (0.3–0.5). */
27500
27388
  headroom: zod.z.number().min(.3).max(.5).default(.4),
27501
27389
  /**
27502
- * What-if shares (D748): plan as if these node/device shares were stored
27503
- * and the policy were `share`. Absent = the stored shares under the stored
27504
- * policy. A what-if plan is for display; apply always re-plans from what
27505
- * is stored.
27390
+ * The least number of parallel sessions every device must sustain at the
27391
+ * camera rate with the headroom kept free (D755). The most accurate model
27392
+ * that reaches it wins.
27506
27393
  */
27507
- shares: LoadBalancingSharesInputSchema.optional()
27394
+ minSessionsPerDevice: zod.z.number().int().min(MIN_SESSIONS_PER_DEVICE_RANGE.min).max(MIN_SESSIONS_PER_DEVICE_RANGE.max).default(2)
27508
27395
  });
27509
- var BestSettingsPlanSchema = zod.z.object({
27396
+ var AutoTunePlanSchema = zod.z.object({
27510
27397
  /** Hash of everything the apply will write — the apply refuses a different one. */
27511
27398
  planHash: zod.z.string(),
27512
27399
  family: zod.z.literal("yolov9"),
27513
27400
  headroom: zod.z.number(),
27514
- /** Planned under what-if shares (D748): for display — apply refuses it as stale. */
27515
- whatIf: zod.z.boolean(),
27401
+ minSessionsPerDevice: zod.z.number(),
27402
+ /** The detection rate a session is counted at (the fastest camera running the pipeline root). */
27403
+ cameraFps: zod.z.number(),
27516
27404
  generatedAt: zod.z.number(),
27517
27405
  nodes: zod.z.array(NodeRecommendationSchema).readonly(),
27518
27406
  nodeChanges: zod.z.array(NodeDeviceChangeSchema).readonly(),
27519
27407
  cameraClears: zod.z.array(CameraOverrideClearSchema).readonly(),
27520
27408
  detectorStoreClears: zod.z.array(DetectorStoreClearSchema).readonly(),
27521
- warnings: zod.z.array(BestSettingsWarningSchema).readonly()
27409
+ warnings: zod.z.array(AutoTuneWarningSchema).readonly()
27522
27410
  });
27523
- var BestSettingsApplyInputSchema = zod.z.object({
27411
+ var AutoTuneApplyInputSchema = zod.z.object({
27524
27412
  planHash: zod.z.string(),
27525
- headroom: zod.z.number().min(.3).max(.5).default(.4)
27413
+ headroom: zod.z.number().min(.3).max(.5).default(.4),
27414
+ minSessionsPerDevice: zod.z.number().int().min(MIN_SESSIONS_PER_DEVICE_RANGE.min).max(MIN_SESSIONS_PER_DEVICE_RANGE.max).default(2)
27526
27415
  });
27527
- var BestSettingsPhaseResultSchema = zod.z.object({
27416
+ var AutoTunePhaseResultSchema = zod.z.object({
27528
27417
  phase: zod.z.enum([
27529
27418
  "download",
27530
27419
  "camera-overrides",
@@ -27535,19 +27424,19 @@ var BestSettingsPhaseResultSchema = zod.z.object({
27535
27424
  ok: zod.z.boolean(),
27536
27425
  detail: zod.z.string()
27537
27426
  });
27538
- var BestSettingsApplyResultSchema = zod.z.discriminatedUnion("kind", [
27427
+ var AutoTuneApplyResultSchema = zod.z.discriminatedUnion("kind", [
27539
27428
  zod.z.object({
27540
27429
  kind: zod.z.literal("applied"),
27541
27430
  planHash: zod.z.string(),
27542
- phases: zod.z.array(BestSettingsPhaseResultSchema).readonly()
27431
+ phases: zod.z.array(AutoTunePhaseResultSchema).readonly()
27543
27432
  }),
27544
27433
  zod.z.object({
27545
27434
  kind: zod.z.literal("aborted"),
27546
- phases: zod.z.array(BestSettingsPhaseResultSchema).readonly()
27435
+ phases: zod.z.array(AutoTunePhaseResultSchema).readonly()
27547
27436
  }),
27548
27437
  zod.z.object({
27549
27438
  kind: zod.z.literal("stale"),
27550
- plan: BestSettingsPlanSchema
27439
+ plan: AutoTunePlanSchema
27551
27440
  }),
27552
27441
  zod.z.object({
27553
27442
  kind: zod.z.literal("refused"),
@@ -27555,6 +27444,209 @@ var BestSettingsApplyResultSchema = zod.z.discriminatedUnion("kind", [
27555
27444
  })
27556
27445
  ]);
27557
27446
  //#endregion
27447
+ //#region src/pipeline/load-balancing/schemas.ts
27448
+ /**
27449
+ * Wire shapes of the Load balancing surface (D748): the session placement
27450
+ * policy, the atomic share write, the observed placement statistics, the
27451
+ * hardware share suggestion and the stale device pins.
27452
+ */
27453
+ /**
27454
+ * How a new detection session picks its node and device.
27455
+ * - `least-loaded` — the historical rule: lowest `attached / weight`, a
27456
+ * constant node order at a tie (D37). An idle node always ties at 0, so a
27457
+ * weight only bites once a node already holds a session.
27458
+ * - `share` — the share of PARALLEL sessions is held to the weights, and a
27459
+ * full or drowning node yields to a free one (D748).
27460
+ */
27461
+ var SessionPlacementPolicySchema = zod.z.enum(["least-loaded", "share"]);
27462
+ /**
27463
+ * `share` since D750: the percentages are held by default. `least-loaded` stays
27464
+ * selectable.
27465
+ */
27466
+ var DEFAULT_SESSION_PLACEMENT_POLICY = "share";
27467
+ /** The global-settings key the policy is stored under (orchestrator `load` section). */
27468
+ var SESSION_PLACEMENT_SETTING_KEY = "sessionPlacement";
27469
+ /** Parse a stored value; anything unknown is the default. */
27470
+ function parseSessionPlacementPolicy(value) {
27471
+ const parsed = SessionPlacementPolicySchema.safeParse(value);
27472
+ return parsed.success ? parsed.data : DEFAULT_SESSION_PLACEMENT_POLICY;
27473
+ }
27474
+ var LoadBalancingSharesInputSchema = zod.z.object({
27475
+ /** nodeId → share (> 0). A node left out keeps its weight. */
27476
+ nodes: zod.z.record(zod.z.string(), zod.z.number().positive()).default({}),
27477
+ /** nodeId → deviceKey → share (> 0). A device left out keeps its weight. */
27478
+ devices: zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.number().positive())).default({})
27479
+ });
27480
+ var PlacementStatsInputSchema = zod.z.object({
27481
+ /** Window the observed shares are averaged over (default 1 h, max 24 h). */
27482
+ windowMs: zod.z.number().int().min(6e4).max(1440 * 60 * 1e3).default(3600 * 1e3) });
27483
+ var PlacementDeviceStatsSchema = zod.z.object({
27484
+ deviceKey: zod.z.string(),
27485
+ /** Sessions running on this device now. */
27486
+ sessionsNow: zod.z.number(),
27487
+ /** Sessions started on this device inside the window. */
27488
+ sessionsStarted: zod.z.number(),
27489
+ /** Time-weighted share of the node's parallel sessions over the window (0–1); null = no session ran. */
27490
+ observedShare: zod.z.number().nullable()
27491
+ });
27492
+ var PlacementNodeStatsSchema = zod.z.object({
27493
+ nodeId: zod.z.string(),
27494
+ sessionsNow: zod.z.number(),
27495
+ sessionsStarted: zod.z.number(),
27496
+ /** Time-weighted share of the cluster's parallel sessions over the window (0–1); null = none ran. */
27497
+ observedShare: zod.z.number().nullable(),
27498
+ /** Most sessions this node ran at once inside the window. */
27499
+ peakSessions: zod.z.number(),
27500
+ /** Sessions a share election handed elsewhere because this node was full or drowning. */
27501
+ yieldsAway: zod.z.number(),
27502
+ devices: zod.z.array(PlacementDeviceStatsSchema).readonly()
27503
+ });
27504
+ /** A camera's device pin that the session path cannot honour. */
27505
+ var StaleDevicePinSchema = zod.z.object({
27506
+ deviceId: zod.z.number(),
27507
+ deviceKey: zod.z.string(),
27508
+ /** `disabled` — the key exists on some node but is not enabled anywhere; `absent` — no node has it. */
27509
+ reason: zod.z.enum(["disabled", "absent"])
27510
+ });
27511
+ var PlacementStatsSchema = zod.z.object({
27512
+ policy: SessionPlacementPolicySchema,
27513
+ windowMs: zod.z.number(),
27514
+ /** How much of the window was actually observed (the hub keeps it in memory). */
27515
+ observedForMs: zod.z.number(),
27516
+ sessionsNow: zod.z.number(),
27517
+ /** Most parallel sessions across the cluster inside the window. */
27518
+ clusterPeakSessions: zod.z.number(),
27519
+ nodes: zod.z.array(PlacementNodeStatsSchema).readonly(),
27520
+ stalePins: zod.z.array(StaleDevicePinSchema).readonly()
27521
+ });
27522
+ /**
27523
+ * Where an automatic share's capacity comes from (D755).
27524
+ * - `hardware` — the static capacity of each device at its Auto tune model:
27525
+ * the measured latency table for the node's hardware class.
27526
+ * - `benchmark` — the node's own measured capacity (node benchmark results).
27527
+ * A node with no results falls back to `hardware`, and says so.
27528
+ */
27529
+ var CapacitySourceSchema = zod.z.enum(["hardware", "benchmark"]);
27530
+ /** Why a node under the `benchmark` source was sized from hardware instead. */
27531
+ var CapacityFallbackSchema = zod.z.enum(["no-benchmark-results", "partial-benchmark-results"]);
27532
+ var SuggestSharesInputSchema = zod.z.object({
27533
+ headroom: zod.z.number().min(.3).max(.5).default(.4),
27534
+ /** Default `hardware`. */
27535
+ source: CapacitySourceSchema.default("hardware")
27536
+ });
27537
+ var SuggestedDeviceShareSchema = zod.z.object({
27538
+ deviceKey: zod.z.string(),
27539
+ /** Share of the node (0–100, rounded). */
27540
+ share: zod.z.number(),
27541
+ modelId: zod.z.string().nullable(),
27542
+ /** Inferences per second at that model, from the measured table; null when sized by a benchmark. */
27543
+ fps: zod.z.number().nullable(),
27544
+ /** False for a table cell derived from another chip; true for a measured cell or a benchmark. */
27545
+ measured: zod.z.boolean(),
27546
+ /**
27547
+ * Advisory session cap: ⌊fps × (1 − headroom) / camera fps⌋ from the table,
27548
+ * or the benchmark's measured max sessions. Never enforced.
27549
+ */
27550
+ suggestedMaxSessions: zod.z.number().nullable()
27551
+ });
27552
+ var SuggestedNodeShareSchema = zod.z.object({
27553
+ nodeId: zod.z.string(),
27554
+ /** Share of the cluster (0–100, rounded); null = node skipped (offline, unknown hardware). */
27555
+ share: zod.z.number().nullable(),
27556
+ /** Parallel sessions the node sustains at the suggested models with the headroom kept free. */
27557
+ capacitySessions: zod.z.number(),
27558
+ devices: zod.z.array(SuggestedDeviceShareSchema).readonly(),
27559
+ skippedReason: zod.z.string().nullable(),
27560
+ /** What this node's capacity was read from; null when the node is skipped. */
27561
+ capacitySource: CapacitySourceSchema.nullable(),
27562
+ /** Set when the `benchmark` source was asked for and this node used `hardware`. */
27563
+ capacityFallback: CapacityFallbackSchema.nullable()
27564
+ });
27565
+ var SuggestSharesResultSchema = zod.z.object({
27566
+ headroom: zod.z.number(),
27567
+ /** The source asked for; each node says what it actually used. */
27568
+ source: CapacitySourceSchema,
27569
+ /** Camera detection rate the capacity is counted in (the fastest camera's fps). */
27570
+ cameraFps: zod.z.number(),
27571
+ /** The Auto tune capacity floor the models were picked at. */
27572
+ minSessionsPerDevice: zod.z.number(),
27573
+ nodes: zod.z.array(SuggestedNodeShareSchema).readonly()
27574
+ });
27575
+ /**
27576
+ * Where the node and device shares come from (D750, D755).
27577
+ * - `hardware` (default) — computed by the system from each node's static
27578
+ * capacity (its accelerators at their Auto tune models, from the measured
27579
+ * latency table), recomputed whenever a node or device joins, leaves, is
27580
+ * switched on or off, or changes model. No load input.
27581
+ * - `benchmark` — the same, from each node's measured capacity (node
27582
+ * benchmark results); a node without results falls back to `hardware`.
27583
+ * - `manual` — the operator's stored sliders.
27584
+ * Either way a node or device that cannot take sessions gives its share to
27585
+ * the others in proportion; the stored values are never rewritten for that.
27586
+ */
27587
+ var ShareSourceSchema = zod.z.enum([
27588
+ "hardware",
27589
+ "benchmark",
27590
+ "manual"
27591
+ ]);
27592
+ var DEFAULT_SHARE_SOURCE = "hardware";
27593
+ /** `hardware` or `benchmark`: the system computes the shares. */
27594
+ function isAutomaticShareSource(source) {
27595
+ return source !== "manual";
27596
+ }
27597
+ /** Headroom the automatic shares are computed at (Auto tune's default). */
27598
+ var AUTO_SHARE_HEADROOM = .4;
27599
+ /** The global-settings key the share source is stored under (orchestrator `load` section). */
27600
+ var SHARE_SOURCE_SETTING_KEY = "shareSource";
27601
+ /**
27602
+ * Parse a stored value; anything unknown is the default. `auto` (D750, before
27603
+ * D755 split it) reads as `hardware` — that is what it computed.
27604
+ */
27605
+ function parseShareSource(value) {
27606
+ const parsed = ShareSourceSchema.safeParse(value);
27607
+ return parsed.success ? parsed.data : DEFAULT_SHARE_SOURCE;
27608
+ }
27609
+ var SetShareSourceInputSchema = zod.z.object({ source: ShareSourceSchema });
27610
+ /** Raw relative weights (any scale) per node and per node's device. */
27611
+ var ShareWeightsSchema = zod.z.object({
27612
+ nodes: zod.z.record(zod.z.string(), zod.z.number()),
27613
+ devices: zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.number()))
27614
+ });
27615
+ var EffectiveDeviceShareSchema = zod.z.object({
27616
+ deviceKey: zod.z.string(),
27617
+ /** Can take sessions now (enabled, available, can run the root). */
27618
+ eligible: zod.z.boolean(),
27619
+ /** The share the source assigns, as a percentage of the node's devices. */
27620
+ configuredPct: zod.z.number(),
27621
+ /** The share actually used, after an ineligible device's share went to the others. */
27622
+ effectivePct: zod.z.number()
27623
+ });
27624
+ var EffectiveNodeShareSchema = zod.z.object({
27625
+ nodeId: zod.z.string(),
27626
+ eligible: zod.z.boolean(),
27627
+ configuredPct: zod.z.number(),
27628
+ effectivePct: zod.z.number(),
27629
+ /** Automatic sources: what this node's share was computed from; null under `manual` or before the first answer. */
27630
+ capacitySource: CapacitySourceSchema.nullable(),
27631
+ /** Automatic `benchmark`: why this node used `hardware` instead. */
27632
+ capacityFallback: CapacityFallbackSchema.nullable(),
27633
+ devices: zod.z.array(EffectiveDeviceShareSchema).readonly()
27634
+ });
27635
+ var EffectiveSharesSchema = zod.z.object({
27636
+ source: ShareSourceSchema,
27637
+ policy: SessionPlacementPolicySchema,
27638
+ /** An automatic source with no computed answer yet: the stored sliders are used meanwhile. */
27639
+ autoPending: zod.z.boolean(),
27640
+ /** When the automatic shares were last computed (ms epoch); null = never. */
27641
+ computedAt: zod.z.number().nullable(),
27642
+ /** What made the system recompute them last. */
27643
+ trigger: zod.z.string().nullable(),
27644
+ nodes: zod.z.array(EffectiveNodeShareSchema).readonly(),
27645
+ /** The relative weights the election reads (before eligibility). */
27646
+ nodeWeights: zod.z.record(zod.z.string(), zod.z.number()),
27647
+ deviceWeights: zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.number()))
27648
+ });
27649
+ //#endregion
27558
27650
  //#region src/capabilities/schemas/orchestrator-metrics.ts
27559
27651
  /** Shared Zod schemas for the runtime pipeline orchestrator metrics. */
27560
27652
  var OrchestratorMetricsSchema = zod.z.object({
@@ -29167,8 +29259,10 @@ var CameraStepOverridePatchSchema = zod.z.object({
29167
29259
  modelId: zod.z.string().optional(),
29168
29260
  settings: zod.z.record(zod.z.string(), zod.z.unknown()).readonly().optional()
29169
29261
  });
29262
+ var CameraStepSettingsSchema = zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.unknown()).readonly());
29170
29263
  var CameraPipelineSettingsSchema = zod.z.object({
29171
29264
  stepToggles: zod.z.record(zod.z.string(), zod.z.boolean()).optional(),
29265
+ stepSettings: CameraStepSettingsSchema.optional(),
29172
29266
  stepOverridesByDevice: zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), CameraStepOverridePatchSchema))).optional(),
29173
29267
  pipelineByAgent: zod.z.record(zod.z.string(), CameraPipelineForAgentSchema).optional()
29174
29268
  });
@@ -29980,23 +30074,25 @@ var pipelineOrchestratorCapability = {
29980
30074
  auth: "admin"
29981
30075
  }),
29982
30076
  /**
29983
- * Best settings (D745) — DRY RUN. Recommends ONE detector family (YOLOv9)
29984
- * for the whole cluster from each node's static hardware class, the
29985
- * measured latency table and the detection demand, and lists every write
30077
+ * Auto tune (D745, D755) — DRY RUN. Recommends ONE detector family
30078
+ * (YOLOv9) for the whole cluster from each node's static hardware class
30079
+ * and the measured latency table: per device, the most accurate model
30080
+ * that sustains at least `minSessionsPerDevice` parallel sessions at the
30081
+ * camera rate with the headroom kept free (no load input), and lists every write
29986
30082
  * the apply would make: the node model pins set, the enrichment pins and
29987
30083
  * model-bound thresholds removed (node level and per camera), and the
29988
30084
  * per-camera detector thresholds cleared. Writes nothing. Step
29989
30085
  * enablement, device enablement, pins, recording, notifications, zones and
29990
30086
  * rules are never part of it. `planHash` names exactly this diff.
29991
30087
  */
29992
- planBestSettings: require_sleep.method(BestSettingsOptionsSchema, BestSettingsPlanSchema, { auth: "admin" }),
30088
+ planAutoTune: require_sleep.method(AutoTuneOptionsSchema, AutoTunePlanSchema, { auth: "admin" }),
29993
30089
  /**
29994
- * Best settings (D745) — APPLY the plan the operator confirmed. Recomputes
30090
+ * Auto tune (D745) — APPLY the plan the operator confirmed. Recomputes
29995
30091
  * the plan and refuses (`stale`, with the fresh plan) when its hash is not
29996
30092
  * `planHash`, so what is written is exactly the confirmed diff. Offline
29997
30093
  * nodes are skipped; there is no undo.
29998
30094
  */
29999
- applyBestSettings: require_sleep.method(BestSettingsApplyInputSchema, BestSettingsApplyResultSchema, {
30095
+ applyAutoTune: require_sleep.method(AutoTuneApplyInputSchema, AutoTuneApplyResultSchema, {
30000
30096
  kind: "mutation",
30001
30097
  auth: "admin"
30002
30098
  }),
@@ -30021,12 +30117,32 @@ var pipelineOrchestratorCapability = {
30021
30117
  */
30022
30118
  getPlacementStats: require_sleep.method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }),
30023
30119
  /**
30024
- * Load balancing (D748) — shares proportional to each node's measured
30025
- * capacity at the models Best settings would pick, iterated (≤ 3 rounds)
30026
- * until the shares stop moving; per device, an ADVISORY session cap.
30027
- * Writes nothing.
30120
+ * Load balancing (D748, D755) — shares proportional to each node's
30121
+ * capacity in parallel sessions: from the latency table at the models
30122
+ * Auto tune picks (`hardware`), or from node benchmark results
30123
+ * (`benchmark`, each node without results falling back to `hardware` and
30124
+ * saying so). The automatic shares are exactly this answer. Per device,
30125
+ * an ADVISORY session cap. Writes nothing.
30028
30126
  */
30029
30127
  suggestShares: require_sleep.method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }),
30128
+ /**
30129
+ * Load balancing (D750) — the shares placement reads now: the source
30130
+ * (automatic capacity shares or the operator's sliders), each node's and
30131
+ * device's configured share, and the effective share after a node or
30132
+ * device that cannot take sessions gave its share to the others.
30133
+ */
30134
+ getEffectiveShares: require_sleep.method(zod.z.void(), EffectiveSharesSchema, { auth: "admin" }),
30135
+ /**
30136
+ * Load balancing (D750, D755) — switch the share source: `hardware`
30137
+ * (automatic, from static capacity), `benchmark` (automatic, from node
30138
+ * benchmark results) or `manual`. Going manual seeds the sliders with the
30139
+ * current automatic shares (one atomic write), so nothing jumps; going
30140
+ * to an automatic source recomputes at once.
30141
+ */
30142
+ setShareSource: require_sleep.method(SetShareSourceInputSchema, zod.z.object({ success: zod.z.literal(true) }), {
30143
+ kind: "mutation",
30144
+ auth: "admin"
30145
+ }),
30030
30146
  /** Read one camera's settings. Null when never touched (inherits agent defaults fully). */
30031
30147
  getCameraSettings: require_sleep.method(zod.z.object({ deviceId: zod.z.number() }), CameraPipelineSettingsSchema.nullable()),
30032
30148
  /** Set or clear the 3-state toggle for one (camera, addonId). Pass `enabled: null` to clear and revert to agent default. */
@@ -30056,6 +30172,22 @@ var pipelineOrchestratorCapability = {
30056
30172
  kind: "mutation",
30057
30173
  auth: "admin"
30058
30174
  }),
30175
+ /**
30176
+ * Write or clear one step's CAMERA-WIDE settings (D754) — the fields this
30177
+ * camera overrides on every accelerator it runs on. `settings` is the
30178
+ * whole field-level bag for that step (only the overridden keys; a
30179
+ * model-bound field travels with its binding key); `null` or `{}` clears
30180
+ * it. Merged at dispatch between the node base and the per-(node,device)
30181
+ * override, key by key.
30182
+ */
30183
+ setCameraStepSettings: require_sleep.method(zod.z.object({
30184
+ deviceId: zod.z.number(),
30185
+ addonId: zod.z.string(),
30186
+ settings: zod.z.record(zod.z.string(), zod.z.unknown()).nullable()
30187
+ }), zod.z.object({ success: zod.z.literal(true) }), {
30188
+ kind: "mutation",
30189
+ auth: "admin"
30190
+ }),
30059
30191
  /** Write or clear the wholesale per-agent pipeline override. Pass `pipeline: null` to drop the override. */
30060
30192
  setCameraPipelineForAgent: require_sleep.method(zod.z.object({
30061
30193
  deviceId: zod.z.number(),
@@ -56331,7 +56463,7 @@ var METHOD_ACCESS_MAP = Object.freeze({
56331
56463
  addonId: null,
56332
56464
  access: "view"
56333
56465
  },
56334
- "pipelineOrchestrator.applyBestSettings": {
56466
+ "pipelineOrchestrator.applyAutoTune": {
56335
56467
  capName: "pipeline-orchestrator",
56336
56468
  capScope: "system",
56337
56469
  addonId: null,
@@ -56451,6 +56583,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
56451
56583
  addonId: null,
56452
56584
  access: "view"
56453
56585
  },
56586
+ "pipelineOrchestrator.getEffectiveShares": {
56587
+ capName: "pipeline-orchestrator",
56588
+ capScope: "system",
56589
+ addonId: null,
56590
+ access: "view"
56591
+ },
56454
56592
  "pipelineOrchestrator.getGlobalMetrics": {
56455
56593
  capName: "pipeline-orchestrator",
56456
56594
  capScope: "system",
@@ -56517,7 +56655,7 @@ var METHOD_ACCESS_MAP = Object.freeze({
56517
56655
  addonId: null,
56518
56656
  access: "create"
56519
56657
  },
56520
- "pipelineOrchestrator.planBestSettings": {
56658
+ "pipelineOrchestrator.planAutoTune": {
56521
56659
  capName: "pipeline-orchestrator",
56522
56660
  capScope: "system",
56523
56661
  addonId: null,
@@ -56619,6 +56757,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
56619
56757
  addonId: null,
56620
56758
  access: "create"
56621
56759
  },
56760
+ "pipelineOrchestrator.setCameraStepSettings": {
56761
+ capName: "pipeline-orchestrator",
56762
+ capScope: "system",
56763
+ addonId: null,
56764
+ access: "create"
56765
+ },
56622
56766
  "pipelineOrchestrator.setCameraStepToggle": {
56623
56767
  capName: "pipeline-orchestrator",
56624
56768
  capScope: "system",
@@ -56649,6 +56793,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
56649
56793
  addonId: null,
56650
56794
  access: "create"
56651
56795
  },
56796
+ "pipelineOrchestrator.setShareSource": {
56797
+ capName: "pipeline-orchestrator",
56798
+ capScope: "system",
56799
+ addonId: null,
56800
+ access: "create"
56801
+ },
56652
56802
  "pipelineOrchestrator.suggestShares": {
56653
56803
  capName: "pipeline-orchestrator",
56654
56804
  capScope: "system",
@@ -65413,6 +65563,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
65413
65563
  form: "single",
65414
65564
  optional: false
65415
65565
  }],
65566
+ "pipelineOrchestrator.setCameraStepSettings": [{
65567
+ name: "deviceId",
65568
+ form: "single",
65569
+ optional: false
65570
+ }],
65416
65571
  "pipelineOrchestrator.setCameraStepToggle": [{
65417
65572
  name: "deviceId",
65418
65573
  form: "single",
@@ -66397,6 +66552,7 @@ var SYSTEM_SCOPE_DEVICE_METHODS = [
66397
66552
  "pipelineOrchestrator.setCameraPipelineForAgent",
66398
66553
  "pipelineOrchestrator.setCameraSensors",
66399
66554
  "pipelineOrchestrator.setCameraStepOverride",
66555
+ "pipelineOrchestrator.setCameraStepSettings",
66400
66556
  "pipelineOrchestrator.setCameraStepToggle",
66401
66557
  "pipelineOrchestrator.setCameraSwitch",
66402
66558
  "pipelineOrchestrator.setPipelineDevicePin",
@@ -67415,11 +67571,13 @@ function createSystemProxy(api) {
67415
67571
  setAgentInferenceDevices: (input) => dispatch("pipelineOrchestrator", "setAgentInferenceDevices", "mutation", input),
67416
67572
  getNodeInferenceDevices: (input) => dispatch("pipelineOrchestrator", "getNodeInferenceDevices", "query", input),
67417
67573
  resetNodePipelineDefaults: (input) => dispatch("pipelineOrchestrator", "resetNodePipelineDefaults", "mutation", input),
67418
- planBestSettings: (input) => dispatch("pipelineOrchestrator", "planBestSettings", "query", input),
67419
- applyBestSettings: (input) => dispatch("pipelineOrchestrator", "applyBestSettings", "mutation", input),
67574
+ planAutoTune: (input) => dispatch("pipelineOrchestrator", "planAutoTune", "query", input),
67575
+ applyAutoTune: (input) => dispatch("pipelineOrchestrator", "applyAutoTune", "mutation", input),
67420
67576
  setLoadBalancingShares: (input) => dispatch("pipelineOrchestrator", "setLoadBalancingShares", "mutation", input),
67421
67577
  getPlacementStats: (input) => dispatch("pipelineOrchestrator", "getPlacementStats", "query", input),
67422
67578
  suggestShares: (input) => dispatch("pipelineOrchestrator", "suggestShares", "query", input),
67579
+ getEffectiveShares: (input) => dispatch("pipelineOrchestrator", "getEffectiveShares", "query", input),
67580
+ setShareSource: (input) => dispatch("pipelineOrchestrator", "setShareSource", "mutation", input),
67423
67581
  getCameraStatuses: (input) => dispatch("pipelineOrchestrator", "getCameraStatuses", "query", input),
67424
67582
  setCameraSensors: (input) => dispatch("pipelineOrchestrator", "setCameraSensors", "mutation", input),
67425
67583
  reconcileFromDisk: (input) => dispatch("pipelineOrchestrator", "reconcileFromDisk", "mutation", input),
@@ -72383,7 +72541,7 @@ function clearModelBoundOverrides(settings, boundKeys, modelId) {
72383
72541
  /**
72384
72542
  * The keys of every `bindsToModel` field of a step's config schema, groups
72385
72543
  * flattened (D738). One definition for the runner (which applies the binding)
72386
- * and the orchestrator's Best settings (which clears those overrides, D745).
72544
+ * and the orchestrator's Auto tune (which clears those overrides, D745).
72387
72545
  */
72388
72546
  function collectModelBoundKeys(fields) {
72389
72547
  return fields.flatMap((field) => {
@@ -72392,7 +72550,136 @@ function collectModelBoundKeys(fields) {
72392
72550
  });
72393
72551
  }
72394
72552
  //#endregion
72395
- //#region src/pipeline/best-settings/hardware-class.ts
72553
+ //#region src/pipeline/step-settings-layers.ts
72554
+ /**
72555
+ * The layers of a detection step's settings, and the field-level edits on them
72556
+ * (D754).
72557
+ *
72558
+ * A step's settings reach a session through up to three stored layers, merged
72559
+ * key by key — a key in a higher layer wins:
72560
+ *
72561
+ * node the node's folded base (`inferenceDevices[node][*].steps`)
72562
+ * camera `cameraSettings[cam].stepSettings[step]` — every accelerator
72563
+ * accelerator `cameraSettings[cam].stepOverridesByDevice[node][key][step].settings`
72564
+ *
72565
+ * Below them sits the default: the running model's (D738) or the field's own.
72566
+ *
72567
+ * Every layer is SPARSE and FIELD-LEVEL. A key present in a layer is an
72568
+ * override; an absent key inherits. Two consequences that every editor must
72569
+ * respect, and why this module exists:
72570
+ *
72571
+ * - A model-bound field (D738) occupies TWO keys, its value and
72572
+ * `<key>ModelId`. They are written, compared and removed as one unit — a
72573
+ * value without its binding over a lower layer's binding would be judged
72574
+ * against the wrong model.
72575
+ * - An editor writes a DIFF against the merged layers below, never a copy of
72576
+ * them. A copy pins every field at the value it had that day, so later
72577
+ * edits below never reach it (the full-copy "Override" this replaced).
72578
+ */
72579
+ /** Top-down order of the stored layers. */
72580
+ var LAYER_ORDER = [
72581
+ "accelerator",
72582
+ "camera",
72583
+ "node"
72584
+ ];
72585
+ /**
72586
+ * The keys one field occupies in a bag: its own, plus its binding key when it
72587
+ * binds to a model. `boundKeys` = `collectModelBoundKeys(schema)`.
72588
+ */
72589
+ function fieldUnitKeys(key, boundKeys) {
72590
+ return boundKeys.includes(key) ? [key, modelBindingKey(key)] : [key];
72591
+ }
72592
+ /** The field a stored key belongs to (`minConfidencePersonModelId` → `minConfidencePerson`). */
72593
+ function unitOf(storedKey, boundKeys) {
72594
+ return boundKeys.find((k) => modelBindingKey(k) === storedKey) ?? storedKey;
72595
+ }
72596
+ /** Structural equality for stored values (numbers, strings, booleans, arrays, plain objects). */
72597
+ function settingValuesEqual(a, b) {
72598
+ if (Object.is(a, b)) return true;
72599
+ if (Array.isArray(a) && Array.isArray(b)) return a.length === b.length && a.every((v, i) => settingValuesEqual(v, b[i]));
72600
+ if (isPlainObject(a) && isPlainObject(b)) {
72601
+ const ka = Object.keys(a);
72602
+ const kb = Object.keys(b);
72603
+ return ka.length === kb.length && ka.every((k) => settingValuesEqual(a[k], b[k]));
72604
+ }
72605
+ return false;
72606
+ }
72607
+ function isPlainObject(v) {
72608
+ return typeof v === "object" && v !== null && !Array.isArray(v);
72609
+ }
72610
+ /** Merge bags bottom-up (later wins, per key). Fresh object. */
72611
+ function mergeSettingsBags(...bags) {
72612
+ return bags.reduce((acc, bag) => ({
72613
+ ...acc,
72614
+ ...bag
72615
+ }), {});
72616
+ }
72617
+ /** The merged value of the layers BELOW `layer` (what removing a key from `layer` falls back to). */
72618
+ function settingsBelow(layers, layer) {
72619
+ return mergeSettingsBags(...LAYER_ORDER.slice(LAYER_ORDER.indexOf(layer) + 1).toReversed().map((id) => layers[id]));
72620
+ }
72621
+ /** The effective bag: every stored layer merged. */
72622
+ function effectiveStepSettings(layers) {
72623
+ return mergeSettingsBags(layers.node, layers.camera, layers.accelerator);
72624
+ }
72625
+ /** The highest stored layer that holds any key of `key`'s unit, or `default`. */
72626
+ function stepSettingSource(layers, key, boundKeys) {
72627
+ const unit = fieldUnitKeys(key, boundKeys);
72628
+ for (const id of LAYER_ORDER) {
72629
+ const bag = layers[id];
72630
+ if (bag !== void 0 && unit.some((k) => bag[k] !== void 0)) return id;
72631
+ }
72632
+ return "default";
72633
+ }
72634
+ /**
72635
+ * `layer` with `key`'s unit set from `values` (a bag carrying the unit's new
72636
+ * value — e.g. the editor's whole next settings bag). A unit key that `values`
72637
+ * does not carry is removed from the layer. Fresh object.
72638
+ */
72639
+ function withFieldFrom(layer, key, values, boundKeys) {
72640
+ const out = { ...layer };
72641
+ for (const k of fieldUnitKeys(key, boundKeys)) if (values[k] === void 0) delete out[k];
72642
+ else out[k] = values[k];
72643
+ return out;
72644
+ }
72645
+ /** `layer` without `key`'s unit — "reset to the next level". Fresh object. */
72646
+ function withoutField(layer, key, boundKeys) {
72647
+ const out = { ...layer };
72648
+ for (const k of fieldUnitKeys(key, boundKeys)) delete out[k];
72649
+ return out;
72650
+ }
72651
+ /** Every field unit stored in `layer`, by its field key. */
72652
+ function unitsIn(layer, boundKeys) {
72653
+ return [...new Set(Object.keys(layer).map((k) => unitOf(k, boundKeys)))];
72654
+ }
72655
+ /** True when every key of `key`'s unit has the same value in `layer` as in `below`. */
72656
+ function unitEqualsBelow(layer, below, key, boundKeys) {
72657
+ return fieldUnitKeys(key, boundKeys).every((k) => settingValuesEqual(layer[k], below[k]));
72658
+ }
72659
+ /**
72660
+ * `layer` reduced to the fields that DIFFER from `below` — what an editor
72661
+ * stores. A unit is kept or dropped whole. `undefined` when nothing is left.
72662
+ */
72663
+ function diffStepSettings(layer, below, boundKeys) {
72664
+ if (layer === void 0) return void 0;
72665
+ const out = {};
72666
+ for (const unit of unitsIn(layer, boundKeys)) {
72667
+ if (unitEqualsBelow(layer, below, unit, boundKeys)) continue;
72668
+ for (const k of fieldUnitKeys(unit, boundKeys)) if (layer[k] !== void 0) out[k] = layer[k];
72669
+ }
72670
+ return Object.keys(out).length > 0 ? out : void 0;
72671
+ }
72672
+ /**
72673
+ * The fields `layer` stores at exactly the value of the layers below — a
72674
+ * legacy full copy's leftovers. They change nothing today and stop every
72675
+ * later edit below from reaching this layer. Sorted.
72676
+ */
72677
+ function fieldsPinnedAtValueBelow(layer, below, boundKeys) {
72678
+ if (layer === void 0) return [];
72679
+ return unitsIn(layer, boundKeys).filter((unit) => unitEqualsBelow(layer, below, unit, boundKeys)).toSorted();
72680
+ }
72681
+ //#endregion
72682
+ //#region src/pipeline/auto-tune/hardware-class.ts
72396
72683
  var APPLE_CHIP = /^Apple M(\d+)(?:\s+(Pro|Max|Ultra))?\b/i;
72397
72684
  var INTEL_CORE_ULTRA = /Core\(TM\)\s+Ultra|Core Ultra/i;
72398
72685
  var INTEL_N_SERIES = /Intel\(R\)\s+N\d{2,3}\b|\bIntel\s+N\d{2,3}\b/i;
@@ -72448,7 +72735,7 @@ function acceleratorKindOf(deviceKey, hw) {
72448
72735
  return null;
72449
72736
  }
72450
72737
  //#endregion
72451
- //#region src/pipeline/best-settings/detector-performance.ts
72738
+ //#region src/pipeline/auto-tune/detector-performance.ts
72452
72739
  var DETECTOR_PERF = {
72453
72740
  "intel-core-ultra": {
72454
72741
  "intel-npu": {
@@ -72880,149 +73167,32 @@ var DETECTOR_ACCURACY = {
72880
73167
  }
72881
73168
  };
72882
73169
  //#endregion
72883
- //#region src/pipeline/best-settings/demand.ts
72884
- var DEFAULT_DEMAND_OPTIONS = {
72885
- onMotionConcurrency: .25,
72886
- onMotionMinConcurrent: 2
72887
- };
72888
- /** A full observation window. */
72889
- var OBSERVATION_WINDOW_MS = 1440 * 60 * 1e3;
72890
- function deviceId(nodeId, deviceKey) {
72891
- return `${nodeId}\u0000${deviceKey}`;
72892
- }
72893
- function charges(load) {
72894
- return load.mode !== "disabled" && load.runsPipelineRoot && load.fps > 0;
72895
- }
72896
- /** The highest `count` rates, summed. */
72897
- function topRatesSum(rates, count) {
72898
- return rates.toSorted((a, b) => b - a).slice(0, Math.max(0, count)).reduce((sum, r) => sum + r, 0);
72899
- }
72900
- /** Concurrent on-motion sessions assumed cluster-wide without an observation. */
72901
- function estimatedConcurrentSessions(cameraCount, options) {
72902
- if (cameraCount <= 0) return 0;
72903
- const share = Math.ceil(options.onMotionConcurrency * cameraCount);
72904
- return Math.min(cameraCount, Math.max(share, Math.min(cameraCount, options.onMotionMinConcurrent)));
72905
- }
72906
- /**
72907
- * Demand on every eligible device of the cluster.
72908
- */
72909
- function estimateDeviceDemand(input) {
72910
- const options = input.options ?? DEFAULT_DEMAND_OPTIONS;
72911
- const placement = input.shares ? "share" : "least-loaded";
72912
- const eligibleById = new Map(input.eligible.map((d) => [deviceId(d.nodeId, d.deviceKey), d]));
72913
- const peakById = new Map(input.peaks.map((p) => [deviceId(p.nodeId, p.deviceKey), p]));
72914
- const weightByNode = /* @__PURE__ */ new Map();
72915
- const eligibleCountByNode = /* @__PURE__ */ new Map();
72916
- for (const d of input.eligible) {
72917
- weightByNode.set(d.nodeId, (weightByNode.get(d.nodeId) ?? 0) + Math.max(d.weight, 0));
72918
- eligibleCountByNode.set(d.nodeId, (eligibleCountByNode.get(d.nodeId) ?? 0) + 1);
72919
- }
72920
- const pinnedFps = /* @__PURE__ */ new Map();
72921
- const alwaysOnFps = /* @__PURE__ */ new Map();
72922
- const alwaysOnCount = /* @__PURE__ */ new Map();
72923
- const maxFps = /* @__PURE__ */ new Map();
72924
- const onMotionRates = [];
72925
- const bump = (map, key, by) => {
72926
- map.set(key, (map.get(key) ?? 0) + by);
72927
- };
72928
- const noteMax = (key, fps) => {
72929
- maxFps.set(key, Math.max(maxFps.get(key) ?? 0, fps));
72930
- };
72931
- const pinNodeOf = (pin) => {
72932
- if (pin.nodeId !== null) return pin.nodeId;
72933
- const holders = input.eligible.filter((d) => d.deviceKey === pin.deviceKey);
72934
- return holders.length === 1 ? holders[0].nodeId : null;
72935
- };
72936
- let alwaysOnTotal = 0;
72937
- for (const cam of input.cameras) {
72938
- if (!charges(cam)) continue;
72939
- const pinNode = cam.devicePin !== null ? pinNodeOf(cam.devicePin) : null;
72940
- if (cam.devicePin !== null && pinNode !== null) {
72941
- const key = deviceId(pinNode, cam.devicePin.deviceKey);
72942
- if (!eligibleById.has(key)) continue;
72943
- bump(pinnedFps, key, cam.fps);
72944
- noteMax(key, cam.fps);
72945
- continue;
72946
- }
72947
- const standing = cam.mode === "always-on" && cam.standingNodeId !== null ? cam.standingNodeId : cam.nodePinId;
72948
- if (standing !== null) {
72949
- if (cam.mode === "always-on") alwaysOnTotal += 1;
72950
- const nodeWeight = weightByNode.get(standing) ?? 0;
72951
- for (const d of input.eligible) {
72952
- if (d.nodeId !== standing || nodeWeight <= 0) continue;
72953
- const key = deviceId(d.nodeId, d.deviceKey);
72954
- const share = Math.max(d.weight, 0) / nodeWeight;
72955
- bump(alwaysOnFps, key, cam.fps * share);
72956
- bump(alwaysOnCount, key, share);
72957
- noteMax(key, cam.fps);
72958
- }
72959
- continue;
72960
- }
72961
- onMotionRates.push(cam.fps);
72962
- }
72963
- const fastestOnMotion = onMotionRates.reduce((m, r) => Math.max(m, r), 0);
72964
- const nodeCount = weightByNode.size;
72965
- const estimatedTotal = estimatedConcurrentSessions(onMotionRates.length, options);
72966
- const clusterPeak = input.shares?.clusterPeak ?? null;
72967
- const clusterObserved = clusterPeak !== null && clusterPeak.observedForMs >= 864e5;
72968
- const clusterSessions = clusterObserved ? Math.max(0, clusterPeak.peakSessions - alwaysOnTotal) : estimatedTotal;
72969
- const shareSum = [...weightByNode.keys()].reduce((sum, nodeId) => sum + Math.max(input.shares?.nodes[nodeId] ?? 0, 0), 0);
72970
- return input.eligible.map((d) => {
72971
- const key = deviceId(d.nodeId, d.deviceKey);
72972
- const peak = peakById.get(key) ?? (eligibleCountByNode.get(d.nodeId) === 1 ? peakById.get(deviceId(d.nodeId, "")) : void 0);
72973
- const alwaysOn = alwaysOnCount.get(key) ?? 0;
72974
- let onMotionSessions = 0;
72975
- let onMotionSource = "none";
72976
- if (onMotionRates.length > 0 && input.shares !== void 0) {
72977
- const nodeWeight = weightByNode.get(d.nodeId) ?? 0;
72978
- const nodeShare = shareSum > 0 ? Math.max(input.shares.nodes[d.nodeId] ?? 0, 0) / shareSum : 0;
72979
- const deviceShare = nodeWeight > 0 ? Math.max(d.weight, 0) / nodeWeight : 0;
72980
- onMotionSessions = Math.max(0, Math.ceil(clusterSessions * nodeShare * deviceShare - 1e-9));
72981
- onMotionSource = clusterObserved ? "observed-24h" : "estimate";
72982
- } else if (onMotionRates.length > 0) if (peak !== void 0 && peak.observedForMs >= 864e5) {
72983
- onMotionSessions = Math.max(0, Math.round(peak.peakSessions - alwaysOn));
72984
- onMotionSource = "observed-24h";
72985
- } else {
72986
- const nodeWeight = weightByNode.get(d.nodeId) ?? 0;
72987
- const share = nodeCount > 0 && nodeWeight > 0 ? Math.max(d.weight, 0) / nodeWeight / nodeCount : 0;
72988
- onMotionSessions = Math.ceil(estimatedTotal * share);
72989
- onMotionSource = "estimate";
72990
- }
72991
- const demandFps = (pinnedFps.get(key) ?? 0) + (alwaysOnFps.get(key) ?? 0) + topRatesSum(onMotionRates, onMotionSessions);
72992
- return {
72993
- nodeId: d.nodeId,
72994
- deviceKey: d.deviceKey,
72995
- demandFps: Math.round(demandFps * 100) / 100,
72996
- maxCameraFps: Math.max(maxFps.get(key) ?? 0, fastestOnMotion),
72997
- alwaysOnCameras: Math.round(alwaysOn * 100) / 100,
72998
- onMotionSessions,
72999
- onMotionSource,
73000
- observedForMs: input.shares !== void 0 ? clusterPeak?.observedForMs ?? null : peak?.observedForMs ?? null,
73001
- placement
73002
- };
73003
- }).toSorted((a, b) => a.nodeId === b.nodeId ? a.deviceKey.localeCompare(b.deviceKey) : a.nodeId.localeCompare(b.nodeId));
73004
- }
73005
- //#endregion
73006
- //#region src/pipeline/best-settings/recommend.ts
73170
+ //#region src/pipeline/auto-tune/recommend.ts
73007
73171
  /** The family the cluster runs. */
73008
- var BEST_SETTINGS_FAMILY = "yolov9";
73172
+ var AUTO_TUNE_FAMILY = "yolov9";
73009
73173
  /** Recall within this of the best counts as a tie — the faster one wins. */
73010
73174
  var RECALL_TIE = .02;
73011
73175
  /** Default share of an accelerator's throughput kept free. */
73012
73176
  var DEFAULT_HEADROOM = .4;
73177
+ /** Detection rate a session is counted at when no camera says otherwise. */
73178
+ var DEFAULT_CAMERA_FPS = 10;
73179
+ /** Parallel sessions one device sustains at `fps` with `headroom` kept free. */
73180
+ function capacitySessionsOf(fps, headroom, cameraFps) {
73181
+ if (!(fps > 0) || !(cameraFps > 0)) return 0;
73182
+ return Math.max(0, Math.floor(fps * (1 - headroom) / cameraFps + 1e-9));
73183
+ }
73013
73184
  function round(value, digits = 3) {
73014
73185
  const f = 10 ** digits;
73015
73186
  return Math.round(value * f) / f;
73016
73187
  }
73017
- function utilisationOf(cell, demand) {
73018
- return cell.fps > 0 ? round((demand?.demandFps ?? 0) / cell.fps) : Number.POSITIVE_INFINITY;
73188
+ function sessionsOn(cell, sizing) {
73189
+ return cell === void 0 ? 0 : capacitySessionsOf(cell.fps, sizing.headroom, sizing.cameraFps);
73019
73190
  }
73020
- function fitsOn(cell, demand, headroom) {
73021
- const budget = cell.fps * (1 - headroom);
73022
- return budget >= (demand?.demandFps ?? 0) && budget >= (demand?.maxCameraFps ?? 0);
73191
+ function fitsOn(cell, sizing) {
73192
+ return sessionsOn(cell, sizing) >= sizing.minSessions;
73023
73193
  }
73024
73194
  function candidatesFor(contexts, formatsByModel) {
73025
- return Object.keys(DETECTOR_ACCURACY).filter((id) => id.startsWith(BEST_SETTINGS_FAMILY)).filter((id) => contexts.every((c) => c.column[id] !== void 0 && (formatsByModel[id] ?? []).includes(c.device.format))).map((id) => ({
73195
+ return Object.keys(DETECTOR_ACCURACY).filter((id) => id.startsWith(AUTO_TUNE_FAMILY)).filter((id) => contexts.every((c) => c.column[id] !== void 0 && (formatsByModel[id] ?? []).includes(c.device.format))).map((id) => ({
73026
73196
  modelId: id,
73027
73197
  personRecall: DETECTOR_ACCURACY[id]?.personRecall ?? 0
73028
73198
  })).toSorted((a, b) => b.personRecall - a.personRecall || a.modelId.localeCompare(b.modelId));
@@ -73030,28 +73200,24 @@ function candidatesFor(contexts, formatsByModel) {
73030
73200
  function totalLatency(contexts, modelId) {
73031
73201
  return contexts.reduce((sum, c) => sum + (c.column[modelId]?.p50Ms ?? Number.POSITIVE_INFINITY), 0);
73032
73202
  }
73033
- function worstUtilisation(contexts, modelId) {
73034
- return contexts.reduce((worst, c) => {
73035
- const cell = c.column[modelId];
73036
- return Math.max(worst, cell ? utilisationOf(cell, c.demand) : Number.POSITIVE_INFINITY);
73037
- }, 0);
73203
+ /** The fewest sessions any device of the group sustains with this model. */
73204
+ function worstSessions(contexts, modelId, sizing) {
73205
+ return contexts.reduce((worst, c) => Math.min(worst, sessionsOn(c.column[modelId], sizing)), Number.POSITIVE_INFINITY);
73038
73206
  }
73039
73207
  /** One model for a group of devices that must agree (step 2–4 of the header). */
73040
- function pickForGroup(contexts, formatsByModel, headroom) {
73208
+ function pickForGroup(contexts, formatsByModel, sizing) {
73041
73209
  const candidates = candidatesFor(contexts, formatsByModel);
73042
73210
  if (candidates.length === 0) return null;
73043
- const fitting = candidates.filter((c) => contexts.every((ctx) => {
73044
- const cell = ctx.column[c.modelId];
73045
- return cell !== void 0 && fitsOn(cell, ctx.demand, headroom);
73046
- }));
73211
+ const fitting = candidates.filter((c) => contexts.every((ctx) => fitsOn(ctx.column[c.modelId], sizing)));
73047
73212
  if (fitting.length === 0) {
73048
- const lightest = candidates.toSorted((a, b) => worstUtilisation(contexts, a.modelId) - worstUtilisation(contexts, b.modelId))[0];
73213
+ const lightest = candidates.toSorted((a, b) => worstSessions(contexts, b.modelId, sizing) - worstSessions(contexts, a.modelId, sizing) || totalLatency(contexts, a.modelId) - totalLatency(contexts, b.modelId))[0];
73049
73214
  if (lightest === void 0) return null;
73050
73215
  return {
73051
73216
  modelId: lightest.modelId,
73052
73217
  reasons: [{
73053
73218
  kind: "no-fit-lightest",
73054
- utilisation: worstUtilisation(contexts, lightest.modelId)
73219
+ sessions: worstSessions(contexts, lightest.modelId, sizing),
73220
+ minSessions: sizing.minSessions
73055
73221
  }]
73056
73222
  };
73057
73223
  }
@@ -73061,10 +73227,7 @@ function pickForGroup(contexts, formatsByModel, headroom) {
73061
73227
  const reasons = [];
73062
73228
  const mostAccurate = candidates[0];
73063
73229
  if (mostAccurate !== void 0 && mostAccurate.modelId !== best.modelId) {
73064
- const limitedBy = contexts.find((ctx) => {
73065
- const cell = ctx.column[mostAccurate.modelId];
73066
- return cell === void 0 || !fitsOn(cell, ctx.demand, headroom);
73067
- })?.device.key ?? "";
73230
+ const limitedBy = contexts.find((ctx) => !fitsOn(ctx.column[mostAccurate.modelId], sizing))?.device.key ?? "";
73068
73231
  reasons.push({
73069
73232
  kind: "stepped-down",
73070
73233
  from: mostAccurate.modelId,
@@ -73082,7 +73245,7 @@ function pickForGroup(contexts, formatsByModel, headroom) {
73082
73245
  reasons
73083
73246
  };
73084
73247
  }
73085
- function choiceOn(ctx, modelId) {
73248
+ function choiceOn(ctx, modelId, sizing) {
73086
73249
  const cell = ctx.column[modelId];
73087
73250
  if (cell === void 0) return null;
73088
73251
  return {
@@ -73090,23 +73253,20 @@ function choiceOn(ctx, modelId) {
73090
73253
  p50Ms: cell.p50Ms,
73091
73254
  fps: cell.fps,
73092
73255
  measured: cell.measured,
73093
- utilisation: utilisationOf(cell, ctx.demand),
73256
+ capacitySessions: sessionsOn(cell, sizing),
73094
73257
  personRecall: DETECTOR_ACCURACY[modelId]?.personRecall ?? 0
73095
73258
  };
73096
73259
  }
73097
- function deviceReasonsFor(ctx, choice) {
73260
+ function deviceReasonsFor(choice, sizing) {
73098
73261
  const out = [{
73099
- kind: "fits",
73100
- utilisation: choice.utilisation
73262
+ kind: "capacity",
73263
+ sessions: choice.capacitySessions,
73264
+ minSessions: sizing.minSessions
73101
73265
  }];
73102
73266
  if (!choice.measured) out.push({
73103
73267
  kind: "derived-latency",
73104
73268
  modelId: choice.modelId
73105
73269
  });
73106
- if (ctx.demand?.onMotionSource === "estimate") out.push({
73107
- kind: "estimated-load",
73108
- observedForMs: ctx.demand.observedForMs
73109
- });
73110
73270
  return out;
73111
73271
  }
73112
73272
  function skippedNode(node, reason, hardwareClass) {
@@ -73122,7 +73282,6 @@ function skippedNode(node, reason, hardwareClass) {
73122
73282
  accelerator: node.hardware ? acceleratorKindOf(d.key, node.hardware) : null,
73123
73283
  enabled: d.enabled,
73124
73284
  available: d.available,
73125
- demand: null,
73126
73285
  chosen: null,
73127
73286
  reasons: []
73128
73287
  })),
@@ -73132,7 +73291,11 @@ function skippedNode(node, reason, hardwareClass) {
73132
73291
  /** Recommend one node. See the module header. */
73133
73292
  function recommendNode(input) {
73134
73293
  const { node } = input;
73135
- const headroom = input.headroom ?? .4;
73294
+ const sizing = {
73295
+ headroom: input.headroom ?? .4,
73296
+ cameraFps: input.cameraFps ?? 10,
73297
+ minSessions: input.minSessionsPerDevice ?? 2
73298
+ };
73136
73299
  const perf = input.perf ?? DETECTOR_PERF;
73137
73300
  if (!node.reachable) return skippedNode(node, { kind: "node-offline" }, null);
73138
73301
  if (node.hardware === null) return skippedNode(node, { kind: "no-hardware-facts" }, null);
@@ -73143,7 +73306,6 @@ function recommendNode(input) {
73143
73306
  kind: "no-measured-data",
73144
73307
  hardwareClass
73145
73308
  }, hardwareClass);
73146
- const demandByKey = new Map(input.demand.filter((d) => d.nodeId === node.nodeId).map((d) => [d.deviceKey, d]));
73147
73309
  const devices = node.devices.toSorted((a, b) => a.key.localeCompare(b.key));
73148
73310
  const contexts = /* @__PURE__ */ new Map();
73149
73311
  const early = /* @__PURE__ */ new Map();
@@ -73172,8 +73334,7 @@ function recommendNode(input) {
73172
73334
  contexts.set(device.key, {
73173
73335
  device,
73174
73336
  accelerator,
73175
- column,
73176
- demand: demandByKey.get(device.key) ?? null
73337
+ column
73177
73338
  });
73178
73339
  }
73179
73340
  const isCpu = (a) => a === "x86-cpu" || a === "arm-cpu";
@@ -73183,23 +73344,23 @@ function recommendNode(input) {
73183
73344
  const reasonsByKey = /* @__PURE__ */ new Map();
73184
73345
  const nodeReasons = [];
73185
73346
  let acceleratorModelId = null;
73186
- const groupPick = accelerators.length > 0 ? pickForGroup(accelerators, node.formatsByModel, headroom) : null;
73347
+ const groupPick = accelerators.length > 0 ? pickForGroup(accelerators, node.formatsByModel, sizing) : null;
73187
73348
  if (groupPick !== null) {
73188
73349
  acceleratorModelId = groupPick.modelId;
73189
73350
  nodeReasons.push(...groupPick.reasons);
73190
73351
  for (const ctx of accelerators) {
73191
- const choice = choiceOn(ctx, groupPick.modelId);
73352
+ const choice = choiceOn(ctx, groupPick.modelId, sizing);
73192
73353
  if (choice === null) continue;
73193
73354
  chosenByKey.set(ctx.device.key, choice);
73194
- reasonsByKey.set(ctx.device.key, deviceReasonsFor(ctx, choice));
73355
+ reasonsByKey.set(ctx.device.key, deviceReasonsFor(choice, sizing));
73195
73356
  }
73196
73357
  } else for (const ctx of accelerators) reasonsByKey.set(ctx.device.key, [{
73197
73358
  kind: "no-family-build",
73198
73359
  format: ctx.device.format
73199
73360
  }]);
73200
73361
  for (const ctx of cpus) {
73201
- const pick = pickForGroup([ctx], node.formatsByModel, headroom);
73202
- const choice = pick === null ? null : choiceOn(ctx, pick.modelId);
73362
+ const pick = pickForGroup([ctx], node.formatsByModel, sizing);
73363
+ const choice = pick === null ? null : choiceOn(ctx, pick.modelId, sizing);
73203
73364
  if (pick === null || choice === null) {
73204
73365
  reasonsByKey.set(ctx.device.key, [{
73205
73366
  kind: "no-family-build",
@@ -73211,7 +73372,7 @@ function recommendNode(input) {
73211
73372
  reasonsByKey.set(ctx.device.key, [
73212
73373
  { kind: "cpu-device" },
73213
73374
  ...pick.reasons,
73214
- ...deviceReasonsFor(ctx, choice)
73375
+ ...deviceReasonsFor(choice, sizing)
73215
73376
  ]);
73216
73377
  }
73217
73378
  return {
@@ -73226,7 +73387,6 @@ function recommendNode(input) {
73226
73387
  accelerator: acceleratorKindOf(device.key, hardware),
73227
73388
  enabled: device.enabled,
73228
73389
  available: device.available,
73229
- demand: demandByKey.get(device.key) ?? null,
73230
73390
  chosen: chosenByKey.get(device.key) ?? null,
73231
73391
  reasons: early.get(device.key) ?? reasonsByKey.get(device.key) ?? []
73232
73392
  })),
@@ -73276,6 +73436,208 @@ function electByShare(candidates) {
73276
73436
  };
73277
73437
  }
73278
73438
  //#endregion
73439
+ //#region src/pipeline/load-balancing/effective-shares.ts
73440
+ /**
73441
+ * The shares a session election actually reads, and the view the Load
73442
+ * balancing tab shows (D750). Pure.
73443
+ *
73444
+ * The SOURCE decides the configured weights: the automatic capacity shares
73445
+ * (`hardware` or `benchmark`, D755), or the operator's stored sliders. Eligibility decides the effective ones: a
73446
+ * node or device that cannot take a session now (offline, switched off, no
73447
+ * detect capability, unable to run the root) contributes nothing, and the
73448
+ * others split its share in proportion to their own. That redistribution is
73449
+ * exactly what `electByShare` does over its candidate set, so the view and
73450
+ * the election cannot disagree; the stored values are never rewritten for it.
73451
+ */
73452
+ /** Weight a node or device has when its source names none (the balancer's own default). */
73453
+ var DEFAULT_WEIGHT = 1;
73454
+ function positive(value) {
73455
+ return value !== void 0 && value > 0 ? value : DEFAULT_WEIGHT;
73456
+ }
73457
+ function percentages(keys, weightOf, counts) {
73458
+ const total = keys.reduce((sum, k) => sum + (counts(k) ? weightOf(k) : 0), 0);
73459
+ return new Map(keys.map((k) => [k, total > 0 && counts(k) ? Math.round(weightOf(k) / total * 1e3) / 10 : 0]));
73460
+ }
73461
+ function resolveEffectiveShares(input) {
73462
+ const useAuto = isAutomaticShareSource(input.source) && input.auto !== null;
73463
+ const weights = useAuto && input.auto !== null ? input.auto : input.stored;
73464
+ const nodeWeights = {};
73465
+ for (const nodeId of input.nodeIds) nodeWeights[nodeId] = positive(weights.nodes[nodeId]);
73466
+ const eligibleNodes = new Set(input.eligibleNodes);
73467
+ const configured = percentages(input.nodeIds, (k) => nodeWeights[k] ?? DEFAULT_WEIGHT, () => true);
73468
+ const effective = percentages(input.nodeIds, (k) => nodeWeights[k] ?? DEFAULT_WEIGHT, (k) => eligibleNodes.has(k));
73469
+ const deviceWeights = {};
73470
+ const nodes = input.nodeIds.map((nodeId) => {
73471
+ const eligibleKeys = new Set(input.eligibleDevices[nodeId] ?? []);
73472
+ const named = weights.devices[nodeId] ?? {};
73473
+ const keys = [...new Set([...Object.keys(named), ...eligibleKeys])].toSorted();
73474
+ const perDevice = {};
73475
+ for (const key of keys) perDevice[key] = positive(named[key]);
73476
+ if (keys.length > 0) deviceWeights[nodeId] = perDevice;
73477
+ const devConfigured = percentages(keys, (k) => perDevice[k] ?? DEFAULT_WEIGHT, () => true);
73478
+ const devEffective = percentages(keys, (k) => perDevice[k] ?? DEFAULT_WEIGHT, (k) => eligibleNodes.has(nodeId) && eligibleKeys.has(k));
73479
+ const devices = keys.map((deviceKey) => ({
73480
+ deviceKey,
73481
+ eligible: eligibleKeys.has(deviceKey),
73482
+ configuredPct: devConfigured.get(deviceKey) ?? 0,
73483
+ effectivePct: devEffective.get(deviceKey) ?? 0
73484
+ }));
73485
+ const capacity = useAuto ? input.autoCapacity?.[nodeId] : void 0;
73486
+ return {
73487
+ nodeId,
73488
+ eligible: eligibleNodes.has(nodeId),
73489
+ configuredPct: configured.get(nodeId) ?? 0,
73490
+ effectivePct: effective.get(nodeId) ?? 0,
73491
+ capacitySource: capacity?.source ?? null,
73492
+ capacityFallback: capacity?.fallback ?? null,
73493
+ devices
73494
+ };
73495
+ });
73496
+ return {
73497
+ source: input.source,
73498
+ policy: input.policy ?? "share",
73499
+ autoPending: isAutomaticShareSource(input.source) && input.auto === null,
73500
+ computedAt: input.computedAt ?? null,
73501
+ trigger: input.trigger ?? null,
73502
+ nodes,
73503
+ nodeWeights,
73504
+ deviceWeights
73505
+ };
73506
+ }
73507
+ //#endregion
73508
+ //#region src/pipeline/load-balancing/capacity-shares.ts
73509
+ /**
73510
+ * Automatic shares from CAPACITY (D755). Pure.
73511
+ *
73512
+ * A node's share is its capacity in parallel sessions over the cluster's; a
73513
+ * device's share inside its node follows its throughput. There is no load
73514
+ * input: nothing here depends on how many sessions ran, only on what each
73515
+ * node can carry.
73516
+ *
73517
+ * Two places a capacity can come from:
73518
+ * - `hardware` — each enabled accelerator at its Auto tune model, from the
73519
+ * measured latency table: ⌊fps × (1 − headroom) / camera fps⌋ sessions;
73520
+ * - `benchmark` — the node's own measured max sessions per device, read
73521
+ * through a {@link NodeCapacitySource}. A node whose results do not cover
73522
+ * every enabled device it would be sized on is sized from `hardware`
73523
+ * instead, and the answer says so per node — never a silent mix.
73524
+ */
73525
+ /** A source that has no results — the benchmark store before it exists. */
73526
+ var NO_MEASURED_CAPACITY = { readMeasuredCapacity: async () => /* @__PURE__ */ new Map() };
73527
+ /** Integer shares summing to 100 (largest remainder); ties broken by key. */
73528
+ function toPercentShares(weights) {
73529
+ const total = [...weights.values()].reduce((a, b) => a + b, 0);
73530
+ const out = /* @__PURE__ */ new Map();
73531
+ if (total <= 0) return out;
73532
+ const raw = [...weights].map(([k, w]) => ({
73533
+ k,
73534
+ exact: w / total * 100
73535
+ }));
73536
+ let assigned = 0;
73537
+ for (const r of raw) {
73538
+ out.set(r.k, Math.floor(r.exact));
73539
+ assigned += Math.floor(r.exact);
73540
+ }
73541
+ const remainder = (exact) => Math.round((exact - Math.floor(exact)) * 1e6);
73542
+ const byRemainder = raw.toSorted((a, b) => remainder(b.exact) - remainder(a.exact) || a.k.localeCompare(b.k));
73543
+ for (let i = 0; i < 100 - assigned; i++) {
73544
+ const r = byRemainder[i % byRemainder.length];
73545
+ if (r === void 0) break;
73546
+ out.set(r.k, (out.get(r.k) ?? 0) + 1);
73547
+ }
73548
+ return out;
73549
+ }
73550
+ function hardwareDevices(rec, headroom, cameraFps) {
73551
+ return rec.devices.filter((d) => d.enabled && d.available && d.chosen !== null).map((d) => {
73552
+ const fps = d.chosen?.fps ?? 0;
73553
+ return {
73554
+ deviceKey: d.deviceKey,
73555
+ sessions: capacitySessionsOf(fps, headroom, cameraFps),
73556
+ weight: Math.max(fps, 0),
73557
+ modelId: d.chosen?.modelId ?? null,
73558
+ fps: d.chosen?.fps ?? null,
73559
+ measured: d.chosen?.measured ?? false
73560
+ };
73561
+ });
73562
+ }
73563
+ function sizeNode(rec, input) {
73564
+ const fromHardware = (fallback) => {
73565
+ const devices = rec.skipped ? [] : hardwareDevices(rec, input.headroom, input.cameraFps);
73566
+ const capacity = devices.reduce((sum, d) => sum + d.sessions, 0);
73567
+ return {
73568
+ rec,
73569
+ devices,
73570
+ capacitySource: rec.skipped ? null : "hardware",
73571
+ capacityFallback: rec.skipped ? null : fallback,
73572
+ skippedReason: rec.skipped ? rec.reasons[0]?.kind ?? "skipped" : capacity > 0 ? null : "no-capacity"
73573
+ };
73574
+ };
73575
+ if (input.source === "hardware") return fromHardware(null);
73576
+ if (!rec.reachable) return fromHardware(null);
73577
+ const results = input.measured.get(rec.nodeId);
73578
+ const byKey = new Map((results?.devices ?? []).map((d) => [d.deviceKey, d]));
73579
+ const usable = rec.devices.filter((d) => d.enabled && d.available);
73580
+ const mustCover = rec.devices.filter((d) => d.enabled && d.available && d.chosen !== null);
73581
+ const covered = usable.filter((d) => byKey.has(d.deviceKey));
73582
+ if (covered.length === 0) return fromHardware("no-benchmark-results");
73583
+ if (mustCover.some((d) => !byKey.has(d.deviceKey))) return fromHardware("partial-benchmark-results");
73584
+ const devices = covered.map((d) => {
73585
+ const row = byKey.get(d.deviceKey);
73586
+ const sessions = Math.max(0, Math.floor(row?.maxSessions ?? 0));
73587
+ return {
73588
+ deviceKey: d.deviceKey,
73589
+ sessions,
73590
+ weight: sessions,
73591
+ modelId: row?.modelId ?? null,
73592
+ fps: null,
73593
+ measured: true
73594
+ };
73595
+ });
73596
+ return {
73597
+ rec,
73598
+ devices,
73599
+ capacitySource: "benchmark",
73600
+ capacityFallback: null,
73601
+ skippedReason: devices.reduce((sum, d) => sum + d.sessions, 0) > 0 ? null : "no-capacity"
73602
+ };
73603
+ }
73604
+ /** Shares proportional to capacity — the automatic shares and the suggestion are this. */
73605
+ function computeCapacityShares(input) {
73606
+ const sized = input.recommendations.map((rec) => sizeNode(rec, input));
73607
+ const capacityByNode = /* @__PURE__ */ new Map();
73608
+ for (const node of sized) {
73609
+ const capacity = node.devices.reduce((sum, d) => sum + d.sessions, 0);
73610
+ if (node.skippedReason === null && capacity > 0) capacityByNode.set(node.rec.nodeId, capacity);
73611
+ }
73612
+ const nodePct = toPercentShares(capacityByNode);
73613
+ const nodes = sized.map((node) => {
73614
+ const devicePct = toPercentShares(new Map(node.devices.map((d) => [d.deviceKey, d.weight])));
73615
+ return {
73616
+ nodeId: node.rec.nodeId,
73617
+ share: nodePct.get(node.rec.nodeId) ?? null,
73618
+ capacitySessions: node.devices.reduce((sum, d) => sum + d.sessions, 0),
73619
+ skippedReason: node.skippedReason,
73620
+ capacitySource: node.capacitySource,
73621
+ capacityFallback: node.capacityFallback,
73622
+ devices: node.devices.map((d) => ({
73623
+ deviceKey: d.deviceKey,
73624
+ share: devicePct.get(d.deviceKey) ?? 0,
73625
+ modelId: d.modelId,
73626
+ fps: d.fps,
73627
+ measured: d.measured,
73628
+ suggestedMaxSessions: d.sessions
73629
+ }))
73630
+ };
73631
+ });
73632
+ return {
73633
+ headroom: input.headroom,
73634
+ source: input.source,
73635
+ cameraFps: input.cameraFps,
73636
+ minSessionsPerDevice: input.minSessionsPerDevice,
73637
+ nodes
73638
+ };
73639
+ }
73640
+ //#endregion
73279
73641
  //#region src/pipeline/root-face-crop.ts
73280
73642
  /** Side of the square, as a multiple of the face box's longer side. */
73281
73643
  var ROOT_FACE_REFINE_SCALE = 1.6;
@@ -75420,6 +75782,8 @@ exports.AUDIO_PRESETS = require_composition.AUDIO_PRESETS;
75420
75782
  exports.AUDIO_SCALE_EPOCH_ISO = AUDIO_SCALE_EPOCH_ISO;
75421
75783
  exports.AUDIO_SCALE_EPOCH_MS = AUDIO_SCALE_EPOCH_MS;
75422
75784
  exports.AUTOMATIC_HUB_ADDRESS_FLAGS = AUTOMATIC_HUB_ADDRESS_FLAGS;
75785
+ exports.AUTO_SHARE_HEADROOM = AUTO_SHARE_HEADROOM;
75786
+ exports.AUTO_TUNE_FAMILY = AUTO_TUNE_FAMILY;
75423
75787
  exports.AcceleratorKindSchema = AcceleratorKindSchema;
75424
75788
  exports.AccessoriesStatusSchema = AccessoriesStatusSchema;
75425
75789
  exports.AccessoryKind = AccessoryKind;
@@ -75487,6 +75851,12 @@ exports.AudioMetricsSnapshotSchema = AudioMetricsSnapshotSchema;
75487
75851
  exports.AudioPcmChunkSchema = AudioPcmChunkSchema;
75488
75852
  exports.AudioStreamPickSchema = require_sleep.AudioStreamPickSchema;
75489
75853
  exports.AuthResultSchema = AuthResultSchema;
75854
+ exports.AutoTuneApplyInputSchema = AutoTuneApplyInputSchema;
75855
+ exports.AutoTuneApplyResultSchema = AutoTuneApplyResultSchema;
75856
+ exports.AutoTuneOptionsSchema = AutoTuneOptionsSchema;
75857
+ exports.AutoTunePhaseResultSchema = AutoTunePhaseResultSchema;
75858
+ exports.AutoTunePlanSchema = AutoTunePlanSchema;
75859
+ exports.AutoTuneWarningSchema = AutoTuneWarningSchema;
75490
75860
  exports.AutoUpdateSettingsSchema = AutoUpdateSettingsSchema;
75491
75861
  exports.AutomationActionSchema = AutomationActionSchema;
75492
75862
  exports.AutomationConditionOperatorSchema = AutomationConditionOperatorSchema;
@@ -75499,7 +75869,6 @@ exports.BASE_DEVICE_CAPS = BASE_DEVICE_CAPS;
75499
75869
  exports.BASE_LIVE_EGRESS_PROFILE = BASE_LIVE_EGRESS_PROFILE;
75500
75870
  exports.BATTERY_DEVICE_PROFILE = BATTERY_DEVICE_PROFILE;
75501
75871
  exports.BATTERY_UNREACHABLE_AFTER_MS = BATTERY_UNREACHABLE_AFTER_MS;
75502
- exports.BEST_SETTINGS_FAMILY = BEST_SETTINGS_FAMILY;
75503
75872
  exports.BIRTH_DECISION_DEFAULT_LIMIT = BIRTH_DECISION_DEFAULT_LIMIT;
75504
75873
  exports.BOOT_RECOVERY_BACKOFF_MS = require_sleep.BOOT_RECOVERY_BACKOFF_MS;
75505
75874
  exports.BUILTIN_RESULT_KINDS = BUILTIN_RESULT_KINDS;
@@ -75515,12 +75884,6 @@ exports.BaseAddon = require_sleep.BaseAddon;
75515
75884
  exports.BaseDevice = BaseDevice;
75516
75885
  exports.BaseDeviceProvider = BaseDeviceProvider;
75517
75886
  exports.BatteryStatusSchema = BatteryStatusSchema;
75518
- exports.BestSettingsApplyInputSchema = BestSettingsApplyInputSchema;
75519
- exports.BestSettingsApplyResultSchema = BestSettingsApplyResultSchema;
75520
- exports.BestSettingsOptionsSchema = BestSettingsOptionsSchema;
75521
- exports.BestSettingsPhaseResultSchema = BestSettingsPhaseResultSchema;
75522
- exports.BestSettingsPlanSchema = BestSettingsPlanSchema;
75523
- exports.BestSettingsWarningSchema = BestSettingsWarningSchema;
75524
75887
  exports.BinaryStatusSchema = BinaryStatusSchema;
75525
75888
  exports.BirthDecisionQueryInputSchema = BirthDecisionQueryInputSchema;
75526
75889
  exports.BirthDecisionRecordSchema = BirthDecisionRecordSchema;
@@ -75652,6 +76015,8 @@ exports.CameraSwitchWarningSchema = CameraSwitchWarningSchema;
75652
76015
  exports.CandidateQueryFilterSchema = CandidateQueryFilterSchema;
75653
76016
  exports.CapScopeSchema = CapScopeSchema;
75654
76017
  exports.CapabilityBindingsSchema = CapabilityBindingsSchema;
76018
+ exports.CapacityFallbackSchema = CapacityFallbackSchema;
76019
+ exports.CapacitySourceSchema = CapacitySourceSchema;
75655
76020
  exports.CarbonMonoxideStatusSchema = CarbonMonoxideStatusSchema;
75656
76021
  exports.ChargingStatus = require_err_msg.ChargingStatus;
75657
76022
  exports.ClaimOutcomeSchema = ClaimOutcomeSchema;
@@ -75776,12 +76141,12 @@ exports.DECLARED_DEVICE_SWEEP_LIMIT = DECLARED_DEVICE_SWEEP_LIMIT;
75776
76141
  exports.DECLARED_INTEGRATION_FIXED_KEY = DECLARED_INTEGRATION_FIXED_KEY;
75777
76142
  exports.DEFAULT_ADDON_PLACEMENT = DEFAULT_ADDON_PLACEMENT;
75778
76143
  exports.DEFAULT_AUDIO_ANALYZER_CONFIG = DEFAULT_AUDIO_ANALYZER_CONFIG;
76144
+ exports.DEFAULT_CAMERA_FPS = DEFAULT_CAMERA_FPS;
75779
76145
  exports.DEFAULT_CAMERA_SENSOR_MODE = DEFAULT_CAMERA_SENSOR_MODE;
75780
76146
  exports.DEFAULT_CLUSTER_STEP_MODELS = DEFAULT_CLUSTER_STEP_MODELS;
75781
76147
  exports.DEFAULT_CLUSTER_STEP_SETTINGS = DEFAULT_CLUSTER_STEP_SETTINGS;
75782
76148
  exports.DEFAULT_CORE_BLOCK_ENTRY = DEFAULT_CORE_BLOCK_ENTRY;
75783
76149
  exports.DEFAULT_DECODER_HWACCEL_CONFIG = DEFAULT_DECODER_HWACCEL_CONFIG;
75784
- exports.DEFAULT_DEMAND_OPTIONS = DEFAULT_DEMAND_OPTIONS;
75785
76150
  exports.DEFAULT_DETAIL_CROP_CONVENTION = DEFAULT_DETAIL_CROP_CONVENTION;
75786
76151
  exports.DEFAULT_EVENTS_BAND_BUFFER_SEC = DEFAULT_EVENTS_BAND_BUFFER_SEC;
75787
76152
  exports.DEFAULT_EVENT_COLOR = DEFAULT_EVENT_COLOR;
@@ -75789,6 +76154,7 @@ exports.DEFAULT_FEATURES = DEFAULT_FEATURES;
75789
76154
  exports.DEFAULT_FIRST_SIGHTING_FRESHNESS_MS = require_composition.DEFAULT_FIRST_SIGHTING_FRESHNESS_MS;
75790
76155
  exports.DEFAULT_HEADROOM = DEFAULT_HEADROOM;
75791
76156
  exports.DEFAULT_MIN_LANDMARK_FACE_SIZE_PX = DEFAULT_MIN_LANDMARK_FACE_SIZE_PX;
76157
+ exports.DEFAULT_MIN_SESSIONS_PER_DEVICE = DEFAULT_MIN_SESSIONS_PER_DEVICE;
75792
76158
  exports.DEFAULT_NATIVE_LEASE_SETTINGS = DEFAULT_NATIVE_LEASE_SETTINGS;
75793
76159
  exports.DEFAULT_OVERLAY_LAYERS = DEFAULT_OVERLAY_LAYERS;
75794
76160
  exports.DEFAULT_POOL_MEMORY_POLICY = DEFAULT_POOL_MEMORY_POLICY;
@@ -75796,6 +76162,7 @@ exports.DEFAULT_RECORDING_PROFILES = DEFAULT_RECORDING_PROFILES;
75796
76162
  exports.DEFAULT_RETENTION = DEFAULT_RETENTION;
75797
76163
  exports.DEFAULT_RUNTIME_STATE_DURABILITY = require_sleep.DEFAULT_RUNTIME_STATE_DURABILITY;
75798
76164
  exports.DEFAULT_SESSION_PLACEMENT_POLICY = DEFAULT_SESSION_PLACEMENT_POLICY;
76165
+ exports.DEFAULT_SHARE_SOURCE = DEFAULT_SHARE_SOURCE;
75799
76166
  exports.DEFAULT_TIMELAPSE_PREVIEW_TEXT = DEFAULT_TIMELAPSE_PREVIEW_TEXT;
75800
76167
  exports.DEFAULT_TOKEN_EXPIRY = DEFAULT_TOKEN_EXPIRY;
75801
76168
  exports.DERIVED_CAMERA_SILENCED_CAP_NAMES = DERIVED_CAMERA_SILENCED_CAP_NAMES;
@@ -75848,7 +76215,6 @@ exports.DetectorStoreClearSchema = DetectorStoreClearSchema;
75848
76215
  exports.DeviceAdminLinkSchema = DeviceAdminLinkSchema;
75849
76216
  exports.DeviceCodeSeveritySchema = DeviceCodeSeveritySchema;
75850
76217
  exports.DeviceConfig = DeviceConfig;
75851
- exports.DeviceDemandSchema = DeviceDemandSchema;
75852
76218
  exports.DeviceDiscoveryStatusSchema = DeviceDiscoveryStatusSchema;
75853
76219
  exports.DeviceExportExposeInputSchema = ExposeInputSchema;
75854
76220
  exports.DeviceExportStatusSchema = DeviceExportStatusSchema;
@@ -75897,6 +76263,9 @@ exports.EXTENSION_SLOTS = EXTENSION_SLOTS;
75897
76263
  exports.EXTENSION_SLOT_IDS = EXTENSION_SLOT_IDS;
75898
76264
  exports.EXTENSION_SLOT_LISTING_METHOD = EXTENSION_SLOT_LISTING_METHOD;
75899
76265
  exports.EXTENSION_SLOT_REF_SEPARATOR = EXTENSION_SLOT_REF_SEPARATOR;
76266
+ exports.EffectiveDeviceShareSchema = EffectiveDeviceShareSchema;
76267
+ exports.EffectiveNodeShareSchema = EffectiveNodeShareSchema;
76268
+ exports.EffectiveSharesSchema = EffectiveSharesSchema;
75900
76269
  exports.EffectiveTuningSchema = EffectiveTuningSchema;
75901
76270
  exports.EgressEncodeSchema = EgressEncodeSchema;
75902
76271
  exports.EgressRateControlSchema = EgressRateControlSchema;
@@ -76153,6 +76522,7 @@ exports.MEDIA_PRESENCE_OWNER_KINDS = MEDIA_PRESENCE_OWNER_KINDS;
76153
76522
  exports.METHOD_ACCESS_MAP = METHOD_ACCESS_MAP;
76154
76523
  exports.METHOD_DEVICE_SELECTORS = METHOD_DEVICE_SELECTORS;
76155
76524
  exports.MINUTES_PER_DAY = MINUTES_PER_DAY;
76525
+ exports.MIN_SESSIONS_PER_DEVICE_RANGE = MIN_SESSIONS_PER_DEVICE_RANGE;
76156
76526
  exports.MODEL_FORMATS = MODEL_FORMATS;
76157
76527
  exports.MODEL_HOSTING = MODEL_HOSTING;
76158
76528
  exports.MODEL_PROVIDER_IDS = MODEL_PROVIDER_IDS;
@@ -76315,6 +76685,7 @@ exports.NC_TEMPLATE_VARS = NC_TEMPLATE_VARS;
76315
76685
  exports.NC_UPDATE_EVENT_PACKAGE_NAMES = NC_UPDATE_EVENT_PACKAGE_NAMES;
76316
76686
  exports.NETWORK_LINK_TYPES = NETWORK_LINK_TYPES;
76317
76687
  exports.NETWORK_LINK_UNKNOWN = NETWORK_LINK_UNKNOWN;
76688
+ exports.NO_MEASURED_CAPACITY = NO_MEASURED_CAPACITY;
76318
76689
  exports.NativeCropBboxSchema = NativeCropBboxSchema;
76319
76690
  exports.NativeCropRefSchema = NativeCropRefSchema;
76320
76691
  exports.NativeCropResultSchema = NativeCropResultSchema;
@@ -76445,7 +76816,6 @@ exports.NotificationFormatSchema = NotificationFormatSchema;
76445
76816
  exports.NotificationSchema = NotificationSchema;
76446
76817
  exports.NotifierStatusSchema = NotifierStatusSchema;
76447
76818
  exports.NumericSensorStatusSchema = NumericSensorStatusSchema;
76448
- exports.OBSERVATION_WINDOW_MS = OBSERVATION_WINDOW_MS;
76449
76819
  exports.OPERATOR_WRITTEN_STALE_MS = OPERATOR_WRITTEN_STALE_MS;
76450
76820
  exports.OPS_LOG_DEFAULT_LIMIT = OPS_LOG_DEFAULT_LIMIT;
76451
76821
  exports.OPS_LOG_RING_DEFAULT_MAX = OPS_LOG_RING_DEFAULT_MAX;
@@ -76692,6 +77062,7 @@ exports.SCOPE_PRESETS = SCOPE_PRESETS;
76692
77062
  exports.SENSOR_FEATURES = SENSOR_FEATURES;
76693
77063
  exports.SENSOR_MAP = SENSOR_MAP;
76694
77064
  exports.SESSION_PLACEMENT_SETTING_KEY = SESSION_PLACEMENT_SETTING_KEY;
77065
+ exports.SHARE_SOURCE_SETTING_KEY = SHARE_SOURCE_SETTING_KEY;
76695
77066
  exports.SHARE_VIEW_KINDS = require_sleep.SHARE_VIEW_KINDS;
76696
77067
  exports.SINGLE_HUB_ADDRESS_ROLES = SINGLE_HUB_ADDRESS_ROLES;
76697
77068
  exports.SOURCE_CAPS = require_composition.SOURCE_CAPS;
@@ -76741,6 +77112,7 @@ exports.SessionPlacementPolicySchema = SessionPlacementPolicySchema;
76741
77112
  exports.SessionTriggerSchema = SessionTriggerSchema;
76742
77113
  exports.SetCameraSensorsInputSchema = SetCameraSensorsInputSchema;
76743
77114
  exports.SetLoggingSettingsInputSchema = SetLoggingSettingsInputSchema;
77115
+ exports.SetShareSourceInputSchema = SetShareSourceInputSchema;
76744
77116
  exports.SetSiteLocationInputSchema = SetSiteLocationInputSchema;
76745
77117
  exports.SetTrackPurityInputSchema = SetTrackPurityInputSchema;
76746
77118
  exports.SetTrackPurityResultSchema = SetTrackPurityResultSchema;
@@ -76749,6 +77121,8 @@ exports.SettingsPatchSchema = SettingsPatchSchema;
76749
77121
  exports.SettingsRecordSchema = SettingsRecordSchema;
76750
77122
  exports.SettingsSchemaWithValuesSchema = SettingsSchemaWithValuesSchema;
76751
77123
  exports.SettingsUpdateResultSchema = SettingsUpdateResultSchema;
77124
+ exports.ShareSourceSchema = ShareSourceSchema;
77125
+ exports.ShareWeightsSchema = ShareWeightsSchema;
76752
77126
  exports.ShmRingStatsSchema = ShmRingStatsSchema;
76753
77127
  exports.SiteLocationSchema = SiteLocationSchema;
76754
77128
  exports.SiteLocationSourceSchema = SiteLocationSourceSchema;
@@ -77047,6 +77421,7 @@ exports.cameraSensorRefKey = cameraSensorRefKey;
77047
77421
  exports.cameraStreamsCapability = cameraStreamsCapability;
77048
77422
  exports.canConvertUnit = canConvertUnit;
77049
77423
  exports.canonicalEgressPlan = canonicalEgressPlan;
77424
+ exports.capacitySessionsOf = capacitySessionsOf;
77050
77425
  exports.carbonMonoxideCapability = carbonMonoxideCapability;
77051
77426
  exports.cellsToRects = cellsToRects;
77052
77427
  exports.checkRoleAddress = checkRoleAddress;
@@ -77088,6 +77463,7 @@ exports.compositionReadKey = require_composition.compositionReadKey;
77088
77463
  exports.compositionSliceKey = require_composition.compositionSliceKey;
77089
77464
  exports.compositionSourceKey = require_composition.compositionSourceKey;
77090
77465
  exports.compositionSourceRefs = compositionSourceRefs;
77466
+ exports.computeCapacityShares = computeCapacityShares;
77091
77467
  exports.conditionDepth = conditionDepth;
77092
77468
  exports.conditionExclusionReason = conditionExclusionReason;
77093
77469
  exports.conditionVisibleForKind = conditionVisibleForKind;
@@ -77174,6 +77550,7 @@ exports.deviceProviderCapability = deviceProviderCapability;
77174
77550
  exports.deviceSelectorMatches = deviceSelectorMatches;
77175
77551
  exports.deviceStateCapability = deviceStateCapability;
77176
77552
  exports.deviceStatusCapability = deviceStatusCapability;
77553
+ exports.diffStepSettings = diffStepSettings;
77177
77554
  exports.disarmRoseMemory = require_composition.disarmRoseMemory;
77178
77555
  exports.displayIconEntry = displayIconEntry;
77179
77556
  exports.displayIconsInGroup = displayIconsInGroup;
@@ -77181,6 +77558,7 @@ exports.doActionSelectValue = doActionSelectValue;
77181
77558
  exports.doorbellCapability = doorbellCapability;
77182
77559
  exports.doorbellFeatureSources = doorbellFeatureSources;
77183
77560
  exports.droppedConditionsForKind = droppedConditionsForKind;
77561
+ exports.effectiveStepSettings = effectiveStepSettings;
77184
77562
  exports.egressTranscodeSharingKey = egressTranscodeSharingKey;
77185
77563
  exports.egressTransportFromRequest = egressTransportFromRequest;
77186
77564
  exports.electByShare = electByShare;
@@ -77201,8 +77579,6 @@ exports.enumerateInferenceDevices = enumerateInferenceDevices;
77201
77579
  exports.enumerateItemArrayFields = enumerateItemArrayFields;
77202
77580
  exports.enumerateSchemaFields = enumerateSchemaFields;
77203
77581
  exports.errMsg = require_err_msg.errMsg;
77204
- exports.estimateDeviceDemand = estimateDeviceDemand;
77205
- exports.estimatedConcurrentSessions = estimatedConcurrentSessions;
77206
77582
  exports.evaluateAst = require_composition.evaluateAst;
77207
77583
  exports.evaluateCompositionField = evaluateCompositionField;
77208
77584
  exports.evaluateCount = require_composition.evaluateCount;
@@ -77238,6 +77614,8 @@ exports.feederCustomizationExample = feederCustomizationExample;
77238
77614
  exports.feederExampleSources = feederExampleSources;
77239
77615
  exports.ffmpegRate = ffmpegRate;
77240
77616
  exports.fieldReads = require_composition.fieldReads;
77617
+ exports.fieldUnitKeys = fieldUnitKeys;
77618
+ exports.fieldsPinnedAtValueBelow = fieldsPinnedAtValueBelow;
77241
77619
  exports.filesystemBrowseCapability = filesystemBrowseCapability;
77242
77620
  exports.findCandidateCycles = findCandidateCycles;
77243
77621
  exports.findCompositionCycles = findCompositionCycles;
@@ -77289,6 +77667,7 @@ exports.isAudioChunkFormat = require_sleep.isAudioChunkFormat;
77289
77667
  exports.isAudioClassName = isAudioClassName;
77290
77668
  exports.isAudioLabelSelected = isAudioLabelSelected;
77291
77669
  exports.isAudioRule = isAudioRule;
77670
+ exports.isAutomaticShareSource = isAutomaticShareSource;
77292
77671
  exports.isBaseConditionKey = isBaseConditionKey;
77293
77672
  exports.isBatteryPresenceFault = isBatteryPresenceFault;
77294
77673
  exports.isClusterScopedStep = isClusterScopedStep;
@@ -77375,6 +77754,7 @@ exports.mayReadLocation = mayReadLocation;
77375
77754
  exports.mayWriteToLocation = mayWriteToLocation;
77376
77755
  exports.mediaPlayerCapability = mediaPlayerCapability;
77377
77756
  exports.memoizePinnedFfmpeg = memoizePinnedFfmpeg;
77757
+ exports.mergeSettingsBags = mergeSettingsBags;
77378
77758
  exports.mergeSourceInfo = mergeSourceInfo;
77379
77759
  exports.meshNetworkCapability = meshNetworkCapability;
77380
77760
  exports.method = require_sleep.method;
@@ -77435,6 +77815,7 @@ exports.parseProcStatus = parseProcStatus;
77435
77815
  exports.parseProfileBrokerId = require_sleep.parseProfileBrokerId;
77436
77816
  exports.parseRuleSection = parseRuleSection;
77437
77817
  exports.parseSessionPlacementPolicy = parseSessionPlacementPolicy;
77818
+ exports.parseShareSource = parseShareSource;
77438
77819
  exports.parseStreamParamsFormPatch = parseStreamParamsFormPatch;
77439
77820
  exports.patchAudio = patchAudio;
77440
77821
  exports.petFeederCapability = petFeederCapability;
@@ -77515,6 +77896,7 @@ exports.resolveCoreBlockFiles = resolveCoreBlockFiles;
77515
77896
  exports.resolveCreateExportSubject = resolveCreateExportSubject;
77516
77897
  exports.resolveDeviceControlKind = resolveDeviceControlKind;
77517
77898
  exports.resolveDeviceProfile = resolveDeviceProfile;
77899
+ exports.resolveEffectiveShares = resolveEffectiveShares;
77518
77900
  exports.resolveEgressDecodeHwAccel = resolveEgressDecodeHwAccel;
77519
77901
  exports.resolveExportProfiles = resolveExportProfiles;
77520
77902
  exports.resolveFormat = resolveFormat;
@@ -77579,6 +77961,8 @@ exports.sensorTransitionOffered = sensorTransitionOffered;
77579
77961
  exports.servedTemplateVars = servedTemplateVars;
77580
77962
  exports.serverManagementCapability = serverManagementCapability;
77581
77963
  exports.setByPath = setByPath;
77964
+ exports.settingValuesEqual = settingValuesEqual;
77965
+ exports.settingsBelow = settingsBelow;
77582
77966
  exports.settingsStoreCapability = settingsStoreCapability;
77583
77967
  exports.signalPercentFromBars = signalPercentFromBars;
77584
77968
  exports.signalPercentFromRssi = signalPercentFromRssi;
@@ -77595,6 +77979,7 @@ exports.startReachabilityPoll = startReachabilityPoll;
77595
77979
  exports.stateLabel = stateLabel;
77596
77980
  exports.stateVocabularyFor = stateVocabularyFor;
77597
77981
  exports.stepModelRunsOnFormat = stepModelRunsOnFormat;
77982
+ exports.stepSettingSource = stepSettingSource;
77598
77983
  exports.storageCapability = storageCapability;
77599
77984
  exports.storageEvictableCapability = storageEvictableCapability;
77600
77985
  exports.storageMigrationCapability = storageMigrationCapability;
@@ -77646,6 +78031,7 @@ exports.toAppLinkHubOrigin = toAppLinkHubOrigin;
77646
78031
  exports.toDeviceSummary = toDeviceSummary;
77647
78032
  exports.toExpressionValue = require_composition.toExpressionValue;
77648
78033
  exports.toNodeId = require_sleep.toNodeId;
78034
+ exports.toPercentShares = toPercentShares;
77649
78035
  exports.toStreamSourceEntry = toStreamSourceEntry;
77650
78036
  exports.toastCapability = toastCapability;
77651
78037
  exports.toggleAudioLabel = toggleAudioLabel;
@@ -77686,7 +78072,9 @@ exports.wiringHealthSnapshotSchema = wiringHealthSnapshotSchema;
77686
78072
  exports.wiringNodeHealthSchema = wiringNodeHealthSchema;
77687
78073
  exports.wiringProbeKindSchema = wiringProbeKindSchema;
77688
78074
  exports.wiringProbeResultSchema = wiringProbeResultSchema;
78075
+ exports.withFieldFrom = withFieldFrom;
77689
78076
  exports.withLocationMode = withLocationMode;
78077
+ exports.withoutField = withoutField;
77690
78078
  exports.writeModelBoundSetting = writeModelBoundSetting;
77691
78079
  exports.zodEntriesToConfigUI = zodEntriesToConfigUI;
77692
78080
  exports.zoneAnalyticsCapability = zoneAnalyticsCapability;