@camstack/addon-admin-ui 1.2.59 → 1.2.60
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-nmw7yXa5.js +1 -0
- package/dist/assets/AddonCollectionPage-L-_Ay0C2.js +1 -0
- package/dist/assets/Addons-Ce18i_2K.js +1 -0
- package/dist/assets/{AdminPage-Dq33XE9j.js → AdminPage-CCD07UMs.js} +1 -1
- package/dist/assets/{AdminTabs-Co61VJ4U.js → AdminTabs-VEJ9aAds.js} +1 -1
- package/dist/assets/AiProfiles-BmyaHJsG.js +3 -0
- package/dist/assets/BrokerForm-C_ydrEiE.js +1 -0
- package/dist/assets/Build-B0V3eQCD.js +32 -0
- package/dist/assets/Capabilities-mYaTP3zj.js +1 -0
- package/dist/assets/{CapabilityBadges-Do48_jzx.js → CapabilityBadges-CUuQq9C6.js} +1 -1
- package/dist/assets/Cluster-CAPVntiH.js +1 -0
- package/dist/assets/Data-Cy6cxYnL.js +1 -0
- package/dist/assets/DetectionIntelligence-D_UfLFUs.js +1 -0
- package/dist/assets/{DeviceAggregateSection-n3hYy5qm.js → DeviceAggregateSection-cezz4Q1I.js} +1 -1
- package/dist/assets/DeviceDetail-OZn62WTd.js +2 -0
- package/dist/assets/Devices-B7naJHzB.js +1 -0
- package/dist/assets/EmbedPlayerPage-CUJ-TF0I.js +1 -0
- package/dist/assets/Events-C54Nf_FA.js +1 -0
- package/dist/assets/FormBuilder-79Fgr735.js +1 -0
- package/dist/assets/Identity-C-vZI88k.js +1 -0
- package/dist/assets/IntegrationDetail-hg7RVODR.js +1 -0
- package/dist/assets/Integrations-BDhj7UlK.js +1 -0
- package/dist/assets/Integrations-CD7WfSkd.js +1 -0
- package/dist/assets/Logs-BlgZwoZu.js +1 -0
- package/dist/assets/{MaskShapeCanvas-pGn6MKOi.js → MaskShapeCanvas-Dcpby34M.js} +1 -1
- package/dist/assets/MotionZonesSettings-B-y6Y1Xg.js +1 -0
- package/dist/assets/MyAccess-D62ngaEJ.js +2 -0
- package/dist/assets/Network-DNg2yCKK.js +1 -0
- package/dist/assets/NodeAddonsSettingsPanel-B_e7Y4br.js +1 -0
- package/dist/assets/NodeInferenceDevices-DTEpjg6z.js +1 -0
- package/dist/assets/Notifications-DZywZPYK.js +1 -0
- package/dist/assets/Pipeline-BGd2zTfL.js +1 -0
- package/dist/assets/Plates-Dgn8ovPo.js +1 -0
- package/dist/assets/PrivacyMaskSettings-aqN_KJa8.js +1 -0
- package/dist/assets/{ProviderIcon-B5c5wlw9.js → ProviderIcon-CSVJE_O0.js} +1 -1
- package/dist/assets/Recordings-WBG1aCx6.js +1 -0
- package/dist/assets/ScanNetworkModal-BY3gf03t.js +1 -0
- package/dist/assets/SceneMonitorEditor-BZimh2ck.js +1 -0
- package/dist/assets/Scenes-DeCu0w94.js +1 -0
- package/dist/assets/{SchemaTabBar-BrF8ZUiR.js → SchemaTabBar-DC28nb9j.js} +1 -1
- package/dist/assets/Settings-BVd4lsaN.js +1 -0
- package/dist/assets/{Showroom-CBvbRA83.js → Showroom-DFG_5cnr.js} +1 -1
- package/dist/assets/{StableTabPanel-p16epZGa.js → StableTabPanel-Dc954AQl.js} +1 -1
- package/dist/assets/{StatusBadge-Dcr2bw58.js → StatusBadge-CeptlsPG.js} +1 -1
- package/dist/assets/{Terminal-BSwEKm0g.js → Terminal-QEGYVgmV.js} +2 -2
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-xKOm5ETc.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-C6w2JXhl.js} +1 -1
- package/dist/assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js +1 -0
- package/dist/assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-8kv6pj9W.js +6 -0
- package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-DkcC9IVF.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-DN3UpM8E.js} +1 -1
- package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-D9-wIasd.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-BsvPG3BX.js} +1 -1
- package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-DstpX0yz.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-DtoGixA1.js} +1 -1
- package/dist/assets/{_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_konva__loadShare__.js-BBBrLLEa.js → _virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_konva__loadShare__.js-PmiLsYEK.js} +1 -1
- package/dist/assets/{authed-media-B8T1dsFh.js → authed-media-BPd_L9jr.js} +1 -1
- package/dist/assets/{bell-ring-BqgJ8dnI.js → bell-ring-BdqqbAsS.js} +1 -1
- package/dist/assets/{boxes-BCCj5PaE.js → boxes-Di4kSEDf.js} +1 -1
- package/dist/assets/build-cluster-graph-BgVD-LXn.js +7 -0
- package/dist/assets/circle-check-big-C6H3pgU0.js +1 -0
- package/dist/assets/{circle-x-DmD78bDU.js → circle-x-BZtdhG1q.js} +1 -1
- package/dist/assets/clock-Dkewc-gM.js +1 -0
- package/dist/assets/{copy-lMFz0Is-.js → copy-B3EObRTl.js} +1 -1
- package/dist/assets/{debounced-invalidate-CCYTebYW.js → debounced-invalidate-kboD8U--.js} +1 -1
- package/dist/assets/dist-CZzC-g02.js +345 -0
- package/dist/assets/{dist-CK_B4BKB.js → dist-DG2WQw7F.js} +1 -1
- package/dist/assets/{download-CXXQf3fF.js → download-zOlfMwmw.js} +1 -1
- package/dist/assets/{face-bbox-DAP66Zl4.js → face-bbox-Bdb4p_vZ.js} +1 -1
- package/dist/assets/{hard-drive-gxnGyiw0.js → hard-drive-CEELYlZc.js} +1 -1
- package/dist/assets/{hostInit-B_AsKiXE.js → hostInit-DQGrrD-J.js} +1 -1
- package/dist/assets/index-BfeBVcjY.js +4 -0
- package/dist/assets/{key-round-ClzJuSaS.js → key-round-B4uUkd69.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-53feb26e.js → mf-entry-bootstrap-0-f9457985.js} +2 -2
- package/dist/assets/{pencil-OtLKJIw8.js → pencil-BFtrhTcL.js} +1 -1
- package/dist/assets/play-CAOvtlt9.js +1 -0
- package/dist/assets/player-overlays-CYHBR24b.js +1 -0
- package/dist/assets/plus-CT9BkTdL.js +1 -0
- package/dist/assets/power-C3GOj5RH.js +1 -0
- package/dist/assets/{radio-B8HIjRjm.js → radio-D6rodlbU.js} +1 -1
- package/dist/assets/{refresh-cw-BwezRSth.js → refresh-cw-BBMiW3q-.js} +1 -1
- package/dist/assets/remoteEntry-96xMdM9r.js +1 -0
- package/dist/assets/rotate-ccw-B3RVJZHZ.js +1 -0
- package/dist/assets/rotate-cw-Dt9c2DJW.js +1 -0
- package/dist/assets/search-DTWCy4IW.js +1 -0
- package/dist/assets/{send-DLoLyQZY.js → send-5Q9K_RF0.js} +1 -1
- package/dist/assets/{server-jIBmmmio.js → server-DVsXQl7s.js} +1 -1
- package/dist/assets/square-CEELVm2C.js +1 -0
- package/dist/assets/{square-check-big-CKAjnVKI.js → square-check-big-B39UzQnv.js} +1 -1
- package/dist/assets/src-gHOaseTq.js +67 -0
- package/dist/assets/src-k7u3Lt4U.js +345 -0
- package/dist/assets/{undo-2-8_qvXX1O.js → undo-2-DgZBtWUR.js} +1 -1
- package/dist/assets/{upload-DUXkaKq1.js → upload-xzQ3maRZ.js} +1 -1
- package/dist/assets/{useBodyScrollLock-B_rtaBV1.js → useBodyScrollLock-BDocajQE.js} +1 -1
- package/dist/assets/useEventInvalidation-HvWohuH6.js +1 -0
- package/dist/assets/{video-DKFg6rjo.js → video-CRvcPI-y.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DRkfmg3i.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-B_q_nV5G.js} +2 -2
- package/dist/assets/{wifi-DT5Z6S_y.js → wifi-gnm9Xr91.js} +1 -1
- package/dist/assets/{zap-B5xlyN9v.js → zap-D_23PdBs.js} +1 -1
- package/dist/index.html +5 -5
- package/dist/server/addon.js +240 -40
- package/package.json +1 -1
- package/dist/assets/AddLocationWizard-BXcL90QM.js +0 -1
- package/dist/assets/AddonCollectionPage-C7QSc0L5.js +0 -1
- package/dist/assets/Addons-BjibMtF0.js +0 -1
- package/dist/assets/AiProfiles-BTRgo8wQ.js +0 -3
- package/dist/assets/BrokerForm-dYfcx-yx.js +0 -1
- package/dist/assets/Build-CeZh7cjz.js +0 -32
- package/dist/assets/Capabilities-DqpHPDt5.js +0 -1
- package/dist/assets/Cluster-C1ow3yuB.js +0 -1
- package/dist/assets/Data-Bmealxcc.js +0 -1
- package/dist/assets/DetectionIntelligence-DSjppxYS.js +0 -1
- package/dist/assets/DeviceDetail-f12eUwKC.js +0 -2
- package/dist/assets/Devices-CMuMzwTK.js +0 -1
- package/dist/assets/EmbedPlayerPage-D5CGJj62.js +0 -1
- package/dist/assets/Events-CWhiAlpv.js +0 -1
- package/dist/assets/FormBuilder-DVbN4jV5.js +0 -1
- package/dist/assets/Identity-BxlWiwaZ.js +0 -1
- package/dist/assets/IntegrationDetail-D-EyePxA.js +0 -1
- package/dist/assets/Integrations-CVh8WXwB.js +0 -1
- package/dist/assets/Integrations-fubIeAyS.js +0 -1
- package/dist/assets/Logs-BRgM3t9y.js +0 -1
- package/dist/assets/MotionZonesSettings-BQz60XWV.js +0 -1
- package/dist/assets/MyAccess-kWZq3W2o.js +0 -2
- package/dist/assets/Network-CgSVh1De.js +0 -1
- package/dist/assets/NodeAddonsSettingsPanel-DJKQxT7V.js +0 -1
- package/dist/assets/NodeInferenceDevices-BTPZ_wyg.js +0 -1
- package/dist/assets/Notifications-NpPQQefM.js +0 -1
- package/dist/assets/Pipeline-BaYygdkg.js +0 -1
- package/dist/assets/Plates-jNVVmALy.js +0 -1
- package/dist/assets/PrivacyMaskSettings-C4YaoDu_.js +0 -1
- package/dist/assets/Recordings-D5v6ma1R.js +0 -1
- package/dist/assets/ScanNetworkModal-WPD06cKp.js +0 -1
- package/dist/assets/SceneMonitorEditor-Czf-iZgv.js +0 -1
- package/dist/assets/Settings-DvWeXqKw.js +0 -1
- package/dist/assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js +0 -1
- package/dist/assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-CSJxMxg6.js +0 -6
- package/dist/assets/build-cluster-graph-DMQ4vDW2.js +0 -7
- package/dist/assets/circle-check-big-CQsfhCrZ.js +0 -1
- package/dist/assets/clock-0kqs7-NB.js +0 -1
- package/dist/assets/dist-BX6atE5N.js +0 -345
- package/dist/assets/index-B6kDpXr5.js +0 -4
- package/dist/assets/play-Q-R5vHEh.js +0 -1
- package/dist/assets/plus-vrCV3Fn-.js +0 -1
- package/dist/assets/power-Dw-9Qin8.js +0 -1
- package/dist/assets/remoteEntry-DOOomD9n.js +0 -1
- package/dist/assets/rotate-ccw-uOQBDtri.js +0 -1
- package/dist/assets/rotate-cw-B6qXQ5pJ.js +0 -1
- package/dist/assets/search-iOwuoJNQ.js +0 -1
- package/dist/assets/square-CgzDPTwM.js +0 -1
- package/dist/assets/src-BizjMCcy.js +0 -345
- package/dist/assets/src-BmAmiAXy.js +0 -67
- package/dist/assets/useEventInvalidation-Dovpg3no.js +0 -1
- package/dist/assets/widget-panel-BF8s8cZY.js +0 -1
package/dist/server/addon.js
CHANGED
|
@@ -5398,12 +5398,6 @@ Object.fromEntries([
|
|
|
5398
5398
|
icon: "shapes",
|
|
5399
5399
|
order: 38
|
|
5400
5400
|
},
|
|
5401
|
-
{
|
|
5402
|
-
id: "scenes",
|
|
5403
|
-
label: "Scenes",
|
|
5404
|
-
icon: "scan-eye",
|
|
5405
|
-
order: 36
|
|
5406
|
-
},
|
|
5407
5401
|
{
|
|
5408
5402
|
id: "analytics",
|
|
5409
5403
|
label: "Analytics",
|
|
@@ -12191,6 +12185,17 @@ var LlmImageSchema = object({
|
|
|
12191
12185
|
bytes: _instanceof(Uint8Array),
|
|
12192
12186
|
mimeType: string()
|
|
12193
12187
|
});
|
|
12188
|
+
/**
|
|
12189
|
+
* Retry policy. `enabled: false` is NOT the same as `maxAttempts: 1` in intent —
|
|
12190
|
+
* the flag is what a consumer table flips, the count is what the operator tunes.
|
|
12191
|
+
* A retry doubles the wall time of a call, so the two gates that run inside a
|
|
12192
|
+
* notification's budget keep it off (see `CONSUMER_RETRY_POLICY` in addon-ai).
|
|
12193
|
+
*/
|
|
12194
|
+
var LlmRetryPolicySchema = object({
|
|
12195
|
+
enabled: boolean().default(false),
|
|
12196
|
+
/** Total attempts INCLUDING the first. 1 = no retry. */
|
|
12197
|
+
maxAttempts: number().int().min(1).max(5).default(1)
|
|
12198
|
+
});
|
|
12194
12199
|
var LlmGenerateBaseInputSchema = object({
|
|
12195
12200
|
/** Collection routing (the notification-output posture). */
|
|
12196
12201
|
addonId: string().optional(),
|
|
@@ -12205,7 +12210,28 @@ var LlmGenerateBaseInputSchema = object({
|
|
|
12205
12210
|
jsonSchema: record(string(), unknown()).optional(),
|
|
12206
12211
|
/** Per-call override of the profile default. */
|
|
12207
12212
|
maxTokens: number().int().positive().optional(),
|
|
12208
|
-
temperature: number().optional()
|
|
12213
|
+
temperature: number().optional(),
|
|
12214
|
+
/** Per-call override of the profile default (nucleus sampling). */
|
|
12215
|
+
topP: number().min(0).max(1).optional(),
|
|
12216
|
+
/** Per-call override of the profile default (top-k sampling). */
|
|
12217
|
+
topK: number().int().positive().optional(),
|
|
12218
|
+
/** Per-call override of `profile.timeoutMs` — the total generation bound. */
|
|
12219
|
+
timeoutMs: number().int().positive().optional(),
|
|
12220
|
+
/** Per-call override; beats both the consumer table and the profile. */
|
|
12221
|
+
retry: LlmRetryPolicySchema.optional(),
|
|
12222
|
+
/**
|
|
12223
|
+
* Caller-minted id that makes this generation CANCELLABLE.
|
|
12224
|
+
*
|
|
12225
|
+
* Without it a caller that stops waiting cannot stop the work: the gates race
|
|
12226
|
+
* the call against 8 s and free their own slot when the timer wins, while the
|
|
12227
|
+
* generation upstream keeps running to `profile.timeoutMs` — 60 s by default,
|
|
12228
|
+
* on a single-threaded local model. The per-camera bound then counts WAITS,
|
|
12229
|
+
* not generations, and the real load is unbounded.
|
|
12230
|
+
*
|
|
12231
|
+
* `AbortSignal` cannot cross a process boundary; an id can. Pass one here and
|
|
12232
|
+
* `llm.cancel({ requestId })` tears the socket down.
|
|
12233
|
+
*/
|
|
12234
|
+
requestId: string().optional()
|
|
12209
12235
|
});
|
|
12210
12236
|
/**
|
|
12211
12237
|
* `llm-runtime` — node-side managed llama.cpp executor (spec §4). Registered
|
|
@@ -12244,8 +12270,49 @@ var ManagedRuntimeConfigSchema = object({
|
|
|
12244
12270
|
gpuLayers: number().int().default(0),
|
|
12245
12271
|
/** Default: cpus-2, clamped ≥1 (resolved node-side). */
|
|
12246
12272
|
threads: number().int().optional(),
|
|
12247
|
-
/** Concurrent slots. */
|
|
12273
|
+
/** Concurrent slots (`--parallel`). */
|
|
12248
12274
|
parallel: number().int().default(1),
|
|
12275
|
+
/** Logical batch size (`-b`). Larger = faster prompt ingest, more RAM. */
|
|
12276
|
+
batchSize: number().int().positive().optional(),
|
|
12277
|
+
/** Physical batch / micro-batch (`-ub`). */
|
|
12278
|
+
ubatchSize: number().int().positive().optional(),
|
|
12279
|
+
/**
|
|
12280
|
+
* `--flash-attn`. Cuts KV-cache memory on the backends that implement it and
|
|
12281
|
+
* is a no-op elsewhere, so it is offered rather than assumed.
|
|
12282
|
+
*/
|
|
12283
|
+
flashAttention: boolean().default(false),
|
|
12284
|
+
/**
|
|
12285
|
+
* `--mlock`. Pins the weights in RAM so the OS cannot page them out mid
|
|
12286
|
+
* inference. Costs the full model size in resident memory — which is exactly
|
|
12287
|
+
* what the RAM budget is counting.
|
|
12288
|
+
*/
|
|
12289
|
+
mlock: boolean().default(false),
|
|
12290
|
+
/**
|
|
12291
|
+
* `--no-mmap`. Reads the whole GGUF up front instead of mapping it. Slower to
|
|
12292
|
+
* start, but avoids the page-fault stalls a network or spinning-disk model
|
|
12293
|
+
* store produces on every first token.
|
|
12294
|
+
*/
|
|
12295
|
+
noMmap: boolean().default(false),
|
|
12296
|
+
/** `--cache-type-k` / `--cache-type-v` — quantising the KV cache is the
|
|
12297
|
+
* cheapest way to fit a longer context in the same RAM. */
|
|
12298
|
+
cacheTypeK: _enum([
|
|
12299
|
+
"f32",
|
|
12300
|
+
"f16",
|
|
12301
|
+
"q8_0",
|
|
12302
|
+
"q5_1",
|
|
12303
|
+
"q5_0",
|
|
12304
|
+
"q4_1",
|
|
12305
|
+
"q4_0"
|
|
12306
|
+
]).optional(),
|
|
12307
|
+
cacheTypeV: _enum([
|
|
12308
|
+
"f32",
|
|
12309
|
+
"f16",
|
|
12310
|
+
"q8_0",
|
|
12311
|
+
"q5_1",
|
|
12312
|
+
"q5_0",
|
|
12313
|
+
"q4_1",
|
|
12314
|
+
"q4_0"
|
|
12315
|
+
]).optional(),
|
|
12249
12316
|
/** Else lazy: first generate boots it. */
|
|
12250
12317
|
autoStart: boolean().default(false),
|
|
12251
12318
|
/** 0 = never; frees RAM after quiet periods. */
|
|
@@ -12333,10 +12400,44 @@ var LlmProfileSchema = object({
|
|
|
12333
12400
|
baseUrl: string().optional(),
|
|
12334
12401
|
/** ConfigUISchema type:'password' — never round-trips (spec §5). */
|
|
12335
12402
|
apiKey: string().optional(),
|
|
12403
|
+
/** Vision on/off. A vision call against a `false` profile is REFUSED, never
|
|
12404
|
+
* degraded to text — that shipped once and produced a confident answer to a
|
|
12405
|
+
* question about a picture nobody sent. */
|
|
12336
12406
|
supportsVision: boolean(),
|
|
12337
12407
|
temperature: number().min(0).max(2).optional(),
|
|
12408
|
+
/** Nucleus sampling. Every wire we speak has it. */
|
|
12409
|
+
topP: number().min(0).max(1).optional(),
|
|
12410
|
+
/** Top-k sampling. Carried only by the wires that have it — NEITHER OpenAI
|
|
12411
|
+
* wire does, and the client drops it there (measured: the request body gets
|
|
12412
|
+
* `top_p` and no `top_k`). The profile editor hides the field wherever it
|
|
12413
|
+
* would change nothing; `KINDS_WITH_TOP_K` is the single owner of that list. */
|
|
12414
|
+
topK: number().int().positive().optional(),
|
|
12338
12415
|
maxTokens: number().int().positive().optional(),
|
|
12416
|
+
/** Prompt context window. Advisory for cloud kinds (they enforce their own);
|
|
12417
|
+
* for `managed-local` it is the llama.cpp `--ctx-size` the runtime starts
|
|
12418
|
+
* the model with, so it is the one field that changes a PROCESS. */
|
|
12419
|
+
contextLength: number().int().positive().optional(),
|
|
12420
|
+
/** Default system prompt. A caller's `system` REPLACES it (never appends —
|
|
12421
|
+
* two system prompts fighting is worse than either alone). */
|
|
12422
|
+
systemPrompt: string().optional(),
|
|
12423
|
+
/** Total generation bound — the only one a unary call has. */
|
|
12339
12424
|
timeoutMs: number().int().positive().default(6e4),
|
|
12425
|
+
/** Wait for response headers only. */
|
|
12426
|
+
connectTimeoutMs: number().int().positive().default(1e4),
|
|
12427
|
+
/** Accepted, but no output yet — a cold GPU load lives here. */
|
|
12428
|
+
firstTokenTimeoutMs: number().int().positive().default(12e4),
|
|
12429
|
+
/** Output started then stopped. */
|
|
12430
|
+
idleTimeoutMs: number().int().positive().default(6e4),
|
|
12431
|
+
/** Profile-level default. The per-consumer table and a per-call override
|
|
12432
|
+
* both beat it — see `resolveRetryPolicy`. */
|
|
12433
|
+
retry: LlmRetryPolicySchema.default({
|
|
12434
|
+
enabled: false,
|
|
12435
|
+
maxAttempts: 1
|
|
12436
|
+
}),
|
|
12437
|
+
/** Whether this profile may use tools. The tool-call plumbing rides the
|
|
12438
|
+
* library; the REGISTRY of callable tools is ours and is empty in v1, so a
|
|
12439
|
+
* `true` here buys the wiring, not behaviour, until tools are registered. */
|
|
12440
|
+
toolsEnabled: boolean().default(false),
|
|
12340
12441
|
extraHeaders: record(string(), string()).optional(),
|
|
12341
12442
|
/** kind === 'managed-local' only (spec §4). */
|
|
12342
12443
|
runtime: ManagedRuntimeConfigSchema.optional()
|
|
@@ -12398,7 +12499,10 @@ var ProfileRefInputSchema = object({
|
|
|
12398
12499
|
addonId: string(),
|
|
12399
12500
|
profileId: string()
|
|
12400
12501
|
});
|
|
12401
|
-
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({
|
|
12502
|
+
method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(GenerateVisionInputSchema, LlmGenerateResultSchema, { kind: "mutation" }), method(object({
|
|
12503
|
+
addonId: string().optional(),
|
|
12504
|
+
requestId: string()
|
|
12505
|
+
}), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
|
|
12402
12506
|
kind: "mutation",
|
|
12403
12507
|
auth: "admin"
|
|
12404
12508
|
}), method(ProfileRefInputSchema, _void(), {
|
|
@@ -14134,28 +14238,36 @@ var NcOccupancyConditionSchema = object({
|
|
|
14134
14238
|
/**
|
|
14135
14239
|
* Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
|
|
14136
14240
|
*
|
|
14137
|
-
*
|
|
14138
|
-
*
|
|
14139
|
-
*
|
|
14140
|
-
*
|
|
14141
|
-
*
|
|
14142
|
-
*
|
|
14143
|
-
*
|
|
14144
|
-
*
|
|
14145
|
-
*
|
|
14146
|
-
*
|
|
14147
|
-
*
|
|
14148
|
-
*
|
|
14149
|
-
*
|
|
14150
|
-
*
|
|
14151
|
-
*
|
|
14152
|
-
*
|
|
14153
|
-
*
|
|
14154
|
-
*
|
|
14155
|
-
*
|
|
14156
|
-
*
|
|
14157
|
-
*
|
|
14158
|
-
* `
|
|
14241
|
+
* **TWO EXCLUSIVE MODES** (operator decision 2026-08-14, D157). Which one a
|
|
14242
|
+
* rule is in is not a stored field — it is WHICH FILTER the rule carries, so
|
|
14243
|
+
* there is no second switch that can disagree with the first and every rule
|
|
14244
|
+
* authored before the decision migrates for free (`audioModeOf`):
|
|
14245
|
+
*
|
|
14246
|
+
* - **LABEL mode — `labels` present.** The rule fires on the FIRST frame the
|
|
14247
|
+
* classifier labels with one of them. No window, no percentage:
|
|
14248
|
+
* `hitPercent` and `samplingSeconds` are ignored, and the rule's own
|
|
14249
|
+
* `throttle` cooldown is the only brake. The per-label confidence floor is
|
|
14250
|
+
* the analyzer's (`classificationMinScore`, per device) — a label only
|
|
14251
|
+
* reaches this condition if the classifier was already confident enough.
|
|
14252
|
+
* - **LEVEL mode — `dbThreshold` present, no labels.** The sampling window IS
|
|
14253
|
+
* the condition: at least `hitPercent`% of the samples over
|
|
14254
|
+
* `samplingSeconds` must be at or above `dbThreshold` dBFS (see
|
|
14255
|
+
* {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale). The window
|
|
14256
|
+
* must be FULL before it can match — a window open for two of its ten
|
|
14257
|
+
* seconds is 100% of nothing.
|
|
14258
|
+
*
|
|
14259
|
+
* **Why label mode has no window.** It had one, and it never fired: the
|
|
14260
|
+
* analyzer emits ~1 audio frame per second but YAMNet only LABELS one to three
|
|
14261
|
+
* of them per episode, even through continuous crying. The measured maximum
|
|
14262
|
+
* `hitPercent` over the whole live history was 40 — under the shipped default
|
|
14263
|
+
* of 60, so a label rule could not fire at all, ever. A percentage of frames is
|
|
14264
|
+
* the wrong question to ask of a sparse classifier.
|
|
14265
|
+
*
|
|
14266
|
+
* **Fail-closed when NEITHER is given** — every sample would be a trivial hit
|
|
14267
|
+
* and the rule would fire on silence. The schema cannot express "exactly one
|
|
14268
|
+
* of" without becoming a ZodEffects the cap path would have to special-case, so
|
|
14269
|
+
* the exclusivity is enforced where every editor writes (`patchAudio`) and a
|
|
14270
|
+
* legacy rule carrying both resolves to LABEL (the mode that fires).
|
|
14159
14271
|
*
|
|
14160
14272
|
* Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
|
|
14161
14273
|
* `audio-*` ids). Both spellings are accepted — the matcher normalizes the
|
|
@@ -14163,13 +14275,13 @@ var NcOccupancyConditionSchema = object({
|
|
|
14163
14275
|
* an operator who typed `dog` mean the same thing.
|
|
14164
14276
|
*/
|
|
14165
14277
|
var NcAudioConditionSchema = object({
|
|
14166
|
-
/**
|
|
14278
|
+
/** LABEL MODE: audio macro labels. Present ⇒ fires on the first labelled frame. */
|
|
14167
14279
|
labels: array(string().min(1)).min(1).optional(),
|
|
14168
|
-
/**
|
|
14280
|
+
/** LEVEL MODE: floor in dBFS (negative-going, `0` = full scale). */
|
|
14169
14281
|
dbThreshold: number().min(-96).max(0).optional(),
|
|
14170
|
-
/**
|
|
14282
|
+
/** LEVEL MODE ONLY: percentage of the window's samples that must be hits (1–100). */
|
|
14171
14283
|
hitPercent: number().int().min(1).max(100).default(60),
|
|
14172
|
-
/**
|
|
14284
|
+
/** LEVEL MODE ONLY: length of the sampling window in seconds. */
|
|
14173
14285
|
samplingSeconds: number().int().min(1).max(300).default(10)
|
|
14174
14286
|
});
|
|
14175
14287
|
/**
|
|
@@ -24125,10 +24237,22 @@ method(object({
|
|
|
24125
24237
|
* thing except the comparator: `similarity` (CLIP cosine at the same ROI coords
|
|
24126
24238
|
* vs condition-tagged references) and `llm` (vision-LLM judgment over the crop).
|
|
24127
24239
|
*
|
|
24128
|
-
*
|
|
24129
|
-
*
|
|
24130
|
-
*
|
|
24131
|
-
*
|
|
24240
|
+
* **No `deviceConfig`, deliberately.** This shipped as the D14 widget archetype,
|
|
24241
|
+
* which put a "Scenes" tab on one camera's detail page. That is the wrong shape
|
|
24242
|
+
* for the thing: a scene is a standing question about the property ("is the bin
|
|
24243
|
+
* still out"), and the operator's question is "which of my scenes have tripped",
|
|
24244
|
+
* across every camera at once — not "what does camera 617 think". Buried one
|
|
24245
|
+
* camera deep it also could not be found. The surface is now a top-level admin
|
|
24246
|
+
* page (`/scenes`, `pages/Scenes.tsx`) that lists every scene on every camera and
|
|
24247
|
+
* picks the camera inside the create flow, the same shape Events and Faces have.
|
|
24248
|
+
*
|
|
24249
|
+
* The consequence to keep in mind: `host/scene-monitor-editor` is gone from
|
|
24250
|
+
* `HOST_WIDGETS` too. `scripts/check-host-widget-resolves.ts` asserts BOTH
|
|
24251
|
+
* directions, so a registration nobody declares fails exactly as loudly as a
|
|
24252
|
+
* declaration nobody registers. The editor is imported directly by the page.
|
|
24253
|
+
*
|
|
24254
|
+
* `status.kind:'push'` — the engine pushes on every hysteresis flip /
|
|
24255
|
+
* availability change; consumers never poll.
|
|
24132
24256
|
*/
|
|
24133
24257
|
/** Extensible condition tag. Seeded 'day' | 'ir' (the two variants the operator
|
|
24134
24258
|
* captures) plus 'night' | 'dawn' | 'dusk' from the resolver's sun-times band.
|
|
@@ -24657,12 +24781,64 @@ var NetworkAddressSchema = object({
|
|
|
24657
24781
|
family: string(),
|
|
24658
24782
|
internal: boolean()
|
|
24659
24783
|
});
|
|
24784
|
+
/**
|
|
24785
|
+
* Provenance of the site coordinates, and the whole reason this is not just two
|
|
24786
|
+
* numbers.
|
|
24787
|
+
*
|
|
24788
|
+
* - `operator-set` — a human typed it, or accepted a detection. Authoritative;
|
|
24789
|
+
* nothing overwrites it.
|
|
24790
|
+
* - `derived-from-ip` — the hub geolocated its own public IP once, because a
|
|
24791
|
+
* default that is right to a few kilometres beats the coarse UTC clock split
|
|
24792
|
+
* the sun-times consumers otherwise fall back to.
|
|
24793
|
+
*
|
|
24794
|
+
* The UI shows which one it is. An operator who cannot tell a guess from their
|
|
24795
|
+
* own input will eventually trust the guess.
|
|
24796
|
+
*/
|
|
24797
|
+
var SiteLocationSourceSchema = _enum(["operator-set", "derived-from-ip"]);
|
|
24798
|
+
/**
|
|
24799
|
+
* The read shape: the location plus the honest state of the one-shot derivation.
|
|
24800
|
+
*
|
|
24801
|
+
* `derivationAttemptedAt` is what makes the "one call, ever" contract
|
|
24802
|
+
* inspectable. When it is set and `location` is null, the geo-IP lookup ran and
|
|
24803
|
+
* failed; the hub will NOT try again on its own — the fallback is declared
|
|
24804
|
+
* (consumers degrade to their own last resort) and the operator either types the
|
|
24805
|
+
* coordinates or presses detect.
|
|
24806
|
+
*/
|
|
24807
|
+
var SiteLocationStatusSchema = object({
|
|
24808
|
+
location: object({
|
|
24809
|
+
/** WGS84 decimal degrees. */
|
|
24810
|
+
latitude: number().min(-90).max(90),
|
|
24811
|
+
longitude: number().min(-180).max(180),
|
|
24812
|
+
source: SiteLocationSourceSchema,
|
|
24813
|
+
/** Epoch ms the value was last written. */
|
|
24814
|
+
updatedAt: number(),
|
|
24815
|
+
/**
|
|
24816
|
+
* Human-readable place the geo-IP service reported ("Napoli, IT"). Display
|
|
24817
|
+
* only — never parsed, never matched on. Absent for an operator-typed value.
|
|
24818
|
+
*/
|
|
24819
|
+
label: string().optional()
|
|
24820
|
+
}).nullable(),
|
|
24821
|
+
derivationAttemptedAt: number().nullable(),
|
|
24822
|
+
/** Why the last derivation failed, for the UI to show instead of a shrug. */
|
|
24823
|
+
derivationError: string().nullable()
|
|
24824
|
+
});
|
|
24825
|
+
/** `null` clears the location and re-arms nothing — the derivation stays spent. */
|
|
24826
|
+
var SetSiteLocationInputSchema = object({
|
|
24827
|
+
latitude: number().min(-90).max(90),
|
|
24828
|
+
longitude: number().min(-180).max(180)
|
|
24829
|
+
}).nullable();
|
|
24660
24830
|
method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), method(_void(), FeatureManifestSchema), method(_void(), array(NetworkAddressSchema).readonly()), method(_void(), unknown().nullable(), { auth: "admin" }), method(record(string(), unknown()), _null(), {
|
|
24661
24831
|
kind: "mutation",
|
|
24662
24832
|
auth: "admin"
|
|
24663
24833
|
}), method(_void(), _void(), {
|
|
24664
24834
|
kind: "mutation",
|
|
24665
24835
|
auth: "admin"
|
|
24836
|
+
}), method(_void(), SiteLocationStatusSchema), method(SetSiteLocationInputSchema, SiteLocationStatusSchema, {
|
|
24837
|
+
kind: "mutation",
|
|
24838
|
+
auth: "admin"
|
|
24839
|
+
}), method(_void(), SiteLocationStatusSchema, {
|
|
24840
|
+
kind: "mutation",
|
|
24841
|
+
auth: "admin"
|
|
24666
24842
|
});
|
|
24667
24843
|
object({
|
|
24668
24844
|
/** True when the device's tamper switch / case-open contact is
|
|
@@ -27392,6 +27568,12 @@ Object.freeze({
|
|
|
27392
27568
|
addonId: null,
|
|
27393
27569
|
access: "create"
|
|
27394
27570
|
},
|
|
27571
|
+
"llm.cancel": {
|
|
27572
|
+
capName: "llm",
|
|
27573
|
+
capScope: "system",
|
|
27574
|
+
addonId: null,
|
|
27575
|
+
access: "create"
|
|
27576
|
+
},
|
|
27395
27577
|
"llm.deleteModel": {
|
|
27396
27578
|
capName: "llm",
|
|
27397
27579
|
capScope: "system",
|
|
@@ -30326,6 +30508,12 @@ Object.freeze({
|
|
|
30326
30508
|
addonId: null,
|
|
30327
30509
|
access: "create"
|
|
30328
30510
|
},
|
|
30511
|
+
"system.detectSiteLocation": {
|
|
30512
|
+
capName: "system",
|
|
30513
|
+
capScope: "system",
|
|
30514
|
+
addonId: null,
|
|
30515
|
+
access: "create"
|
|
30516
|
+
},
|
|
30329
30517
|
"system.featureFlags": {
|
|
30330
30518
|
capName: "system",
|
|
30331
30519
|
capScope: "system",
|
|
@@ -30344,6 +30532,12 @@ Object.freeze({
|
|
|
30344
30532
|
addonId: null,
|
|
30345
30533
|
access: "view"
|
|
30346
30534
|
},
|
|
30535
|
+
"system.getSiteLocation": {
|
|
30536
|
+
capName: "system",
|
|
30537
|
+
capScope: "system",
|
|
30538
|
+
addonId: null,
|
|
30539
|
+
access: "view"
|
|
30540
|
+
},
|
|
30347
30541
|
"system.health": {
|
|
30348
30542
|
capName: "system",
|
|
30349
30543
|
capScope: "system",
|
|
@@ -30368,6 +30562,12 @@ Object.freeze({
|
|
|
30368
30562
|
addonId: null,
|
|
30369
30563
|
access: "create"
|
|
30370
30564
|
},
|
|
30565
|
+
"system.setSiteLocation": {
|
|
30566
|
+
capName: "system",
|
|
30567
|
+
capScope: "system",
|
|
30568
|
+
addonId: null,
|
|
30569
|
+
access: "create"
|
|
30570
|
+
},
|
|
30371
30571
|
"terminalSession.adoptLegacyMonitor": {
|
|
30372
30572
|
capName: "terminal-session",
|
|
30373
30573
|
capScope: "system",
|
|
@@ -33013,7 +33213,7 @@ var AdminUIAddon = class extends BaseAddon {
|
|
|
33013
33213
|
capability: adminUiCapability,
|
|
33014
33214
|
provider: {
|
|
33015
33215
|
getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
|
|
33016
|
-
getVersion: async () => ({ version: "1.2.
|
|
33216
|
+
getVersion: async () => ({ version: "1.2.60" })
|
|
33017
33217
|
}
|
|
33018
33218
|
}];
|
|
33019
33219
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ba as e,Do as t,Fa as n}from"./src-BmAmiAXy.js";import{I as r,Q as i,S as a,W as o,a as s,o as c,q as l,x as u,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{c as f}from"./widget-panel-BF8s8cZY.js";import{t as p}from"./FormBuilder-DVbN4jV5.js";import{t as m}from"./pencil-OtLKJIw8.js";import{t as h}from"./plus-vrCV3Fn-.js";import{t as g}from"./power-Dw-9Qin8.js";import{F as _,G as v,S as y,i as b,s as x}from"./index-B6kDpXr5.js";var S=v(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]);i();function C(e){return e.enabled!==!1}function w(e){return e.isDefault}function T(e,t){let n={id:e.id,type:e.type,displayName:t.displayName??e.displayName,providerId:e.providerId,config:e.config,isDefault:t.isDefault??e.isDefault,isSystem:e.isSystem},r=e.nodeId===void 0?n:{...n,nodeId:e.nodeId},i=t.enabled??e.enabled;return i===void 0?r:{...r,enabled:i}}function E(e){return`${(e/1024**3).toFixed(e>=100*1024**3?0:1)} GB`}function D({location:e}){let t=e.capacity;return t==null?null:a(`span`,{className:`text-[10px] text-foreground-subtle tabular-nums`,children:[E(t.availableBytes),` free of `,E(t.totalBytes)]})}function O(e){let t=e.basePath;if(typeof t==`string`&&t.length>0)return t;let n=Object.keys(e);return n.length===0?``:n.join(`, `)}function k({location:e,cardinality:t,onEdit:n,onDelete:r,onSetDefault:i,onToggleEnabled:o}){let s=O(e.config),c=C(e),l=w(e);return a(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 px-3 py-2 border-t border-border first:border-t-0 hover:bg-primary/5`,children:[a(`div`,{className:`flex flex-wrap items-center gap-2 min-w-0 flex-1 basis-64`,children:[u(`div`,{className:`w-[88px] shrink-0`,children:e.isDefault?a(`span`,{className:`inline-flex items-center gap-0.5 rounded bg-primary/10 border border-primary/20 px-1.5 py-0.5 text-[10px] font-semibold text-primary uppercase tracking-wide`,title:`Default location for this type`,children:[u(S,{className:`h-2.5 w-2.5 fill-primary`}),`Default`]}):a(`button`,{onClick:()=>i(e),className:`inline-flex items-center gap-0.5 rounded border border-border px-1.5 py-0.5 text-[10px] font-medium text-foreground-subtle hover:text-foreground hover:bg-primary/10 hover:border-primary/30 uppercase tracking-wide`,title:`Promote to default for this type`,children:[u(S,{className:`h-2.5 w-2.5`}),`Set default`]})}),u(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle bg-background border border-border rounded px-1.5 py-0.5 font-mono`,children:e.providerId}),!c&&u(`span`,{className:`text-[10px] uppercase tracking-wide text-warning bg-warning/10 border border-warning/30 rounded px-1.5 py-0.5`,title:`Disabled — nothing new is written here. Existing data stays readable and is still pruned by age.`,children:`disabled`}),e.isSystem&&u(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle bg-background border border-border rounded px-1.5 py-0.5`,title:`System-managed location — cannot be deleted; edit config to relocate`,children:`system`}),e.config.readOnly===!0&&u(`span`,{className:`text-[10px] uppercase tracking-wide text-warning bg-warning/10 border border-warning/30 rounded px-1.5 py-0.5`,title:`Drain mode — reads and age retention continue; nothing new is written here and disk-pressure eviction skips it`,children:`read-only`}),a(`div`,{className:`min-w-0`,children:[u(`div`,{className:`text-xs font-medium text-foreground truncate`,children:e.displayName}),a(`div`,{className:`flex flex-wrap items-center gap-x-2`,children:[s&&u(`span`,{className:`text-[10px] text-foreground-subtle truncate font-mono`,children:s}),u(D,{location:e})]})]})]}),a(`div`,{className:`flex flex-wrap items-center gap-1 shrink-0`,children:[a(`button`,{type:`button`,role:`switch`,"aria-label":`Writes enabled`,"aria-checked":c,disabled:l,onClick:()=>o(e,!c),title:l?`The default location of a type is always enabled — it is the fallback every balancing consumer falls back to. Promote another location to default first.`:c?`Enabled — balancing consumers may write new data here. Click to stop new writes.`:`Disabled — no new data is written here. Existing data stays readable. Click to enable.`,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium border disabled:cursor-not-allowed ${c?`border-success/30 text-success hover:bg-success/10`:`border-warning/40 text-warning hover:bg-warning/10`}`,children:[u(g,{className:`h-3 w-3`}),c?`Enabled`:`Disabled`]}),!e.isDefault&&a(`button`,{onClick:()=>i(e),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle border border-border hover:text-foreground hover:bg-primary/10`,title:`Set as default for this type`,children:[u(S,{className:`h-3 w-3`}),`Set default`]}),a(`button`,{onClick:()=>n(e),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle border border-border hover:text-foreground hover:bg-primary/10`,children:[u(m,{className:`h-3 w-3`}),`Edit`]}),!e.isSystem&&t!==`single`&&u(`button`,{onClick:()=>r(e),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10`,title:`Delete location`,children:u(x,{className:`h-3 w-3`})})]})]})}function A({type:e,displayName:t,description:n,cardinality:r,locations:i,onAdd:s,onEdit:c,onDelete:l,onSetDefault:d,onToggleEnabled:f}){let p=o(()=>{let e=[...i];return e.sort((e,t)=>e.isDefault===t.isDefault?e.displayName.localeCompare(t.displayName):e.isDefault?-1:1),e},[i]);return a(`div`,{className:`rounded-lg border border-border bg-surface`,children:[a(`div`,{className:`flex items-start justify-between border-b border-border px-3 py-2`,children:[a(`div`,{className:`space-y-0.5`,children:[a(`div`,{className:`flex items-center gap-2`,children:[u(`span`,{className:`text-sm font-semibold text-foreground capitalize`,children:t}),u(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle bg-background border border-border rounded px-1.5 py-0.5 font-mono`,children:e})]}),n&&u(`p`,{className:`text-[11px] text-foreground-subtle`,children:n}),r===`single`&&u(`p`,{className:`text-[10px] text-foreground-subtle italic`,children:`Single — one location per type. Edit the existing entry; it can't be split.`})]}),r===`multi`&&a(`button`,{onClick:()=>s(e),className:`inline-flex items-center gap-1 rounded bg-primary px-2 py-1 text-[11px] font-medium text-primary-foreground hover:bg-primary/90`,children:[u(h,{className:`h-3 w-3`}),`Add`]})]}),p.length===0?u(`div`,{className:`px-3 py-4 text-center text-[11px] text-foreground-subtle italic`,children:r===`multi`?`No location registered. Click "Add" to register one.`:`No location registered yet — should be auto-seeded at next boot.`}):u(`div`,{children:p.map(e=>u(k,{location:e,cardinality:r,onEdit:c,onDelete:l,onSetDefault:d,onToggleEnabled:f},e.id))})]})}var j=new Set([`proc`,`sys`,`dev`,`run`,`boot`,`lost+found`,`snap`,`bin`,`sbin`,`lib`,`lib32`,`lib64`,`libx32`,`usr`,`etc`,`var`,`opt`,`tmp`,`srv`,`root`,`System`,`Library`,`Applications`,`cores`,`private`]),M=[`recordings`,`data`,`mnt`,`media`,`Volumes`];function N(e){let t=M.findIndex(t=>t===`recordings`?e.startsWith(t):e===t);return t===-1?M.length:t}function P(e){return e.filter(e=>!e.name.startsWith(`.`)&&!j.has(e.name)).toSorted((e,t)=>{let n=N(e.name)-N(t.name);return n===0?e.name.localeCompare(t.name):n}).map(e=>e.path)}i();function F({nodeId:e,value:t,onChange:n}){let i=f().trpcClient,[o,s]=l([]),[c,p]=l(t),[m,h]=l(null),[g,_]=l(null),[v,y]=l(``),b=r(async(t,r)=>{_(null);try{let a=await i.filesystemBrowse.browse.query({nodeId:e,path:t});h(a),p(a.path),r&&n(a.path)}catch(e){_(e instanceof Error?e.message:`browse failed`)}},[i,e,n]);d(()=>{p(t),(async()=>{let n=await i.filesystemBrowse.browse.query({nodeId:e,path:`/`}).then(e=>e).catch(()=>null);if(n){s(P(n.entries)),await b(t.startsWith(`/`)?t:`/`,!1);return}try{let n=await i.filesystemBrowse.listAllowedRoots.query({nodeId:e});s(n),await b(t&&n.some(e=>t.startsWith(e))?t:n[0]??``,!1)}catch(e){s([]),h(null),_(e instanceof Error&&/not available on node/i.test(e.message)?`This node can't be browsed remotely. Enter the path manually.`:e instanceof Error?e.message:`browse unavailable`)}})()},[e]);let x=async()=>{if(!(!v.trim()||!m)){_(null);try{let t=`${m.path.replace(/\/+$/,``)}/${v.trim()}`;await i.filesystemBrowse.createDir.mutate({nodeId:e,path:t}),y(``),await b(m.path,!0)}catch(e){_(e instanceof Error?e.message:`create failed`)}}},S=e=>`${(e/1e9).toFixed(1)} GB`;return a(`div`,{className:`space-y-2 rounded border border-border p-2`,children:[u(`div`,{className:`flex flex-wrap gap-1`,children:o.map(e=>u(`button`,{onClick:()=>void b(e,!0),className:`rounded border border-border px-2 py-0.5 text-[10px] font-mono hover:border-primary/40`,children:e},e))}),u(`input`,{value:c,onChange:e=>{p(e.target.value),n(e.target.value)},placeholder:`/absolute/path`,className:`w-full rounded border border-border bg-background px-2 py-1 text-[11px] font-mono`}),m&&a(`div`,{className:`text-[10px] text-foreground-subtle`,children:[S(m.freeBytes),` free / `,S(m.totalBytes)]}),u(`div`,{className:`max-h-40 space-y-0.5 overflow-y-auto`,children:m?.entries.map(e=>a(`button`,{onClick:()=>void b(e.path,!0),className:`block w-full truncate rounded px-2 py-1 text-left text-xs hover:bg-primary/5`,children:[`📁 `,e.name]},e.path))}),a(`div`,{className:`flex gap-1`,children:[u(`input`,{value:v,onChange:e=>y(e.target.value),placeholder:`new folder`,className:`flex-1 rounded border border-border bg-background px-2 py-1 text-xs`}),u(`button`,{onClick:()=>void x(),className:`rounded border border-border px-2 py-1 text-xs hover:border-primary/40`,children:`Create`})]}),g&&u(`div`,{className:`text-[10px] text-red-400`,children:g})]})}i();function I({location:r,onClose:i,onSaved:d}){let m=c(),h=f().trpcClient,[g,_]=l({...r.config}),[v,x]=l(r.displayName),[S,C]=l(null),[w,T]=l(!1),E=n(),D=o(()=>{let e=E.data;return Array.isArray(e)?e.find(e=>e.providerId===r.providerId)??null:null},[E.data,r.providerId]),O=e({onSuccess:()=>{m.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),d()}}),k=D?.shouldSaveDiskSpace===!0,A=D?.nodeLocal===!0,[j,M]=l(typeof r.nodeId==`string`?r.nodeId:`hub`),N=typeof g.basePath==`string`?g.basePath:``,P=e=>_(t=>({...t,basePath:e})),I=g.readOnly===!0,L=s({queryKey:[`storage`,`listLocations`,`ro-guard`],queryFn:()=>h.storage.listLocations.query({})}),R=(L.data??[]).filter(e=>e.type===r.type&&e.id!==r.id&&e.config.readOnly!==!0).length,z=!I&&L.data!==void 0&&R===0,B=e=>_(t=>{let n={...t};return delete n.readOnly,e?{...n,readOnly:!0}:n}),V=typeof g.maxUsedGb==`number`?g.maxUsedGb:``,H=e=>{let t=e.trim(),n=t===``?void 0:Number(t);_(e=>{let t={...e};return n===void 0||!Number.isFinite(n)||n<=0?delete t.maxUsedGb:t.maxUsedGb=n,t})},U=typeof g.minFreePercent==`number`?g.minFreePercent:``,W=e=>{let t=e.trim(),n=t===``?void 0:Number(t);_(e=>{let t={...e};return n===void 0||!Number.isFinite(n)?delete t.minFreePercent:t.minFreePercent=Math.min(100,Math.max(0,n)),t})},G=async()=>{T(!0),C(null);try{C(await(e=>h.storage.testConfig.query(e))({providerId:r.providerId,config:g}))}catch(e){C({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{T(!1)}};return u(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:i,children:a(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[a(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[a(`div`,{className:`space-y-0.5`,children:[a(`h2`,{className:`text-sm font-semibold text-foreground`,children:[`Edit `,r.displayName]}),a(`p`,{className:`text-xs text-foreground-subtle`,children:[u(`span`,{className:`font-mono`,children:r.id}),` ·`,` `,D?.displayName??r.providerId]})]}),u(`button`,{onClick:i,className:`text-foreground-subtle hover:text-foreground`,children:u(b,{className:`h-4 w-4`})})]}),a(`div`,{className:`p-4 space-y-3 max-h-[60vh] overflow-y-auto`,children:[a(`div`,{className:`space-y-1`,children:[u(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Display name`}),u(`input`,{type:`text`,value:v,onChange:e=>x(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),D&&u(p,{schema:D.configSchema,values:g,onChange:_}),a(`div`,{className:`space-y-1`,children:[a(`label`,{className:`flex items-center gap-2 text-xs ${z?`text-foreground-subtle cursor-not-allowed`:`text-foreground cursor-pointer`}`,children:[u(`input`,{type:`checkbox`,checked:I,disabled:z,onChange:e=>B(e.target.checked),className:`accent-primary`}),`Read-only (drain mode)`]}),u(`p`,{className:`text-[10px] text-foreground-subtle`,children:z?`Blocked: this is the last writable location of its type — new footage would have nowhere to go.`:`Reads and age-based retention continue; nothing new is written here and disk-pressure eviction skips it. Use it to slowly decommission a disk.`})]}),A&&a(`div`,{className:`space-y-2`,children:[u(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Node`}),u(t,{selectedNodeId:j,onSelect:M,alwaysShow:!0}),u(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Path`}),u(F,{nodeId:j,value:N,onChange:P})]}),k&&a(`div`,{className:`space-y-1`,children:[u(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Min free disk %`}),u(`input`,{type:`number`,min:0,max:100,value:U,placeholder:D?.minFreePercent==null?``:String(D.minFreePercent),onChange:e=>W(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`}),a(`p`,{className:`text-[10px] text-foreground-subtle`,children:[`When free space on this volume drops below this %, the oldest data stored here is evicted to reclaim space.`,D?.minFreePercent==null?` Empty = use the default.`:` Empty = use the default (${D.minFreePercent}%).`]}),u(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Max used (GB)`}),u(`input`,{type:`number`,min:1,value:V,placeholder:`unlimited`,onChange:e=>H(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`}),u(`p`,{className:`text-[10px] text-foreground-subtle`,children:`Hard cap on the TOTAL bytes evictable data (recordings) may occupy on this location, independent of disk free space — oldest footage is evicted past it. Empty = unlimited.`})]}),!D&&!E.isLoading&&a(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-700 dark:text-amber-300`,children:[`Provider `,u(`code`,{className:`font-mono`,children:r.providerId}),` is no longer registered. Field schema unavailable; raw config is preserved on save.`]}),S&&u(`div`,{className:`rounded border px-3 py-2 text-[11px] ${S.ok?`border-success/30 bg-success/5 text-success`:`border-danger/30 bg-danger/5 text-danger`}`,children:S.ok?`Connection OK.`:`Test failed: ${S.error??`unknown error`}`}),O.isError&&u(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:O.error instanceof Error?O.error.message:String(O.error)})]}),a(`div`,{className:`flex items-center justify-between gap-2 border-t border-border px-4 py-3`,children:[u(`button`,{onClick:i,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Cancel`}),a(`div`,{className:`flex items-center gap-2`,children:[u(`button`,{onClick:()=>{G()},disabled:w||!D,className:`rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10 disabled:opacity-50`,children:w?`Testing…`:`Test connection`}),a(`button`,{onClick:()=>{O.mutate({id:r.id,type:r.type,providerId:r.providerId,isDefault:r.isDefault,displayName:v.trim(),config:g,nodeId:A?j:void 0})},disabled:O.isPending||v.trim().length===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[O.isPending?u(y,{className:`h-3.5 w-3.5 animate-spin`}):null,O.isPending?`Saving…`:`Save`]})]})]})]})})}function L(e){let t=e.trim().toLowerCase();return t.length===0?``:t.replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function R(e,t){let n=L(t);return`${e}:${n.length>0?n:`default`}`}i();function z({initialType:r,onClose:i,onCreated:s}){let d=c(),m=f().trpcClient,[h,g]=l(`picker`),[v,x]=l(r),[S,C]=l(null),[w,T]=l({}),[E,D]=l(``),[O,k]=l(null),[A,j]=l(!1),[M,N]=l(!1),[P,I]=l(`hub`),[L,z]=l(null),[B,V]=l(!1),H=e=>T(t=>({...t,basePath:e})),U=typeof w.basePath==`string`?w.basePath:``,W=n(),G=o(()=>{let e=W.data;return Array.isArray(e)?e:[]},[W.data]),K=W.isLoading,q=e({onSuccess:()=>{d.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),s()}}),J=o(()=>O!==null&&O.length>0?O:R(v,E),[v,E,O]),Y=async()=>{if(S){V(!0),z(null);try{z(await(e=>m.storage.testConfig.query(e))({providerId:S.providerId,config:w}))}catch(e){z({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{V(!1)}}};return u(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:i,children:a(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[a(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[a(`div`,{className:`space-y-0.5`,children:[u(`h2`,{className:`text-sm font-semibold text-foreground`,children:{picker:`Add Location — Pick provider`,config:`Add Location — ${S?.displayName??``}`,naming:`Add Location — Name & defaults`}[h]}),a(`p`,{className:`text-xs text-foreground-subtle`,children:[`Type: `,u(`span`,{className:`font-mono`,children:v})]})]}),u(`button`,{onClick:i,className:`text-foreground-subtle hover:text-foreground`,children:u(b,{className:`h-4 w-4`})})]}),h===`picker`&&a(`div`,{className:`p-4 space-y-2`,children:[K&&u(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading providers…`}),!K&&G.length===0&&a(`div`,{className:`rounded border border-border bg-background px-3 py-4 text-center text-xs text-foreground-subtle`,children:[`No storage-provider supports type "`,v,`". Install a compatible addon (e.g.`,` `,u(`code`,{className:`font-mono`,children:`remote-storage`}),`) to enable it.`]}),G.map(e=>a(`button`,{onClick:()=>{C(e),g(`config`)},className:`flex w-full items-center gap-3 rounded-lg border border-border bg-background p-3 text-left hover:border-primary/40 hover:bg-primary/5 transition-colors`,children:[a(`div`,{className:`flex-1 min-w-0`,children:[u(`p`,{className:`text-xs font-semibold text-foreground`,children:e.displayName}),u(`p`,{className:`text-[10px] text-foreground-subtle font-mono mt-0.5 truncate`,children:e.providerId})]}),u(_,{className:`h-4 w-4 text-foreground-subtle flex-shrink-0`})]},e.providerId))]}),h===`config`&&S&&a(`div`,{className:`p-4 space-y-3 max-h-[60vh] overflow-y-auto`,children:[u(p,{schema:S.configSchema,values:w,onChange:T}),S.nodeLocal&&a(`div`,{className:`space-y-2`,children:[u(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Node`}),u(t,{selectedNodeId:P,onSelect:I,alwaysShow:!0}),u(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Path`}),u(F,{nodeId:P,value:U,onChange:H})]}),L&&u(`div`,{className:`rounded border px-3 py-2 text-[11px] ${L.ok?`border-success/30 bg-success/5 text-success`:`border-danger/30 bg-danger/5 text-danger`}`,children:L.ok?`Connection OK.`:`Test failed: ${L.error??`unknown error`}`}),a(`div`,{className:`flex items-center justify-between pt-1`,children:[u(`button`,{onClick:()=>g(`picker`),className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Back`}),a(`div`,{className:`flex items-center gap-2`,children:[u(`button`,{onClick:()=>{Y()},disabled:B,className:`rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10 disabled:opacity-50`,children:B?`Testing…`:`Test connection`}),u(`button`,{onClick:()=>g(`naming`),className:`rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:`Next`})]})]})]}),h===`naming`&&S&&a(`div`,{className:`p-4 space-y-3`,children:[a(`div`,{className:`space-y-1`,children:[u(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Display name`}),u(`input`,{type:`text`,value:E,onChange:e=>D(e.target.value),placeholder:`${v} on ${S.displayName}`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),a(`div`,{className:`space-y-1`,children:[a(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:[`Id`,` `,u(`span`,{className:`lowercase tracking-normal text-foreground-subtle`,children:`— auto-derived; override if needed`})]}),u(`input`,{type:`text`,value:J,onChange:e=>k(e.target.value),placeholder:R(v,E),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground font-mono focus:outline-none focus:ring-1 focus:ring-primary`}),a(`p`,{className:`text-[10px] text-foreground-subtle`,children:[`Format: `,u(`code`,{className:`font-mono`,children:`<type>:<slug>`}),`. Lowercase letters, digits, and hyphens only.`]})]}),a(`label`,{className:`flex items-start gap-2 rounded border border-border bg-background px-3 py-2 cursor-pointer hover:bg-primary/5`,children:[u(`input`,{type:`checkbox`,checked:A,onChange:e=>j(e.target.checked),className:`accent-primary mt-0.5`}),a(`div`,{className:`space-y-0.5`,children:[a(`div`,{className:`text-xs font-medium text-foreground`,children:[`Mark as default for type "`,v,`"`]}),a(`div`,{className:`text-[10px] text-foreground-subtle`,children:[`Setting this as default will demote the current default for this type. References like `,a(`code`,{className:`font-mono`,children:[`"`,v,`"`]}),` resolve to whichever location is the default.`]})]})]}),a(`label`,{className:`flex items-start gap-2 rounded border border-border bg-background px-3 py-2 cursor-pointer hover:bg-primary/5`,children:[u(`input`,{type:`checkbox`,checked:M,onChange:e=>N(e.target.checked),className:`accent-primary mt-0.5`}),a(`div`,{className:`space-y-0.5`,children:[u(`div`,{className:`text-xs font-medium text-foreground`,children:`Enable immediately`}),u(`div`,{className:`text-[10px] text-foreground-subtle`,children:`A disabled location receives no writes until enabled — reads and age-based retention still work, nothing new lands here. Leave this off to register the disk now and start using it later.`})]})]}),q.isError&&u(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:q.error instanceof Error?q.error.message:String(q.error)}),a(`div`,{className:`flex items-center justify-between pt-1`,children:[u(`button`,{onClick:()=>g(`config`),className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Back`}),a(`div`,{className:`flex items-center gap-2`,children:[u(`button`,{onClick:()=>{x(r),C(null),T({}),D(``),k(null),j(!1),N(!1),z(null),g(`picker`)},className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Reset`}),a(`button`,{onClick:()=>{S&&q.mutate({id:J,type:v,displayName:E.trim(),providerId:S.providerId,config:w,isDefault:A,enabled:M,nodeId:S.nodeLocal?P:void 0})},disabled:q.isPending||E.trim().length===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[q.isPending?u(y,{className:`h-3.5 w-3.5 animate-spin`}):null,q.isPending?`Saving…`:`Save`]})]})]})]})]})})}export{T as i,I as n,A as r,z as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Eo as e,Pt as t,To as n,_s as r,g as i,hs as a,kt as o,p as s,v as c}from"./src-BmAmiAXy.js";import{Q as l,S as u,o as d,q as f,x as p,z as m}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{t as h}from"./play-Q-R5vHEh.js";import{t as g}from"./plus-vrCV3Fn-.js";import{t as _}from"./refresh-cw-BwezRSth.js";import{t as v}from"./square-CgzDPTwM.js";import{H as y,K as b,L as x,S,m as C}from"./index-B6kDpXr5.js";import{t as w}from"./AdminPage-Dq33XE9j.js";import{t as T}from"./NodeAddonsSettingsPanel-DJKQxT7V.js";l();function E({addonId:e,fallback:t,tileClassName:n,iconPath:r=`assets/icon.svg`}){let[i,a]=f(!1),o=`/api/addon-assets/${e}/${r}`;return p(`div`,{className:`h-10 w-10 rounded-lg flex items-center justify-center shrink-0 ${n}`,children:i?p(t,{className:`h-5 w-5`}):p(`img`,{src:o,alt:e,className:`h-7 w-7 rounded-md bg-white p-1 ring-1 ring-black/5`,onError:()=>a(!0)})})}l();function D({addonId:e,defaultActivity:t,showActivity:n=!0,maxHeight:r=`max-h-64`,defaultTab:a,capability:o}){let[s,l]=f(t??(a===`events`?`events`:`logs`));return u(`div`,{className:`flex flex-col gap-4`,children:[p(T,{nodeId:`hub`,addonIds:[e],level:`global`,capability:o}),n&&u(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[u(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border bg-surface-hover/20`,children:[p(`span`,{className:`text-[11px] font-semibold text-foreground-subtle uppercase tracking-wide`,children:`Activity`}),u(`div`,{className:`flex items-center gap-1`,children:[p(O,{kind:`logs`,active:s===`logs`,onClick:()=>l(`logs`)}),p(O,{kind:`events`,active:s===`events`,onClick:()=>l(`events`)})]})]}),s===`logs`?p(c,{addonId:e,maxHeight:r,showFilters:!1}):p(i,{addonId:e,category:`addon.*`,maxHeight:r})]})]})}function O({kind:e,active:t,onClick:n}){return u(`button`,{onClick:n,className:`inline-flex items-center gap-1 rounded px-2 py-0.5 text-[11px] font-medium transition-colors ${t?`bg-primary/10 text-primary`:`text-foreground-subtle hover:text-foreground hover:bg-surface-hover`}`,children:[p(e===`logs`?C:y,{className:`h-3 w-3`}),e===`logs`?`Logs`:`Events`]})}l();function k(t){let{title:i,subtitle:o,pageIcon:s,itemIcon:c,capability:l,installButtonLabel:d=`Add addon`,items:h,isLoading:_,emptyTitle:v=`No addons installed for this capability`,emptyDescription:y,itemIconColor:S,renderStatusBadges:C,renderPrimaryAction:T,itemError:O,renderExpandedPanel:k,workspaceMaxHeight:N=`max-h-72`,trailing:P,showChrome:F=!1}=t,I=h.length>1,[L,R]=f(()=>h[0]?.addonId??null);m(()=>{L&&(h.some(e=>e.addonId===L)||R(h[0]?.addonId??null))},[h,L]);let z=e=>R(t=>t===e?null:e),B=`/system/addons?capability=${encodeURIComponent(l)}`;return p(w,{icon:F?s:void 0,title:F?i:void 0,subtitle:F?o:void 0,actions:F?p(b,{to:B,children:u(r,{variant:`primary`,size:`sm`,children:[p(g,{className:`h-3.5 w-3.5 mr-1`}),d]})}):void 0,children:_?p(a,{children:p(`div`,{className:`p-6 text-sm text-foreground-subtle`,children:`Loading…`})}):h.length===0?p(a,{children:p(e,{title:v,description:y??`Install an addon that declares the "${l}" capability to get started.`,action:F?p(b,{to:B,children:u(r,{variant:`primary`,size:`sm`,children:[p(g,{className:`h-3.5 w-3.5 mr-1`}),d]})}):void 0})}):u(`div`,{className:`flex flex-col gap-4`,children:[h.map(e=>{let t=!I||L===e.addonId,r=S?.(e)??(e.isActive?`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`:`bg-foreground-subtle/15 text-foreground-subtle`),i=O?.(e)??null;return u(a,{children:[u(`div`,{className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-center ${t?`border-b border-border`:``}`,children:[u(`div`,{className:`flex items-center gap-3 flex-1 min-w-0`,children:[I&&p(`button`,{type:`button`,onClick:()=>z(e.addonId),"aria-label":t?`Collapse`:`Expand`,className:`shrink-0 p-1 rounded hover:bg-foreground-subtle/10 transition-colors`,children:p(x,{className:`h-4 w-4 text-foreground-subtle transition-transform ${t?`rotate-180`:``}`})}),u(`button`,{type:`button`,onClick:()=>I&&z(e.addonId),className:`flex items-center gap-4 flex-1 min-w-0 text-left ${I?`hover:opacity-80 transition-opacity`:``}`,disabled:!I,children:[p(E,{addonId:e.addonId,fallback:c,tileClassName:r}),u(`div`,{className:`flex-1 min-w-0`,children:[u(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[p(`span`,{className:`font-semibold text-foreground`,children:e.displayName}),p(A,{isActive:e.isActive}),C?.(e)]}),p(`div`,{className:`text-xs text-foreground-subtle mt-1 font-mono break-all`,children:e.addonId})]})]})]}),u(`div`,{className:`flex items-center gap-1 shrink-0 flex-wrap justify-end`,children:[T?.(e),p(j,{capName:e.capName??l,addonId:e.addonId,isActive:e.isActive}),p(M,{addonId:e.addonId,displayName:e.displayName})]})]}),t&&u(`div`,{className:`p-4 flex flex-col gap-3`,children:[i!==null&&p(n,{message:i}),k?.(e),p(D,{addonId:e.addonId,maxHeight:N,capability:e.capName??l})]})]},e.addonId)}),P]})})}function A({isActive:e}){return p(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${e?`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`:`bg-foreground-subtle/15 text-foreground-subtle`}`,children:e?`Enabled`:`Disabled`})}function j({capName:e,addonId:n,isActive:i}){let a=d(),o=t({onSuccess:()=>{a.invalidateQueries({queryKey:[[`addons`,`listCapabilityProviders`]]})}}),s=o.isPending;return u(r,{size:`sm`,variant:i?`secondary`:`primary`,disabled:s,onClick:()=>o.mutate({capName:e,addonId:n,enabled:!i}),children:[s?p(S,{className:`h-3 w-3 animate-spin`}):p(i?v:h,{className:`h-3 w-3`}),i?`Disable`:`Enable`]})}function M({addonId:e,displayName:t}){let n=d(),r=o({onSuccess:()=>{n.invalidateQueries({queryKey:[[`addons`,`listCapabilityProviders`]]})}});return p(s,{label:`Restart`,icon:_,size:`sm`,title:`Restart "${t}"?`,description:`Restarting the addon bounces its subprocess — the provider will briefly drop and reconnect automatically.`,confirmLabel:`Restart`,triggerVariant:`ghost`,confirmVariant:`danger`,disabled:r.isPending,action:()=>r.mutateAsync({addonId:e})})}export{k as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ao as e,Ct as t,Do as n,Dt as r,Et as i,Ft as a,Hr as o,It as s,Jr as c,Lt as l,Mt as u,Nt as d,Ot as f,St as p,_t as m,b as h,bt as g,g as _,jt as v,kt as y,v as ee,vt as b,wo as te,wt as ne,xt as re,yt as x}from"./src-BmAmiAXy.js";import{I as S,K as C,Q as w,R as ie,S as T,W as E,b as D,o as ae,q as O,x as k,z as A}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{yt as oe}from"./src-BizjMCcy.js";import{c as se}from"./widget-panel-BF8s8cZY.js";import{t as j}from"./clock-0kqs7-NB.js";import{t as M}from"./download-CXXQf3fF.js";import{t as ce}from"./plus-vrCV3Fn-.js";import{t as N}from"./refresh-cw-BwezRSth.js";import{t as le}from"./search-iOwuoJNQ.js";import{t as P}from"./upload-DUXkaKq1.js";import{G as F,L as I,N as ue,R as L,S as R,Y as z,g as de,i as B,m as V,p as fe,q as H,s as U}from"./index-B6kDpXr5.js";import{t as W}from"./AdminPage-Dq33XE9j.js";import{t as pe}from"./NodeAddonsSettingsPanel-DJKQxT7V.js";var me=F(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),G=F(`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`}]]),he=F(`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`}]]),K=F(`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`}]]);w();var q=new Set([`completed`,`failed`,`partially-failed`,`cancelled`]),J=new Set([`done`,`failed`,`skipped`]);function Y(e){return!J.has(e.phase)&&!q.has(e.jobState)}function ge(e,t){let n=new Map,r=[...e].sort((e,t)=>e.createdAtMs-t.createdAtMs);for(let e of r){let r=q.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 _e(){let{data:t}=i({activeOnly:!0},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data?.length??0)>0?3e3:!1}),{map:n}=e(oe.AddonsJobProgress,e=>e.job.jobId);return E(()=>{let e=new Map;for(let n of t??[])e.set(n.jobId,n);for(let[t,r]of n)e.set(t,r.job);return ge([...e.values()],Date.now())},[t,n])}var X={queued:{icon:j,cls:`bg-muted text-foreground-subtle`,label:`queued`},fetching:{icon:R,cls:`bg-primary/10 text-primary`,label:`fetching`,spin:!0},staged:{icon:R,cls:`bg-primary/10 text-primary`,label:`staged`,spin:!0},validating:{icon:R,cls:`bg-primary/10 text-primary`,label:`validating`,spin:!0},applying:{icon:R,cls:`bg-primary/10 text-primary`,label:`applying`,spin:!0},restarting:{icon:R,cls:`bg-amber-500/10 text-amber-600 dark:text-amber-400`,label:`restarting`,spin:!0},applied:{icon:R,cls:`bg-primary/10 text-primary`,label:`finalizing`,spin:!0},done:{icon:L,cls:`bg-success/10 text-success`,label:`updated`},failed:{icon:G,cls:`bg-danger/10 text-danger`,label:`failed`},skipped:{icon:K,cls:`bg-muted text-foreground-subtle`,label:`skipped`}};function ve({progress:e}){let t=X[e.phase],n=t.icon,r=e.error??`${e.packageName}: ${e.fromVersion??`?`} → ${e.toVersion}`;return T(`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:[k(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label,T(`span`,{className:`font-mono`,children:[`→ `,e.toVersion]})]})}function ye({packageName:e,currentVersion:t,installSource:n,onInstall:r,onClose:i,onSelect:a,selectedVersion:o}){let s=n===`upload`||n===`local`,{data:c,isLoading:l}=p({name:e});return T(`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:[T(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[k(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle font-medium`,children:`Versions`}),k(`button`,{type:`button`,onClick:i,className:`text-foreground-subtle hover:text-foreground`,children:k(B,{className:`h-3 w-3`})})]}),s&&T(`div`,{className:`flex items-start gap-2 px-3 py-2 border-b border-border bg-cyan-500/10 text-[10px]`,children:[k(P,{className:`h-3 w-3 mt-0.5 text-cyan-500 shrink-0`}),T(`div`,{className:`text-cyan-700 dark:text-cyan-200`,children:[T(`span`,{className:`font-semibold`,children:[n===`upload`?`Uploaded copy`:`Local copy`,` in place.`]}),` `,`Re-install `,k(`span`,{className:`font-mono`,children:t}),` from npm to track upstream releases again.`]})]}),l&&T(`div`,{className:`flex items-center justify-center gap-2 py-6 text-[10px] text-foreground-subtle`,children:[k(R,{className:`h-3.5 w-3.5 animate-spin`}),`Loading versions...`]}),c&&k(`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=T(D,{children:[k(`span`,{className:`font-mono flex-1 text-left ${n?`text-primary font-semibold`:c?`text-amber-400`:`text-foreground`}`,children:e.version}),n&&k(`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=>k(`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&&k(`span`,{className:`text-[9px] text-red-400 line-through`,children:`deprecated`}),k(`span`,{className:`text-[9px] text-foreground-subtle shrink-0`,children:new Date(e.publishedAt).toLocaleDateString()})]});return a?T(`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?k(L,{className:`h-3 w-3 text-primary shrink-0`}):k(`span`,{className:`w-3 shrink-0`})]},e.version):T(`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?k(L,{className:`h-3 w-3 text-primary shrink-0`}):k(`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:k(M,{className:`h-3 w-3`})})]},e.version)})}),c&&c.length===0&&k(`div`,{className:`py-4 text-center text-[10px] text-foreground-subtle`,children:`No versions found`})]})}var be={queued:{icon:j,bg:`bg-muted text-foreground-subtle`,label:`queued`},updating:{icon:R,bg:`bg-primary/10 text-primary`,label:`updating`,spin:!0},"done-pending-restart":{icon:N,bg:`bg-amber-500/10 text-amber-700`,label:`pending restart`},done:{icon:L,bg:`bg-success/10 text-success`,label:`done`},failed:{icon:G,bg:`bg-danger/10 text-danger`,label:`failed`}};function xe({item:e}){let t=be[e.status],n=t.icon;return T(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] rounded ${t.bg}`,title:e.error,children:[k(n,{className:`w-2.5 h-2.5 ${t.spin?`animate-spin`:``}`}),t.label]})}w();var Z=`device-export`;function Se(e){return e.capabilities.some(e=>(typeof e==`string`?e:e.name)===Z)}function Ce({isBundle:e,installSource:t,addonId:n,iconPath:r,color:i}){let[a,o]=O(!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 T(`div`,{className:`relative flex-shrink-0`,children:[k(`div`,{className:`h-9 w-9 rounded-lg flex items-center justify-center ${s?``:c}`,style:s,children:u?k(`img`,{src:l,alt:n,className:`h-5 w-5`,onError:()=>o(!0)}):k(e?he:de,{className:`h-4 w-4`})}),t===`local`&&k(`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`&&k(`span`,{className:`absolute -top-1 -left-1 w-4 h-4 rounded bg-[#cb3837] flex items-center justify-center -rotate-12 shadow-sm`,children:k(`svg`,{viewBox:`0 0 780 250`,className:`w-[11px] h-[11px]`,children:k(`path`,{fill:`#fff`,d:`M240 250h100V50h100v200h340V0H0v250z`})})}),t===`upload`&&k(`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:k(P,{className:`h-2.5 w-2.5 text-white`})})]})}function we({version:e,availableUpdate:t,selectedVersion:n,isUpdating:r,installSource:i,disabled:a,onUpdate:o,onOpenPicker:s,children:c}){if(r)return T(`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:[k(R,{className:`h-3 w-3 animate-spin`}),`Updating…`]});if(t){let r=n??t;return T(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[o&&T(`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:[k(M,{className:`h-3 w-3`}),`Update`]}),T(`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:[k(`span`,{className:`font-normal opacity-70`,children:e}),k(`span`,{className:`font-normal opacity-70`,children:`→`}),r,k(I,{className:`h-3 w-3`})]}),c]})}return T(`div`,{className:`relative inline-flex items-center gap-1 shrink-0`,children:[T(`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,k(I,{className:`h-3 w-3 opacity-50`})]}),c]})}function Te({addonId:e}){let t=ae(),{data:n=`inherit`}=x({addonId:e}),r=d({onSuccess:()=>{t.invalidateQueries({queryKey:[[`addons`,`getAddonAutoUpdate`]]})}});return k(`div`,{className:`flex rounded-lg border border-border overflow-hidden text-[10px] font-medium`,children:[`inherit`,`off`,`latest`,`beta`].map(t=>k(`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 Ee({addon:e,agents:n=[],clusterStatus:r,hideVersion:i,availableUpdate:a,onUpdate:o,isUpdating:c,jobProgress:l,bundle:u,bulkItem:d,disabledByBulk:f,isSystem:p}){let[m,g]=O(!1),[b,ne]=O(!1),[re,x]=O(!1),[S,C]=O(null);A(()=>{C(null)},[a]);let w=S??a,[ie,E]=O(!1),[oe,j]=O(!1),[M,le]=O(`logs`),P=ae(),F=se(),ue=H(),L=te(),{manifest:R}=e,z=e.installedOn??[],de=!u&&!R.protected&&R.removable!==!1,W=!!u,K=u?.displayName??R.name,q=u?.packageName??R.packageName,J=u?.version??R.packageVersion??R.version,Y=u?.installSource??e.installSource,ge=u?u.bundle?.description??u.addons[0]?.manifest.description:R.description,_e=s({onSuccess:()=>{P.invalidateQueries({queryKey:[[`addons`]]}),P.invalidateQueries({queryKey:[[`addonPages`]]}),P.invalidateQueries({queryKey:[[`capabilities`]]})}}),X=y({onSuccess:()=>{P.invalidateQueries({queryKey:[[`addons`]]})}}),be=t({onSuccess:()=>{P.invalidateQueries({queryKey:[[`addons`]]}),P.invalidateQueries({queryKey:[[`addonPages`]]}),P.invalidateQueries({queryKey:[[`capabilities`]]}),P.invalidateQueries({queryKey:[[`integrations`]]})}}),Z=v({onSuccess:()=>{P.invalidateQueries({queryKey:[[`addons`]]}),P.invalidateQueries({queryKey:[[`alerts`]]})}}),Q=e.health,De=Q?.phase===`failed`&&!Q.inGracePeriod,Oe=De&&Q?.nextRetryAt&&!Q.retrying;return T(`div`,{className:`rounded-lg border bg-surface overflow-hidden ${De?`border-red-500/50`:`border-border`}`,children:[De&&Q&&T(`div`,{className:`bg-danger/10 border-b border-danger/30 px-4 py-2.5 flex items-start gap-2.5`,children:[k(G,{className:`h-4 w-4 text-danger shrink-0 mt-0.5`}),T(`div`,{className:`flex-1 min-w-0`,children:[T(`div`,{className:`text-xs font-semibold text-danger`,children:[`Failed to load (attempt #`,Q.retryCount,`)`]}),k(`div`,{className:`text-[11px] text-foreground mt-0.5 break-words font-mono`,children:Q.lastError?.message??`Unknown error`}),Oe&&Q.nextRetryAt&&T(`div`,{className:`text-[10px] text-foreground-subtle mt-1`,children:[`Auto-retry at `,new Date(Q.nextRetryAt).toLocaleTimeString()]})]}),T(`button`,{type:`button`,disabled:Z.isPending||Q.retrying,onClick:e=>{e.stopPropagation(),Z.mutate({packageName:q})},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:[k(N,{className:`h-3 w-3 ${Z.isPending||Q.retrying?`animate-spin`:``}`}),`Retry now`]})]}),T(`div`,{className:`flex items-start gap-3 px-4 py-3`,children:[k(Ce,{isBundle:W||!!R.components&&R.components.length>1,installSource:Y,addonId:W?u.addons[0]?.manifest.id:R.id,iconPath:W?u.bundle?.icon??u.addons[0]?.manifest.icon:R.icon,color:W?u.addons[0]?.manifest.color:R.color}),T(`div`,{className:`flex-1 min-w-0`,children:[T(`div`,{className:`flex items-start justify-between gap-2`,children:[k(`span`,{className:`text-sm font-semibold text-foreground truncate min-w-0`,children:K}),!i&&k(we,{version:J,availableUpdate:a,...w===void 0?{}:{selectedVersion:w},isUpdating:c,installSource:Y,disabled:f,...o&&w!==void 0?{onUpdate:()=>o(w)}:{},onOpenPicker:()=>x(e=>!e),children:re&&k(ye,{packageName:q,currentVersion:J,...Y?{installSource:Y}:{},...a!==void 0&&w!==void 0?{selectedVersion:w,onSelect:e=>{C(e),x(!1)}}:{},onInstall:e=>{x(!1),be.mutate({packageName:q,version:e})},onClose:()=>x(!1)})})]}),T(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 mt-0.5`,children:[q!==K&&k(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate max-w-full`,children:q}),W&&T(`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:[k(he,{className:`h-3 w-3`}),u.addons.length]}),p&&T(`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:[k(N,{className:`h-3 w-3`}),`System`]}),d!=null&&k(xe,{item:d}),l!=null&&k(ve,{progress:l})]}),ge&&k(`p`,{className:`text-[10px] text-foreground-subtle mt-1 line-clamp-1`,children:ge}),!W&&e.process&&T(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[k(`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&&T(`span`,{className:`text-[9px] font-mono text-foreground-subtle`,children:[`PID `,e.process.pid]}),k(`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})]})]})]}),!W&&T(`div`,{className:`flex items-center gap-1 px-4 py-1.5 border-t border-border/50 bg-surface-hover/20`,children:[T(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),X.mutate({addonId:R.id})},disabled:X.isPending||f,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:[k(N,{className:`h-3 w-3 ${X.isPending?`animate-spin`:``}`}),`Restart`]}),T(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),E(e=>!e)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${ie?`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:[k(V,{className:`h-3 w-3`}),`Logs`]}),!W&&T(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),j(!0)},className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium border transition-colors ${oe?`border-primary/30 bg-primary/10 text-primary`:`border-border text-foreground-subtle hover:text-foreground hover:border-primary/30 hover:bg-primary/10`}`,children:[k(fe,{className:`h-3 w-3`}),`Settings`]}),k(`div`,{className:`flex-1`}),de&&T(`button`,{type:`button`,onClick:async e=>{e.stopPropagation(),await L({title:`Uninstall ${R.name}?`,message:`This will remove the addon package and all its data. This action cannot be undone.`,confirmLabel:`Uninstall`,variant:`danger`})&&_e.mutate({packageName:R.packageName})},disabled:_e.isPending||f,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:[k(U,{className:`h-3 w-3`}),_e.isPending?`Removing...`:`Uninstall`]})]}),r&&r.nodes.length>1&&!W&&T(`div`,{className:`border-t border-border px-4 py-2 bg-muted/10`,children:[k(`div`,{className:`text-[10px] font-medium text-foreground-subtle mb-1.5`,children:`Cluster Deployment`}),k(`div`,{className:`space-y-1`,children:r.nodes.map(e=>T(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[k(`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`}`}),k(`span`,{className:`font-medium text-foreground min-w-[60px]`,children:e.name}),k(`span`,{className:`font-mono text-foreground-subtle`,children:e.version}),!e.synced&&e.status!==`offline`&&k(`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`&&k(`span`,{className:`text-[9px] px-1 py-0.5 rounded bg-muted text-muted-foreground`,children:`offline`}),e.synced&&e.status!==`offline`&&k(`span`,{className:`text-[9px] text-success`,children:`synced`})]},e.nodeId))})]}),ie&&!W&&T(`div`,{className:`border-t border-border`,children:[T(`div`,{className:`flex items-center px-4 py-1 bg-surface-hover/20 border-b border-border/50`,children:[T(`div`,{className:`flex rounded border border-border overflow-hidden text-[9px]`,children:[k(`button`,{type:`button`,onClick:()=>le(`logs`),className:`px-2 py-0.5 transition-colors ${M===`logs`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Logs`}),k(`button`,{type:`button`,onClick:()=>le(`events`),className:`px-2 py-0.5 border-l border-border transition-colors ${M===`events`?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-surface-hover`}`,children:`Events`})]}),k(`div`,{className:`flex-1`}),k(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),E(!1)},className:`text-foreground-subtle hover:text-foreground`,children:k(B,{className:`h-3.5 w-3.5`})})]}),M===`logs`&&k(ee,{addonId:R.id,maxHeight:`max-h-64`,showFilters:!1}),M===`events`&&k(_,{addonId:R.id,category:`addon.*`,maxHeight:`max-h-64`})]}),W&&T(D,{children:[k(`button`,{type:`button`,onClick:()=>g(e=>!e),className:`w-full flex items-center justify-center border-t border-border py-1 hover:bg-surface-hover/50 transition-colors`,children:k(m?me:I,{className:`h-3.5 w-3.5 text-foreground-subtle`})}),m&&k(`div`,{className:`border-t border-border px-3 py-2 space-y-2`,children:u.addons.map(e=>k(Ee,{addon:e,agents:n,hideVersion:!0},e.manifest.id))})]}),oe&&!W&&k(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4`,onClick:()=>j(!1),children:T(`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:[T(`div`,{className:`flex items-center justify-between px-5 py-3 border-b border-border flex-shrink-0`,children:[T(`div`,{className:`flex items-center gap-2`,children:[k(fe,{className:`h-4 w-4 text-primary`}),T(`h2`,{className:`text-sm font-semibold text-foreground`,children:[K,` Settings`]})]}),k(`button`,{onClick:()=>j(!1),className:`text-foreground-subtle hover:text-foreground transition-colors p-1 rounded`,children:k(B,{className:`h-4 w-4`})})]}),T(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[k(pe,{nodeId:`hub`,addonIds:[R.id],level:`global`}),Se(R)&&T(`div`,{children:[k(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Device export`}),k(h,{addonId:R.id,trpc:F.trpcClient,onOpenDevice:e=>ue(`/devices/${e}`)})]}),Y===`npm`&&T(`div`,{children:[k(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Auto-Update`}),k(Te,{addonId:R.id})]}),R.components&&R.components.length>0&&T(`div`,{children:[T(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:[`Components (`,R.components.length,`)`]}),k(`div`,{className:`flex flex-wrap gap-1`,children:R.components.map(e=>k(`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&&T(`div`,{children:[k(`div`,{className:`text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-2`,children:`Installed on`}),T(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[z.length===0&&k(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Hub (local)`}),z.map(e=>k(`span`,{className:`rounded-full bg-surface-hover border border-border px-2 py-0.5 text-[10px] text-foreground-subtle`,children:e},e)),T(`div`,{className:`relative`,children:[T(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ne(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:[k(ce,{className:`h-3 w-3`}),`Add agent`]}),b&&T(`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&&!z.includes(e.name)).map(e=>k(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ne(!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&&!z.includes(e.name)).length===0&&k(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle`,children:`No available agents`})]})]})]})]})]}),k(`div`,{className:`flex items-center justify-end px-5 py-3 border-t border-border flex-shrink-0`,children:k(`button`,{type:`button`,onClick:()=>j(!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`})})]})})]})}w();var Q=`.tgz,.tar.gz,.zip`;function De({onUploadSuccess:e}){let[t,n]=O(!1),r=C(null),i=S(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 T(D,{children:[k(`input`,{ref:r,type:`file`,accept:Q,onChange:S(e=>{let t=e.target.files?.[0];t&&i(t),e.target.value=``},[i]),className:`hidden`}),T(`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?k(R,{className:`w-3.5 h-3.5 animate-spin`}):k(P,{className:`w-3.5 h-3.5`}),t?`Uploading...`:`Upload`]})]})}w();var Oe=new Set([`@camstack/system`,`@camstack/types`,`@camstack/sdk`,`@camstack/shm-ring`,`@camstack/ui-library`]);function ke(e){return e!==void 0&&Oe.has(e)}function Ae(e,t){let n=e??`hub-only`;return n===`any-node`?!0:n===`hub-only`?t:!t}function je(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 Me(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 Ne({addons:e,clusterStatus:n,selectedNode:i,onRefresh:o,isRefreshing:s}){let c=ae(),[d,f]=O(``),p=ie(d),[h,_]=O(!1),v=C(null);A(()=>{if(!h)return;let e=e=>{v.current&&!v.current.contains(e.target)&&_(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[h]);let{data:y}=r({nodeId:i.id}),ee=E(()=>{let e=new Map;for(let t of y??[])e.set(t.name,t.latestVersion);return e},[y]),b=E(()=>(y??[]).filter(e=>!e.isSystem).length,[y]),[ne,x]=O(()=>new Set),[w,D]=O(()=>new Map),oe=S(e=>{x(t=>new Set(t).add(e))},[]),se=S(e=>{x(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),j=S((e,t)=>{D(n=>new Map(n).set(e,t))},[]),ce=S(e=>{D(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),P=l({onMutate:e=>{oe(e.name),ce(e.name)},onSuccess:(e,t)=>{se(t.name);let n=e;if(n&&n.success===!1){j(t.name,n.error??`Update failed (no error message returned by server)`);return}c.invalidateQueries({queryKey:[[`addons`]]}),c.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]})},onError:(e,t)=>{se(t.name),j(t.name,e instanceof Error?e.message:String(e))}}),F=_e(),I=C(new Set);A(()=>{let e=new Set;for(let[t,n]of F)Y(n)&&e.add(t);let t=[...I.current].some(t=>!e.has(t));I.current=e,t&&(c.invalidateQueries({queryKey:[[`addons`]]}),c.invalidateQueries({queryKey:[[`addons`,`listUpdates`]]}))},[F,c]);let{data:de}=g(void 0),B=m({onSuccess:()=>{c.invalidateQueries({queryKey:[[`addons`,`getAutoUpdateSettings`]]})}}),{data:V,isFetching:fe}=u({query:p||void 0},{enabled:h}),H=a(),{data:U}=re(void 0),W=U?.requestedAt,[pe,me]=O(null),[G,he]=O(!1);A(()=>{if(U?.kind===`framework-bulk-update`&&U.requestedAt!==pe){me(U.requestedAt),he(!0);let e=window.setTimeout(()=>he(!1),6e3);return()=>window.clearTimeout(e)}},[W,pe,U]),te();let K=S(async()=>{let e=(y??[]).filter(e=>!e.isSystem);if(e.length!==0){if(!i.isHub){for(let t of e)await P.mutateAsync({name:t.name,version:t.latestVersion,nodeId:i.id});return}await H.mutateAsync({kind:`update`,targets:e.map(e=>({name:e.name,version:e.latestVersion})),nodeIds:[i.id]})}},[y,i.id,i.isHub,H,P]),q=t({onSuccess:()=>{c.invalidateQueries({queryKey:[[`addons`]]}),c.invalidateQueries({queryKey:[[`addonPages`]]}),c.invalidateQueries({queryKey:[[`capabilities`]]}),c.invalidateQueries({queryKey:[[`integrations`]]})}}),[J,ge]=O(`type`),[X,ve]=O(()=>typeof window>`u`?`grouped`:window.localStorage.getItem(`camstack.addons.viewMode`)===`flat`?`flat`:`grouped`),ye=e=>{ve(e),typeof window<`u`&&window.localStorage.setItem(`camstack.addons.viewMode`,e)},[be,xe]=z(),Z=be.get(`capability`),Se=E(()=>{let t=e.filter(e=>!ke(e.manifest.packageName));return i.isHub||(t=t.filter(e=>Ae(e.placement,i.isHub))),Z&&(t=t.filter(e=>(e.manifest.capabilities??[]).some(e=>(typeof e==`string`?e:e.name)===Z))),t},[e,i.isHub,Z]),Ce=()=>{let e=new URLSearchParams(be);e.delete(`capability`),xe(e,{replace:!0})},we=X===`flat`?Se:Me(Se),Te=E(()=>{let e=[...we];switch(J){case`type`:e.sort((e,t)=>{let n=+!$(e),r=+!$(t);if(n!==r)return n-r;let i=$(e)?e.bundle.displayName:e.manifest.name,a=$(t)?t.bundle.displayName:t.manifest.name;return i.localeCompare(a)});break;case`name`:e.sort((e,t)=>{let n=$(e)?e.bundle.displayName:e.manifest.name,r=$(t)?t.bundle.displayName:t.manifest.name;return n.localeCompare(r)});break;case`source`:e.sort((e,t)=>{let n=$(e)?e.bundle.installSource??``:e.installSource??``,r=$(t)?t.bundle.installSource??``:t.installSource??``;return n.localeCompare(r)});break}return e},[we,J]);return T(`div`,{className:`space-y-4`,children:[[...w.entries()].map(([e,t])=>k(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-[11px]`,children:T(`div`,{className:`flex items-start justify-between gap-3`,children:[T(`div`,{className:`space-y-0.5`,children:[T(`div`,{className:`font-medium text-danger`,children:[`Failed to update `,e]}),k(`div`,{className:`text-foreground-subtle font-mono`,children:t})]}),k(`button`,{type:`button`,onClick:()=>ce(e),className:`text-foreground-subtle hover:text-foreground text-[10px]`,children:`dismiss`})]})},e)),T(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[T(`div`,{className:`flex items-center gap-1.5`,children:[k(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Sort:`}),T(`select`,{value:J,onChange:e=>ge(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:[k(`option`,{value:`type`,children:`Bundles first`}),k(`option`,{value:`name`,children:`Name`}),k(`option`,{value:`source`,children:`Install source`})]})]}),T(`div`,{className:`flex items-center gap-1.5`,children:[k(`span`,{className:`text-[10px] text-foreground-subtle`,children:`View:`}),k(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`grouped`,`flat`].map(e=>k(`button`,{type:`button`,onClick:()=>ye(e),className:`px-2.5 py-1.5 transition-colors capitalize ${X===e?`bg-primary/10 text-primary`:`bg-transparent text-foreground-subtle hover:bg-surface-hover`}`,title:e===`grouped`?`Group multi-addon packages into a bundle card`:`Show every addon as its own card`,children:e},e))})]}),i.isHub&&T(`div`,{className:`flex items-center gap-1.5`,children:[k(N,{className:`h-3 w-3 text-foreground-subtle`}),k(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Auto-Update:`}),k(`div`,{className:`flex rounded-md border border-border overflow-hidden text-[10px] font-medium`,children:[`off`,`latest`,`beta`].map(e=>k(`button`,{type:`button`,onClick:()=>B.mutate({channel:e}),disabled:B.isPending,className:`px-2.5 py-1.5 transition-colors capitalize ${de?.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))})]}),b>0&&T(`button`,{type:`button`,onClick:()=>void K(),disabled:H.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:[H.isPending?k(R,{className:`w-3 h-3 animate-spin`}):k(M,{className:`w-3 h-3`}),H.isPending?`Updating…`:`Update All (${b})`]}),T(`button`,{type:`button`,onClick:o,disabled:s||H.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:[k(N,{className:`w-3 h-3 ${s?`animate-spin`:``}`}),`Refresh`]})]}),T(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[T(`div`,{className:`relative flex-1 min-w-0 sm:min-w-[200px]`,ref:v,children:[k(le,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),k(`input`,{type:`text`,value:d,onChange:e=>{f(e.target.value),_(!0)},onFocus:()=>_(!0),placeholder:`Search addons on npm...`,disabled:H.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`}),fe&&k(R,{className:`absolute right-2.5 top-1/2 -translate-y-1/2 h-3 w-3 text-foreground-subtle animate-spin`}),h&&V&&V.length>0&&T(`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:[V.length>0&&T(`div`,{className:`px-3 py-1.5 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:[`npm results (`,V.length,`)`]}),V&&V.length>0&&k(`div`,{className:`max-h-72 overflow-auto divide-y divide-border`,children:V.map(e=>T(`div`,{className:`flex items-center gap-3 px-3 py-2 hover:bg-surface-hover transition-colors`,children:[k(`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()}),T(`div`,{className:`flex-1 min-w-0`,children:[T(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[k(`span`,{className:`text-[11px] font-semibold break-words`,children:e.name.replace(/^@camstack\/(addon-)?/,``)}),T(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:[`v`,e.version]})]}),k(`div`,{className:`font-mono text-[9px] text-foreground-subtle/80 truncate`,children:e.name}),e.description&&k(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.description})]}),e.installed?T(`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:[k(L,{className:`h-3 w-3`}),e.installedVersion??`Installed`]}):T(`button`,{type:`button`,onClick:()=>q.mutate({packageName:e.name}),disabled:q.isPending,className:`inline-flex items-center gap-1 px-2 py-1 text-[10px] font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors shrink-0`,children:[q.isPending?k(R,{className:`h-3 w-3 animate-spin`}):k(M,{className:`h-3 w-3`}),`Install`]})]},e.name))})]})]}),k(De,{onUploadSuccess:()=>{c.invalidateQueries({queryKey:[[`addons`]]}),o()}})]}),Z&&T(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-primary/10 border border-primary/30 text-sm`,children:[k(`span`,{className:`text-foreground-subtle`,children:`Filtering by capability:`}),k(`span`,{className:`font-mono text-primary font-semibold`,children:Z}),k(`button`,{type:`button`,onClick:Ce,className:`ml-auto text-xs text-foreground-subtle hover:text-foreground underline`,children:`Clear`})]}),G&&T(`div`,{className:`fixed top-[calc(env(safe-area-inset-top)+1rem)] right-[calc(env(safe-area-inset-right)+1rem)] z-50 flex items-start gap-2 px-3 py-2.5 rounded-md border border-green-500/30 bg-green-500/10 shadow-lg backdrop-blur-sm max-w-sm pointer-events-auto`,children:[k(ue,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),T(`div`,{children:[k(`div`,{className:`text-[11px] font-semibold text-foreground`,children:`Bulk update completed`}),k(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:`System packages updated — hub restarted successfully.`})]})]}),Se.length===0&&k(`div`,{className:`text-xs text-foreground-subtle`,children:e.length===0?`No addons installed`:Z?`No installed addons declare the "${Z}" capability. Browse the npm catalog above to find a compatible addon.`:`No addons compatible with ${i.name} (placement filter active)`}),k(`div`,{className:`space-y-2`,children:Te.map(e=>{let t=$(e)?e.bundle.packageName:e.manifest.packageName,r=ee.get(t),a=$(e)?e.representative:e,o=r?e=>P.mutate({name:t,version:e,nodeId:i.id}):void 0,s=F.get(t)??null,c=s!==null&&Y(s);return k(Ee,{addon:a,clusterStatus:n?.[a.manifest.id],bundle:$(e)?e.bundle:void 0,availableUpdate:r,isUpdating:ne.has(t)||c,jobProgress:s,onUpdate:o,disabledByBulk:H.isPending},$(e)?t:e.manifest.id)})})]})}function Pe(){let e=ae(),{data:t,isLoading:r,isError:i}=ne(),{data:a}=o(void 0),{data:s}=c(void 0,{refetchInterval:1e4}),l=E(()=>{let e=new Map;e.set(`hub`,{id:`hub`,name:`Hub`,isHub:!0});for(let t of s??[]){let n=String(t.id??``);n&&e.set(n,{id:n,name:String(t.name??n),isHub:!!t.isHub})}return[...e.values()]},[s]),[u,d]=O(`hub`),p=l.find(e=>e.id===u)??l[0],m=b(),h=f(),g=m.isPending||h.isPending,_=async()=>{await m.mutateAsync({nodeId:u}),await h.mutateAsync(),e.invalidateQueries({queryKey:[[`addons`]]})},v=C(m);v.current=m,A(()=>{v.current.mutate({nodeId:`hub`})},[]);let y=(t??[]).map(je).filter(e=>e!==null);return T(W,{children:[T(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[k(n,{selectedNodeId:u,onSelect:d}),T(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[!r&&!i&&T(`span`,{className:`text-[10px] rounded-full bg-primary/10 text-primary px-2 py-0.5 font-medium`,children:[y.length,` installed`]}),T(`button`,{type:`button`,onClick:()=>void _(),disabled:g,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:[k(N,{className:`w-3 h-3 ${g?`animate-spin`:``}`}),`Check for updates`]})]})]}),!p.isHub&&T(`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`,` `,k(`span`,{className:`font-medium text-foreground`,children:p.name}),` — agents only run`,` `,k(`code`,{className:`font-mono`,children:`agent-only`}),` and`,` `,k(`code`,{className:`font-mono`,children:`any-node`}),` addons. Install / uninstall is hub-driven; agents auto-sync from the hub.`]}),r&&k(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading…`}),i&&k(`div`,{className:`text-xs text-danger`,children:`Failed to load addons`}),!r&&!i&&k(Ne,{addons:y,clusterStatus:a,selectedNode:p,onRefresh:()=>void _(),isRefreshing:g})]})}export{Pe as AddonsPage};
|