@camstack/addon-admin-ui 1.2.115 → 1.2.117
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/assets/{AddLocationWizard-CGIOvC3P.js → AddLocationWizard-Bob-o0Kv.js} +1 -1
- package/dist/assets/{AddonCollectionPage-CFaF5Vw9.js → AddonCollectionPage-BRZ5wnDA.js} +1 -1
- package/dist/assets/{Addons-DZCZomaH.js → Addons-C7ugoYzx.js} +1 -1
- package/dist/assets/{AdminTabs-BJEXfjyu.js → AdminTabs-DVhMhCwB.js} +1 -1
- package/dist/assets/{AiProfiles-BnJM-kV3.js → AiProfiles-BOumh8Sy.js} +1 -1
- package/dist/assets/{BrokerForm-ByK6-Bp9.js → BrokerForm-DUIN2thN.js} +1 -1
- package/dist/assets/{Build-36exF1MS.js → Build-CKeeP86Z.js} +1 -1
- package/dist/assets/{Capabilities-0UWikL4K.js → Capabilities-Dy5fksAD.js} +1 -1
- package/dist/assets/{CapabilityBadges-CGpdhPHy.js → CapabilityBadges-KzSV_NH7.js} +1 -1
- package/dist/assets/Cluster-BviBUX6y.js +11 -0
- package/dist/assets/{Data-BwbwqI-R.js → Data-DujVsgdF.js} +1 -1
- package/dist/assets/{DetectionIntelligence-B4klGkOh.js → DetectionIntelligence-CM7P-dMx.js} +1 -1
- package/dist/assets/{DeviceAggregateSection-0MLZqgcC.js → DeviceAggregateSection-Bsi6p5YO.js} +1 -1
- package/dist/assets/{DeviceDetail-C40U8em3.js → DeviceDetail-DQMiHdyF.js} +1 -1
- package/dist/assets/{Devices-Dn5VCAkY.js → Devices-BJcC70V3.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-CsErD-aU.js → EmbedPlayerPage-CSY1rShh.js} +1 -1
- package/dist/assets/{Events-DW7CqfPm.js → Events-BTAz2irZ.js} +1 -1
- package/dist/assets/{FormBuilder-BIwZtxC8.js → FormBuilder-Cl04f_JD.js} +1 -1
- package/dist/assets/Identity-DwP0DWZT.js +1 -0
- package/dist/assets/{IntegrationDetail-KIwepyEo.js → IntegrationDetail-DrtquA7G.js} +1 -1
- package/dist/assets/{Integrations-BWZIP2oy.js → Integrations-D3WabD9o.js} +1 -1
- package/dist/assets/{Integrations-CNBZWNb8.js → Integrations-sedJLouZ.js} +1 -1
- package/dist/assets/{Logs-Blz6qLWG.js → Logs-CprZOubd.js} +1 -1
- package/dist/assets/{MotionZonesSettings-kcllZKfi.js → MotionZonesSettings-CJ739aet.js} +1 -1
- package/dist/assets/{MyAccess-B0WuiuOr.js → MyAccess-eCoyemMZ.js} +1 -1
- package/dist/assets/{Network-DCZ_Std9.js → Network-GD5AYiiW.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-D5n8FA1J.js → NodeAddonsSettingsPanel-BKGrAKXv.js} +1 -1
- package/dist/assets/{NodeInferenceDevices-BXO_eElj.js → NodeInferenceDevices-BCYhY7nQ.js} +1 -1
- package/dist/assets/{Notifications-BvSUFvwo.js → Notifications-f42HlHqJ.js} +1 -1
- package/dist/assets/Pipeline-Jv-H2NAp.js +1 -0
- package/dist/assets/Plates-DNXJ0ZGd.js +1 -0
- package/dist/assets/{PrivacyMaskSettings-CNusEkLm.js → PrivacyMaskSettings-0i9ff8gY.js} +1 -1
- package/dist/assets/{ProviderIcon-CCmwPnj7.js → ProviderIcon-O1y41-9_.js} +1 -1
- package/dist/assets/Recordings-BLl9b2uJ.js +1 -0
- package/dist/assets/{ScanNetworkModal-popRbbnY.js → ScanNetworkModal-Bkpvy3_p.js} +1 -1
- package/dist/assets/{SceneMonitorEditor--U-5D4mi.js → SceneMonitorEditor-CRrYOWn_.js} +1 -1
- package/dist/assets/{Scenes-BUdZCtSm.js → Scenes-5wMKZRPv.js} +1 -1
- package/dist/assets/{Settings-Chyz9pil.js → Settings-DWYKhvBB.js} +1 -1
- package/dist/assets/{Showroom-L0I-EMzO.js → Showroom-CUXHrY5P.js} +1 -1
- package/dist/assets/{Terminal-DFGgZjs0.js → Terminal-BlZVC9iW.js} +3 -3
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-D9FJNM6p.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CAribm2M.js} +1 -1
- package/dist/assets/{bell-ring-Dnavb4Im.js → bell-ring-BLQ-V73q.js} +1 -1
- package/dist/assets/{boxes-DVHIrGCL.js → boxes-Dypj31sZ.js} +1 -1
- package/dist/assets/circle-check-big-xsZd2yKi.js +1 -0
- package/dist/assets/{circle-x-CaCMuaLw.js → circle-x-B3MSB8Og.js} +1 -1
- package/dist/assets/clock-BtMlIKiK.js +1 -0
- package/dist/assets/{copy-BML9XMSw.js → copy-D55okrt8.js} +1 -1
- package/dist/assets/{debounced-invalidate-B1h2pckj.js → debounced-invalidate-Bq_-Ngtg.js} +1 -1
- package/dist/assets/{dist-Bow-GmSy.js → dist-BKLAovWG.js} +1 -1
- package/dist/assets/dist-vBVTdcJV.js +349 -0
- package/dist/assets/{download-QOZKEneZ.js → download-DPaR139q.js} +1 -1
- package/dist/assets/{face-bbox-BF-SXIv8.js → face-bbox-Dl112HSj.js} +1 -1
- package/dist/assets/{hostInit-CT2SNnwW.js → hostInit-BEpzKY8C.js} +1 -1
- package/dist/assets/index-C5g8h6ZU.js +4 -0
- package/dist/assets/{key-round-C3b-L-A3.js → key-round-DUZWZ_rI.js} +1 -1
- package/dist/assets/{layers-BbCt6KkN.js → layers-Czk9MtAZ.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-5980646d.js → mf-entry-bootstrap-0-bb1142ed.js} +2 -2
- package/dist/assets/{pencil-C6wR4nZ6.js → pencil-DtuLbgSG.js} +1 -1
- package/dist/assets/play-BJCc4fGn.js +1 -0
- package/dist/assets/{player-overlays-BVWg5sq2.js → player-overlays-Bx-E68JT.js} +1 -1
- package/dist/assets/plus-D5JVg6nA.js +1 -0
- package/dist/assets/power-BjgBAjFq.js +1 -0
- package/dist/assets/{radio-XbexHVTT.js → radio-B_dQ98Hi.js} +1 -1
- package/dist/assets/{refresh-cw-GeVcZb88.js → refresh-cw-DsTF0HtQ.js} +1 -1
- package/dist/assets/remoteEntry-BWuMimQ_.js +1 -0
- package/dist/assets/rotate-ccw-CFqgYAHl.js +1 -0
- package/dist/assets/rotate-cw-D7RHGKK4.js +1 -0
- package/dist/assets/{send-oraC7Ohv.js → send-BP6R0rRO.js} +1 -1
- package/dist/assets/{server-D8LYlM1F.js → server-D37fa07L.js} +1 -1
- package/dist/assets/{shield-7mzChvvY.js → shield-B6cq5CW6.js} +1 -1
- package/dist/assets/square-CZw5Ock3.js +1 -0
- package/dist/assets/{square-check-big-BSmHZjeu.js → square-check-big-Jbtwig6c.js} +1 -1
- package/dist/assets/src-BoA1cQeV.js +67 -0
- package/dist/assets/src-Hd2A_xp6.js +349 -0
- package/dist/assets/{star-BEgAOLq_.js → star-f_-GYi1D.js} +1 -1
- package/dist/assets/{undo-2-CrALNUHJ.js → undo-2-S6HqaEGy.js} +1 -1
- package/dist/assets/{use-scenes-feed-Cw8vHv_m.js → use-scenes-feed-C5C2RGwJ.js} +1 -1
- package/dist/assets/useEventInvalidation-2W9yFdBU.js +1 -0
- package/dist/assets/{video-BKXq8xP8.js → video-CxvKF_Ar.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DyISAdzQ.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-B11mjU62.js} +2 -2
- package/dist/assets/{wifi-DHK8q32C.js → wifi-B9yskYca.js} +1 -1
- package/dist/assets/{zap-B0mfRLCS.js → zap-8iaR87i8.js} +1 -1
- package/dist/index.html +5 -5
- package/dist/server/addon.js +334 -13
- package/package.json +1 -1
- package/dist/assets/Cluster-DeA0so_x.js +0 -11
- package/dist/assets/Identity-DeElzcC7.js +0 -1
- package/dist/assets/Pipeline-Bid2_o3k.js +0 -1
- package/dist/assets/Plates-BmjpMJ8M.js +0 -1
- package/dist/assets/Recordings-Dx95yGAh.js +0 -1
- package/dist/assets/circle-check-big-BFWc5wJh.js +0 -1
- package/dist/assets/clock-cmGwdobA.js +0 -1
- package/dist/assets/dist-D8-6hzNY.js +0 -349
- package/dist/assets/index-Z-wl-d5v.js +0 -4
- package/dist/assets/play-C6a3xrQ3.js +0 -1
- package/dist/assets/plus-QSG2gY1B.js +0 -1
- package/dist/assets/power-CwFgOqTp.js +0 -1
- package/dist/assets/remoteEntry-DS4leWkd.js +0 -1
- package/dist/assets/rotate-ccw-BSDcy5mi.js +0 -1
- package/dist/assets/rotate-cw-CJsnyxHu.js +0 -1
- package/dist/assets/square-qBqYsstR.js +0 -1
- package/dist/assets/src-B0h87dKs.js +0 -67
- package/dist/assets/src-CXH7iEed.js +0 -349
- package/dist/assets/useEventInvalidation-Dm4wRxi4.js +0 -1
package/dist/server/addon.js
CHANGED
|
@@ -8167,13 +8167,49 @@ var StorageMigrationParticipantSchema = _enum([
|
|
|
8167
8167
|
"recorder",
|
|
8168
8168
|
"analytics"
|
|
8169
8169
|
]);
|
|
8170
|
+
/**
|
|
8171
|
+
* The mover's own numbers, folded onto the coordinator's durable move record.
|
|
8172
|
+
*
|
|
8173
|
+
* The long half of a non-blocking migration is `draining`, and it is measured
|
|
8174
|
+
* in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
|
|
8175
|
+
* existed the only place those numbers appeared was a Loki line, so an operator
|
|
8176
|
+
* watching the Admin UI saw `phase: draining` and nothing else for a whole
|
|
8177
|
+
* afternoon.
|
|
8178
|
+
*
|
|
8179
|
+
* It is POLLED, never pushed. Events are telemetry and may be dropped
|
|
8180
|
+
* (D8/D11), and a dropped progress event is indistinguishable from a stalled
|
|
8181
|
+
* mover — which is the exact failure this is meant to end. The coordinator's
|
|
8182
|
+
* `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
|
|
8183
|
+
* read `state`; folding the counters costs no extra read and makes the durable
|
|
8184
|
+
* record say afterwards how far a move actually got.
|
|
8185
|
+
*
|
|
8186
|
+
* `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
|
|
8187
|
+
* a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
|
|
8188
|
+
* cannot say M, and a 0 there would render as "100 % done".
|
|
8189
|
+
*/
|
|
8190
|
+
var StorageMigrationMoveProgressSchema = object({
|
|
8191
|
+
filesMoved: number().int().nonnegative(),
|
|
8192
|
+
/** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
|
|
8193
|
+
filesTotal: number().int().nonnegative().nullable(),
|
|
8194
|
+
bytesMoved: number().int().nonnegative(),
|
|
8195
|
+
/** The MOVER's start, not the migration's: a drain restarted after an addon
|
|
8196
|
+
* crash gets a new mover, and a rate computed from the migration's start
|
|
8197
|
+
* would silently average in the time nothing was running. */
|
|
8198
|
+
startedAt: number(),
|
|
8199
|
+
/** When the coordinator last read these numbers. Paired with `startedAt` it
|
|
8200
|
+
* is the only honest rate: both clocks are the hub's, so a UI never has to
|
|
8201
|
+
* subtract its own. */
|
|
8202
|
+
observedAt: number()
|
|
8203
|
+
});
|
|
8170
8204
|
var StorageMigrationMoveSchema = object({
|
|
8171
8205
|
storageClass: StorageMigrationClassSchema,
|
|
8172
8206
|
fromLocationId: string(),
|
|
8173
8207
|
toLocationId: string(),
|
|
8174
8208
|
moverJobId: string().nullable(),
|
|
8175
8209
|
state: RelocateJobStateSchema.nullable(),
|
|
8176
|
-
error: string().nullable()
|
|
8210
|
+
error: string().nullable(),
|
|
8211
|
+
/** Last observed mover counters; `null` until the mover has been polled once. */
|
|
8212
|
+
progress: StorageMigrationMoveProgressSchema.nullable()
|
|
8177
8213
|
});
|
|
8178
8214
|
var StorageMigrationJobSchema = object({
|
|
8179
8215
|
jobId: string(),
|
|
@@ -8219,6 +8255,98 @@ var StorageMigrationPlanSchema = object({
|
|
|
8219
8255
|
findings: array(StorageMigrationFindingSchema)
|
|
8220
8256
|
});
|
|
8221
8257
|
/**
|
|
8258
|
+
* A mover as it exists RIGHT NOW, whether or not a migration job owns it.
|
|
8259
|
+
*
|
|
8260
|
+
* The coordinator's job record is the state of record for a migration, and its
|
|
8261
|
+
* moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
|
|
8262
|
+
* standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
|
|
8263
|
+
* are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
|
|
8264
|
+
* way because no supported UI path existed. A mover armed like that has no job
|
|
8265
|
+
* to fold progress into, so it has to be readable on its own or it is invisible.
|
|
8266
|
+
*
|
|
8267
|
+
* `migrationJobId` is what tells the two apart: `null` means nothing here
|
|
8268
|
+
* orchestrated it.
|
|
8269
|
+
*/
|
|
8270
|
+
var StorageMigrationMoverSchema = object({
|
|
8271
|
+
lane: _enum(["footage", "media"]),
|
|
8272
|
+
job: RelocateJobSchema,
|
|
8273
|
+
/** The coordinator job that armed this mover, or `null` for a mover armed
|
|
8274
|
+
* directly against the owning addon. */
|
|
8275
|
+
migrationJobId: string().nullable(),
|
|
8276
|
+
/** When the hub read these counters. Stamped here so a rate is `bytesMoved`
|
|
8277
|
+
* over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
|
|
8278
|
+
* a browser subtracting its own `Date.now()` from a server `startedAt` is a
|
|
8279
|
+
* rate made of two different clocks. */
|
|
8280
|
+
observedAt: number()
|
|
8281
|
+
});
|
|
8282
|
+
/**
|
|
8283
|
+
* What a SOURCE still holds for one storage class — the number that makes a
|
|
8284
|
+
* "drain remaining" action honest rather than hopeful.
|
|
8285
|
+
*
|
|
8286
|
+
* It comes from the archive (`SegmentHourLedger.census` for footage, the media
|
|
8287
|
+
* engine's own selection count for media), never from the resident index: a
|
|
8288
|
+
* drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
|
|
8289
|
+
* never been told about (D295).
|
|
8290
|
+
*
|
|
8291
|
+
* `items`/`bytes` are `null` for "the archive could not be asked", which is
|
|
8292
|
+
* deliberately NOT zero: a drain is still offered for an unknown residue,
|
|
8293
|
+
* because refusing on an unanswerable read would hide exactly the case an
|
|
8294
|
+
* operator needs to act on.
|
|
8295
|
+
*/
|
|
8296
|
+
var StorageMigrationResidueSchema = object({
|
|
8297
|
+
storageClass: StorageMigrationClassSchema,
|
|
8298
|
+
/** The location still holding the data. `'*'` for the media lane, whose rows
|
|
8299
|
+
* move from wherever they are rather than from one named source. */
|
|
8300
|
+
fromLocationId: string(),
|
|
8301
|
+
/** Where a drain would move it — the class's CURRENT default. */
|
|
8302
|
+
toLocationId: string(),
|
|
8303
|
+
/** Segments (footage lane) or rows (media lane) still on the source. */
|
|
8304
|
+
items: number().int().nonnegative().nullable(),
|
|
8305
|
+
/** Bytes on the source; `null` when the lane counts rows rather than bytes. */
|
|
8306
|
+
bytes: number().int().nonnegative().nullable()
|
|
8307
|
+
});
|
|
8308
|
+
/**
|
|
8309
|
+
* Run the DRAIN half and nothing else.
|
|
8310
|
+
*
|
|
8311
|
+
* A migration that reached `done` has already repointed, so `start` correctly
|
|
8312
|
+
* refuses its destination ("already the default") — there is nothing left to
|
|
8313
|
+
* repoint. But the drain can fail, be cancelled, be interrupted by a restart,
|
|
8314
|
+
* or finish against a work list that was a tenth of the archive (D295), and
|
|
8315
|
+
* before this there was no supported way to run only that half: the only way
|
|
8316
|
+
* through was calling `recording.relocateFootage` by hand over admin tRPC.
|
|
8317
|
+
*
|
|
8318
|
+
* `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
|
|
8319
|
+
* refusal meaningful: the two verbs are disjoint, so nothing here can silently
|
|
8320
|
+
* re-repoint a class that is already migrated.
|
|
8321
|
+
*/
|
|
8322
|
+
var StorageMigrationDrainInputSchema = object({
|
|
8323
|
+
/** The classes to drain. Each must appear in `storageMigration.residue`, so
|
|
8324
|
+
* a class whose source is already empty is refused rather than started. */
|
|
8325
|
+
classes: array(StorageMigrationClassSchema).min(1),
|
|
8326
|
+
throttleMbps: number().min(1).max(1e3).optional()
|
|
8327
|
+
});
|
|
8328
|
+
/** What a footage source still holds, asked of the durable hour ledger. */
|
|
8329
|
+
var RelocateResidueInputSchema = object({
|
|
8330
|
+
fromLocationId: string().min(1),
|
|
8331
|
+
/** Narrow to one logical class; omit for every profile on the location. */
|
|
8332
|
+
footageClass: RelocateFootageClassSchema.optional()
|
|
8333
|
+
});
|
|
8334
|
+
/** `null` = the archive could not answer (no ledger on this node, or the
|
|
8335
|
+
* aggregate failed). Never conflated with an empty source. */
|
|
8336
|
+
var RelocateResidueSchema = object({
|
|
8337
|
+
segments: number().int().nonnegative(),
|
|
8338
|
+
bytes: number().int().nonnegative()
|
|
8339
|
+
}).nullable();
|
|
8340
|
+
/** How many rows a media pass would still act on against a given target — the
|
|
8341
|
+
* media lane's denominator AND its residue, from ONE derivation so the two can
|
|
8342
|
+
* never disagree. `null` = the count could not be taken. */
|
|
8343
|
+
var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
|
|
8344
|
+
var RelocatableMediaCountInputSchema = object({
|
|
8345
|
+
toLocationId: string().min(1),
|
|
8346
|
+
/** Omitted = `move`. */
|
|
8347
|
+
mode: MediaRelocateModeSchema.optional()
|
|
8348
|
+
});
|
|
8349
|
+
/**
|
|
8222
8350
|
* `StorageLocationType` — an addon-declared id that identifies the *kind* of
|
|
8223
8351
|
* storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
|
|
8224
8352
|
* so the persisted record schema and the consumer-facing cap can both consume it
|
|
@@ -8322,6 +8450,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
|
|
|
8322
8450
|
* two addons declaring the same `id` must agree on `cardinality` (validated
|
|
8323
8451
|
* at kernel aggregation time, not here).
|
|
8324
8452
|
*/
|
|
8453
|
+
/**
|
|
8454
|
+
* `StorageAccess` — how the service that DECLARED a storage-location kind
|
|
8455
|
+
* actually reaches the bytes. It is the constraint that decides which
|
|
8456
|
+
* `storage-provider`s may back a location of that kind.
|
|
8457
|
+
*
|
|
8458
|
+
* - `'local-path'` — the service asks `storage.resolve` for a path string and
|
|
8459
|
+
* then does its own `node:fs` I/O on it (the recorder's segment writer, the
|
|
8460
|
+
* post-analysis media roots). Only a provider that serves a genuine local
|
|
8461
|
+
* filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
|
|
8462
|
+
* remote provider's `resolve` returns a path on the REMOTE host, and
|
|
8463
|
+
* `fs.readdir` of it on this node either fails or — far worse — succeeds
|
|
8464
|
+
* against a same-named local directory that is something else entirely.
|
|
8465
|
+
*
|
|
8466
|
+
* - `'cap-mediated'` — every byte travels through the `storage` cap
|
|
8467
|
+
* (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
|
|
8468
|
+
* service never sees a path, so any provider can back it. `backups` is the
|
|
8469
|
+
* one kind that qualifies today.
|
|
8470
|
+
*
|
|
8471
|
+
* Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
|
|
8472
|
+
* an EMERGENT property of how the recorder happened to be written. Nothing
|
|
8473
|
+
* refused the configuration; the first write simply went somewhere wrong, and
|
|
8474
|
+
* a recording write that goes wrong surfaces as a silent black window rather
|
|
8475
|
+
* than an error (the read path does not `stat`). This turns that accident into
|
|
8476
|
+
* a declared, enforced, testable refusal.
|
|
8477
|
+
*/
|
|
8478
|
+
var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
|
|
8325
8479
|
var StorageLocationDeclarationSchema = object({
|
|
8326
8480
|
/**
|
|
8327
8481
|
* Global location identifier, e.g. `recordings` or `recordingsLow`.
|
|
@@ -8341,6 +8495,19 @@ var StorageLocationDeclarationSchema = object({
|
|
|
8341
8495
|
*/
|
|
8342
8496
|
cardinality: _enum(["single", "multi"]),
|
|
8343
8497
|
/**
|
|
8498
|
+
* HOW the declaring service reaches the bytes — and therefore WHICH
|
|
8499
|
+
* providers may back a location of this kind. See {@link StorageAccessSchema}
|
|
8500
|
+
* and {@link STORAGE_ACCESS_FALLBACK}.
|
|
8501
|
+
*
|
|
8502
|
+
* Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
|
|
8503
|
+
* can only over-restrict (refuse a remote provider for a kind that might
|
|
8504
|
+
* have coped) and never under-restrict. Declaring `'cap-mediated'` is the
|
|
8505
|
+
* permissive direction and is therefore never inferred — a repo guard
|
|
8506
|
+
* (`scripts/check-storage-access-declarations.ts`) refuses to let it be
|
|
8507
|
+
* reached by omission.
|
|
8508
|
+
*/
|
|
8509
|
+
access: StorageAccessSchema.optional(),
|
|
8510
|
+
/**
|
|
8344
8511
|
* When set, the default instance for this location inherits its resolved
|
|
8345
8512
|
* root from the named location's default instance. Useful for derivative
|
|
8346
8513
|
* slots (e.g. `recordingsLow` → `recordings`) so operators only need to
|
|
@@ -17866,8 +18033,10 @@ var TrackSchema = object({
|
|
|
17866
18033
|
lastSeen: number(),
|
|
17867
18034
|
/** Frame-rate position history (subject to maxPositionHistory cap). */
|
|
17868
18035
|
positions: array(TrackPositionSchema).readonly(),
|
|
17869
|
-
/** Periodic snapshots at snapshotIntervalMs cadence
|
|
17870
|
-
*
|
|
18036
|
+
/** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
|
|
18037
|
+
* only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
|
|
18038
|
+
* the retired `saveThumbnails` used to gate this and the rolling
|
|
18039
|
+
* `lastFrame` together). Empty is the healthy default, not a capture gap. */
|
|
17871
18040
|
snapshots: array(TrackSnapshotSchema).readonly(),
|
|
17872
18041
|
/** Deduplicated zones the track has entered at least once. Zone IDS. */
|
|
17873
18042
|
zonesVisited: array(string()).readonly(),
|
|
@@ -18727,7 +18896,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
18727
18896
|
}), method(RelocateMediaInputSchema, object({ jobId: string() }), {
|
|
18728
18897
|
kind: "mutation",
|
|
18729
18898
|
auth: "admin"
|
|
18730
|
-
}), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(
|
|
18899
|
+
}), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
|
|
18900
|
+
kind: "query",
|
|
18901
|
+
auth: "admin"
|
|
18902
|
+
}), method(object({}), array(RelocateJobSchema).readonly(), {
|
|
18731
18903
|
kind: "query",
|
|
18732
18904
|
auth: "admin"
|
|
18733
18905
|
}), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
@@ -20686,6 +20858,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
|
|
|
20686
20858
|
}), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
20687
20859
|
kind: "mutation",
|
|
20688
20860
|
auth: "admin"
|
|
20861
|
+
}), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
|
|
20862
|
+
kind: "mutation",
|
|
20863
|
+
auth: "admin"
|
|
20689
20864
|
});
|
|
20690
20865
|
var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
|
|
20691
20866
|
providerId: string().min(1),
|
|
@@ -21084,12 +21259,38 @@ response: record(string(), unknown()) }), object({
|
|
|
21084
21259
|
*
|
|
21085
21260
|
* ## Why this is a capability and not a helper
|
|
21086
21261
|
*
|
|
21087
|
-
*
|
|
21088
|
-
*
|
|
21089
|
-
*
|
|
21090
|
-
*
|
|
21091
|
-
*
|
|
21092
|
-
*
|
|
21262
|
+
* This capability was introduced with the claim that SIX stores in
|
|
21263
|
+
* `addon-post-analysis` held vectors in a `JSON` settings-store column — object
|
|
21264
|
+
* CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
|
|
21265
|
+
* claim was never true, and leaving it here made five stores look like pending
|
|
21266
|
+
* work when three of them have no vector at all. Counted column by column on
|
|
21267
|
+
* 2026-08-30, exactly THREE ever held one:
|
|
21268
|
+
*
|
|
21269
|
+
* - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
|
|
21270
|
+
* - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
|
|
21271
|
+
* - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
|
|
21272
|
+
* face, migrated 2026-08-30 into its OWN index (see below).
|
|
21273
|
+
*
|
|
21274
|
+
* `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
|
|
21275
|
+
* and `identities` store a name; the event store stores no derivative vector.
|
|
21276
|
+
* They are not migration candidates and never were.
|
|
21277
|
+
*
|
|
21278
|
+
* Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
|
|
21279
|
+
* as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
|
|
21280
|
+
* rows before ranking anything.
|
|
21281
|
+
*
|
|
21282
|
+
* ## One index per COMPARISON, never per encoder
|
|
21283
|
+
*
|
|
21284
|
+
* `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
|
|
21285
|
+
* model, and they still get two indexes. An index is a set of things that are
|
|
21286
|
+
* ranked against each other and that live and die together, and these two are
|
|
21287
|
+
* neither: a `faces` row is TRACK-OWNED and cascades away with its track under
|
|
21288
|
+
* a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
|
|
21289
|
+
* forever and is the gallery every recognition ranks against. One index would
|
|
21290
|
+
* mean every gallery load and every reconcile carried a filter whose failure
|
|
21291
|
+
* mode is either ranking a candidate against itself or reclaiming an enrolled
|
|
21292
|
+
* person's only sample. The dimension they share is not a reason to share an
|
|
21293
|
+
* index; the question they answer is, and it differs.
|
|
21093
21294
|
*
|
|
21094
21295
|
* The fix is not a faster loop, it is a different backend — and the backend
|
|
21095
21296
|
* should be replaceable without touching six callers. So: a singleton
|
|
@@ -21194,7 +21395,20 @@ var VectorQueryResultSchema = object({
|
|
|
21194
21395
|
*/
|
|
21195
21396
|
scanned: number(),
|
|
21196
21397
|
/** True when the backend could not consider every row that passed the filter. */
|
|
21197
|
-
truncated: boolean()
|
|
21398
|
+
truncated: boolean(),
|
|
21399
|
+
/**
|
|
21400
|
+
* The `topK` the backend actually ran with.
|
|
21401
|
+
*
|
|
21402
|
+
* Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
|
|
21403
|
+
* past it used to learn nothing but a boolean, from a WARN in the provider's
|
|
21404
|
+
* own log rather than in its answer. That is how an audit asking for 20,000
|
|
21405
|
+
* consumed 4,096 and reported `examined: 4096` as if it had walked the index,
|
|
21406
|
+
* for weeks. `truncated` says THAT the answer was short; this says BY HOW
|
|
21407
|
+
* MUCH, in the return value, where the caller cannot fail to see it.
|
|
21408
|
+
*
|
|
21409
|
+
* Equals the requested `topK` whenever nothing was lowered.
|
|
21410
|
+
*/
|
|
21411
|
+
effectiveTopK: number().int().positive()
|
|
21198
21412
|
});
|
|
21199
21413
|
var VectorDeleteInputSchema = object({
|
|
21200
21414
|
index: string(),
|
|
@@ -21223,6 +21437,68 @@ var VectorGetResultSchema = object({ items: array(object({
|
|
|
21223
21437
|
id: string(),
|
|
21224
21438
|
metadata: VectorMetadataSchema
|
|
21225
21439
|
})) });
|
|
21440
|
+
/**
|
|
21441
|
+
* Ids to read back WITH their vectors.
|
|
21442
|
+
*
|
|
21443
|
+
* The sibling of {@link VectorGetResultSchema}, and deliberately a separate
|
|
21444
|
+
* method rather than a flag on it: `getByIds` promises no vectors and its one
|
|
21445
|
+
* caller depends on that promise. This one promises the opposite.
|
|
21446
|
+
*
|
|
21447
|
+
* It exists because a store cannot put its vectors here otherwise. An ArcFace
|
|
21448
|
+
* gallery is ranked IN PROCESS, per detection, against every enrolled sample —
|
|
21449
|
+
* a per-face cross-process KNN would be a network round trip inside the
|
|
21450
|
+
* recognition loop. So the gallery is loaded once and held in RAM, and loading
|
|
21451
|
+
* it requires the index to hand the floats back. Without this method the only
|
|
21452
|
+
* way to keep a readable vector is a JSON column, which is the thing this
|
|
21453
|
+
* capability exists to delete.
|
|
21454
|
+
*
|
|
21455
|
+
* BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
|
|
21456
|
+
* index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
|
|
21457
|
+
*/
|
|
21458
|
+
var VectorFetchInputSchema = object({
|
|
21459
|
+
index: string(),
|
|
21460
|
+
ids: array(string())
|
|
21461
|
+
});
|
|
21462
|
+
var VectorFetchResultSchema = object({ items: array(object({
|
|
21463
|
+
id: string(),
|
|
21464
|
+
/** base64 Float32LE — the same wire form `upsert` accepts. */
|
|
21465
|
+
vector: string(),
|
|
21466
|
+
metadata: VectorMetadataSchema
|
|
21467
|
+
})) });
|
|
21468
|
+
/**
|
|
21469
|
+
* ENUMERATE an index: one page of rows in a stable order, no ranking.
|
|
21470
|
+
*
|
|
21471
|
+
* A reconcile does not want the nearest rows, it wants ALL of them, and asking
|
|
21472
|
+
* a KNN for "all" is the wrong question twice over. It hits the backend's `k`
|
|
21473
|
+
* ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
|
|
21474
|
+
* probe vector it does not have, so the audit passed a ZERO vector whose cosine
|
|
21475
|
+
* distance to every row is degenerate. `examined: 4096` then read as "we
|
|
21476
|
+
* looked" for as long as anyone cared to read it.
|
|
21477
|
+
*
|
|
21478
|
+
* This is the primitive that question actually needs: a bounded page, ordered
|
|
21479
|
+
* by the backend's own row order, costing no distance computation at all.
|
|
21480
|
+
* Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
|
|
21481
|
+
* the full-table read this capability was built to stop.
|
|
21482
|
+
*/
|
|
21483
|
+
var VectorScanInputSchema = object({
|
|
21484
|
+
index: string(),
|
|
21485
|
+
/** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
|
|
21486
|
+
cursor: number().int().nonnegative().default(0),
|
|
21487
|
+
limit: number().int().positive()
|
|
21488
|
+
});
|
|
21489
|
+
var VectorScanResultSchema = object({
|
|
21490
|
+
items: array(object({
|
|
21491
|
+
id: string(),
|
|
21492
|
+
metadata: VectorMetadataSchema
|
|
21493
|
+
})),
|
|
21494
|
+
/**
|
|
21495
|
+
* Where the next page starts, or `null` when the walk reached the end.
|
|
21496
|
+
*
|
|
21497
|
+
* `null` is the ONLY end-of-index signal. A caller must not infer the end
|
|
21498
|
+
* from a short page: a backend is free to return fewer rows than asked.
|
|
21499
|
+
*/
|
|
21500
|
+
nextCursor: number().int().nonnegative().nullable()
|
|
21501
|
+
});
|
|
21226
21502
|
var VectorStatsInputSchema = object({ index: string() });
|
|
21227
21503
|
var VectorStatsResultSchema = object({
|
|
21228
21504
|
/** Provider id, so an operator can tell brute force from an ANN index. */
|
|
@@ -21241,7 +21517,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
|
|
|
21241
21517
|
}), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
|
|
21242
21518
|
kind: "mutation",
|
|
21243
21519
|
auth: "admin"
|
|
21244
|
-
}), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
|
|
21520
|
+
}), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
|
|
21245
21521
|
kind: "mutation",
|
|
21246
21522
|
auth: "admin"
|
|
21247
21523
|
}), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
|
|
@@ -26145,6 +26421,9 @@ method(object({
|
|
|
26145
26421
|
}), method(object({}), array(RelocateJobSchema).readonly(), {
|
|
26146
26422
|
kind: "query",
|
|
26147
26423
|
auth: "admin"
|
|
26424
|
+
}), method(RelocateResidueInputSchema, RelocateResidueSchema, {
|
|
26425
|
+
kind: "query",
|
|
26426
|
+
auth: "admin"
|
|
26148
26427
|
}), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
26149
26428
|
kind: "mutation",
|
|
26150
26429
|
auth: "admin"
|
|
@@ -31110,6 +31389,12 @@ Object.freeze({
|
|
|
31110
31389
|
addonId: null,
|
|
31111
31390
|
access: "create"
|
|
31112
31391
|
},
|
|
31392
|
+
"pipelineAnalytics.countRelocatableMedia": {
|
|
31393
|
+
capName: "pipeline-analytics",
|
|
31394
|
+
capScope: "device",
|
|
31395
|
+
addonId: null,
|
|
31396
|
+
access: "view"
|
|
31397
|
+
},
|
|
31113
31398
|
"pipelineAnalytics.countUnstampedEventMedia": {
|
|
31114
31399
|
capName: "pipeline-analytics",
|
|
31115
31400
|
capScope: "device",
|
|
@@ -32274,6 +32559,12 @@ Object.freeze({
|
|
|
32274
32559
|
addonId: null,
|
|
32275
32560
|
access: "view"
|
|
32276
32561
|
},
|
|
32562
|
+
"recording.getRelocateResidue": {
|
|
32563
|
+
capName: "recording",
|
|
32564
|
+
capScope: "system",
|
|
32565
|
+
addonId: null,
|
|
32566
|
+
access: "view"
|
|
32567
|
+
},
|
|
32277
32568
|
"recording.getStorageMigrationMoveStatus": {
|
|
32278
32569
|
capName: "recording",
|
|
32279
32570
|
capScope: "system",
|
|
@@ -32820,12 +33111,30 @@ Object.freeze({
|
|
|
32820
33111
|
addonId: null,
|
|
32821
33112
|
access: "create"
|
|
32822
33113
|
},
|
|
33114
|
+
"storageMigration.drain": {
|
|
33115
|
+
capName: "storage-migration",
|
|
33116
|
+
capScope: "system",
|
|
33117
|
+
addonId: null,
|
|
33118
|
+
access: "create"
|
|
33119
|
+
},
|
|
33120
|
+
"storageMigration.movers": {
|
|
33121
|
+
capName: "storage-migration",
|
|
33122
|
+
capScope: "system",
|
|
33123
|
+
addonId: null,
|
|
33124
|
+
access: "view"
|
|
33125
|
+
},
|
|
32823
33126
|
"storageMigration.plan": {
|
|
32824
33127
|
capName: "storage-migration",
|
|
32825
33128
|
capScope: "system",
|
|
32826
33129
|
addonId: null,
|
|
32827
33130
|
access: "view"
|
|
32828
33131
|
},
|
|
33132
|
+
"storageMigration.residue": {
|
|
33133
|
+
capName: "storage-migration",
|
|
33134
|
+
capScope: "system",
|
|
33135
|
+
addonId: null,
|
|
33136
|
+
access: "view"
|
|
33137
|
+
},
|
|
32829
33138
|
"storageMigration.start": {
|
|
32830
33139
|
capName: "storage-migration",
|
|
32831
33140
|
capScope: "system",
|
|
@@ -33660,6 +33969,12 @@ Object.freeze({
|
|
|
33660
33969
|
addonId: null,
|
|
33661
33970
|
access: "delete"
|
|
33662
33971
|
},
|
|
33972
|
+
"vectorStore.fetchByIds": {
|
|
33973
|
+
capName: "vector-store",
|
|
33974
|
+
capScope: "system",
|
|
33975
|
+
addonId: null,
|
|
33976
|
+
access: "view"
|
|
33977
|
+
},
|
|
33663
33978
|
"vectorStore.getByIds": {
|
|
33664
33979
|
capName: "vector-store",
|
|
33665
33980
|
capScope: "system",
|
|
@@ -33672,6 +33987,12 @@ Object.freeze({
|
|
|
33672
33987
|
addonId: null,
|
|
33673
33988
|
access: "view"
|
|
33674
33989
|
},
|
|
33990
|
+
"vectorStore.scan": {
|
|
33991
|
+
capName: "vector-store",
|
|
33992
|
+
capScope: "system",
|
|
33993
|
+
addonId: null,
|
|
33994
|
+
access: "view"
|
|
33995
|
+
},
|
|
33675
33996
|
"vectorStore.stats": {
|
|
33676
33997
|
capName: "vector-store",
|
|
33677
33998
|
capScope: "system",
|
|
@@ -36103,7 +36424,7 @@ var AdminUIAddon = class extends BaseAddon {
|
|
|
36103
36424
|
capability: adminUiCapability,
|
|
36104
36425
|
provider: {
|
|
36105
36426
|
getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
|
|
36106
|
-
getVersion: async () => ({ version: "1.2.
|
|
36427
|
+
getVersion: async () => ({ version: "1.2.117" })
|
|
36107
36428
|
}
|
|
36108
36429
|
}];
|
|
36109
36430
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{I as e,K as t,Q as n,S as r,V as i,W as a,b as o,o as s,q as c,x as l,z as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{Z as d}from"./player-overlays-BVWg5sq2.js";import{Ba as f,Ct as p,Hr as m,Io as h,Is as g,J as _,Ji as v,Lo as y,Qo as b,Ro as x,Rs as S,St as C,ao as w,ea as T,ia as ee,na as te,nt as E,q as ne,qi as re,ra as ie,ta as ae,tt as D,un as O,wt as oe,xt as se,zo as ce}from"./src-B0h87dKs.js";import{Et as le}from"./src-CXH7iEed.js";import{t as ue}from"./pencil-C6wR4nZ6.js";import{t as de}from"./radio-XbexHVTT.js";import{t as fe}from"./refresh-cw-GeVcZb88.js";import{t as k}from"./rotate-cw-CJsnyxHu.js";import{t as pe}from"./server-D8LYlM1F.js";import{C as A,H as me,I as he,K as j,N as M,R as ge,X as _e,a as N,m as ve,o as ye,p as be,r as P,t as F,z as xe}from"./index-Z-wl-d5v.js";import{t as Se}from"./NodeAddonsSettingsPanel-D5n8FA1J.js";import{t as I}from"./format-size-DIxKXxtj.js";var L=j(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),Ce=j(`hard-drive-download`,[[`path`,{d:`M12 2v8`,key:`1q4o3n`}],[`path`,{d:`m16 6-4 4-4-4`,key:`6wukr`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,key:`w68u3i`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M10 18h.01`,key:`h775k`}]]),R=j(`memory-stick`,[[`path`,{d:`M6 19v-3`,key:`1nvgqn`}],[`path`,{d:`M10 19v-3`,key:`iu8nkm`}],[`path`,{d:`M14 19v-3`,key:`kcehxu`}],[`path`,{d:`M18 19v-3`,key:`1vh91z`}],[`path`,{d:`M8 11V9`,key:`63erz4`}],[`path`,{d:`M16 11V9`,key:`fru6f3`}],[`path`,{d:`M12 11V9`,key:`ha00sb`}],[`path`,{d:`M2 15h20`,key:`16ne18`}],[`path`,{d:`M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z`,key:`lhddv3`}]]);n();function we(e){if(e<60)return`${e}s`;let t=Math.floor(e/60);if(t<60)return`${t}m`;let n=Math.floor(t/60);return n<24?`${n}h ${t%60}m`:`${Math.floor(n/24)}d ${n%24}h`}function Te({state:e}){return l(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full ${e===`running`?`bg-success/10 text-success`:e===`crashed`||e===`failed`?`bg-destructive/10 text-destructive`:`bg-muted text-muted-foreground`}`,children:e})}var Ee=[`trace`,`debug`,`info`,`warn`,`error`];function De({proc:e,nodeId:t,defaultExpanded:n,activePanel:i,onTogglePanel:a}){let o=e.services??[],s=o.length===1,[u,d]=c(s||n),[f,m]=c(null),[h,g]=c(`info`),v=e.name.includes(`(core)`),y=ae(),b=te(),x=ie(),S=async e=>{m(e);try{await y.mutateAsync({nodeId:t,addonId:e})}catch(e){console.error(`Failed to restart addon:`,e)}finally{m(null)}},w=async()=>{m(e.name);try{await b.mutateAsync({nodeId:t,processName:e.name})}catch(e){console.error(`Failed to restart process:`,e)}finally{m(null)}},T=async n=>{let r=`${t}/${e.name}`;try{await x.mutateAsync({nodeId:r,level:n}),g(n)}catch(e){console.error(`Failed to set log level:`,e)}};return r(`div`,{className:`border border-border/50 rounded-lg overflow-hidden`,children:[r(`div`,{role:s?void 0:`button`,tabIndex:s?void 0:0,onClick:s?void 0:()=>d(!u),onKeyDown:s?void 0:e=>{(e.key===`Enter`||e.key===` `)&&d(!u)},className:`flex items-center gap-2 w-full px-3 py-2 bg-muted/20 transition-colors text-left select-none ${s?``:`hover:bg-muted/40 cursor-pointer`}`,children:[s?l(`span`,{className:`h-3 w-3 shrink-0`}):l(u?ge:he,{className:`h-3 w-3 text-muted-foreground shrink-0`}),v?l(pe,{className:`h-3.5 w-3.5 text-primary shrink-0`}):l(me,{className:`h-3.5 w-3.5 text-amber-500 shrink-0`}),l(`span`,{className:`text-xs font-semibold flex-1`,children:e.name}),r(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[`PID `,e.pid]}),l(Te,{state:e.state}),r(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[e.cpuPercent,`% CPU`]}),l(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:I(e.memoryRss)}),l(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:we(e.uptimeSeconds)}),!v&&r(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:[r(se,{children:[l(oe,{className:`text-[9px] px-1.5 py-0.5 rounded border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors font-mono`,title:`Set log level`,children:h}),l(C,{align:`end`,className:`min-w-[70px] py-0.5`,children:Ee.map(e=>l(p,{onClick:()=>T(e),className:`h-auto px-2 py-1 text-[10px] font-mono ${e===h?`text-primary font-semibold`:``}`,children:e},e))})]}),l(`button`,{onClick:w,disabled:f===e.name,className:`p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50`,title:`Restart process`,children:l(k,{className:`h-3 w-3 ${f===e.name?`animate-spin`:``}`})})]})]}),u&&o.length>0&&l(`div`,{className:`divide-y divide-border/30`,children:o.map(e=>r(`div`,{children:[r(`div`,{className:`flex items-center gap-2 px-3 py-1.5 pl-9 hover:bg-muted/10 transition-colors`,children:[l(`div`,{className:`h-1.5 w-1.5 rounded-full shrink-0 ${e.status===`running`?`bg-success`:`bg-muted-foreground/30`}`}),l(`span`,{className:`text-xs font-medium flex-1 min-w-0 truncate`,children:e.addonId}),e.capabilities.length>0&&r(`div`,{className:`flex gap-1 flex-shrink-0`,children:[e.capabilities.slice(0,3).map(e=>l(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-blue-500/10 text-blue-400 truncate max-w-[80px]`,children:e},e)),e.capabilities.length>3&&r(`span`,{className:`text-[9px] text-muted-foreground`,children:[`+`,e.capabilities.length-3]})]}),r(`div`,{className:`flex items-center gap-1 shrink-0`,children:[l(`button`,{onClick:()=>a(e.addonId,`logs`),className:`p-0.5 rounded transition-colors ${i?.addonId===e.addonId&&i.type===`logs`?`bg-primary/10 text-primary`:`hover:bg-muted text-muted-foreground hover:text-foreground`}`,title:`Show logs for ${e.addonId}`,children:l(ve,{className:`h-3 w-3`})}),l(`button`,{onClick:()=>a(e.addonId,`events`),className:`p-0.5 rounded transition-colors ${i?.addonId===e.addonId&&i.type===`events`?`bg-primary/10 text-primary`:`hover:bg-muted text-muted-foreground hover:text-foreground`}`,title:`Show events for ${e.addonId}`,children:l(de,{className:`h-3 w-3`})}),l(`button`,{onClick:()=>S(e.addonId),disabled:f===e.addonId,className:`p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50`,title:`Restart ${e.addonId}`,children:l(k,{className:`h-3 w-3 ${f===e.addonId?`animate-spin`:``}`})})]})]}),i?.addonId===e.addonId&&i.type===`logs`&&l(`div`,{className:`border-t border-border/40 bg-muted/5`,children:l(_,{addonId:e.addonId,agentId:t,maxHeight:`max-h-48`,showFilters:!1,onClose:()=>a(e.addonId,`logs`)})}),i?.addonId===e.addonId&&i.type===`events`&&l(`div`,{className:`border-t border-border/40 bg-muted/5`,children:l(ne,{addonId:e.addonId,category:`addon.*`,maxHeight:`max-h-48`,onClose:()=>a(e.addonId,`events`)})})]},e.addonId))}),u&&o.length===0&&l(`div`,{className:`px-3 py-2 pl-9 text-[10px] text-muted-foreground`,children:`No services`})]})}function Oe({nodeId:e,processes:t}){let[n,r]=c(null),i=(e,t)=>{r(n=>n?.addonId===e&&n.type===t?null:{addonId:e,type:t})};return t.length===0?l(`div`,{className:`py-4 text-xs text-muted-foreground text-center`,children:`No processes on this node`}):l(`div`,{className:`space-y-2 py-1`,children:t.map((t,r)=>l(De,{proc:t,nodeId:e,defaultExpanded:r===0,activePanel:n,onTogglePanel:i},t.name))})}var ke={system:0,managed:1,root:2};n();function Ae(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${e%60}s`:e<86400?`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`${Math.floor(e/86400)}d ${Math.floor(e%86400/3600)}h`}function je(e,t=80){return e.length<=t?e:`…${e.slice(e.length-t+1)}`}function Me({nodeId:e}){let t=s(),n=g(`metrics.node-processes-snapshot`,t=>t.nodeId===e),{data:i}=v({nodeId:e}),o=n?.processes??i,c=a(()=>o?[...o]:[],[o]),u=a(()=>[{key:`classification`,header:`Class`,sortValue:e=>ke[e.classification],render:e=>l(`span`,{className:`inline-block rounded-full px-1.5 py-0.5 text-[10px] font-medium ${e.classification===`root`?`bg-sky-500/20 text-sky-400`:e.classification===`system`?`bg-foreground-subtle/20 text-foreground-subtle`:`bg-success/20 text-success`}`,children:e.classification})},{key:`pid`,header:`PID`,align:`right`,sortValue:e=>e.pid,render:e=>l(`span`,{className:`font-mono`,children:e.pid})},{key:`ppid`,header:`PPID`,align:`right`,sortValue:e=>e.ppid,render:e=>l(`span`,{className:`font-mono text-foreground-subtle`,children:e.ppid})},{key:`addonId`,header:`Addon`,sortValue:e=>e.addonId,render:e=>l(`span`,{className:`text-foreground-subtle text-[11px]`,children:e.addonId??`—`})},{key:`command`,header:`Command`,nowrap:!1,render:e=>l(`span`,{className:`font-mono text-[10px] text-foreground-subtle break-all`,children:je(e.command)})},{key:`cpuPercent`,header:`CPU%`,align:`right`,sortValue:e=>e.cpuPercent,render:e=>e.cpuPercent.toFixed(1)},{key:`memoryRssBytes`,header:`RSS`,align:`right`,sortValue:e=>e.memoryRssBytes,render:e=>I(e.memoryRssBytes)},{key:`uptimeSec`,header:`Uptime`,align:`right`,sortValue:e=>e.uptimeSec,render:e=>l(`span`,{className:`text-foreground-subtle`,children:Ae(e.uptimeSec)})}],[]);return r(`div`,{className:`space-y-4`,children:[l(`div`,{className:`flex items-start justify-end gap-4`,children:r(`button`,{type:`button`,onClick:()=>t.invalidateQueries({queryKey:[[`metricsProvider`,`listNodeProcesses`]]}),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-[11px] text-foreground hover:bg-surface-hover`,children:[l(fe,{className:`h-3 w-3`}),` Refresh`]})}),l(D,{columns:u,rows:c,rowKey:e=>e.pid,minWidthPx:880,mobileMode:`scroll`,maxBodyHeight:E,emptyMessage:`Scanning…`})]})}var z={width:320,height:64},B=.8,V=Math.ceil(8*B-3)+1,H=z.width+34,U=z.height+V+1+11,Ne=V+z.height+1+3+Math.ceil(8*B),Pe=[1,2,5,10],Fe=[1,2,4,8,16,32,64,128,256,512,1024],W=[1,1.5,2,2.5,3,4,5],G=[4,3,5,2],Ie=1e-9;function Le(e,t){if(!Number.isFinite(e)||e<=0)return!1;if(t===`bytes`){if(!Number.isInteger(e))return!1;let t=e/1024**Math.floor(Math.log(e)/Math.log(1024));return W.some(e=>Math.abs(t-e)<Ie)}let n=e/10**Math.floor(Math.log10(e));return W.some(e=>Math.abs(n-e)<Ie)}function Re(e,t,n){let r=0;for(let t of e)t!==null&&t>r&&(r=t);if(r<=t)return t;if(n===`bytes`){let e=1024**Math.floor(Math.log(r)/Math.log(1024));for(let t of Fe){let n=t*e;if(n>=r)return n}return 1024*e}let i=10**Math.floor(Math.log10(r));for(let e of Pe){let t=e*i;if(t>=r)return t}return 10*i}function ze(e,t){if(!Number.isFinite(e)||e<=0)return[];let n=G.find(n=>Le(e/n,t))??G[G.length-1],r=e/n,i=[];for(let e=1;e<=n;e++)i.push(r*e);return i}var Be=2.5;function Ve(e){return e*Be}function K(e,t,n,r){if(e.length===0)return[];let i=e[0].atMs,a=e.at(-1).atMs-i,o=n<=0?1:n,s=r!==void 0&&r>0?r:null;return e.map((r,c)=>{let l=a>0?(r.atMs-i)/a*t.width:c/Math.max(1,e.length-1)*t.width,u=c>0?e[c-1]:void 0;return{x:l,y:r.value===null?null:t.height-Math.min(r.value,n)/o*t.height,gapBefore:s!==null&&u!==void 0&&r.atMs-u.atMs>s}})}function He(e){let t=[],n=!1;for(let r of e){if(r.y===null){n=!1;continue}r.gapBefore&&(n=!1),t.push(`${n?`L`:`M`}${r.x.toFixed(1)},${r.y.toFixed(1)}`),n=!0}return t.join(` `)}function Ue(e,t){let n=[],r=[],i=()=>{if(r.length<2){r=[];return}let e=r.map((e,t)=>`${t===0?`M`:`L`}${e.x.toFixed(1)},${e.top.toFixed(1)}`),t=[...r].reverse().map(e=>`L${e.x.toFixed(1)},${e.bottom.toFixed(1)}`);n.push(`${e.join(` `)} ${t.join(` `)} Z`),r=[]};for(let n=0;n<e.length;n++){let a=e[n],o=t[n];if(!a||!o||a.y===null||o.y===null){i();continue}(a.gapBefore||o.gapBefore)&&i(),r.push({x:a.x,top:a.y,bottom:o.y})}return i(),n.join(` `)}function We(e,t,n=3){if(e.length<2||n<2)return[];let r=e[0].atMs,i=e.at(-1).atMs-r;if(i<=0)return[];let a=[];for(let e=0;e<n;e++){let o=e/(n-1);a.push({atMs:r+i*o,x:o*t.width,anchor:e===0?`start`:e===n-1?`end`:`middle`})}return a}function Ge(e){return e.length<2?0:Math.max(0,e.at(-1).atMs-e[0].atMs)}function Ke(e){let t=[];for(let n=1;n<e.length;n++){let r=e[n];r.gapBefore&&t.push({fromX:e[n-1].x,toX:r.x})}return t}function qe(e,t){if(e.length===0)return null;let n=0,r=1/0;for(let i=0;i<e.length;i++){let a=Math.abs(e[i].x-t);a<r&&(r=a,n=i)}return n}n();var q={main:`var(--load-series-main)`,gc:`var(--load-series-gc)`},Je=`
|
|
2
|
-
.load-chart-scope { --load-series-main: #2a78d6; --load-series-gc: #e87ba4; }
|
|
3
|
-
@media (prefers-color-scheme: dark) {
|
|
4
|
-
:root:not([data-theme="light"]) .load-chart-scope {
|
|
5
|
-
--load-series-main: #3987e5; --load-series-gc: #d55181;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
:root[data-theme="dark"] .load-chart-scope {
|
|
9
|
-
--load-series-main: #3987e5; --load-series-gc: #d55181;
|
|
10
|
-
}
|
|
11
|
-
`,J=z,Ye={height:U};function Xe({title:e,points:n,mainLabel:s,gcLabel:u,formatValue:d,emptyMessage:f,gapMs:p}){let m=i(),h=t(null),[g,_]=c(null),v=a(()=>{let e=n.map(e=>({atMs:e.atMs,value:e.main===null||e.gc===null?null:e.main+e.gc})),t=n.map(e=>({atMs:e.atMs,value:e.main})),r=Re(e.map(e=>e.value),25,`linear`),i=K(e,J,r,p),a=K(t,J,r,p),o=a.map(e=>({x:e.x,y:e.y===null?null:J.height,gapBefore:e.gapBefore}));return{max:r,ticks:ze(r,`linear`),upper:i,middle:a,base:o,gaps:Ke(i),times:We(e,J),spanMs:Ge(e)}},[n,p]),y=n.at(-1),b=g===null?void 0:n[g.index],x=b??y;return n.length===0||v.upper.every(e=>e.y===null)?l(Z,{title:e,children:l(at,{message:f})}):l(Z,{title:e,legend:r(o,{children:[l(it,{color:q.main,label:s}),l(it,{color:q.gc,label:u})]}),readout:x&&x.main!==null&&x.gc!==null?r(o,{children:[b!==void 0&&l(rt,{atMs:b.atMs,spanMs:v.spanMs}),l(Q,{color:q.main,text:d(x.main)}),l(Q,{color:q.gc,text:d(x.gc)})]}):null,children:r(`svg`,{ref:h,viewBox:`0 0 ${H} ${U}`,preserveAspectRatio:`none`,className:`w-full`,style:Ye,role:`img`,"aria-label":`${e}: ${s} and ${u} over time`,onMouseLeave:()=>_(null),onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect();if(t.width===0)return;let n=(e.clientX-t.left)/t.width*H-34,r=qe(v.upper,n);r!==null&&_({index:r,xPx:v.upper[r].x})},children:[l(Ze,{ticks:v.ticks,max:v.max,formatValue:d}),l(nt,{ticks:v.times,spanMs:v.spanMs}),r(`g`,{transform:`translate(34,${V})`,clipPath:`url(#${m})`,children:[l(`clipPath`,{id:m,children:l(`rect`,{x:0,y:0,width:J.width,height:J.height})}),l(X,{spans:v.gaps}),l(`path`,{d:Ue(v.middle,v.base),fill:q.main,fillOpacity:.85}),l(`path`,{d:Ue(v.upper,v.middle),fill:q.gc,fillOpacity:.85,stroke:`var(--color-surface, transparent)`,strokeWidth:2}),l(`path`,{d:He(v.upper),fill:`none`,stroke:q.gc,strokeWidth:2}),g!==null&&l(`line`,{x1:g.xPx,x2:g.xPx,y1:0,y2:J.height,stroke:`currentColor`,strokeWidth:1,className:`text-foreground-subtle`})]})]})})}function Y({title:e,points:n,formatValue:i,emptyMessage:s,axisFloor:u,axisScale:d=`linear`,gapMs:f}){let p=t(null),[m,h]=c(null),g=a(()=>{let e=Re(n.map(e=>e.value),u,d),t=K(n,J,e,f);return{max:e,ticks:ze(e,d),projected:t,gaps:Ke(t),times:We(n,J),spanMs:Ge(n)}},[n,u,d,f]),_=m===null?void 0:n[m.index],v=_??n.at(-1)??void 0;return n.length===0||g.projected.every(e=>e.y===null)?l(Z,{title:e,children:l(at,{message:s})}):l(Z,{title:e,readout:v&&v.value!==null?r(o,{children:[_!==void 0&&l(rt,{atMs:_.atMs,spanMs:g.spanMs}),l(Q,{color:q.main,text:i(v.value)})]}):null,children:r(`svg`,{ref:p,viewBox:`0 0 ${H} ${U}`,preserveAspectRatio:`none`,className:`w-full`,style:Ye,role:`img`,"aria-label":e,onMouseLeave:()=>h(null),onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect();if(t.width===0)return;let n=(e.clientX-t.left)/t.width*H-34,r=qe(g.projected,n);r!==null&&h({index:r,xPx:g.projected[r].x})},children:[l(Ze,{ticks:g.ticks,max:g.max,formatValue:i}),l(nt,{ticks:g.times,spanMs:g.spanMs}),r(`g`,{transform:`translate(34,${V})`,children:[l(X,{spans:g.gaps}),l(`path`,{d:He(g.projected),fill:`none`,stroke:q.main,strokeWidth:2}),m!==null&&l(`line`,{x1:m.xPx,x2:m.xPx,y1:0,y2:J.height,stroke:`currentColor`,strokeWidth:1,className:`text-foreground-subtle`})]})]})})}function Ze({ticks:e,max:t,formatValue:n}){let i=t<=0?1:t;return l(`g`,{className:`text-foreground-subtle`,children:e.map(e=>{let t=V+J.height-e/i*J.height;return r(`g`,{children:[l(`line`,{x1:34,x2:34+J.width,y1:t,y2:t,stroke:`currentColor`,strokeWidth:.5,strokeOpacity:.3}),l(`text`,{x:0,y:t+3,fontSize:8,fill:`currentColor`,children:n(e)})]},e)})})}function X({spans:e}){return e.length===0?null:l(`g`,{className:`text-foreground-subtle`,children:e.map(e=>l(`rect`,{x:e.fromX,y:0,width:Math.max(1,e.toX-e.fromX),height:J.height,fill:`currentColor`,fillOpacity:.12,children:l(`title`,{children:`No samples in this interval — nothing was measured, nothing is drawn.`})},`${e.fromX}-${e.toX}`))})}var Qe=10*6e4,$e={hour:`2-digit`,minute:`2-digit`},et={hour:`2-digit`,minute:`2-digit`,second:`2-digit`};function tt(e,t){return new Date(e).toLocaleTimeString(void 0,t<Qe?et:$e)}function nt({ticks:e,spanMs:t}){return e.length===0?null:l(`g`,{className:`text-foreground-subtle`,children:e.map(e=>l(`text`,{x:34+e.x,y:Ne,fontSize:8,textAnchor:e.anchor,fill:`currentColor`,children:tt(e.atMs,t)},e.atMs))})}function rt({atMs:e,spanMs:t}){return l(`span`,{className:`text-[10px] tabular-nums text-foreground-subtle`,children:tt(e,t)})}function Z({title:e,legend:t,readout:n,children:i}){return r(`div`,{className:`load-chart-scope min-w-0`,children:[r(`div`,{className:`flex items-baseline justify-between gap-2 mb-1`,children:[l(`span`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:e}),l(`div`,{className:`flex items-center gap-2`,children:n})]}),i,t&&l(`div`,{className:`flex items-center gap-3 mt-1`,children:t})]})}function it({color:e,label:t}){return r(`span`,{className:`inline-flex items-center gap-1 text-[9px] text-foreground-subtle`,children:[l(`span`,{className:`inline-block h-2 w-2 rounded-[2px]`,style:{backgroundColor:e}}),t]})}function Q({color:e,text:t}){return r(`span`,{className:`inline-flex items-center gap-1 text-[11px] tabular-nums text-foreground`,children:[l(`span`,{className:`inline-block h-2 w-2 rounded-[2px]`,style:{backgroundColor:e}}),t]})}function at({message:e}){return l(`div`,{className:`h-16 flex items-center justify-center rounded border border-dashed border-border text-[10px] text-foreground-subtle text-center px-2`,children:e})}function ot(e,t){let n=e.at(-1);return n===void 0?[t]:t.atMs>n.atMs?[...e,t]:e.some(e=>e.atMs===t.atMs)?e:[...e,t].toSorted((e,t)=>e.atMs-t.atMs)}function st(e,t,n,r){let i=e.get(t),a=ot(i?.points??[],r);if(i!==void 0&&a===i.points)return e;let o=new Map(e);return o.set(t,{key:t,kind:n,points:a.slice(Math.max(0,a.length-720))}),o}function ct(e,t,n){let r=e;for(let e of le(t,n))r=st(r,e.key,e.kind,e.point);return r}function lt(e,t){let n=e;for(let e of t)for(let t of e.points)n=st(n,e.key,e.kind,t);return n}function ut(e){let t=null;for(let n of e.values()){let e=n.points.at(-1);e!==void 0&&(t===null||e.atMs>t)&&(t=e.atMs)}return t}var dt=12e4;function ft(e,t){return e===null?!1:t-e>dt}function pt(e){let t=e=>{let t=e.points.at(-1);return t===void 0?-1:t.cpuMainPercent!==null&&t.cpuGcPercent!==null?t.cpuMainPercent+t.cpuGcPercent:t.cpuLifetimePercent};return[...e.values()].toSorted((e,n)=>{let r=t(n)-t(e);return r===0?e.key.localeCompare(n.key):r})}function mt(e){for(let t of e.values()){let e=t.points.at(-1);if(e&&e.cpuMainPercent!==null)return!0}return!1}var ht={key:`cpu`,dir:`desc`};function gt(e){let t=e.points.at(-1);return t===void 0?null:t.cpuMainPercent!==null&&t.cpuGcPercent!==null?t.cpuMainPercent+t.cpuGcPercent:t.cpuLifetimePercent}function _t(e){return e.points.at(-1)?.memoryRssBytes??null}function vt(e,t,n){let r=n.trim().toLowerCase();return r===``?!0:e.toLowerCase().includes(r)||t.toLowerCase().includes(r)}function yt(e,t){return t===`memory`?_t(e):gt(e)}function bt(e,t,n){let r=e.filter(e=>t.selectedKeys.size>0&&!t.selectedKeys.has(e.key)?!1:vt(n(e),e.key,t.search)),i=(e,t)=>e.key.localeCompare(t.key);return[...r].toSorted((e,r)=>{if(t.sort.key===`name`){let a=n(e).localeCompare(n(r)),o=t.sort.dir===`asc`?a:-a;return o===0?i(e,r):o}let a=yt(e,t.sort.key),o=yt(r,t.sort.key);if(a===null&&o===null)return i(e,r);if(a===null)return 1;if(o===null)return-1;let s=t.sort.dir===`desc`?o-a:a-o;return s===0?i(e,r):s})}n();function xt(e,n=720){let r=g(`metrics.node-processes-snapshot`,t=>t.nodeId===e),[i,a]=c(new Map),[o,s]=c(void 0),l=t(null),{data:d,isPending:f}=re({forNodeId:e,sinceMs:o,maxPoints:n});u(()=>{d!==void 0&&a(e=>{let t=lt(e,d.series);return l.current=ut(t),t})},[d]);let p=r?.timestamp;u(()=>{r==null||p===void 0||(ft(l.current,p)&&s(l.current??0),a(e=>{let t=ct(e,r.processes,p);return l.current=ut(t),t}))},[p]),u(()=>{a(new Map),s(void 0),l.current=null},[e]);let m=0;for(let e of i.values())m=Math.max(m,e.points.length);return{series:pt(i),sampleCount:m,threadSplitAvailable:mt(i),loadingRetained:f,durable:d?.durable??null,bucketMs:d?.bucketMs??null,cadenceMs:d?.cadenceMs??null,retainedSamples:d?.retainedSamples??null}}var St=`__unclaimed__`;function Ct(e,t){return{kind:e,deviceId:t,cpu:0,cpuKnown:!0,rss:0,rssKnown:!0,count:0,roles:new Set}}function wt(e,t){return{key:e,kind:t.kind,deviceId:t.deviceId,cpuSeconds:t.cpuKnown?Math.round(t.cpu*100)/100:null,rssBytes:t.rssKnown?t.rss:null,unitCount:t.count,roles:[...t.roles].sort()}}function Tt(e,t){let n=new Map,r=new Set;for(let t of e){t.pid!==void 0&&r.add(t.pid);let e=t.deviceId!==null&&t.attribution!==`unattributable`,i=e?`device:${t.deviceId}`:`shared:${t.role}`,a=n.get(i)??Ct(e?`camera`:`shared`,e?t.deviceId:null);a.count+=1,a.roles.add(t.role),t.cpuSeconds===void 0?a.cpuKnown=!1:a.cpu+=t.cpuSeconds,t.rssBytes===void 0?a.rssKnown=!1:a.rss+=t.rssBytes,n.set(i,a)}let i=[...n.entries()].map(([e,t])=>wt(e,t));if(t===void 0)return i;let a=t.filter(e=>!r.has(e.pid));if(a.length===0)return i;let o=Ct(`unclaimed`,null);for(let e of a)o.count+=1,o.rss+=e.memoryRssBytes;return o.cpuKnown=!1,[...i,wt(St,o)]}var Et=[{family:`decode`,attribution:`measured`,unit:`one forked decode-worker child per decode SESSION`,perCamera:!0,wiredToday:!0,missingLink:``,evidence:[`packages/addon-pipeline/src/session-decode/fork-decode-worker.ts:118`,`packages/addon-pipeline/src/session-decode/fork-decode-worker.ts:131`,`packages/addon-pipeline/src/pipeline-runner/index.ts:2765`,`packages/types/src/process/child-cost-registry.ts:188`]},{family:`transcode`,attribution:`measured`,unit:`one ffmpeg child per (camera, encode plan)`,perCamera:!0,wiredToday:!0,missingLink:``,evidence:[`packages/addon-pipeline/src/stream-broker/stream-broker/egress-transcode-manager.ts:960`,`packages/addon-pipeline/src/stream-broker/stream-broker/transcode-egress.ts:282`,`packages/addon-pipeline/src/stream-broker/stream-broker/transcode-egress.ts:324`,`packages/types/src/ffmpeg/sharing-key.ts:139`]},{family:`recording`,attribution:`measured`,unit:`one passthrough ffmpeg per (camera, profile)`,perCamera:!0,wiredToday:!0,missingLink:``,evidence:[`packages/addon-pipeline/src/recorder/addon/segment-writer.ts:33`,`packages/addon-pipeline/src/recorder/addon/segment-writer.ts:217`,`packages/addon-pipeline/src/recorder/addon/segment-writer.ts:279`,`packages/addon-pipeline/src/recorder/addon/recording-controller.ts:1710`]},{family:`detection`,attribution:`accounted`,unit:`a SHARED inference pool per (node, runtime, device) — no per-camera process`,perCamera:!1,wiredToday:!0,missingLink:"Nothing is missing for COUNTING — per-camera inference milliseconds, processed/shed frames and bytes-to-pool are already accumulated. What is missing is any basis for CPU seconds: `deviceId` reaches the pool as a diagnostic label and selects nothing, so cost can only ever be apportioned, never measured. Since 2026-08-27 the pool DECLARES this itself, contributing `deviceId: null` + `attribution: unattributable` rather than leaving an observer to infer it — the renunciation is data, and it is still refused by the chart gate.",evidence:[`packages/addon-pipeline/src/detection-pipeline/provider.ts:540`,`packages/addon-pipeline/src/detection-pipeline/engine/shared-inference-pool.ts:413`,`packages/types/src/interfaces/inference-engine.ts:24`,`packages/addon-pipeline/src/pipeline-runner/timing-sampler.ts:63`,`packages/addon-pipeline/src/pipeline-runner/runner.ts:353`,`packages/addon-pipeline/src/pipeline-runner/runner.ts:849`,`packages/addon-pipeline/src/pipeline-runner/frame-lazy-metrics.ts:100`]},{family:`streaming`,attribution:`measured`,unit:"one StreamBroker per `${deviceId}/${camStreamId}`, with an exact RTP ring byte counter",perCamera:!0,wiredToday:!1,missingLink:"The ffmpeg-backed ingest is now reported per camera, but that is the minority path. `rtpRingBytes` — the exact figure for the in-process case — is maintained on every push and drop and is still private and absent from `getStats()`. The three `EncodedRingBuffer`s track packets and duration and have no byte accumulator at all; the only byte figure they offer is `preRollBudgetBytes`, which is a BUDGET, not an occupancy.",evidence:[`packages/addon-pipeline/src/stream-broker/stream-broker/stream-broker.ts:2895`,`packages/addon-pipeline/src/stream-broker/rtsp/ffmpeg-push-reader.ts:189`,`packages/addon-pipeline/src/stream-broker/stream-broker/stream-broker.ts:494`,`packages/addon-pipeline/src/stream-broker/stream-broker/stream-broker.ts:498`,`packages/addon-pipeline/src/stream-broker/stream-broker/stream-broker.ts:2505`,`packages/addon-pipeline/src/stream-broker/stream-broker/pre-roll.ts:269`]}];function Dt(e){return e.attribution===`measured`&&e.wiredToday}function Ot(){let e=new Set;for(let t of Et)Dt(t)&&e.add(t.family);return e}var kt=Ot();function At(e){return!kt.has(e.role)||e.deviceId===null?!1:e.attribution===`measured`}function jt(e){return`${e.addonId}${e.role}${e.unit}${e.pid??`-`}`}function Mt(){return{cpuSeconds:0,cpuKnown:!0,rssBytes:0,rssKnown:!0,unitCount:0,roles:new Set}}function Nt(e,t,n){if(t.cpuSeconds===void 0)return null;if(e===void 0)return t.startedAtMs===void 0||t.startedAtMs<n?null:t.cpuSeconds;if(e.cpuSeconds===void 0||e.startedAtMs===void 0||t.startedAtMs===void 0||e.startedAtMs!==t.startedAtMs)return null;let r=t.cpuSeconds-e.cpuSeconds;return r<0?null:r}function Pt(e){return Math.round(e*10)/10}function Ft(e,t){let n=t.atMs-e.atMs;if(n<=0)return[];let r=n/1e3,i=new Map;for(let t of e.entries)At(t)&&i.set(jt(t),t);let a=new Map,o=new Set;for(let n of t.entries){if(!At(n)||n.deviceId===null)continue;let t=jt(n);o.add(t);let r=a.get(n.deviceId)??Mt();r.unitCount+=1,r.roles.add(n.role);let s=Nt(i.get(t),n,e.atMs);s===null?r.cpuKnown=!1:r.cpuSeconds+=s,n.rssBytes===void 0?r.rssKnown=!1:r.rssBytes+=n.rssBytes,a.set(n.deviceId,r)}for(let[e,t]of i){if(o.has(e)||t.deviceId===null)continue;let n=a.get(t.deviceId);n!==void 0&&(n.cpuKnown=!1)}return[...a.entries()].map(([e,n])=>({deviceId:e,point:{atMs:t.atMs,cpuPercent:n.cpuKnown?Pt(n.cpuSeconds/r*100):null,rssBytes:n.rssKnown?n.rssBytes:null,unitCount:n.unitCount,roles:[...n.roles].toSorted()}}))}function It(e,t){if(t.length===0)return e;let n=new Map(e);for(let e of t){let t=n.get(e.deviceId),r=t?.points.at(-1);if(r!==void 0&&e.point.atMs<=r.atMs)continue;let i=[...t?.points??[],e.point];n.set(e.deviceId,{deviceId:e.deviceId,points:i.slice(Math.max(0,i.length-720))})}return n}function Lt(e){let t=e=>{for(let t=e.points.length-1;t>=0;t--){let n=e.points[t]?.cpuPercent;if(n!=null)return n}return-1};return[...e.values()].toSorted((e,n)=>{let r=t(n)-t(e);return r===0?e.deviceId-n.deviceId:r})}function Rt(e){let t=e.indexOf(`@`);return t===-1?{addonId:e,nodeId:null}:{addonId:e.slice(0,t),nodeId:e.slice(t+1)}}function zt(e,t){let n=Rt(e);return n.nodeId===null?t.isHub:n.nodeId===t.nodeId}function Bt(e,t){return e.filter(e=>zt(e.addonId,t))}n();function Vt(e){let n=g(`metrics.node-processes-snapshot`,t=>t.nodeId===e.nodeId),r=b(void 0,{staleTime:1/0,refetchOnWindowFocus:!1}),[i,a]=c(new Map),o=t(null),s=t(r.refetch);s.current=r.refetch;let l=n?.timestamp;u(()=>{l!==void 0&&s.current()},[l]),u(()=>{a(new Map),o.current=null},[e.nodeId,e.isHub]);let d=r.data,f=r.dataUpdatedAt;u(()=>{if(d===void 0||f===0)return;let t={atMs:f,entries:Bt(d,e)},n=o.current;if(o.current=t,n===null)return;let r=Ft(n,t);r.length!==0&&a(e=>It(e,r))},[d,f,e.nodeId,e.isHub]);let p=d===void 0?[]:Bt(d,e),m=n?.processes,h=Tt(p,m);return{series:Lt(i),unclaimed:h.find(e=>e.kind===`unclaimed`)??null,loading:r.isPending,error:r.error===null?null:r.error.message}}function Ht(e){let t=new Map;for(let n of e){let e=n.name?.trim();e===void 0||e===``||t.set(n.id,e)}return t}var Ut=25,Wt=64*1024*1024,Gt=1e4;function Kt({scope:e,cadenceMs:t}){let{t:n}=F(),i=Vt(e),{data:a=[]}=m({isCamera:!0,projection:`slim`}),o=Ht(a),s=Ve(t??Gt);return r(`section`,{className:`space-y-3`,children:[i.error!==null&&r(`div`,{className:`flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-[11px] text-destructive`,children:[l(N,{className:`h-3 w-3 mt-0.5 shrink-0`}),l(`span`,{children:n(`cameraLoad.readFailed`,`Could not read the load contributions: {{error}}. This is a failed read, NOT an idle cluster.`,{error:i.error})})]}),l(Jt,{unclaimed:i.unclaimed}),i.series.length===0&&i.error===null&&l(`div`,{className:`rounded-md border border-dashed border-border px-3 py-6 text-center text-[11px] text-foreground-subtle`,children:i.loading?n(`cameraLoad.loading`,`Reading what the addons report…`):n(`cameraLoad.waitingWindow`,`No per-camera window yet.`)}),l(`div`,{className:`space-y-3`,children:i.series.map(e=>r(`div`,{className:`rounded-lg border border-border p-3`,children:[r(`div`,{className:`flex items-baseline justify-between gap-2 mb-2`,children:[l(qt,{deviceId:e.deviceId,name:o.get(e.deviceId)}),l(`span`,{className:`text-[10px] text-foreground-subtle`,children:n(`cameraLoad.unitCount`,`{{count}} unit(s): {{roles}}`,{count:e.points.at(-1)?.unitCount??0,roles:(e.points.at(-1)?.roles??[]).join(`, `)})})]}),r(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[l(Y,{title:n(`cameraLoad.cpuTitle`,`CPU % of one core (delta)`),points:e.points.map(e=>({atMs:e.atMs,value:e.cpuPercent})),formatValue:e=>`${e.toFixed(1)}%`,axisFloor:Ut,gapMs:s,emptyMessage:n(`cameraLoad.cpuUnavailable`,`No measurable window yet.`)}),l(Y,{title:n(`cameraLoad.memoryTitle`,`Memory RSS`),points:e.points.map(e=>({atMs:e.atMs,value:e.rssBytes})),formatValue:I,axisFloor:Wt,axisScale:`bytes`,gapMs:s,emptyMessage:n(`cameraLoad.memoryUnavailable`,`No memory reported.`)})]})]},e.deviceId))})]})}function qt({deviceId:e,name:t}){let{t:n}=F();return t===void 0?l(`span`,{className:`text-xs font-medium text-foreground`,children:n(`cameraLoad.deviceLabel`,`Camera {{deviceId}}`,{deviceId:e})}):r(`span`,{className:`flex items-baseline gap-1.5 min-w-0`,children:[l(`span`,{className:`text-xs font-medium text-foreground truncate`,children:t}),r(`span`,{className:`shrink-0 text-[10px] font-mono text-foreground-subtle`,children:[`#`,e]})]})}function Jt({unclaimed:e}){let{t}=F();return e===null||e.unitCount===0?null:l(`div`,{className:`flex items-center gap-2`,children:l(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-amber-500/10 text-amber-400 font-medium tabular-nums`,children:t(`cameraLoad.unclaimedBadge`,`{{count}} unclaimed · {{rss}}`,{count:e.unitCount,rss:e.rssBytes===null?`—`:I(e.rssBytes)})})})}n();var Yt=256*1024*1024,Xt=1e4;function Zt({nodeId:e,isHub:t}){let{t:n}=F(),{series:i,sampleCount:o,threadSplitAvailable:s,loadingRetained:u,bucketMs:d,cadenceMs:f}=xt(e),[p,m]=c(``),[h,g]=c(new Set),[_,v]=c(ht),y=e=>e.key===`__root__`?n(`clusterLoad.bucketRoot`,`Node supervisor`):e.key===`__unattributed__`?n(`clusterLoad.bucketUnattributed`,`Unattributed processes`):e.key,b=Ve(d??f??Xt),x=a(()=>bt(i,{search:p,selectedKeys:h,sort:_},y),[i,p,h,_]),S=e=>{g(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return r(`div`,{className:`space-y-4`,children:[l(`style`,{children:Je}),l(Qt,{bucketMs:d,cadenceMs:f}),!s&&o>0&&r(`div`,{className:`flex items-start gap-2 rounded-md border border-amber-500/40 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400`,children:[l(N,{className:`h-3 w-3 mt-0.5 shrink-0`}),l(`span`,{children:n(`clusterLoad.noThreadSplit`,`No thread-level CPU split on this node — /proc/<pid>/task is Linux-only, and the first sample after a restart has no window to measure. CPU below falls back to the ps lifetime AVERAGE, which is not a rate.`)})]}),o===0&&l(`div`,{className:`rounded-md border border-dashed border-border px-3 py-6 text-center text-[11px] text-foreground-subtle`,children:u?n(`clusterLoad.loadingRetained`,`Reading the retained series from this node…`):n(`clusterLoad.waitingFirstSample`,`No retained samples for this node — waiting for the next snapshot (up to 20s). The chart needs two to draw a rate.`)}),i.length>0&&r(`div`,{className:`space-y-2`,children:[r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(`label`,{className:`relative flex-1 min-w-[160px]`,children:[l(be,{className:`pointer-events-none absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-foreground-subtle`}),l(`input`,{type:`search`,value:p,onChange:e=>m(e.target.value),placeholder:n(`clusterLoad.searchPlaceholder`,`Find a runner…`),"aria-label":n(`clusterLoad.searchLabel`,`Find a runner`),className:`w-full rounded border border-border bg-background py-1 pl-7 pr-2 text-[11px] text-foreground placeholder:text-foreground-subtle`})]}),l($t,{sort:_,onChange:v})]}),r(`div`,{className:`flex flex-wrap items-center gap-1`,children:[i.map(e=>{let t=h.has(e.key);return l(`button`,{type:`button`,"aria-pressed":t,onClick:()=>S(e.key),className:`rounded-full border px-2 py-0.5 text-[10px] transition-colors ${t?`border-primary bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground`}`,children:y(e)},e.key)}),h.size>0&&r(`button`,{type:`button`,onClick:()=>g(new Set),className:`inline-flex items-center gap-1 rounded-full border border-border px-2 py-0.5 text-[10px] text-foreground-subtle hover:text-foreground`,children:[l(P,{className:`h-2.5 w-2.5`}),n(`clusterLoad.clearFilter`,`All runners`)]})]})]}),i.length>0&&x.length===0&&l(`div`,{className:`rounded-md border border-dashed border-border px-3 py-6 text-center text-[11px] text-foreground-subtle`,children:n(`clusterLoad.noMatches`,`No runner matches this search on {{count}} present. The node is reporting — the filter is hiding them.`,{count:i.length})}),l(`div`,{className:`space-y-3`,children:x.map(e=>r(`div`,{className:`rounded-lg border border-border p-3`,children:[r(`div`,{className:`flex items-baseline justify-between gap-2 mb-2`,children:[l(`span`,{className:`text-xs font-medium text-foreground`,children:y(e)}),l(`span`,{className:`text-[10px] text-foreground-subtle`,children:n(`clusterLoad.processCount`,`{{count}} process(es)`,{count:e.points.at(-1)?.processCount??0})})]}),r(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[l(Xe,{title:s?n(`clusterLoad.cpuTitle`,`CPU % of one core`):n(`clusterLoad.cpuTitleLifetime`,`CPU % (ps lifetime average)`),mainLabel:n(`clusterLoad.seriesMain`,`Main threads`),gcLabel:n(`clusterLoad.seriesGc`,`GC / V8 helpers`),points:e.points.map(e=>({atMs:e.atMs,main:e.cpuMainPercent,gc:e.cpuGcPercent})),formatValue:e=>`${e.toFixed(0)}%`,gapMs:b,emptyMessage:n(`clusterLoad.cpuUnavailable`,`No thread split on this node. Lifetime average: {{avg}}%`,{avg:(e.points.at(-1)?.cpuLifetimePercent??0).toFixed(1)})}),l(Y,{title:n(`clusterLoad.memoryTitle`,`Memory RSS`),points:e.points.map(e=>({atMs:e.atMs,value:e.memoryRssBytes})),formatValue:I,axisFloor:Yt,axisScale:`bytes`,gapMs:b,emptyMessage:n(`clusterLoad.memoryUnavailable`,`No memory samples yet.`)})]})]},e.key))}),l(Kt,{scope:{nodeId:e,isHub:t},cadenceMs:f})]})}function Qt({bucketMs:e,cadenceMs:t}){let{t:n}=F();return e===null?null:l(`p`,{className:`text-[10px] text-foreground-subtle`,children:t!==null&&e>t?n(`clusterLoad.captionBucket`,`1 point = {{bucket}}s (bucket MAXIMUM, not a mean)`,{bucket:Math.round(e/1e3)}):n(`clusterLoad.captionRaw`,`1 point = 1 snapshot`)})}function $t({sort:e,onChange:t}){let{t:n}=F(),i=[{key:`cpu`,label:n(`clusterLoad.sortCpu`,`CPU`)},{key:`memory`,label:n(`clusterLoad.sortMemory`,`Memory`)},{key:`name`,label:n(`clusterLoad.sortName`,`Name`)}];return r(`div`,{className:`flex items-center gap-1`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:n(`clusterLoad.sortBy`,`Sort by`)}),i.map(n=>{let i=e.key===n.key;return r(`button`,{type:`button`,"aria-pressed":i,onClick:()=>t(i?{key:n.key,dir:e.dir===`desc`?`asc`:`desc`}:{key:n.key,dir:n.key===`name`?`asc`:`desc`}),className:`rounded border px-1.5 py-0.5 text-[10px] transition-colors ${i?`border-primary bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground`}`,children:[n.label,i&&(e.dir===`desc`?` ↓`:` ↑`)]},n.key)})]})}var en=`No per-node settings on this node. Every other setting these addons expose is one value for the whole cluster — edit those in System → Settings, not here.`;function tn({nodeId:e,addonIds:t}){return t.length===0?l(`div`,{className:`py-4 text-xs text-muted-foreground text-center`,children:`No addons on this node`}):l(`div`,{className:`w-full py-2`,children:l(Se,{nodeId:e,addonIds:t,level:`global`,fieldScope:`perNode`,emptyMessage:en,selfTabbed:!0})})}n();function nn({nodeId:e,addons:t}){let n=s(),{data:r,isLoading:i}=f({nodeId:e}),o=a(()=>{let e=new Map;for(let n of t)for(let t of n.capabilities){let r=e.get(t)??[];r.push(n.id),e.set(t,r)}return[...e.entries()].toSorted(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({capName:e,providers:t}))},[t]),c=w({onSuccess:()=>{n.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getCapabilityBindings`]]})}});return o.length===0?l(`div`,{className:`py-4 text-xs text-muted-foreground text-center`,children:`No capabilities on this node`}):l(D,{columns:[{key:`capName`,header:`Capability`,width:`w-1/2`,sortValue:e=>e.capName,render:e=>l(`span`,{className:`font-medium`,children:e.capName})},{key:`provider`,header:`Bound provider`,render:t=>{let n=r?.[t.capName]??t.providers[0]??``,a=t.providers.length===1;return l(`select`,{value:n,onChange:n=>c.mutate({nodeId:e,capName:t.capName,addonId:n.target.value}),disabled:a||c.isPending||i,className:`w-full rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-60`,title:a?`Only one provider installed — choice becomes available once a second addon registers this capability`:void 0,children:t.providers.map(e=>l(`option`,{value:e,children:e},e))})}}],rows:o,rowKey:e=>e.capName,minWidthPx:520,mobileMode:`scroll`,maxBodyHeight:E})}n();function rn(e){if(e==null)return`—`;let t=Math.floor(e/1e3),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return n>0?`${n}d ${r}h ${i}m`:r>0?`${r}h ${i}m`:`${i}m`}function an(e){let[t,n]=c(!1),[i,a]=c(e.name),o=s(),u=T({onSuccess:()=>{o.invalidateQueries({queryKey:[[`nodes`,`topology`]]})}}),d=(e.localIps??[]).filter(e=>!e.includes(`:`)),f=(e.localIps??[]).filter(e=>e.includes(`:`)),p=async()=>{if(!i.trim()||i===e.name){n(!1);return}try{await u.mutateAsync({nodeId:e.nodeId,name:i.trim()}),n(!1)}catch(e){console.error(`Rename failed:`,e)}},m=[[`Node ID`,l(`span`,{className:`font-mono text-xs`,children:e.nodeId})],[`Display Name`,t?r(`div`,{className:`flex items-center gap-1.5`,children:[l(`input`,{type:`text`,className:`flex-1 px-2 py-0.5 text-xs border border-border rounded bg-background focus:outline-none focus:ring-1 focus:ring-primary`,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p(),e.key===`Escape`&&n(!1)},disabled:u.isPending,autoFocus:!0}),l(`button`,{onClick:()=>void p(),disabled:u.isPending,className:`p-0.5 text-success hover:bg-success/10 rounded`,title:`Save`,children:l(xe,{className:`h-3.5 w-3.5`})}),l(`button`,{onClick:()=>n(!1),className:`p-0.5 text-muted-foreground hover:bg-muted rounded`,title:`Cancel`,children:l(P,{className:`h-3.5 w-3.5`})})]}):r(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-xs`,children:e.name}),!e.isHub&&l(`button`,{onClick:()=>{a(e.name),n(!0)},className:`p-0.5 text-muted-foreground hover:text-primary rounded`,title:`Rename`,children:l(ue,{className:`h-3 w-3`})})]})],[`Hostname`,l(`span`,{className:`text-xs`,children:e.hostname})],[`Role`,e.isHub?l(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary font-medium`,children:`Hub`}):l(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground font-medium`,children:`Agent`})],[`Root Package`,e.rootPackage?r(`span`,{className:`font-mono text-xs`,children:[e.rootPackage.name,`@`,e.rootPackage.version]}):l(`span`,{className:`text-xs text-muted-foreground`,children:`—`})],[`Platform`,r(`span`,{className:`text-xs`,children:[e.platform,` / `,e.arch]})],[`CPU`,r(`span`,{className:`text-xs`,children:[e.cpuModel??`—`,` (`,e.cpuCores,` cores)`]})],[`Memory`,l(`span`,{className:`text-xs`,children:e.memoryMB>0?`${(e.memoryMB/1024).toFixed(1)} GB`:`—`})],[`Uptime`,l(`span`,{className:`text-xs`,children:rn(e.uptime)})],[`Engines`,e.engines.length>0?l(`div`,{className:`flex flex-wrap gap-1`,children:e.engines.map(e=>l(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-purple-500/10 text-purple-400 font-medium`,children:e},e))}):l(`span`,{className:`text-xs text-muted-foreground`,children:`—`})]];return d.length>0&&m.push([`IPv4`,l(`div`,{className:`flex flex-wrap gap-1.5`,children:d.map((e,t)=>l(`span`,{className:`font-mono text-xs px-1.5 py-0.5 rounded bg-muted`,children:e},`${e}-${t}`))})]),f.length>0&&m.push([`IPv6`,l(`div`,{className:`flex flex-wrap gap-1.5`,children:f.map((e,t)=>l(`span`,{className:`font-mono text-[10px] px-1.5 py-0.5 rounded bg-muted truncate max-w-[280px]`,title:e,children:e},`${e}-${t}`))})]),l(`div`,{className:`py-2`,children:l(`table`,{className:`w-full text-sm`,children:l(`tbody`,{children:m.map(([e,t],n)=>r(`tr`,{className:n%2==0?`bg-muted/20`:``,children:[l(`td`,{className:`py-1.5 px-2 text-xs font-medium text-muted-foreground w-28 align-top whitespace-nowrap`,children:e}),l(`td`,{className:`py-1.5 px-2`,children:t})]},e))})})})}n();var on=[[`serverManagement`,`getServerPackageStatus`]];function sn({label:e,tone:t}){return l(`span`,{className:`inline-flex items-center rounded px-2 py-0.5 text-[11px] font-medium ${{neutral:`bg-surface-muted text-foreground-subtle`,ok:`bg-emerald-500/15 text-emerald-500`,info:`bg-sky-500/15 text-sky-500`,warn:`bg-amber-500/15 text-amber-500`,error:`bg-red-500/15 text-red-500`}[t]}`,children:e})}function $({label:e,value:t}){return r(`div`,{className:`flex items-center justify-between gap-4 text-sm`,children:[l(`span`,{className:`text-foreground-subtle`,children:e}),l(`span`,{className:`font-mono text-foreground`,children:t??`—`})]})}function cn({node:t}){let{t:n}=F(),i=s(),a=O(),[o,u]=c(!1),d=t.isHub?void 0:{nodeId:t.id},f=x(d,{refetchInterval:1e4,enabled:t.isOnline,retry:1}),p=f.data??null,m=e(()=>{i.invalidateQueries({queryKey:on})},[i]),g=y({onSettled:m}),_=h({onSettled:m}),v=ce({onSettled:m}),b=e(async()=>{p?.latestVersion!=null&&await a({title:n(`serverManagement.confirmUpdateTitle`,`Update node root package`),message:n(`serverManagement.confirmUpdateBody`,`Install {{pkg}}@{{version}} on "{{node}}" and restart to apply.`,{pkg:p.packageName,version:p.latestVersion,node:t.name}),confirmLabel:n(`serverManagement.confirmUpdateAction`,`Update & restart`)})&&(await _.mutateAsync({version:p.latestVersion,...d})).restarting&&u(!0)},[_,a,t.name,d,p,n]),S=e(async()=>{await a({title:n(`serverManagement.confirmRestartTitle`,`Restart node`),message:n(`serverManagement.confirmRestartBody`,`Restart "{{node}}"? In-flight requests to this node are dropped.`,{node:t.name}),confirmLabel:n(`serverManagement.confirmRestartAction`,`Restart`),variant:`warning`})&&(await v.mutateAsync(d)).restarting&&u(!0)},[a,t.name,v,d,n]),C=()=>{switch(p?.bootMode){case`data-root`:return{label:n(`serverManagement.bootDataRoot`,`runtime-updatable`),tone:`ok`};case`workspace`:return{label:n(`serverManagement.bootWorkspace`,`dev workspace`),tone:`info`};default:return{label:n(`serverManagement.bootBaked`,`baked image seed`),tone:`neutral`}}},w=()=>{if(p==null)return null;switch(p.updateState){case`checking`:return{label:n(`serverManagement.stateChecking`,`checking…`),tone:`info`};case`staging`:return{label:n(`serverManagement.stateStaging`,`updating…`),tone:`info`};case`pending-restart`:return{label:n(`serverManagement.statePending`,`restart pending`),tone:`warn`};default:return p.updateAvailable?{label:n(`serverManagement.stateUpdateAvailable`,`update available`),tone:`warn`}:{label:n(`serverManagement.stateUpToDate`,`up to date`),tone:`ok`}}},T=p?.bootMode===`workspace`,ee=t.isOnline&&p!=null&&!T&&p.updateAvailable&&p.updateState===`idle`&&!_.isPending,te=t.isOnline&&p!=null&&p.updateState===`idle`&&!v.isPending,E=t.isOnline?w():null;return r(`div`,{className:`space-y-4 py-2`,children:[r(`div`,{className:`flex items-center justify-between gap-3`,children:[r(`div`,{className:`flex items-center gap-2 min-w-0`,children:[l(`span`,{className:`font-mono text-xs text-foreground-subtle truncate`,children:p?.packageName??t.rootPackage?.name??`@camstack/server`}),t.isOnline&&p!=null&&l(sn,{...C()})]}),E!=null&&l(sn,{...E})]}),!t.isOnline&&l($,{label:n(`serverManagement.lastReportedVersion`,`Last reported version`),value:t.rootPackage?.version??null}),t.isOnline&&f.isLoading&&r(`div`,{className:`flex items-center gap-2 text-sm text-foreground-subtle`,children:[l(A,{className:`h-4 w-4 animate-spin`}),n(`common.loading`,`Loading…`)]}),t.isOnline&&f.isError&&r(`div`,{className:`space-y-1.5`,children:[l(`p`,{className:`text-sm text-red-500`,children:n(`serverManagement.loadError`,`Could not load the node root-package status.`)}),t.rootPackage!=null&&l($,{label:n(`serverManagement.lastReportedVersion`,`Last reported version`),value:t.rootPackage.version})]}),t.isOnline&&p!=null&&r(`div`,{className:`space-y-1.5`,children:[l($,{label:n(`serverManagement.runningVersion`,`Running version`),value:p.runningVersion}),l($,{label:n(`serverManagement.latestVersion`,`Latest on registry`),value:p.latestVersion}),l($,{label:n(`serverManagement.imageSeedVersion`,`Image seed (baked)`),value:p.seedVersion}),l($,{label:n(`serverManagement.nodeRuntimeVersion`,`Node.js runtime`),value:p.nodeRuntimeVersion}),p.pendingVersion!=null&&l($,{label:n(`serverManagement.pendingVersion`,`Staged (applies on restart)`),value:p.pendingVersion})]}),t.isOnline&&p?.imageContract?.state===`behind-series`&&r(`div`,{className:`rounded-md border border-red-500/40 bg-red-500/10 px-3 py-2 text-xs leading-relaxed text-red-500`,children:[l(`p`,{className:`mb-0.5 font-semibold`,children:n(`serverManagement.imageContractDiverged`,`Container image diverges from the deployment contract`)}),l(`p`,{children:p.imageContract.message})]}),t.isOnline&&T&&l(`p`,{className:`text-xs text-foreground-subtle`,children:n(`serverManagement.workspaceNote`,`Development workspace detected — runtime updates are disabled (the dev loop resolves code from the workspace).`)}),o&&r(`div`,{className:`flex items-center gap-2 text-sm text-amber-500`,children:[l(A,{className:`h-4 w-4 animate-spin`}),n(`serverManagement.nodeRestarting`,`The node is restarting to apply the change…`)]}),t.isOnline&&r(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[r(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-surface-muted disabled:opacity-50`,disabled:g.isPending||p?.updateState===`staging`,onClick:()=>g.mutate(d),children:[g.isPending?l(A,{className:`h-3.5 w-3.5 animate-spin`}):l(fe,{className:`h-3.5 w-3.5`}),n(`serverManagement.checkForUpdate`,`Check for update`)]}),ee&&r(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded bg-primary px-2.5 py-1.5 text-xs font-medium text-primary-foreground hover:opacity-90 disabled:opacity-50`,onClick:()=>void b(),children:[_.isPending?l(A,{className:`h-3.5 w-3.5 animate-spin`}):l(L,{className:`h-3.5 w-3.5`}),n(`serverManagement.updateTo`,`Update to {{version}}`,{version:p?.latestVersion??``})]}),r(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-surface-muted disabled:opacity-50`,disabled:!te,onClick:()=>void S(),children:[v.isPending?l(A,{className:`h-3.5 w-3.5 animate-spin`}):l(k,{className:`h-3.5 w-3.5`}),n(`serverManagement.restart`,`Restart`)]})]}),t.isOnline&&p?.lastCheckedAtMs!=null&&r(`p`,{className:`flex items-center gap-1.5 text-[11px] text-foreground-subtle`,children:[l(Ce,{className:`h-3 w-3`}),n(`serverManagement.lastChecked`,`Last checked: {{when}}`,{when:new Date(p.lastCheckedAtMs).toLocaleString()})]})]})}n();function ln({node:e}){let t=d(),[n,i]=c(`info`),[a,o]=c(!1),s=e.processes??[],u=e.addons.map(e=>e.id),f=async()=>{if(!a){o(!0);try{await Promise.allSettled([t.trpcClient.pipelineOrchestrator.removeAgentSettings.mutate({agentNodeId:e.id}),t.trpcClient.clusterNodes.forgetNode.mutate({nodeId:e.id})])}finally{o(!1)}}};return e.isOnline?r(`div`,{className:`border border-border rounded-xl`,children:[r(`div`,{className:`flex items-center gap-3 px-4 py-3 bg-muted/30 border-b border-border rounded-t-xl`,children:[l(`div`,{className:`w-2.5 h-2.5 rounded-full bg-success`}),l(`span`,{className:`text-sm font-semibold`,children:e.name}),r(`span`,{className:`text-xs text-muted-foreground`,children:[e.cpuModel??e.platform,` ·`,` `,e.memoryMB>0?`${Math.round(e.memoryMB/1024)}GB`:``,` · `,e.arch]}),e.engines.map(e=>l(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-purple-500/10 text-purple-400 font-medium`,children:e},e)),r(`div`,{className:`ml-auto flex gap-3 text-xs text-muted-foreground`,children:[r(`span`,{className:`flex items-center gap-1`,children:[l(M,{className:`h-3 w-3`}),` `,e.cpuPercent,`%`]}),r(`span`,{className:`flex items-center gap-1`,children:[l(R,{className:`h-3 w-3`}),` `,e.memoryPercent,`%`]})]})]}),l(`div`,{className:`sticky top-0 z-20 flex border-b border-border px-4 bg-background overflow-x-auto`,children:[`info`,`forks`,`processes`,`load`,`settings`,`capabilities`].map(e=>l(`button`,{onClick:()=>i(e),className:`shrink-0 whitespace-nowrap px-3 py-2 text-xs font-medium border-b-2 transition-colors ${n===e?`border-primary text-primary`:`border-transparent text-muted-foreground hover:text-foreground`}`,children:e===`info`?`General`:e===`forks`?`Forks (${s.length})`:e===`processes`?`Processes`:e===`load`?`Load`:e===`settings`?`Settings`:`Capabilities`},e))}),r(`div`,{className:`px-4 py-2`,children:[n===`info`&&r(`div`,{className:`space-y-3`,children:[l(an,{nodeId:e.id,name:e.name,hostname:e.hostname,platform:e.platform,arch:e.arch,cpuModel:e.cpuModel,cpuCores:e.cpuCores,memoryMB:e.memoryMB,engines:e.engines,isHub:e.isHub,uptime:e.uptime,localIps:e.localIps,rootPackage:e.rootPackage}),l(`div`,{className:`border-t border-border pt-1`,children:l(cn,{node:{id:e.id,name:e.name,isHub:e.isHub,isOnline:e.isOnline,rootPackage:e.rootPackage??null}})})]}),n===`forks`&&l(Oe,{nodeId:e.id,processes:s}),n===`processes`&&l(Me,{nodeId:e.id}),n===`load`&&l(Zt,{nodeId:e.id,isHub:e.isHub}),n===`settings`&&l(tn,{nodeId:e.id,addonIds:u}),n===`capabilities`&&l(nn,{nodeId:e.id,addons:e.addons})]})]}):r(`div`,{className:`border border-border rounded-xl overflow-hidden opacity-60`,children:[r(`div`,{className:`flex items-center gap-3 px-4 py-3 bg-muted/30`,children:[l(`div`,{className:`w-2.5 h-2.5 rounded-full bg-destructive`}),l(`span`,{className:`text-sm font-semibold`,children:e.name}),r(`span`,{className:`text-xs text-muted-foreground`,children:[e.cpuModel??e.platform,` ·`,` `,e.memoryMB>0?`${Math.round(e.memoryMB/1024)}GB`:``,` · `,e.arch]}),e.engines.map(e=>l(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-purple-500/10 text-purple-400 font-medium`,children:e},e)),e.rootPackage&&r(`span`,{className:`text-[10px] font-mono px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:[e.rootPackage.name,`@`,e.rootPackage.version]}),l(`span`,{className:`ml-auto text-xs px-2 py-0.5 rounded-full bg-destructive/10 text-destructive`,children:`offline`})]}),r(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[r(`span`,{className:`text-xs text-muted-foreground`,children:[e.lastSeen?`Last seen ${new Date(e.lastSeen).toLocaleString()} — `:``,e.addons.length,` addon`,e.addons.length===1?``:`s`,` assigned; will resume when node reconnects`]}),r(`button`,{type:`button`,onClick:()=>void f(),disabled:a,title:`Forget this node — removes its saved history and pipeline assignments`,className:`flex items-center gap-1 text-xs px-2 py-1 rounded-md border border-border text-muted-foreground hover:text-destructive hover:border-destructive/50 disabled:opacity-50 transition-colors`,children:[l(ye,{className:`h-3 w-3`}),a?`Forgetting…`:`Forget node`]})]})]})}function un(e){return[...e].toSorted((e,t)=>e.isHub===t.isHub?e.isOnline===t.isOnline?e.name.localeCompare(t.name):e.isOnline?-1:1:e.isHub?-1:1)}function dn(e,t){let n=un(e);return(t===null?void 0:n.find(e=>e.id===t))??n[0]??null}function fn({nodes:e,selected:t,onSelect:n}){let{t:i}=F(),a=un(e);return t===null?l(`div`,{className:`rounded-md border border-dashed border-border px-3 py-6 text-center text-xs text-foreground-subtle`,children:i(`cluster.noNodes`,`No nodes in this cluster yet.`)}):r(`div`,{className:`flex flex-col gap-3`,children:[a.length>1&&l(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`tablist`,"aria-label":i(`cluster.nodeSelectorLabel`,`Nodes`),children:a.map(e=>l(pn,{node:e,active:e.id===t.id,onSelect:()=>n(e.id)},e.id))}),l(ln,{node:t})]})}function pn({node:e,active:t,onSelect:n}){let{t:i}=F();return r(`button`,{type:`button`,role:`tab`,"aria-selected":t,onClick:n,className:`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs transition-colors ${t?`border-primary bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`}`,children:[l(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${e.isOnline?`bg-success`:`bg-destructive`}`}),l(`span`,{className:`font-medium`,children:e.name}),e.isOnline?r(`span`,{className:`inline-flex items-center gap-1 text-[10px] tabular-nums text-muted-foreground`,children:[l(M,{className:`h-3 w-3`}),e.cpuPercent,`%`,l(R,{className:`h-3 w-3`}),e.memoryPercent,`%`]}):l(`span`,{className:`text-[10px] text-destructive`,children:i(`cluster.offline`,`offline`)})]})}n();var mn=`node`;function hn(){let{data:e,isLoading:t}=ee(void 0,{staleTime:1/0}),[n,r]=c(null);return S(`cluster.topology-snapshot`,e=>{let t=e.data?.nodes;Array.isArray(t)&&r(t)}),{nodes:a(()=>n??e??[],[n,e]),isLoading:t&&!n}}function gn(){let{t}=F(),n=O(),{nodes:i,isLoading:o}=hn(),[s,u]=_e(),d=a(()=>dn(i,s.get(mn)),[i,s]),f=e(e=>{let t=new URLSearchParams(s);t.set(mn,e),u(t,{replace:!0})},[s,u]),p=a(()=>i.filter(e=>e.isOnline),[i]),m=p.length,g=i.filter(e=>!e.isOnline).length,_=h(),[v,y]=c(!1),b=e(async()=>{let e=[...p].sort((e,t)=>e.isHub===t.isHub?0:e.isHub?1:-1);if(await n({title:t(`serverManagement.confirmUpdateAllTitle`,`Update all nodes`),message:t(`serverManagement.confirmUpdateAllBody`,`Update and restart every online node, agents first, hub last. Up-to-date nodes are skipped; this page reconnects when the hub comes back.`),confirmLabel:t(`serverManagement.confirmUpdateAllAction`,`Update all & restart`),variant:`warning`})){y(!0);try{for(let t of e)try{await _.mutateAsync(t.isHub?{}:{nodeId:t.id})}catch{}}finally{y(!1)}}},[_,n,p,t]);return r(`div`,{className:`flex flex-col h-full gap-4 p-4`,children:[r(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[r(`div`,{className:`flex items-center gap-2`,children:[m>0&&r(`span`,{className:`text-xs px-2 py-0.5 rounded-full bg-success/10 text-success`,children:[m,` online`]}),g>0&&r(`span`,{className:`text-xs px-2 py-0.5 rounded-full bg-destructive/10 text-destructive`,children:[g,` offline`]})]}),l(`div`,{className:`flex items-center gap-2`,children:m>1&&r(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:opacity-90 disabled:opacity-50`,disabled:v,title:t(`serverManagement.updateAllHint`,`Sequenced agents-first, hub-last — up-to-date nodes are skipped.`),onClick:()=>void b(),children:[v?l(A,{className:`h-3.5 w-3.5 animate-spin`}):l(L,{className:`h-3.5 w-3.5`}),t(`serverManagement.updateAll`,`Update all nodes`)]})})]}),o?l(`div`,{className:`flex items-center justify-center flex-1 text-muted-foreground`,children:`Loading cluster topology...`}):l(`div`,{className:`flex-1 overflow-auto`,children:l(fn,{nodes:i,selected:d,onSelect:f})})]})}export{gn as ClusterPage};
|