@camstack/addon-admin-ui 1.2.342 → 1.2.344
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/{AddonCollectionPage-DMer3W7x.js → AddonCollectionPage-CtGDw_n5.js} +1 -1
- package/dist/assets/Addons-BbvxpnQM.js +1 -0
- package/dist/assets/{AdminTabs-8K5IGAB8.js → AdminTabs-CPymFEi4.js} +1 -1
- package/dist/assets/AiProfiles-BdZwB876.js +3 -0
- package/dist/assets/{BrokerForm-B7pu8gw6.js → BrokerForm-bTr6I-mZ.js} +1 -1
- package/dist/assets/Build-6ro8Cc39.js +40 -0
- package/dist/assets/{Calendars-DeYzry19.js → Calendars-CpkPyhTX.js} +1 -1
- package/dist/assets/{Capabilities-BlzqjCkv.js → Capabilities-BZAkKnia.js} +1 -1
- package/dist/assets/Cluster-D-SOzA9E.js +11 -0
- package/dist/assets/CompositionEditor-CJcav7Ft.js +1 -0
- package/dist/assets/{CompositionEditorPage-NxiR7QQh.js → CompositionEditorPage-CdYKQzfV.js} +1 -1
- package/dist/assets/Data-BYvkr1Az.js +1 -0
- package/dist/assets/DetectionIntelligence-rHDGickO.js +1 -0
- package/dist/assets/DeviceDetail-iRpAa689.js +2 -0
- package/dist/assets/{DeviceDoActionFields-BTGvB-rE.js → DeviceDoActionFields-77FuYXq4.js} +1 -1
- package/dist/assets/{Devices-DzqN9BfL.js → Devices-BALjzGER.js} +1 -1
- package/dist/assets/{EmbedPlayerPage--gPnf__x.js → EmbedPlayerPage-CpfoFmmz.js} +1 -1
- package/dist/assets/Events-DuDdPYOu.js +1 -0
- package/dist/assets/Identity-CEVA6NKV.js +1 -0
- package/dist/assets/IntegrationDetail-C2e7uYr5.js +1 -0
- package/dist/assets/{Integrations-CPNmXnNZ.js → Integrations-2prW_G4w.js} +1 -1
- package/dist/assets/Integrations-DN-iKI4e.js +1 -0
- package/dist/assets/Locations-Ct64zaky.js +3 -0
- package/dist/assets/{Logs-lxtWEkCP.js → Logs-Bt9bZHCg.js} +1 -1
- package/dist/assets/{MotionZonesSettings-PK_RhzUS.js → MotionZonesSettings-DrDb42JA.js} +1 -1
- package/dist/assets/{MyAccess-ByVOiLoY.js → MyAccess-CHyhSK3u.js} +1 -1
- package/dist/assets/Network-DiPcjaq_.js +1 -0
- package/dist/assets/{NodeAddonsSettingsPanel-D604xGht.js → NodeAddonsSettingsPanel-Cr3o3Ujo.js} +1 -1
- package/dist/assets/NodeInferenceDevices-DnBVo7ok.js +1 -0
- package/dist/assets/Notifications-DCPQjEcI.js +1 -0
- package/dist/assets/Pipeline-CSOsf66e.js +1 -0
- package/dist/assets/Plates-CLEIGuVQ.js +1 -0
- package/dist/assets/{PrivacyMaskSettings-BnjtiPUD.js → PrivacyMaskSettings-CsE8o2Uv.js} +1 -1
- package/dist/assets/Recordings-DSVqpOgy.js +1 -0
- package/dist/assets/{ScanNetworkModal-CbBwJI-2.js → ScanNetworkModal-DL3nHyCZ.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-C35-Indg.js → SceneMonitorEditor-MYttqwVI.js} +1 -1
- package/dist/assets/{Scenes-u29K3L8z.js → Scenes-BOx4Mvpv.js} +1 -1
- package/dist/assets/{Settings-B_TdmhVB.js → Settings-MacJqwiQ.js} +1 -1
- package/dist/assets/{Showroom-CmZzpo6R.js → Showroom-C6xljbRB.js} +1 -1
- package/dist/assets/{StorageLocationsPanel-BubFNpD_.js → StorageLocationsPanel-Cv1X1NjV.js} +1 -1
- package/dist/assets/{Terminal-CgmMWRwh.js → Terminal-D96J85VG.js} +3 -3
- package/dist/assets/{Viewer-BpYyXG64.js → Viewer-Bj-zXdCO.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DYaeQRfF.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-B1f3x9Eb.js} +1 -1
- package/dist/assets/{archive-Cr-BIlNA.js → archive-uu0z7Vbk.js} +1 -1
- package/dist/assets/{authed-media-Dsq6dhVf.js → authed-media-Diawm6nx.js} +1 -1
- package/dist/assets/{boxes-C54oMdA_.js → boxes-abVc1Hvk.js} +1 -1
- package/dist/assets/circle-slash-BkxL4upj.js +1 -0
- package/dist/assets/client-DiC53LtD.js +357 -0
- package/dist/assets/{debounced-invalidate-BJmaQT-4.js → debounced-invalidate-C5Qx_AMv.js} +1 -1
- package/dist/assets/{device-integration-icon-DWs_AbRL.js → device-integration-icon-B2kPq0Ge.js} +1 -1
- package/dist/assets/device-picker-model-IJVfx39B.js +1 -0
- package/dist/assets/dist-CyodHhwD.js +357 -0
- package/dist/assets/{dist-cztQPA_y.js → dist-DCMiz6wY.js} +1 -1
- package/dist/assets/{face-bbox-G6Z1voG1.js → face-bbox-Bq3RRIFx.js} +1 -1
- package/dist/assets/{hard-drive-download-C-k_wqAM.js → hard-drive-download-BvgHPGJ2.js} +1 -1
- package/dist/assets/{hostInit-B_WZ2Gy8.js → hostInit-a8Ek4LWp.js} +1 -1
- package/dist/assets/index-D-By8TEI.js +4 -0
- package/dist/assets/index-a-YFw77c.css +2 -0
- package/dist/assets/{layers-CW939zq1.js → layers-sovBK7wv.js} +1 -1
- package/dist/assets/{location-owned-usage-Cn8KruJL.js → location-owned-usage-D_cP9v4r.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-a707d600.js → mf-entry-bootstrap-0-d597973b.js} +2 -2
- package/dist/assets/mount-IJVfx39B.js +1 -0
- package/dist/assets/notification-schedule-field-DY2tWj32.js +1 -0
- package/dist/assets/{player-overlays-BzWBMmxi.js → player-overlays-CmqgH3Pl.js} +1 -1
- package/dist/assets/remoteEntry-RqyefSe0.js +1 -0
- package/dist/assets/{send-DkNVOtAO.js → send-zuGgaWIb.js} +1 -1
- package/dist/assets/{settings-2-C2Xnx-LO.js → settings-2-BYa-yW4F.js} +1 -1
- package/dist/assets/{square-check-big-Cye5KH4u.js → square-check-big-De4GFjbb.js} +1 -1
- package/dist/assets/src-CORgGajV.js +67 -0
- package/dist/assets/{use-scenes-feed-BjyTyZVh.js → use-scenes-feed-Dz80M6w9.js} +1 -1
- package/dist/assets/{use-stationary-objects-bFk21PMu.js → use-stationary-objects-BDdYcKnB.js} +1 -1
- package/dist/assets/useEventInvalidation-IJVfx39B.js +1 -0
- package/dist/assets/{useNodeUrlSelection-CivR-_O-.js → useNodeUrlSelection-CXCDlBFE.js} +1 -1
- package/dist/assets/user-round-BPp-N6Am.js +1 -0
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CK6jZXGF.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DH8oU7rj.js} +2 -2
- package/dist/index.html +8 -8
- package/dist/server/addon.js +405 -23
- package/package.json +1 -1
- package/dist/assets/Addons-CCB5Mhf0.js +0 -1
- package/dist/assets/AiProfiles-CSSe_12X.js +0 -3
- package/dist/assets/Build-BLoEyldh.js +0 -40
- package/dist/assets/Cluster-BO4_UGaX.js +0 -11
- package/dist/assets/CompositionEditor-B6fgYvbE.js +0 -1
- package/dist/assets/Data-CoObUhmn.js +0 -1
- package/dist/assets/DetectionIntelligence-Dmz6stFp.js +0 -1
- package/dist/assets/DeviceDetail-BsBDq47F.js +0 -2
- package/dist/assets/Events-EaZ3wtPc.js +0 -1
- package/dist/assets/Identity-Bc98FIpW.js +0 -1
- package/dist/assets/IntegrationDetail-DaRzcvf1.js +0 -1
- package/dist/assets/Integrations-r_lIevSO.js +0 -1
- package/dist/assets/Locations-BP5dY9EA.js +0 -3
- package/dist/assets/Network-wF6b24iS.js +0 -1
- package/dist/assets/NodeInferenceDevices-DSHgXUIY.js +0 -1
- package/dist/assets/Notifications-CVlNXgoo.js +0 -1
- package/dist/assets/Pipeline-DePIr3MD.js +0 -1
- package/dist/assets/Plates-B-dp-vdZ.js +0 -1
- package/dist/assets/Recordings-CaUwVjZS.js +0 -1
- package/dist/assets/circle-slash-iHyT1430.js +0 -1
- package/dist/assets/client-USvucJT_.js +0 -357
- package/dist/assets/device-picker-model-C7bibG8k.js +0 -1
- package/dist/assets/dist-DAPUZI5S.js +0 -357
- package/dist/assets/index-7VTcgfLR.css +0 -2
- package/dist/assets/index-CV0bhG27.js +0 -4
- package/dist/assets/mount-C7bibG8k.js +0 -1
- package/dist/assets/notification-schedule-field-Bp8DTlPQ.js +0 -1
- package/dist/assets/remoteEntry-Bp8bsjuG.js +0 -1
- package/dist/assets/src-DryjbkTc.js +0 -67
- package/dist/assets/useEventInvalidation-C7bibG8k.js +0 -1
- package/dist/assets/user-round-BjVxqy86.js +0 -1
package/dist/server/addon.js
CHANGED
|
@@ -10533,6 +10533,40 @@ var ModelFormatEntrySchema = object({
|
|
|
10533
10533
|
revision: string().min(1).optional()
|
|
10534
10534
|
});
|
|
10535
10535
|
/**
|
|
10536
|
+
* What a node holds for one (model, format) (D746). `current` is a complete
|
|
10537
|
+
* copy at its catalog revision — exactly what `downloaded: true` means.
|
|
10538
|
+
* `stale` is bytes on disk that are not (yet) proven current under D743/D744:
|
|
10539
|
+
* no or a different revision record, or a missing sibling. `missing` is no
|
|
10540
|
+
* copy. `downloaded` alone folds `stale` into "not downloaded", which hid
|
|
10541
|
+
* reclaimable bytes and a copy about to be replaced.
|
|
10542
|
+
*/
|
|
10543
|
+
var ModelOnDiskStateSchema = _enum([
|
|
10544
|
+
"current",
|
|
10545
|
+
"stale",
|
|
10546
|
+
"missing"
|
|
10547
|
+
]);
|
|
10548
|
+
/**
|
|
10549
|
+
* The numeric precision of one format's BUILD (D746) — reported only when the
|
|
10550
|
+
* build states it (file-name token, an INT8 variant, an EdgeTPU compile, a
|
|
10551
|
+
* CamStack Core ML export). Absent means "not stated", never "fp32".
|
|
10552
|
+
*/
|
|
10553
|
+
var ModelFormatPrecisionSchema = _enum([
|
|
10554
|
+
"fp32",
|
|
10555
|
+
"fp16",
|
|
10556
|
+
"int8"
|
|
10557
|
+
]);
|
|
10558
|
+
/**
|
|
10559
|
+
* One format of one model as a node's `pipelineExecutor.getSchema` reports it.
|
|
10560
|
+
* `onDisk` / `precision` are optional for version skew: a runner that predates
|
|
10561
|
+
* them omits them, and a reader falls back to `downloaded`.
|
|
10562
|
+
*/
|
|
10563
|
+
var PipelineModelFormatStatusSchema = object({
|
|
10564
|
+
downloaded: boolean(),
|
|
10565
|
+
sizeMB: number(),
|
|
10566
|
+
onDisk: ModelOnDiskStateSchema.optional(),
|
|
10567
|
+
precision: ModelFormatPrecisionSchema.optional()
|
|
10568
|
+
});
|
|
10569
|
+
/**
|
|
10536
10570
|
* Extra file that must be downloaded alongside the model (e.g., labels JSON, dict.txt).
|
|
10537
10571
|
* The downloader fetches from `url` and saves to `{modelsDir}/{filename}`.
|
|
10538
10572
|
*/
|
|
@@ -23169,7 +23203,7 @@ var FrameRefSchema = object({
|
|
|
23169
23203
|
timestamp: number(),
|
|
23170
23204
|
capturedAt: number().optional()
|
|
23171
23205
|
});
|
|
23172
|
-
var ModelFormatSchema$
|
|
23206
|
+
var ModelFormatSchema$2 = _enum([
|
|
23173
23207
|
"onnx",
|
|
23174
23208
|
"coreml",
|
|
23175
23209
|
"openvino",
|
|
@@ -23187,7 +23221,7 @@ var PipelineSlotSchema = _enum([
|
|
|
23187
23221
|
var PipelineEngineChoiceSchema = object({
|
|
23188
23222
|
runtime: literal("python"),
|
|
23189
23223
|
backend: string(),
|
|
23190
|
-
format: ModelFormatSchema$
|
|
23224
|
+
format: ModelFormatSchema$2,
|
|
23191
23225
|
device: string().optional()
|
|
23192
23226
|
});
|
|
23193
23227
|
/**
|
|
@@ -23244,10 +23278,7 @@ var PipelineTemplateSchema$1 = object({
|
|
|
23244
23278
|
var PipelineModelOptionSchema = object({
|
|
23245
23279
|
id: string(),
|
|
23246
23280
|
name: string(),
|
|
23247
|
-
formats: record(string(),
|
|
23248
|
-
downloaded: boolean(),
|
|
23249
|
-
sizeMB: number()
|
|
23250
|
-
})),
|
|
23281
|
+
formats: record(string(), PipelineModelFormatStatusSchema),
|
|
23251
23282
|
group: ModelVariantGroupSchema.optional(),
|
|
23252
23283
|
legacy: boolean().optional(),
|
|
23253
23284
|
provider: ModelProviderIdSchema.optional(),
|
|
@@ -23414,6 +23445,22 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
23414
23445
|
}), {
|
|
23415
23446
|
kind: "mutation",
|
|
23416
23447
|
auth: "admin"
|
|
23448
|
+
}), method(object({
|
|
23449
|
+
nodeId: string(),
|
|
23450
|
+
deviceIds: array(number()).readonly().optional(),
|
|
23451
|
+
dryRun: boolean()
|
|
23452
|
+
}), object({
|
|
23453
|
+
entries: array(object({
|
|
23454
|
+
deviceId: number(),
|
|
23455
|
+
keys: array(string()).readonly()
|
|
23456
|
+
})).readonly(),
|
|
23457
|
+
refused: array(object({
|
|
23458
|
+
deviceId: number(),
|
|
23459
|
+
reason: string()
|
|
23460
|
+
})).readonly()
|
|
23461
|
+
}), {
|
|
23462
|
+
kind: "mutation",
|
|
23463
|
+
auth: "admin"
|
|
23417
23464
|
}), method(object({ nodeId: string() }), object({ unhealthy: array(object({
|
|
23418
23465
|
/** `<backend>:<device>`, e.g. `openvino:gpu`. */
|
|
23419
23466
|
deviceKey: string(),
|
|
@@ -23450,11 +23497,11 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
23450
23497
|
}), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
|
|
23451
23498
|
addonId: string(),
|
|
23452
23499
|
modelId: string(),
|
|
23453
|
-
format: ModelFormatSchema$
|
|
23500
|
+
format: ModelFormatSchema$2
|
|
23454
23501
|
}), DownloadModelResultSchema, { kind: "mutation" }), method(object({
|
|
23455
23502
|
addonId: string(),
|
|
23456
23503
|
modelId: string(),
|
|
23457
|
-
format: ModelFormatSchema$
|
|
23504
|
+
format: ModelFormatSchema$2
|
|
23458
23505
|
}), object({ success: literal(true) }), { kind: "mutation" }), method(object({
|
|
23459
23506
|
steps: array(PipelineStepInputSchema).min(1),
|
|
23460
23507
|
frame: FrameInputSchema.optional(),
|
|
@@ -23611,6 +23658,307 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
23611
23658
|
filename: string().optional(),
|
|
23612
23659
|
settings: record(string(), unknown()).optional()
|
|
23613
23660
|
}), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
|
|
23661
|
+
/**
|
|
23662
|
+
* Wire shapes of the Load balancing surface (D748): the session placement
|
|
23663
|
+
* policy, the atomic share write, the observed placement statistics, the
|
|
23664
|
+
* hardware share suggestion and the stale device pins.
|
|
23665
|
+
*/
|
|
23666
|
+
/**
|
|
23667
|
+
* How a new detection session picks its node and device.
|
|
23668
|
+
* - `least-loaded` — the historical rule: lowest `attached / weight`, a
|
|
23669
|
+
* constant node order at a tie (D37). An idle node always ties at 0, so a
|
|
23670
|
+
* weight only bites once a node already holds a session.
|
|
23671
|
+
* - `share` — the share of PARALLEL sessions is held to the weights, and a
|
|
23672
|
+
* full or drowning node yields to a free one (D748).
|
|
23673
|
+
*/
|
|
23674
|
+
var SessionPlacementPolicySchema = _enum(["least-loaded", "share"]);
|
|
23675
|
+
var LoadBalancingSharesInputSchema = object({
|
|
23676
|
+
/** nodeId → share (> 0). A node left out keeps its weight. */
|
|
23677
|
+
nodes: record(string(), number().positive()).default({}),
|
|
23678
|
+
/** nodeId → deviceKey → share (> 0). A device left out keeps its weight. */
|
|
23679
|
+
devices: record(string(), record(string(), number().positive())).default({})
|
|
23680
|
+
});
|
|
23681
|
+
var PlacementStatsInputSchema = object({
|
|
23682
|
+
/** Window the observed shares are averaged over (default 1 h, max 24 h). */
|
|
23683
|
+
windowMs: number().int().min(6e4).max(1440 * 60 * 1e3).default(3600 * 1e3) });
|
|
23684
|
+
var PlacementDeviceStatsSchema = object({
|
|
23685
|
+
deviceKey: string(),
|
|
23686
|
+
/** Sessions running on this device now. */
|
|
23687
|
+
sessionsNow: number(),
|
|
23688
|
+
/** Sessions started on this device inside the window. */
|
|
23689
|
+
sessionsStarted: number(),
|
|
23690
|
+
/** Time-weighted share of the node's parallel sessions over the window (0–1); null = no session ran. */
|
|
23691
|
+
observedShare: number().nullable()
|
|
23692
|
+
});
|
|
23693
|
+
var PlacementNodeStatsSchema = object({
|
|
23694
|
+
nodeId: string(),
|
|
23695
|
+
sessionsNow: number(),
|
|
23696
|
+
sessionsStarted: number(),
|
|
23697
|
+
/** Time-weighted share of the cluster's parallel sessions over the window (0–1); null = none ran. */
|
|
23698
|
+
observedShare: number().nullable(),
|
|
23699
|
+
/** Most sessions this node ran at once inside the window. */
|
|
23700
|
+
peakSessions: number(),
|
|
23701
|
+
/** Sessions a share election handed elsewhere because this node was full or drowning. */
|
|
23702
|
+
yieldsAway: number(),
|
|
23703
|
+
devices: array(PlacementDeviceStatsSchema).readonly()
|
|
23704
|
+
});
|
|
23705
|
+
/** A camera's device pin that the session path cannot honour. */
|
|
23706
|
+
var StaleDevicePinSchema = object({
|
|
23707
|
+
deviceId: number(),
|
|
23708
|
+
deviceKey: string(),
|
|
23709
|
+
/** `disabled` — the key exists on some node but is not enabled anywhere; `absent` — no node has it. */
|
|
23710
|
+
reason: _enum(["disabled", "absent"])
|
|
23711
|
+
});
|
|
23712
|
+
var PlacementStatsSchema = object({
|
|
23713
|
+
policy: SessionPlacementPolicySchema,
|
|
23714
|
+
windowMs: number(),
|
|
23715
|
+
/** How much of the window was actually observed (the hub keeps it in memory). */
|
|
23716
|
+
observedForMs: number(),
|
|
23717
|
+
sessionsNow: number(),
|
|
23718
|
+
/** Most parallel sessions across the cluster inside the window. */
|
|
23719
|
+
clusterPeakSessions: number(),
|
|
23720
|
+
nodes: array(PlacementNodeStatsSchema).readonly(),
|
|
23721
|
+
stalePins: array(StaleDevicePinSchema).readonly()
|
|
23722
|
+
});
|
|
23723
|
+
var SuggestSharesInputSchema = object({ headroom: number().min(.3).max(.5).default(.4) });
|
|
23724
|
+
var SuggestedDeviceShareSchema = object({
|
|
23725
|
+
deviceKey: string(),
|
|
23726
|
+
/** Share of the node (0–100, rounded). */
|
|
23727
|
+
share: number(),
|
|
23728
|
+
modelId: string().nullable(),
|
|
23729
|
+
/** Inferences per second at that model, from the measured table. */
|
|
23730
|
+
fps: number().nullable(),
|
|
23731
|
+
measured: boolean(),
|
|
23732
|
+
/** Advisory session cap: ⌊fps × (1 − headroom) / camera fps⌋. Never enforced. */
|
|
23733
|
+
suggestedMaxSessions: number().nullable()
|
|
23734
|
+
});
|
|
23735
|
+
var SuggestedNodeShareSchema = object({
|
|
23736
|
+
nodeId: string(),
|
|
23737
|
+
/** Share of the cluster (0–100, rounded); null = node skipped (offline, unknown hardware). */
|
|
23738
|
+
share: number().nullable(),
|
|
23739
|
+
/** Parallel sessions the node sustains at the suggested models with the headroom kept free. */
|
|
23740
|
+
capacitySessions: number(),
|
|
23741
|
+
devices: array(SuggestedDeviceShareSchema).readonly(),
|
|
23742
|
+
skippedReason: string().nullable()
|
|
23743
|
+
});
|
|
23744
|
+
var SuggestSharesResultSchema = object({
|
|
23745
|
+
headroom: number(),
|
|
23746
|
+
/** Camera detection rate the capacity is counted in (the fastest camera's fps). */
|
|
23747
|
+
cameraFps: number(),
|
|
23748
|
+
/** How many share → model → capacity rounds ran before the shares stopped moving (≤ 3). */
|
|
23749
|
+
iterations: number(),
|
|
23750
|
+
nodes: array(SuggestedNodeShareSchema).readonly()
|
|
23751
|
+
});
|
|
23752
|
+
/**
|
|
23753
|
+
* The wire shapes of the Best settings plan and apply (D745), used by the
|
|
23754
|
+
* `pipeline-orchestrator` cap. The recommender's own types
|
|
23755
|
+
* (`recommend.ts`, `demand.ts`) are the TS face of the same data; these
|
|
23756
|
+
* schemas are what crosses the cap boundary.
|
|
23757
|
+
*/
|
|
23758
|
+
var ModelFormatSchema$1 = _enum(MODEL_FORMATS);
|
|
23759
|
+
var HardwareClassIdSchema = _enum([
|
|
23760
|
+
"intel-core-ultra",
|
|
23761
|
+
"intel-n-series",
|
|
23762
|
+
"apple-m-base",
|
|
23763
|
+
"apple-m-pro",
|
|
23764
|
+
"unknown"
|
|
23765
|
+
]);
|
|
23766
|
+
var AcceleratorKindSchema = _enum([
|
|
23767
|
+
"intel-npu",
|
|
23768
|
+
"intel-igpu",
|
|
23769
|
+
"x86-cpu",
|
|
23770
|
+
"arm-cpu",
|
|
23771
|
+
"apple-ane",
|
|
23772
|
+
"coral"
|
|
23773
|
+
]);
|
|
23774
|
+
var RecommendationReasonSchema = discriminatedUnion("kind", [
|
|
23775
|
+
object({
|
|
23776
|
+
kind: literal("fits"),
|
|
23777
|
+
utilisation: number()
|
|
23778
|
+
}),
|
|
23779
|
+
object({
|
|
23780
|
+
kind: literal("tie-faster"),
|
|
23781
|
+
over: string(),
|
|
23782
|
+
recallDelta: number()
|
|
23783
|
+
}),
|
|
23784
|
+
object({
|
|
23785
|
+
kind: literal("stepped-down"),
|
|
23786
|
+
from: string(),
|
|
23787
|
+
to: string(),
|
|
23788
|
+
limitedBy: string()
|
|
23789
|
+
}),
|
|
23790
|
+
object({
|
|
23791
|
+
kind: literal("no-fit-lightest"),
|
|
23792
|
+
utilisation: number()
|
|
23793
|
+
}),
|
|
23794
|
+
object({
|
|
23795
|
+
kind: literal("derived-latency"),
|
|
23796
|
+
modelId: string()
|
|
23797
|
+
}),
|
|
23798
|
+
object({
|
|
23799
|
+
kind: literal("estimated-load"),
|
|
23800
|
+
observedForMs: number().nullable()
|
|
23801
|
+
}),
|
|
23802
|
+
object({ kind: literal("cpu-device") }),
|
|
23803
|
+
object({ kind: literal("coral-untouched") }),
|
|
23804
|
+
object({ kind: literal("device-disabled") }),
|
|
23805
|
+
object({ kind: literal("device-unavailable") }),
|
|
23806
|
+
object({ kind: literal("node-offline") }),
|
|
23807
|
+
object({ kind: literal("no-hardware-facts") }),
|
|
23808
|
+
object({
|
|
23809
|
+
kind: literal("no-measured-data"),
|
|
23810
|
+
hardwareClass: HardwareClassIdSchema
|
|
23811
|
+
}),
|
|
23812
|
+
object({
|
|
23813
|
+
kind: literal("no-family-build"),
|
|
23814
|
+
format: ModelFormatSchema$1
|
|
23815
|
+
})
|
|
23816
|
+
]);
|
|
23817
|
+
var DeviceDemandSchema = object({
|
|
23818
|
+
nodeId: string(),
|
|
23819
|
+
deviceKey: string(),
|
|
23820
|
+
demandFps: number(),
|
|
23821
|
+
maxCameraFps: number(),
|
|
23822
|
+
alwaysOnCameras: number(),
|
|
23823
|
+
onMotionSessions: number(),
|
|
23824
|
+
onMotionSource: _enum([
|
|
23825
|
+
"observed-24h",
|
|
23826
|
+
"estimate",
|
|
23827
|
+
"none"
|
|
23828
|
+
]),
|
|
23829
|
+
observedForMs: number().nullable(),
|
|
23830
|
+
/** How on-motion sessions were charged: per-device observation, or split by share (D748). */
|
|
23831
|
+
placement: SessionPlacementPolicySchema
|
|
23832
|
+
});
|
|
23833
|
+
var DeviceModelChoiceSchema = object({
|
|
23834
|
+
modelId: string(),
|
|
23835
|
+
p50Ms: number(),
|
|
23836
|
+
fps: number(),
|
|
23837
|
+
measured: boolean(),
|
|
23838
|
+
utilisation: number(),
|
|
23839
|
+
personRecall: number()
|
|
23840
|
+
});
|
|
23841
|
+
var DeviceRecommendationSchema = object({
|
|
23842
|
+
deviceKey: string(),
|
|
23843
|
+
accelerator: AcceleratorKindSchema.nullable(),
|
|
23844
|
+
enabled: boolean(),
|
|
23845
|
+
available: boolean(),
|
|
23846
|
+
demand: DeviceDemandSchema.nullable(),
|
|
23847
|
+
chosen: DeviceModelChoiceSchema.nullable(),
|
|
23848
|
+
reasons: array(RecommendationReasonSchema).readonly()
|
|
23849
|
+
});
|
|
23850
|
+
var NodeRecommendationSchema = object({
|
|
23851
|
+
nodeId: string(),
|
|
23852
|
+
reachable: boolean(),
|
|
23853
|
+
hardwareClass: HardwareClassIdSchema.nullable(),
|
|
23854
|
+
cpuModel: string().nullable(),
|
|
23855
|
+
skipped: boolean(),
|
|
23856
|
+
acceleratorModelId: string().nullable(),
|
|
23857
|
+
devices: array(DeviceRecommendationSchema).readonly(),
|
|
23858
|
+
reasons: array(RecommendationReasonSchema).readonly()
|
|
23859
|
+
});
|
|
23860
|
+
var ModelPinChangeSchema = object({
|
|
23861
|
+
stepId: string(),
|
|
23862
|
+
before: string().nullable(),
|
|
23863
|
+
after: string().nullable()
|
|
23864
|
+
});
|
|
23865
|
+
var NodeDeviceChangeSchema = object({
|
|
23866
|
+
nodeId: string(),
|
|
23867
|
+
deviceKey: string(),
|
|
23868
|
+
madeExplicit: boolean(),
|
|
23869
|
+
modelPins: array(ModelPinChangeSchema).readonly(),
|
|
23870
|
+
thresholds: array(object({
|
|
23871
|
+
stepId: string(),
|
|
23872
|
+
keys: array(string()).readonly()
|
|
23873
|
+
})).readonly()
|
|
23874
|
+
});
|
|
23875
|
+
var CameraOverrideClearSchema = object({
|
|
23876
|
+
deviceId: number(),
|
|
23877
|
+
source: _enum(["step-override", "wholesale"]),
|
|
23878
|
+
nodeId: string(),
|
|
23879
|
+
deviceKey: string().nullable(),
|
|
23880
|
+
stepId: string(),
|
|
23881
|
+
modelIdBefore: string().nullable(),
|
|
23882
|
+
keys: array(string()).readonly()
|
|
23883
|
+
});
|
|
23884
|
+
var DetectorStoreClearSchema = object({
|
|
23885
|
+
deviceId: number(),
|
|
23886
|
+
keys: array(string()).readonly()
|
|
23887
|
+
});
|
|
23888
|
+
var BestSettingsWarningSchema = discriminatedUnion("kind", [
|
|
23889
|
+
object({
|
|
23890
|
+
kind: literal("detector-store-cluster-wide"),
|
|
23891
|
+
skippedNodes: array(string()).readonly()
|
|
23892
|
+
}),
|
|
23893
|
+
object({
|
|
23894
|
+
kind: literal("detector-store-unreadable"),
|
|
23895
|
+
error: string()
|
|
23896
|
+
}),
|
|
23897
|
+
object({
|
|
23898
|
+
kind: literal("coral-enabled"),
|
|
23899
|
+
nodeId: string(),
|
|
23900
|
+
deviceKey: string()
|
|
23901
|
+
})
|
|
23902
|
+
]);
|
|
23903
|
+
var BestSettingsOptionsSchema = object({
|
|
23904
|
+
/** Share of each accelerator's throughput kept free (0.3–0.5). */
|
|
23905
|
+
headroom: number().min(.3).max(.5).default(.4),
|
|
23906
|
+
/**
|
|
23907
|
+
* What-if shares (D748): plan as if these node/device shares were stored
|
|
23908
|
+
* and the policy were `share`. Absent = the stored shares under the stored
|
|
23909
|
+
* policy. A what-if plan is for display; apply always re-plans from what
|
|
23910
|
+
* is stored.
|
|
23911
|
+
*/
|
|
23912
|
+
shares: LoadBalancingSharesInputSchema.optional()
|
|
23913
|
+
});
|
|
23914
|
+
var BestSettingsPlanSchema = object({
|
|
23915
|
+
/** Hash of everything the apply will write — the apply refuses a different one. */
|
|
23916
|
+
planHash: string(),
|
|
23917
|
+
family: literal("yolov9"),
|
|
23918
|
+
headroom: number(),
|
|
23919
|
+
/** Planned under what-if shares (D748): for display — apply refuses it as stale. */
|
|
23920
|
+
whatIf: boolean(),
|
|
23921
|
+
generatedAt: number(),
|
|
23922
|
+
nodes: array(NodeRecommendationSchema).readonly(),
|
|
23923
|
+
nodeChanges: array(NodeDeviceChangeSchema).readonly(),
|
|
23924
|
+
cameraClears: array(CameraOverrideClearSchema).readonly(),
|
|
23925
|
+
detectorStoreClears: array(DetectorStoreClearSchema).readonly(),
|
|
23926
|
+
warnings: array(BestSettingsWarningSchema).readonly()
|
|
23927
|
+
});
|
|
23928
|
+
var BestSettingsApplyInputSchema = object({
|
|
23929
|
+
planHash: string(),
|
|
23930
|
+
headroom: number().min(.3).max(.5).default(.4)
|
|
23931
|
+
});
|
|
23932
|
+
var BestSettingsPhaseResultSchema = object({
|
|
23933
|
+
phase: _enum([
|
|
23934
|
+
"download",
|
|
23935
|
+
"camera-overrides",
|
|
23936
|
+
"detector-thresholds",
|
|
23937
|
+
"node-models",
|
|
23938
|
+
"redispatch"
|
|
23939
|
+
]),
|
|
23940
|
+
ok: boolean(),
|
|
23941
|
+
detail: string()
|
|
23942
|
+
});
|
|
23943
|
+
var BestSettingsApplyResultSchema = discriminatedUnion("kind", [
|
|
23944
|
+
object({
|
|
23945
|
+
kind: literal("applied"),
|
|
23946
|
+
planHash: string(),
|
|
23947
|
+
phases: array(BestSettingsPhaseResultSchema).readonly()
|
|
23948
|
+
}),
|
|
23949
|
+
object({
|
|
23950
|
+
kind: literal("aborted"),
|
|
23951
|
+
phases: array(BestSettingsPhaseResultSchema).readonly()
|
|
23952
|
+
}),
|
|
23953
|
+
object({
|
|
23954
|
+
kind: literal("stale"),
|
|
23955
|
+
plan: BestSettingsPlanSchema
|
|
23956
|
+
}),
|
|
23957
|
+
object({
|
|
23958
|
+
kind: literal("refused"),
|
|
23959
|
+
reason: _enum(["apply-in-progress"])
|
|
23960
|
+
})
|
|
23961
|
+
]);
|
|
23614
23962
|
object({
|
|
23615
23963
|
activeCameras: number(),
|
|
23616
23964
|
throttledCameras: number(),
|
|
@@ -24791,7 +25139,6 @@ var CameraStepOverridePatchSchema = object({
|
|
|
24791
25139
|
settings: record(string(), unknown()).readonly().optional()
|
|
24792
25140
|
});
|
|
24793
25141
|
var CameraPipelineSettingsSchema = object({
|
|
24794
|
-
pinnedAgentNodeId: string().optional(),
|
|
24795
25142
|
stepToggles: record(string(), boolean()).optional(),
|
|
24796
25143
|
stepOverridesByDevice: record(string(), record(string(), record(string(), CameraStepOverridePatchSchema))).optional(),
|
|
24797
25144
|
pipelineByAgent: record(string(), CameraPipelineForAgentSchema).optional()
|
|
@@ -25290,12 +25637,6 @@ method(object({
|
|
|
25290
25637
|
}), object({ success: literal(true) }), {
|
|
25291
25638
|
kind: "mutation",
|
|
25292
25639
|
auth: "admin"
|
|
25293
|
-
}), method(object({
|
|
25294
|
-
agentNodeId: string(),
|
|
25295
|
-
detectWeight: number().positive().nullable()
|
|
25296
|
-
}), object({ success: literal(true) }), {
|
|
25297
|
-
kind: "mutation",
|
|
25298
|
-
auth: "admin"
|
|
25299
25640
|
}), method(object({
|
|
25300
25641
|
agentNodeId: string(),
|
|
25301
25642
|
detect: boolean().nullable().optional(),
|
|
@@ -25337,7 +25678,13 @@ method(object({
|
|
|
25337
25678
|
}), {
|
|
25338
25679
|
kind: "mutation",
|
|
25339
25680
|
auth: "admin"
|
|
25340
|
-
}), method(
|
|
25681
|
+
}), method(BestSettingsOptionsSchema, BestSettingsPlanSchema, { auth: "admin" }), method(BestSettingsApplyInputSchema, BestSettingsApplyResultSchema, {
|
|
25682
|
+
kind: "mutation",
|
|
25683
|
+
auth: "admin"
|
|
25684
|
+
}), method(LoadBalancingSharesInputSchema, object({ success: literal(true) }), {
|
|
25685
|
+
kind: "mutation",
|
|
25686
|
+
auth: "admin"
|
|
25687
|
+
}), method(PlacementStatsInputSchema, PlacementStatsSchema, { auth: "admin" }), method(SuggestSharesInputSchema, SuggestSharesResultSchema, { auth: "admin" }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
25341
25688
|
deviceId: number(),
|
|
25342
25689
|
addonId: string(),
|
|
25343
25690
|
enabled: boolean().nullable()
|
|
@@ -40912,6 +41259,12 @@ Object.freeze({
|
|
|
40912
41259
|
addonId: null,
|
|
40913
41260
|
access: "delete"
|
|
40914
41261
|
},
|
|
41262
|
+
"pipelineExecutor.clearModelBoundDeviceOverrides": {
|
|
41263
|
+
capName: "pipeline-executor",
|
|
41264
|
+
capScope: "system",
|
|
41265
|
+
addonId: null,
|
|
41266
|
+
access: "delete"
|
|
41267
|
+
},
|
|
40915
41268
|
"pipelineExecutor.deleteModel": {
|
|
40916
41269
|
capName: "pipeline-executor",
|
|
40917
41270
|
capScope: "system",
|
|
@@ -41128,6 +41481,12 @@ Object.freeze({
|
|
|
41128
41481
|
addonId: null,
|
|
41129
41482
|
access: "view"
|
|
41130
41483
|
},
|
|
41484
|
+
"pipelineOrchestrator.applyBestSettings": {
|
|
41485
|
+
capName: "pipeline-orchestrator",
|
|
41486
|
+
capScope: "system",
|
|
41487
|
+
addonId: null,
|
|
41488
|
+
access: "create"
|
|
41489
|
+
},
|
|
41131
41490
|
"pipelineOrchestrator.applyDeviceSettingsPatch": {
|
|
41132
41491
|
capName: "pipeline-orchestrator",
|
|
41133
41492
|
capScope: "system",
|
|
@@ -41278,6 +41637,12 @@ Object.freeze({
|
|
|
41278
41637
|
addonId: null,
|
|
41279
41638
|
access: "view"
|
|
41280
41639
|
},
|
|
41640
|
+
"pipelineOrchestrator.getPlacementStats": {
|
|
41641
|
+
capName: "pipeline-orchestrator",
|
|
41642
|
+
capScope: "system",
|
|
41643
|
+
addonId: null,
|
|
41644
|
+
access: "view"
|
|
41645
|
+
},
|
|
41281
41646
|
"pipelineOrchestrator.getReconcileFromDiskStatus": {
|
|
41282
41647
|
capName: "pipeline-orchestrator",
|
|
41283
41648
|
capScope: "system",
|
|
@@ -41302,6 +41667,12 @@ Object.freeze({
|
|
|
41302
41667
|
addonId: null,
|
|
41303
41668
|
access: "create"
|
|
41304
41669
|
},
|
|
41670
|
+
"pipelineOrchestrator.planBestSettings": {
|
|
41671
|
+
capName: "pipeline-orchestrator",
|
|
41672
|
+
capScope: "system",
|
|
41673
|
+
addonId: null,
|
|
41674
|
+
access: "view"
|
|
41675
|
+
},
|
|
41305
41676
|
"pipelineOrchestrator.rebalance": {
|
|
41306
41677
|
capName: "pipeline-orchestrator",
|
|
41307
41678
|
capScope: "system",
|
|
@@ -41362,12 +41733,6 @@ Object.freeze({
|
|
|
41362
41733
|
addonId: null,
|
|
41363
41734
|
access: "create"
|
|
41364
41735
|
},
|
|
41365
|
-
"pipelineOrchestrator.setAgentDetectWeight": {
|
|
41366
|
-
capName: "pipeline-orchestrator",
|
|
41367
|
-
capScope: "system",
|
|
41368
|
-
addonId: null,
|
|
41369
|
-
access: "create"
|
|
41370
|
-
},
|
|
41371
41736
|
"pipelineOrchestrator.setAgentInferenceDevices": {
|
|
41372
41737
|
capName: "pipeline-orchestrator",
|
|
41373
41738
|
capScope: "system",
|
|
@@ -41422,12 +41787,24 @@ Object.freeze({
|
|
|
41422
41787
|
addonId: null,
|
|
41423
41788
|
access: "create"
|
|
41424
41789
|
},
|
|
41790
|
+
"pipelineOrchestrator.setLoadBalancingShares": {
|
|
41791
|
+
capName: "pipeline-orchestrator",
|
|
41792
|
+
capScope: "system",
|
|
41793
|
+
addonId: null,
|
|
41794
|
+
access: "create"
|
|
41795
|
+
},
|
|
41425
41796
|
"pipelineOrchestrator.setPipelineDevicePin": {
|
|
41426
41797
|
capName: "pipeline-orchestrator",
|
|
41427
41798
|
capScope: "system",
|
|
41428
41799
|
addonId: null,
|
|
41429
41800
|
access: "create"
|
|
41430
41801
|
},
|
|
41802
|
+
"pipelineOrchestrator.suggestShares": {
|
|
41803
|
+
capName: "pipeline-orchestrator",
|
|
41804
|
+
capScope: "system",
|
|
41805
|
+
addonId: null,
|
|
41806
|
+
access: "view"
|
|
41807
|
+
},
|
|
41431
41808
|
"pipelineOrchestrator.unassignAudio": {
|
|
41432
41809
|
capName: "pipeline-orchestrator",
|
|
41433
41810
|
capScope: "system",
|
|
@@ -46724,6 +47101,11 @@ Object.freeze({
|
|
|
46724
47101
|
form: "single",
|
|
46725
47102
|
optional: false
|
|
46726
47103
|
}],
|
|
47104
|
+
"pipelineExecutor.clearModelBoundDeviceOverrides": [{
|
|
47105
|
+
name: "deviceIds",
|
|
47106
|
+
form: "array",
|
|
47107
|
+
optional: true
|
|
47108
|
+
}],
|
|
46727
47109
|
"pipelineExecutor.runPipeline": [{
|
|
46728
47110
|
name: "deviceId",
|
|
46729
47111
|
form: "single",
|
|
@@ -48763,7 +49145,7 @@ var AdminUIAddon = class extends BaseAddon {
|
|
|
48763
49145
|
capability: adminUiCapability,
|
|
48764
49146
|
provider: {
|
|
48765
49147
|
getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
|
|
48766
|
-
getVersion: async () => ({ version: "1.2.
|
|
49148
|
+
getVersion: async () => ({ version: "1.2.344" })
|
|
48767
49149
|
}
|
|
48768
49150
|
}];
|
|
48769
49151
|
}
|
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{Z as d,gt as f,st as p,vt as m}from"./player-overlays-BzWBMmxi.js";import{Cl as h,Cr as ee,Cu as g,Fl as _,Fn as v,Pu as y,Ql as b,R as x,Sr as S,_o as C,_r as te,_u as ne,ar as re,au as w,bu as ie,cr as ae,cu as oe,dd as T,dr as E,fr as D,gd as se,gl as O,gr as ce,ht as le,ir as k,k as A,lr as j,mr as ue,mt as M,mu as N,or as de,pr as P,rd as F,rr as I,sr as L,su as fe,tr as pe,vr as R,xd as z,xr as me,yd as B,yl as V,yr as H}from"./src-DryjbkTc.js";import{Gr as U}from"./client-USvucJT_.js";import"./mount-C7bibG8k.js";import{F as he,N as ge}from"./index-CV0bhG27.js";import{t as W}from"./AdminPage-CiKtOLQm.js";import{t as _e}from"./NodeAddonsSettingsPanel-D604xGht.js";import{r as G,t as K}from"./useNodeUrlSelection-CivR-_O-.js";var q=m(`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`}]]);n();var J=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),ve=new Set([`done`,`failed`,`skipped`]);function Y(e){return!ve.has(e.phase)&&!J.has(e.jobState)}function X(e,t){let n=new Map,r=[...e].sort((e,t)=>e.createdAtMs-t.createdAtMs);for(let e of r){let r=J.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 Z(){let{data:e}=E({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:t}=V(U.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 X([...n.values()],Date.now())},[e,t])}var ye={queued:{icon:T,cls:`bg-muted text-foreground-subtle`,label:`queued`},fetching:{icon:y,cls:`bg-primary/10 text-primary`,label:`fetching`,spin:!0},staged:{icon:y,cls:`bg-primary/10 text-primary`,label:`staged`,spin:!0},validating:{icon:y,cls:`bg-primary/10 text-primary`,label:`validating`,spin:!0},applying:{icon:y,cls:`bg-primary/10 text-primary`,label:`applying`,spin:!0},restarting:{icon:y,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,label:`restarting`,spin:!0},applied:{icon:y,cls:`bg-primary/10 text-primary`,label:`finalizing`,spin:!0},done:{icon:z,cls:`bg-success/10 text-success`,label:`updated`},failed:{icon:q,cls:`bg-danger/10 text-danger`,label:`failed`},skipped:{icon:b,cls:`bg-muted text-foreground-subtle`,label:`skipped`}};function be({progress:e}){let t=ye[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 xe({packageName:e,currentVersion:t,installSource:n,onInstall:r,onClose:a,onSelect:s,selectedVersion:c}){let u=n===`upload`||n===`local`,{data:d,isLoading:f}=L({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(h,{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(_,{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(y,{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(F,{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 Se={queued:{icon:T,bg:`bg-muted text-foreground-subtle`,label:`queued`},updating:{icon:y,bg:`bg-primary/10 text-primary`,label:`updating`,spin:!0},"done-pending-restart":{icon:N,bg:`bg-amber-500/10 text-amber-700`,label:`pending restart`},done:{icon:z,bg:`bg-success/10 text-success`,label:`done`},failed:{icon:q,bg:`bg-danger/10 text-danger`,label:`failed`}};function Q({item:e}){let t=Se[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 Ce=`device-export`;function we(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===Ce)}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,f=e?`bg-indigo-500/20 text-indigo-700 dark:text-indigo-300`:`bg-purple-500/20 text-purple-700 dark:text-purple-300`,p=n&&r?d(`/api/addon-assets/${n}/${r}`):null,m=!!p&&!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?``:f}`,style:u,children:m?l(`img`,{src:p,alt:n,className:`h-5 w-5`,onError:()=>s(!0)}):l(e?g:ne,{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(_,{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(y,{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(F,{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`}=k({addonId:e}),r=R({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:d,isUpdating:m,jobProgress:ee,bundle:_,bulkItem:y,disabledByBulk:b,isSystem:C}){let[te,ne]=c(!1),[re,T]=c(!1),[E,D]=c(!1),[se,O]=c(null);u(()=>{O(null)},[a]);let k=se??a,[A,j]=c(!1),[de,P]=c(!1),[F,I]=c(`logs`),L=s(),fe=ge(),pe=v(),{manifest:R}=e,z=e.installedOn??[],me=!_&&!R.protected&&R.removable!==!1,V=!!_,H=_?.displayName??R.name,U=_?.packageName??R.packageName,he=_?.version??R.packageVersion??R.version,W=_?.installSource??e.installSource,G=_?_.bundle?.description??_.addons[0]?.manifest.description:R.description,K=S({onSuccess:()=>{L.invalidateQueries({queryKey:[[`addons`]]}),L.invalidateQueries({queryKey:[[`addonPages`]]}),L.invalidateQueries({queryKey:[[`capabilities`]]})}}),J=ue({onSuccess:()=>{L.invalidateQueries({queryKey:[[`addons`]]})}}),ve=ae({onSuccess:()=>{L.invalidateQueries({queryKey:[[`addons`]]}),L.invalidateQueries({queryKey:[[`addonPages`]]}),L.invalidateQueries({queryKey:[[`capabilities`]]}),L.invalidateQueries({queryKey:[[`integrations`]]})}}),Y=ce({onSuccess:()=>{L.invalidateQueries({queryKey:[[`addons`]]}),L.invalidateQueries({queryKey:[[`alerts`]]})}}),X=e.health,Z=X?.phase===`failed`&&!X.inGracePeriod,ye=Z&&X?.nextRetryAt&&!X.retrying;return i(`div`,{className:`rounded-lg border bg-surface overflow-hidden ${Z?`border-red-500/50`:`border-border`}`,children:[Z&&X&&i(`div`,{className:`bg-danger/10 border-b border-danger/30 px-4 py-2.5 flex items-start gap-2.5`,children:[l(q,{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 #`,X.retryCount,`)`]}),l(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:X.lastError?.message??`Unknown error`}),ye&&X.nextRetryAt&&i(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:[`Auto-retry at `,new Date(X.nextRetryAt).toLocaleTimeString()]})]}),i(`button`,{type:`button`,disabled:Y.isPending||X.retrying,onClick:e=>{e.stopPropagation(),Y.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(N,{className:`h-3 w-3 ${Y.isPending||X.retrying?`animate-spin`:``}`}),`Retry now`]})]}),i(`div`,{className:`flex items-start gap-3 px-4 py-3`,children:[l(Te,{isBundle:V||!!R.components&&R.components.length>1,installSource:W,addonId:V?_.addons[0]?.manifest.id:R.id,iconPath:V?_.bundle?.icon??_.addons[0]?.manifest.icon:R.icon,color:V?_.addons[0]?.manifest.color:R.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:he,availableUpdate:a,...k===void 0?{}:{selectedVersion:k},isUpdating:m,installSource:W,disabled:b,...d&&k!==void 0?{onUpdate:()=>d(k)}:{},onOpenPicker:()=>D(e=>!e),children:E&&l(xe,{packageName:U,currentVersion:he,...W?{installSource:W}:{},...a!==void 0&&k!==void 0?{selectedVersion:k,onSelect:e=>{O(e),D(!1)}}:{},onInstall:e=>{D(!1),ve.mutate({packageName:U,version:e})},onClose:()=>D(!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}),V&&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(g,{className:`h-3 w-3`}),_.addons.length]}),C&&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(N,{className:`h-3 w-3`}),`System`]}),y!=null&&l(Q,{item:y}),ee!=null&&l(be,{progress:ee})]}),G&&l(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:G}),!V&&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})]})]})]}),!V&&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:R.id})},disabled:J.isPending||b,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(N,{className:`h-3 w-3 ${J.isPending?`animate-spin`:``}`}),`Restart`]}),i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),j(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${A?`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(oe,{className:`h-3 w-3`}),`Logs`]}),!V&&i(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),P(!0)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${de?`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(w,{className:`h-3 w-3`}),`Settings`]}),l(`div`,{className:`flex-1`}),me&&i(`button`,{type:`button`,onClick:async e=>{e.stopPropagation(),await pe({title:`Uninstall ${R.name}?`,message:`This will remove the addon package and all its data. This action cannot be undone.`,confirmLabel:`Uninstall`,variant:`danger`})&&K.mutate({packageName:R.packageName})},disabled:K.isPending||b,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(p,{className:`h-3 w-3`}),K.isPending?`Removing...`:`Uninstall`]})]}),n&&n.nodes.length>1&&!V&&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))})]}),A&&!V&&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:()=>I(`logs`),className:`px-2 py-0.5 transition-colors ${F===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Logs`}),l(`button`,{type:`button`,onClick:()=>I(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${F===`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(),j(!1)},className:`text-foreground-subtle hover:text-foreground`,children:l(h,{className:`h-3.5 w-3.5`})})]}),F===`logs`&&l(le,{addonId:R.id,maxHeight:`max-h-64`,showFilters:!1}),F===`events`&&l(M,{addonId:R.id,category:`addon.*`,maxHeight:`max-h-64`})]}),V&&i(o,{children:[l(`button`,{type:`button`,onClick:()=>ne(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(te?B:f,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),te&&l(`div`,{className:`border-t border-border px-3 py-2 space-y-2`,children:_.addons.map(e=>l(Oe,{addon:e,agents:t,hideVersion:!0},e.manifest.id))})]}),de&&!V&&l(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4`,onClick:()=>P(!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(w,{className:`h-4 w-4 text-primary`}),i(`h2`,{className:`text-sm font-semibold text-foreground`,children:[H,` Settings`]})]}),l(`button`,{onClick:()=>P(!1),className:`text-foreground-subtle hover:text-foreground transition-colors p-1 rounded`,children:l(h,{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(_e,{nodeId:null,addonIds:[R.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(R)&&i(`div`,{children:[l(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Device export`}),l(x,{addonId:R.id,onOpenDevice:e=>fe(`/devices/${e}`)})]}),W===`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:R.id})]}),R.components&&R.components.length>0&&i(`div`,{children:[i(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:[`Components (`,R.components.length,`)`]}),l(`div`,{className:`flex flex-wrap gap-1`,children:R.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:[z.length===0&&l(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Hub (local)`}),z.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(),T(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(ie,{className:`h-3 w-3`}),`Add agent`]}),re&&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&&!z.includes(e.name)).map(e=>l(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),T(!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&&!z.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:()=>P(!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(d(`/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(y,{className:`w-3.5 h-3.5 animate-spin`}):l(_,{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(``),_=r(h),[b,x]=c(!1),S=t(null);u(()=>{if(!b)return;let e=e=>{S.current&&!S.current.contains(e.target)&&x(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[b]);let{data:C}=D({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]),[ie,oe]=c(()=>new Set),[T,E]=c(()=>new Map),O=e(e=>{oe(t=>new Set(t).add(e))},[]),ce=e(e=>{oe(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),le=e((e,t)=>{E(n=>new Map(n).set(e,t))},[]),k=e(e=>{E(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),A=ee({onMutate:e=>{O(e.name),k(e.name)},onSuccess:(e,t)=>{ce(t.name);let n=e;if(n&&n.success===!1){le(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)=>{ce(t.name),le(t.name,e instanceof Error?e.message:String(e))}}),j=Z(),ue=t(new Set);u(()=>{let e=new Set;for(let[t,n]of j)Y(n)&&e.add(t);let t=[...ue.current].some(t=>!e.has(t));ue.current=e,t&&(m.invalidateQueries({queryKey:[[`addons`]]}),m.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[j,m]);let{data:M}=re(void 0),P=pe({onSuccess:()=>{m.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),I=H({onSuccess:()=>{m.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:L,isFetching:R}=te({query:_||void 0},{enabled:b}),B=me(),{data:V}=de(void 0),U=V?.requestedAt,[ge,W]=c(null),[_e,G]=c(!1);u(()=>{if(V?.kind===`framework-bulk-update`&&V.requestedAt!==ge){W(V.requestedAt),G(!0);let e=window.setTimeout(()=>G(!1),6e3);return()=>window.clearTimeout(e)}},[U,ge,V]),v();let K=e(async()=>{let e=(C??[]).filter(e=>!e.isSystem);if(e.length!==0){if(!d.isHub){for(let t of e)await A.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,A]),q=ae({onSuccess:()=>{m.invalidateQueries({queryKey:[[`addons`]]}),m.invalidateQueries({queryKey:[[`addonPages`]]}),m.invalidateQueries({queryKey:[[`capabilities`]]}),m.invalidateQueries({queryKey:[[`integrations`]]})}}),[J,ve]=c(`type`),[X,ye]=c(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),be=e=>{ye(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[xe,Se]=he(),Q=xe.get(`capability`),Ce=a(()=>{let e=n.filter(e=>!Ne(e.manifest.packageName));return d.isHub||(e=e.filter(e=>Fe(e.placement,d.isHub))),Q&&(e=e.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===Q))),e},[n,d.isHub,Q]),we=()=>{let e=new URLSearchParams(xe);e.delete(`capability`),Se(e,{replace:!0})},Te=X===`flat`?Ce:Le(Ce),Ee=a(()=>{let e=[...Te];switch(J){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,J]);return i(`div`,{className:`space-y-4`,children:[[...T.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:()=>k(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:J,onChange:e=>ve(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:()=>be(e),className:`px-2.5 py-1.5 transition-colors capitalize ${X===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(N,{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:()=>P.mutate({channel:e}),disabled:P.isPending,className:`px-2.5 py-1.5 transition-colors capitalize ${M?.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:M?.updateCheckIntervalSeconds??21600,disabled:I.isPending||M===void 0,onChange:e=>{M!==void 0&&I.mutate({channel:M.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 K(),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(y,{className:`w-3 h-3 animate-spin`}):l(F,{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(N,{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(fe,{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`}),R&&l(y,{className:`absolute right-2.5 top-1/2 -translate-y-1/2 h-3 w-3 text-foreground-subtle animate-spin`}),b&&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:()=>q.mutate({packageName:e.name}),disabled:q.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:[q.isPending?l(y,{className:`h-3 w-3 animate-spin`}):l(F,{className:`h-3 w-3`}),`Install`]})]},e.name))})]})]}),l(Ae,{onUploadSuccess:()=>{m.invalidateQueries({queryKey:[[`addons`]]}),f()}})]}),Q&&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:Q}),l(`button`,{type:`button`,onClick:we,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:`Clear`})]}),_e&&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(se,{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.`})]})]}),Ce.length===0&&l(`div`,{className:`text-xs text-foreground-subtle`,children:n.length===0?`No addons installed`:Q?`No installed addons declare the "${Q}" 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=>A.mutate({name:t,version:e,nodeId:d.id}):void 0,a=j.get(t)??null,s=a!==null&&Y(a);return l(Oe,{addon:r,clusterStatus:o?.[r.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:n,isUpdating:ie.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}=j(),{data:o}=C(void 0),{nodes:c}=O(),{selection:d,selectNode:f,requestedNodeId:p}=K(c.length>0?c:[Pe]),m=d.node??Pe,h=m.id,ee=c.length>0?d.staleNodeId:null,g=I(),_=P(),v=g.isPending||_.isPending,y=async()=>{await g.mutateAsync({nodeId:h}),await _.mutateAsync(),e.invalidateQueries({queryKey:[[`addons`]]})},b=t(g);b.current=g;let x=t(p??`hub`);u(()=>{b.current.mutate({nodeId:x.current})},[]);let S=(n??[]).map(Ie).filter(e=>e!==null);return i(W,{children:[i(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[l(A,{selectedNodeId:h,onSelect:f}),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 y(),disabled:v,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(N,{className:`w-3 h-3 ${v?`animate-spin`:``}`}),`Check for updates`]})]})]}),l(G,{staleNodeId:ee,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 y(),isRefreshing:v})]})}export{ze as AddonsPage};
|