@camstack/addon-admin-ui 1.2.120 → 1.2.121
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-4tqarwDa.js → AddLocationWizard--mkj3ETu.js} +1 -1
- package/dist/assets/{AddonCollectionPage-DP3xO6SM.js → AddonCollectionPage-CqgSQxQ5.js} +1 -1
- package/dist/assets/Addons-Bf2kB7FO.js +1 -0
- package/dist/assets/{AdminTabs-CWEa6lxu.js → AdminTabs-Bnpekf9L.js} +1 -1
- package/dist/assets/{AiProfiles-DRsR3twK.js → AiProfiles-Dx9QzfkB.js} +1 -1
- package/dist/assets/{BrokerForm-DZvpOz2t.js → BrokerForm-Cp-QCiwW.js} +1 -1
- package/dist/assets/{Build-BOm-p24w.js → Build-DK4nAd1G.js} +3 -3
- package/dist/assets/{Capabilities-Bf45hSb9.js → Capabilities-DjmiW556.js} +1 -1
- package/dist/assets/{CapabilityBadges-DFomLheZ.js → CapabilityBadges-CjczBoDi.js} +1 -1
- package/dist/assets/Cluster-CWDTyv3x.js +11 -0
- package/dist/assets/{Data-Dga_gZJa.js → Data-CC__xt_7.js} +1 -1
- package/dist/assets/{DetectionIntelligence-BewRfI5g.js → DetectionIntelligence-DOLcWM0z.js} +1 -1
- package/dist/assets/{DeviceAggregateSection-B8d1ttwK.js → DeviceAggregateSection-CtNus-Z9.js} +1 -1
- package/dist/assets/DeviceDetail-BBK_biJu.js +2 -0
- package/dist/assets/{Devices-C_J1PG_S.js → Devices-C9AhNeGU.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-CEh82zWX.js → EmbedPlayerPage-gbryRNIt.js} +1 -1
- package/dist/assets/Events-zTFK1o8o.js +1 -0
- package/dist/assets/{FormBuilder-CCyg_30_.js → FormBuilder-C_1-Y69Y.js} +1 -1
- package/dist/assets/Identity-CVqxKTJo.js +1 -0
- package/dist/assets/{IntegrationDetail-Ckm2INyi.js → IntegrationDetail-CnTI0i1_.js} +1 -1
- package/dist/assets/{Integrations-Bi5H7cYT.js → Integrations-1V80f5GH.js} +1 -1
- package/dist/assets/{Integrations-BgYbl7ny.js → Integrations-CWQzB2G-.js} +1 -1
- package/dist/assets/{Logs-BxrfPbr6.js → Logs-DAI2eKrC.js} +1 -1
- package/dist/assets/{MotionZonesSettings-CdemhWhc.js → MotionZonesSettings-Cx8Fgga9.js} +1 -1
- package/dist/assets/{MyAccess-rfHA9QRX.js → MyAccess-lmd0GUa4.js} +1 -1
- package/dist/assets/Network-DL7vgvPz.js +1 -0
- package/dist/assets/{NodeAddonsSettingsPanel-BbdhEikK.js → NodeAddonsSettingsPanel-CF38Xfjd.js} +1 -1
- package/dist/assets/{NodeInferenceDevices-BA4AvFSy.js → NodeInferenceDevices-DEeOhTqE.js} +1 -1
- package/dist/assets/{Notifications-Bu5PLj4y.js → Notifications-DyHxI0OV.js} +1 -1
- package/dist/assets/Pipeline-D2AK3bq-.js +1 -0
- package/dist/assets/Plates-FJGFRHwS.js +1 -0
- package/dist/assets/{PrivacyMaskSettings-DKaOBD7I.js → PrivacyMaskSettings--DN9Cj1J.js} +1 -1
- package/dist/assets/{ProviderIcon-C1SY--6Z.js → ProviderIcon-B7xnPSGY.js} +1 -1
- package/dist/assets/Recordings-DuMD9mO7.js +1 -0
- package/dist/assets/{ScanNetworkModal-CkKXaASr.js → ScanNetworkModal-BkuLL5Hb.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-D6QFhj6_.js → SceneMonitorEditor-CKZcEP_n.js} +1 -1
- package/dist/assets/{Scenes-nzqmq3E_.js → Scenes-UJ6HwN5-.js} +1 -1
- package/dist/assets/{Settings-DmR-y-lo.js → Settings-Bsfr9POB.js} +1 -1
- package/dist/assets/{Showroom-GJaAdxge.js → Showroom-D134TM7C.js} +1 -1
- package/dist/assets/{Terminal-SMJsDxD3.js → Terminal-DaXvlDS6.js} +5 -5
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-B1yKKlRb.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-7GR589xa.js} +1 -1
- package/dist/assets/{bell-ring-B8CPJsI_.js → bell-ring-6mWtb-XF.js} +1 -1
- package/dist/assets/{boxes-BO9PDasW.js → boxes-C5NTL0ET.js} +1 -1
- package/dist/assets/circle-check-big-DADKFm5x.js +1 -0
- package/dist/assets/{circle-x-BEeBoyIR.js → circle-x-CFWnmyvU.js} +1 -1
- package/dist/assets/clock-Cl7hHyqW.js +1 -0
- package/dist/assets/{copy-DgkH27Wp.js → copy-tqbIiAtY.js} +1 -1
- package/dist/assets/{debounced-invalidate-BPgv7urB.js → debounced-invalidate-BvbZ9j3z.js} +1 -1
- package/dist/assets/{dist-CyUtTvQp.js → dist-D-XW9v3T.js} +1 -1
- package/dist/assets/dist-DYkLn2xO.js +349 -0
- package/dist/assets/{download-ChPOQTM7.js → download-CBTHh5Td.js} +1 -1
- package/dist/assets/{face-bbox-DYhU07MB.js → face-bbox-DK3crsBr.js} +1 -1
- package/dist/assets/{hostInit-4nJRa4cE.js → hostInit-uOc4KuW6.js} +1 -1
- package/dist/assets/{index-fcpGbsCa.js → index-D-9Wyuju.js} +3 -3
- package/dist/assets/{key-round-B0Xn9Yjt.js → key-round-Cp0w9XS6.js} +1 -1
- package/dist/assets/{layers-tAo2_7kJ.js → layers-R56RBx5J.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-f8228165.js → mf-entry-bootstrap-0-3f5d688b.js} +2 -2
- package/dist/assets/{pencil-uWNwJNLv.js → pencil-Dppq_R1x.js} +1 -1
- package/dist/assets/play-CRkSis2D.js +1 -0
- package/dist/assets/{player-overlays-CXg0hhE6.js → player-overlays-MJd9eRlM.js} +1 -1
- package/dist/assets/plus-BgigjkU9.js +1 -0
- package/dist/assets/power-BCS2t-Wx.js +1 -0
- package/dist/assets/{radio-B2Ey6CU_.js → radio-Den8nSQU.js} +1 -1
- package/dist/assets/{refresh-cw-Bc7sN4NG.js → refresh-cw-Budztdr-.js} +1 -1
- package/dist/assets/remoteEntry-DdFdvgxU.js +1 -0
- package/dist/assets/rotate-ccw-C_FPsgtu.js +1 -0
- package/dist/assets/rotate-cw-Ci2EV6Gc.js +1 -0
- package/dist/assets/{send-k49_GbSQ.js → send-BZ9zOH2R.js} +1 -1
- package/dist/assets/{server-hj9nrAEV.js → server-DhDeuLAj.js} +1 -1
- package/dist/assets/{shield-BDHcGLyd.js → shield-CDajPz7k.js} +1 -1
- package/dist/assets/square-BVwnxCbL.js +1 -0
- package/dist/assets/{square-check-big-BDI8demC.js → square-check-big-B9gVi10Z.js} +1 -1
- package/dist/assets/src-0iNMzZ2l.js +349 -0
- package/dist/assets/src-DwTflGqD.js +67 -0
- package/dist/assets/{star-2GlelgRj.js → star-B4ylQ-n9.js} +1 -1
- package/dist/assets/{undo-2-CIYAu2-S.js → undo-2-3EmEvFIS.js} +1 -1
- package/dist/assets/use-scenes-feed-julJoDvZ.js +1 -0
- package/dist/assets/useEventInvalidation-DSpypyuO.js +1 -0
- package/dist/assets/{useNodeUrlSelection-Qqj3vhRX.js → useNodeUrlSelection-Dsk2NydD.js} +1 -1
- package/dist/assets/{video--oQgXab3.js → video-BlZPfhfO.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-T5nrky73.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CokdarDJ.js} +2 -2
- package/dist/assets/{wifi--ujzZRuQ.js → wifi-obpV41fJ.js} +1 -1
- package/dist/assets/{zap-I5L6iIx1.js → zap-B8NXR1Yj.js} +1 -1
- package/dist/index.html +5 -5
- package/dist/server/addon.js +219 -5
- package/package.json +1 -1
- package/dist/assets/Addons-Dn3BsUiH.js +0 -1
- package/dist/assets/Cluster-3tVwxwtg.js +0 -11
- package/dist/assets/DeviceDetail-CVtzUGLM.js +0 -2
- package/dist/assets/Events-JRIOdVcm.js +0 -1
- package/dist/assets/Identity-BZcLgE2n.js +0 -1
- package/dist/assets/Network-BgC3msZy.js +0 -1
- package/dist/assets/Pipeline-D722tZEW.js +0 -1
- package/dist/assets/Plates-ByHorRzI.js +0 -1
- package/dist/assets/Recordings-CA2d3Y9X.js +0 -1
- package/dist/assets/circle-check-big-Dp32y98z.js +0 -1
- package/dist/assets/clock-VR-g6-6X.js +0 -1
- package/dist/assets/dist-Okm6znYF.js +0 -349
- package/dist/assets/play-GnEjunvs.js +0 -1
- package/dist/assets/plus-BSMCkEaa.js +0 -1
- package/dist/assets/power-DqOV8y7N.js +0 -1
- package/dist/assets/remoteEntry-BHE-czLb.js +0 -1
- package/dist/assets/rotate-ccw-su9Ag1p3.js +0 -1
- package/dist/assets/rotate-cw-BzcYJDMV.js +0 -1
- package/dist/assets/square-htLjVnEj.js +0 -1
- package/dist/assets/src-2_PdZDlW.js +0 -67
- package/dist/assets/src-7nQ9U_oz.js +0 -349
- package/dist/assets/use-scenes-feed-BZvnS8B9.js +0 -1
- package/dist/assets/useEventInvalidation-2YNos8NI.js +0 -1
package/dist/server/addon.js
CHANGED
|
@@ -8021,6 +8021,20 @@ var RelocateJobSchema = object({
|
|
|
8021
8021
|
* in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
|
|
8022
8022
|
*/
|
|
8023
8023
|
rowsReconciled: number().int().nonnegative().optional(),
|
|
8024
|
+
/**
|
|
8025
|
+
* Rows this run FORGOT because the file they name is not on disk.
|
|
8026
|
+
*
|
|
8027
|
+
* The mover derived the path from the row's own fields and `stat`ed it; an
|
|
8028
|
+
* ENOENT there is a per-path confirmation that the segment is gone (D296),
|
|
8029
|
+
* and the durable row is dropped through the same channel eviction uses. It
|
|
8030
|
+
* is reported for the same reason `rowsReconciled` is: this is a durable
|
|
8031
|
+
* mutation nobody asked for, and a migration that quietly erases hour rows is
|
|
8032
|
+
* the same failure as one that quietly skips them (D295).
|
|
8033
|
+
*
|
|
8034
|
+
* The production drain of 2026-08-30 would have reported 11 074 here — the
|
|
8035
|
+
* ledger claimed 5.65 GB of footage that no longer existed.
|
|
8036
|
+
*/
|
|
8037
|
+
rowsForgotten: number().int().nonnegative().optional(),
|
|
8024
8038
|
startedAt: number(),
|
|
8025
8039
|
finishedAt: number().nullable(),
|
|
8026
8040
|
error: string().nullable()
|
|
@@ -8384,6 +8398,91 @@ var RelocateResidueSchema = object({
|
|
|
8384
8398
|
segments: number().int().nonnegative(),
|
|
8385
8399
|
bytes: number().int().nonnegative()
|
|
8386
8400
|
}).nullable();
|
|
8401
|
+
/**
|
|
8402
|
+
* Ask one location whether its durable hour rows describe the disk — the walk
|
|
8403
|
+
* (D319).
|
|
8404
|
+
*
|
|
8405
|
+
* `apply` DEFAULTS TO FALSE and that default is the product: the operator's
|
|
8406
|
+
* missing tool is the question, and the dry run is how they sanity-check the
|
|
8407
|
+
* destructive run before authorising it.
|
|
8408
|
+
*/
|
|
8409
|
+
var LedgerWalkInputSchema = object({
|
|
8410
|
+
locationId: string().min(1),
|
|
8411
|
+
/** Forget the confirmed-absent rows, rather than only counting them. */
|
|
8412
|
+
apply: boolean().optional(),
|
|
8413
|
+
/** Narrow to one camera. */
|
|
8414
|
+
deviceId: number().int().positive().optional(),
|
|
8415
|
+
/** Narrow to these recording profiles; empty/absent = every profile. */
|
|
8416
|
+
profiles: array(string().min(1)).optional()
|
|
8417
|
+
});
|
|
8418
|
+
/** Why a whole walk did nothing. Every one leaves the ledger untouched. */
|
|
8419
|
+
var LedgerWalkRefusalSchema = _enum([
|
|
8420
|
+
"location-unknown",
|
|
8421
|
+
"source-writable",
|
|
8422
|
+
"no-ledger",
|
|
8423
|
+
"archive-unreadable",
|
|
8424
|
+
"anchor-absent",
|
|
8425
|
+
"anchor-unreadable",
|
|
8426
|
+
"anchor-moved"
|
|
8427
|
+
]);
|
|
8428
|
+
_enum([
|
|
8429
|
+
"live-tail",
|
|
8430
|
+
"listing-error",
|
|
8431
|
+
"path-mismatch",
|
|
8432
|
+
"durable-refused"
|
|
8433
|
+
]);
|
|
8434
|
+
/** Every skip reason, always present, always a number — so a reason that never
|
|
8435
|
+
* fired reports as zero rather than absent and the report shape is constant
|
|
8436
|
+
* between passes. Spelled out rather than `z.record` for exactly that. */
|
|
8437
|
+
var LedgerWalkSkipCountsSchema = object({
|
|
8438
|
+
"live-tail": number().int().nonnegative(),
|
|
8439
|
+
"listing-error": number().int().nonnegative(),
|
|
8440
|
+
"path-mismatch": number().int().nonnegative(),
|
|
8441
|
+
"durable-refused": number().int().nonnegative()
|
|
8442
|
+
});
|
|
8443
|
+
/** One camera's share of a walk, so a report names cameras and not rows. */
|
|
8444
|
+
var LedgerWalkDeviceReportSchema = object({
|
|
8445
|
+
deviceId: number().int(),
|
|
8446
|
+
hoursWalked: number().int().nonnegative(),
|
|
8447
|
+
hoursMissing: number().int().nonnegative(),
|
|
8448
|
+
ghostSegments: number().int().nonnegative(),
|
|
8449
|
+
ghostBytes: number().int().nonnegative(),
|
|
8450
|
+
forgottenSegments: number().int().nonnegative(),
|
|
8451
|
+
orphanFiles: number().int().nonnegative()
|
|
8452
|
+
});
|
|
8453
|
+
/**
|
|
8454
|
+
* What one walk claimed, listed, found and (only when armed) forgot.
|
|
8455
|
+
*
|
|
8456
|
+
* `archiveSegments` is the **M** and `segmentsClaimed` the **N** (D295), so a
|
|
8457
|
+
* walk that saw a fraction of the location is visible in its own report rather
|
|
8458
|
+
* than in the absence of one.
|
|
8459
|
+
*/
|
|
8460
|
+
var LedgerWalkReportSchema = object({
|
|
8461
|
+
locationId: string(),
|
|
8462
|
+
applied: boolean(),
|
|
8463
|
+
refused: LedgerWalkRefusalSchema.nullable(),
|
|
8464
|
+
archiveSegments: number().int().nonnegative().nullable(),
|
|
8465
|
+
archiveBytes: number().int().nonnegative().nullable(),
|
|
8466
|
+
hoursClaimed: number().int().nonnegative(),
|
|
8467
|
+
hoursWalked: number().int().nonnegative(),
|
|
8468
|
+
hoursMissing: number().int().nonnegative(),
|
|
8469
|
+
/** `readdir` calls issued — the cost, stated in the unit that is paid. */
|
|
8470
|
+
listings: number().int().nonnegative(),
|
|
8471
|
+
segmentsClaimed: number().int().nonnegative(),
|
|
8472
|
+
ghostSegments: number().int().nonnegative(),
|
|
8473
|
+
ghostBytes: number().int().nonnegative(),
|
|
8474
|
+
ghostHoursWhole: number().int().nonnegative(),
|
|
8475
|
+
forgottenSegments: number().int().nonnegative(),
|
|
8476
|
+
forgottenBytes: number().int().nonnegative(),
|
|
8477
|
+
/** Files under a claimed hour that no durable row names. Never deleted. */
|
|
8478
|
+
orphanFiles: number().int().nonnegative(),
|
|
8479
|
+
orphanSample: array(string()).readonly(),
|
|
8480
|
+
hoursSkipped: number().int().nonnegative(),
|
|
8481
|
+
skippedByReason: LedgerWalkSkipCountsSchema,
|
|
8482
|
+
/** The walk stopped at its per-pass hour bound with claims unwalked. */
|
|
8483
|
+
bounded: boolean(),
|
|
8484
|
+
byDevice: array(LedgerWalkDeviceReportSchema).readonly()
|
|
8485
|
+
});
|
|
8387
8486
|
/** How many rows a media pass would still act on against a given target — the
|
|
8388
8487
|
* media lane's denominator AND its residue, from ONE derivation so the two can
|
|
8389
8488
|
* never disagree. `null` = the count could not be taken. */
|
|
@@ -18657,13 +18756,15 @@ var ListGroupsPageSchema = object({
|
|
|
18657
18756
|
groups: array(AnalyticsGroupRecordSchema).readonly(),
|
|
18658
18757
|
nextCursor: string().nullable()
|
|
18659
18758
|
});
|
|
18759
|
+
var KEY_EVENTS_DEFAULT_LIMIT = 50;
|
|
18760
|
+
var KEY_EVENTS_MAX_LIMIT = 200;
|
|
18660
18761
|
var KeyEventQueryInput = object({
|
|
18661
18762
|
deviceId: number(),
|
|
18662
18763
|
/** Window lower bound (track firstSeen ≥ since). */
|
|
18663
18764
|
since: number(),
|
|
18664
18765
|
/** Window upper bound (track firstSeen ≤ until). */
|
|
18665
18766
|
until: number(),
|
|
18666
|
-
limit: number().int().min(1).max(
|
|
18767
|
+
limit: number().int().min(1).max(KEY_EVENTS_MAX_LIMIT).default(KEY_EVENTS_DEFAULT_LIMIT),
|
|
18667
18768
|
/** Drop tracks scoring below this importance. */
|
|
18668
18769
|
minImportance: number().min(0).max(1).optional(),
|
|
18669
18770
|
/** Restrict to a single class (e.g. 'person'). */
|
|
@@ -18685,6 +18786,32 @@ var KeyEventSchema = object({
|
|
|
18685
18786
|
...TrackFlagFields,
|
|
18686
18787
|
...TrackRetrainFields
|
|
18687
18788
|
});
|
|
18789
|
+
/** `getKeyEvents`' window and filters, asked of a SET of cameras at once. */
|
|
18790
|
+
var KeyEventBatchQueryInput = object({
|
|
18791
|
+
deviceIds: array(number()).min(1).max(200),
|
|
18792
|
+
since: number(),
|
|
18793
|
+
until: number(),
|
|
18794
|
+
/** Applied PER CAMERA, exactly as `getKeyEvents.limit` is — never a total
|
|
18795
|
+
* across the set, which would let a busy camera starve a quiet one of its
|
|
18796
|
+
* rows and change what the merged feed contains. */
|
|
18797
|
+
limit: number().int().min(1).max(KEY_EVENTS_MAX_LIMIT).default(KEY_EVENTS_DEFAULT_LIMIT),
|
|
18798
|
+
minImportance: number().min(0).max(1).optional(),
|
|
18799
|
+
classFilter: string().optional()
|
|
18800
|
+
});
|
|
18801
|
+
/**
|
|
18802
|
+
* One camera's key events in a batch answer.
|
|
18803
|
+
*
|
|
18804
|
+
* The row exists for every requested id. `getKeyEvents` degrades to `[]` on
|
|
18805
|
+
* error rather than throwing, so a camera whose store read failed and one with
|
|
18806
|
+
* no events in the window were ALREADY indistinguishable per camera — the
|
|
18807
|
+
* batch does not make that worse, and the row keeps the deviceId the single
|
|
18808
|
+
* method's output never carried (the caller used to stamp it from the fan-out
|
|
18809
|
+
* key, which only worked because there was one query per camera).
|
|
18810
|
+
*/
|
|
18811
|
+
var KeyEventsForDeviceSchema = object({
|
|
18812
|
+
deviceId: number(),
|
|
18813
|
+
events: array(KeyEventSchema).readonly()
|
|
18814
|
+
});
|
|
18688
18815
|
object({
|
|
18689
18816
|
trackId: string(),
|
|
18690
18817
|
className: string(),
|
|
@@ -18954,7 +19081,7 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
|
|
|
18954
19081
|
until: number().optional(),
|
|
18955
19082
|
kinds: array(string()).optional(),
|
|
18956
19083
|
limit: number().int().min(1).max(MAX_EVENT_QUERY_LIMIT).default(DEFAULT_EVENT_QUERY_LIMIT)
|
|
18957
|
-
}), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(object({
|
|
19084
|
+
}), array(SensorEventSchema).readonly()), method(KeyEventQueryInput, array(KeyEventSchema).readonly()), method(KeyEventBatchQueryInput, array(KeyEventsForDeviceSchema).readonly()), method(object({
|
|
18958
19085
|
deviceId: number(),
|
|
18959
19086
|
since: number(),
|
|
18960
19087
|
until: number(),
|
|
@@ -26606,6 +26733,9 @@ method(object({
|
|
|
26606
26733
|
}), method(RelocateResidueInputSchema, RelocateResidueSchema, {
|
|
26607
26734
|
kind: "query",
|
|
26608
26735
|
auth: "admin"
|
|
26736
|
+
}), method(LedgerWalkInputSchema, LedgerWalkReportSchema, {
|
|
26737
|
+
kind: "mutation",
|
|
26738
|
+
auth: "admin"
|
|
26609
26739
|
}), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
26610
26740
|
kind: "mutation",
|
|
26611
26741
|
auth: "admin"
|
|
@@ -26997,7 +27127,26 @@ var SceneMonitorStatusSchema = object({
|
|
|
26997
27127
|
monitors: array(SceneMonitorSchema),
|
|
26998
27128
|
lastFetchedAt: number()
|
|
26999
27129
|
});
|
|
27000
|
-
|
|
27130
|
+
/**
|
|
27131
|
+
* One camera's row in a `listScenesBatch` answer.
|
|
27132
|
+
*
|
|
27133
|
+
* `status` is NULLABLE and the nullability is the whole point. `scene-monitor`
|
|
27134
|
+
* is a `defaultActive` wrapper, so every camera is asked; a camera whose
|
|
27135
|
+
* provider is absent (pipeline-analytics not deployed, the post-processing node
|
|
27136
|
+
* down) cannot answer, and that is not the same fact as a camera with no scenes
|
|
27137
|
+
* configured. Fanned out per camera the difference was visible — one query
|
|
27138
|
+
* errored while the others resolved — and a batch that returned only the rows
|
|
27139
|
+
* it managed would have destroyed it, silently, by making an unreachable camera
|
|
27140
|
+
* indistinguishable from one that answered `monitors: []`.
|
|
27141
|
+
*
|
|
27142
|
+
* So: EVERY requested deviceId gets a row. `status: null` means "this camera
|
|
27143
|
+
* could not be read"; `status.monitors: []` means "read, and it has none".
|
|
27144
|
+
*/
|
|
27145
|
+
var SceneMonitorStatusForDeviceSchema = object({
|
|
27146
|
+
deviceId: number(),
|
|
27147
|
+
status: SceneMonitorStatusSchema.nullable()
|
|
27148
|
+
});
|
|
27149
|
+
DeviceType.Camera, method(object({ deviceId: number() }), SceneMonitorStatusSchema), method(object({ deviceIds: array(number()).min(1).max(200) }), array(SceneMonitorStatusForDeviceSchema).readonly()), method(object({
|
|
27001
27150
|
deviceId: number(),
|
|
27002
27151
|
label: string(),
|
|
27003
27152
|
roi: MaskRectShapeSchema,
|
|
@@ -28321,6 +28470,27 @@ var CameraOccupancySnapshotSchema = object({
|
|
|
28321
28470
|
stationaryObjects: array(StationaryObjectSchema).readonly().optional()
|
|
28322
28471
|
});
|
|
28323
28472
|
/**
|
|
28473
|
+
* One camera's row in a `getCurrentSnapshotBatch` answer.
|
|
28474
|
+
*
|
|
28475
|
+
* THREE outcomes, and the single-camera method could only express two of them
|
|
28476
|
+
* because `snapshot: null` was already spoken for:
|
|
28477
|
+
*
|
|
28478
|
+
* - `read: 'read'`, `snapshot` present — the live occupancy reading.
|
|
28479
|
+
* - `read: 'read'`, `snapshot: null` — read, and this camera has no reading
|
|
28480
|
+
* yet: no frame since boot, and no parked-object registry to hydrate from.
|
|
28481
|
+
* - `read: 'unreadable'` — the owner could not answer for this
|
|
28482
|
+
* camera. `snapshot` is null, and it does NOT mean "nothing parked here".
|
|
28483
|
+
*
|
|
28484
|
+
* Collapsing the last two is the failure this field exists to prevent: a
|
|
28485
|
+
* hydration that threw would otherwise render as an empty Stationary section,
|
|
28486
|
+
* which is a definite claim about a camera nobody could read.
|
|
28487
|
+
*/
|
|
28488
|
+
var CameraOccupancySnapshotForDeviceSchema = object({
|
|
28489
|
+
deviceId: number(),
|
|
28490
|
+
read: _enum(["read", "unreadable"]),
|
|
28491
|
+
snapshot: CameraOccupancySnapshotSchema.nullable()
|
|
28492
|
+
});
|
|
28493
|
+
/**
|
|
28324
28494
|
* Time-series resolution. The history methods return one bucket per
|
|
28325
28495
|
* step over the requested range. Smaller resolutions cost more
|
|
28326
28496
|
* memory + bandwidth; bound to discrete steps so caller cannot ask
|
|
@@ -28344,7 +28514,7 @@ var HistoryPointSchema = object({
|
|
|
28344
28514
|
/** Object count averaged over the bucket (rounded to nearest integer). */
|
|
28345
28515
|
count: number().int().nonnegative()
|
|
28346
28516
|
});
|
|
28347
|
-
DeviceType.Camera, method(object({ deviceId: number() }), CameraOccupancySnapshotSchema.nullable()), method(object({
|
|
28517
|
+
DeviceType.Camera, method(object({ deviceId: number() }), CameraOccupancySnapshotSchema.nullable()), method(object({ deviceIds: array(number()).min(1).max(200) }), array(CameraOccupancySnapshotForDeviceSchema).readonly()), method(object({
|
|
28348
28518
|
deviceId: number(),
|
|
28349
28519
|
zoneId: string(),
|
|
28350
28520
|
className: string().optional()
|
|
@@ -31649,6 +31819,12 @@ Object.freeze({
|
|
|
31649
31819
|
addonId: null,
|
|
31650
31820
|
access: "view"
|
|
31651
31821
|
},
|
|
31822
|
+
"pipelineAnalytics.getKeyEventsBatch": {
|
|
31823
|
+
capName: "pipeline-analytics",
|
|
31824
|
+
capScope: "device",
|
|
31825
|
+
addonId: null,
|
|
31826
|
+
access: "view"
|
|
31827
|
+
},
|
|
31652
31828
|
"pipelineAnalytics.getMotionEvents": {
|
|
31653
31829
|
capName: "pipeline-analytics",
|
|
31654
31830
|
capScope: "device",
|
|
@@ -32825,6 +33001,12 @@ Object.freeze({
|
|
|
32825
33001
|
addonId: null,
|
|
32826
33002
|
access: "view"
|
|
32827
33003
|
},
|
|
33004
|
+
"recording.reconcileLedgerAgainstDisk": {
|
|
33005
|
+
capName: "recording",
|
|
33006
|
+
capScope: "system",
|
|
33007
|
+
addonId: null,
|
|
33008
|
+
access: "create"
|
|
33009
|
+
},
|
|
32828
33010
|
"recording.refreshStorageLocationsForMigration": {
|
|
32829
33011
|
capName: "recording",
|
|
32830
33012
|
capScope: "system",
|
|
@@ -32951,6 +33133,12 @@ Object.freeze({
|
|
|
32951
33133
|
addonId: null,
|
|
32952
33134
|
access: "view"
|
|
32953
33135
|
},
|
|
33136
|
+
"sceneMonitor.listScenesBatch": {
|
|
33137
|
+
capName: "scene-monitor",
|
|
33138
|
+
capScope: "device",
|
|
33139
|
+
addonId: null,
|
|
33140
|
+
access: "view"
|
|
33141
|
+
},
|
|
32954
33142
|
"sceneMonitor.recheckNow": {
|
|
32955
33143
|
capName: "scene-monitor",
|
|
32956
33144
|
capScope: "device",
|
|
@@ -34307,6 +34495,12 @@ Object.freeze({
|
|
|
34307
34495
|
addonId: null,
|
|
34308
34496
|
access: "view"
|
|
34309
34497
|
},
|
|
34498
|
+
"zoneAnalytics.getCurrentSnapshotBatch": {
|
|
34499
|
+
capName: "zone-analytics",
|
|
34500
|
+
capScope: "device",
|
|
34501
|
+
addonId: null,
|
|
34502
|
+
access: "view"
|
|
34503
|
+
},
|
|
34310
34504
|
"zoneAnalytics.getUnzonedHistory": {
|
|
34311
34505
|
capName: "zone-analytics",
|
|
34312
34506
|
capScope: "device",
|
|
@@ -35311,6 +35505,11 @@ Object.freeze({
|
|
|
35311
35505
|
form: "single",
|
|
35312
35506
|
optional: false
|
|
35313
35507
|
}],
|
|
35508
|
+
"pipelineAnalytics.getKeyEventsBatch": [{
|
|
35509
|
+
name: "deviceIds",
|
|
35510
|
+
form: "array",
|
|
35511
|
+
optional: false
|
|
35512
|
+
}],
|
|
35314
35513
|
"pipelineAnalytics.getMotionEvents": [{
|
|
35315
35514
|
name: "deviceId",
|
|
35316
35515
|
form: "single",
|
|
@@ -35751,6 +35950,11 @@ Object.freeze({
|
|
|
35751
35950
|
form: "single",
|
|
35752
35951
|
optional: false
|
|
35753
35952
|
}],
|
|
35953
|
+
"recording.reconcileLedgerAgainstDisk": [{
|
|
35954
|
+
name: "deviceId",
|
|
35955
|
+
form: "single",
|
|
35956
|
+
optional: true
|
|
35957
|
+
}],
|
|
35754
35958
|
"recording.relocateFootage": [{
|
|
35755
35959
|
name: "deviceId",
|
|
35756
35960
|
form: "single",
|
|
@@ -35816,6 +36020,11 @@ Object.freeze({
|
|
|
35816
36020
|
form: "single",
|
|
35817
36021
|
optional: false
|
|
35818
36022
|
}],
|
|
36023
|
+
"sceneMonitor.listScenesBatch": [{
|
|
36024
|
+
name: "deviceIds",
|
|
36025
|
+
form: "array",
|
|
36026
|
+
optional: false
|
|
36027
|
+
}],
|
|
35819
36028
|
"sceneMonitor.recheckNow": [{
|
|
35820
36029
|
name: "deviceId",
|
|
35821
36030
|
form: "single",
|
|
@@ -36077,6 +36286,11 @@ Object.freeze({
|
|
|
36077
36286
|
form: "single",
|
|
36078
36287
|
optional: false
|
|
36079
36288
|
}],
|
|
36289
|
+
"zoneAnalytics.getCurrentSnapshotBatch": [{
|
|
36290
|
+
name: "deviceIds",
|
|
36291
|
+
form: "array",
|
|
36292
|
+
optional: false
|
|
36293
|
+
}],
|
|
36080
36294
|
"zoneAnalytics.getUnzonedHistory": [{
|
|
36081
36295
|
name: "deviceId",
|
|
36082
36296
|
form: "single",
|
|
@@ -36628,7 +36842,7 @@ var AdminUIAddon = class extends BaseAddon {
|
|
|
36628
36842
|
capability: adminUiCapability,
|
|
36629
36843
|
provider: {
|
|
36630
36844
|
getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
|
|
36631
|
-
getVersion: async () => ({ version: "1.2.
|
|
36845
|
+
getVersion: async () => ({ version: "1.2.121" })
|
|
36632
36846
|
}
|
|
36633
36847
|
}];
|
|
36634
36848
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as e,K as t,Q as n,R as r,S 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{Q as d}from"./player-overlays-CXg0hhE6.js";import{$i as f,An as p,Bn as ee,Bs as m,C as h,Cn as g,Dn as _,En as v,Fn as y,Hn as te,In as b,J as x,Ln as S,Mn as C,Nn as ne,On as w,Rn as re,Rs as T,Sn as E,Tn as ie,Vn as ae,g as D,jn as oe,q as se,un as ce,wn as le,xn as ue}from"./src-2_PdZDlW.js";import{Vt as O}from"./src-7nQ9U_oz.js";import{t as k}from"./clock-VR-g6-6X.js";import{t as A}from"./download-ChPOQTM7.js";import{t as de}from"./plus-BSMCkEaa.js";import{t as j}from"./refresh-cw-Bc7sN4NG.js";import{C as M,J as N,K as P,P as fe,R as F,X as pe,_ as I,f as me,m as he,o as L,p as R,r as ge,z}from"./index-fcpGbsCa.js";import{t as B}from"./AdminPage-CCD07UMs.js";import{t as V}from"./NodeAddonsSettingsPanel-BbdhEikK.js";import{r as H,t as U}from"./useNodeUrlSelection-Qqj3vhRX.js";var _e=P(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ve=P(`octagon-alert`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z`,key:`1fd625`}]]),ye=P(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),W=P(`skip-forward`,[[`polygon`,{points:`5 4 15 12 5 20 5 4`,key:`16p6eg`}],[`line`,{x1:`19`,x2:`19`,y1:`5`,y2:`19`,key:`futhcm`}]]),G=P(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]);n();var K=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),q=new Set([`done`,`failed`,`skipped`]);function J(e){return!q.has(e.phase)&&!K.has(e.jobState)}function be(e,t){let n=new Map,r=[...e].sort((e,t)=>e.createdAtMs-t.createdAtMs);for(let e of r){let r=K.has(e.state);for(let i of e.tasks)r&&i.finishedAtMs!==null&&t-i.finishedAtMs>6e4||n.set(i.packageName,{jobId:e.jobId,packageName:i.packageName,phase:i.phase,fromVersion:i.fromVersion,toVersion:i.toVersion,error:i.error,jobState:e.state,finishedAtMs:i.finishedAtMs})}return n}function xe(){let{data:e}=p({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:t}=m(O.AddonsJobProgress,e=>e.job.jobId);return a(()=>{let n=new Map;for(let t of e??[])n.set(t.jobId,t);for(let[e,r]of t)n.set(e,r.job);return be([...n.values()],Date.now())},[e,t])}var Y={queued:{icon:k,cls:`bg-muted text-foreground-subtle`,label:`queued`},fetching:{icon:M,cls:`bg-primary/10 text-primary`,label:`fetching`,spin:!0},staged:{icon:M,cls:`bg-primary/10 text-primary`,label:`staged`,spin:!0},validating:{icon:M,cls:`bg-primary/10 text-primary`,label:`validating`,spin:!0},applying:{icon:M,cls:`bg-primary/10 text-primary`,label:`applying`,spin:!0},restarting:{icon:M,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,label:`restarting`,spin:!0},applied:{icon:M,cls:`bg-primary/10 text-primary`,label:`finalizing`,spin:!0},done:{icon:z,cls:`bg-success/10 text-success`,label:`updated`},failed:{icon:ve,cls:`bg-danger/10 text-danger`,label:`failed`},skipped:{icon:W,cls:`bg-muted text-foreground-subtle`,label:`skipped`}};function Se({progress:e}){let t=Y[e.phase],n=t.icon,r=e.error??`${e.packageName}: ${e.fromVersion??`?`} → ${e.toVersion}`;return i(`span`,{"data-testid":`addon-job-progress`,className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded shrink-0 ${t.cls}`,title:r,children:[l(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label,i(`span`,{className:`font-mono`,children:[`→ `,e.toVersion]})]})}function Ce({packageName:e,currentVersion:t,installSource:n,onInstall:r,onClose:a,onSelect:s,selectedVersion:c}){let u=n===`upload`||n===`local`,{data:d,isLoading:f}=v({name:e});return i(`div`,{className:`fixed z-50 w-72 rounded-lg border border-border bg-surface shadow-xl overflow-hidden`,style:{top:`auto`,bottom:`auto`},ref:e=>{if(!e)return;let t=e.parentElement?.getBoundingClientRect();if(!t)return;let n=window.innerHeight-t.bottom,r=t.top;n<280&&r>n?(e.style.bottom=`${window.innerHeight-t.top+4}px`,e.style.top=`auto`):(e.style.top=`${t.bottom+4}px`,e.style.bottom=`auto`),e.style.right=`${window.innerWidth-t.right}px`},onClick:e=>e.stopPropagation(),children:[i(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[l(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle font-medium`,children:`Versions`}),l(`button`,{type:`button`,onClick:a,className:`text-foreground-subtle hover:text-foreground`,children:l(ge,{className:`h-3 w-3`})})]}),u&&i(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[l(G,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),i(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[i(`span`,{className:`font-semibold`,children:[n===`upload`?`Uploaded copy`:`Local copy`,` in place.`]}),` `,`Re-install `,l(`span`,{className:`font-mono`,children:t}),` from npm to track upstream releases again.`]})]}),f&&i(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[l(M,{className:`h-3.5 w-3.5 animate-spin`}),`Loading versions...`]}),d&&l(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:d.map(e=>{let n=e.version===t,a=s!==void 0&&e.version===c,d=/-(alpha|beta|rc|dev|canary|next)/i.test(e.version),f=i(o,{children:[l(`span`,{className:`font-mono flex-1 text-left ${n?`text-primary font-semibold`:d?`text-amber-400`:`text-foreground`}`,children:e.version}),n&&l(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium bg-primary/10 text-primary`,children:`current`}),e.distTags.map(e=>l(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e===`latest`?`bg-emerald-500/15 text-emerald-400`:e===`beta`?`bg-amber-500/15 text-amber-400`:`bg-gray-500/15 text-gray-400`}`,children:e},e)),e.deprecated&&l(`span`,{className:`text-[9px] text-red-400 line-through`,children:`deprecated`}),l(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()})]});return s?i(`button`,{type:`button`,"aria-label":`Select ${e.version}`,onClick:()=>s(e.version),className:`w-full flex items-center gap-2 px-3 py-2 text-[11px] ${a?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[f,a?l(z,{className:`h-3 w-3 text-primary shrink-0`}):l(`span`,{className:`w-3 shrink-0`})]},e.version):i(`div`,{className:`flex items-center gap-2 px-3 py-2 text-[11px] ${n?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[f,n&&!u?l(z,{className:`h-3 w-3 text-primary shrink-0`}):l(`button`,{type:`button`,onClick:()=>r(e.version),className:`shrink-0 rounded p-0.5 hover:bg-primary/20 text-foreground-subtle hover:text-primary transition-colors`,title:n?`Re-install ${e.version} from npm`:`Install ${e.version}`,children:l(A,{className:`h-3 w-3`})})]},e.version)})}),d&&d.length===0&&l(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:`No versions found`})]})}var X={queued:{icon:k,bg:`bg-muted text-foreground-subtle`,label:`queued`},updating:{icon:M,bg:`bg-primary/10 text-primary`,label:`updating`,spin:!0},"done-pending-restart":{icon:j,bg:`bg-amber-500/10 text-amber-700`,label:`pending restart`},done:{icon:z,bg:`bg-success/10 text-success`,label:`done`},failed:{icon:ve,bg:`bg-danger/10 text-danger`,label:`failed`}};function Z({item:e}){let t=X[e.status],n=t.icon;return i(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${t.bg}`,title:e.error,children:[l(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label]})}n();var Q=`device-export`;function we(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===Q)}function Te({isBundle:e,installSource:t,addonId:n,iconPath:r,color:a}){let[o,s]=c(!1),u=a?{backgroundColor:`${a.startsWith(`#`)?a:`#${a}`}26`}:void 0,d=e?`bg-indigo-500/20 text-indigo-700 dark:text-indigo-300`:`bg-purple-500/20 text-purple-700 dark:text-purple-300`,f=n&&r?`/api/addon-assets/${n}/${r}`:null,p=!!f&&!o;return i(`div`,{className:`relative flex-shrink-0`,children:[l(`div`,{className:`h-9 w-9 rounded-lg flex items-center justify-center ${u?``:d}`,style:u,children:p?l(`img`,{src:f,alt:n,className:`h-5 w-5`,onError:()=>s(!0)}):l(e?ye:I,{className:`h-4 w-4`})}),t===`local`&&l(`span`,{className:`absolute -top-1.5 -left-1.5 text-[7px] font-bold leading-none bg-orange-500 text-white px-1 py-0.5 rounded -rotate-12 shadow-sm`,children:`DEV`}),t===`npm`&&l(`span`,{className:`absolute -top-1 -left-1 w-4 h-4 rounded bg-[#cb3837] flex items-center justify-center -rotate-12 shadow-sm`,children:l(`svg`,{viewBox:`0 0 780 250`,className:`w-[11px] h-[11px]`,children:l(`path`,{fill:`#fff`,d:`M240 250h100V50h100v200h340V0H0v250z`})})}),t===`upload`&&l(`span`,{className:`absolute -top-1.5 -left-1.5 flex items-center justify-center h-4 w-4 rounded bg-cyan-500 -rotate-12 shadow-sm`,children:l(G,{className:`h-2.5 w-2.5 text-white`})})]})}function Ee({version:e,availableUpdate:t,selectedVersion:n,isUpdating:r,installSource:a,disabled:o,onUpdate:s,onOpenPicker:c,children:u}){if(r)return i(`span`,{className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-blue-500/30 bg-blue-500/10 text-blue-400 shrink-0`,children:[l(M,{className:`h-3 w-3 animate-spin`}),`Updating…`]});if(t){let r=n??t;return i(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[s&&i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s()},disabled:o,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-semibold border border-blue-500/30 bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,title:`Update to ${r}`,children:[l(A,{className:`h-3 w-3`}),`Update`]}),i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:o,"aria-label":`Select version to install`,title:`Installed ${e} — update available. Selected ${r}; tap to choose another version.`,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-bold font-mono border border-amber-500/40 bg-amber-500/15 text-amber-500 hover:bg-amber-500/25 animate-pulse disabled:opacity-50 disabled:cursor-not-allowed transition-colors`,children:[l(`span`,{className:`font-normal opacity-70`,children:e}),l(`span`,{className:`font-normal opacity-70`,children:`→`}),r,l(F,{className:`h-3 w-3`})]}),u]})}return i(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c()},disabled:o,className:[`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-bold font-mono border transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,a===`local`?`border-orange-500/30 bg-orange-500/10 text-orange-400 hover:bg-orange-500/20`:`border-emerald-500/30 bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20`].join(` `),title:`Version ${e} — tap to view all versions`,children:[e,l(F,{className:`h-3 w-3 opacity-50`})]}),u]})}function De({addonId:e}){let t=s(),{data:n=`inherit`}=g({addonId:e}),r=S({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addons`,`getAddonAutoUpdate`]]})}});return l(`div`,{className:`flex rounded-lg border border-border overflow-hidden text-[10px] font-medium`,children:[`inherit`,`off`,`latest`,`beta`].map(t=>l(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),r.mutate({addonId:e,channel:t})},disabled:r.isPending,className:`px-2.5 py-1 transition-colors capitalize ${n===t?t===`inherit`?`bg-gray-700/50 text-gray-700 dark:text-gray-300`:t===`off`?`bg-gray-700 text-gray-700 dark:text-gray-300`:t===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${t===`inherit`?``:`border-l border-border`}`,children:t},t))})}function Oe({addon:e,agents:t=[],clusterStatus:n,hideVersion:r,availableUpdate:a,onUpdate:f,isUpdating:p,jobProgress:ee,bundle:m,bulkItem:g,disabledByBulk:v,isSystem:te}){let[b,S]=c(!1),[C,w]=c(!1),[re,T]=c(!1),[E,ie]=c(null);u(()=>{ie(null)},[a]);let D=E??a,[oe,le]=c(!1),[ue,O]=c(!1),[k,A]=c(`logs`),M=s(),P=d(),fe=N(),pe=ce(),{manifest:I}=e,R=e.installedOn??[],z=!m&&!I.protected&&I.removable!==!1,B=!!m,H=m?.displayName??I.name,U=m?.packageName??I.packageName,W=m?.version??I.packageVersion??I.version,G=m?.installSource??e.installSource,K=m?m.bundle?.description??m.addons[0]?.manifest.description:I.description,q=ae({onSuccess:()=>{M.invalidateQueries({queryKey:[[`addons`]]}),M.invalidateQueries({queryKey:[[`addonPages`]]}),M.invalidateQueries({queryKey:[[`capabilities`]]})}}),J=ne({onSuccess:()=>{M.invalidateQueries({queryKey:[[`addons`]]})}}),be=_({onSuccess:()=>{M.invalidateQueries({queryKey:[[`addons`]]}),M.invalidateQueries({queryKey:[[`addonPages`]]}),M.invalidateQueries({queryKey:[[`capabilities`]]}),M.invalidateQueries({queryKey:[[`integrations`]]})}}),xe=y({onSuccess:()=>{M.invalidateQueries({queryKey:[[`addons`]]}),M.invalidateQueries({queryKey:[[`alerts`]]})}}),Y=e.health,X=Y?.phase===`failed`&&!Y.inGracePeriod,Q=X&&Y?.nextRetryAt&&!Y.retrying;return i(`div`,{className:`rounded-lg border bg-surface overflow-hidden ${X?`border-red-500/50`:`border-border`}`,children:[X&&Y&&i(`div`,{className:`bg-danger/10 border-b border-danger/30 px-4 py-2.5 flex items-start gap-2.5`,children:[l(ve,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),i(`div`,{className:`flex-1 min-w-0`,children:[i(`div`,{className:`text-xs font-semibold text-danger`,children:[`Failed to load (attempt #`,Y.retryCount,`)`]}),l(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:Y.lastError?.message??`Unknown error`}),Q&&Y.nextRetryAt&&i(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:[`Auto-retry at `,new Date(Y.nextRetryAt).toLocaleTimeString()]})]}),i(`button`,{type:`button`,disabled:xe.isPending||Y.retrying,onClick:e=>{e.stopPropagation(),xe.mutate({packageName:U})},className:`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-[11px] font-semibold border border-red-400/40 bg-red-400/10 text-red-700 dark:text-red-300 hover:bg-red-400/20 disabled:opacity-50 disabled:cursor-not-allowed transition-colors shrink-0`,title:`Reset retry counter and force immediate reload`,children:[l(j,{className:`h-3 w-3 ${xe.isPending||Y.retrying?`animate-spin`:``}`}),`Retry now`]})]}),i(`div`,{className:`flex items-start gap-3 px-4 py-3`,children:[l(Te,{isBundle:B||!!I.components&&I.components.length>1,installSource:G,addonId:B?m.addons[0]?.manifest.id:I.id,iconPath:B?m.bundle?.icon??m.addons[0]?.manifest.icon:I.icon,color:B?m.addons[0]?.manifest.color:I.color}),i(`div`,{className:`flex-1 min-w-0`,children:[i(`div`,{className:`flex items-start justify-between gap-2`,children:[l(`span`,{className:`text-sm font-semibold text-foreground truncate min-w-0`,children:H}),!r&&l(Ee,{version:W,availableUpdate:a,...D===void 0?{}:{selectedVersion:D},isUpdating:p,installSource:G,disabled:v,...f&&D!==void 0?{onUpdate:()=>f(D)}:{},onOpenPicker:()=>T(e=>!e),children:re&&l(Ce,{packageName:U,currentVersion:W,...G?{installSource:G}:{},...a!==void 0&&D!==void 0?{selectedVersion:D,onSelect:e=>{ie(e),T(!1)}}:{},onInstall:e=>{T(!1),be.mutate({packageName:U,version:e})},onClose:()=>T(!1)})})]}),i(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[U!==H&&l(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate max-w-full`,children:U}),B&&i(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium shrink-0 inline-flex items-center gap-1`,children:[l(ye,{className:`h-3 w-3`}),m.addons.length]}),te&&i(`span`,{className:`text-[10px] rounded-full bg-amber-500/15 text-amber-700 dark:text-amber-300 px-2 py-0.5 font-medium shrink-0 inline-flex items-center gap-1`,title:`System package — updating restarts the hub`,children:[l(j,{className:`h-3 w-3`}),`System`]}),g!=null&&l(Z,{item:g}),ee!=null&&l(Se,{progress:ee})]}),K&&l(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:K}),!B&&e.process&&i(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[l(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e.process.mode===`forked`?`bg-blue-500/15 text-blue-400`:`bg-gray-500/15 text-gray-400`}`,children:e.process.mode===`forked`?`forked`:`in-process`}),e.process.pid!=null&&i(`span`,{className:`text-[9px] font-mono text-foreground-subtle`,children:[`PID `,e.process.pid]}),l(`span`,{className:`text-[9px] rounded-full px-1.5 py-0.5 font-medium ${e.process.state===`running`?`bg-emerald-500/15 text-emerald-400`:e.process.state===`crashed`||e.process.state===`failed`?`bg-red-500/15 text-red-400`:`bg-gray-500/15 text-gray-400`}`,children:e.process.state})]})]})]}),!B&&i(`div`,{className:`flex items-center gap-1 px-4 py-1.5 border-t border-border/50 bg-surface-hover/20`,children:[i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),J.mutate({addonId:I.id})},disabled:J.isPending||v,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-border text-foreground-subtle hover:text-blue-400 hover:border-blue-500/30 hover:bg-blue-500/10 disabled:opacity-50 transition-colors`,children:[l(j,{className:`h-3 w-3 ${J.isPending?`animate-spin`:``}`}),`Restart`]}),i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),le(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${oe?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[l(he,{className:`h-3 w-3`}),`Logs`]}),!B&&i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),O(!0)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${ue?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[l(me,{className:`h-3 w-3`}),`Settings`]}),l(`div`,{className:`flex-1`}),z&&i(`button`,{type:`button`,onClick:async e=>{e.stopPropagation(),await pe({title:`Uninstall ${I.name}?`,message:`This will remove the addon package and all its data. This action cannot be undone.`,confirmLabel:`Uninstall`,variant:`danger`})&&q.mutate({packageName:I.packageName})},disabled:q.isPending||v,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border border-border text-foreground-subtle hover:text-red-400 hover:border-red-500/30 hover:bg-red-500/10 disabled:opacity-50 transition-colors`,children:[l(L,{className:`h-3 w-3`}),q.isPending?`Removing...`:`Uninstall`]})]}),n&&n.nodes.length>1&&!B&&i(`div`,{className:`border-t border-border px-4 py-2 bg-muted/10`,children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle mb-1.5`,children:`Cluster Deployment`}),l(`div`,{className:`space-y-1`,children:n.nodes.map(e=>i(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[l(`div`,{className:`h-1.5 w-1.5 rounded-full shrink-0 ${e.status===`offline`?`bg-muted-foreground/30`:e.synced?`bg-success`:`bg-amber-500`}`}),l(`span`,{className:`font-medium text-foreground min-w-[60px]`,children:e.name}),l(`span`,{className:`font-mono text-foreground-subtle`,children:e.version}),!e.synced&&e.status!==`offline`&&l(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-amber-500/10 text-amber-400 border border-amber-500/20`,children:`outdated`}),e.status===`offline`&&l(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:`offline`}),e.synced&&e.status!==`offline`&&l(`span`,{className:`text-[9px] text-success`,children:`synced`})]},e.nodeId))})]}),oe&&!B&&i(`div`,{className:`border-t border-border`,children:[i(`div`,{className:`flex items-center px-4 py-1 bg-surface-hover/20 border-b border-border/50`,children:[i(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[l(`button`,{type:`button`,onClick:()=>A(`logs`),className:`px-2 py-0.5 transition-colors ${k===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Logs`}),l(`button`,{type:`button`,onClick:()=>A(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${k===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Events`})]}),l(`div`,{className:`flex-1`}),l(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),le(!1)},className:`text-foreground-subtle hover:text-foreground`,children:l(ge,{className:`h-3.5 w-3.5`})})]}),k===`logs`&&l(x,{addonId:I.id,maxHeight:`max-h-64`,showFilters:!1}),k===`events`&&l(se,{addonId:I.id,category:`addon.*`,maxHeight:`max-h-64`})]}),B&&i(o,{children:[l(`button`,{type:`button`,onClick:()=>S(e=>!e),className:`w-full flex items-center justify-center border-t border-border py-1 hover:bg-surface-hover/50 transition-colors`,children:l(b?_e:F,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),b&&l(`div`,{className:`border-t border-border px-3 py-2 space-y-2`,children:m.addons.map(e=>l(Oe,{addon:e,agents:t,hideVersion:!0},e.manifest.id))})]}),ue&&!B&&l(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4`,onClick:()=>O(!1),children:i(`div`,{className:`w-full max-w-lg max-h-[80vh] rounded-xl border border-border bg-surface shadow-2xl flex flex-col overflow-hidden`,onClick:e=>e.stopPropagation(),children:[i(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-border flex-shrink-0`,children:[i(`div`,{className:`flex items-center gap-2`,children:[l(me,{className:`h-4 w-4 text-primary`}),i(`h2`,{className:`text-sm font-semibold text-foreground`,children:[H,` Settings`]})]}),l(`button`,{onClick:()=>O(!1),className:`text-foreground-subtle hover:text-foreground transition-colors p-1 rounded`,children:l(ge,{className:`h-4 w-4`})})]}),i(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[l(`div`,{className:`text-[10px] text-foreground-subtle mb-2`,children:`Cluster-wide settings — one value for every node. Per-node settings live under Cluster → the node → Settings.`}),l(V,{nodeId:null,addonIds:[I.id],level:`global`,fieldScope:`cluster`,emptyMessage:`This addon exposes no cluster-wide settings. Anything it can configure is per-node — open it from Cluster → the node → Settings.`}),we(I)&&i(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Device export`}),l(h,{addonId:I.id,trpc:P.trpcClient,onOpenDevice:e=>fe(`/devices/${e}`)})]}),G===`npm`&&i(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Auto-Update`}),l(De,{addonId:I.id})]}),I.components&&I.components.length>0&&i(`div`,{children:[i(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:[`Components (`,I.components.length,`)`]}),l(`div`,{className:`flex flex-wrap gap-1`,children:I.components.map(e=>l(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]}),t.length>=2&&i(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Installed on`}),i(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[R.length===0&&l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Hub (local)`}),R.map(e=>l(`span`,{className:`rounded-full bg-surface-hover border border-border px-2 py-0.5 text-[10px] text-foreground-subtle`,children:e},e)),i(`div`,{className:`relative`,children:[i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),w(e=>!e)},className:`inline-flex items-center gap-1 rounded-full border border-dashed border-border px-2 py-0.5 text-[10px] text-foreground-subtle hover:text-foreground hover:border-primary transition-colors`,title:`Install on more agents`,children:[l(de,{className:`h-3 w-3`}),`Add agent`]}),C&&i(`div`,{className:`absolute left-0 top-full mt-1 z-10 min-w-[160px] rounded-md border border-border bg-surface shadow-lg overflow-hidden`,children:[t.filter(e=>!e.isHub&&!R.includes(e.name)).map(e=>l(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),w(!1)},className:`w-full text-left px-3 py-1.5 text-[10px] text-foreground hover:bg-surface-hover transition-colors`,children:e.name},e.id)),t.filter(e=>!e.isHub&&!R.includes(e.name)).length===0&&l(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle`,children:`No available agents`})]})]})]})]})]}),l(`div`,{className:`flex items-center justify-end px-5 py-3 border-t border-border flex-shrink-0`,children:l(`button`,{type:`button`,onClick:()=>O(!1),className:`rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:`Close`})})]})})]})}n();var ke=`.tgz,.tar.gz,.zip`;function Ae({onUploadSuccess:n}){let[r,a]=c(!1),s=t(null),u=e(async e=>{a(!0);let t=new FormData;t.append(`file`,e);let r=localStorage.getItem(`camstack_admin_token`)??``;try{(await(await fetch(`/api/addons/upload`,{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:t})).json()).success&&n()}finally{a(!1)}},[n]);return i(o,{children:[l(`input`,{ref:s,type:`file`,accept:ke,onChange:e(e=>{let t=e.target.files?.[0];t&&u(t),e.target.value=``},[u]),className:`hidden`}),i(`button`,{type:`button`,onClick:()=>s.current?.click(),disabled:r,className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[r?l(M,{className:`w-3.5 h-3.5 animate-spin`}):l(G,{className:`w-3.5 h-3.5`}),r?`Uploading...`:`Upload`]})]})}n();var je=[{seconds:900,label:`15m`},{seconds:3600,label:`1h`},{seconds:21600,label:`6h`},{seconds:43200,label:`12h`},{seconds:86400,label:`24h`}],Me=new Set([`@camstack/system`,`@camstack/types`,`@camstack/sdk`,`@camstack/shm-ring`,`@camstack/ui-library`]);function Ne(e){return e!==void 0&&Me.has(e)}var Pe={id:`hub`,name:`Hub`,isHub:!0,isOnline:!0};function Fe(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function Ie(e){let t=e;if(!t?.manifest)return null;let n={...t.manifest,name:t.manifest.name??t.manifest.id,version:t.manifest.version??`0.0.0`,capabilities:t.manifest.capabilities??[]},r=t.process,i=r?{pid:r.pid,mode:r.mode===`forked`?`forked`:`in-process`,state:r.state??`unknown`}:void 0,a=t.health,o=t.declaration?.execution,s=t.manifest.execution,c=o?.placement??s?.placement;return{manifest:n,enabled:!0,source:t.source,installSource:t.installSource,installedOn:[],...i?{process:i}:{},hasBackup:t.hasBackup,...a?{health:a}:{},...c?{placement:c}:{}}}function Le(e){let t=new Map,n=[];for(let r of e){let e=r.manifest.packageName;if(!e){n.push(r);continue}let i=t.get(e);if(i)i.addons.push(r);else{let n=r.manifest.bundle,i={packageName:e,displayName:n?.displayName??r.manifest.packageDisplayName??r.manifest.name,version:r.manifest.packageVersion,addons:[r],...r.installSource===void 0?{}:{installSource:r.installSource},...n===void 0?{}:{bundle:n}};t.set(e,i)}}let r=[];for(let e of t.values())e.bundle!==void 0||e.addons.length>=2?r.push({bundle:e,representative:e.addons[0]}):r.push(e.addons[0]);return r.push(...n),r}function $(e){return`bundle`in e}function Re({addons:n,clusterStatus:o,selectedNode:d,onRefresh:f,isRefreshing:p}){let m=s(),[h,g]=c(``),v=r(h),[y,x]=c(!1),S=t(null);u(()=>{if(!y)return;let e=e=>{S.current&&!S.current.contains(e.target)&&x(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[y]);let{data:C}=oe({nodeId:d.id}),ne=a(()=>{let e=new Map;for(let t of C??[])e.set(t.name,t.latestVersion);return e},[C]),w=a(()=>(C??[]).filter(e=>!e.isSystem).length,[C]),[T,E]=c(()=>new Set),[ae,D]=c(()=>new Map),se=e(e=>{E(t=>new Set(t).add(e))},[]),O=e(e=>{E(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),k=e((e,t)=>{D(n=>new Map(n).set(e,t))},[]),de=e(e=>{D(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),N=te({onMutate:e=>{se(e.name),de(e.name)},onSuccess:(e,t)=>{O(t.name);let n=e;if(n&&n.success===!1){k(t.name,n.error??`Update failed (no error message returned by server)`);return}m.invalidateQueries({queryKey:[[`addons`]]}),m.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{O(t.name),k(t.name,e instanceof Error?e.message:String(e))}}),P=xe(),F=t(new Set);u(()=>{let e=new Set;for(let[t,n]of P)J(n)&&e.add(t);let t=[...F.current].some(t=>!e.has(t));F.current=e,t&&(m.invalidateQueries({queryKey:[[`addons`]]}),m.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[P,m]);let{data:I}=le(void 0),me=ue({onSuccess:()=>{m.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),he=re({onSuccess:()=>{m.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:L,isFetching:ge}=b({query:v||void 0},{enabled:y}),B=ee(),{data:V}=ie(void 0),H=V?.requestedAt,[U,_e]=c(null),[ve,ye]=c(!1);u(()=>{if(V?.kind===`framework-bulk-update`&&V.requestedAt!==U){_e(V.requestedAt),ye(!0);let e=window.setTimeout(()=>ye(!1),6e3);return()=>window.clearTimeout(e)}},[H,U,V]),ce();let W=e(async()=>{let e=(C??[]).filter(e=>!e.isSystem);if(e.length!==0){if(!d.isHub){for(let t of e)await N.mutateAsync({name:t.name,version:t.latestVersion,nodeId:d.id});return}await B.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[d.id]})}},[C,d.id,d.isHub,B,N]),G=_({onSuccess:()=>{m.invalidateQueries({queryKey:[[`addons`]]}),m.invalidateQueries({queryKey:[[`addonPages`]]}),m.invalidateQueries({queryKey:[[`capabilities`]]}),m.invalidateQueries({queryKey:[[`integrations`]]})}}),[K,q]=c(`type`),[be,Y]=c(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),Se=e=>{Y(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[Ce,X]=pe(),Z=Ce.get(`capability`),Q=a(()=>{let e=n.filter(e=>!Ne(e.manifest.packageName));return d.isHub||(e=e.filter(e=>Fe(e.placement,d.isHub))),Z&&(e=e.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===Z))),e},[n,d.isHub,Z]),we=()=>{let e=new URLSearchParams(Ce);e.delete(`capability`),X(e,{replace:!0})},Te=be===`flat`?Q:Le(Q),Ee=a(()=>{let e=[...Te];switch(K){case`type`:e.sort((e,t)=>{let n=+!$(e),r=+!$(t);if(n!==r)return n-r;let i=$(e)?e.bundle.displayName:e.manifest.name,a=$(t)?t.bundle.displayName:t.manifest.name;return i.localeCompare(a)});break;case`name`:e.sort((e,t)=>{let n=$(e)?e.bundle.displayName:e.manifest.name,r=$(t)?t.bundle.displayName:t.manifest.name;return n.localeCompare(r)});break;case`source`:e.sort((e,t)=>{let n=$(e)?e.bundle.installSource??``:e.installSource??``,r=$(t)?t.bundle.installSource??``:t.installSource??``;return n.localeCompare(r)});break}return e},[Te,K]);return i(`div`,{className:`space-y-4`,children:[[...ae.entries()].map(([e,t])=>l(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-[11px]`,children:i(`div`,{className:`flex items-start justify-between gap-3`,children:[i(`div`,{className:`space-y-0.5`,children:[i(`div`,{className:`font-medium text-danger`,children:[`Failed to update `,e]}),l(`div`,{className:`text-foreground-subtle font-mono`,children:t})]}),l(`button`,{type:`button`,onClick:()=>de(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:`dismiss`})]})},e)),i(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[i(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Sort:`}),i(`select`,{value:K,onChange:e=>q(e.target.value),className:`rounded-md border border-border bg-surface px-2 py-1.5 text-[11px] text-foreground focus:outline-none focus:border-primary/50`,children:[l(`option`,{value:`type`,children:`Bundles first`}),l(`option`,{value:`name`,children:`Name`}),l(`option`,{value:`source`,children:`Install source`})]})]}),i(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`View:`}),l(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>l(`button`,{type:`button`,onClick:()=>Se(e),className:`px-2.5 py-1.5 transition-colors capitalize ${be===e?`bg-primary/10 text-primary`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`}`,title:e===`grouped`?`Group multi-addon packages into a bundle card`:`Show every addon as its own card`,children:e},e))})]}),d.isHub&&i(`div`,{className:`flex items-center gap-1.5`,children:[l(j,{className:`h-3 w-3 text-foreground-subtle`}),l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Auto-Update:`}),l(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>l(`button`,{type:`button`,onClick:()=>me.mutate({channel:e}),disabled:me.isPending,className:`px-2.5 py-1.5 transition-colors capitalize ${I?.channel===e?e===`off`?`bg-gray-700 text-gray-200`:e===`latest`?`bg-blue-500/20 text-blue-400`:`bg-amber-500/20 text-amber-400`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`} ${e===`off`?``:`border-l border-border`}`,children:e},e))})]}),d.isHub&&i(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Check every:`}),l(`select`,{className:`rounded-md border border-border bg-transparent px-1.5 py-1 text-[10px] font-medium text-foreground-subtle`,value:I?.updateCheckIntervalSeconds??21600,disabled:he.isPending||I===void 0,onChange:e=>{I!==void 0&&he.mutate({channel:I.channel,updateCheckIntervalSeconds:Number(e.target.value)})},children:je.map(e=>l(`option`,{value:e.seconds,children:e.label},e.seconds))})]}),w>0&&i(`button`,{type:`button`,onClick:()=>void W(),disabled:B.isPending,className:`flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 border border-blue-500/30 disabled:opacity-50 transition-colors font-medium`,children:[B.isPending?l(M,{className:`w-3 h-3 animate-spin`}):l(A,{className:`w-3 h-3`}),B.isPending?`Updating…`:`Update All (${w})`]}),i(`button`,{type:`button`,onClick:f,disabled:p||B.isPending,className:`flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,children:[l(j,{className:`w-3 h-3 ${p?`animate-spin`:``}`}),`Refresh`]})]}),i(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[i(`div`,{className:`relative flex-1 min-w-0 sm:min-w-[200px]`,ref:S,children:[l(R,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),l(`input`,{type:`text`,value:h,onChange:e=>{g(e.target.value),x(!0)},onFocus:()=>x(!0),placeholder:`Search addons on npm...`,disabled:B.isPending,className:`w-full rounded-lg border border-border bg-background pl-9 pr-3 py-2 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50 disabled:cursor-not-allowed`}),ge&&l(M,{className:`absolute right-2.5 top-1/2 -translate-y-1/2 h-3 w-3 text-foreground-subtle animate-spin`}),y&&L&&L.length>0&&i(`div`,{className:`absolute left-0 right-0 top-full mt-1 z-40 rounded-lg border border-border bg-surface shadow-xl overflow-hidden`,children:[L.length>0&&i(`div`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:[`npm results (`,L.length,`)`]}),L&&L.length>0&&l(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:L.map(e=>i(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[l(`div`,{className:`w-6 h-6 rounded-md bg-primary/10 flex items-center justify-center text-primary text-[9px] font-bold shrink-0`,children:e.name.replace(`@camstack/addon-`,``).charAt(0).toUpperCase()}),i(`div`,{className:`flex-1 min-w-0`,children:[i(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[l(`span`,{className:`text-[11px] font-semibold break-words`,children:e.name.replace(/^@camstack\/(addon-)?/,``)}),i(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:[`v`,e.version]})]}),l(`div`,{className:`font-mono text-[9px] text-foreground-subtle/80 truncate`,children:e.name}),e.description&&l(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?i(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 text-[10px] font-medium rounded-md border border-emerald-500/30 bg-emerald-500/10 text-emerald-400 shrink-0`,children:[l(z,{className:`h-3 w-3`}),e.installedVersion??`Installed`]}):i(`button`,{type:`button`,onClick:()=>G.mutate({packageName:e.name}),disabled:G.isPending,className:`inline-flex items-center gap-1 px-2 py-1 text-[10px] font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors shrink-0`,children:[G.isPending?l(M,{className:`h-3 w-3 animate-spin`}):l(A,{className:`h-3 w-3`}),`Install`]})]},e.name))})]})]}),l(Ae,{onUploadSuccess:()=>{m.invalidateQueries({queryKey:[[`addons`]]}),f()}})]}),Z&&i(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-primary/10 border border-primary/30 text-sm`,children:[l(`span`,{className:`text-foreground-subtle`,children:`Filtering by capability:`}),l(`span`,{className:`font-mono text-primary font-semibold`,children:Z}),l(`button`,{type:`button`,onClick:we,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:`Clear`})]}),ve&&i(`div`,{className:`fixed top-[calc(env(safe-area-inset-top)+1rem)] right-[calc(env(safe-area-inset-right)+1rem)] z-50 flex items-start gap-2 px-3 py-2.5 rounded-md border border-green-500/30 bg-green-500/10 shadow-lg backdrop-blur-sm max-w-sm pointer-events-auto`,children:[l(fe,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),i(`div`,{children:[l(`div`,{className:`text-[11px] font-semibold text-foreground`,children:`Bulk update completed`}),l(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:`System packages updated — hub restarted successfully.`})]})]}),Q.length===0&&l(`div`,{className:`text-xs text-foreground-subtle`,children:n.length===0?`No addons installed`:Z?`No installed addons declare the "${Z}" capability. Browse the npm catalog above to find a compatible addon.`:`No addons compatible with ${d.name} (placement filter active)`}),l(`div`,{className:`space-y-2`,children:Ee.map(e=>{let t=$(e)?e.bundle.packageName:e.manifest.packageName,n=ne.get(t),r=$(e)?e.representative:e,i=n?e=>N.mutate({name:t,version:e,nodeId:d.id}):void 0,a=P.get(t)??null,s=a!==null&&J(a);return l(Oe,{addon:r,clusterStatus:o?.[r.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:n,isUpdating:T.has(t)||s,jobProgress:a,onUpdate:i,disabledByBulk:B.isPending},$(e)?t:e.manifest.id)})})]})}function ze(){let e=s(),{data:n,isLoading:r,isError:a}=w(),{data:o}=f(void 0),{nodes:c}=T(),{selection:d,selectNode:p,requestedNodeId:ee}=U(c.length>0?c:[Pe]),m=d.node??Pe,h=m.id,g=c.length>0?d.staleNodeId:null,_=E(),v=C(),y=_.isPending||v.isPending,te=async()=>{await _.mutateAsync({nodeId:h}),await v.mutateAsync(),e.invalidateQueries({queryKey:[[`addons`]]})},b=t(_);b.current=_;let x=t(ee??`hub`);u(()=>{b.current.mutate({nodeId:x.current})},[]);let S=(n??[]).map(Ie).filter(e=>e!==null);return i(B,{children:[i(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[l(D,{selectedNodeId:h,onSelect:p}),i(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[!r&&!a&&i(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium`,children:[S.length,` installed`]}),i(`button`,{type:`button`,onClick:()=>void te(),disabled:y,className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] rounded-md bg-surface hover:bg-surface-hover border border-border disabled:opacity-50 transition-colors`,title:`Re-fetch addons + check npm for new versions`,children:[l(j,{className:`w-3 h-3 ${y?`animate-spin`:``}`}),`Check for updates`]})]})]}),l(H,{staleNodeId:g,shownNodeName:m.name}),!m.isHub&&i(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 px-3 py-2 text-[11px] text-foreground-subtle`,children:[`Showing only addons compatible with`,` `,l(`span`,{className:`font-medium text-foreground`,children:m.name}),` — agents only run`,` `,l(`code`,{className:`font-mono`,children:`agent-only`}),` and`,` `,l(`code`,{className:`font-mono`,children:`any-node`}),` addons. Install / uninstall is hub-driven; agents auto-sync from the hub.`]}),r&&l(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading…`}),a&&l(`div`,{className:`text-xs text-danger`,children:`Failed to load addons`}),!r&&!a&&l(Re,{addons:S,clusterStatus:o,selectedNode:m,onRefresh:()=>void te(),isRefreshing:y})]})}export{ze as AddonsPage};
|
|
@@ -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{Q as d}from"./player-overlays-CXg0hhE6.js";import{Ba as f,Ct as p,Hr as m,Io as h,J as g,Ji as _,Lo as v,Ro as y,St as b,Vs as x,ao as S,ea as C,ia as w,na as T,nt as E,q as ee,qi as D,ra as te,ta as ne,ts as re,tt as O,un as k,wt as ie,xt as ae,zo as oe,zs as A}from"./src-2_PdZDlW.js";import{Et as se}from"./src-7nQ9U_oz.js";import{t as ce}from"./pencil-uWNwJNLv.js";import{t as le}from"./radio-B2Ey6CU_.js";import{t as ue}from"./refresh-cw-Bc7sN4NG.js";import{t as j}from"./rotate-cw-BzcYJDMV.js";import{t as de}from"./server-hj9nrAEV.js";import{C as M,H as fe,I as pe,K as N,N as me,R as he,a as P,m as ge,o as _e,p as ve,r as F,t as I,z as ye}from"./index-fcpGbsCa.js";import{t as be}from"./NodeAddonsSettingsPanel-BbdhEikK.js";import{t as L}from"./format-size-DIxKXxtj.js";import{n as xe,r as Se,t as Ce}from"./useNodeUrlSelection-Qqj3vhRX.js";var R=N(`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`}]]),we=N(`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`}]]),z=N(`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 Te(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 Ee({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 De=[`trace`,`debug`,`info`,`warn`,`error`];function Oe({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,_]=c(`info`),v=e.name.includes(`(core)`),y=ne(),x=T(),S=te(),C=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 x.mutateAsync({nodeId:t,processName:e.name})}catch(e){console.error(`Failed to restart process:`,e)}finally{m(null)}},E=async n=>{let r=`${t}/${e.name}`;try{await S.mutateAsync({nodeId:r,level:n}),_(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?he:pe,{className:`h-3 w-3 text-muted-foreground shrink-0`}),v?l(de,{className:`h-3.5 w-3.5 text-primary shrink-0`}):l(fe,{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(Ee,{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:L(e.memoryRss)}),l(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:Te(e.uptimeSeconds)}),!v&&r(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:[r(ae,{children:[l(ie,{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(b,{align:`end`,className:`min-w-[70px] py-0.5`,children:De.map(e=>l(p,{onClick:()=>E(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(j,{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(ge,{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(le,{className:`h-3 w-3`})}),l(`button`,{onClick:()=>C(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(j,{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(g,{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(ee,{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 ke({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(Oe,{proc:t,nodeId:e,defaultExpanded:r===0,activePanel:n,onTogglePanel:i},t.name))})}var Ae={system:0,managed:1,root:2};n();function je(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 Me(e,t=80){return e.length<=t?e:`…${e.slice(e.length-t+1)}`}function Ne({nodeId:e}){let t=s(),n=A(`metrics.node-processes-snapshot`,t=>t.nodeId===e),{data:i}=_({nodeId:e}),o=n?.processes??i,c=a(()=>o?[...o]:[],[o]),u=a(()=>[{key:`classification`,header:`Class`,sortValue:e=>Ae[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:Me(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=>L(e.memoryRssBytes)},{key:`uptimeSec`,header:`Uptime`,align:`right`,sortValue:e=>e.uptimeSec,render:e=>l(`span`,{className:`text-foreground-subtle`,children:je(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(ue,{className:`h-3 w-3`}),` Refresh`]})}),l(O,{columns:u,rows:c,rowKey:e=>e.pid,minWidthPx:880,mobileMode:`scroll`,maxBodyHeight:E,emptyMessage:`Scanning…`})]})}var B={width:320,height:64},V=.8,H=Math.ceil(8*V-3)+1,U=B.width+34,W=B.height+H+1+11,Pe=H+B.height+1+3+Math.ceil(8*V),Fe=[1,2,5,10],Ie=[1,2,4,8,16,32,64,128,256,512,1024],Le=[1,1.5,2,2.5,3,4,5],G=[4,3,5,2],Re=1e-9;function ze(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 Le.some(e=>Math.abs(t-e)<Re)}let n=e/10**Math.floor(Math.log10(e));return Le.some(e=>Math.abs(n-e)<Re)}function Be(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 Ie){let n=t*e;if(n>=r)return n}return 1024*e}let i=10**Math.floor(Math.log10(r));for(let e of Fe){let t=e*i;if(t>=r)return t}return 10*i}function Ve(e,t){if(!Number.isFinite(e)||e<=0)return[];let n=G.find(n=>ze(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 He=2.5;function Ue(e){return e*He}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 We(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 Ge(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 Ke(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 qe(e){return e.length<2?0:Math.max(0,e.at(-1).atMs-e[0].atMs)}function Je(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 q(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 J={main:`var(--load-series-main)`,gc:`var(--load-series-gc)`},Ye=`
|
|
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
|
-
`,Y=B,Xe={height:W};function Ze({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=Be(e.map(e=>e.value),25,`linear`),i=K(e,Y,r,p),a=K(t,Y,r,p),o=a.map(e=>({x:e.x,y:e.y===null?null:Y.height,gapBefore:e.gapBefore}));return{max:r,ticks:Ve(r,`linear`),upper:i,middle:a,base:o,gaps:Je(i),times:Ke(e,Y),spanMs:qe(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(st,{message:f})}):l(Z,{title:e,legend:r(o,{children:[l(ot,{color:J.main,label:s}),l(ot,{color:J.gc,label:u})]}),readout:x&&x.main!==null&&x.gc!==null?r(o,{children:[b!==void 0&&l(at,{atMs:b.atMs,spanMs:v.spanMs}),l(Q,{color:J.main,text:d(x.main)}),l(Q,{color:J.gc,text:d(x.gc)})]}):null,children:r(`svg`,{ref:h,viewBox:`0 0 ${U} ${W}`,preserveAspectRatio:`none`,className:`w-full`,style:Xe,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*U-34,r=q(v.upper,n);r!==null&&_({index:r,xPx:v.upper[r].x})},children:[l(Qe,{ticks:v.ticks,max:v.max,formatValue:d}),l(it,{ticks:v.times,spanMs:v.spanMs}),r(`g`,{transform:`translate(34,${H})`,clipPath:`url(#${m})`,children:[l(`clipPath`,{id:m,children:l(`rect`,{x:0,y:0,width:Y.width,height:Y.height})}),l($e,{spans:v.gaps}),l(`path`,{d:Ge(v.middle,v.base),fill:J.main,fillOpacity:.85}),l(`path`,{d:Ge(v.upper,v.middle),fill:J.gc,fillOpacity:.85,stroke:`var(--color-surface, transparent)`,strokeWidth:2}),l(`path`,{d:We(v.upper),fill:`none`,stroke:J.gc,strokeWidth:2}),g!==null&&l(`line`,{x1:g.xPx,x2:g.xPx,y1:0,y2:Y.height,stroke:`currentColor`,strokeWidth:1,className:`text-foreground-subtle`})]})]})})}function X({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=Be(n.map(e=>e.value),u,d),t=K(n,Y,e,f);return{max:e,ticks:Ve(e,d),projected:t,gaps:Je(t),times:Ke(n,Y),spanMs:qe(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(st,{message:s})}):l(Z,{title:e,readout:v&&v.value!==null?r(o,{children:[_!==void 0&&l(at,{atMs:_.atMs,spanMs:g.spanMs}),l(Q,{color:J.main,text:i(v.value)})]}):null,children:r(`svg`,{ref:p,viewBox:`0 0 ${U} ${W}`,preserveAspectRatio:`none`,className:`w-full`,style:Xe,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*U-34,r=q(g.projected,n);r!==null&&h({index:r,xPx:g.projected[r].x})},children:[l(Qe,{ticks:g.ticks,max:g.max,formatValue:i}),l(it,{ticks:g.times,spanMs:g.spanMs}),r(`g`,{transform:`translate(34,${H})`,children:[l($e,{spans:g.gaps}),l(`path`,{d:We(g.projected),fill:`none`,stroke:J.main,strokeWidth:2}),m!==null&&l(`line`,{x1:m.xPx,x2:m.xPx,y1:0,y2:Y.height,stroke:`currentColor`,strokeWidth:1,className:`text-foreground-subtle`})]})]})})}function Qe({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=H+Y.height-e/i*Y.height;return r(`g`,{children:[l(`line`,{x1:34,x2:34+Y.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 $e({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:Y.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 et=10*6e4,tt={hour:`2-digit`,minute:`2-digit`},nt={hour:`2-digit`,minute:`2-digit`,second:`2-digit`};function rt(e,t){return new Date(e).toLocaleTimeString(void 0,t<et?nt:tt)}function it({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:Pe,fontSize:8,textAnchor:e.anchor,fill:`currentColor`,children:rt(e.atMs,t)},e.atMs))})}function at({atMs:e,spanMs:t}){return l(`span`,{className:`text-[10px] tabular-nums text-foreground-subtle`,children:rt(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 ot({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 st({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 ct(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 lt(e,t,n,r){let i=e.get(t),a=ct(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 ut(e,t,n){let r=e;for(let e of se(t,n))r=lt(r,e.key,e.kind,e.point);return r}function dt(e,t){let n=e;for(let e of t)for(let t of e.points)n=lt(n,e.key,e.kind,t);return n}function ft(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 pt=12e4;function mt(e,t){return e===null?!1:t-e>pt}function ht(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 gt(e){for(let t of e.values()){let e=t.points.at(-1);if(e&&e.cpuMainPercent!==null)return!0}return!1}var _t={key:`cpu`,dir:`desc`};function vt(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 yt(e){return e.points.at(-1)?.memoryRssBytes??null}function bt(e,t,n){let r=n.trim().toLowerCase();return r===``?!0:e.toLowerCase().includes(r)||t.toLowerCase().includes(r)}function xt(e,t){return t===`memory`?yt(e):vt(e)}function St(e,t,n){let r=e.filter(e=>t.selectedKeys.size>0&&!t.selectedKeys.has(e.key)?!1:bt(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=xt(e,t.sort.key),o=xt(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 Ct(e,n=720){let r=A(`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}=D({forNodeId:e,sinceMs:o,maxPoints:n});u(()=>{d!==void 0&&a(e=>{let t=dt(e,d.series);return l.current=ft(t),t})},[d]);let p=r?.timestamp;u(()=>{r==null||p===void 0||(mt(l.current,p)&&s(l.current??0),a(e=>{let t=ut(e,r.processes,p);return l.current=ft(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:ht(i),sampleCount:m,threadSplitAvailable:gt(i),loadingRetained:f,durable:d?.durable??null,bucketMs:d?.bucketMs??null,cadenceMs:d?.cadenceMs??null,retainedSamples:d?.retainedSamples??null}}var wt=`__unclaimed__`;function Tt(e,t){return{kind:e,deviceId:t,cpu:0,cpuKnown:!0,rss:0,rssKnown:!0,count:0,roles:new Set}}function Et(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 Dt(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)??Tt(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])=>Et(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=Tt(`unclaimed`,null);for(let e of a)o.count+=1,o.rss+=e.memoryRssBytes;return o.cpuKnown=!1,[...i,Et(wt,o)]}var Ot=[{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 kt(e){return e.attribution===`measured`&&e.wiredToday}function At(){let e=new Set;for(let t of Ot)kt(t)&&e.add(t.family);return e}var jt=At();function Mt(e){return!jt.has(e.role)||e.deviceId===null?!1:e.attribution===`measured`}function Nt(e){return`${e.addonId}${e.role}${e.unit}${e.pid??`-`}`}function Pt(){return{cpuSeconds:0,cpuKnown:!0,rssBytes:0,rssKnown:!0,unitCount:0,roles:new Set}}function Ft(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 It(e){return Math.round(e*10)/10}function Lt(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)Mt(t)&&i.set(Nt(t),t);let a=new Map,o=new Set;for(let n of t.entries){if(!Mt(n)||n.deviceId===null)continue;let t=Nt(n);o.add(t);let r=a.get(n.deviceId)??Pt();r.unitCount+=1,r.roles.add(n.role);let s=Ft(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?It(n.cpuSeconds/r*100):null,rssBytes:n.rssKnown?n.rssBytes:null,unitCount:n.unitCount,roles:[...n.roles].toSorted()}}))}function Rt(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 zt(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 Bt(e){let t=e.indexOf(`@`);return t===-1?{addonId:e,nodeId:null}:{addonId:e.slice(0,t),nodeId:e.slice(t+1)}}function Vt(e,t){let n=Bt(e);return n.nodeId===null?t.isHub:n.nodeId===t.nodeId}function Ht(e,t){return e.filter(e=>Vt(e.addonId,t))}n();function Ut(e){let n=A(`metrics.node-processes-snapshot`,t=>t.nodeId===e.nodeId),r=re(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:Ht(d,e)},n=o.current;if(o.current=t,n===null)return;let r=Lt(n,t);r.length!==0&&a(e=>Rt(e,r))},[d,f,e.nodeId,e.isHub]);let p=d===void 0?[]:Ht(d,e),m=n?.processes,h=Dt(p,m);return{series:zt(i),unclaimed:h.find(e=>e.kind===`unclaimed`)??null,loading:r.isPending,error:r.error===null?null:r.error.message}}function Wt(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 Gt=25,Kt=64*1024*1024,qt=1e4;function Jt({scope:e,cadenceMs:t}){let{t:n}=I(),i=Ut(e),{data:a=[]}=m({isCamera:!0,projection:`slim`}),o=Wt(a),s=Ue(t??qt);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(P,{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(Xt,{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(Yt,{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(X,{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:Gt,gapMs:s,emptyMessage:n(`cameraLoad.cpuUnavailable`,`No measurable window yet.`)}),l(X,{title:n(`cameraLoad.memoryTitle`,`Memory RSS`),points:e.points.map(e=>({atMs:e.atMs,value:e.rssBytes})),formatValue:L,axisFloor:Kt,axisScale:`bytes`,gapMs:s,emptyMessage:n(`cameraLoad.memoryUnavailable`,`No memory reported.`)})]})]},e.deviceId))})]})}function Yt({deviceId:e,name:t}){let{t:n}=I();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 Xt({unclaimed:e}){let{t}=I();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?`—`:L(e.rssBytes)})})})}n();var Zt=256*1024*1024,Qt=1e4;function $t({nodeId:e,isHub:t}){let{t:n}=I(),{series:i,sampleCount:o,threadSplitAvailable:s,loadingRetained:u,bucketMs:d,cadenceMs:f}=Ct(e),[p,m]=c(``),[h,g]=c(new Set),[_,v]=c(_t),y=e=>e.key===`__root__`?n(`clusterLoad.bucketRoot`,`Node supervisor`):e.key===`__unattributed__`?n(`clusterLoad.bucketUnattributed`,`Unattributed processes`):e.key,b=Ue(d??f??Qt),x=a(()=>St(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:Ye}),l(en,{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(P,{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(ve,{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(tn,{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(F,{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(Ze,{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(X,{title:n(`clusterLoad.memoryTitle`,`Memory RSS`),points:e.points.map(e=>({atMs:e.atMs,value:e.memoryRssBytes})),formatValue:L,axisFloor:Zt,axisScale:`bytes`,gapMs:b,emptyMessage:n(`clusterLoad.memoryUnavailable`,`No memory samples yet.`)})]})]},e.key))}),l(Jt,{scope:{nodeId:e,isHub:t},cadenceMs:f})]})}function en({bucketMs:e,cadenceMs:t}){let{t:n}=I();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 tn({sort:e,onChange:t}){let{t:n}=I(),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 nn=`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 rn({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(be,{nodeId:e,addonIds:t,level:`global`,fieldScope:`perNode`,emptyMessage:nn,selfTabbed:!0})})}n();function an({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=S({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(O,{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 on(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 sn(e){let[t,n]=c(!1),[i,a]=c(e.name),o=s(),u=C({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(ye,{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(F,{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(ce,{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:on(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 cn=[[`serverManagement`,`getServerPackageStatus`]];function ln({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 un({node:t}){let{t:n}=I(),i=s(),a=k(),[o,u]=c(!1),d=t.isHub?void 0:{nodeId:t.id},f=y(d,{refetchInterval:1e4,enabled:t.isOnline,retry:1}),p=f.data??null,m=e(()=>{i.invalidateQueries({queryKey:cn})},[i]),g=v({onSettled:m}),_=h({onSettled:m}),b=oe({onSettled:m}),x=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 b.mutateAsync(d)).restarting&&u(!0)},[a,t.name,b,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`,E=t.isOnline&&p!=null&&!T&&p.updateAvailable&&p.updateState===`idle`&&!_.isPending,ee=t.isOnline&&p!=null&&p.updateState===`idle`&&!b.isPending,D=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(ln,{...C()})]}),D!=null&&l(ln,{...D})]}),!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(M,{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(M,{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(M,{className:`h-3.5 w-3.5 animate-spin`}):l(ue,{className:`h-3.5 w-3.5`}),n(`serverManagement.checkForUpdate`,`Check for update`)]}),E&&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 x(),children:[_.isPending?l(M,{className:`h-3.5 w-3.5 animate-spin`}):l(R,{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:!ee,onClick:()=>void S(),children:[b.isPending?l(M,{className:`h-3.5 w-3.5 animate-spin`}):l(j,{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(we,{className:`h-3 w-3`}),n(`serverManagement.lastChecked`,`Last checked: {{when}}`,{when:new Date(p.lastCheckedAtMs).toLocaleString()})]})]})}n();function dn({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(me,{className:`h-3 w-3`}),` `,e.cpuPercent,`%`]}),r(`span`,{className:`flex items-center gap-1`,children:[l(z,{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(sn,{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(un,{node:{id:e.id,name:e.name,isHub:e.isHub,isOnline:e.isOnline,rootPackage:e.rootPackage??null}})})]}),n===`forks`&&l(ke,{nodeId:e.id,processes:s}),n===`processes`&&l(Ne,{nodeId:e.id}),n===`load`&&l($t,{nodeId:e.id,isHub:e.isHub}),n===`settings`&&l(rn,{nodeId:e.id,addonIds:u}),n===`capabilities`&&l(an,{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(_e,{className:`h-3 w-3`}),a?`Forgetting…`:`Forget node`]})]})]})}function fn({nodes:e,selected:t,onSelect:n}){let{t:i}=I(),a=xe(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(dn,{node:t})]})}function pn({node:e,active:t,onSelect:n}){let{t:i}=I();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(me,{className:`h-3 w-3`}),e.cpuPercent,`%`,l(z,{className:`h-3 w-3`}),e.memoryPercent,`%`]}):l(`span`,{className:`text-[10px] text-destructive`,children:i(`cluster.offline`,`offline`)})]})}n();function mn(){let{data:e,isLoading:t}=w(void 0,{staleTime:1/0}),[n,r]=c(null);return x(`cluster.topology-snapshot`,e=>{let t=e.data?.nodes;Array.isArray(t)&&r(t)}),{nodes:a(()=>n??e??[],[n,e]),isLoading:t&&!n}}function hn(){let{t}=I(),n=k(),{nodes:i,isLoading:o}=mn(),{selection:s,selectNode:u}=Ce(i),d=s.node,f=a(()=>i.filter(e=>e.isOnline),[i]),p=f.length,m=i.filter(e=>!e.isOnline).length,g=h(),[_,v]=c(!1),y=e(async()=>{let e=[...f].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`})){v(!0);try{for(let t of e)try{await g.mutateAsync(t.isHub?{}:{nodeId:t.id})}catch{}}finally{v(!1)}}},[g,n,f,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:[p>0&&r(`span`,{className:`text-xs px-2 py-0.5 rounded-full bg-success/10 text-success`,children:[p,` online`]}),m>0&&r(`span`,{className:`text-xs px-2 py-0.5 rounded-full bg-destructive/10 text-destructive`,children:[m,` offline`]})]}),l(`div`,{className:`flex items-center gap-2`,children:p>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:_,title:t(`serverManagement.updateAllHint`,`Sequenced agents-first, hub-last — up-to-date nodes are skipped.`),onClick:()=>void y(),children:[_?l(M,{className:`h-3.5 w-3.5 animate-spin`}):l(R,{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...`}):r(`div`,{className:`flex-1 overflow-auto flex flex-col gap-3`,children:[l(Se,{staleNodeId:s.staleNodeId,shownNodeName:d?.name??``}),l(fn,{nodes:i,selected:d,onSelect:u})]})]})}export{hn as ClusterPage};
|