@camstack/addon-admin-ui 1.2.59 → 1.2.61

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.
Files changed (151) hide show
  1. package/dist/assets/AddLocationWizard-BVrPN8yV.js +1 -0
  2. package/dist/assets/AddonCollectionPage-Cluggqrl.js +1 -0
  3. package/dist/assets/Addons-pf4_6Np6.js +1 -0
  4. package/dist/assets/{AdminPage-Dq33XE9j.js → AdminPage-CCD07UMs.js} +1 -1
  5. package/dist/assets/{AdminTabs-Co61VJ4U.js → AdminTabs-D4DXIa-o.js} +1 -1
  6. package/dist/assets/AiProfiles-Dc-3w9Z5.js +3 -0
  7. package/dist/assets/BrokerForm-DpZEb2oo.js +1 -0
  8. package/dist/assets/Build-DFf7JJQN.js +32 -0
  9. package/dist/assets/Capabilities-fyyhemKk.js +1 -0
  10. package/dist/assets/{CapabilityBadges-Do48_jzx.js → CapabilityBadges-CFAqIVEN.js} +1 -1
  11. package/dist/assets/Cluster-BI79yXHi.js +1 -0
  12. package/dist/assets/Data-BnH1FBcv.js +1 -0
  13. package/dist/assets/DetectionIntelligence-pZ34_QKw.js +1 -0
  14. package/dist/assets/{DeviceAggregateSection-n3hYy5qm.js → DeviceAggregateSection-DcU4HtPo.js} +1 -1
  15. package/dist/assets/DeviceDetail-D4IEMIPA.js +2 -0
  16. package/dist/assets/Devices-Qvmjz6OV.js +1 -0
  17. package/dist/assets/EmbedPlayerPage-BiOYECZo.js +1 -0
  18. package/dist/assets/Events-BkGGzjc6.js +1 -0
  19. package/dist/assets/FormBuilder-Ce9uWxtp.js +1 -0
  20. package/dist/assets/Identity-Dz2q6O35.js +1 -0
  21. package/dist/assets/IntegrationDetail-BgYnCOqc.js +1 -0
  22. package/dist/assets/Integrations-CGDgpbY3.js +1 -0
  23. package/dist/assets/Integrations-JZkpFkbO.js +1 -0
  24. package/dist/assets/Logs-Dc8myuGB.js +1 -0
  25. package/dist/assets/{MaskShapeCanvas-pGn6MKOi.js → MaskShapeCanvas-Dcpby34M.js} +1 -1
  26. package/dist/assets/MotionZonesSettings-CNAneuwi.js +1 -0
  27. package/dist/assets/MyAccess-BplkKorv.js +2 -0
  28. package/dist/assets/Network-DkXgbHRL.js +1 -0
  29. package/dist/assets/NodeAddonsSettingsPanel-qSFnzXqZ.js +1 -0
  30. package/dist/assets/NodeInferenceDevices-B7RYmrXb.js +1 -0
  31. package/dist/assets/Notifications-CsUJcPdF.js +1 -0
  32. package/dist/assets/Pipeline-BVix_5wm.js +1 -0
  33. package/dist/assets/Plates-Cn1Al2WA.js +1 -0
  34. package/dist/assets/PrivacyMaskSettings-GAkxAsA3.js +1 -0
  35. package/dist/assets/{ProviderIcon-B5c5wlw9.js → ProviderIcon-CQo4yDQS.js} +1 -1
  36. package/dist/assets/Recordings-DZMmDA_4.js +1 -0
  37. package/dist/assets/ScanNetworkModal-TrU5QhWB.js +1 -0
  38. package/dist/assets/SceneMonitorEditor-DcTfkrW3.js +1 -0
  39. package/dist/assets/Scenes-bMn8sgm0.js +1 -0
  40. package/dist/assets/{SchemaTabBar-BrF8ZUiR.js → SchemaTabBar-DC28nb9j.js} +1 -1
  41. package/dist/assets/Settings-B1YsrVcn.js +1 -0
  42. package/dist/assets/{Showroom-CBvbRA83.js → Showroom-Cik2ivrC.js} +1 -1
  43. package/dist/assets/{StableTabPanel-p16epZGa.js → StableTabPanel-Dc954AQl.js} +1 -1
  44. package/dist/assets/{StatusBadge-Dcr2bw58.js → StatusBadge-CeptlsPG.js} +1 -1
  45. package/dist/assets/{Terminal-BSwEKm0g.js → Terminal-BWct2hhL.js} +2 -2
  46. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-xKOm5ETc.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-B59PxHv9.js} +1 -1
  47. 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
  48. package/dist/assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-8kv6pj9W.js +6 -0
  49. 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
  50. 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
  51. 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
  52. 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
  53. package/dist/assets/{authed-media-B8T1dsFh.js → authed-media-BPd_L9jr.js} +1 -1
  54. package/dist/assets/{bell-ring-BqgJ8dnI.js → bell-ring-CtdRZtjG.js} +1 -1
  55. package/dist/assets/{boxes-BCCj5PaE.js → boxes-BN_wTQoj.js} +1 -1
  56. package/dist/assets/build-cluster-graph-JVj1fl5o.js +7 -0
  57. package/dist/assets/circle-check-big-KvCernzh.js +1 -0
  58. package/dist/assets/{circle-x-DmD78bDU.js → circle-x-DKEv2fk-.js} +1 -1
  59. package/dist/assets/clock-Ddu_eThB.js +1 -0
  60. package/dist/assets/{copy-lMFz0Is-.js → copy-C0Y9pMFE.js} +1 -1
  61. package/dist/assets/{debounced-invalidate-CCYTebYW.js → debounced-invalidate-CYoigLZW.js} +1 -1
  62. package/dist/assets/dist-Bz6O5BsH.js +345 -0
  63. package/dist/assets/{dist-CK_B4BKB.js → dist-DVOPUibu.js} +1 -1
  64. package/dist/assets/{download-CXXQf3fF.js → download-B538th-h.js} +1 -1
  65. package/dist/assets/{face-bbox-DAP66Zl4.js → face-bbox-0omHJ2v9.js} +1 -1
  66. package/dist/assets/{hard-drive-gxnGyiw0.js → hard-drive-DFBgqBxK.js} +1 -1
  67. package/dist/assets/{hostInit-B_AsKiXE.js → hostInit-CiIhfzzr.js} +1 -1
  68. package/dist/assets/index-Dr-ap6SH.js +4 -0
  69. package/dist/assets/{key-round-ClzJuSaS.js → key-round-D1XSxvLS.js} +1 -1
  70. package/dist/assets/{mf-entry-bootstrap-0-53feb26e.js → mf-entry-bootstrap-0-82869dcc.js} +2 -2
  71. package/dist/assets/{pencil-OtLKJIw8.js → pencil-CZ2gMyTB.js} +1 -1
  72. package/dist/assets/play-BrdA8mXB.js +1 -0
  73. package/dist/assets/player-overlays-7AKPeTm-.js +1 -0
  74. package/dist/assets/plus-ChsVL8uT.js +1 -0
  75. package/dist/assets/power-Dz2il9ai.js +1 -0
  76. package/dist/assets/{radio-B8HIjRjm.js → radio-C0T0_Ki5.js} +1 -1
  77. package/dist/assets/{refresh-cw-BwezRSth.js → refresh-cw-DuE4ONv-.js} +1 -1
  78. package/dist/assets/remoteEntry-CgpjK5QJ.js +1 -0
  79. package/dist/assets/rotate-ccw-DS5e2J2f.js +1 -0
  80. package/dist/assets/rotate-cw-Bb9OhnRT.js +1 -0
  81. package/dist/assets/search-BunRfhTv.js +1 -0
  82. package/dist/assets/{send-DLoLyQZY.js → send-CiGeFhM_.js} +1 -1
  83. package/dist/assets/{server-jIBmmmio.js → server-BBJTl0ih.js} +1 -1
  84. package/dist/assets/square-BlgtgcV9.js +1 -0
  85. package/dist/assets/{square-check-big-CKAjnVKI.js → square-check-big-DEpi1DZf.js} +1 -1
  86. package/dist/assets/src-BaVKQIP9.js +345 -0
  87. package/dist/assets/src-CgOOvCVA.js +67 -0
  88. package/dist/assets/{undo-2-8_qvXX1O.js → undo-2-BEASNScj.js} +1 -1
  89. package/dist/assets/{upload-DUXkaKq1.js → upload-CCWw0hX4.js} +1 -1
  90. package/dist/assets/use-scenes-feed-BrAVTu20.js +1 -0
  91. package/dist/assets/{useBodyScrollLock-B_rtaBV1.js → useBodyScrollLock-BDocajQE.js} +1 -1
  92. package/dist/assets/useEventInvalidation-CnCqhaHZ.js +1 -0
  93. package/dist/assets/{video-DKFg6rjo.js → video-BEAVV4bf.js} +1 -1
  94. 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_-D8I8UoDY.js} +2 -2
  95. package/dist/assets/{wifi-DT5Z6S_y.js → wifi-sgX03Yna.js} +1 -1
  96. package/dist/assets/{zap-B5xlyN9v.js → zap-DVVII2tr.js} +1 -1
  97. package/dist/index.html +5 -5
  98. package/dist/server/addon.js +314 -45
  99. package/package.json +1 -1
  100. package/dist/assets/AddLocationWizard-BXcL90QM.js +0 -1
  101. package/dist/assets/AddonCollectionPage-C7QSc0L5.js +0 -1
  102. package/dist/assets/Addons-BjibMtF0.js +0 -1
  103. package/dist/assets/AiProfiles-BTRgo8wQ.js +0 -3
  104. package/dist/assets/BrokerForm-dYfcx-yx.js +0 -1
  105. package/dist/assets/Build-CeZh7cjz.js +0 -32
  106. package/dist/assets/Capabilities-DqpHPDt5.js +0 -1
  107. package/dist/assets/Cluster-C1ow3yuB.js +0 -1
  108. package/dist/assets/Data-Bmealxcc.js +0 -1
  109. package/dist/assets/DetectionIntelligence-DSjppxYS.js +0 -1
  110. package/dist/assets/DeviceDetail-f12eUwKC.js +0 -2
  111. package/dist/assets/Devices-CMuMzwTK.js +0 -1
  112. package/dist/assets/EmbedPlayerPage-D5CGJj62.js +0 -1
  113. package/dist/assets/Events-CWhiAlpv.js +0 -1
  114. package/dist/assets/FormBuilder-DVbN4jV5.js +0 -1
  115. package/dist/assets/Identity-BxlWiwaZ.js +0 -1
  116. package/dist/assets/IntegrationDetail-D-EyePxA.js +0 -1
  117. package/dist/assets/Integrations-CVh8WXwB.js +0 -1
  118. package/dist/assets/Integrations-fubIeAyS.js +0 -1
  119. package/dist/assets/Logs-BRgM3t9y.js +0 -1
  120. package/dist/assets/MotionZonesSettings-BQz60XWV.js +0 -1
  121. package/dist/assets/MyAccess-kWZq3W2o.js +0 -2
  122. package/dist/assets/Network-CgSVh1De.js +0 -1
  123. package/dist/assets/NodeAddonsSettingsPanel-DJKQxT7V.js +0 -1
  124. package/dist/assets/NodeInferenceDevices-BTPZ_wyg.js +0 -1
  125. package/dist/assets/Notifications-NpPQQefM.js +0 -1
  126. package/dist/assets/Pipeline-BaYygdkg.js +0 -1
  127. package/dist/assets/Plates-jNVVmALy.js +0 -1
  128. package/dist/assets/PrivacyMaskSettings-C4YaoDu_.js +0 -1
  129. package/dist/assets/Recordings-D5v6ma1R.js +0 -1
  130. package/dist/assets/ScanNetworkModal-WPD06cKp.js +0 -1
  131. package/dist/assets/SceneMonitorEditor-Czf-iZgv.js +0 -1
  132. package/dist/assets/Settings-DvWeXqKw.js +0 -1
  133. 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
  134. package/dist/assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-CSJxMxg6.js +0 -6
  135. package/dist/assets/build-cluster-graph-DMQ4vDW2.js +0 -7
  136. package/dist/assets/circle-check-big-CQsfhCrZ.js +0 -1
  137. package/dist/assets/clock-0kqs7-NB.js +0 -1
  138. package/dist/assets/dist-BX6atE5N.js +0 -345
  139. package/dist/assets/index-B6kDpXr5.js +0 -4
  140. package/dist/assets/play-Q-R5vHEh.js +0 -1
  141. package/dist/assets/plus-vrCV3Fn-.js +0 -1
  142. package/dist/assets/power-Dw-9Qin8.js +0 -1
  143. package/dist/assets/remoteEntry-DOOomD9n.js +0 -1
  144. package/dist/assets/rotate-ccw-uOQBDtri.js +0 -1
  145. package/dist/assets/rotate-cw-B6qXQ5pJ.js +0 -1
  146. package/dist/assets/search-iOwuoJNQ.js +0 -1
  147. package/dist/assets/square-CgzDPTwM.js +0 -1
  148. package/dist/assets/src-BizjMCcy.js +0 -345
  149. package/dist/assets/src-BmAmiAXy.js +0 -67
  150. package/dist/assets/useEventInvalidation-Dovpg3no.js +0 -1
  151. package/dist/assets/widget-panel-BF8s8cZY.js +0 -1
