@camstack/types 1.2.225 → 1.2.227

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/node.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as Fmp4BoxSplitter, o as buildFfmpegArgs, t as canonicalHash, u as isSoftwareDecode } from "./canonical-hash-CvL03d3i.mjs";
1
+ import { n as Fmp4BoxSplitter, o as buildFfmpegArgs, t as canonicalHash, u as isSoftwareDecode } from "./canonical-hash-CPK2Dy60.mjs";
2
2
  import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
3
3
  import { createHash, createHmac, randomUUID, timingSafeEqual } from "node:crypto";
4
4
  import * as fs from "node:fs";
@@ -365,40 +365,42 @@ function bundledFfmpegPath(platform) {
365
365
  * - Linux: https://johnvansickle.com/ffmpeg/ (static builds)
366
366
  * - macOS: https://www.osxexperts.net/
367
367
  */
368
- var FFMPEG_VERSION = "7.1";
369
- function getFfmpegDownloadUrl(platform, arch) {
370
- switch (platform) {
371
- case "linux": {
372
- const a = {
373
- x64: "amd64",
374
- arm64: "arm64"
375
- }[arch];
376
- if (!a) throw new Error(`Unsupported Linux architecture: ${arch}`);
377
- return `https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-${a}-static.tar.xz`;
378
- }
379
- case "darwin":
380
- if (!{
381
- arm64: "arm64",
382
- x64: "amd64"
383
- }[arch]) throw new Error(`Unsupported macOS architecture: ${arch}`);
384
- return `https://www.osxexperts.net/ffmpeg${FFMPEG_VERSION.replace(".", "")}arm.zip`;
385
- default: throw new Error(`Unsupported platform: ${platform}`);
368
+ /**
369
+ * johnvansickle for linux (unversioned "release" URLs, so no version appears
370
+ * here), osxexperts for macOS — two different builds, and the Intel one is a
371
+ * different file at a different version from the arm one.
372
+ */
373
+ var FFMPEG_ARTIFACTS = {
374
+ "linux-x64": {
375
+ url: "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz",
376
+ archiveFormat: "tar.xz",
377
+ expectedHwaccels: []
378
+ },
379
+ "linux-arm64": {
380
+ url: "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-arm64-static.tar.xz",
381
+ archiveFormat: "tar.xz",
382
+ expectedHwaccels: []
383
+ },
384
+ "darwin-arm64": {
385
+ url: "https://www.osxexperts.net/ffmpeg71arm.zip",
386
+ archiveFormat: "zip",
387
+ expectedHwaccels: ["videotoolbox"]
388
+ },
389
+ "darwin-x64": {
390
+ url: "https://www.osxexperts.net/ffmpeg80intel.zip",
391
+ archiveFormat: "zip",
392
+ expectedHwaccels: ["videotoolbox"]
386
393
  }
394
+ };
395
+ /** The artifact for this node, or a refusal naming what was asked for. */
396
+ function getFfmpegArtifact(platform, arch) {
397
+ const artifact = FFMPEG_ARTIFACTS[`${platform}-${arch}`];
398
+ if (!artifact) throw new Error(`Unsupported platform/architecture for ffmpeg: ${platform}-${arch}`);
399
+ return artifact;
387
400
  }
388
- function getFfmpegArchiveInfo(platform) {
389
- switch (platform) {
390
- case "linux": return {
391
- isArchive: true,
392
- archiveFormat: "tar.xz",
393
- archiveInnerPath: `ffmpeg-${FFMPEG_VERSION}-amd64-static/ffmpeg`
394
- };
395
- case "darwin": return {
396
- isArchive: true,
397
- archiveFormat: "zip",
398
- archiveInnerPath: "ffmpeg"
399
- };
400
- default: throw new Error(`Unsupported platform: ${platform}`);
401
- }
401
+ /** The URL alone, for a caller that wants nothing else. */
402
+ function getFfmpegDownloadUrl(platform, arch) {
403
+ return getFfmpegArtifact(platform, arch).url;
402
404
  }
403
405
  /**
404
406
  * Ensure an ffmpeg binary WE provide is available on this node, and report
@@ -427,13 +429,15 @@ async function ensureFfmpeg(dataDir, logger) {
427
429
  exists: existsSync
428
430
  });
429
431
  if (override !== void 0 && override.trim().length > 0 && chosen?.origin !== "override") logger.error(`${FFMPEG_PATH_ENV} names a binary that does not exist — ignoring it`, { meta: { [FFMPEG_PATH_ENV]: override } });
432
+ const artifact = chosen === null ? getFfmpegArtifact(platform, arch) : null;
430
433
  const path = chosen?.path ?? await downloadBinary({
431
434
  name: "ffmpeg",
432
- url: getFfmpegDownloadUrl(platform, arch),
435
+ url: artifact?.url ?? getFfmpegDownloadUrl(platform, arch),
433
436
  targetDir: depsDir,
434
437
  targetName: `ffmpeg${ext}`,
435
438
  logger,
436
- ...getFfmpegArchiveInfo(platform)
439
+ isArchive: true,
440
+ archiveFormat: artifact?.archiveFormat ?? "tar.xz"
437
441
  });
438
442
  const capabilities = await probeFfmpegBinary(path);
439
443
  logger.info("ffmpeg binary resolved", { meta: {
@@ -442,6 +446,15 @@ async function ensureFfmpeg(dataDir, logger) {
442
446
  version: capabilities.version,
443
447
  hwaccels: [...capabilities.hwaccels].join(",") || "none"
444
448
  } });
449
+ if (artifact !== null) {
450
+ const missing = artifact.expectedHwaccels.filter((name) => !capabilities.hwaccels.has(name));
451
+ if (missing.length > 0) logger.error("the ffmpeg we downloaded cannot do what this artifact is supposed to — the source changed under us", { meta: {
452
+ url: artifact.url,
453
+ expected: artifact.expectedHwaccels.join(","),
454
+ missing: missing.join(","),
455
+ got: [...capabilities.hwaccels].join(",") || "none"
456
+ } });
457
+ }
445
458
  return path;
446
459
  }
447
460
  //#endregion
@@ -1924,4 +1937,4 @@ function resolveExportFingerprint(input) {
1924
1937
  return input.persisted ?? input.fresh;
1925
1938
  }
1926
1939
  //#endregion
1927
- export { ChildCostRegistry, FfmpegProcess, FilesystemStorageProvider, Fmp4FragmentChild, Fmp4FragmentPlane, NO_COST_CLAIM, PYTHON_VERSION, buildBinaryPath, canonicalDeviceFingerprint, canonicalHash, containsOrEquals, diffExportTargets, downloadBinary, ensureBinary, ensureFfmpeg, ensurePython, findInPath, getFfmpegDownloadUrl, getPlatformInfo, getPythonDownloadUrl, installPythonPackages, installPythonRequirements, nodeProcStatReader, parseProcCpuSeconds, parseProcRssBytes, physicalRootOf, readProcessCost, resolveExportFingerprint, signExpiringUrl, verifyExpiringUrl };
1940
+ export { ChildCostRegistry, FfmpegProcess, FilesystemStorageProvider, Fmp4FragmentChild, Fmp4FragmentPlane, NO_COST_CLAIM, PYTHON_VERSION, buildBinaryPath, canonicalDeviceFingerprint, canonicalHash, containsOrEquals, diffExportTargets, downloadBinary, ensureBinary, ensureFfmpeg, ensurePython, findInPath, getFfmpegArtifact, getFfmpegDownloadUrl, getPlatformInfo, getPythonDownloadUrl, installPythonPackages, installPythonRequirements, nodeProcStatReader, parseFfmpegCapabilities, parseProcCpuSeconds, parseProcRssBytes, physicalRootOf, probeFfmpegBinary, readProcessCost, resolveExportFingerprint, signExpiringUrl, verifyExpiringUrl };
@@ -1362,6 +1362,17 @@ var CAM_PROFILE_ORDER = [
1362
1362
  "mid",
1363
1363
  "low"
1364
1364
  ];
1365
+ /**
1366
+ * Which rung a per-camera consumer listens on: an explicit profile, or `auto`.
1367
+ *
1368
+ * `auto` is a REAL value, not an absent one — it means "resolve it by the rule
1369
+ * that consumer owns". It lives beside `CamProfile` because a rung is the only
1370
+ * operator-facing way to name a stream: a cam-stream id is broker-internal and
1371
+ * moves when a slot is reassigned, so a stored id silently stops meaning what
1372
+ * the operator picked. Today's one user is the audio analyser, whose rule is
1373
+ * "the lowest AVAILABLE native rung" (D537).
1374
+ */
1375
+ var AudioStreamPickSchema = z.union([CamProfileSchema, z.literal("auto")]);
1365
1376
  var CamStreamKindSchema = z.enum([
1366
1377
  "pull-rtsp",
1367
1378
  "pull-rtmp",
@@ -3880,7 +3891,8 @@ function createDeviceProxy(api, binding, opts) {
3880
3891
  getIceCandidates: (input) => dispatch("webrtc-session", "webrtcSession", "getIceCandidates", "query", input),
3881
3892
  closeSession: (input) => dispatch("webrtc-session", "webrtcSession", "closeSession", "mutation", input),
3882
3893
  hasAdaptiveBitrate: (input) => dispatch("webrtc-session", "webrtcSession", "hasAdaptiveBitrate", "query", input),
3883
- getSessionState: (input) => dispatch("webrtc-session", "webrtcSession", "getSessionState", "query", input)
3894
+ getSessionState: (input) => dispatch("webrtc-session", "webrtcSession", "getSessionState", "query", input),
3895
+ getSessionDebug: (input) => dispatch("webrtc-session", "webrtcSession", "getSessionDebug", "query", input)
3884
3896
  },
3885
3897
  zoneAnalytics: {
3886
3898
  getCurrentSnapshot: (input) => dispatch("zone-analytics", "zoneAnalytics", "getCurrentSnapshot", "query", input),
@@ -4320,4 +4332,4 @@ function sleepCancellable(ms, signal) {
4320
4332
  });
4321
4333
  }
4322
4334
  //#endregion
4323
- export { CAM_PROFILE_ORDER as $, DeviceType as A, isEvent as At, systemMethod as B, isAudioChunkFormat as Bt, customAction as C, SHARE_VIEW_KINDS as Ct, ChargingStatus as D, createDurableState as Dt, deviceCustomAction as E, normalizeAddonInitResult as Et, event as F, hydrateSchema as Ft, ReadinessRegistry as G, nodePin as H, expandCapMethods as I, resolveHydratedFieldValue as It, readinessKey as J, ReadinessTimeoutError as K, isDeviceConfigCap as L, AUDIO_CHUNK_FORMATS as Lt, DEFAULT_RUNTIME_STATE_DURABILITY as M, WELL_KNOWN_TAB_MAP as Mt, DEVICE_SETTINGS_CONTRIBUTION_METHODS as N, collectHydratedFieldEntries as Nt, DeviceFeature as O, createEvent as Ot, DEVICE_STATUS_METHOD as P, collectHydratedFieldValues as Pt, BrokerStatusSchema as Q, method as R, audioChunkBytesPerSample as Rt, DEVICE_CHILDREN_BATCH_MAX as S, DATAPLANE_SECRET_HEADER as St, describeCustomActions as T, BaseAddon as Tt, readNodePin as U, CAP_NODE_PIN_CONTEXT_KEY as V, toNodeId as W, AudioChunkFormatSchema as X, scopeKey as Y, BrokerStatsSchema as Z, createMirrorSource as _, SubscribeFramesResultSchema as _t, asJsonObject as a, DecodedFrameSchema as at, deviceOpsCapability as b, parseProfileBrokerId as bt, parseJsonArray as c, FrameHandleSchema as ct, BOOT_RECOVERY_BACKOFF_MS as d, ProfileSlotStatusSchema as dt, CamProfileSchema as et, DEVICE_SCOPED_CAPS as f, StreamSourceEntrySchema$1 as ft, createLazyTrpcSource as g, SubscribeFramesInputSchema as gt, createEventBusSliceSource as h, SubscribeAudioChunksResultSchema as ht, asJsonArray as i, DecodedAudioChunkSchema as it, adminUiCapability as j, WELL_KNOWN_TABS as jt, DeviceRole as k, emitReadiness as kt, parseJsonObject as l, ProfileRtspEntrySchema as lt, createDeviceProxy as m, SubscribeAudioChunksInputSchema as mt, sleepCancellable as n, CamStreamResolutionSchema as nt, asNumber as o, EncodedPacketSchema as ot, isDeviceScopedCap as p, StreamSourceSchema as pt, emitDownForOwnedCaps as q, asBoolean as r, CameraStreamSchema as rt, asString as s, FrameHandleFormatSchema as st, sleep as t, CamStreamKindSchema as tt, parseJsonUnknown as u, ProfileSlotSchema as ut, createSliceHandle as v, makeProfileBrokerId as vt, defineCustomActions as w, DisposerChain as wt, viewerUiCapability as x, selectAssignedProfileSlots as xt, RawStateResultSchema as y, makeSourceBrokerId as yt, resolveCapMount as z, expandAudioChunkToF32le as zt };
4335
+ export { BrokerStatusSchema as $, DeviceType as A, emitReadiness as At, systemMethod as B, expandAudioChunkToF32le as Bt, customAction as C, DATAPLANE_SECRET_HEADER as Ct, ChargingStatus as D, normalizeAddonInitResult as Dt, deviceCustomAction as E, BaseAddon as Et, event as F, collectHydratedFieldValues as Ft, ReadinessRegistry as G, nodePin as H, expandCapMethods as I, hydrateSchema as It, readinessKey as J, ReadinessTimeoutError as K, isDeviceConfigCap as L, resolveHydratedFieldValue as Lt, DEFAULT_RUNTIME_STATE_DURABILITY as M, WELL_KNOWN_TABS as Mt, DEVICE_SETTINGS_CONTRIBUTION_METHODS as N, WELL_KNOWN_TAB_MAP as Nt, DeviceFeature as O, createDurableState as Ot, DEVICE_STATUS_METHOD as P, collectHydratedFieldEntries as Pt, BrokerStatsSchema as Q, method as R, AUDIO_CHUNK_FORMATS as Rt, DEVICE_CHILDREN_BATCH_MAX as S, selectAssignedProfileSlots as St, describeCustomActions as T, DisposerChain as Tt, readNodePin as U, CAP_NODE_PIN_CONTEXT_KEY as V, isAudioChunkFormat as Vt, toNodeId as W, AudioChunkFormatSchema as X, scopeKey as Y, AudioStreamPickSchema as Z, createMirrorSource as _, SubscribeFramesInputSchema as _t, asJsonObject as a, DecodedAudioChunkSchema as at, deviceOpsCapability as b, makeSourceBrokerId as bt, parseJsonArray as c, FrameHandleFormatSchema as ct, BOOT_RECOVERY_BACKOFF_MS as d, ProfileSlotSchema as dt, CAM_PROFILE_ORDER as et, DEVICE_SCOPED_CAPS as f, ProfileSlotStatusSchema as ft, createLazyTrpcSource as g, SubscribeAudioChunksResultSchema as gt, createEventBusSliceSource as h, SubscribeAudioChunksInputSchema as ht, asJsonArray as i, CameraStreamSchema as it, adminUiCapability as j, isEvent as jt, DeviceRole as k, createEvent as kt, parseJsonObject as l, FrameHandleSchema as lt, createDeviceProxy as m, StreamSourceSchema as mt, sleepCancellable as n, CamStreamKindSchema as nt, asNumber as o, DecodedFrameSchema as ot, isDeviceScopedCap as p, StreamSourceEntrySchema$1 as pt, emitDownForOwnedCaps as q, asBoolean as r, CamStreamResolutionSchema as rt, asString as s, EncodedPacketSchema as st, sleep as t, CamProfileSchema as tt, parseJsonUnknown as u, ProfileRtspEntrySchema as ut, createSliceHandle as v, SubscribeFramesResultSchema as vt, defineCustomActions as w, SHARE_VIEW_KINDS as wt, viewerUiCapability as x, parseProfileBrokerId as xt, RawStateResultSchema as y, makeProfileBrokerId as yt, resolveCapMount as z, audioChunkBytesPerSample as zt };
@@ -1362,6 +1362,17 @@ var CAM_PROFILE_ORDER = [
1362
1362
  "mid",
1363
1363
  "low"
1364
1364
  ];
1365
+ /**
1366
+ * Which rung a per-camera consumer listens on: an explicit profile, or `auto`.
1367
+ *
1368
+ * `auto` is a REAL value, not an absent one — it means "resolve it by the rule
1369
+ * that consumer owns". It lives beside `CamProfile` because a rung is the only
1370
+ * operator-facing way to name a stream: a cam-stream id is broker-internal and
1371
+ * moves when a slot is reassigned, so a stored id silently stops meaning what
1372
+ * the operator picked. Today's one user is the audio analyser, whose rule is
1373
+ * "the lowest AVAILABLE native rung" (D537).
1374
+ */
1375
+ var AudioStreamPickSchema = zod.z.union([CamProfileSchema, zod.z.literal("auto")]);
1365
1376
  var CamStreamKindSchema = zod.z.enum([
1366
1377
  "pull-rtsp",
1367
1378
  "pull-rtmp",
@@ -3880,7 +3891,8 @@ function createDeviceProxy(api, binding, opts) {
3880
3891
  getIceCandidates: (input) => dispatch("webrtc-session", "webrtcSession", "getIceCandidates", "query", input),
3881
3892
  closeSession: (input) => dispatch("webrtc-session", "webrtcSession", "closeSession", "mutation", input),
3882
3893
  hasAdaptiveBitrate: (input) => dispatch("webrtc-session", "webrtcSession", "hasAdaptiveBitrate", "query", input),
3883
- getSessionState: (input) => dispatch("webrtc-session", "webrtcSession", "getSessionState", "query", input)
3894
+ getSessionState: (input) => dispatch("webrtc-session", "webrtcSession", "getSessionState", "query", input),
3895
+ getSessionDebug: (input) => dispatch("webrtc-session", "webrtcSession", "getSessionDebug", "query", input)
3884
3896
  },
3885
3897
  zoneAnalytics: {
3886
3898
  getCurrentSnapshot: (input) => dispatch("zone-analytics", "zoneAnalytics", "getCurrentSnapshot", "query", input),
@@ -4332,6 +4344,12 @@ Object.defineProperty(exports, "AudioChunkFormatSchema", {
4332
4344
  return AudioChunkFormatSchema;
4333
4345
  }
4334
4346
  });
4347
+ Object.defineProperty(exports, "AudioStreamPickSchema", {
4348
+ enumerable: true,
4349
+ get: function() {
4350
+ return AudioStreamPickSchema;
4351
+ }
4352
+ });
4335
4353
  Object.defineProperty(exports, "BOOT_RECOVERY_BACKOFF_MS", {
4336
4354
  enumerable: true,
4337
4355
  get: function() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.2.225",
3
+ "version": "1.2.227",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",