@camstack/addon-admin-ui 1.1.38 → 1.1.39
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-6UQCTSu4.js → AddLocationWizard-C6d7Rl2b.js} +1 -1
- package/dist/assets/{AddonCollectionPage-C7y1Xqv4.js → AddonCollectionPage-6BdYLe6i.js} +1 -1
- package/dist/assets/Addons-DRZkv8if.js +1 -0
- package/dist/assets/{AdminTabs-Bn5jDw8C.js → AdminTabs-B163y6NF.js} +1 -1
- package/dist/assets/{BrokerForm-E7__Uhl9.js → BrokerForm-Blc6VNTn.js} +1 -1
- package/dist/assets/{Capabilities-DWu3W2I3.js → Capabilities-CMoqY-Ug.js} +1 -1
- package/dist/assets/{CapabilityBadges-D4uPGt_S.js → CapabilityBadges-khS3I08e.js} +1 -1
- package/dist/assets/Cluster-DUuIC1Di.js +1 -0
- package/dist/assets/{Dashboard-DRARX0g8.js → Dashboard-BUIPjBAI.js} +1 -1
- package/dist/assets/{Data-Cgi4uVIl.js → Data-CI9RNUqg.js} +1 -1
- package/dist/assets/{DetectionIntelligence-B-VvnmfI.js → DetectionIntelligence-BWjYUpoc.js} +1 -1
- package/dist/assets/DeviceDetail-ncfqxizt.js +2 -0
- package/dist/assets/{Devices-BFoz2HIh.js → Devices-BI0K3L20.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-BY9eFyyg.js → EmbedPlayerPage-DTJcJ-K0.js} +1 -1
- package/dist/assets/{FormBuilder-CJrUV3p4.js → FormBuilder-Dq7rzw2g.js} +1 -1
- package/dist/assets/Identity-BClKA5CP.js +1 -0
- package/dist/assets/IntegrationDetail-CddIVuAg.js +1 -0
- package/dist/assets/{Integrations-Bj35Jpxj.js → Integrations-BqqLAeN1.js} +1 -1
- package/dist/assets/{Integrations-DpfC2qld.js → Integrations-Co_wJVPe.js} +1 -1
- package/dist/assets/{Logs-B2WAadmI.js → Logs-CBR7x9NW.js} +1 -1
- package/dist/assets/{MotionZonesSettings-3tt6mBQ0.js → MotionZonesSettings-BzuwNLPu.js} +1 -1
- package/dist/assets/{MyAccess-DXmHi-4Y.js → MyAccess-DN5XJRXk.js} +1 -1
- package/dist/assets/Network-DWjMAaiC.js +1 -0
- package/dist/assets/{NodeAddonsSettingsPanel-DTzycFzS.js → NodeAddonsSettingsPanel-DLEbHtxx.js} +1 -1
- package/dist/assets/{NotificationTargets-C3VSwqNL.js → NotificationTargets-BiiLAuNs.js} +1 -1
- package/dist/assets/Pipeline-CX07C-rk.js +1 -0
- package/dist/assets/{PrivacyMaskSettings-temQSWYL.js → PrivacyMaskSettings-B86k8eCd.js} +1 -1
- package/dist/assets/{ProviderIcon-DwFpv01K.js → ProviderIcon-BLTH0Ake.js} +1 -1
- package/dist/assets/{ScanNetworkModal-C6OLnfky.js → ScanNetworkModal-DVZ-75GA.js} +1 -1
- package/dist/assets/{Settings-BmZ2YcWY.js → Settings-EwkM7qrL.js} +1 -1
- package/dist/assets/{Showroom-CHFvHOSL.js → Showroom-ByaFbcYn.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-xXz7MEuT.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CJNw3KPL.js} +1 -1
- package/dist/assets/addon-display-names-DvSEQty-.js +1 -0
- package/dist/assets/{build-cluster-graph-DIgt00ch.js → build-cluster-graph-QwpFUUjE.js} +2 -2
- package/dist/assets/circle-check-big-Ybrsd8CR.js +1 -0
- package/dist/assets/{copy-CpT57v81.js → copy-BwUimuA-.js} +1 -1
- package/dist/assets/dist-BAlJw4R3.js +7 -0
- package/dist/assets/{dist-B8dNOlY9.js → dist-DAY4wmmI.js} +1 -1
- package/dist/assets/{download-fsWmKUMh.js → download-DDSz9DfI.js} +1 -1
- package/dist/assets/{hostInit-sp7Rf71V.js → hostInit-8o1E_qzk.js} +1 -1
- package/dist/assets/index-ByJMV5aQ.js +4 -0
- package/dist/assets/index-DufitHjX.css +2 -0
- package/dist/assets/{key-round-0X280kmV.js → key-round-DH-NOckT.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-2b967ba8.js → mf-entry-bootstrap-0-a41549da.js} +2 -2
- package/dist/assets/{pencil-BlQGw-pI.js → pencil-D-LLTb5E.js} +1 -1
- package/dist/assets/{player-overlays-CpsGl45o.js → player-overlays-2Q1miaEN.js} +1 -1
- package/dist/assets/plus-BWeUQ-Wm.js +1 -0
- package/dist/assets/{radio-DO0Dq2MF.js → radio-DqOn-16x.js} +1 -1
- package/dist/assets/{refresh-cw-CMRlnF-M.js → refresh-cw-DuM6oiTl.js} +1 -1
- package/dist/assets/remoteEntry-zKeZuvbY.js +1 -0
- package/dist/assets/{rotate-ccw-CaH5zDeG.js → rotate-ccw-AVemYpzI.js} +1 -1
- package/dist/assets/rotate-cw-8j5op9rY.js +1 -0
- package/dist/assets/search-Cb4-y9a0.js +1 -0
- package/dist/assets/{server-CaW_paWO.js → server-BKvjFwOh.js} +1 -1
- package/dist/assets/{sparkles-D1oHkgOm.js → sparkles-UVx0u2KJ.js} +1 -1
- package/dist/assets/{square-check-big-D7lGfpqc.js → square-check-big-BUD8eXmE.js} +1 -1
- package/dist/assets/square-fxMkH5ka.js +1 -0
- package/dist/assets/src-CKNSRfvW.js +7 -0
- package/dist/assets/src-D37vd48r.js +67 -0
- package/dist/assets/{upload-7zSY3rlx.js → upload-B9TkBT8Q.js} +1 -1
- package/dist/assets/{useDevice-BwzYPnLK.js → useDevice-Dt2O2ZfS.js} +1 -1
- package/dist/assets/{useEventInvalidation-CETyyXeZ.js → useEventInvalidation-UIA6NlSS.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DkH43QoX.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CsRvw1py.js} +2 -2
- package/dist/assets/{wifi-BeF9XXWL.js → wifi-C2e4NNeF.js} +1 -1
- package/dist/assets/{zap-abOrEOMQ.js → zap-C-u-esEw.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/server/addon.js +45 -83
- package/package.json +1 -1
- package/dist/assets/Addons-BMHA1UvX.js +0 -1
- package/dist/assets/Cluster-dHKbt5S3.js +0 -1
- package/dist/assets/DeviceDetail-DiuVtjgW.js +0 -2
- package/dist/assets/Identity-B0ygozcS.js +0 -1
- package/dist/assets/IntegrationDetail-Brj01VUG.js +0 -1
- package/dist/assets/Network-CaKLSIvm.js +0 -1
- package/dist/assets/Pipeline-Cp7B8YFG.js +0 -1
- package/dist/assets/circle-check-big-wzEehng2.js +0 -1
- package/dist/assets/dist-DRenWL4F.js +0 -7
- package/dist/assets/index-CY52lvbZ.js +0 -4
- package/dist/assets/index-_8k1nh07.css +0 -2
- package/dist/assets/plus-DSiRMRVx.js +0 -1
- package/dist/assets/remoteEntry-BTav0B7H.js +0 -1
- package/dist/assets/rotate-cw-CCcZjC0U.js +0 -1
- package/dist/assets/search-CN_ccU_h.js +0 -1
- package/dist/assets/square-DWukmPnU.js +0 -1
- package/dist/assets/src-BXL7z3gT.js +0 -7
- package/dist/assets/src-BZ1dd5LI.js +0 -67
package/dist/server/addon.js
CHANGED
|
@@ -4629,7 +4629,7 @@ function _instanceof(cls, params = {}) {
|
|
|
4629
4629
|
return inst;
|
|
4630
4630
|
}
|
|
4631
4631
|
//#endregion
|
|
4632
|
-
//#region ../types/dist/sleep-
|
|
4632
|
+
//#region ../types/dist/sleep-DiQ8xW1M.mjs
|
|
4633
4633
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
4634
4634
|
EventCategory["SystemBoot"] = "system.boot";
|
|
4635
4635
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -10306,7 +10306,7 @@ var BoundingBoxSchema = object({
|
|
|
10306
10306
|
w: number(),
|
|
10307
10307
|
h: number()
|
|
10308
10308
|
});
|
|
10309
|
-
|
|
10309
|
+
object({
|
|
10310
10310
|
class: string(),
|
|
10311
10311
|
originalClass: string(),
|
|
10312
10312
|
score: number(),
|
|
@@ -10497,11 +10497,6 @@ var PipelineSchemaSchema = object({
|
|
|
10497
10497
|
selectedEngine: PipelineEngineChoiceSchema,
|
|
10498
10498
|
slots: array(PipelineSlotSchemaSchema).readonly()
|
|
10499
10499
|
});
|
|
10500
|
-
var DetectorOutputSchema = object({
|
|
10501
|
-
detections: array(SpatialDetectionSchema).readonly(),
|
|
10502
|
-
inferenceMs: number(),
|
|
10503
|
-
modelId: string()
|
|
10504
|
-
});
|
|
10505
10500
|
var EngineProvisioningSchema = object({
|
|
10506
10501
|
runtimeId: _enum([
|
|
10507
10502
|
"onnx",
|
|
@@ -10626,7 +10621,7 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
10626
10621
|
auth: "admin"
|
|
10627
10622
|
}), method(object({ nodeId: string() }), object({
|
|
10628
10623
|
success: literal(true),
|
|
10629
|
-
|
|
10624
|
+
clearedDevices: number()
|
|
10630
10625
|
}), {
|
|
10631
10626
|
kind: "mutation",
|
|
10632
10627
|
auth: "admin"
|
|
@@ -10647,10 +10642,6 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
10647
10642
|
modelId: string(),
|
|
10648
10643
|
format: ModelFormatSchema$1
|
|
10649
10644
|
}), object({ success: literal(true) }), { kind: "mutation" }), method(object({
|
|
10650
|
-
addonId: string(),
|
|
10651
|
-
frame: FrameInputSchema,
|
|
10652
|
-
config: record(string(), unknown()).optional()
|
|
10653
|
-
}), DetectorOutputSchema), method(object({
|
|
10654
10645
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
10655
10646
|
steps: array(PipelineStepInputSchema).min(1),
|
|
10656
10647
|
frame: FrameInputSchema.optional(),
|
|
@@ -12345,7 +12336,9 @@ var AddonPageDeclarationSchema$1 = object({
|
|
|
12345
12336
|
icon: string(),
|
|
12346
12337
|
path: string(),
|
|
12347
12338
|
remoteName: string(),
|
|
12348
|
-
bundle: string()
|
|
12339
|
+
bundle: string(),
|
|
12340
|
+
section: string().optional(),
|
|
12341
|
+
sectionLabel: string().optional()
|
|
12349
12342
|
});
|
|
12350
12343
|
var AddonPageInfoSchema = object({
|
|
12351
12344
|
addonId: string(),
|
|
@@ -12385,7 +12378,18 @@ var AddonPageDeclarationSchema = object({
|
|
|
12385
12378
|
* the static-file route can compute an mtime-based cache-buster URL
|
|
12386
12379
|
* without a separate filesystem stat.
|
|
12387
12380
|
*/
|
|
12388
|
-
bundle: string()
|
|
12381
|
+
bundle: string(),
|
|
12382
|
+
/**
|
|
12383
|
+
* Sidebar section this page docks into. Well-known ids: `'detection'`,
|
|
12384
|
+
* `'cluster'`, `'administration'` — the page renders inside that group.
|
|
12385
|
+
* Any OTHER string creates (or joins) a custom section rendered after
|
|
12386
|
+
* the built-in groups; its label comes from `sectionLabel` (first
|
|
12387
|
+
* declaration wins), falling back to the id. Absent → the legacy
|
|
12388
|
+
* "Addon Pages" group.
|
|
12389
|
+
*/
|
|
12390
|
+
section: string().optional(),
|
|
12391
|
+
/** Display label for a CUSTOM `section` id (ignored for well-known ids). */
|
|
12392
|
+
sectionLabel: string().optional()
|
|
12389
12393
|
});
|
|
12390
12394
|
method(_void(), array(AddonPageDeclarationSchema).readonly());
|
|
12391
12395
|
var AddonHttpRouteSchema = object({
|
|
@@ -15219,7 +15223,12 @@ var AgentPipelineSettingsSchema = object({
|
|
|
15219
15223
|
detectWeight: number().positive().optional(),
|
|
15220
15224
|
/** Node is eligible to run the detection pipeline (decode + inference). */
|
|
15221
15225
|
detect: boolean().optional(),
|
|
15222
|
-
/**
|
|
15226
|
+
/**
|
|
15227
|
+
* DEPRECATED AND IGNORED. Decode is always co-located with its frame
|
|
15228
|
+
* consumer, so decode eligibility IS detect eligibility. Kept optional in
|
|
15229
|
+
* the schema ONLY so persisted stores written before the removal still
|
|
15230
|
+
* parse — no code reads it and no write path emits it.
|
|
15231
|
+
*/
|
|
15223
15232
|
decode: boolean().optional(),
|
|
15224
15233
|
/** Node is eligible to run audio-analyzer sessions. */
|
|
15225
15234
|
audio: boolean().optional(),
|
|
@@ -15280,25 +15289,6 @@ var PipelineAssignmentSchema = object({
|
|
|
15280
15289
|
assignedAt: number()
|
|
15281
15290
|
});
|
|
15282
15291
|
/**
|
|
15283
|
-
* Decoder placement record. Symmetric to `PipelineAssignmentSchema` but for
|
|
15284
|
-
* the decoder-node placement domain (`balanceDecoder` decision: manual pin
|
|
15285
|
-
* → co-located with pipeline → capacity).
|
|
15286
|
-
*/
|
|
15287
|
-
var DecoderAssignmentSchema = object({
|
|
15288
|
-
deviceId: number(),
|
|
15289
|
-
/** Moleculer node id of the decoder provider currently responsible for this camera. */
|
|
15290
|
-
decoderNodeId: string(),
|
|
15291
|
-
/** True when the assignment was set manually via `assignDecoder`, false when chosen by the balancer. */
|
|
15292
|
-
pinned: boolean(),
|
|
15293
|
-
/** Why this assignment was made — useful for debugging the decoder balancer. */
|
|
15294
|
-
reason: _enum([
|
|
15295
|
-
"manual",
|
|
15296
|
-
"co-located",
|
|
15297
|
-
"capacity",
|
|
15298
|
-
"hardware-affinity"
|
|
15299
|
-
])
|
|
15300
|
-
});
|
|
15301
|
-
/**
|
|
15302
15292
|
* Per-agent load summary surfaced to the load balancer + dashboards.
|
|
15303
15293
|
* Aggregated from each runner's `getLocalLoad` cap call.
|
|
15304
15294
|
*/
|
|
@@ -15504,15 +15494,6 @@ method(object({
|
|
|
15504
15494
|
}), method(_void(), IngestOwnerSchema), method(object({
|
|
15505
15495
|
deviceId: number(),
|
|
15506
15496
|
nodeId: string()
|
|
15507
|
-
}), _void(), {
|
|
15508
|
-
kind: "mutation",
|
|
15509
|
-
auth: "admin"
|
|
15510
|
-
}), method(object({ deviceId: number() }), _void(), {
|
|
15511
|
-
kind: "mutation",
|
|
15512
|
-
auth: "admin"
|
|
15513
|
-
}), method(_void(), array(DecoderAssignmentSchema).readonly()), method(object({
|
|
15514
|
-
deviceId: number(),
|
|
15515
|
-
nodeId: string()
|
|
15516
15497
|
}), object({ success: literal(true) }), {
|
|
15517
15498
|
kind: "mutation",
|
|
15518
15499
|
auth: "admin"
|
|
@@ -15531,10 +15512,7 @@ method(object({
|
|
|
15531
15512
|
nodeId: string(),
|
|
15532
15513
|
pinned: boolean(),
|
|
15533
15514
|
assignedAt: number()
|
|
15534
|
-
}))), method(object({
|
|
15535
|
-
deviceId: number(),
|
|
15536
|
-
pipelineNodeId: string().optional()
|
|
15537
|
-
}), DecoderAssignmentSchema), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
|
|
15515
|
+
}))), method(object({ agentNodeId: string() }), AgentPipelineSettingsSchema.nullable()), method(_void(), array(object({
|
|
15538
15516
|
nodeId: string(),
|
|
15539
15517
|
settings: AgentPipelineSettingsSchema
|
|
15540
15518
|
})).readonly()), method(object({
|
|
@@ -15564,7 +15542,6 @@ method(object({
|
|
|
15564
15542
|
}), method(object({
|
|
15565
15543
|
agentNodeId: string(),
|
|
15566
15544
|
detect: boolean().nullable().optional(),
|
|
15567
|
-
decode: boolean().nullable().optional(),
|
|
15568
15545
|
audio: boolean().nullable().optional(),
|
|
15569
15546
|
ingest: boolean().nullable().optional()
|
|
15570
15547
|
}), object({ success: literal(true) }), {
|
|
@@ -15576,6 +15553,15 @@ method(object({
|
|
|
15576
15553
|
}), object({ success: literal(true) }), {
|
|
15577
15554
|
kind: "mutation",
|
|
15578
15555
|
auth: "admin"
|
|
15556
|
+
}), method(object({ agentNodeId: string() }), object({
|
|
15557
|
+
success: literal(true),
|
|
15558
|
+
/** Hardware-aware default detection model now in effect on the node (null when unresolvable). */
|
|
15559
|
+
effectiveModelId: string().nullable(),
|
|
15560
|
+
/** Number of cameras whose node-scoped overrides were cleared. */
|
|
15561
|
+
clearedCameraOverrides: number()
|
|
15562
|
+
}), {
|
|
15563
|
+
kind: "mutation",
|
|
15564
|
+
auth: "admin"
|
|
15579
15565
|
}), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
|
|
15580
15566
|
deviceId: number(),
|
|
15581
15567
|
addonId: string(),
|
|
@@ -21060,23 +21046,23 @@ Object.freeze({
|
|
|
21060
21046
|
addonId: null,
|
|
21061
21047
|
access: "create"
|
|
21062
21048
|
},
|
|
21063
|
-
"pipelineExecutor.
|
|
21049
|
+
"pipelineExecutor.clearDeviceOverrides": {
|
|
21064
21050
|
capName: "pipeline-executor",
|
|
21065
21051
|
capScope: "system",
|
|
21066
21052
|
addonId: null,
|
|
21067
21053
|
access: "delete"
|
|
21068
21054
|
},
|
|
21069
|
-
"pipelineExecutor.
|
|
21055
|
+
"pipelineExecutor.deleteModel": {
|
|
21070
21056
|
capName: "pipeline-executor",
|
|
21071
21057
|
capScope: "system",
|
|
21072
21058
|
addonId: null,
|
|
21073
21059
|
access: "delete"
|
|
21074
21060
|
},
|
|
21075
|
-
"pipelineExecutor.
|
|
21061
|
+
"pipelineExecutor.deleteTemplate": {
|
|
21076
21062
|
capName: "pipeline-executor",
|
|
21077
21063
|
capScope: "system",
|
|
21078
21064
|
addonId: null,
|
|
21079
|
-
access: "
|
|
21065
|
+
access: "delete"
|
|
21080
21066
|
},
|
|
21081
21067
|
"pipelineExecutor.downloadModel": {
|
|
21082
21068
|
capName: "pipeline-executor",
|
|
@@ -21222,12 +21208,6 @@ Object.freeze({
|
|
|
21222
21208
|
addonId: null,
|
|
21223
21209
|
access: "create"
|
|
21224
21210
|
},
|
|
21225
|
-
"pipelineExecutor.resetToDefault": {
|
|
21226
|
-
capName: "pipeline-executor",
|
|
21227
|
-
capScope: "system",
|
|
21228
|
-
addonId: null,
|
|
21229
|
-
access: "delete"
|
|
21230
|
-
},
|
|
21231
21211
|
"pipelineExecutor.runAudioTest": {
|
|
21232
21212
|
capName: "pipeline-executor",
|
|
21233
21213
|
capScope: "system",
|
|
@@ -21288,12 +21268,6 @@ Object.freeze({
|
|
|
21288
21268
|
addonId: null,
|
|
21289
21269
|
access: "create"
|
|
21290
21270
|
},
|
|
21291
|
-
"pipelineOrchestrator.assignDecoder": {
|
|
21292
|
-
capName: "pipeline-orchestrator",
|
|
21293
|
-
capScope: "system",
|
|
21294
|
-
addonId: null,
|
|
21295
|
-
access: "create"
|
|
21296
|
-
},
|
|
21297
21271
|
"pipelineOrchestrator.assignPipeline": {
|
|
21298
21272
|
capName: "pipeline-orchestrator",
|
|
21299
21273
|
capScope: "system",
|
|
@@ -21372,18 +21346,6 @@ Object.freeze({
|
|
|
21372
21346
|
addonId: null,
|
|
21373
21347
|
access: "view"
|
|
21374
21348
|
},
|
|
21375
|
-
"pipelineOrchestrator.getDecoderAssignment": {
|
|
21376
|
-
capName: "pipeline-orchestrator",
|
|
21377
|
-
capScope: "system",
|
|
21378
|
-
addonId: null,
|
|
21379
|
-
access: "view"
|
|
21380
|
-
},
|
|
21381
|
-
"pipelineOrchestrator.getDecoderAssignments": {
|
|
21382
|
-
capName: "pipeline-orchestrator",
|
|
21383
|
-
capScope: "system",
|
|
21384
|
-
addonId: null,
|
|
21385
|
-
access: "view"
|
|
21386
|
-
},
|
|
21387
21349
|
"pipelineOrchestrator.getGlobalMetrics": {
|
|
21388
21350
|
capName: "pipeline-orchestrator",
|
|
21389
21351
|
capScope: "system",
|
|
@@ -21432,6 +21394,12 @@ Object.freeze({
|
|
|
21432
21394
|
addonId: null,
|
|
21433
21395
|
access: "delete"
|
|
21434
21396
|
},
|
|
21397
|
+
"pipelineOrchestrator.resetNodePipelineDefaults": {
|
|
21398
|
+
capName: "pipeline-orchestrator",
|
|
21399
|
+
capScope: "system",
|
|
21400
|
+
addonId: null,
|
|
21401
|
+
access: "delete"
|
|
21402
|
+
},
|
|
21435
21403
|
"pipelineOrchestrator.resolvePipeline": {
|
|
21436
21404
|
capName: "pipeline-orchestrator",
|
|
21437
21405
|
capScope: "system",
|
|
@@ -21504,12 +21472,6 @@ Object.freeze({
|
|
|
21504
21472
|
addonId: null,
|
|
21505
21473
|
access: "create"
|
|
21506
21474
|
},
|
|
21507
|
-
"pipelineOrchestrator.unassignDecoder": {
|
|
21508
|
-
capName: "pipeline-orchestrator",
|
|
21509
|
-
capScope: "system",
|
|
21510
|
-
addonId: null,
|
|
21511
|
-
access: "create"
|
|
21512
|
-
},
|
|
21513
21475
|
"pipelineOrchestrator.unassignPipeline": {
|
|
21514
21476
|
capName: "pipeline-orchestrator",
|
|
21515
21477
|
capScope: "system",
|
|
@@ -22866,7 +22828,7 @@ var AdminUIAddon = class extends BaseAddon {
|
|
|
22866
22828
|
capability: adminUiCapability,
|
|
22867
22829
|
provider: {
|
|
22868
22830
|
getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
|
|
22869
|
-
getVersion: async () => ({ version: "1.1.
|
|
22831
|
+
getVersion: async () => ({ version: "1.1.39" })
|
|
22870
22832
|
}
|
|
22871
22833
|
}];
|
|
22872
22834
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ct as e,Dt as t,Et as n,Fr as r,Ot as i,Qi as a,St as o,_t as s,bt as c,ct as l,dt as u,ft as d,g as f,gt as p,ia as m,kr as h,kt as ee,lt as g,m as _,mt as v,pt as te,st as ne,ta as re,ut as ie,v as ae,vt as y,wt as oe,yt as se}from"./src-BZ1dd5LI.js";import{I as b,K as x,Q as S,R as ce,S as C,W as w,b as le,o as ue,q as T,x as E,z as D}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{L as O}from"./src-BXL7z3gT.js";import{p as de}from"./player-overlays-CpsGl45o.js";import{t as k}from"./download-fsWmKUMh.js";import{t as fe}from"./plus-DSiRMRVx.js";import{t as A}from"./refresh-cw-CMRlnF-M.js";import{t as j}from"./search-CN_ccU_h.js";import{t as M}from"./upload-7zSY3rlx.js";import{A as pe,F as N,G as P,P as F,U as me,V as I,f as he,h as L,i as ge,o as R,p as z,s as _e,x as B}from"./index-CY52lvbZ.js";import{t as V}from"./AdminPage-BwmGKnRf.js";import{t as ve}from"./NodeAddonsSettingsPanel-DTzycFzS.js";var ye=I(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),H=I(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),U=I(`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`}]]),be=I(`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=I(`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`}]]);S();var G=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),K=new Set([`done`,`failed`,`skipped`]);function q(e){return!K.has(e.phase)&&!G.has(e.jobState)}function J(e,t){let n=new Map,r=[...e].sort((e,t)=>e.createdAtMs-t.createdAtMs);for(let e of r){let r=G.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 Y(){let{data:e}=s({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:t}=m(O.AddonsJobProgress,e=>e.job.jobId);return w(()=>{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 J([...n.values()],Date.now())},[e,t])}var X={queued:{icon:H,cls:`bg-muted text-foreground-subtle`,label:`queued`},fetching:{icon:B,cls:`bg-primary/10 text-primary`,label:`fetching`,spin:!0},staged:{icon:B,cls:`bg-primary/10 text-primary`,label:`staged`,spin:!0},validating:{icon:B,cls:`bg-primary/10 text-primary`,label:`validating`,spin:!0},applying:{icon:B,cls:`bg-primary/10 text-primary`,label:`applying`,spin:!0},restarting:{icon:B,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,label:`restarting`,spin:!0},applied:{icon:B,cls:`bg-primary/10 text-primary`,label:`finalizing`,spin:!0},done:{icon:N,cls:`bg-success/10 text-success`,label:`updated`},failed:{icon:U,cls:`bg-danger/10 text-danger`,label:`failed`},skipped:{icon:W,cls:`bg-muted text-foreground-subtle`,label:`skipped`}};function xe({progress:e}){let t=X[e.phase],n=t.icon,r=e.error??`${e.packageName}: ${e.fromVersion??`?`} → ${e.toVersion}`;return C(`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:[E(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label,C(`span`,{className:`font-mono`,children:[`→ `,e.toVersion]})]})}function Se({packageName:e,currentVersion:t,installSource:n,onInstall:r,onClose:i,onSelect:a,selectedVersion:o}){let s=n===`upload`||n===`local`,{data:c,isLoading:l}=d({name:e});return C(`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:[C(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[E(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle font-medium`,children:`Versions`}),E(`button`,{type:`button`,onClick:i,className:`text-foreground-subtle hover:text-foreground`,children:E(ge,{className:`h-3 w-3`})})]}),s&&C(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[E(M,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),C(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[C(`span`,{className:`font-semibold`,children:[n===`upload`?`Uploaded copy`:`Local copy`,` in place.`]}),` `,`Re-install `,E(`span`,{className:`font-mono`,children:t}),` from npm to track upstream releases again.`]})]}),l&&C(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[E(B,{className:`h-3.5 w-3.5 animate-spin`}),`Loading versions...`]}),c&&E(`div`,{className:`max-h-64 overflow-auto divide-y divide-border`,children:c.map(e=>{let n=e.version===t,i=a!==void 0&&e.version===o,c=/-(alpha|beta|rc|dev|canary|next)/i.test(e.version),l=C(le,{children:[E(`span`,{className:`font-mono flex-1 text-left ${n?`text-primary font-semibold`:c?`text-amber-400`:`text-foreground`}`,children:e.version}),n&&E(`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=>E(`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&&E(`span`,{className:`text-[9px] text-red-400 line-through`,children:`deprecated`}),E(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()})]});return a?C(`button`,{type:`button`,"aria-label":`Select ${e.version}`,onClick:()=>a(e.version),className:`w-full flex items-center gap-2 px-3 py-2 text-[11px] ${i?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[l,i?E(N,{className:`h-3 w-3 text-primary shrink-0`}):E(`span`,{className:`w-3 shrink-0`})]},e.version):C(`div`,{className:`flex items-center gap-2 px-3 py-2 text-[11px] ${n?`bg-primary/5`:`hover:bg-surface-hover`} transition-colors`,children:[l,n&&!s?E(N,{className:`h-3 w-3 text-primary shrink-0`}):E(`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:E(k,{className:`h-3 w-3`})})]},e.version)})}),c&&c.length===0&&E(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:`No versions found`})]})}var Z={queued:{icon:H,bg:`bg-muted text-foreground-subtle`,label:`queued`},updating:{icon:B,bg:`bg-primary/10 text-primary`,label:`updating`,spin:!0},"done-pending-restart":{icon:A,bg:`bg-amber-500/10 text-amber-700`,label:`pending restart`},done:{icon:N,bg:`bg-success/10 text-success`,label:`done`},failed:{icon:U,bg:`bg-danger/10 text-danger`,label:`failed`}};function Ce({item:e}){let t=Z[e.status],n=t.icon;return C(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${t.bg}`,title:e.error,children:[E(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label]})}S();var we=`device-export`;function Te(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===we)}function Ee({isBundle:e,installSource:t,addonId:n,iconPath:r,color:i}){let[a,o]=T(!1),s=i?{backgroundColor:`${i.startsWith(`#`)?i:`#${i}`}26`}:void 0,c=e?`bg-indigo-500/20 text-indigo-700 dark:text-indigo-300`:`bg-purple-500/20 text-purple-700 dark:text-purple-300`,l=n&&r?`/api/addon-assets/${n}/${r}`:null,u=!!l&&!a;return C(`div`,{className:`relative flex-shrink-0`,children:[E(`div`,{className:`h-9 w-9 rounded-lg flex items-center justify-center ${s?``:c}`,style:s,children:u?E(`img`,{src:l,alt:n,className:`h-5 w-5`,onError:()=>o(!0)}):E(e?be:L,{className:`h-4 w-4`})}),t===`local`&&E(`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`&&E(`span`,{className:`absolute -top-1 -left-1 w-4 h-4 rounded bg-[#cb3837] flex items-center justify-center -rotate-12 shadow-sm`,children:E(`svg`,{viewBox:`0 0 780 250`,className:`w-[11px] h-[11px]`,children:E(`path`,{fill:`#fff`,d:`M240 250h100V50h100v200h340V0H0v250z`})})}),t===`upload`&&E(`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:E(M,{className:`h-2.5 w-2.5 text-white`})})]})}function De({version:e,availableUpdate:t,selectedVersion:n,isUpdating:r,installSource:i,disabled:a,onUpdate:o,onOpenPicker:s,children:c}){if(r)return C(`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:[E(B,{className:`h-3 w-3 animate-spin`}),`Updating…`]});if(t){let r=n??t;return C(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[o&&C(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o()},disabled:a,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:[E(k,{className:`h-3 w-3`}),`Update`]}),C(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s()},disabled:a,"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:[E(`span`,{className:`font-normal opacity-70`,children:e}),E(`span`,{className:`font-normal opacity-70`,children:`→`}),r,E(F,{className:`h-3 w-3`})]}),c]})}return C(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[C(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s()},disabled:a,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`,i===`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,E(F,{className:`h-3 w-3 opacity-50`})]}),c]})}function Oe({addonId:e}){let t=ue(),{data:n=`inherit`}=g({addonId:e}),r=oe({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addons`,`getAddonAutoUpdate`]]})}});return E(`div`,{className:`flex rounded-lg border border-border overflow-hidden text-[10px] font-medium`,children:[`inherit`,`off`,`latest`,`beta`].map(t=>E(`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 ke({addon:e,agents:n=[],clusterStatus:r,hideVersion:i,availableUpdate:s,onUpdate:l,isUpdating:u,jobProgress:d,bundle:p,bulkItem:m,disabledByBulk:h,isSystem:ee}){let[g,v]=T(!1),[ne,re]=T(!1),[ie,y]=T(!1),[oe,se]=T(null);D(()=>{se(null)},[s]);let b=oe??s,[x,S]=T(!1),[ce,w]=T(!1),[O,k]=T(`logs`),j=ue(),M=de(),pe=me(),N=a(),{manifest:P}=e,I=e.installedOn??[],L=!p&&!P.protected&&P.removable!==!1,R=!!p,B=p?.displayName??P.name,V=p?.packageName??P.packageName,H=p?.version??P.packageVersion??P.version,W=p?.installSource??e.installSource,G=p?p.bundle?.description??p.addons[0]?.manifest.description:P.description,K=t({onSuccess:()=>{j.invalidateQueries({queryKey:[[`addons`]]}),j.invalidateQueries({queryKey:[[`addonPages`]]}),j.invalidateQueries({queryKey:[[`capabilities`]]})}}),q=c({onSuccess:()=>{j.invalidateQueries({queryKey:[[`addons`]]})}}),J=te({onSuccess:()=>{j.invalidateQueries({queryKey:[[`addons`]]}),j.invalidateQueries({queryKey:[[`addonPages`]]}),j.invalidateQueries({queryKey:[[`capabilities`]]}),j.invalidateQueries({queryKey:[[`integrations`]]})}}),Y=o({onSuccess:()=>{j.invalidateQueries({queryKey:[[`addons`]]}),j.invalidateQueries({queryKey:[[`alerts`]]})}}),X=e.health,Z=X?.phase===`failed`&&!X.inGracePeriod,we=Z&&X?.nextRetryAt&&!X.retrying;return C(`div`,{className:`rounded-lg border bg-surface overflow-hidden ${Z?`border-red-500/50`:`border-border`}`,children:[Z&&X&&C(`div`,{className:`bg-danger/10 border-b border-danger/30 px-4 py-2.5 flex items-start gap-2.5`,children:[E(U,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),C(`div`,{className:`flex-1 min-w-0`,children:[C(`div`,{className:`text-xs font-semibold text-danger`,children:[`Failed to load (attempt #`,X.retryCount,`)`]}),E(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:X.lastError?.message??`Unknown error`}),we&&X.nextRetryAt&&C(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:[`Auto-retry at `,new Date(X.nextRetryAt).toLocaleTimeString()]})]}),C(`button`,{type:`button`,disabled:Y.isPending||X.retrying,onClick:e=>{e.stopPropagation(),Y.mutate({packageName:V})},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:[E(A,{className:`h-3 w-3 ${Y.isPending||X.retrying?`animate-spin`:``}`}),`Retry now`]})]}),C(`div`,{className:`flex items-start gap-3 px-4 py-3`,children:[E(Ee,{isBundle:R||!!P.components&&P.components.length>1,installSource:W,addonId:R?p.addons[0]?.manifest.id:P.id,iconPath:R?p.bundle?.icon??p.addons[0]?.manifest.icon:P.icon,color:R?p.addons[0]?.manifest.color:P.color}),C(`div`,{className:`flex-1 min-w-0`,children:[C(`div`,{className:`flex items-start justify-between gap-2`,children:[E(`span`,{className:`text-sm font-semibold text-foreground truncate min-w-0`,children:B}),!i&&E(De,{version:H,availableUpdate:s,...b===void 0?{}:{selectedVersion:b},isUpdating:u,installSource:W,disabled:h,...l&&b!==void 0?{onUpdate:()=>l(b)}:{},onOpenPicker:()=>y(e=>!e),children:ie&&E(Se,{packageName:V,currentVersion:H,...W?{installSource:W}:{},...s!==void 0&&b!==void 0?{selectedVersion:b,onSelect:e=>{se(e),y(!1)}}:{},onInstall:e=>{y(!1),J.mutate({packageName:V,version:e})},onClose:()=>y(!1)})})]}),C(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[V!==B&&E(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate max-w-full`,children:V}),R&&C(`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:[E(be,{className:`h-3 w-3`}),p.addons.length]}),ee&&C(`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:[E(A,{className:`h-3 w-3`}),`System`]}),m!=null&&E(Ce,{item:m}),d!=null&&E(xe,{progress:d})]}),G&&E(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:G}),!R&&e.process&&C(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[E(`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&&C(`span`,{className:`text-[9px] font-mono text-foreground-subtle`,children:[`PID `,e.process.pid]}),E(`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})]})]})]}),!R&&C(`div`,{className:`flex items-center gap-1 px-4 py-1.5 border-t border-border/50 bg-surface-hover/20`,children:[C(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),q.mutate({addonId:P.id})},disabled:q.isPending||h,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:[E(A,{className:`h-3 w-3 ${q.isPending?`animate-spin`:``}`}),`Restart`]}),C(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),S(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${x?`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:[E(z,{className:`h-3 w-3`}),`Logs`]}),!R&&C(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),w(!0)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${ce?`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:[E(he,{className:`h-3 w-3`}),`Settings`]}),E(`div`,{className:`flex-1`}),L&&C(`button`,{type:`button`,onClick:async e=>{e.stopPropagation(),await N({title:`Uninstall ${P.name}?`,message:`This will remove the addon package and all its data. This action cannot be undone.`,confirmLabel:`Uninstall`,variant:`danger`})&&K.mutate({packageName:P.packageName})},disabled:K.isPending||h,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:[E(_e,{className:`h-3 w-3`}),K.isPending?`Removing...`:`Uninstall`]})]}),r&&r.nodes.length>1&&!R&&C(`div`,{className:`border-t border-border px-4 py-2 bg-muted/10`,children:[E(`div`,{className:`text-[10px] font-medium text-foreground-subtle mb-1.5`,children:`Cluster Deployment`}),E(`div`,{className:`space-y-1`,children:r.nodes.map(e=>C(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[E(`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`}`}),E(`span`,{className:`font-medium text-foreground min-w-[60px]`,children:e.name}),E(`span`,{className:`font-mono text-foreground-subtle`,children:e.version}),!e.synced&&e.status!==`offline`&&E(`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`&&E(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:`offline`}),e.synced&&e.status!==`offline`&&E(`span`,{className:`text-[9px] text-success`,children:`synced`})]},e.nodeId))})]}),x&&!R&&C(`div`,{className:`border-t border-border`,children:[C(`div`,{className:`flex items-center px-4 py-1 bg-surface-hover/20 border-b border-border/50`,children:[C(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[E(`button`,{type:`button`,onClick:()=>k(`logs`),className:`px-2 py-0.5 transition-colors ${O===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Logs`}),E(`button`,{type:`button`,onClick:()=>k(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${O===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Events`})]}),E(`div`,{className:`flex-1`}),E(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),S(!1)},className:`text-foreground-subtle hover:text-foreground`,children:E(ge,{className:`h-3.5 w-3.5`})})]}),O===`logs`&&E(f,{addonId:P.id,maxHeight:`max-h-64`,showFilters:!1}),O===`events`&&E(_,{addonId:P.id,category:`addon.*`,maxHeight:`max-h-64`})]}),R&&C(le,{children:[E(`button`,{type:`button`,onClick:()=>v(e=>!e),className:`w-full flex items-center justify-center border-t border-border py-1 hover:bg-surface-hover/50 transition-colors`,children:E(g?ye:F,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),g&&E(`div`,{className:`border-t border-border px-3 py-2 space-y-2`,children:p.addons.map(e=>E(ke,{addon:e,agents:n,hideVersion:!0},e.manifest.id))})]}),ce&&!R&&E(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4`,onClick:()=>w(!1),children:C(`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:[C(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-border flex-shrink-0`,children:[C(`div`,{className:`flex items-center gap-2`,children:[E(he,{className:`h-4 w-4 text-primary`}),C(`h2`,{className:`text-sm font-semibold text-foreground`,children:[B,` Settings`]})]}),E(`button`,{onClick:()=>w(!1),className:`text-foreground-subtle hover:text-foreground transition-colors p-1 rounded`,children:E(ge,{className:`h-4 w-4`})})]}),C(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[E(ve,{nodeId:`hub`,addonIds:[P.id],level:`global`}),Te(P)&&C(`div`,{children:[E(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Device export`}),E(ae,{addonId:P.id,trpc:M.trpcClient,onOpenDevice:e=>pe(`/devices/${e}`)})]}),W===`npm`&&C(`div`,{children:[E(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Auto-Update`}),E(Oe,{addonId:P.id})]}),P.components&&P.components.length>0&&C(`div`,{children:[C(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:[`Components (`,P.components.length,`)`]}),E(`div`,{className:`flex flex-wrap gap-1`,children:P.components.map(e=>E(`span`,{className:`text-[10px] rounded bg-background border border-border px-1.5 py-0.5 text-foreground-subtle font-mono`,children:e},e))})]}),n.length>=2&&C(`div`,{children:[E(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Installed on`}),C(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[I.length===0&&E(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Hub (local)`}),I.map(e=>E(`span`,{className:`rounded-full bg-surface-hover border border-border px-2 py-0.5 text-[10px] text-foreground-subtle`,children:e},e)),C(`div`,{className:`relative`,children:[C(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),re(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:[E(fe,{className:`h-3 w-3`}),`Add agent`]}),ne&&C(`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:[n.filter(e=>!e.isHub&&!I.includes(e.name)).map(e=>E(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),re(!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)),n.filter(e=>!e.isHub&&!I.includes(e.name)).length===0&&E(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle`,children:`No available agents`})]})]})]})]})]}),E(`div`,{className:`flex items-center justify-end px-5 py-3 border-t border-border flex-shrink-0`,children:E(`button`,{type:`button`,onClick:()=>w(!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`})})]})})]})}S();var Ae=`.tgz,.tar.gz,.zip`;function je({onUploadSuccess:e}){let[t,n]=T(!1),r=x(null),i=b(async t=>{n(!0);let r=new FormData;r.append(`file`,t);let i=localStorage.getItem(`camstack_admin_token`)??``;try{(await(await fetch(`/api/addons/upload`,{method:`POST`,headers:{Authorization:`Bearer ${i}`},body:r})).json()).success&&e()}finally{n(!1)}},[e]);return C(le,{children:[E(`input`,{ref:r,type:`file`,accept:Ae,onChange:b(e=>{let t=e.target.files?.[0];t&&i(t),e.target.value=``},[i]),className:`hidden`}),C(`button`,{type:`button`,onClick:()=>r.current?.click(),disabled:t,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:[t?E(B,{className:`w-3.5 h-3.5 animate-spin`}):E(M,{className:`w-3.5 h-3.5`}),t?`Uploading...`:`Upload`]})]})}function Me({pending:e,onCancel:t,onConfirm:n,isPending:r,error:i}){return E(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:C(`div`,{className:`bg-surface border border-border rounded-md shadow-xl p-5 max-w-md w-full mx-4 space-y-3`,children:[C(`div`,{className:`flex items-center gap-2`,children:[E(R,{className:`w-4 h-4 text-amber-700`}),E(`h3`,{className:`text-sm font-medium text-foreground`,children:`Update system package?`})]}),C(`div`,{className:`space-y-2 text-[11px] text-foreground-subtle`,children:[C(`div`,{children:[E(`span`,{className:`font-mono text-foreground`,children:e.packageName}),E(`span`,{className:`mx-1`,children:`·`}),C(`span`,{className:`font-mono`,children:[`v`,e.fromVersion]}),E(`span`,{className:`mx-1`,children:`→`}),C(`span`,{className:`font-mono text-amber-700`,children:[`v`,e.toVersion]})]}),E(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 p-2 text-amber-800`,children:`The hub will restart immediately after the install. Any in-flight requests will be dropped. The reconnect typically takes ~10 seconds.`}),i!==null&&E(`div`,{className:`rounded border border-danger/40 bg-danger/10 p-2 text-danger`,children:i})]}),C(`div`,{className:`flex justify-end gap-2 pt-1`,children:[E(`button`,{type:`button`,onClick:t,disabled:r,className:`px-3 py-1.5 text-[11px] rounded bg-surface hover:bg-surface-hover border border-border disabled:opacity-50`,children:`Cancel`}),C(`button`,{type:`button`,onClick:n,disabled:r,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-[11px] rounded bg-amber-500/20 text-amber-800 hover:bg-amber-500/30 border border-amber-500/40 font-medium disabled:opacity-50`,children:[r?E(B,{className:`w-3 h-3 animate-spin`}):E(k,{className:`w-3 h-3`}),`Update & restart`]})]})]})})}S();function Ne(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function Q(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 Pe(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 Fe({addons:t,clusterStatus:r,selectedNode:o,onRefresh:s,isRefreshing:c}){let l=ue(),[d,f]=T(``),m=ce(d),[h,g]=T(!1),_=x(null);D(()=>{if(!h)return;let e=e=>{_.current&&!_.current.contains(e.target)&&g(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[h]);let{data:v}=y({nodeId:o.id}),re=w(()=>{let e=new Map;for(let t of v??[])e.set(t.name,t.latestVersion);return e},[v]),[ae,oe]=T(()=>new Set),[se,S]=T(()=>new Map),le=b(e=>{oe(t=>new Set(t).add(e))},[]),O=b(e=>{oe(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),de=b((e,t)=>{S(n=>new Map(n).set(e,t))},[]),fe=b(e=>{S(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),M=ee({onMutate:e=>{le(e.name),fe(e.name)},onSuccess:(e,t)=>{O(t.name);let n=e;if(n&&n.success===!1){de(t.name,n.error??`Update failed (no error message returned by server)`);return}l.invalidateQueries({queryKey:[[`addons`]]}),l.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{O(t.name),de(t.name,e instanceof Error?e.message:String(e))}}),F=Y(),me=x(new Set);D(()=>{let e=new Set;for(let[t,n]of F)q(n)&&e.add(t);let t=[...me.current].some(t=>!e.has(t));me.current=e,t&&(l.invalidateQueries({queryKey:[[`addons`]]}),l.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[F,l]);let{data:I}=ie(void 0),he=ne({onSuccess:()=>{l.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:L,isFetching:ge}=e({query:m||void 0},{enabled:h}),R=n(),{data:z}=u(void 0),_e=z?.requestedAt,[V,ve]=T(null),[ye,H]=T(!1);D(()=>{if(z?.kind===`framework-bulk-update`&&z.requestedAt!==V){ve(z.requestedAt),H(!0);let e=window.setTimeout(()=>H(!1),6e3);return()=>window.clearTimeout(e)}},[_e,V,z]);let{data:U}=p(void 0),be=w(()=>new Map((U??[]).map(e=>[e.packageName,e])),[U]),[W,G]=T(null),[K,J]=T(null),X=i({onSuccess:()=>{G(null),l.invalidateQueries({queryKey:[[`addons`]]})},onError:e=>{J(e instanceof Error?e.message:String(e))}}),xe=a(),Se=b(async()=>{let e=v??[];e.length!==0&&(e.some(e=>e.isSystem)&&!await xe({title:`Update all — includes a system package`,message:`This batch updates a system package (@camstack/system). The hub will restart automatically once the framework update completes. In-flight requests are dropped; reconnect typically takes ~10 seconds.`,confirmLabel:`Update all & restart`,variant:`warning`})||await R.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[o.id]}))},[v,o.id,R,xe]),Z=te({onSuccess:()=>{l.invalidateQueries({queryKey:[[`addons`]]}),l.invalidateQueries({queryKey:[[`addonPages`]]}),l.invalidateQueries({queryKey:[[`capabilities`]]}),l.invalidateQueries({queryKey:[[`integrations`]]})}}),[Ce,we]=T(`type`),[Te,Ee]=T(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),De=e=>{Ee(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[Oe,Ae]=P(),Q=Oe.get(`capability`),Fe=w(()=>{let e=o.isHub?t:t.filter(e=>Ne(e.placement,o.isHub));return Q&&(e=e.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===Q))),e},[t,o.isHub,Q]),Ie=()=>{let e=new URLSearchParams(Oe);e.delete(`capability`),Ae(e,{replace:!0})},Le=Te===`flat`?Fe:Pe(Fe),Re=w(()=>{let e=[...Le];switch(Ce){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},[Le,Ce]);return C(`div`,{className:`space-y-4`,children:[[...se.entries()].map(([e,t])=>E(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-[11px]`,children:C(`div`,{className:`flex items-start justify-between gap-3`,children:[C(`div`,{className:`space-y-0.5`,children:[C(`div`,{className:`font-medium text-danger`,children:[`Failed to update `,e]}),E(`div`,{className:`text-foreground-subtle font-mono`,children:t})]}),E(`button`,{type:`button`,onClick:()=>fe(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:`dismiss`})]})},e)),C(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[C(`div`,{className:`flex items-center gap-1.5`,children:[E(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Sort:`}),C(`select`,{value:Ce,onChange:e=>we(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:[E(`option`,{value:`type`,children:`Bundles first`}),E(`option`,{value:`name`,children:`Name`}),E(`option`,{value:`source`,children:`Install source`})]})]}),C(`div`,{className:`flex items-center gap-1.5`,children:[E(`span`,{className:`text-[10px] text-foreground-subtle`,children:`View:`}),E(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>E(`button`,{type:`button`,onClick:()=>De(e),className:`px-2.5 py-1.5 transition-colors capitalize ${Te===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))})]}),o.isHub&&C(`div`,{className:`flex items-center gap-1.5`,children:[E(A,{className:`h-3 w-3 text-foreground-subtle`}),E(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Auto-Update:`}),E(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>E(`button`,{type:`button`,onClick:()=>he.mutate({channel:e}),disabled:he.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))})]}),(v?.length??0)>0&&C(`button`,{type:`button`,onClick:()=>void Se(),disabled:R.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:[R.isPending?E(B,{className:`w-3 h-3 animate-spin`}):E(k,{className:`w-3 h-3`}),R.isPending?`Updating…`:`Update All (${v.length})`]}),C(`button`,{type:`button`,onClick:s,disabled:c||R.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:[E(A,{className:`w-3 h-3 ${c?`animate-spin`:``}`}),`Refresh`]})]}),C(`div`,{className:`flex items-center gap-3`,children:[C(`div`,{className:`relative flex-1 min-w-[200px]`,ref:_,children:[E(j,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),E(`input`,{type:`text`,value:d,onChange:e=>{f(e.target.value),g(!0)},onFocus:()=>g(!0),placeholder:`Search addons on npm...`,disabled:R.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&&E(B,{className:`absolute right-2.5 top-1/2 -translate-y-1/2 h-3 w-3 text-foreground-subtle animate-spin`}),h&&L&&L.length>0&&C(`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&&C(`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&&E(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:L.map(e=>C(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[E(`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()}),C(`div`,{className:`flex-1 min-w-0`,children:[C(`div`,{className:`flex items-center gap-2`,children:[E(`span`,{className:`text-[11px] font-semibold truncate`,children:e.name}),C(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`v`,e.version]})]}),e.description&&E(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?C(`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:[E(N,{className:`h-3 w-3`}),e.installedVersion??`Installed`]}):C(`button`,{type:`button`,onClick:()=>Z.mutate({packageName:e.name}),disabled:Z.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:[Z.isPending?E(B,{className:`h-3 w-3 animate-spin`}):E(k,{className:`h-3 w-3`}),`Install`]})]},e.name))})]})]}),E(je,{onUploadSuccess:()=>{l.invalidateQueries({queryKey:[[`addons`]]}),s()}})]}),Q&&C(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-primary/10 border border-primary/30 text-sm`,children:[E(`span`,{className:`text-foreground-subtle`,children:`Filtering by capability:`}),E(`span`,{className:`font-mono text-primary font-semibold`,children:Q}),E(`button`,{type:`button`,onClick:Ie,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:`Clear`})]}),ye&&C(`div`,{className:`fixed top-4 right-4 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:[E(pe,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),C(`div`,{children:[E(`div`,{className:`text-[11px] font-semibold text-foreground`,children:`Bulk update completed`}),E(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:`System packages updated — hub restarted successfully.`})]})]}),Fe.length===0&&E(`div`,{className:`text-xs text-foreground-subtle`,children:t.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 ${o.name} (placement filter active)`}),E(`div`,{className:`space-y-2`,children:Re.map(e=>{let t=$(e)?e.bundle.packageName:e.manifest.packageName,n=re.get(t),i=$(e)?e.representative:e,a=be.has(t),s=n?a?e=>G({packageName:t,fromVersion:be.get(t)?.currentVersion??i.manifest.packageVersion??i.manifest.version,toVersion:e}):e=>M.mutate({name:t,version:e,nodeId:o.id}):void 0,c=F.get(t)??null,l=c!==null&&q(c);return E(ke,{addon:i,clusterStatus:r?.[i.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:n,isUpdating:ae.has(t)||l,jobProgress:c,onUpdate:s,isSystem:a,disabledByBulk:R.isPending},$(e)?t:e.manifest.id)})}),W!==null&&E(Me,{pending:W,onCancel:()=>{G(null),J(null)},onConfirm:()=>{J(null),X.mutate({packageName:W.packageName,version:W.toVersion})},isPending:X.isPending,error:K})]})}function Ie(){let e=ue(),{data:t,isLoading:n,isError:i}=v(),{data:a}=h(void 0),{data:o}=r(void 0,{refetchInterval:1e4}),s=w(()=>{let e=new Map;e.set(`hub`,{id:`hub`,name:`Hub`,isHub:!0});for(let t of o??[]){let n=String(t.id??``);n&&e.set(n,{id:n,name:String(t.name??n),isHub:!!t.isHub})}return[...e.values()]},[o]),[c,u]=T(`hub`),d=s.find(e=>e.id===c)??s[0],f=l(),p=se(),m=f.isPending||p.isPending,ee=async()=>{await f.mutateAsync({nodeId:c}),await p.mutateAsync(),e.invalidateQueries({queryKey:[[`addons`]]})},g=x(f);g.current=f,D(()=>{g.current.mutate({nodeId:`hub`})},[]);let _=(t??[]).map(Q).filter(e=>e!==null);return C(V,{children:[C(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[E(re,{selectedNodeId:c,onSelect:u}),C(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[!n&&!i&&C(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium`,children:[_.length,` installed`]}),C(`button`,{type:`button`,onClick:()=>void ee(),disabled:m,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:[E(A,{className:`w-3 h-3 ${m?`animate-spin`:``}`}),`Check for updates`]})]})]}),!d.isHub&&C(`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`,` `,E(`span`,{className:`font-medium text-foreground`,children:d.name}),` — agents only run`,` `,E(`code`,{className:`font-mono`,children:`agent-only`}),` and`,` `,E(`code`,{className:`font-mono`,children:`any-node`}),` addons. Install / uninstall is hub-driven; agents auto-sync from the hub.`]}),n&&E(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading…`}),i&&E(`div`,{className:`text-xs text-danger`,children:`Failed to load addons`}),!n&&!i&&E(Fe,{addons:_,clusterStatus:a,selectedNode:d,onRefresh:()=>void ee(),isRefreshing:m})]})}export{Ie as AddonsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ar as e,Cr as t,Fr as n,Ir as r,Mr as i,Nr as a,Pr as o,Qi as s,_a as c,_i as l,aa as u,ba as d,g as f,jr as p,m,ni as h,ra as g,va as _,wr as v,ya as y}from"./src-BZ1dd5LI.js";import{I as b,K as x,Q as S,S as C,W as w,o as T,q as E,x as D,z as O}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{p as k}from"./player-overlays-CpsGl45o.js";import{t as A}from"./pencil-BlQGw-pI.js";import{t as j}from"./radio-DO0Dq2MF.js";import{t as M}from"./refresh-cw-CMRlnF-M.js";import{t as N}from"./rotate-cw-CCcZjC0U.js";import{t as P}from"./server-CaW_paWO.js";import{t as F}from"./upload-7zSY3rlx.js";import{F as I,L,M as R,P as z,V as B,i as V,k as H,o as U,p as W,s as G,x as K}from"./index-CY52lvbZ.js";import{n as q,t as J}from"./build-cluster-graph-DIgt00ch.js";import{t as Y}from"./format-size-CO9d3C3-.js";import{t as X}from"./NodeAddonsSettingsPanel-DTzycFzS.js";var Z=B(`git-fork`,[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]),Q=B(`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`}]]),$=B(`skull`,[[`path`,{d:`m12.5 17-.5-1-.5 1h1z`,key:`3me087`}],[`path`,{d:`M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z`,key:`1o5pge`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}]]),ee=B(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]);S();function te(e){let t=new FormData;return t.append(`file`,e.file,e.file.name),t.append(`nodeId`,e.nodeId),e.addonId&&t.append(`addonId`,e.addonId),new Promise((n,r)=>{let i=new XMLHttpRequest;i.open(`POST`,`/api/addons/upload`),e.token&&i.setRequestHeader(`Authorization`,`Bearer ${e.token}`),i.upload.addEventListener(`progress`,t=>{t.lengthComputable&&e.onProgress(Math.round(t.loaded/t.total*100))}),i.addEventListener(`load`,()=>{let e;try{e=JSON.parse(i.responseText)}catch{r(Error(`HTTP ${i.status}`));return}i.status>=200&&i.status<300?n(e):r(Error(e.error??`HTTP ${i.status}`))}),i.addEventListener(`error`,()=>r(Error(`Network error during upload`))),i.addEventListener(`abort`,()=>r(Error(`Upload aborted`))),i.send(t)})}function ne({nodeId:t,addons:n,isHub:a}){let o=T(),c=s(),[l,u]=E(null),[d,f]=E(null),[p,m]=E(!1),[h,g]=E(null),[_,v]=E(0),y=x(null),b=i(),S=r(),w=e({nodeId:t}),O=w.data??[],k=new Map(n.map(e=>[e.id,e.capabilities])),A=O.length>0?O.map(e=>({id:e.id,status:e.status,capabilities:k.get(e.id)??[],version:e.version,packageName:e.packageName})):n.map(e=>({id:e.id,status:e.status,capabilities:e.capabilities,version:void 0,packageName:void 0})),j=()=>{o.invalidateQueries({queryKey:[[`nodes`,`topology`]]}),w.refetch()},M=async e=>{u(e);try{await b.mutateAsync({nodeId:t,addonId:e}),j()}catch(e){console.error(`Failed to restart addon:`,e)}finally{u(null)}},P=async e=>{if(await c({title:`Uninstall addon`,message:`Remove "${e}" from ${t}? The addon directory will be deleted on disk.`,confirmLabel:`Uninstall`,variant:`danger`})){f(e);try{await S.mutateAsync({nodeId:t,addonId:e}),j()}catch(e){console.error(`Failed to uninstall addon:`,e)}finally{f(null)}}},I=C(`div`,{className:`flex items-center gap-2 mb-2`,children:[D(`input`,{ref:y,type:`file`,accept:`.tgz,.tar.gz`,className:`hidden`,onChange:async e=>{let n=e.target.files?.[0];if(n){e.target.value=``,g(null),m(!0),v(0);try{await te({file:n,nodeId:t,token:localStorage.getItem(`camstack_admin_token`),onProgress:v}),j()}catch(e){g(e instanceof Error?e.message:String(e))}finally{m(!1),v(0)}}}}),C(`button`,{onClick:()=>y.current?.click(),disabled:p,className:`inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1 text-[11px] font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[p?D(K,{className:`h-3 w-3 animate-spin`}):D(F,{className:`h-3 w-3`}),p?`Uploading… ${_}%`:`Upload addon (.tgz)`]}),p&&D(`div`,{className:`flex-1 h-1 rounded-full bg-muted overflow-hidden max-w-[140px]`,children:D(`div`,{className:`h-full bg-primary transition-all`,style:{width:`${_}%`}})}),h&&D(`span`,{className:`text-[10px] text-destructive`,children:h})]});return A.length===0?C(`div`,{children:[I,D(`div`,{className:`py-4 text-xs text-muted-foreground text-center`,children:w.isLoading?`Loading addons…`:`No addons on this node`})]}):C(`div`,{children:[I,C(`table`,{className:`w-full text-xs`,children:[D(`thead`,{children:C(`tr`,{className:`text-muted-foreground text-left`,children:[D(`th`,{className:`py-2 font-medium`,children:`Addon`}),D(`th`,{className:`py-2 font-medium`,children:`Version`}),D(`th`,{className:`py-2 font-medium`,children:`Capabilities`}),D(`th`,{className:`py-2 font-medium`,children:`Status`}),D(`th`,{className:`py-2 font-medium w-16`})]})}),D(`tbody`,{children:A.map(e=>C(`tr`,{className:`border-t border-border/50`,children:[C(`td`,{className:`py-2 font-medium`,children:[D(`div`,{children:e.id}),e.packageName&&D(`div`,{className:`text-[9px] text-muted-foreground`,children:e.packageName})]}),D(`td`,{className:`py-2 text-muted-foreground`,children:e.version??`—`}),D(`td`,{className:`py-2`,children:D(`div`,{className:`flex flex-wrap gap-1`,children:e.capabilities.length>0?e.capabilities.map(e=>D(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-blue-500/10 text-blue-400`,children:e},e)):D(`span`,{className:`text-muted-foreground`,children:`—`})})}),D(`td`,{className:`py-2`,children:D(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full ${e.status===`running`?`bg-success/10 text-success`:e.status===`error`?`bg-destructive/10 text-destructive`:`bg-muted text-muted-foreground`}`,children:e.status})}),D(`td`,{className:`py-2`,children:C(`div`,{className:`flex items-center gap-1 justify-end`,children:[D(`button`,{onClick:()=>M(e.id),disabled:l===e.id||d===e.id,className:`p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50`,title:`Restart ${e.id}`,children:D(N,{className:`h-3 w-3 ${l===e.id?`animate-spin`:``}`})}),D(`button`,{onClick:()=>P(e.id),disabled:l===e.id||d===e.id,className:`p-1 rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50`,title:`Uninstall ${e.id}`,children:d===e.id?D(K,{className:`h-3 w-3 animate-spin`}):D(G,{className:`h-3 w-3`})})]})})]},e.id))})]})]})}S();function re(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 ie({state:e}){return D(`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 ae=[`trace`,`debug`,`info`,`warn`,`error`];function oe({proc:e,nodeId:t,defaultExpanded:n,activePanel:r,onTogglePanel:s}){let l=e.services??[],u=l.length===1,[p,h]=E(u||n),[g,v]=E(null),[b,x]=E(`info`),S=e.name.includes(`(core)`),w=i(),T=a(),O=o(),k=async e=>{v(e);try{await w.mutateAsync({nodeId:t,addonId:e})}catch(e){console.error(`Failed to restart addon:`,e)}finally{v(null)}},A=async()=>{v(e.name);try{await T.mutateAsync({nodeId:t,processName:e.name})}catch(e){console.error(`Failed to restart process:`,e)}finally{v(null)}},M=async n=>{let r=`${t}/${e.name}`;try{await O.mutateAsync({nodeId:r,level:n}),x(n)}catch(e){console.error(`Failed to set log level:`,e)}};return C(`div`,{className:`border border-border/50 rounded-lg overflow-hidden`,children:[C(`div`,{role:u?void 0:`button`,tabIndex:u?void 0:0,onClick:u?void 0:()=>h(!p),onKeyDown:u?void 0:e=>{(e.key===`Enter`||e.key===` `)&&h(!p)},className:`flex items-center gap-2 w-full px-3 py-2 bg-muted/20 transition-colors text-left select-none ${u?``:`hover:bg-muted/40 cursor-pointer`}`,children:[u?D(`span`,{className:`h-3 w-3 shrink-0`}):D(p?z:R,{className:`h-3 w-3 text-muted-foreground shrink-0`}),S?D(P,{className:`h-3.5 w-3.5 text-primary shrink-0`}):D(L,{className:`h-3.5 w-3.5 text-amber-500 shrink-0`}),D(`span`,{className:`text-xs font-semibold flex-1`,children:e.name}),C(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[`PID `,e.pid]}),D(ie,{state:e.state}),C(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[e.cpuPercent,`% CPU`]}),D(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:Y(e.memoryRss)}),D(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:re(e.uptimeSeconds)}),!S&&C(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:[C(c,{children:[D(d,{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:b}),D(_,{align:`end`,className:`min-w-[70px] py-0.5`,children:ae.map(e=>D(y,{onClick:()=>M(e),className:`h-auto px-2 py-1 text-[10px] font-mono ${e===b?`text-primary font-semibold`:``}`,children:e},e))})]}),D(`button`,{onClick:A,disabled:g===e.name,className:`p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50`,title:`Restart process`,children:D(N,{className:`h-3 w-3 ${g===e.name?`animate-spin`:``}`})})]})]}),p&&l.length>0&&D(`div`,{className:`divide-y divide-border/30`,children:l.map(e=>C(`div`,{children:[C(`div`,{className:`flex items-center gap-2 px-3 py-1.5 pl-9 hover:bg-muted/10 transition-colors`,children:[D(`div`,{className:`h-1.5 w-1.5 rounded-full shrink-0 ${e.status===`running`?`bg-success`:`bg-muted-foreground/30`}`}),D(`span`,{className:`text-xs font-medium flex-1 min-w-0 truncate`,children:e.addonId}),e.capabilities.length>0&&C(`div`,{className:`flex gap-1 flex-shrink-0`,children:[e.capabilities.slice(0,3).map(e=>D(`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&&C(`span`,{className:`text-[9px] text-muted-foreground`,children:[`+`,e.capabilities.length-3]})]}),C(`div`,{className:`flex items-center gap-1 shrink-0`,children:[D(`button`,{onClick:()=>s(e.addonId,`logs`),className:`p-0.5 rounded transition-colors ${r?.addonId===e.addonId&&r.type===`logs`?`bg-primary/10 text-primary`:`hover:bg-muted text-muted-foreground hover:text-foreground`}`,title:`Show logs for ${e.addonId}`,children:D(W,{className:`h-3 w-3`})}),D(`button`,{onClick:()=>s(e.addonId,`events`),className:`p-0.5 rounded transition-colors ${r?.addonId===e.addonId&&r.type===`events`?`bg-primary/10 text-primary`:`hover:bg-muted text-muted-foreground hover:text-foreground`}`,title:`Show events for ${e.addonId}`,children:D(j,{className:`h-3 w-3`})}),D(`button`,{onClick:()=>k(e.addonId),disabled:g===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:D(N,{className:`h-3 w-3 ${g===e.addonId?`animate-spin`:``}`})})]})]}),r?.addonId===e.addonId&&r.type===`logs`&&D(`div`,{className:`border-t border-border/40 bg-muted/5`,children:D(f,{addonId:e.addonId,agentId:t,maxHeight:`max-h-48`,showFilters:!1,onClose:()=>s(e.addonId,`logs`)})}),r?.addonId===e.addonId&&r.type===`events`&&D(`div`,{className:`border-t border-border/40 bg-muted/5`,children:D(m,{addonId:e.addonId,category:`addon.*`,maxHeight:`max-h-48`,onClose:()=>s(e.addonId,`events`)})})]},e.addonId))}),p&&l.length===0&&D(`div`,{className:`px-3 py-2 pl-9 text-[10px] text-muted-foreground`,children:`No services`})]})}function se({nodeId:e,processes:t}){let[n,r]=E(null),i=(e,t)=>{r(n=>n?.addonId===e&&n.type===t?null:{addonId:e,type:t})};return t.length===0?D(`div`,{className:`py-4 text-xs text-muted-foreground text-center`,children:`No processes on this node`}):D(`div`,{className:`space-y-2 py-1`,children:t.map((t,r)=>D(oe,{proc:t,nodeId:e,defaultExpanded:r===0,activePanel:n,onTogglePanel:i},t.name))})}S();function ce(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 le(e,t=80){return e.length<=t?e:`…${e.slice(e.length-t+1)}`}function ue({nodeId:e}){let n=T(),r=s(),[i,a]=E(`all`),o=g(`metrics.node-processes-snapshot`,t=>t.nodeId===e),{data:c}=v({nodeId:e}),l=o?.processes??c,u=w(()=>l?[...l]:[],[l]),d=w(()=>i===`ghost`?u.filter(e=>e.classification===`ghost`):u,[u,i]),f=w(()=>{let e=u.filter(e=>e.classification===`ghost`),t=new Map;for(let n of e)t.has(n.ppid)||t.set(n.ppid,[]),t.get(n.ppid).push(n);return[...t.entries()].filter(([,e])=>e.length>1).map(([e,t])=>({ppid:e,children:t})).toSorted((e,t)=>t.children.length-e.children.length)},[u]),p=t({onSettled:()=>{n.invalidateQueries({queryKey:[[`metricsProvider`,`listNodeProcesses`]]})}}),m=w(()=>{let e=new Map;for(let t of u)e.set(t.pid,t.classification);return e},[u]),h=async(t,n)=>{if(t.classification===`root`||t.classification===`system`)return;let i=t.classification===`ghost`?`ghost`:t.addonId??`process`,a=n?`SIGKILL`:`SIGTERM`;await r({title:`Send ${a}?`,message:`Target pid ${t.pid} (${i}) on node ${e}.`,confirmLabel:`Send ${a}`,variant:`danger`})&&p.mutate({nodeId:e,pid:t.pid,force:n})},_=async(t,n)=>{try{await p.mutateAsync({nodeId:e,pid:t,force:n})}catch{}},y=async t=>{let i=m.get(t.ppid);if(i===`root`||i===`system`){await r({title:`Cannot kill protected ancestor`,message:i===`root`?`pid ${t.ppid} is the current node supervisor. Restart the node via the cluster page instead.`:`pid ${t.ppid} is a system ancestor (concurrently / vite / npm wrapper). Killing it would tear down the dev tree.`,confirmLabel:`OK`,cancelLabel:`Close`,variant:`warning`});return}await r({title:`Kill ghost parent + ${t.children.length} child(ren)?`,message:`SIGKILL parent pid ${t.ppid} and SIGTERM ${t.children.length} ghost child(ren) on node ${e}.`,confirmLabel:`Kill all`,variant:`danger`})&&(await Promise.all([_(t.ppid,!0),...t.children.map(e=>_(e.pid,!1))]),n.invalidateQueries({queryKey:[[`metricsProvider`,`listNodeProcesses`]]}))},b=async()=>{let t=u.filter(e=>e.classification===`ghost`);t.length!==0&&await r({title:`Kill all ${t.length} ghost process(es)?`,message:`SIGKILL ${t.length} ghost process(es) on node ${e}. This is irreversible.`,confirmLabel:`Kill all`,variant:`danger`})&&(await Promise.all(t.map(e=>_(e.pid,!0))),n.invalidateQueries({queryKey:[[`metricsProvider`,`listNodeProcesses`]]}))},x=u.filter(e=>e.classification===`ghost`).length,S=u.filter(e=>e.classification===`managed`).length,O=u.filter(e=>e.classification===`root`).length,k=u.filter(e=>e.classification===`system`).length;return C(`div`,{className:`space-y-4`,children:[C(`div`,{className:`flex items-start justify-between gap-4`,children:[C(`p`,{className:`text-[11px] text-foreground-subtle`,children:[`ps`," scan + kernel `$process.list` cross-reference. Ghosts = camstack-shaped commands with no managed binding (usually orphaned to ppid=1). Refreshes every 10s."]}),C(`button`,{type:`button`,onClick:()=>n.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:[D(M,{className:`h-3 w-3`}),` Refresh`]})]}),C(`div`,{className:`grid grid-cols-4 gap-3`,children:[C(`div`,{className:`rounded-lg border border-border p-3`,children:[D(`div`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:`Root`}),D(`div`,{className:`text-xl font-semibold text-foreground`,children:O})]}),C(`div`,{className:`rounded-lg border border-border p-3`,children:[D(`div`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:`Managed`}),D(`div`,{className:`text-xl font-semibold text-foreground`,children:S})]}),C(`div`,{className:`rounded-lg border border-border p-3`,children:[D(`div`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:`System`}),D(`div`,{className:`text-xl font-semibold text-foreground`,children:k})]}),C(`div`,{className:`rounded-lg border p-3 ${x>0?`border-destructive/40 bg-destructive/5`:`border-border`}`,children:[C(`div`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle flex items-center gap-1`,children:[x>0&&D($,{className:`h-3 w-3 text-destructive`}),` Ghosts`]}),D(`div`,{className:`text-xl font-semibold ${x>0?`text-destructive`:`text-foreground`}`,children:x})]})]}),f.length>0&&C(`div`,{className:`rounded-lg border border-amber-500/40 bg-amber-500/5 p-3`,children:[C(`div`,{className:`flex items-center gap-1 text-[11px] font-semibold text-amber-400 mb-2`,children:[D(U,{className:`h-3 w-3`}),` Recurring ghost parents (`,f.length,`)`]}),D(`div`,{className:`space-y-1.5`,children:f.map(e=>C(`div`,{className:`text-[11px] text-foreground flex items-center justify-between gap-2`,children:[C(`div`,{className:`flex items-center gap-2`,children:[C(`span`,{className:`font-mono text-foreground-subtle`,children:[`ppid `,e.ppid]}),C(`span`,{children:[`→ `,e.children.length,` ghost(s)`]})]}),C(`button`,{type:`button`,disabled:p.isPending,onClick:()=>{y(e)},className:`inline-flex items-center gap-1 rounded border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 text-[10px] text-amber-400 hover:bg-amber-500/20 disabled:opacity-30`,children:[D($,{className:`h-3 w-3`}),` Kill parent + `,e.children.length]})]},e.ppid))})]}),C(`div`,{className:`flex items-center justify-between gap-2 text-[11px]`,children:[C(`div`,{className:`flex items-center gap-2`,children:[D(`span`,{className:`text-foreground-subtle`,children:`Filter:`}),C(`button`,{type:`button`,className:`px-2 py-0.5 rounded ${i===`all`?`bg-primary text-primary-foreground`:`border border-border text-foreground hover:bg-surface-hover`}`,onClick:()=>a(`all`),children:[`All (`,u.length,`)`]}),C(`button`,{type:`button`,className:`px-2 py-0.5 rounded ${i===`ghost`?`bg-destructive text-destructive-foreground`:`border border-border text-foreground hover:bg-surface-hover`}`,onClick:()=>a(`ghost`),children:[`Ghost only (`,x,`)`]})]}),x>0&&C(`button`,{type:`button`,disabled:p.isPending,onClick:()=>{b()},className:`inline-flex items-center gap-1 rounded border border-destructive/40 bg-destructive/10 px-2 py-1 text-[11px] font-medium text-destructive hover:bg-destructive/20 disabled:opacity-30`,children:[D($,{className:`h-3 w-3`}),` Kill all `,x,` ghost(s)`]})]}),D(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:C(`table`,{className:`w-full text-xs`,children:[D(`thead`,{className:`bg-surface`,children:C(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[D(`th`,{className:`text-left px-3 py-2`,children:`Class`}),D(`th`,{className:`text-right px-3 py-2`,children:`PID`}),D(`th`,{className:`text-right px-3 py-2`,children:`PPID`}),D(`th`,{className:`text-left px-3 py-2`,children:`Addon`}),D(`th`,{className:`text-left px-3 py-2`,children:`Command`}),D(`th`,{className:`text-right px-3 py-2`,children:`CPU%`}),D(`th`,{className:`text-right px-3 py-2`,children:`RSS`}),D(`th`,{className:`text-right px-3 py-2`,children:`Uptime`}),D(`th`,{className:`w-44`})]})}),C(`tbody`,{children:[d.length===0&&D(`tr`,{children:D(`td`,{colSpan:9,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:i===`ghost`?`No ghost processes detected.`:`Scanning…`})}),d.map(e=>C(`tr`,{className:`border-t border-border ${e.classification===`ghost`?`bg-destructive/5`:``}`,children:[D(`td`,{className:`px-3 py-2`,children:D(`span`,{className:`inline-block rounded-full px-1.5 py-0.5 text-[10px] font-medium ${e.classification===`ghost`?`bg-destructive/20 text-destructive`: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})}),D(`td`,{className:`px-3 py-2 text-right font-mono text-foreground`,children:e.pid}),C(`td`,{className:`px-3 py-2 text-right font-mono text-foreground-subtle`,children:[e.ppid,e.orphaned?` ⚠`:``]}),D(`td`,{className:`px-3 py-2 text-foreground-subtle text-[11px]`,children:e.addonId??`—`}),D(`td`,{className:`px-3 py-2 font-mono text-[10px] text-foreground-subtle break-all`,children:le(e.command)}),D(`td`,{className:`px-3 py-2 text-right text-foreground`,children:e.cpuPercent.toFixed(1)}),D(`td`,{className:`px-3 py-2 text-right text-foreground`,children:Y(e.memoryRssBytes)}),D(`td`,{className:`px-3 py-2 text-right text-foreground-subtle`,children:ce(e.uptimeSec)}),D(`td`,{className:`px-3 py-2 text-right`,children:C(`div`,{className:`inline-flex gap-1`,children:[C(`button`,{type:`button`,disabled:p.isPending||e.classification===`root`||e.classification===`system`,onClick:()=>{h(e,!1)},title:`SIGTERM`,className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded border border-border text-[10px] text-foreground hover:bg-surface-hover disabled:opacity-30`,children:[D(G,{className:`h-3 w-3`}),` Term`]}),C(`button`,{type:`button`,disabled:p.isPending||e.classification===`root`||e.classification===`system`,onClick:()=>{h(e,!0)},title:`SIGKILL`,className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded border border-destructive/30 text-[10px] text-destructive hover:bg-destructive/10 disabled:opacity-30`,children:[D($,{className:`h-3 w-3`}),` Kill`]})]})})]},e.pid))]})]})}),p.isError&&C(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-[11px] text-destructive`,children:[`Kill failed:`,` `,p.error instanceof Error?p.error.message:`unknown`]})]})}function de({nodeId:e,addonIds:t}){return t.length===0?D(`div`,{className:`py-4 text-xs text-muted-foreground text-center`,children:`No addons on this node`}):D(`div`,{className:`w-full py-2`,children:D(X,{nodeId:e,addonIds:t,level:`global`})})}S();function fe({nodeId:e,addons:t}){let n=T(),{data:r,isLoading:i}=h({nodeId:e}),a=w(()=>{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]),o=l({onSuccess:()=>{n.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getCapabilityBindings`]]})}});return a.length===0?D(`div`,{className:`py-4 text-xs text-muted-foreground text-center`,children:`No capabilities on this node`}):C(`table`,{className:`w-full text-xs`,children:[D(`thead`,{children:C(`tr`,{className:`text-muted-foreground text-left`,children:[D(`th`,{className:`py-2 font-medium w-1/2`,children:`Capability`}),D(`th`,{className:`py-2 font-medium`,children:`Bound provider`})]})}),D(`tbody`,{children:a.map(({capName:t,providers:n})=>{let a=r?.[t]??n[0]??``,s=n.length===1;return C(`tr`,{className:`border-t border-border/50`,children:[D(`td`,{className:`py-2 font-medium`,children:t}),D(`td`,{className:`py-2`,children:D(`select`,{value:a,onChange:n=>o.mutate({nodeId:e,capName:t,addonId:n.target.value}),disabled:s||o.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:s?`Only one provider installed — choice becomes available once a second addon registers this capability`:void 0,children:n.map(e=>D(`option`,{value:e,children:e},e))})})]},t)})})]})}S();function pe(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 me(e){let[t,n]=E(!1),[r,i]=E(e.name),a=T(),o=p({onSuccess:()=>{a.invalidateQueries({queryKey:[[`nodes`,`topology`]]})}}),s=(e.localIps??[]).filter(e=>!e.includes(`:`)),c=(e.localIps??[]).filter(e=>e.includes(`:`)),l=async()=>{if(!r.trim()||r===e.name){n(!1);return}try{await o.mutateAsync({nodeId:e.nodeId,name:r.trim()}),n(!1)}catch(e){console.error(`Rename failed:`,e)}},u=[[`Node ID`,D(`span`,{className:`font-mono text-xs`,children:e.nodeId})],[`Display Name`,t?C(`div`,{className:`flex items-center gap-1.5`,children:[D(`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:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l(),e.key===`Escape`&&n(!1)},disabled:o.isPending,autoFocus:!0}),D(`button`,{onClick:()=>void l(),disabled:o.isPending,className:`p-0.5 text-success hover:bg-success/10 rounded`,title:`Save`,children:D(I,{className:`h-3.5 w-3.5`})}),D(`button`,{onClick:()=>n(!1),className:`p-0.5 text-muted-foreground hover:bg-muted rounded`,title:`Cancel`,children:D(V,{className:`h-3.5 w-3.5`})})]}):C(`div`,{className:`flex items-center gap-1.5`,children:[D(`span`,{className:`text-xs`,children:e.name}),!e.isHub&&D(`button`,{onClick:()=>{i(e.name),n(!0)},className:`p-0.5 text-muted-foreground hover:text-primary rounded`,title:`Rename`,children:D(A,{className:`h-3 w-3`})})]})],[`Hostname`,D(`span`,{className:`text-xs`,children:e.hostname})],[`Role`,e.isHub?D(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary font-medium`,children:`Hub`}):D(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground font-medium`,children:`Agent`})],[`Platform`,C(`span`,{className:`text-xs`,children:[e.platform,` / `,e.arch]})],[`CPU`,C(`span`,{className:`text-xs`,children:[e.cpuModel??`—`,` (`,e.cpuCores,` cores)`]})],[`Memory`,D(`span`,{className:`text-xs`,children:e.memoryMB>0?`${(e.memoryMB/1024).toFixed(1)} GB`:`—`})],[`Uptime`,D(`span`,{className:`text-xs`,children:pe(e.uptime)})],[`Engines`,e.engines.length>0?D(`div`,{className:`flex flex-wrap gap-1`,children:e.engines.map(e=>D(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-purple-500/10 text-purple-400 font-medium`,children:e},e))}):D(`span`,{className:`text-xs text-muted-foreground`,children:`—`})]];return s.length>0&&u.push([`IPv4`,D(`div`,{className:`flex flex-wrap gap-1.5`,children:s.map((e,t)=>D(`span`,{className:`font-mono text-xs px-1.5 py-0.5 rounded bg-muted`,children:e},`${e}-${t}`))})]),c.length>0&&u.push([`IPv6`,D(`div`,{className:`flex flex-wrap gap-1.5`,children:c.map((e,t)=>D(`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}`))})]),D(`div`,{className:`py-2`,children:D(`table`,{className:`w-full text-sm`,children:D(`tbody`,{children:u.map(([e,t],n)=>C(`tr`,{className:n%2==0?`bg-muted/20`:``,children:[D(`td`,{className:`py-1.5 px-2 text-xs font-medium text-muted-foreground w-28 align-top whitespace-nowrap`,children:e}),D(`td`,{className:`py-1.5 px-2`,children:t})]},e))})})})}S();function he({node:e}){let t=k(),[n,r]=E(`info`),[i,a]=E(!1),o=e.processes??[],s=e.addons.map(e=>e.id),c=async()=>{if(!i){a(!0);try{await Promise.allSettled([t.trpcClient.pipelineOrchestrator.removeAgentSettings.mutate({agentNodeId:e.id}),t.trpcClient.clusterNodes.forgetNode.mutate({nodeId:e.id})])}finally{a(!1)}}};return e.isOnline?C(`div`,{className:`border border-border rounded-xl overflow-hidden`,children:[C(`div`,{className:`flex items-center gap-3 px-4 py-3 bg-muted/30 border-b border-border`,children:[D(`div`,{className:`w-2.5 h-2.5 rounded-full bg-success`}),D(`span`,{className:`text-sm font-semibold`,children:e.name}),C(`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=>D(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-purple-500/10 text-purple-400 font-medium`,children:e},e)),C(`div`,{className:`ml-auto flex gap-3 text-xs text-muted-foreground`,children:[C(`span`,{className:`flex items-center gap-1`,children:[D(H,{className:`h-3 w-3`}),` `,e.cpuPercent,`%`]}),C(`span`,{className:`flex items-center gap-1`,children:[D(Q,{className:`h-3 w-3`}),` `,e.memoryPercent,`%`]})]})]}),D(`div`,{className:`flex border-b border-border px-4`,children:[`info`,`addons`,`forks`,`processes`,`settings`,`capabilities`].map(t=>D(`button`,{onClick:()=>r(t),className:`px-3 py-2 text-xs font-medium border-b-2 transition-colors ${n===t?`border-primary text-primary`:`border-transparent text-muted-foreground hover:text-foreground`}`,children:t===`info`?`Info`:t===`addons`?`Addons (${e.addons.length})`:t===`forks`?`Forks (${o.length})`:t===`processes`?`Processes`:t===`settings`?`Settings`:`Capabilities`},t))}),C(`div`,{className:`px-4 py-2`,children:[n===`info`&&D(me,{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}),n===`addons`&&D(ne,{nodeId:e.id,addons:e.addons,isHub:e.isHub}),n===`forks`&&D(se,{nodeId:e.id,processes:o}),n===`processes`&&D(ue,{nodeId:e.id}),n===`settings`&&D(de,{nodeId:e.id,addonIds:s}),n===`capabilities`&&D(fe,{nodeId:e.id,addons:e.addons})]})]}):C(`div`,{className:`border border-border rounded-xl overflow-hidden opacity-60`,children:[C(`div`,{className:`flex items-center gap-3 px-4 py-3 bg-muted/30`,children:[D(`div`,{className:`w-2.5 h-2.5 rounded-full bg-destructive`}),D(`span`,{className:`text-sm font-semibold`,children:e.name}),C(`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=>D(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-purple-500/10 text-purple-400 font-medium`,children:e},e)),D(`span`,{className:`ml-auto text-xs px-2 py-0.5 rounded-full bg-destructive/10 text-destructive`,children:`offline`})]}),C(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[C(`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`]}),C(`button`,{type:`button`,onClick:()=>void c(),disabled:i,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:[D(G,{className:`h-3 w-3`}),i?`Forgetting…`:`Forget node`]})]})]})}S();function ge({nodes:e,focusNodeId:t,focusNonce:n}){let r=[...e].toSorted((e,t)=>e.isHub?-1:t.isHub?1:e.isOnline&&!t.isOnline?-1:!e.isOnline&&t.isOnline?1:e.name.localeCompare(t.name)),i=x(null);return O(()=>{if(!t)return;let e=i.current?.querySelector(`#node-card-${CSS.escape(t)}`);e&&e.scrollIntoView({behavior:`smooth`,block:`start`})},[t,n]),D(`div`,{ref:i,className:`flex flex-col gap-4`,children:r.map(e=>D(`div`,{id:`node-card-${e.id}`,children:D(he,{node:e})},e.id))})}S();function _e(e){let[t,n]=E(()=>typeof window<`u`?window.matchMedia(e).matches:!1);return O(()=>{let t=window.matchMedia(e),r=e=>n(e.matches);return t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function ve(){let{data:e,isLoading:t}=n(void 0,{staleTime:1/0}),[r,i]=E(null);return u(`cluster.topology-snapshot`,e=>{let t=e.data?.nodes;Array.isArray(t)&&i(t)}),{nodes:w(()=>r??e??[],[r,e]),isLoading:t&&!r}}function ye(){let[e,t]=E(`table`),[n,r]=E(void 0),[i,a]=E(0),o=_e(`(max-width: 767px)`),s=o&&e===`graph`?`table`:e,{nodes:c,isLoading:l}=ve(),u=w(()=>J(c),[c]),d=c.filter(e=>e.isOnline).length,f=c.filter(e=>!e.isOnline).length,p=b(e=>{t(`table`),r(e),a(e=>e+1)},[]),m=(n,r,i)=>C(`button`,{onClick:()=>t(n),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors ${e===n?`bg-primary text-primary-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[D(i,{className:`h-3.5 w-3.5`}),r]});return C(`div`,{className:`flex flex-col h-full gap-4 p-4`,children:[C(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[C(`div`,{className:`flex items-center gap-2`,children:[d>0&&C(`span`,{className:`text-xs px-2 py-0.5 rounded-full bg-success/10 text-success`,children:[d,` online`]}),f>0&&C(`span`,{className:`text-xs px-2 py-0.5 rounded-full bg-destructive/10 text-destructive`,children:[f,` offline`]})]}),C(`div`,{className:`flex gap-0.5 p-1 rounded-lg bg-muted`,children:[m(`table`,`Table`,ee),!o&&m(`graph`,`Graph`,Z)]})]}),l?D(`div`,{className:`flex items-center justify-center flex-1 text-muted-foreground`,children:`Loading cluster topology...`}):s===`graph`?D(q,{graph:u,onOpenNodeDetail:p}):D(`div`,{className:`flex-1 overflow-auto`,children:D(ge,{nodes:c,focusNodeId:n,focusNonce:i})})]})}export{ye as ClusterPage};
|