@@ -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({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
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
- * Operator-approved vocabulary (2026-08-12, option A — the same one the
14138
- * reference notifier uses, so an operator moving between them re-uses what
14139
- * they already know): a rule matches when, over a sampling window of
14140
- * `samplingSeconds`, at least `hitPercent`% of the audio samples in that
14141
- * window are HITS. A sample is a hit when it satisfies BOTH present filters:
14142
- *
14143
- * - `dbThreshold` its level is at or above this many dBFS (see
14144
- * {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale);
14145
- * - `labels` the classifier put at least one of these labels on it.
14146
- *
14147
- * Both are OPTIONAL and independent, which is the point of the shape: a
14148
- * loudness rule ("something loud at 3am") needs no model to be right, and a
14149
- * label rule ("a dog barked") needs no threshold. **Fail-closed when NEITHER
14150
- * is given** a window in which every sample is trivially a hit would fire on
14151
- * silence, so the engine refuses such a condition rather than notifying on
14152
- * nothing (the schema cannot express "at least one of" without becoming a
14153
- * ZodEffects the cap path would have to special-case).
14154
- *
14155
- * `hitPercent` is over the samples the window actually HOLDS, and the window
14156
- * must be FULL before it can match a window that has been open for two
14157
- * seconds of its ten is 100% of nothing, and firing on it would make
14158
- * `samplingSeconds` decorative.
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
- /** Audio macro labels; absent = any sound (level-only rule). */
14278
+ /** LABEL MODE: audio macro labels. Present fires on the first labelled frame. */
14167
14279
  labels: array(string().min(1)).min(1).optional(),
14168
- /** Level floor in dBFS (negative-going, `0` = full scale); absent = any level. */
14280
+ /** LEVEL MODE: floor in dBFS (negative-going, `0` = full scale). */
14169
14281
  dbThreshold: number().min(-96).max(0).optional(),
14170
- /** Percentage of the window's samples that must be hits (1–100). */
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
- /** Length of the sampling window in seconds. */
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
  /**
@@ -14307,13 +14419,81 @@ var NcRuleActionsSchema = object({
14307
14419
  */
14308
14420
  buttons: array(NcRuleNotificationButtonSchema).max(8).optional()
14309
14421
  });
14422
+ /**
14423
+ * "This rule applies only while `deviceId` is in one of `states`."
14424
+ *
14425
+ * The states are the DEVICE's own vocabulary — `AlarmState` for a panel,
14426
+ * `on`/`off` for a switch — not a normalised set, because normalising would
14427
+ * make the condition lie about devices whose states have no equivalent.
14428
+ *
14429
+ * An unreadable state does NOT match: see the engine's fail-closed gate. A
14430
+ * condition that fired on "I could not read it" would be worse than no gate.
14431
+ */
14432
+ var NcDeviceStateConditionSchema = object({
14433
+ deviceId: number().int(),
14434
+ /** Any of these matches. */
14435
+ states: array(string().min(1)).min(1)
14436
+ });
14437
+ /**
14438
+ * "This rule applies only while scene `sceneId` is `matched` / `diverged`."
14439
+ *
14440
+ * A GATE, not a trigger. `occupancy` and `audio` each DISCRIMINATE their rule —
14441
+ * carrying one makes the rule fire on that subject and nothing else. Scene is
14442
+ * the other shape entirely, the `deviceState` shape: it narrows a rule that
14443
+ * already has a trigger ("tell me about a person at the front door, but only
14444
+ * while the bin is still out"). That is why it composes with every delivery
14445
+ * instead of owning one, and why no new `NcDelivery` member and no new subject
14446
+ * kind exist for it — see D159.
14447
+ *
14448
+ * ── Identity ───────────────────────────────────────────────────────────────
14449
+ * `sceneId` is `SceneMonitor.id`, a `randomUUID()` minted by `createScene` —
14450
+ * globally unique, so it needs no device to disambiguate it. `deviceId` is
14451
+ * carried as a HINT for the editor and for the log line, never as part of the
14452
+ * lookup key: a rule whose hint drifted must still gate correctly.
14453
+ *
14454
+ * ── Which boolean ──────────────────────────────────────────────────────────
14455
+ * `latched` ABSENT means "whatever the scene itself says" — `SceneMonitor.emit`
14456
+ * already declares which boolean drives notification rules, and a second knob
14457
+ * that could disagree with it is exactly the D62 failure. Set it only to
14458
+ * override one rule against the scene's own default.
14459
+ *
14460
+ * - LIVE reading (`emit`/`latched` resolve to live): passes iff
14461
+ * `verdict === requiredState`. `unknown` — no reference for this light, view
14462
+ * shifted, no snapshot — passes NEITHER. A scene that cannot judge is not
14463
+ * evidence, in either direction.
14464
+ * - LATCHED reading: passes iff `latched === (requiredState === 'diverged')`.
14465
+ * The latch is a durable fact about the past ("it has diverged since I armed
14466
+ * it"), so a camera that has gone dark does not clear it — that is the whole
14467
+ * reason the operator asked for a latch.
14468
+ *
14469
+ * The gate reads an in-memory mirror (`NcSceneStateCache`) refreshed OFF the
14470
+ * event path, never the cap: D49. A mirror that has never loaded, or a scene it
14471
+ * does not carry, reads absent and the rule does NOT fire — fail closed, and
14472
+ * said out loud in the log rather than dropped in silence.
14473
+ */
14474
+ var NcSceneConditionSchema = object({
14475
+ /** `SceneMonitor.id` — the uuid the cap mints. The whole lookup key. */
14476
+ sceneId: string().min(1),
14477
+ /** The camera the scene lives on. A hint for the editor and the log line. */
14478
+ deviceId: number().int().optional(),
14479
+ /** The state the scene must be in for the rule to fire. */
14480
+ requiredState: _enum(["matched", "diverged"]),
14481
+ /**
14482
+ * Read the LATCH (`true`) or the LIVE verdict (`false`). Absent = follow the
14483
+ * scene's own `emit` field, which is the only place that decision belongs.
14484
+ */
14485
+ latched: boolean().optional()
14486
+ });
14310
14487
  var NcConditionsSchema = object({
14311
14488
  /** Gate on ANOTHER device's current state (the alarm armed, a switch on). */
14312
- deviceState: object({
14313
- deviceId: number().int(),
14314
- /** Any of these matches. */
14315
- states: array(string().min(1)).min(1)
14316
- }).optional(),
14489
+ deviceState: NcDeviceStateConditionSchema.optional(),
14490
+ /**
14491
+ * Gate on a SCENE's state — "only while the bin is still out". Composes with
14492
+ * every trigger (detection, occupancy, audio, sensor, package, track-end);
14493
+ * unlike `occupancy`/`audio` it discriminates nothing. See
14494
+ * {@link NcSceneCondition} and D159.
14495
+ */
14496
+ scene: NcSceneConditionSchema.optional(),
14317
14497
  /** Device scope — absent = all devices. */
14318
14498
  devices: array(number()).optional(),
14319
14499
  /** Detector class names (any overlap with the record's class set). */
@@ -14951,6 +15131,7 @@ var NcConditionDescriptorSchema = object({
14951
15131
  "occupancy",
14952
15132
  "audio",
14953
15133
  "deviceState",
15134
+ "scene",
14954
15135
  "systemEvent"
14955
15136
  ]),
14956
15137
  operator: _enum([
@@ -24125,10 +24306,22 @@ method(object({
24125
24306
  * thing except the comparator: `similarity` (CLIP cosine at the same ROI coords
24126
24307
  * vs condition-tagged references) and `llm` (vision-LLM judgment over the crop).
24127
24308
  *
24128
- * D14 device-config archetype (`deviceConfig.ui.kind:'widget'`) the framework
24129
- * derives the device-detail contribution; the provider carries NO hand-written
24130
- * settings-contribution methods. `status.kind:'push'` the engine pushes on
24131
- * every hysteresis flip / availability change; consumers never poll.
24309
+ * **No `deviceConfig`, deliberately.** This shipped as the D14 widget archetype,
24310
+ * which put a "Scenes" tab on one camera's detail page. That is the wrong shape
24311
+ * for the thing: a scene is a standing question about the property ("is the bin
24312
+ * still out"), and the operator's question is "which of my scenes have tripped",
24313
+ * across every camera at once — not "what does camera 617 think". Buried one
24314
+ * camera deep it also could not be found. The surface is now a top-level admin
24315
+ * page (`/scenes`, `pages/Scenes.tsx`) that lists every scene on every camera and
24316
+ * picks the camera inside the create flow, the same shape Events and Faces have.
24317
+ *
24318
+ * The consequence to keep in mind: `host/scene-monitor-editor` is gone from
24319
+ * `HOST_WIDGETS` too. `scripts/check-host-widget-resolves.ts` asserts BOTH
24320
+ * directions, so a registration nobody declares fails exactly as loudly as a
24321
+ * declaration nobody registers. The editor is imported directly by the page.
24322
+ *
24323
+ * `status.kind:'push'` — the engine pushes on every hysteresis flip /
24324
+ * availability change; consumers never poll.
24132
24325
  */
24133
24326
  /** Extensible condition tag. Seeded 'day' | 'ir' (the two variants the operator
24134
24327
  * captures) plus 'night' | 'dawn' | 'dusk' from the resolver's sun-times band.
@@ -24657,12 +24850,64 @@ var NetworkAddressSchema = object({
24657
24850
  family: string(),
24658
24851
  internal: boolean()
24659
24852
  });
24853
+ /**
24854
+ * Provenance of the site coordinates, and the whole reason this is not just two
24855
+ * numbers.
24856
+ *
24857
+ * - `operator-set` — a human typed it, or accepted a detection. Authoritative;
24858
+ * nothing overwrites it.
24859
+ * - `derived-from-ip` — the hub geolocated its own public IP once, because a
24860
+ * default that is right to a few kilometres beats the coarse UTC clock split
24861
+ * the sun-times consumers otherwise fall back to.
24862
+ *
24863
+ * The UI shows which one it is. An operator who cannot tell a guess from their
24864
+ * own input will eventually trust the guess.
24865
+ */
24866
+ var SiteLocationSourceSchema = _enum(["operator-set", "derived-from-ip"]);
24867
+ /**
24868
+ * The read shape: the location plus the honest state of the one-shot derivation.
24869
+ *
24870
+ * `derivationAttemptedAt` is what makes the "one call, ever" contract
24871
+ * inspectable. When it is set and `location` is null, the geo-IP lookup ran and
24872
+ * failed; the hub will NOT try again on its own — the fallback is declared
24873
+ * (consumers degrade to their own last resort) and the operator either types the
24874
+ * coordinates or presses detect.
24875
+ */
24876
+ var SiteLocationStatusSchema = object({
24877
+ location: object({
24878
+ /** WGS84 decimal degrees. */
24879
+ latitude: number().min(-90).max(90),
24880
+ longitude: number().min(-180).max(180),
24881
+ source: SiteLocationSourceSchema,
24882
+ /** Epoch ms the value was last written. */
24883
+ updatedAt: number(),
24884
+ /**
24885
+ * Human-readable place the geo-IP service reported ("Napoli, IT"). Display
24886
+ * only — never parsed, never matched on. Absent for an operator-typed value.
24887
+ */
24888
+ label: string().optional()
24889
+ }).nullable(),
24890
+ derivationAttemptedAt: number().nullable(),
24891
+ /** Why the last derivation failed, for the UI to show instead of a shrug. */
24892
+ derivationError: string().nullable()
24893
+ });
24894
+ /** `null` clears the location and re-arms nothing — the derivation stays spent. */
24895
+ var SetSiteLocationInputSchema = object({
24896
+ latitude: number().min(-90).max(90),
24897
+ longitude: number().min(-180).max(180)
24898
+ }).nullable();
24660
24899
  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
24900
  kind: "mutation",
24662
24901
  auth: "admin"
24663
24902
  }), method(_void(), _void(), {
24664
24903
  kind: "mutation",
24665
24904
  auth: "admin"
24905
+ }), method(_void(), SiteLocationStatusSchema), method(SetSiteLocationInputSchema, SiteLocationStatusSchema, {
24906
+ kind: "mutation",
24907
+ auth: "admin"
24908
+ }), method(_void(), SiteLocationStatusSchema, {
24909
+ kind: "mutation",
24910
+ auth: "admin"
24666
24911
  });
24667
24912
  object({
24668
24913
  /** True when the device's tamper switch / case-open contact is
@@ -27392,6 +27637,12 @@ Object.freeze({
27392
27637
  addonId: null,
27393
27638
  access: "create"
27394
27639
  },
27640
+ "llm.cancel": {
27641
+ capName: "llm",
27642
+ capScope: "system",
27643
+ addonId: null,
27644
+ access: "create"
27645
+ },
27395
27646
  "llm.deleteModel": {
27396
27647
  capName: "llm",
27397
27648
  capScope: "system",
@@ -30326,6 +30577,12 @@ Object.freeze({
30326
30577
  addonId: null,
30327
30578
  access: "create"
30328
30579
  },
30580
+ "system.detectSiteLocation": {
30581
+ capName: "system",
30582
+ capScope: "system",
30583
+ addonId: null,
30584
+ access: "create"
30585
+ },
30329
30586
  "system.featureFlags": {
30330
30587
  capName: "system",
30331
30588
  capScope: "system",
@@ -30344,6 +30601,12 @@ Object.freeze({
30344
30601
  addonId: null,
30345
30602
  access: "view"
30346
30603
  },
30604
+ "system.getSiteLocation": {
30605
+ capName: "system",
30606
+ capScope: "system",
30607
+ addonId: null,
30608
+ access: "view"
30609
+ },
30347
30610
  "system.health": {
30348
30611
  capName: "system",
30349
30612
  capScope: "system",
@@ -30368,6 +30631,12 @@ Object.freeze({
30368
30631
  addonId: null,
30369
30632
  access: "create"
30370
30633
  },
30634
+ "system.setSiteLocation": {
30635
+ capName: "system",
30636
+ capScope: "system",
30637
+ addonId: null,
30638
+ access: "create"
30639
+ },
30371
30640
  "terminalSession.adoptLegacyMonitor": {
30372
30641
  capName: "terminal-session",
30373
30642
  capScope: "system",
@@ -33013,7 +33282,7 @@ var AdminUIAddon = class extends BaseAddon {
33013
33282
  capability: adminUiCapability,
33014
33283
  provider: {
33015
33284
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
33016
- getVersion: async () => ({ version: "1.2.59" })
33285
+ getVersion: async () => ({ version: "1.2.61" })
33017
33286
  }
33018
33287
  }];
33019
33288
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.2.59",
3
+ "version": "1.2.61",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Admin UI — Vite frontend build and server-side addon",
@@ -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};