@camstack/addon-terminal 0.1.52 → 0.1.54

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 (3) hide show
  1. package/dist/addon.js +803 -466
  2. package/dist/addon.mjs +803 -466
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -8117,6 +8117,20 @@ var RelocateJobSchema = object({
8117
8117
  * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8118
8118
  */
8119
8119
  rowsReconciled: number().int().nonnegative().optional(),
8120
+ /**
8121
+ * Rows this run FORGOT because the file they name is not on disk.
8122
+ *
8123
+ * The mover derived the path from the row's own fields and `stat`ed it; an
8124
+ * ENOENT there is a per-path confirmation that the segment is gone (D296),
8125
+ * and the durable row is dropped through the same channel eviction uses. It
8126
+ * is reported for the same reason `rowsReconciled` is: this is a durable
8127
+ * mutation nobody asked for, and a migration that quietly erases hour rows is
8128
+ * the same failure as one that quietly skips them (D295).
8129
+ *
8130
+ * The production drain of 2026-08-30 would have reported 11 074 here — the
8131
+ * ledger claimed 5.65 GB of footage that no longer existed.
8132
+ */
8133
+ rowsForgotten: number().int().nonnegative().optional(),
8120
8134
  startedAt: number(),
8121
8135
  finishedAt: number().nullable(),
8122
8136
  error: string().nullable()
@@ -8480,6 +8494,91 @@ var RelocateResidueSchema = object({
8480
8494
  segments: number().int().nonnegative(),
8481
8495
  bytes: number().int().nonnegative()
8482
8496
  }).nullable();
8497
+ /**
8498
+ * Ask one location whether its durable hour rows describe the disk — the walk
8499
+ * (D319).
8500
+ *
8501
+ * `apply` DEFAULTS TO FALSE and that default is the product: the operator's
8502
+ * missing tool is the question, and the dry run is how they sanity-check the
8503
+ * destructive run before authorising it.
8504
+ */
8505
+ var LedgerWalkInputSchema = object({
8506
+ locationId: string().min(1),
8507
+ /** Forget the confirmed-absent rows, rather than only counting them. */
8508
+ apply: boolean().optional(),
8509
+ /** Narrow to one camera. */
8510
+ deviceId: number().int().positive().optional(),
8511
+ /** Narrow to these recording profiles; empty/absent = every profile. */
8512
+ profiles: array(string().min(1)).optional()
8513
+ });
8514
+ /** Why a whole walk did nothing. Every one leaves the ledger untouched. */
8515
+ var LedgerWalkRefusalSchema = _enum([
8516
+ "location-unknown",
8517
+ "source-writable",
8518
+ "no-ledger",
8519
+ "archive-unreadable",
8520
+ "anchor-absent",
8521
+ "anchor-unreadable",
8522
+ "anchor-moved"
8523
+ ]);
8524
+ _enum([
8525
+ "live-tail",
8526
+ "listing-error",
8527
+ "path-mismatch",
8528
+ "durable-refused"
8529
+ ]);
8530
+ /** Every skip reason, always present, always a number — so a reason that never
8531
+ * fired reports as zero rather than absent and the report shape is constant
8532
+ * between passes. Spelled out rather than `z.record` for exactly that. */
8533
+ var LedgerWalkSkipCountsSchema = object({
8534
+ "live-tail": number().int().nonnegative(),
8535
+ "listing-error": number().int().nonnegative(),
8536
+ "path-mismatch": number().int().nonnegative(),
8537
+ "durable-refused": number().int().nonnegative()
8538
+ });
8539
+ /** One camera's share of a walk, so a report names cameras and not rows. */
8540
+ var LedgerWalkDeviceReportSchema = object({
8541
+ deviceId: number().int(),
8542
+ hoursWalked: number().int().nonnegative(),
8543
+ hoursMissing: number().int().nonnegative(),
8544
+ ghostSegments: number().int().nonnegative(),
8545
+ ghostBytes: number().int().nonnegative(),
8546
+ forgottenSegments: number().int().nonnegative(),
8547
+ orphanFiles: number().int().nonnegative()
8548
+ });
8549
+ /**
8550
+ * What one walk claimed, listed, found and (only when armed) forgot.
8551
+ *
8552
+ * `archiveSegments` is the **M** and `segmentsClaimed` the **N** (D295), so a
8553
+ * walk that saw a fraction of the location is visible in its own report rather
8554
+ * than in the absence of one.
8555
+ */
8556
+ var LedgerWalkReportSchema = object({
8557
+ locationId: string(),
8558
+ applied: boolean(),
8559
+ refused: LedgerWalkRefusalSchema.nullable(),
8560
+ archiveSegments: number().int().nonnegative().nullable(),
8561
+ archiveBytes: number().int().nonnegative().nullable(),
8562
+ hoursClaimed: number().int().nonnegative(),
8563
+ hoursWalked: number().int().nonnegative(),
8564
+ hoursMissing: number().int().nonnegative(),
8565
+ /** `readdir` calls issued — the cost, stated in the unit that is paid. */
8566
+ listings: number().int().nonnegative(),
8567
+ segmentsClaimed: number().int().nonnegative(),
8568
+ ghostSegments: number().int().nonnegative(),
8569
+ ghostBytes: number().int().nonnegative(),
8570
+ ghostHoursWhole: number().int().nonnegative(),
8571
+ forgottenSegments: number().int().nonnegative(),
8572
+ forgottenBytes: number().int().nonnegative(),
8573
+ /** Files under a claimed hour that no durable row names. Never deleted. */
8574
+ orphanFiles: number().int().nonnegative(),
8575
+ orphanSample: array(string()).readonly(),
8576
+ hoursSkipped: number().int().nonnegative(),
8577
+ skippedByReason: LedgerWalkSkipCountsSchema,
8578
+ /** The walk stopped at its per-pass hour bound with claims unwalked. */
8579
+ bounded: boolean(),
8580
+ byDevice: array(LedgerWalkDeviceReportSchema).readonly()
8581
+ });
8483
8582
  /** How many rows a media pass would still act on against a given target — the
8484
8583
  * media lane's denominator AND its residue, from ONE derivation so the two can
8485
8584
  * never disagree. `null` = the count could not be taken. */
@@ -19040,13 +19139,15 @@ var ListGroupsPageSchema = object({
19040
19139
  groups: array(AnalyticsGroupRecordSchema).readonly(),
19041
19140
  nextCursor: string().nullable()
19042
19141
  });
19142
+ var KEY_EVENTS_DEFAULT_LIMIT = 50;
19143
+ var KEY_EVENTS_MAX_LIMIT = 200;
19043
19144
  var KeyEventQueryInput = object({
19044
19145
  deviceId: number(),
19045
19146
  /** Window lower bound (track firstSeen ≥ since). */
19046
19147
  since: number(),
19047
19148
  /** Window upper bound (track firstSeen ≤ until). */
19048
19149
  until: number(),
19049
- limit: number().int().min(1).max(200).default(50),
19150
+ limit: number().int().min(1).max(KEY_EVENTS_MAX_LIMIT).default(KEY_EVENTS_DEFAULT_LIMIT),
19050
19151
  /** Drop tracks scoring below this importance. */
19051
19152
  minImportance: number().min(0).max(1).optional(),
19052
19153
  /** Restrict to a single class (e.g. 'person'). */
@@ -19068,6 +19169,32 @@ var KeyEventSchema = object({
19068
19169
  ...TrackFlagFields,
19069
19170
  ...TrackRetrainFields
19070
19171
  });
19172
+ /** `getKeyEvents`' window and filters, asked of a SET of cameras at once. */
19173
+ var KeyEventBatchQueryInput = object({
19174
+ deviceIds: array(number()).min(1).max(200),
19175
+ since: number(),
19176
+ until: number(),
19177
+ /** Applied PER CAMERA, exactly as `getKeyEvents.limit` is — never a total
19178
+ * across the set, which would let a busy camera starve a quiet one of its
19179
+ * rows and change what the merged feed contains. */
19180
+ limit: number().int().min(1).max(KEY_EVENTS_MAX_LIMIT).default(KEY_EVENTS_DEFAULT_LIMIT),
19181
+ minImportance: number().min(0).max(1).optional(),
19182
+ classFilter: string().optional()
19183
+ });
19184
+ /**
19185
+ * One camera's key events in a batch answer.
19186
+ *
19187
+ * The row exists for every requested id. `getKeyEvents` degrades to `[]` on
19188
+ * error rather than throwing, so a camera whose store read failed and one with
19189
+ * no events in the window were ALREADY indistinguishable per camera — the
19190
+ * batch does not make that worse, and the row keeps the deviceId the single
19191
+ * method's output never carried (the caller used to stamp it from the fan-out
19192
+ * key, which only worked because there was one query per camera).
19193
+ */
19194
+ var KeyEventsForDeviceSchema = object({
19195
+ deviceId: number(),
19196
+ events: array(KeyEventSchema).readonly()
19197
+ });
19071
19198
  object({
19072
19199
  trackId: string(),
19073
19200
  className: string(),
@@ -19139,6 +19266,50 @@ var EventStoreFootprintSchema = object({
19139
19266
  totalBytes: number().int(),
19140
19267
  devices: array(EventStoreDeviceFootprintSchema).readonly()
19141
19268
  });
19269
+ /** Event-media footprint for one {@link MediaFileKind}. */
19270
+ var EventMediaKindFootprintSchema = object({
19271
+ kind: MediaFileKindEnum,
19272
+ /** Media rows of this kind. */
19273
+ rows: number().int(),
19274
+ /** Bytes on disk held by those rows. */
19275
+ bytes: number().int()
19276
+ });
19277
+ /**
19278
+ * The media footprint broken down by KIND — the axis a deletion decision
19279
+ * actually turns on.
19280
+ *
19281
+ * A byte total says how much there is; it cannot say what is safe to remove.
19282
+ * The deletable set (the periodic `snapshot` filmstrip, the surplus per-edge
19283
+ * motion stills) and the keep set (`firstFrame`, rolling `lastFrame`,
19284
+ * `thumbnail`/`thumbnailSmall`, `keyFrame`/`keyFrameSmall`, the face/plate
19285
+ * buffers, gallery media, the CLIP `crop`) are distinguished by `kind` and by
19286
+ * nothing else, so sizing a deletion means summing per kind.
19287
+ *
19288
+ * ## Why `unaccounted*` exists
19289
+ *
19290
+ * `kinds` is enumerated from {@link MediaFileKindEnum} — the closed set the
19291
+ * writers use — and summed one kind at a time. `totalRows` / `totalBytes` come
19292
+ * from a SEPARATE unfiltered aggregate over the same rows, never from adding
19293
+ * `kinds` up. A row whose stored `kind` is not in the enum (written by a
19294
+ * retired code path, or by a version that knew a kind this one does not) would
19295
+ * otherwise vanish from the total silently, and an operator would delete
19296
+ * against a denominator smaller than the disk.
19297
+ *
19298
+ * `unaccountedRows` / `unaccountedBytes` are the difference. They are normally
19299
+ * zero; a non-zero value is a real finding and must be shown, not rounded away.
19300
+ */
19301
+ var EventMediaKindBreakdownSchema = object({
19302
+ /** Every media row in scope, from one unfiltered aggregate. */
19303
+ totalRows: number().int(),
19304
+ /** Every media byte in scope, from that same aggregate. */
19305
+ totalBytes: number().int(),
19306
+ /** Per-kind footprint, ordered by bytes descending. */
19307
+ kinds: array(EventMediaKindFootprintSchema).readonly(),
19308
+ /** `totalRows` minus the summed `kinds` rows — see the schema note. */
19309
+ unaccountedRows: number().int(),
19310
+ /** `totalBytes` minus the summed `kinds` bytes — see the schema note. */
19311
+ unaccountedBytes: number().int()
19312
+ });
19142
19313
  /** Per-kind counts returned by the event-prune / device-delete mutations. */
19143
19314
  var EventPruneCountsSchema = object({
19144
19315
  motion: number().int(),
@@ -19293,7 +19464,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19293
19464
  until: number().optional(),
19294
19465
  kinds: array(string()).optional(),
19295
19466
  limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
19296
- }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
19467
+ }), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(KeyEventBatchQueryInput, array(KeyEventsForDeviceSchema).readonly()), method(object({
19297
19468
  deviceId: number(),
19298
19469
  since: number(),
19299
19470
  until: number(),
@@ -19342,6 +19513,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19342
19513
  }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
19343
19514
  kind: "query",
19344
19515
  auth: "admin"
19516
+ }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
19517
+ kind: "query",
19518
+ auth: "admin"
19345
19519
  }), method(object({
19346
19520
  olderThanMs: number(),
19347
19521
  reason: OpsLogReasonSchema.optional()
@@ -21397,6 +21571,20 @@ method(object({
21397
21571
  error: string().optional()
21398
21572
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
21399
21573
  providerId: string(),
21574
+ /**
21575
+ * The location this config is an UNSAVED edit of, when there is one.
21576
+ *
21577
+ * `listLocations` replaces every declared secret with the redaction
21578
+ * sentinel, so the edit modal's form state holds the sentinel for any
21579
+ * credential the operator did not retype — and posting that here
21580
+ * without a way to resolve it makes the provider try to authenticate
21581
+ * as `__camstack_redacted__` and report the operator's own working
21582
+ * password as wrong. Given this id, the orchestrator restores each
21583
+ * sentinel from the stored config (same rule as `upsertLocation`)
21584
+ * before dispatching. Omitted by the "Add location" wizard, where
21585
+ * every value was typed just now and nothing is stored yet.
21586
+ */
21587
+ locationId: string().optional(),
21400
21588
  config: record(string(), unknown())
21401
21589
  }), object({
21402
21590
  ok: boolean(),
@@ -28791,6 +28979,9 @@ method(object({
28791
28979
  }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28792
28980
  kind: "query",
28793
28981
  auth: "admin"
28982
+ }), method(LedgerWalkInputSchema, LedgerWalkReportSchema, {
28983
+ kind: "mutation",
28984
+ auth: "admin"
28794
28985
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28795
28986
  kind: "mutation",
28796
28987
  auth: "admin"
@@ -29182,6 +29373,25 @@ var SceneMonitorStatusSchema = object({
29182
29373
  monitors: array(SceneMonitorSchema),
29183
29374
  lastFetchedAt: number()
29184
29375
  });
29376
+ /**
29377
+ * One camera's row in a `listScenesBatch` answer.
29378
+ *
29379
+ * `status` is NULLABLE and the nullability is the whole point. `scene-monitor`
29380
+ * is a `defaultActive` wrapper, so every camera is asked; a camera whose
29381
+ * provider is absent (pipeline-analytics not deployed, the post-processing node
29382
+ * down) cannot answer, and that is not the same fact as a camera with no scenes
29383
+ * configured. Fanned out per camera the difference was visible — one query
29384
+ * errored while the others resolved — and a batch that returned only the rows
29385
+ * it managed would have destroyed it, silently, by making an unreachable camera
29386
+ * indistinguishable from one that answered `monitors: []`.
29387
+ *
29388
+ * So: EVERY requested deviceId gets a row. `status: null` means "this camera
29389
+ * could not be read"; `status.monitors: []` means "read, and it has none".
29390
+ */
29391
+ var SceneMonitorStatusForDeviceSchema = object({
29392
+ deviceId: number(),
29393
+ status: SceneMonitorStatusSchema.nullable()
29394
+ });
29185
29395
  var sceneMonitorCapability = {
29186
29396
  name: "scene-monitor",
29187
29397
  scope: "device",
@@ -29191,6 +29401,22 @@ var sceneMonitorCapability = {
29191
29401
  deviceTypes: [DeviceType.Camera],
29192
29402
  methods: {
29193
29403
  listScenes: method(object({ deviceId: number() }), SceneMonitorStatusSchema),
29404
+ /**
29405
+ * The same answer, for a SET of cameras, in one round trip.
29406
+ *
29407
+ * `/scenes` renders every camera and re-reads them on a 30s safety-net
29408
+ * poll behind the push slice. Fanned out client-side that was one query
29409
+ * per camera — 29 round trips through the browser, the hub and the
29410
+ * post-analysis runner every 30 seconds to read an in-memory map the
29411
+ * owner had already merged. The work is unchanged (`statusFor` per
29412
+ * device, all in-process at the owner); what collapses is the transport.
29413
+ *
29414
+ * A camera that cannot answer still gets a row, with `status: null` —
29415
+ * see {@link SceneMonitorStatusForDeviceSchema}. Never fewer rows than
29416
+ * ids: a caller that asked for twenty-nine and got twenty-seven cannot
29417
+ * tell which two are missing, or that any are.
29418
+ */
29419
+ listScenesBatch: method(object({ deviceIds: array(number()).min(1).max(200) }), array(SceneMonitorStatusForDeviceSchema).readonly()),
29194
29420
  createScene: method(object({
29195
29421
  deviceId: number(),
29196
29422
  label: string(),
@@ -31026,6 +31252,27 @@ var CameraOccupancySnapshotSchema = object({
31026
31252
  stationaryObjects: array(StationaryObjectSchema).readonly().optional()
31027
31253
  });
31028
31254
  /**
31255
+ * One camera's row in a `getCurrentSnapshotBatch` answer.
31256
+ *
31257
+ * THREE outcomes, and the single-camera method could only express two of them
31258
+ * because `snapshot: null` was already spoken for:
31259
+ *
31260
+ * - `read: 'read'`, `snapshot` present — the live occupancy reading.
31261
+ * - `read: 'read'`, `snapshot: null` — read, and this camera has no reading
31262
+ * yet: no frame since boot, and no parked-object registry to hydrate from.
31263
+ * - `read: 'unreadable'` — the owner could not answer for this
31264
+ * camera. `snapshot` is null, and it does NOT mean "nothing parked here".
31265
+ *
31266
+ * Collapsing the last two is the failure this field exists to prevent: a
31267
+ * hydration that threw would otherwise render as an empty Stationary section,
31268
+ * which is a definite claim about a camera nobody could read.
31269
+ */
31270
+ var CameraOccupancySnapshotForDeviceSchema = object({
31271
+ deviceId: number(),
31272
+ read: _enum(["read", "unreadable"]),
31273
+ snapshot: CameraOccupancySnapshotSchema.nullable()
31274
+ });
31275
+ /**
31029
31276
  * Time-series resolution. The history methods return one bucket per
31030
31277
  * step over the requested range. Smaller resolutions cost more
31031
31278
  * memory + bandwidth; bound to discrete steps so caller cannot ask
@@ -31082,6 +31329,20 @@ var zoneAnalyticsCapability = {
31082
31329
  * (no inference result emitted since boot or since binding was
31083
31330
  * activated). */
31084
31331
  getCurrentSnapshot: method(object({ deviceId: number() }), CameraOccupancySnapshotSchema.nullable()),
31332
+ /**
31333
+ * The same snapshot, for a SET of cameras, in one round trip.
31334
+ *
31335
+ * The Events page's Stationary section polls this every 15s for every
31336
+ * selected camera. Fanned out client-side that is one query per camera to
31337
+ * read a `Map.get` at the owner — the answer costs nothing, the round trip
31338
+ * costs everything. Batched, N transports become one and the per-device
31339
+ * work is unchanged.
31340
+ *
31341
+ * Every requested deviceId gets a row, tagged `read` — see
31342
+ * {@link CameraOccupancySnapshotForDeviceSchema}. A camera the owner could
31343
+ * not answer for is `'unreadable'`, never an empty reading.
31344
+ */
31345
+ getCurrentSnapshotBatch: method(object({ deviceIds: array(number()).min(1).max(200) }), array(CameraOccupancySnapshotForDeviceSchema).readonly()),
31085
31346
  /** Time-series object count inside one zone. `className` optional —
31086
31347
  * omit to count every class in the zone. */
31087
31348
  getZoneHistory: method(object({
@@ -35477,6 +35738,12 @@ Object.freeze({
35477
35738
  addonId: null,
35478
35739
  access: "view"
35479
35740
  },
35741
+ "pipelineAnalytics.getEventMediaFootprintByKind": {
35742
+ capName: "pipeline-analytics",
35743
+ capScope: "device",
35744
+ addonId: null,
35745
+ access: "view"
35746
+ },
35480
35747
  "pipelineAnalytics.getEventStoreFootprint": {
35481
35748
  capName: "pipeline-analytics",
35482
35749
  capScope: "device",
@@ -35495,6 +35762,12 @@ Object.freeze({
35495
35762
  addonId: null,
35496
35763
  access: "view"
35497
35764
  },
35765
+ "pipelineAnalytics.getKeyEventsBatch": {
35766
+ capName: "pipeline-analytics",
35767
+ capScope: "device",
35768
+ addonId: null,
35769
+ access: "view"
35770
+ },
35498
35771
  "pipelineAnalytics.getMotionEvents": {
35499
35772
  capName: "pipeline-analytics",
35500
35773
  capScope: "device",
@@ -36671,6 +36944,12 @@ Object.freeze({
36671
36944
  addonId: null,
36672
36945
  access: "view"
36673
36946
  },
36947
+ "recording.reconcileLedgerAgainstDisk": {
36948
+ capName: "recording",
36949
+ capScope: "system",
36950
+ addonId: null,
36951
+ access: "create"
36952
+ },
36674
36953
  "recording.refreshStorageLocationsForMigration": {
36675
36954
  capName: "recording",
36676
36955
  capScope: "system",
@@ -36797,6 +37076,12 @@ Object.freeze({
36797
37076
  addonId: null,
36798
37077
  access: "view"
36799
37078
  },
37079
+ "sceneMonitor.listScenesBatch": {
37080
+ capName: "scene-monitor",
37081
+ capScope: "device",
37082
+ addonId: null,
37083
+ access: "view"
37084
+ },
36800
37085
  "sceneMonitor.recheckNow": {
36801
37086
  capName: "scene-monitor",
36802
37087
  capScope: "device",
@@ -38153,6 +38438,12 @@ Object.freeze({
38153
38438
  addonId: null,
38154
38439
  access: "view"
38155
38440
  },
38441
+ "zoneAnalytics.getCurrentSnapshotBatch": {
38442
+ capName: "zone-analytics",
38443
+ capScope: "device",
38444
+ addonId: null,
38445
+ access: "view"
38446
+ },
38156
38447
  "zoneAnalytics.getUnzonedHistory": {
38157
38448
  capName: "zone-analytics",
38158
38449
  capScope: "device",
@@ -39142,6 +39433,11 @@ Object.freeze({
39142
39433
  form: "single",
39143
39434
  optional: false
39144
39435
  }],
39436
+ "pipelineAnalytics.getEventMediaFootprintByKind": [{
39437
+ name: "deviceId",
39438
+ form: "single",
39439
+ optional: true
39440
+ }],
39145
39441
  "pipelineAnalytics.getGroup": [{
39146
39442
  name: "deviceId",
39147
39443
  form: "single",
@@ -39152,6 +39448,11 @@ Object.freeze({
39152
39448
  form: "single",
39153
39449
  optional: false
39154
39450
  }],
39451
+ "pipelineAnalytics.getKeyEventsBatch": [{
39452
+ name: "deviceIds",
39453
+ form: "array",
39454
+ optional: false
39455
+ }],
39155
39456
  "pipelineAnalytics.getMotionEvents": [{
39156
39457
  name: "deviceId",
39157
39458
  form: "single",
@@ -39592,6 +39893,11 @@ Object.freeze({
39592
39893
  form: "single",
39593
39894
  optional: false
39594
39895
  }],
39896
+ "recording.reconcileLedgerAgainstDisk": [{
39897
+ name: "deviceId",
39898
+ form: "single",
39899
+ optional: true
39900
+ }],
39595
39901
  "recording.relocateFootage": [{
39596
39902
  name: "deviceId",
39597
39903
  form: "single",
@@ -39657,6 +39963,11 @@ Object.freeze({
39657
39963
  form: "single",
39658
39964
  optional: false
39659
39965
  }],
39966
+ "sceneMonitor.listScenesBatch": [{
39967
+ name: "deviceIds",
39968
+ form: "array",
39969
+ optional: false
39970
+ }],
39660
39971
  "sceneMonitor.recheckNow": [{
39661
39972
  name: "deviceId",
39662
39973
  form: "single",
@@ -39918,6 +40229,11 @@ Object.freeze({
39918
40229
  form: "single",
39919
40230
  optional: false
39920
40231
  }],
40232
+ "zoneAnalytics.getCurrentSnapshotBatch": [{
40233
+ name: "deviceIds",
40234
+ form: "array",
40235
+ optional: false
40236
+ }],
39921
40237
  "zoneAnalytics.getUnzonedHistory": [{
39922
40238
  name: "deviceId",
39923
40239
  form: "single",
@@ -40491,6 +40807,111 @@ function resolveGlancesCursesShimEnv(options) {
40491
40807
  return { PYTHONPATH: existing ? `${options.shimDir}:${existing}` : options.shimDir };
40492
40808
  }
40493
40809
  //#endregion
40810
+ //#region src/profile-settings.ts
40811
+ var GLANCES_PLUGINS = [
40812
+ {
40813
+ key: "showCpu",
40814
+ plugin: "cpu",
40815
+ label: "CPU"
40816
+ },
40817
+ {
40818
+ key: "showMem",
40819
+ plugin: "mem",
40820
+ label: "Memory"
40821
+ },
40822
+ {
40823
+ key: "showLoad",
40824
+ plugin: "load",
40825
+ label: "Load"
40826
+ },
40827
+ {
40828
+ key: "showNetwork",
40829
+ plugin: "network",
40830
+ label: "Network"
40831
+ },
40832
+ {
40833
+ key: "showDiskIo",
40834
+ plugin: "diskio",
40835
+ label: "Disk I/O"
40836
+ },
40837
+ {
40838
+ key: "showFs",
40839
+ plugin: "fs",
40840
+ label: "Filesystems"
40841
+ },
40842
+ {
40843
+ key: "showProcessList",
40844
+ plugin: "processlist",
40845
+ label: "Process list"
40846
+ },
40847
+ {
40848
+ key: "showContainers",
40849
+ plugin: "containers",
40850
+ label: "Containers"
40851
+ },
40852
+ {
40853
+ key: "showSensors",
40854
+ plugin: "sensors",
40855
+ label: "Sensors"
40856
+ }
40857
+ ];
40858
+ function glancesBooleanField(key, label) {
40859
+ return {
40860
+ type: "boolean",
40861
+ key,
40862
+ label,
40863
+ default: true,
40864
+ style: "switch"
40865
+ };
40866
+ }
40867
+ function glancesSettingsSchema() {
40868
+ return { sections: [{
40869
+ id: "glances-panels",
40870
+ title: "Glances panels",
40871
+ description: "Turn off a panel to pass --disable-plugin to this Terminal only. All on is the measured default (~1% of one core at the camera grid).",
40872
+ columns: 2,
40873
+ fields: GLANCES_PLUGINS.map((plugin) => glancesBooleanField(plugin.key, plugin.label))
40874
+ }] };
40875
+ }
40876
+ function settingsSchemaForProfile(profileId) {
40877
+ if (profileId === "glances") return glancesSettingsSchema();
40878
+ return null;
40879
+ }
40880
+ function glancesSettingsToArgs(settings) {
40881
+ const disabled = GLANCES_PLUGINS.filter((plugin) => settings[plugin.key] === false).map((plugin) => plugin.plugin);
40882
+ if (disabled.length === 0) return [];
40883
+ return ["--disable-plugin", disabled.join(",")];
40884
+ }
40885
+ function sanitizeProfileSettings(profileId, raw) {
40886
+ if (profileId !== "glances") return {};
40887
+ const bag = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
40888
+ const out = {
40889
+ showCpu: true,
40890
+ showMem: true,
40891
+ showLoad: true,
40892
+ showNetwork: true,
40893
+ showDiskIo: true,
40894
+ showFs: true,
40895
+ showProcessList: true,
40896
+ showContainers: true,
40897
+ showSensors: true
40898
+ };
40899
+ for (const plugin of GLANCES_PLUGINS) {
40900
+ const value = bag[plugin.key];
40901
+ if (typeof value === "boolean") out[plugin.key] = value;
40902
+ }
40903
+ return out;
40904
+ }
40905
+ function profileSettingsToArgs(profileId, settings) {
40906
+ if (profileId !== "glances") return [];
40907
+ return glancesSettingsToArgs(sanitizeProfileSettings(profileId, settings));
40908
+ }
40909
+ function spawnArgsForInstance(input) {
40910
+ const extra = profileSettingsToArgs(input.profileId, input.profileSettings);
40911
+ if (input.instanceArgs.length > 0) return [...input.instanceArgs, ...extra];
40912
+ if (extra.length > 0) return [...input.profileArgs, ...extra];
40913
+ }
40914
+ //#endregion
40494
40915
  //#region src/pty.ts
40495
40916
  /**
40496
40917
  * Minimal pty abstraction. The manager depends on this interface, never on
@@ -40672,6 +41093,356 @@ async function silenceAnalysisFor(deps, deviceId) {
40672
41093
  if (failures.length > 0) throw new Error(`terminal camera ${deviceId}: could not switch off ${failures.length} analyzer(s) — it will run at full detection cost (${failures.join("; ")})`);
40673
41094
  }
40674
41095
  //#endregion
41096
+ //#region src/terminal-camera-declarations.ts
41097
+ /**
41098
+ * Feed DeclaredDevices every live declaration plus one deterministic orphan
41099
+ * batch. The generic sweep intentionally refuses an over-limit set; selecting
41100
+ * a batch here drains large historical Terminal orphan sets across convergence
41101
+ * passes without weakening that global safety guard.
41102
+ */
41103
+ function terminalCameraReconciliationIndex(rows, integrationId, declarations, managedStableIds = /* @__PURE__ */ new Set()) {
41104
+ if (!integrationId) return [];
41105
+ const declared = new Set(declarations.map((camera) => camera.stableId));
41106
+ const owned = rows.filter((row) => row.integrationId === integrationId && (declared.has(row.stableId) || managedStableIds.has(row.stableId) || row.stableId.startsWith("terminal-camera-instance-")));
41107
+ return [...owned.filter((row) => declared.has(row.stableId)), ...owned.filter((row) => !declared.has(row.stableId)).sort((left, right) => left.id - right.id).slice(0, 32)];
41108
+ }
41109
+ /** Explicit persisted instances, never the node × profile template matrix. */
41110
+ function buildTerminalInstanceCameraDeclarations(instances) {
41111
+ return instances.filter((instance) => instance.enabled).map((instance) => ({
41112
+ stableId: instance.cameraStableId,
41113
+ name: instance.name,
41114
+ config: {
41115
+ instanceId: instance.id,
41116
+ nodeId: instance.nodeId,
41117
+ profileId: instance.profileId,
41118
+ profileLabel: instance.profileLabel
41119
+ }
41120
+ }));
41121
+ }
41122
+ /**
41123
+ * `DeviceConfig` materializes schema defaults in memory, so comparing
41124
+ * `config.get()` cannot detect a legacy `{ nodeId }` row. Reconciliation must
41125
+ * inspect the raw persisted blob to make the profile migration durable.
41126
+ */
41127
+ function needsTerminalCameraConfigMigration(persistedConfig, declaration) {
41128
+ return persistedConfig.instanceId !== declaration.config.instanceId || persistedConfig.nodeId !== declaration.config.nodeId || persistedConfig.profileId !== declaration.config.profileId || persistedConfig.profileLabel !== declaration.config.profileLabel;
41129
+ }
41130
+ //#endregion
41131
+ //#region src/terminal-cell-runs.ts
41132
+ var TERMINAL_DEFAULT_FG = "#d7dce2";
41133
+ var TERMINAL_DEFAULT_BG = "#0b0d10";
41134
+ /**
41135
+ * The 16 ANSI colours, in a dark-theme variant chosen to sit with the existing
41136
+ * frame (`#0b0d10` ground, `#d7dce2` text) rather than the raw xterm defaults,
41137
+ * whose pure `#0000ff` blue and `#008000` green are close to unreadable on a
41138
+ * near-black background at 13px. Index 7 IS the default foreground, so plain
41139
+ * `CSI 37m` text renders identically to unstyled text.
41140
+ */
41141
+ var TERMINAL_ANSI_PALETTE = [
41142
+ "#282c34",
41143
+ "#e06c75",
41144
+ "#98c379",
41145
+ "#e5c07b",
41146
+ "#61afef",
41147
+ "#c678dd",
41148
+ "#56b6c2",
41149
+ TERMINAL_DEFAULT_FG,
41150
+ "#5c6370",
41151
+ "#ef596f",
41152
+ "#89ca78",
41153
+ "#f0c674",
41154
+ "#6cb6ff",
41155
+ "#d55fde",
41156
+ "#2bbac5",
41157
+ "#ffffff"
41158
+ ];
41159
+ /** The six levels of the xterm 6×6×6 colour cube (indices 16-231). */
41160
+ var TERMINAL_CUBE_LEVELS = [
41161
+ 0,
41162
+ 95,
41163
+ 135,
41164
+ 175,
41165
+ 215,
41166
+ 255
41167
+ ];
41168
+ var TERMINAL_CUBE_FIRST = 16;
41169
+ var TERMINAL_GRAYSCALE_FIRST = 232;
41170
+ var TERMINAL_GRAYSCALE_BASE = 8;
41171
+ var TERMINAL_GRAYSCALE_STEP = 10;
41172
+ /** SGR 2 keeps the foreground legible; it must not become the background. */
41173
+ var TERMINAL_DIM_WEIGHT = .6;
41174
+ function channel(value) {
41175
+ return Math.max(0, Math.min(255, Math.round(value))).toString(16).padStart(2, "0");
41176
+ }
41177
+ function hex(red, green, blue) {
41178
+ return `#${channel(red)}${channel(green)}${channel(blue)}`;
41179
+ }
41180
+ function parseHex(color) {
41181
+ return [
41182
+ Number.parseInt(color.slice(1, 3), 16),
41183
+ Number.parseInt(color.slice(3, 5), 16),
41184
+ Number.parseInt(color.slice(5, 7), 16)
41185
+ ];
41186
+ }
41187
+ /** Resolve an xterm palette index (0-255) to a hex colour. */
41188
+ function terminalPaletteColor(index) {
41189
+ const ansi = TERMINAL_ANSI_PALETTE[index];
41190
+ if (ansi !== void 0) return ansi;
41191
+ if (index >= TERMINAL_GRAYSCALE_FIRST) {
41192
+ const level = TERMINAL_GRAYSCALE_BASE + (index - TERMINAL_GRAYSCALE_FIRST) * TERMINAL_GRAYSCALE_STEP;
41193
+ return hex(level, level, level);
41194
+ }
41195
+ if (index >= TERMINAL_CUBE_FIRST) {
41196
+ const offset = index - TERMINAL_CUBE_FIRST;
41197
+ return hex(TERMINAL_CUBE_LEVELS[Math.floor(offset / 36) % 6] ?? 0, TERMINAL_CUBE_LEVELS[Math.floor(offset / 6) % 6] ?? 0, TERMINAL_CUBE_LEVELS[offset % 6] ?? 0);
41198
+ }
41199
+ return TERMINAL_DEFAULT_FG;
41200
+ }
41201
+ /** Resolve a 0xRRGGBB truecolor value to a hex colour. */
41202
+ function terminalRgbColor(value) {
41203
+ return hex(value >> 16 & 255, value >> 8 & 255, value & 255);
41204
+ }
41205
+ function blend(color, toward, weight) {
41206
+ const [red, green, blue] = parseHex(color);
41207
+ const [targetRed, targetGreen, targetBlue] = parseHex(toward);
41208
+ return hex(red * weight + targetRed * (1 - weight), green * weight + targetGreen * (1 - weight), blue * weight + targetBlue * (1 - weight));
41209
+ }
41210
+ function resolveForeground(cell) {
41211
+ if (cell.isFgRGB()) return terminalRgbColor(cell.getFgColor());
41212
+ if (cell.isFgPalette()) return terminalPaletteColor(cell.getFgColor());
41213
+ return TERMINAL_DEFAULT_FG;
41214
+ }
41215
+ function resolveBackground(cell) {
41216
+ if (cell.isBgRGB()) return terminalRgbColor(cell.getBgColor());
41217
+ if (cell.isBgPalette()) return terminalPaletteColor(cell.getBgColor());
41218
+ return TERMINAL_DEFAULT_BG;
41219
+ }
41220
+ /**
41221
+ * Resolve one cell's attributes into concrete colours.
41222
+ *
41223
+ * Inverse is applied by SWAPPING the already-resolved pair, so inverse over two
41224
+ * defaults is still a visible swap rather than a no-op — that is how a selected
41225
+ * or highlighted row in Glances reads. Invisible is then conceal-by-equality
41226
+ * (foreground painted in its own background): the cell keeps its columns, which
41227
+ * a dropped cell would not, and dropping it would shift the whole rest of the
41228
+ * row left.
41229
+ */
41230
+ function resolveCellStyle(cell) {
41231
+ const inverse = cell.isInverse() !== 0;
41232
+ const plainFg = resolveForeground(cell);
41233
+ const plainBg = resolveBackground(cell);
41234
+ const background = inverse ? plainFg : plainBg;
41235
+ let foreground = inverse ? plainBg : plainFg;
41236
+ if (cell.isDim() !== 0) foreground = blend(foreground, background, TERMINAL_DIM_WEIGHT);
41237
+ if (cell.isInvisible() !== 0) foreground = background;
41238
+ return {
41239
+ fg: foreground === "#d7dce2" ? null : foreground,
41240
+ bg: background === "#0b0d10" ? null : background,
41241
+ bold: cell.isBold() !== 0
41242
+ };
41243
+ }
41244
+ function sameStyle(left, right) {
41245
+ return left.fg === right.fg && left.bg === right.bg && left.bold === right.bold;
41246
+ }
41247
+ /**
41248
+ * Merge adjacent same-style cells into runs, then drop the trailing run of
41249
+ * default-styled whitespace so a row costs what it draws — the same trim
41250
+ * `translateToString(true)` performs. Whitespace carrying a BACKGROUND is kept:
41251
+ * a green bar of spaces out to the right margin is a pixel Glances drew.
41252
+ */
41253
+ function buildCellRuns(cells) {
41254
+ const runs = [];
41255
+ let text = "";
41256
+ let style = null;
41257
+ for (const cell of cells) {
41258
+ if (style !== null && sameStyle(style, cell.style)) {
41259
+ text += cell.text;
41260
+ continue;
41261
+ }
41262
+ if (style !== null) runs.push({
41263
+ text,
41264
+ ...style
41265
+ });
41266
+ text = cell.text;
41267
+ style = cell.style;
41268
+ }
41269
+ if (style !== null) runs.push({
41270
+ text,
41271
+ ...style
41272
+ });
41273
+ while (runs.length > 0) {
41274
+ const last = runs[runs.length - 1];
41275
+ if (last === void 0 || last.bg !== null) break;
41276
+ const trimmed = last.text.replace(/\s+$/u, "");
41277
+ if (trimmed === last.text) break;
41278
+ if (trimmed === "") {
41279
+ runs.pop();
41280
+ continue;
41281
+ }
41282
+ runs[runs.length - 1] = {
41283
+ ...last,
41284
+ text: trimmed
41285
+ };
41286
+ break;
41287
+ }
41288
+ return runs;
41289
+ }
41290
+ /**
41291
+ * Monospace families to try, in order — NOT one family and a generic.
41292
+ *
41293
+ * A terminal screen is mostly box-drawing and block characters, and a font
41294
+ * without them renders the frame as noise rather than as missing detail.
41295
+ * `DejaVu Sans Mono` covers them and ships in the hub image; macOS has neither
41296
+ * DejaVu nor fontconfig, so the Mac agent fell through to a generic whose
41297
+ * coverage is not, and its Glances camera came out unreadable while the hub's
41298
+ * was pixel-perfect (measured 2026-08-11, same Glances, two nodes).
41299
+ *
41300
+ * `Menlo` is the fix rather than a guess: it is macOS's default terminal face,
41301
+ * present on every install, and derived from DejaVu Sans Mono — the same glyph
41302
+ * coverage by ancestry. Monaco and Courier New follow as older fallbacks; the
41303
+ * generic stays last so a host with none of them still draws something.
41304
+ */
41305
+ var TERMINAL_FONT_STACK = "DejaVu Sans Mono,Menlo,Monaco,Courier New,monospace";
41306
+ var TERMINAL_FONT_SIZE = 13;
41307
+ var TERMINAL_TEXT_MARGIN_X = 8;
41308
+ var TERMINAL_ROW_HEIGHT = 15;
41309
+ var TERMINAL_BASELINE_Y = 18;
41310
+ /**
41311
+ * Distance from a row's baseline up to the top of its cell box. Chosen so
41312
+ * consecutive rows tile exactly: row N's box runs from `baseline - this` for
41313
+ * `TERMINAL_ROW_HEIGHT`, and row N+1's box starts where it ends. A background
41314
+ * bar that stopped short would draw as stripes across a `CSI 42m` panel.
41315
+ */
41316
+ var TERMINAL_CELL_ASCENT = 11.5;
41317
+ var TERMINAL_CELL_WIDTH = TERMINAL_FONT_SIZE * (1233 / 2048);
41318
+ /** Two decimals is under a tenth of a pixel and keeps the SVG small. */
41319
+ function coordinate(value) {
41320
+ return String(Number(value.toFixed(2)));
41321
+ }
41322
+ function escapeXml(value) {
41323
+ return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;");
41324
+ }
41325
+ /**
41326
+ * Render already-interpreted terminal rows into a compact MJPEG frame.
41327
+ *
41328
+ * `xml:space="preserve"` is load-bearing, not tidiness. SVG `<text>` collapses
41329
+ * runs of whitespace by default, and a terminal's entire column alignment IS
41330
+ * runs of whitespace — Glances pads every field with spaces. Without it the
41331
+ * frame drew each line at roughly half its true width, crammed into the
41332
+ * top-left of a mostly-black image, while the SAME session over `attach`
41333
+ * looked perfect — which is exactly how the operator reported it. Measured in
41334
+ * the hub's own rasterizer 2026-08-11: `AAA<10 spaces>BBB<3>CCC` drew 92 px
41335
+ * collapsed against 178 px preserved.
41336
+ *
41337
+ * Every run is anchored at its OWN column (`x = margin + startCol * cellW`),
41338
+ * never appended to the one before it, so the background rects and the glyphs
41339
+ * are placed off the same grid and cannot drift apart. `textLength` is emitted
41340
+ * with it because it is the correct declaration and renderers that honour it
41341
+ * get an exact grid — but it is not what makes this work: librsvg, which sharp
41342
+ * uses, ignores it outright (measured 2026-08-12, a 120-glyph run pinned to
41343
+ * 600 px still drew its natural 937 px). The anchoring is the guarantee.
41344
+ */
41345
+ function renderTerminalSvg(rows) {
41346
+ const backgrounds = [];
41347
+ const texts = [];
41348
+ rows.slice(0, 40).forEach((row, index) => {
41349
+ const baseline = TERMINAL_BASELINE_Y + index * TERMINAL_ROW_HEIGHT;
41350
+ const top = baseline - TERMINAL_CELL_ASCENT;
41351
+ let column = 0;
41352
+ for (const run of row) {
41353
+ if (column >= 120) break;
41354
+ const clipped = clipRun(run, 120 - column);
41355
+ const columns = [...clipped].length;
41356
+ if (columns === 0) continue;
41357
+ const x = TERMINAL_TEXT_MARGIN_X + column * TERMINAL_CELL_WIDTH;
41358
+ const width = columns * TERMINAL_CELL_WIDTH;
41359
+ if (run.bg !== null) backgrounds.push(`<rect x="${coordinate(x)}" y="${coordinate(top)}" width="${coordinate(width)}" height="${String(TERMINAL_ROW_HEIGHT)}" fill="${run.bg}"/>`);
41360
+ if (clipped.trim() !== "") {
41361
+ const fill = run.fg === null ? "" : ` fill="${run.fg}"`;
41362
+ const weight = run.bold ? " font-weight=\"bold\"" : "";
41363
+ texts.push(`<text xml:space="preserve" x="${coordinate(x)}" y="${coordinate(baseline)}" textLength="${coordinate(width)}" lengthAdjust="spacingAndGlyphs"${fill}${weight}>${escapeXml(clipped)}</text>`);
41364
+ }
41365
+ column += columns;
41366
+ }
41367
+ });
41368
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${String(960)}" height="${String(640)}"><rect width="100%" height="100%" fill="${TERMINAL_DEFAULT_BG}"/>${backgrounds.join("")}<g fill="${TERMINAL_DEFAULT_FG}" font-family="${TERMINAL_FONT_STACK}" font-size="${String(TERMINAL_FONT_SIZE)}">${texts.join("")}</g></svg>`;
41369
+ }
41370
+ /** Cut a run to the columns still left in the row, by code point not unit. */
41371
+ function clipRun(run, remaining) {
41372
+ const points = [...run.text];
41373
+ return points.length <= remaining ? run.text : points.slice(0, remaining).join("");
41374
+ }
41375
+ async function renderTerminalJpeg(rows) {
41376
+ return (0, sharp.default)(Buffer.from(renderTerminalSvg(rows))).jpeg({
41377
+ quality: 82,
41378
+ chromaSubsampling: "4:2:0"
41379
+ }).toBuffer();
41380
+ }
41381
+ //#endregion
41382
+ //#region src/terminal-camera-device.ts
41383
+ var terminalCameraSchema = object({
41384
+ instanceId: string().min(1).optional(),
41385
+ nodeId: string().min(1),
41386
+ profileId: string().min(1).default("monitor"),
41387
+ profileLabel: string().min(1).default("BTM")
41388
+ });
41389
+ var relay = null;
41390
+ function installTerminalCameraRelay(next) {
41391
+ relay = next;
41392
+ }
41393
+ var TerminalCameraDevice = class extends BaseDevice {
41394
+ features = [DeviceFeature.NativeSnapshot];
41395
+ constructor(ctx) {
41396
+ super(ctx, terminalCameraSchema, { type: ctx.deviceMeta.type });
41397
+ this.ctx.registerNativeCap(streamCatalogCapability, { getCatalog: async ({ deviceId }) => {
41398
+ if (deviceId !== this.id) return [];
41399
+ return this.catalog();
41400
+ } });
41401
+ this.ctx.registerNativeCap(snapshotCapability, {
41402
+ getSnapshot: async ({ deviceId }) => {
41403
+ if (deviceId !== this.id) throw new Error(`TerminalCameraDevice: deviceId mismatch, expected ${String(this.id)}, got ${String(deviceId)}`);
41404
+ const activeRelay = relay;
41405
+ if (!activeRelay) throw new Error("terminal camera relay is unavailable");
41406
+ return {
41407
+ base64: (await activeRelay.snapshot(this.relayInstanceId(), this.config.get("nodeId"), this.config.get("profileId"))).toString("base64"),
41408
+ contentType: "image/jpeg"
41409
+ };
41410
+ },
41411
+ invalidateCache: async () => {}
41412
+ });
41413
+ this.markOnline(true);
41414
+ }
41415
+ async catalog() {
41416
+ const activeRelay = relay;
41417
+ if (!activeRelay) throw new Error("terminal camera relay is unavailable");
41418
+ const nodeId = this.config.get("nodeId");
41419
+ const profileId = this.config.get("profileId");
41420
+ const instanceId = this.relayInstanceId();
41421
+ return [{
41422
+ camStreamId: profileId,
41423
+ kind: "pull-http",
41424
+ url: activeRelay.streamUrl(instanceId, nodeId, profileId),
41425
+ codec: "h264",
41426
+ resolution: {
41427
+ width: 960,
41428
+ height: 640
41429
+ },
41430
+ fps: 2,
41431
+ label: this.config.get("profileLabel")
41432
+ }];
41433
+ }
41434
+ setNodeOnline(online) {
41435
+ this.markOnline(online);
41436
+ if (!online) relay?.closeInstance(this.relayInstanceId());
41437
+ }
41438
+ async removeDevice() {
41439
+ await relay?.closeInstance(this.relayInstanceId());
41440
+ }
41441
+ relayInstanceId() {
41442
+ return this.config.get("instanceId") ?? `legacy:${this.stableId}`;
41443
+ }
41444
+ };
41445
+ //#endregion
40675
41446
  //#region ../../node_modules/@xterm/addon-serialize/lib/addon-serialize.js
40676
41447
  var require_addon_serialize = /* @__PURE__ */ __commonJSMin(((exports, module) => {
40677
41448
  (function(e, t) {
@@ -45479,174 +46250,9 @@ var require_xterm_headless = /* @__PURE__ */ __commonJSMin(((exports) => {
45479
46250
  })();
45480
46251
  }));
45481
46252
  //#endregion
45482
- //#region src/terminal-cell-runs.ts
46253
+ //#region src/xterm-screen.ts
45483
46254
  var import_addon_serialize = require_addon_serialize();
45484
46255
  var import_xterm_headless = require_xterm_headless();
45485
- var TERMINAL_DEFAULT_FG = "#d7dce2";
45486
- var TERMINAL_DEFAULT_BG = "#0b0d10";
45487
- /**
45488
- * The 16 ANSI colours, in a dark-theme variant chosen to sit with the existing
45489
- * frame (`#0b0d10` ground, `#d7dce2` text) rather than the raw xterm defaults,
45490
- * whose pure `#0000ff` blue and `#008000` green are close to unreadable on a
45491
- * near-black background at 13px. Index 7 IS the default foreground, so plain
45492
- * `CSI 37m` text renders identically to unstyled text.
45493
- */
45494
- var TERMINAL_ANSI_PALETTE = [
45495
- "#282c34",
45496
- "#e06c75",
45497
- "#98c379",
45498
- "#e5c07b",
45499
- "#61afef",
45500
- "#c678dd",
45501
- "#56b6c2",
45502
- TERMINAL_DEFAULT_FG,
45503
- "#5c6370",
45504
- "#ef596f",
45505
- "#89ca78",
45506
- "#f0c674",
45507
- "#6cb6ff",
45508
- "#d55fde",
45509
- "#2bbac5",
45510
- "#ffffff"
45511
- ];
45512
- /** The six levels of the xterm 6×6×6 colour cube (indices 16-231). */
45513
- var TERMINAL_CUBE_LEVELS = [
45514
- 0,
45515
- 95,
45516
- 135,
45517
- 175,
45518
- 215,
45519
- 255
45520
- ];
45521
- var TERMINAL_CUBE_FIRST = 16;
45522
- var TERMINAL_GRAYSCALE_FIRST = 232;
45523
- var TERMINAL_GRAYSCALE_BASE = 8;
45524
- var TERMINAL_GRAYSCALE_STEP = 10;
45525
- /** SGR 2 keeps the foreground legible; it must not become the background. */
45526
- var TERMINAL_DIM_WEIGHT = .6;
45527
- function channel(value) {
45528
- return Math.max(0, Math.min(255, Math.round(value))).toString(16).padStart(2, "0");
45529
- }
45530
- function hex(red, green, blue) {
45531
- return `#${channel(red)}${channel(green)}${channel(blue)}`;
45532
- }
45533
- function parseHex(color) {
45534
- return [
45535
- Number.parseInt(color.slice(1, 3), 16),
45536
- Number.parseInt(color.slice(3, 5), 16),
45537
- Number.parseInt(color.slice(5, 7), 16)
45538
- ];
45539
- }
45540
- /** Resolve an xterm palette index (0-255) to a hex colour. */
45541
- function terminalPaletteColor(index) {
45542
- const ansi = TERMINAL_ANSI_PALETTE[index];
45543
- if (ansi !== void 0) return ansi;
45544
- if (index >= TERMINAL_GRAYSCALE_FIRST) {
45545
- const level = TERMINAL_GRAYSCALE_BASE + (index - TERMINAL_GRAYSCALE_FIRST) * TERMINAL_GRAYSCALE_STEP;
45546
- return hex(level, level, level);
45547
- }
45548
- if (index >= TERMINAL_CUBE_FIRST) {
45549
- const offset = index - TERMINAL_CUBE_FIRST;
45550
- return hex(TERMINAL_CUBE_LEVELS[Math.floor(offset / 36) % 6] ?? 0, TERMINAL_CUBE_LEVELS[Math.floor(offset / 6) % 6] ?? 0, TERMINAL_CUBE_LEVELS[offset % 6] ?? 0);
45551
- }
45552
- return TERMINAL_DEFAULT_FG;
45553
- }
45554
- /** Resolve a 0xRRGGBB truecolor value to a hex colour. */
45555
- function terminalRgbColor(value) {
45556
- return hex(value >> 16 & 255, value >> 8 & 255, value & 255);
45557
- }
45558
- function blend(color, toward, weight) {
45559
- const [red, green, blue] = parseHex(color);
45560
- const [targetRed, targetGreen, targetBlue] = parseHex(toward);
45561
- return hex(red * weight + targetRed * (1 - weight), green * weight + targetGreen * (1 - weight), blue * weight + targetBlue * (1 - weight));
45562
- }
45563
- function resolveForeground(cell) {
45564
- if (cell.isFgRGB()) return terminalRgbColor(cell.getFgColor());
45565
- if (cell.isFgPalette()) return terminalPaletteColor(cell.getFgColor());
45566
- return TERMINAL_DEFAULT_FG;
45567
- }
45568
- function resolveBackground(cell) {
45569
- if (cell.isBgRGB()) return terminalRgbColor(cell.getBgColor());
45570
- if (cell.isBgPalette()) return terminalPaletteColor(cell.getBgColor());
45571
- return TERMINAL_DEFAULT_BG;
45572
- }
45573
- /**
45574
- * Resolve one cell's attributes into concrete colours.
45575
- *
45576
- * Inverse is applied by SWAPPING the already-resolved pair, so inverse over two
45577
- * defaults is still a visible swap rather than a no-op — that is how a selected
45578
- * or highlighted row in Glances reads. Invisible is then conceal-by-equality
45579
- * (foreground painted in its own background): the cell keeps its columns, which
45580
- * a dropped cell would not, and dropping it would shift the whole rest of the
45581
- * row left.
45582
- */
45583
- function resolveCellStyle(cell) {
45584
- const inverse = cell.isInverse() !== 0;
45585
- const plainFg = resolveForeground(cell);
45586
- const plainBg = resolveBackground(cell);
45587
- const background = inverse ? plainFg : plainBg;
45588
- let foreground = inverse ? plainBg : plainFg;
45589
- if (cell.isDim() !== 0) foreground = blend(foreground, background, TERMINAL_DIM_WEIGHT);
45590
- if (cell.isInvisible() !== 0) foreground = background;
45591
- return {
45592
- fg: foreground === "#d7dce2" ? null : foreground,
45593
- bg: background === "#0b0d10" ? null : background,
45594
- bold: cell.isBold() !== 0
45595
- };
45596
- }
45597
- function sameStyle(left, right) {
45598
- return left.fg === right.fg && left.bg === right.bg && left.bold === right.bold;
45599
- }
45600
- /**
45601
- * Merge adjacent same-style cells into runs, then drop the trailing run of
45602
- * default-styled whitespace so a row costs what it draws — the same trim
45603
- * `translateToString(true)` performs. Whitespace carrying a BACKGROUND is kept:
45604
- * a green bar of spaces out to the right margin is a pixel Glances drew.
45605
- */
45606
- function buildCellRuns(cells) {
45607
- const runs = [];
45608
- let text = "";
45609
- let style = null;
45610
- for (const cell of cells) {
45611
- if (style !== null && sameStyle(style, cell.style)) {
45612
- text += cell.text;
45613
- continue;
45614
- }
45615
- if (style !== null) runs.push({
45616
- text,
45617
- ...style
45618
- });
45619
- text = cell.text;
45620
- style = cell.style;
45621
- }
45622
- if (style !== null) runs.push({
45623
- text,
45624
- ...style
45625
- });
45626
- while (runs.length > 0) {
45627
- const last = runs[runs.length - 1];
45628
- if (last === void 0 || last.bg !== null) break;
45629
- const trimmed = last.text.replace(/\s+$/u, "");
45630
- if (trimmed === last.text) break;
45631
- if (trimmed === "") {
45632
- runs.pop();
45633
- continue;
45634
- }
45635
- runs[runs.length - 1] = {
45636
- ...last,
45637
- text: trimmed
45638
- };
45639
- break;
45640
- }
45641
- return runs;
45642
- }
45643
- //#endregion
45644
- //#region src/xterm-screen.ts
45645
- /**
45646
- * Real {@link ScreenBuffer} backed by `@xterm/headless` — the DOM-less xterm
45647
- * build — plus the serialize addon, which turns the current buffer into a
45648
- * self-contained repaint escape sequence for reconnecting clients.
45649
- */
45650
46256
  var SCROLLBACK_LINES = 2e3;
45651
46257
  function createXtermScreen(cols, rows) {
45652
46258
  const term = new import_xterm_headless.Terminal({
@@ -45713,196 +46319,6 @@ function createXtermScreen(cols, rows) {
45713
46319
  };
45714
46320
  }
45715
46321
  //#endregion
45716
- //#region src/terminal-camera-declarations.ts
45717
- /**
45718
- * Feed DeclaredDevices every live declaration plus one deterministic orphan
45719
- * batch. The generic sweep intentionally refuses an over-limit set; selecting
45720
- * a batch here drains large historical Terminal orphan sets across convergence
45721
- * passes without weakening that global safety guard.
45722
- */
45723
- function terminalCameraReconciliationIndex(rows, integrationId, declarations, managedStableIds = /* @__PURE__ */ new Set()) {
45724
- if (!integrationId) return [];
45725
- const declared = new Set(declarations.map((camera) => camera.stableId));
45726
- const owned = rows.filter((row) => row.integrationId === integrationId && (declared.has(row.stableId) || managedStableIds.has(row.stableId) || row.stableId.startsWith("terminal-camera-instance-")));
45727
- return [...owned.filter((row) => declared.has(row.stableId)), ...owned.filter((row) => !declared.has(row.stableId)).sort((left, right) => left.id - right.id).slice(0, 32)];
45728
- }
45729
- /** Explicit persisted instances, never the node × profile template matrix. */
45730
- function buildTerminalInstanceCameraDeclarations(instances) {
45731
- return instances.filter((instance) => instance.enabled).map((instance) => ({
45732
- stableId: instance.cameraStableId,
45733
- name: instance.name,
45734
- config: {
45735
- instanceId: instance.id,
45736
- nodeId: instance.nodeId,
45737
- profileId: instance.profileId,
45738
- profileLabel: instance.profileLabel
45739
- }
45740
- }));
45741
- }
45742
- /**
45743
- * `DeviceConfig` materializes schema defaults in memory, so comparing
45744
- * `config.get()` cannot detect a legacy `{ nodeId }` row. Reconciliation must
45745
- * inspect the raw persisted blob to make the profile migration durable.
45746
- */
45747
- function needsTerminalCameraConfigMigration(persistedConfig, declaration) {
45748
- return persistedConfig.instanceId !== declaration.config.instanceId || persistedConfig.nodeId !== declaration.config.nodeId || persistedConfig.profileId !== declaration.config.profileId || persistedConfig.profileLabel !== declaration.config.profileLabel;
45749
- }
45750
- /**
45751
- * Monospace families to try, in order — NOT one family and a generic.
45752
- *
45753
- * A terminal screen is mostly box-drawing and block characters, and a font
45754
- * without them renders the frame as noise rather than as missing detail.
45755
- * `DejaVu Sans Mono` covers them and ships in the hub image; macOS has neither
45756
- * DejaVu nor fontconfig, so the Mac agent fell through to a generic whose
45757
- * coverage is not, and its Glances camera came out unreadable while the hub's
45758
- * was pixel-perfect (measured 2026-08-11, same Glances, two nodes).
45759
- *
45760
- * `Menlo` is the fix rather than a guess: it is macOS's default terminal face,
45761
- * present on every install, and derived from DejaVu Sans Mono — the same glyph
45762
- * coverage by ancestry. Monaco and Courier New follow as older fallbacks; the
45763
- * generic stays last so a host with none of them still draws something.
45764
- */
45765
- var TERMINAL_FONT_STACK = "DejaVu Sans Mono,Menlo,Monaco,Courier New,monospace";
45766
- var TERMINAL_FONT_SIZE = 13;
45767
- var TERMINAL_TEXT_MARGIN_X = 8;
45768
- var TERMINAL_ROW_HEIGHT = 15;
45769
- var TERMINAL_BASELINE_Y = 18;
45770
- /**
45771
- * Distance from a row's baseline up to the top of its cell box. Chosen so
45772
- * consecutive rows tile exactly: row N's box runs from `baseline - this` for
45773
- * `TERMINAL_ROW_HEIGHT`, and row N+1's box starts where it ends. A background
45774
- * bar that stopped short would draw as stripes across a `CSI 42m` panel.
45775
- */
45776
- var TERMINAL_CELL_ASCENT = 11.5;
45777
- var TERMINAL_CELL_WIDTH = TERMINAL_FONT_SIZE * (1233 / 2048);
45778
- /** Two decimals is under a tenth of a pixel and keeps the SVG small. */
45779
- function coordinate(value) {
45780
- return String(Number(value.toFixed(2)));
45781
- }
45782
- function escapeXml(value) {
45783
- return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;");
45784
- }
45785
- /**
45786
- * Render already-interpreted terminal rows into a compact MJPEG frame.
45787
- *
45788
- * `xml:space="preserve"` is load-bearing, not tidiness. SVG `<text>` collapses
45789
- * runs of whitespace by default, and a terminal's entire column alignment IS
45790
- * runs of whitespace — Glances pads every field with spaces. Without it the
45791
- * frame drew each line at roughly half its true width, crammed into the
45792
- * top-left of a mostly-black image, while the SAME session over `attach`
45793
- * looked perfect — which is exactly how the operator reported it. Measured in
45794
- * the hub's own rasterizer 2026-08-11: `AAA<10 spaces>BBB<3>CCC` drew 92 px
45795
- * collapsed against 178 px preserved.
45796
- *
45797
- * Every run is anchored at its OWN column (`x = margin + startCol * cellW`),
45798
- * never appended to the one before it, so the background rects and the glyphs
45799
- * are placed off the same grid and cannot drift apart. `textLength` is emitted
45800
- * with it because it is the correct declaration and renderers that honour it
45801
- * get an exact grid — but it is not what makes this work: librsvg, which sharp
45802
- * uses, ignores it outright (measured 2026-08-12, a 120-glyph run pinned to
45803
- * 600 px still drew its natural 937 px). The anchoring is the guarantee.
45804
- */
45805
- function renderTerminalSvg(rows) {
45806
- const backgrounds = [];
45807
- const texts = [];
45808
- rows.slice(0, 40).forEach((row, index) => {
45809
- const baseline = TERMINAL_BASELINE_Y + index * TERMINAL_ROW_HEIGHT;
45810
- const top = baseline - TERMINAL_CELL_ASCENT;
45811
- let column = 0;
45812
- for (const run of row) {
45813
- if (column >= 120) break;
45814
- const clipped = clipRun(run, 120 - column);
45815
- const columns = [...clipped].length;
45816
- if (columns === 0) continue;
45817
- const x = TERMINAL_TEXT_MARGIN_X + column * TERMINAL_CELL_WIDTH;
45818
- const width = columns * TERMINAL_CELL_WIDTH;
45819
- if (run.bg !== null) backgrounds.push(`<rect x="${coordinate(x)}" y="${coordinate(top)}" width="${coordinate(width)}" height="${String(TERMINAL_ROW_HEIGHT)}" fill="${run.bg}"/>`);
45820
- if (clipped.trim() !== "") {
45821
- const fill = run.fg === null ? "" : ` fill="${run.fg}"`;
45822
- const weight = run.bold ? " font-weight=\"bold\"" : "";
45823
- texts.push(`<text xml:space="preserve" x="${coordinate(x)}" y="${coordinate(baseline)}" textLength="${coordinate(width)}" lengthAdjust="spacingAndGlyphs"${fill}${weight}>${escapeXml(clipped)}</text>`);
45824
- }
45825
- column += columns;
45826
- }
45827
- });
45828
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${String(960)}" height="${String(640)}"><rect width="100%" height="100%" fill="${TERMINAL_DEFAULT_BG}"/>${backgrounds.join("")}<g fill="${TERMINAL_DEFAULT_FG}" font-family="${TERMINAL_FONT_STACK}" font-size="${String(TERMINAL_FONT_SIZE)}">${texts.join("")}</g></svg>`;
45829
- }
45830
- /** Cut a run to the columns still left in the row, by code point not unit. */
45831
- function clipRun(run, remaining) {
45832
- const points = [...run.text];
45833
- return points.length <= remaining ? run.text : points.slice(0, remaining).join("");
45834
- }
45835
- async function renderTerminalJpeg(rows) {
45836
- return (0, sharp.default)(Buffer.from(renderTerminalSvg(rows))).jpeg({
45837
- quality: 82,
45838
- chromaSubsampling: "4:2:0"
45839
- }).toBuffer();
45840
- }
45841
- //#endregion
45842
- //#region src/terminal-camera-device.ts
45843
- var terminalCameraSchema = object({
45844
- instanceId: string().min(1).optional(),
45845
- nodeId: string().min(1),
45846
- profileId: string().min(1).default("monitor"),
45847
- profileLabel: string().min(1).default("BTM")
45848
- });
45849
- var relay = null;
45850
- function installTerminalCameraRelay(next) {
45851
- relay = next;
45852
- }
45853
- var TerminalCameraDevice = class extends BaseDevice {
45854
- features = [DeviceFeature.NativeSnapshot];
45855
- constructor(ctx) {
45856
- super(ctx, terminalCameraSchema, { type: ctx.deviceMeta.type });
45857
- this.ctx.registerNativeCap(streamCatalogCapability, { getCatalog: async ({ deviceId }) => {
45858
- if (deviceId !== this.id) return [];
45859
- return this.catalog();
45860
- } });
45861
- this.ctx.registerNativeCap(snapshotCapability, {
45862
- getSnapshot: async ({ deviceId }) => {
45863
- if (deviceId !== this.id) throw new Error(`TerminalCameraDevice: deviceId mismatch, expected ${String(this.id)}, got ${String(deviceId)}`);
45864
- const activeRelay = relay;
45865
- if (!activeRelay) throw new Error("terminal camera relay is unavailable");
45866
- return {
45867
- base64: (await activeRelay.snapshot(this.relayInstanceId(), this.config.get("nodeId"), this.config.get("profileId"))).toString("base64"),
45868
- contentType: "image/jpeg"
45869
- };
45870
- },
45871
- invalidateCache: async () => {}
45872
- });
45873
- this.markOnline(true);
45874
- }
45875
- async catalog() {
45876
- const activeRelay = relay;
45877
- if (!activeRelay) throw new Error("terminal camera relay is unavailable");
45878
- const nodeId = this.config.get("nodeId");
45879
- const profileId = this.config.get("profileId");
45880
- const instanceId = this.relayInstanceId();
45881
- return [{
45882
- camStreamId: profileId,
45883
- kind: "pull-http",
45884
- url: activeRelay.streamUrl(instanceId, nodeId, profileId),
45885
- codec: "h264",
45886
- resolution: {
45887
- width: 960,
45888
- height: 640
45889
- },
45890
- fps: 2,
45891
- label: this.config.get("profileLabel")
45892
- }];
45893
- }
45894
- setNodeOnline(online) {
45895
- this.markOnline(online);
45896
- if (!online) relay?.closeInstance(this.relayInstanceId());
45897
- }
45898
- async removeDevice() {
45899
- await relay?.closeInstance(this.relayInstanceId());
45900
- }
45901
- relayInstanceId() {
45902
- return this.config.get("instanceId") ?? `legacy:${this.stableId}`;
45903
- }
45904
- };
45905
- //#endregion
45906
46322
  //#region src/terminal-camera-relay.ts
45907
46323
  var MJPEG_BOUNDARY = "camstack-terminal-frame";
45908
46324
  var SESSION_IDLE_MS = 3e4;
@@ -46453,13 +46869,34 @@ function newTerminalCameraStableId(instanceId) {
46453
46869
  * Legacy automatic cameras are migration candidates only. A tombstone is
46454
46870
  * durable deletion intent, so a lingering failed device removal must never
46455
46871
  * make that camera adoptable again.
46872
+ *
46873
+ * ## `config` is load-bearing — this read can never be `projection: 'slim'`
46874
+ *
46875
+ * `nodeId`, `profileId` and `profileLabel` all live in the device's `config`,
46876
+ * and a row without `nodeId` is skipped. The slim projection returns
46877
+ * `config: {}` for every row, so a slim answer here is shape-identical to a
46878
+ * fleet that has no legacy cameras — the whole migration section disappears
46879
+ * and nothing says why. `legacy-camera-read-shape.spec.ts` is the arm on that.
46880
+ *
46881
+ * `onSkipped` is why the disappearance would now be visible: a row that LOOKS
46882
+ * like a legacy camera (`terminal-camera-*`, not an instance camera, not
46883
+ * tombstoned, not already adopted) but carries no `nodeId` is reported with
46884
+ * its numeric device id, so the caller can log it per-camera. Rows that are
46885
+ * not candidates at all are silent — a fleet of 1 017 devices must not
46886
+ * produce 1 017 lines to say none of them is a Terminal monitor.
46456
46887
  */
46457
- function listLegacyTerminalCameraCandidates(rows, instanceStableIds, tombstones) {
46888
+ function listLegacyTerminalCameraCandidates(rows, instanceStableIds, tombstones, onSkipped) {
46458
46889
  const legacy = [];
46459
46890
  for (const row of rows) {
46460
46891
  if (tombstones.has(row.stableId) || instanceStableIds.has(row.stableId) || row.stableId.startsWith("terminal-camera-instance-") || !row.stableId.startsWith("terminal-camera-")) continue;
46461
46892
  const nodeId = typeof row.config.nodeId === "string" ? row.config.nodeId : null;
46462
- if (!nodeId) continue;
46893
+ if (!nodeId) {
46894
+ onSkipped?.({
46895
+ deviceId: row.id,
46896
+ stableId: row.stableId
46897
+ });
46898
+ continue;
46899
+ }
46463
46900
  const profileId = typeof row.config.profileId === "string" ? row.config.profileId : "monitor";
46464
46901
  const profileLabel = typeof row.config.profileLabel === "string" ? row.config.profileLabel : profileId === "monitor" ? "BTM" : profileId;
46465
46902
  legacy.push({
@@ -46620,111 +47057,6 @@ function findProfile(profiles, profileId) {
46620
47057
  return profiles.find((p) => p.profileId === profileId);
46621
47058
  }
46622
47059
  //#endregion
46623
- //#region src/profile-settings.ts
46624
- var GLANCES_PLUGINS = [
46625
- {
46626
- key: "showCpu",
46627
- plugin: "cpu",
46628
- label: "CPU"
46629
- },
46630
- {
46631
- key: "showMem",
46632
- plugin: "mem",
46633
- label: "Memory"
46634
- },
46635
- {
46636
- key: "showLoad",
46637
- plugin: "load",
46638
- label: "Load"
46639
- },
46640
- {
46641
- key: "showNetwork",
46642
- plugin: "network",
46643
- label: "Network"
46644
- },
46645
- {
46646
- key: "showDiskIo",
46647
- plugin: "diskio",
46648
- label: "Disk I/O"
46649
- },
46650
- {
46651
- key: "showFs",
46652
- plugin: "fs",
46653
- label: "Filesystems"
46654
- },
46655
- {
46656
- key: "showProcessList",
46657
- plugin: "processlist",
46658
- label: "Process list"
46659
- },
46660
- {
46661
- key: "showContainers",
46662
- plugin: "containers",
46663
- label: "Containers"
46664
- },
46665
- {
46666
- key: "showSensors",
46667
- plugin: "sensors",
46668
- label: "Sensors"
46669
- }
46670
- ];
46671
- function glancesBooleanField(key, label) {
46672
- return {
46673
- type: "boolean",
46674
- key,
46675
- label,
46676
- default: true,
46677
- style: "switch"
46678
- };
46679
- }
46680
- function glancesSettingsSchema() {
46681
- return { sections: [{
46682
- id: "glances-panels",
46683
- title: "Glances panels",
46684
- description: "Turn off a panel to pass --disable-plugin to this Terminal only. All on is the measured default (~1% of one core at the camera grid).",
46685
- columns: 2,
46686
- fields: GLANCES_PLUGINS.map((plugin) => glancesBooleanField(plugin.key, plugin.label))
46687
- }] };
46688
- }
46689
- function settingsSchemaForProfile(profileId) {
46690
- if (profileId === "glances") return glancesSettingsSchema();
46691
- return null;
46692
- }
46693
- function glancesSettingsToArgs(settings) {
46694
- const disabled = GLANCES_PLUGINS.filter((plugin) => settings[plugin.key] === false).map((plugin) => plugin.plugin);
46695
- if (disabled.length === 0) return [];
46696
- return ["--disable-plugin", disabled.join(",")];
46697
- }
46698
- function sanitizeProfileSettings(profileId, raw) {
46699
- if (profileId !== "glances") return {};
46700
- const bag = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
46701
- const out = {
46702
- showCpu: true,
46703
- showMem: true,
46704
- showLoad: true,
46705
- showNetwork: true,
46706
- showDiskIo: true,
46707
- showFs: true,
46708
- showProcessList: true,
46709
- showContainers: true,
46710
- showSensors: true
46711
- };
46712
- for (const plugin of GLANCES_PLUGINS) {
46713
- const value = bag[plugin.key];
46714
- if (typeof value === "boolean") out[plugin.key] = value;
46715
- }
46716
- return out;
46717
- }
46718
- function profileSettingsToArgs(profileId, settings) {
46719
- if (profileId !== "glances") return [];
46720
- return glancesSettingsToArgs(sanitizeProfileSettings(profileId, settings));
46721
- }
46722
- function spawnArgsForInstance(input) {
46723
- const extra = profileSettingsToArgs(input.profileId, input.profileSettings);
46724
- if (input.instanceArgs.length > 0) return [...input.instanceArgs, ...extra];
46725
- if (extra.length > 0) return [...input.profileArgs, ...extra];
46726
- }
46727
- //#endregion
46728
47060
  //#region src/terminal-session-manager.ts
46729
47061
  var MIN_GRID = 1;
46730
47062
  var MAX_COLS = 1e3;
@@ -47546,7 +47878,12 @@ var TerminalAddon = class extends BaseAddon {
47546
47878
  async listLegacyTerminalCameras() {
47547
47879
  const instances = this.terminalInstances();
47548
47880
  const instanceStableIds = new Set(instances.map((instance) => instance.cameraStableId));
47549
- return listLegacyTerminalCameraCandidates(await this.ctx.api.deviceManager.listAll.query({ addonId: this.ctx.id }), instanceStableIds, this.terminalCameraTombstones);
47881
+ return listLegacyTerminalCameraCandidates(await this.ctx.api.deviceManager.listAll.query({ addonId: this.ctx.id }), instanceStableIds, this.terminalCameraTombstones, ({ deviceId, stableId }) => {
47882
+ this.ctx.logger.warn("legacy Terminal camera skipped — its device config carries no nodeId, so it cannot be offered for adoption", {
47883
+ tags: { deviceId },
47884
+ meta: { stableId }
47885
+ });
47886
+ });
47550
47887
  }
47551
47888
  async adoptLegacyMonitor(stableId, requestedName) {
47552
47889
  const instance = await this.instanceMutationQueue.run(() => this.adoptLegacyMonitorUnlocked(stableId, requestedName));