@camstack/addon-pipeline-orchestrator 1.2.706 → 1.2.707

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -6126,7 +6126,7 @@ var ZodIssueCode = {
6126
6126
  var ZodFirstPartyTypeKind;
6127
6127
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6128
6128
  //#endregion
6129
- //#region ../types/dist/runtime-capabilities-qX7BpOYT.mjs
6129
+ //#region ../types/dist/runtime-capabilities-B36VcCR6.mjs
6130
6130
  /**
6131
6131
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6132
6132
  * window to float samples (D455).
@@ -10232,14 +10232,104 @@ var SubscribeAudioChunksInputSchema = object({
10232
10232
  var SubscribeAudioChunksResultSchema = object({
10233
10233
  /** Opaque id passed to `pullAudioChunks` / `unsubscribeAudioChunks`. */
10234
10234
  subscriptionId: string() });
10235
- var BrokerStatsSchema = object({
10236
- status: _enum([
10237
- "idle",
10238
- "connecting",
10239
- "streaming",
10240
- "error",
10241
- "stopped"
10235
+ var BrokerStatusSchema = _enum([
10236
+ "idle",
10237
+ "connecting",
10238
+ "streaming",
10239
+ "error",
10240
+ "stopped"
10241
+ ]);
10242
+ /**
10243
+ * The encode a derived stream's feeder was last spawned with — the read-only
10244
+ * "effective encode". Read off the ffmpeg argv that runs, so it cannot drift
10245
+ * from what the operator's profile and the carrier's rules resolved to.
10246
+ */
10247
+ var DerivedEffectiveEncodeSchema = object({
10248
+ /** `-c:v` of the argv (`libx264`, a hardware encoder, `copy`); null when absent. */
10249
+ encoder: string().nullable(),
10250
+ /** Output frame rate; null when the source cadence passes through unmeasured. */
10251
+ fps: number$1().nullable(),
10252
+ gopFrames: number$1(),
10253
+ /** ABR target (`-b:v`), kbps. */
10254
+ targetKbps: number$1().nullable(),
10255
+ /** Ceiling (`-maxrate`), kbps. */
10256
+ capKbps: number$1().nullable(),
10257
+ bufsizeKbps: number$1().nullable(),
10258
+ /**
10259
+ * `copy` = source audio untouched, `aac` = re-encoded, `profile` = operator's
10260
+ * encode, `none` = the operator dropped the track.
10261
+ */
10262
+ audio: _enum([
10263
+ "copy",
10264
+ "aac",
10265
+ "profile",
10266
+ "none"
10267
+ ])
10268
+ });
10269
+ /**
10270
+ * A derived stream's source: a **profile** slot (follows whatever physical
10271
+ * stream that profile is assigned to) or a **camStream** (pinned to one
10272
+ * physical stream regardless of assignment).
10273
+ */
10274
+ var DerivedSourceRefSchema = union([object({
10275
+ kind: literal("profile"),
10276
+ profile: _enum([
10277
+ "high",
10278
+ "mid",
10279
+ "low"
10280
+ ])
10281
+ }), object({
10282
+ kind: literal("camStream"),
10283
+ camStreamId: string()
10284
+ })]);
10285
+ object({
10286
+ width: number$1().nullable(),
10287
+ height: number$1().nullable(),
10288
+ fps: number$1().nullable(),
10289
+ idrIntervalMs: number$1().nullable(),
10290
+ /** `h264` / `h265` when observed. */
10291
+ videoCodec: _enum(["h264", "h265"]).nullable(),
10292
+ /** Upper-cased SDP name (`AAC`, `PCMU`) when the source has an audio track. */
10293
+ audioCodec: string().nullable()
10294
+ });
10295
+ /**
10296
+ * The full effective encode of a derived-stream profile: the stats the broker
10297
+ * publishes in `getBrokerStats.derivedEncode` plus the resolved geometry, the
10298
+ * flags that say WHY a number differs from the request, and the ffmpeg output
10299
+ * argv. One function (`computeDerivedEncode`) produces it for both the
10300
+ * broker's start path and `previewDerivedEncode`.
10301
+ */
10302
+ var DerivedEncodePreviewSchema = DerivedEffectiveEncodeSchema.extend({
10303
+ /** Final picture size; `null` when neither the profile nor the source names it. */
10304
+ width: number$1().nullable(),
10305
+ height: number$1().nullable(),
10306
+ /** `h264` / `h265` re-encode, `copy` remux; `null` is never returned (the encoder always resolves). */
10307
+ videoCodec: _enum([
10308
+ "h264",
10309
+ "h265",
10310
+ "copy"
10242
10311
  ]),
10312
+ requestedFps: number$1().nullable(),
10313
+ /** The requested fps exceeded the source and the source cadence won. */
10314
+ fpsClampedToSource: boolean(),
10315
+ /** Lowest bitrate accepted for this geometry x fps; `null` when unknown. */
10316
+ floorKbps: number$1().nullable(),
10317
+ /** The explicit bitrate was below the floor and was raised to it. */
10318
+ raisedToFloor: boolean(),
10319
+ /** What the profile asked for when it was raised; `null` otherwise. */
10320
+ requestedKbps: number$1().nullable(),
10321
+ /** Seconds between keyframes; `null` when the output cadence is unknown. */
10322
+ keyframeIntervalSec: number$1().nullable(),
10323
+ /** The ffmpeg argv, with the source loopback URL in `-i`. */
10324
+ args: array(string())
10325
+ });
10326
+ /** Result of `previewDerivedEncode`: a plan, or the reason there is none. */
10327
+ var PreviewDerivedEncodeResultSchema = discriminatedUnion("kind", [object({
10328
+ kind: literal("preview"),
10329
+ preview: DerivedEncodePreviewSchema
10330
+ }), object({ kind: literal("no-source") })]);
10331
+ var BrokerStatsSchema = object({
10332
+ status: BrokerStatusSchema,
10243
10333
  inputFps: number$1(),
10244
10334
  encodedSubscribers: number$1(),
10245
10335
  uptimeMs: number$1(),
@@ -10279,7 +10369,9 @@ var BrokerStatsSchema = object({
10279
10369
  * alone that the mute is on the packet path and not merely persisted.
10280
10370
  */
10281
10371
  audioMuted: boolean().optional(),
10282
- audioMutedDropped: number$1().optional()
10372
+ audioMutedDropped: number$1().optional(),
10373
+ /** Present for a derived broker once its feeder has spawned at least once. */
10374
+ derivedEncode: DerivedEffectiveEncodeSchema.optional()
10283
10375
  });
10284
10376
  /**
10285
10377
  * Exporter-facing "profile restream" entry. Returned by
@@ -23263,7 +23355,7 @@ function sleep(ms) {
23263
23355
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
23264
23356
  }
23265
23357
  //#endregion
23266
- //#region ../types/dist/implemented-methods-wFScvZ40.mjs
23358
+ //#region ../types/dist/implemented-methods-BUBqZ2a0.mjs
23267
23359
  /**
23268
23360
  * The ffmpeg build every CamStack node downloads, per platform and arch.
23269
23361
  *
@@ -26035,10 +26127,16 @@ looseObject({
26035
26127
  TargetSchema.omit({ id: true });
26036
26128
  var EncodeProfileSchema = object({
26037
26129
  video: object({
26130
+ /**
26131
+ * `h264` / `h265` re-encode into that codec; `source` re-encodes in whatever
26132
+ * codec the source speaks (a resize that keeps the codec); `copy` remuxes
26133
+ * with no encode at all (so no resize either).
26134
+ */
26038
26135
  codec: _enum([
26039
26136
  "h264",
26040
26137
  "h265",
26041
- "copy"
26138
+ "copy",
26139
+ "source"
26042
26140
  ]),
26043
26141
  profile: _enum([
26044
26142
  "baseline",
@@ -26090,12 +26188,14 @@ var EncodeProfileSchema = object({
26090
26188
  singleSlicePerFrame: boolean().optional()
26091
26189
  }),
26092
26190
  audio: union([literal("passthrough"), object({
26191
+ /** `none` drops the audio track (`-an`); `copy` carries the source's. */
26093
26192
  codec: _enum([
26094
26193
  "opus",
26095
26194
  "aac",
26096
26195
  "pcmu",
26097
26196
  "pcma",
26098
- "copy"
26197
+ "copy",
26198
+ "none"
26099
26199
  ]),
26100
26200
  bitrateKbps: number$1().int().positive().optional(),
26101
26201
  sampleRateHz: number$1().int().positive().optional(),
@@ -56238,7 +56338,11 @@ method(object({
56238
56338
  }).nullable(), {
56239
56339
  kind: "mutation",
56240
56340
  auth: "admin"
56241
- }), method(_void(), array(CameraStreamSchema).readonly()), method(_void(), array(ProfileSlotSchema).readonly()), method(object({ brokerId: string() }), BrokerStatsSchema), method(object({ brokerId: string() }), object({
56341
+ }), method(_void(), array(CameraStreamSchema).readonly()), method(_void(), array(ProfileSlotSchema).readonly()), method(object({ brokerId: string() }), BrokerStatsSchema), method(object({
56342
+ deviceId: number$1().int().nonnegative(),
56343
+ profile: EncodeProfileSchema,
56344
+ source: DerivedSourceRefSchema.optional()
56345
+ }), PreviewDerivedEncodeResultSchema), method(object({ brokerId: string() }), object({
56242
56346
  probed: boolean(),
56243
56347
  summary: string()
56244
56348
  }), {
@@ -74887,7 +74991,8 @@ var StatelessStepRefusalSchema = _enum([
74887
74991
  "unknown-step",
74888
74992
  "model-not-servable",
74889
74993
  "unreadable-frame",
74890
- "execution-failed"
74994
+ "execution-failed",
74995
+ "no-eligible-device"
74891
74996
  ]);
74892
74997
  /**
74893
74998
  * Answer to `runStatelessStep` — a discriminated union rather than a nullable
@@ -81774,7 +81879,13 @@ var NodeInferenceDeviceSchema = object({
81774
81879
  enabled: boolean(),
81775
81880
  /** Relative balancer weight for the enabled device (default 1). */
81776
81881
  weight: number$1(),
81777
- /** Per-device concurrent-session cap; null = unlimited (multi-device C4). */
81882
+ /**
81883
+ * Per-device concurrent-session cap; null = unlimited (multi-device C4). A
81884
+ * limit: a camera no device can take within its cap stays on the node's
81885
+ * default pool — EXCEPT when that default pool is an excluded device
81886
+ * (`defaultPoolExcluded`), where it goes over the cap on the least-loaded
81887
+ * eligible device instead (#610).
81888
+ */
81778
81889
  maxSessions: number$1().nullable(),
81779
81890
  /** Object-detection model the executor defaults to for this deviceKey. */
81780
81891
  defaultModelId: string(),
@@ -81824,7 +81935,15 @@ var NodeInferenceDevicesSchema = object({
81824
81935
  nodeId: string(),
81825
81936
  /** False when the node's platform-probe was unreachable (no live device set). */
81826
81937
  reachable: boolean(),
81827
- devices: array(NodeInferenceDeviceSchema).readonly()
81938
+ devices: array(NodeInferenceDeviceSchema).readonly(),
81939
+ /**
81940
+ * The election left NO device and one was excluded because the operator
81941
+ * turned it off or it is not functional (#610): the runner's default pool is
81942
+ * that device, so work with no explicit device (a stateless step, a bench with
81943
+ * no `deviceKey`) is refused rather than run there. Absent = an orchestrator
81944
+ * older than the field, or an unreachable node: nothing is claimed (D315).
81945
+ */
81946
+ defaultPoolExcluded: boolean().optional()
81828
81947
  });
81829
81948
  /**
81830
81949
  * The CLUSTER switch of one pipeline step (D1065):
@@ -82239,6 +82358,11 @@ var pipelineOrchestratorCapability = {
82239
82358
  * `PipelineSettingsStore.buildNodeInferenceDevices` when placing sessions
82240
82359
  * and the per-(node,device) base provisioning via
82241
82360
  * `buildNodeInferenceDeviceSteps`.
82361
+ * `maxSessions` is a LIMIT, with one exception: when the node's default
82362
+ * pool is itself an excluded device (turned off or not functional) a
82363
+ * camera that would overflow every cap is placed over the cap on the
82364
+ * least-loaded eligible device, because the default pool must never serve
82365
+ * it (#610). The overflow is logged, naming any pin it overrode.
82242
82366
  */
82243
82367
  setAgentInferenceDevices: method(object({
82244
82368
  agentNodeId: string(),
@@ -105431,6 +105555,13 @@ Object.freeze({
105431
105555
  access: "view",
105432
105556
  role: "admin"
105433
105557
  },
105558
+ "streamBroker.previewDerivedEncode": {
105559
+ capName: "stream-broker",
105560
+ capScope: "system",
105561
+ addonId: null,
105562
+ access: "view",
105563
+ role: "admin"
105564
+ },
105434
105565
  "streamBroker.probeStream": {
105435
105566
  capName: "stream-broker",
105436
105567
  capScope: "system",
@@ -109762,6 +109893,11 @@ Object.freeze({
109762
109893
  form: "single",
109763
109894
  optional: false
109764
109895
  }],
109896
+ "streamBroker.previewDerivedEncode": [{
109897
+ name: "deviceId",
109898
+ form: "single",
109899
+ optional: false
109900
+ }],
109765
109901
  "streamBroker.produceEventMedia": [{
109766
109902
  name: "deviceId",
109767
109903
  form: "single",
@@ -115868,6 +116004,45 @@ function annotateInferenceDeviceExclusions(merged, eligibility) {
115868
116004
  exclusion: reasonByKey.get(view.key) ?? null
115869
116005
  }));
115870
116006
  }
116007
+ /**
116008
+ * The device key of the node's selected engine — the runner's DEFAULT pool — as
116009
+ * the node's catalog reports it; null when the catalog is not known.
116010
+ */
116011
+ function defaultEngineKeyOf(catalog) {
116012
+ if (catalog === null) return null;
116013
+ const { backend, device } = catalog.selectedEngine;
116014
+ if (backend === "cpu") return "cpu";
116015
+ return device ? `${backend}:${device}` : backend;
116016
+ }
116017
+ /** Excluded because the hardware is down or the operator turned it off (not the CPU's opt-in `disabled`). */
116018
+ function isNonFunctionalOrOff(e) {
116019
+ if (e.reason === "unavailable" || e.reason === "no-gpu-device") return true;
116020
+ return e.reason === "disabled" && !e.key.startsWith("cpu");
116021
+ }
116022
+ /**
116023
+ * Is the runner's default pool (the node's selected engine) a device the
116024
+ * election EXCLUDED? `defaultKey` is the device key of that engine
116025
+ * (`inferenceDeviceKey` of the node catalog's `selectedEngine`). When the
116026
+ * engine's device was excluded as non-functional (`unavailable`, `no-gpu-device`)
116027
+ * or turned off by the operator (`disabled`) the answer is true — whether or not
116028
+ * OTHER devices are eligible, which is exactly when an at-cap overflow would
116029
+ * otherwise land on it. Exclusions that are not the operator's or the
116030
+ * hardware's word (`cannot-host-camera-root`, `root-switched-off`,
116031
+ * `accelerator-preferred`) do not count. #610.
116032
+ *
116033
+ * `defaultKey` null = the node's engine is not known: nothing is claimed while
116034
+ * any device is eligible (fail-open, D315/D49); with NOTHING eligible the
116035
+ * first non-functional/off exclusion stands in for it.
116036
+ */
116037
+ function isDefaultPoolExcluded(eligibility, defaultKey = null) {
116038
+ if (defaultKey !== null) {
116039
+ if (defaultKey in eligibility.eligible) return false;
116040
+ const own = eligibility.excluded.find((e) => e.key === defaultKey);
116041
+ if (own !== void 0) return isNonFunctionalOrOff(own);
116042
+ }
116043
+ if (Object.keys(eligibility.eligible).length > 0) return false;
116044
+ return eligibility.excluded.some(isNonFunctionalOrOff);
116045
+ }
115871
116046
  function resolveNodeInferenceUsability(eligibility) {
115872
116047
  const eligibleKeys = Object.keys(eligibility.eligible).toSorted();
115873
116048
  const unavailableKeys = eligibility.excluded.filter((e) => e.reason === "unavailable").map((e) => e.key).toSorted();
@@ -122242,6 +122417,33 @@ function deviceAsLoad(deviceKey, load) {
122242
122417
  };
122243
122418
  }
122244
122419
  /**
122420
+ * Nothing could take the camera within its caps. While the node's default pool
122421
+ * is usable it serves, as it always did. When the default pool is an excluded
122422
+ * device it must not: place on the least-loaded eligible device, over its cap
122423
+ * (per-weight attached cameras, ties by key) and name any pin that was overridden.
122424
+ */
122425
+ function atCapSelection(eligibleKeys, loadByKey, input) {
122426
+ const pin = input.pinnedDeviceKey ?? null;
122427
+ const best = eligibleKeys.map((key) => ({
122428
+ key,
122429
+ score: (loadByKey.get(key)?.attachedCameras ?? 0) / Math.max(input.eligible[key] ?? 1, 1e-6)
122430
+ })).toSorted((a, b) => a.score - b.score || a.key.localeCompare(b.key))[0];
122431
+ if (input.defaultPoolExcluded !== true || best === void 0) return {
122432
+ kind: "default-pool",
122433
+ reason: best === void 0 ? "no-eligible-device" : pin ? "pin-unplaceable" : "all-devices-at-cap",
122434
+ eligibleKeys
122435
+ };
122436
+ return {
122437
+ kind: "selected",
122438
+ deviceKey: best.key,
122439
+ reason: "over-cap",
122440
+ tieBreak: null,
122441
+ eligibleKeys,
122442
+ tiedKeys: [best.key],
122443
+ ...pin !== null && pin !== best.key ? { pinOverridden: pin } : {}
122444
+ };
122445
+ }
122446
+ /**
122245
122447
  * Elect the inference device for one camera on one node.
122246
122448
  *
122247
122449
  * Order (each step short-circuits): pin → capacity → fair tie-break. A pin is
@@ -122289,11 +122491,7 @@ function pickInferenceDevice(input) {
122289
122491
  };
122290
122492
  }), input.previousDeviceKey ?? null);
122291
122493
  const election = outcome.election;
122292
- if (election.kind === "none") return {
122293
- kind: "default-pool",
122294
- reason: "all-devices-at-cap",
122295
- eligibleKeys
122296
- };
122494
+ if (election.kind === "none") return atCapSelection(eligibleKeys, loadByKey, input);
122297
122495
  history?.noteElected(historyScope, election.key);
122298
122496
  return {
122299
122497
  kind: "selected",
@@ -122318,11 +122516,7 @@ function pickInferenceDevice(input) {
122318
122516
  eligibleNodes: consideredKeys
122319
122517
  };
122320
122518
  const decision = balance(balancerInput);
122321
- if (!decision || decision.kind !== "assigned") return {
122322
- kind: "default-pool",
122323
- reason: pin ? "pin-unplaceable" : "all-devices-at-cap",
122324
- eligibleKeys
122325
- };
122519
+ if (!decision || decision.kind !== "assigned") return atCapSelection(eligibleKeys, loadByKey, input);
122326
122520
  if (decision.reason === "manual") return {
122327
122521
  kind: "selected",
122328
122522
  deviceKey: decision.agentNodeId,
@@ -122812,6 +123006,7 @@ function jumpTargetKeys(roster, electedDeviceKey) {
122812
123006
  * module header.
122813
123007
  */
122814
123008
  async function resolveAttachPipeline(input, store) {
123009
+ if (defaultPoolIsExcluded(input)) return noEligibleDeviceRefusal(input);
122815
123010
  const roster = buildJumpRoster({
122816
123011
  deviceKey: input.deviceKey,
122817
123012
  eligible: input.eligible,
@@ -122833,6 +123028,7 @@ async function resolveAttachPipeline(input, store) {
122833
123028
  * camera behind it (D3, D49).
122834
123029
  */
122835
123030
  async function resolveAttachPipelineIfCatalogCached(input, store) {
123031
+ if (defaultPoolIsExcluded(input)) return noEligibleDeviceRefusal(input);
122836
123032
  const roster = buildJumpRoster({
122837
123033
  deviceKey: input.deviceKey,
122838
123034
  eligible: input.eligible,
@@ -122853,11 +123049,29 @@ function defaultPoolOf(input) {
122853
123049
  function rootRefusal(input, droppedRoots) {
122854
123050
  return {
122855
123051
  kind: "root-refused",
123052
+ cause: "root-unrunnable",
122856
123053
  nodeId: input.nodeId,
122857
123054
  deviceKey: input.deviceKey,
122858
123055
  droppedRoots
122859
123056
  };
122860
123057
  }
123058
+ /** No device elected AND the default pool is an excluded device (#610). */
123059
+ function defaultPoolIsExcluded(input) {
123060
+ return input.deviceKey === void 0 && input.defaultPoolExcluded === true;
123061
+ }
123062
+ function noEligibleDeviceRefusal(input) {
123063
+ return {
123064
+ kind: "root-refused",
123065
+ cause: "no-eligible-device",
123066
+ nodeId: input.nodeId,
123067
+ deviceKey: void 0,
123068
+ droppedRoots: []
123069
+ };
123070
+ }
123071
+ /** The pending reason a refusal is shown under — on the camera status and the load overview. */
123072
+ function refusalPendingReason(refusal) {
123073
+ return refusal.cause === "no-eligible-device" ? `no-eligible-device:${refusal.nodeId}` : `root-unrunnable:${refusal.nodeId}/${refusal.deviceKey ?? "default-pool"}`;
123074
+ }
122861
123075
  /**
122862
123076
  * Whose provisioning an attach applies. The elected device when there is one.
122863
123077
  * With NO elected device the runner's default pool serves the camera; when the
@@ -123288,9 +123502,20 @@ var PlacementService = class {
123288
123502
  caps,
123289
123503
  pinnedDeviceKey,
123290
123504
  currentDeviceKey: input.currentDeviceKey,
123291
- rotation: this.deps.inferenceRotation
123505
+ rotation: this.deps.inferenceRotation,
123506
+ defaultPoolExcluded: this.deps.isDefaultPoolExcluded?.(input.nodeId) === true
123292
123507
  });
123293
123508
  const deviceKey = selectedDeviceKey(selection);
123509
+ if (selection.kind === "selected" && selection.pinOverridden !== void 0) this.deps.ctx().logger.warn("pinned inference device at cap and the default pool is excluded: placed over cap elsewhere", {
123510
+ tags: {
123511
+ deviceId: input.deviceId,
123512
+ nodeId: input.nodeId
123513
+ },
123514
+ meta: {
123515
+ pin: selection.pinOverridden,
123516
+ chosen: selection.deviceKey
123517
+ }
123518
+ });
123294
123519
  this.deps.ctx().logger.info("inference device selection", {
123295
123520
  tags: {
123296
123521
  deviceId: input.deviceId,
@@ -123312,7 +123537,8 @@ var PlacementService = class {
123312
123537
  kind: "elected",
123313
123538
  deviceKey,
123314
123539
  eligible,
123315
- caps
123540
+ caps,
123541
+ defaultPoolExcluded: this.deps.isDefaultPoolExcluded?.(input.nodeId) === true
123316
123542
  };
123317
123543
  }
123318
123544
  /**
@@ -123328,7 +123554,8 @@ var PlacementService = class {
123328
123554
  nodeId: input.nodeId,
123329
123555
  deviceKey: election.deviceKey,
123330
123556
  eligible: election.eligible,
123331
- caps: election.caps
123557
+ caps: election.caps,
123558
+ defaultPoolExcluded: election.defaultPoolExcluded
123332
123559
  };
123333
123560
  if (input.read.kind === "await-catalog") return resolveAttachPipeline(attachInput, this.deps.settingsStore);
123334
123561
  const outcome = await resolveAttachPipelineIfCatalogCached(attachInput, this.deps.settingsStore);
@@ -123351,7 +123578,8 @@ var PlacementService = class {
123351
123578
  return resolveAttachPipeline({
123352
123579
  ...input,
123353
123580
  eligible,
123354
- caps
123581
+ caps,
123582
+ defaultPoolExcluded: this.deps.isDefaultPoolExcluded?.(input.nodeId) === true
123355
123583
  }, this.deps.settingsStore);
123356
123584
  }
123357
123585
  /**
@@ -123752,7 +123980,7 @@ var PlacementService = class {
123752
123980
  read: { kind: "cached-catalog" }
123753
123981
  });
123754
123982
  if (placement.kind !== "resolved") {
123755
- const reason = placement.kind === "root-refused" ? `root-unrunnable:${placement.nodeId}/${placement.deviceKey ?? "default-pool"}` : `${placement.what}-unavailable:${placement.nodeId}`;
123983
+ const reason = placement.kind === "root-refused" ? refusalPendingReason(placement) : `${placement.what}-unavailable:${placement.nodeId}`;
123756
123984
  skipped.push({
123757
123985
  deviceId,
123758
123986
  targetNodeId: decision.agentNodeId,
@@ -124136,9 +124364,10 @@ var PlacementService = class {
124136
124364
  * re-place it. The camera stays pending instead, once-per-change logged.
124137
124365
  */
124138
124366
  leavePendingRootRefused(deviceId, refusal) {
124139
- const reason = `root-unrunnable:${refusal.nodeId}/${refusal.deviceKey ?? "default-pool"}`;
124367
+ const reason = refusalPendingReason(refusal);
124140
124368
  if (!this.setPendingIfChanged(deviceId, reason)) return;
124141
- this.deps.ctx().logger.error("attach refused — the elected device cannot run the camera root; camera left pending", {
124369
+ const noDevice = refusal.cause === "no-eligible-device";
124370
+ this.deps.ctx().logger.error(noDevice ? "attach refused — no eligible inference device on the node; camera left pending (no default-pool fallback)" : "attach refused — the elected device cannot run the camera root; camera left pending", {
124142
124371
  tags: {
124143
124372
  deviceId,
124144
124373
  nodeId: refusal.nodeId
@@ -124147,7 +124376,7 @@ var PlacementService = class {
124147
124376
  reason,
124148
124377
  deviceKey: refusal.deviceKey ?? null,
124149
124378
  droppedRoots: refusal.droppedRoots.join(","),
124150
- hint: "the root is never jumped: enable a device on this node whose format ships the root model, or disable the device that cannot"
124379
+ hint: noDevice ? "every inference device of this node is disabled in load balancing or not functional: enable one (or fix its runtime) and the camera is placed on the next round" : "the root is never jumped: enable a device on this node whose format ships the root model, or disable the device that cannot"
124151
124380
  }
124152
124381
  });
124153
124382
  }
@@ -129885,9 +130114,20 @@ var SessionDispatchController = class {
129885
130114
  shareHistory: this.deps.shareHistory,
129886
130115
  historyScope: targetNodeId
129887
130116
  } : {},
129888
- previousDeviceKey
130117
+ previousDeviceKey,
130118
+ defaultPoolExcluded: this.deps.isDefaultPoolExcluded?.(targetNodeId) === true
129889
130119
  });
129890
130120
  const deviceKey = selectedDeviceKey(selection);
130121
+ if (selection.kind === "selected" && selection.pinOverridden !== void 0) log.warn("pinned inference device at cap and the default pool is excluded: placed over cap elsewhere", {
130122
+ tags: {
130123
+ deviceId,
130124
+ nodeId: targetNodeId
130125
+ },
130126
+ meta: {
130127
+ pin: selection.pinOverridden,
130128
+ chosen: selection.deviceKey
130129
+ }
130130
+ });
129891
130131
  log.info("inference device selection", {
129892
130132
  tags: {
129893
130133
  deviceId,
@@ -129917,14 +130157,16 @@ var SessionDispatchController = class {
129917
130157
  nodeId: targetNodeId,
129918
130158
  deviceKey,
129919
130159
  eligible: enabledDevices,
129920
- caps: deviceCaps
130160
+ caps: deviceCaps,
130161
+ defaultPoolExcluded: this.deps.isDefaultPoolExcluded?.(targetNodeId) === true
129921
130162
  }, this.deps.settingsStore);
129922
130163
  if (outcome.kind === "root-refused") {
129923
- const reason = `root-unrunnable:${targetNodeId}/${outcome.deviceKey ?? "default-pool"}`;
130164
+ const reason = refusalPendingReason(outcome);
129924
130165
  this.deps.sessionAffinity?.forget(deviceId);
129925
130166
  if (this.sessionRefusals.get(deviceId) !== reason) {
129926
130167
  this.sessionRefusals.set(deviceId, reason);
129927
- log.error("detection session refused — the elected device cannot run the camera root", {
130168
+ const noDevice = outcome.cause === "no-eligible-device";
130169
+ log.error(noDevice ? "detection session refused — no eligible inference device on the node (no default-pool fallback)" : "detection session refused — the elected device cannot run the camera root", {
129928
130170
  tags: {
129929
130171
  deviceId,
129930
130172
  nodeId: targetNodeId
@@ -129933,7 +130175,7 @@ var SessionDispatchController = class {
129933
130175
  reason,
129934
130176
  deviceKey: outcome.deviceKey ?? null,
129935
130177
  droppedRoots: outcome.droppedRoots.join(","),
129936
- hint: "the root is never jumped: enable a device on this node whose format ships the root model, or disable the device that cannot; said once until the refusal changes"
130178
+ hint: noDevice ? "every inference device of this node is disabled in load balancing or not functional; said once until the refusal changes" : "the root is never jumped: enable a device on this node whose format ships the root model, or disable the device that cannot; said once until the refusal changes"
129937
130179
  }
129938
130180
  });
129939
130181
  }
@@ -131262,6 +131504,7 @@ async function buildOrchestratorControllers(deps) {
131262
131504
  getEligibleInferenceDevices: (nodeId) => deps.getEligibleInferenceDevices(nodeId, "await-catalog"),
131263
131505
  getEligibleInferenceDevicesIfCached: (nodeId) => deps.getEligibleInferenceDevicesIfCached(nodeId),
131264
131506
  isNodeInferenceUsable: (nodeId) => deps.isNodeInferenceUsable(nodeId),
131507
+ isDefaultPoolExcluded: (nodeId) => deps.isDefaultPoolExcluded(nodeId),
131265
131508
  getInferenceDeviceCaps: (nodeId) => deps.getInferenceDeviceCaps(nodeId),
131266
131509
  readPipelineDevicePin: (deviceId) => deps.readPipelineDevicePin(deviceId),
131267
131510
  inferenceRotation,
@@ -131302,6 +131545,7 @@ async function buildOrchestratorControllers(deps) {
131302
131545
  readPipelinePin: (deviceId) => deps.readPipelinePin(deviceId),
131303
131546
  getEligibleInferenceDevices: (nodeId, read) => deps.getEligibleInferenceDevices(nodeId, read),
131304
131547
  isNodeInferenceUsable: (nodeId) => deps.isNodeInferenceUsable(nodeId),
131548
+ isDefaultPoolExcluded: (nodeId) => deps.isDefaultPoolExcluded(nodeId),
131305
131549
  getInferenceDeviceCaps: (nodeId) => deps.getInferenceDeviceCaps(nodeId),
131306
131550
  readPipelineDevicePin: (deviceId) => deps.readPipelineDevicePin(deviceId),
131307
131551
  inferenceRotation,
@@ -134224,6 +134468,7 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
134224
134468
  forgetInferenceDeviceProbe: (nodeId) => this.forgetInferenceDeviceProbe(nodeId),
134225
134469
  noteShareTopologyChange: (trigger) => this.noteShareChange(trigger),
134226
134470
  isNodeInferenceUsable: (nodeId) => this.isNodeInferenceUsable(nodeId),
134471
+ isDefaultPoolExcluded: (nodeId) => this.isDefaultPoolExcluded(nodeId),
134227
134472
  getInferenceDeviceCaps: (nodeId) => this.getInferenceDeviceCaps(nodeId),
134228
134473
  readPipelineDevicePin: (deviceId) => this.readPipelineDevicePin(deviceId),
134229
134474
  subscribeToAudioAnalyzerReadiness: (nodeId) => this.subscribeToAudioAnalyzerReadiness(nodeId),
@@ -135109,14 +135354,15 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
135109
135354
  const stored = node?.inferenceDevices ?? {};
135110
135355
  const { probed, reachable } = await this.probeNodeInferenceDevices(nodeId);
135111
135356
  const catalog = await this.settingsStore.getCatalogForNode(nodeId);
135112
- const canRunRoot = catalog ? makeRootCapabilityGuard(catalog) : void 0;
135357
+ const eligibility = resolveInferenceDeviceEligibility(probed, stored, catalog ? makeRootCapabilityGuard(catalog) : void 0, (deviceKey) => this.inferenceDeviceUsability.isUsable(nodeId, deviceKey), catalog ? makeRootSwitchGuard(catalog, await this.settingsStore.readClusterStepModes(), node) : void 0, this.absentReasonFor(nodeId));
135113
135358
  return {
135114
135359
  nodeId,
135115
135360
  reachable,
135116
- devices: annotateInferenceDeviceExclusions(mergeInferenceDevices(probed, stored), resolveInferenceDeviceEligibility(probed, stored, canRunRoot, (deviceKey) => this.inferenceDeviceUsability.isUsable(nodeId, deviceKey), catalog ? makeRootSwitchGuard(catalog, await this.settingsStore.readClusterStepModes(), node) : void 0, this.absentReasonFor(nodeId))).map((row) => !reachable && row.presence === "absent" ? {
135361
+ devices: annotateInferenceDeviceExclusions(mergeInferenceDevices(probed, stored), eligibility).map((row) => !reachable && row.presence === "absent" ? {
135117
135362
  ...row,
135118
135363
  presence: "unknown"
135119
- } : row)
135364
+ } : row),
135365
+ ...reachable ? { defaultPoolExcluded: isDefaultPoolExcluded(eligibility, defaultEngineKeyOf(catalog)) } : {}
135120
135366
  };
135121
135367
  }
135122
135368
  /**
@@ -135189,6 +135435,8 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
135189
135435
  */
135190
135436
  forgetInferenceDeviceProbe(nodeId) {
135191
135437
  this.absentInferenceDevices.delete(nodeId);
135438
+ this.defaultPoolExcluded.delete(nodeId);
135439
+ this.defaultKeyUnknownLogged.delete(nodeId);
135192
135440
  if (!this.lastInferenceDeviceProbe.delete(nodeId)) return;
135193
135441
  this.ctx.logger.info("inference device probe forgotten — the node left", {
135194
135442
  tags: { nodeId },
@@ -135302,6 +135550,18 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
135302
135550
  const { eligible, excluded } = eligibility;
135303
135551
  this.logInferenceDeviceShrinkage(nodeId, eligible, excluded);
135304
135552
  this.noteNodeInferenceUsability(nodeId, resolveNodeInferenceUsability(eligibility));
135553
+ if (probed.length === 0) this.defaultPoolExcluded.delete(nodeId);
135554
+ else {
135555
+ const defaultKey = defaultEngineKeyOf(catalog);
135556
+ if (defaultKey === null && !this.defaultKeyUnknownLogged.has(nodeId)) {
135557
+ this.defaultKeyUnknownLogged.add(nodeId);
135558
+ this.ctx.logger.warn("default inference engine of the node is unknown: its default pool is treated as not excluded while any device is eligible", {
135559
+ tags: { nodeId },
135560
+ meta: { nodeId }
135561
+ });
135562
+ }
135563
+ this.defaultPoolExcluded.set(nodeId, isDefaultPoolExcluded(eligibility, defaultKey));
135564
+ }
135305
135565
  return eligible;
135306
135566
  }
135307
135567
  /**
@@ -135352,6 +135612,17 @@ var PipelineOrchestratorAddon = class PipelineOrchestratorAddon extends BaseAddo
135352
135612
  }
135353
135613
  });
135354
135614
  }
135615
+ /**
135616
+ * Nodes whose LAST eligibility read left no eligible device while the
135617
+ * operator had turned one off or it was not functional (#610) — the runner's
135618
+ * default pool would be that device, so a camera there is refused instead.
135619
+ * Written by the same read the election makes; never by a clock.
135620
+ */
135621
+ defaultPoolExcluded = /* @__PURE__ */ new Map();
135622
+ defaultKeyUnknownLogged = /* @__PURE__ */ new Set();
135623
+ isDefaultPoolExcluded(nodeId) {
135624
+ return this.defaultPoolExcluded.get(nodeId) === true;
135625
+ }
135355
135626
  /** Can this node be given cameras? Read synchronously by the two dispatch
135356
135627
  * paths before they hand `eligibleNodes` to the balancer. */
135357
135628
  isNodeInferenceUsable(nodeId) {
@@ -30,7 +30,7 @@ async function d(e) {
30
30
  }
31
31
  }
32
32
  async function f() {
33
- return l ||= d(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-Dok-wGGT.mjs")).catch((e) => {
33
+ return l ||= d(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-D2VVeuKu.mjs")).catch((e) => {
34
34
  throw l = void 0, e;
35
35
  }), l;
36
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-pipeline-orchestrator",
3
- "version": "1.2.706",
3
+ "version": "1.2.707",
4
4
  "description": "Hub-side camera-to-agent load balancer — tracks runner capacity and dispatches attachCamera calls to the optimal pipeline-runner instance",
5
5
  "keywords": [
6
6
  "camstack",
@@ -76,7 +76,7 @@
76
76
  }
77
77
  ],
78
78
  "requires": {
79
- "server": ">=1.2.905"
79
+ "server": ">=1.2.906"
80
80
  }
81
81
  },
82
82
  "files": [