@camstack/addon-admin-ui 1.2.213 → 1.2.215
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AddonCollectionPage-DZpgo_dH.js → AddonCollectionPage-CubC5kQE.js} +1 -1
- package/dist/assets/{Addons-DVTDjH2L.js → Addons-ttfVVUum.js} +1 -1
- package/dist/assets/{AdminTabs-BhF-e7Yr.js → AdminTabs-TCX8DJNz.js} +1 -1
- package/dist/assets/AiProfiles-CTlEdpoe.js +3 -0
- package/dist/assets/{BrokerForm-BVi_KkFR.js → BrokerForm-BWP4R060.js} +1 -1
- package/dist/assets/{Build-Cz49N4eI.js → Build-CFQpg1d-.js} +1 -1
- package/dist/assets/{Capabilities-Dkziktzm.js → Capabilities-BlBfzNhW.js} +1 -1
- package/dist/assets/{CapabilityBadges-_NNrhBO9.js → CapabilityBadges-8GHyxnS6.js} +1 -1
- package/dist/assets/{Cluster-DnWTS9Dd.js → Cluster-DKcbSAzu.js} +1 -1
- package/dist/assets/{Data-D7IThOuJ.js → Data-B7a-qeQc.js} +1 -1
- package/dist/assets/{DetectionIntelligence-3kyJyVqe.js → DetectionIntelligence-CoUnCX1F.js} +1 -1
- package/dist/assets/{DeviceAggregateSection-COI2_VWV.js → DeviceAggregateSection-v0M0dqtE.js} +1 -1
- package/dist/assets/{DeviceDetail-Dmzy6AjD.js → DeviceDetail-BbCFf2qT.js} +1 -1
- package/dist/assets/{Devices-D7ZKbPxT.js → Devices-Yv0ELguT.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-Bmgt0Ue_.js → EmbedPlayerPage-CIIx9B1X.js} +1 -1
- package/dist/assets/{Events-Buhsl6rD.js → Events-D_L4MDwU.js} +1 -1
- package/dist/assets/{FormBuilder-D8Q5DVBo.js → FormBuilder-BZYmFe24.js} +1 -1
- package/dist/assets/{Identity-CpSVKEiU.js → Identity-BmIlvN7L.js} +1 -1
- package/dist/assets/{IntegrationDetail-BP2mUhdh.js → IntegrationDetail-Cly2iu57.js} +1 -1
- package/dist/assets/{Integrations-CSzSIQpy.js → Integrations-M_KYrEQd.js} +1 -1
- package/dist/assets/{Integrations-D8s_frRf.js → Integrations-S4PkK3Ll.js} +1 -1
- package/dist/assets/{Locations-LrzsmBE-.js → Locations-oFSCmNMr.js} +1 -1
- package/dist/assets/{Logs-Cu0Hkh2A.js → Logs-DlzgvFiJ.js} +1 -1
- package/dist/assets/{MotionZonesSettings-BiAGsr5r.js → MotionZonesSettings-DhGpU0I5.js} +1 -1
- package/dist/assets/{MyAccess-Dv0ckMsw.js → MyAccess-BkO8-x85.js} +1 -1
- package/dist/assets/{Network-W5rj0hIb.js → Network-CJTMcRl5.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-BK3mMfkN.js → NodeAddonsSettingsPanel-ChOwiLnR.js} +1 -1
- package/dist/assets/{NodeInferenceDevices-jIT4TOIy.js → NodeInferenceDevices-C4vp4Fbu.js} +1 -1
- package/dist/assets/{Notifications-wbrfaAe4.js → Notifications-B30i3eP5.js} +1 -1
- package/dist/assets/{Pipeline-Bv9cS8CP.js → Pipeline-ceqGGKwg.js} +1 -1
- package/dist/assets/{Plates-wvCcFo9u.js → Plates-D3kL-Upi.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-Bm_cm4Ez.js → PrivacyMaskSettings-DnhXCrzj.js} +1 -1
- package/dist/assets/{ProviderIcon-0zoOaaFD.js → ProviderIcon-BjItAsS0.js} +1 -1
- package/dist/assets/{Recordings-erk3VDwd.js → Recordings-BOVmjU6i.js} +1 -1
- package/dist/assets/{ScanNetworkModal-DKIxhrJk.js → ScanNetworkModal-CX3MZqWy.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-Cm1_9209.js → SceneMonitorEditor-D3qgH2ME.js} +1 -1
- package/dist/assets/{Scenes-L7LCkjqy.js → Scenes-CNy57iPW.js} +1 -1
- package/dist/assets/{Settings-CFkzlf0_.js → Settings-BDXjI5aJ.js} +1 -1
- package/dist/assets/{Showroom-Bfw3oS6L.js → Showroom-Bl-WXFt1.js} +1 -1
- package/dist/assets/{StorageLocationsPanel-BBHo6JM3.js → StorageLocationsPanel-CFyJlsro.js} +1 -1
- package/dist/assets/{Terminal-C0zU5pFy.js → Terminal-P97KcqD6.js} +1 -1
- package/dist/assets/{Viewer-Da8Spkkl.js → Viewer-D9eP4Sy5.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-AljWtTMR.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-jiyNr2FY.js} +1 -1
- package/dist/assets/{authed-media-DvQdxTUc.js → authed-media-CNR9NqKv.js} +1 -1
- package/dist/assets/{bell-off-6xEwqVzJ.js → bell-off-CMfTPf58.js} +1 -1
- package/dist/assets/{boxes-B7kNLelh.js → boxes-DfeD7UtH.js} +1 -1
- package/dist/assets/circle-slash-arB7gcNw.js +1 -0
- package/dist/assets/{debounced-invalidate-CQPyWocr.js → debounced-invalidate-tuxqo8TG.js} +1 -1
- package/dist/assets/{dist-DWzDC1T8.js → dist-C4gWc6Ge.js} +1 -1
- package/dist/assets/dist-Dyo6dXja.js +349 -0
- package/dist/assets/{face-bbox-DUZG_QP9.js → face-bbox-BvUvF-r6.js} +1 -1
- package/dist/assets/{hard-drive-download-CjICR_3r.js → hard-drive-download-2ug_CgJo.js} +1 -1
- package/dist/assets/{hostInit-CVy552ti.js → hostInit-Bsbwbozc.js} +1 -1
- package/dist/assets/{index-BFpVtoWO.js → index-Lv6YyOrC.js} +3 -3
- package/dist/assets/{key-round-C-KKSFg6.js → key-round-CUq2-GeO.js} +1 -1
- package/dist/assets/{layers-jDvevbCl.js → layers-B7qpIVAW.js} +1 -1
- package/dist/assets/{location-owned-usage-B75IZFVF.js → location-owned-usage-C7OvSrVf.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-163cf22c.js → mf-entry-bootstrap-0-e959a0e4.js} +2 -2
- package/dist/assets/player-overlays-WQ-AX3Cn.js +1 -0
- package/dist/assets/remoteEntry-B5_tp2j8.js +1 -0
- package/dist/assets/{send-LQeZq7ZP.js → send-DQykiOnN.js} +1 -1
- package/dist/assets/{settings-2-CAoxWnYU.js → settings-2-DMA-WZ5M.js} +1 -1
- package/dist/assets/{square-check-big-WyVmnSdy.js → square-check-big-BdaoXPVX.js} +1 -1
- package/dist/assets/src-Akg3No8X.js +67 -0
- package/dist/assets/src-B9cDYU-z.js +349 -0
- package/dist/assets/{use-scenes-feed-Dpx4O083.js → use-scenes-feed-D3GBR8TB.js} +1 -1
- package/dist/assets/{use-stationary-objects-CxwfCEMe.js → use-stationary-objects-CWcJOsfl.js} +1 -1
- package/dist/assets/useEventInvalidation-jvSnCm5E.js +1 -0
- package/dist/assets/{useNodeUrlSelection-DgvtPUJc.js → useNodeUrlSelection-C_L4BxGo.js} +1 -1
- package/dist/assets/user-round-DmX7T-I5.js +1 -0
- package/dist/assets/{video-aqsZgai-.js → video-BAQ67tlW.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-C5II-XR4.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-rFYLpm7E.js} +2 -2
- package/dist/index.html +5 -5
- package/dist/server/addon.js +181 -7
- package/package.json +1 -1
- package/dist/assets/AiProfiles-cVbbqy-g.js +0 -3
- package/dist/assets/circle-slash--GGol-T9.js +0 -1
- package/dist/assets/dist-Dl3E57s2.js +0 -349
- package/dist/assets/player-overlays-C64C5sp1.js +0 -1
- package/dist/assets/remoteEntry-DPWrrM7B.js +0 -1
- package/dist/assets/src-Bqn0Lh4Q.js +0 -349
- package/dist/assets/src-DvETVhyy.js +0 -67
- package/dist/assets/useEventInvalidation-C_4Khxpz.js +0 -1
- package/dist/assets/user-round-B7LijIij.js +0 -1
package/dist/server/addon.js
CHANGED
|
@@ -5361,7 +5361,7 @@ var ZodIssueCode = {
|
|
|
5361
5361
|
var ZodFirstPartyTypeKind;
|
|
5362
5362
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5363
5363
|
//#endregion
|
|
5364
|
-
//#region ../types/dist/sleep-
|
|
5364
|
+
//#region ../types/dist/sleep-Bs3xPtSh.mjs
|
|
5365
5365
|
/**
|
|
5366
5366
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5367
5367
|
* window to float samples (D455).
|
|
@@ -11824,6 +11824,24 @@ var GetStreamWithCodecInputSchema = object({
|
|
|
11824
11824
|
});
|
|
11825
11825
|
var RtpSourceSchema = object({
|
|
11826
11826
|
url: string(),
|
|
11827
|
+
/**
|
|
11828
|
+
* The SENTRY counterpart of {@link url} — the dial that asks for the stream
|
|
11829
|
+
* WITHOUT asking for the camera — or `null` when this camera offers none.
|
|
11830
|
+
*
|
|
11831
|
+
* The broker answers it because the broker is the only thing that can:
|
|
11832
|
+
* eligibility is `sentryEligible` (a BATTERY camera that DECLARES the signals
|
|
11833
|
+
* cap), asked of facts only the broker holds. A consumer re-deriving it from
|
|
11834
|
+
* cap bindings would be a second authority, and two authorities on the same
|
|
11835
|
+
* question is how a composite camera ends up dialling a sleeping camera
|
|
11836
|
+
* because its own copy of the rule was a release behind.
|
|
11837
|
+
*
|
|
11838
|
+
* `null` is a real answer and is never a live url in disguise: a consumer
|
|
11839
|
+
* that silently fell back to {@link url} would perform exactly the wake this
|
|
11840
|
+
* field exists to prevent. Only a PASSTHROUGH acquisition can offer one — a
|
|
11841
|
+
* transcode hands back an egress the broker is feeding itself, which has no
|
|
11842
|
+
* sentry counterpart.
|
|
11843
|
+
*/
|
|
11844
|
+
sentryUrl: string().nullable().optional(),
|
|
11827
11845
|
videoCodec: _enum(["H264", "H265"]),
|
|
11828
11846
|
audioCodec: string(),
|
|
11829
11847
|
resolution: object({
|
|
@@ -27166,6 +27184,114 @@ DeviceType.Light, DeviceType.Siren, DeviceType.Switch, method(object({
|
|
|
27166
27184
|
lastChangedAt: number()
|
|
27167
27185
|
});
|
|
27168
27186
|
/**
|
|
27187
|
+
* camera-grid-layout — the geometry of a COMPOSITE camera, on the camera's own
|
|
27188
|
+
* page.
|
|
27189
|
+
*
|
|
27190
|
+
* ## Why this is a capability and not an addon settings schema
|
|
27191
|
+
*
|
|
27192
|
+
* It was one, and it did not render. The addon declared the editor as a
|
|
27193
|
+
* `type: 'widget'` field inside its own `deviceSettingsSchema()`; the hub
|
|
27194
|
+
* returned that section correctly and `ConfigFormField` renders `type:'widget'`
|
|
27195
|
+
* perfectly well — and nothing ever asked camera-grid for it. The Cluster →
|
|
27196
|
+
* Pipeline → Device Overrides page interrogates a HAND-WRITTEN list of four
|
|
27197
|
+
* addons (`PIPELINE_CLUSTER_DEVICE_ADDONS`), whose own comment says an addon
|
|
27198
|
+
* not on it "falls off silently".
|
|
27199
|
+
*
|
|
27200
|
+
* Adding a fifth name to that list would have been the wrong fix twice over:
|
|
27201
|
+
* that page is per-camera DETECTION tuning, and a grid's geometry belongs
|
|
27202
|
+
* beside PTZ and motion zones on the camera itself — which is exactly where the
|
|
27203
|
+
* framework already puts a widget, when the widget is declared on a CAPABILITY.
|
|
27204
|
+
* `deviceConfig.ui` is the mechanism (`motion-zones`, `ptz`, `ptz-autotrack`
|
|
27205
|
+
* all use it): the framework emits the structural section and the widget
|
|
27206
|
+
* self-persists through the cap's own mutations.
|
|
27207
|
+
*
|
|
27208
|
+
* ## Why one addon may implement it
|
|
27209
|
+
*
|
|
27210
|
+
* It is a device-scoped NATIVE cap, registered by the grid camera device
|
|
27211
|
+
* itself. Nothing else declares a composite camera, so nothing else has a
|
|
27212
|
+
* layout — and the device-scoped route means the widget asks THE camera, not
|
|
27213
|
+
* "the camera-grid addon", which is what let the old custom-action pair be
|
|
27214
|
+
* reached only by a caller that already knew the addon id.
|
|
27215
|
+
*
|
|
27216
|
+
* ## The tab
|
|
27217
|
+
*
|
|
27218
|
+
* `streaming`, not a top-tab of its own. A grid's geometry IS what its stream
|
|
27219
|
+
* is, so the Streaming tab is where it belongs; a `grid` top-tab would need an
|
|
27220
|
+
* entry in `WELL_KNOWN_TAB_MAP` or the device page renders the raw id as the
|
|
27221
|
+
* label (measured on the robot camera, 2026-09-06 — a tab called "navigation"
|
|
27222
|
+
* next to "PTZ").
|
|
27223
|
+
*/
|
|
27224
|
+
/** A rectangle in normalized [0,1] coordinates of whatever contains it. */
|
|
27225
|
+
var GridNormalizedRectSchema = object({
|
|
27226
|
+
x: number().min(0).max(1),
|
|
27227
|
+
y: number().min(0).max(1),
|
|
27228
|
+
width: number().gt(0).max(1),
|
|
27229
|
+
height: number().gt(0).max(1)
|
|
27230
|
+
});
|
|
27231
|
+
/**
|
|
27232
|
+
* One source camera, the part of its picture taken, and where that part lands.
|
|
27233
|
+
*
|
|
27234
|
+
* Both rectangles are NORMALIZED (D519): a source camera can change resolution
|
|
27235
|
+
* — a profile switch, a firmware update, a substream that comes back different
|
|
27236
|
+
* — and a stored PIXEL rectangle would quietly start cutting the wrong region,
|
|
27237
|
+
* which is the class of bug nobody files.
|
|
27238
|
+
*/
|
|
27239
|
+
var GridLayoutCellSchema = object({
|
|
27240
|
+
deviceId: number().int().positive(),
|
|
27241
|
+
/** The part of the SOURCE taken, normalized against the source. */
|
|
27242
|
+
source: GridNormalizedRectSchema,
|
|
27243
|
+
/** Where it lands, normalized against the CANVAS. */
|
|
27244
|
+
cell: GridNormalizedRectSchema
|
|
27245
|
+
});
|
|
27246
|
+
/**
|
|
27247
|
+
* Which profiles this grid can actually compose, and why not.
|
|
27248
|
+
*
|
|
27249
|
+
* A grid's `high` composes its sources' `high` and its `low` their `low`, so a
|
|
27250
|
+
* profile is on offer only when EVERY source can serve it. The refusal NAMES
|
|
27251
|
+
* the sources, because "this grid has no low" is not a finding — "615 has no
|
|
27252
|
+
* low" is, and it is the one an operator can act on.
|
|
27253
|
+
*/
|
|
27254
|
+
var GridProfileOfferSchema = object({
|
|
27255
|
+
profile: _enum([
|
|
27256
|
+
"high",
|
|
27257
|
+
"mid",
|
|
27258
|
+
"low"
|
|
27259
|
+
]),
|
|
27260
|
+
offered: boolean(),
|
|
27261
|
+
/** Sources that cannot serve it. Empty when it is offered, or when there are no cells. */
|
|
27262
|
+
missingSources: array(number().int().positive())
|
|
27263
|
+
});
|
|
27264
|
+
var GridLayoutViewSchema = object({
|
|
27265
|
+
/** The persisted grid row this camera was declared from. */
|
|
27266
|
+
instanceId: string(),
|
|
27267
|
+
deviceId: number().int().nonnegative(),
|
|
27268
|
+
name: string(),
|
|
27269
|
+
/** The canvas the operator laid out — this grid's `high`. mid/low are scaled from it. */
|
|
27270
|
+
width: number().int(),
|
|
27271
|
+
height: number().int(),
|
|
27272
|
+
fps: number().int(),
|
|
27273
|
+
cells: array(GridLayoutCellSchema),
|
|
27274
|
+
/** What the catalog will publish, and what it refuses to. Read-only. */
|
|
27275
|
+
profiles: array(GridProfileOfferSchema)
|
|
27276
|
+
});
|
|
27277
|
+
var GridLayoutPatchSchema = object({
|
|
27278
|
+
deviceId: number().int().nonnegative(),
|
|
27279
|
+
name: string().min(1).max(160).optional(),
|
|
27280
|
+
width: number().int().min(160).max(7680).optional(),
|
|
27281
|
+
height: number().int().min(120).max(4320).optional(),
|
|
27282
|
+
fps: number().int().min(1).max(60).optional(),
|
|
27283
|
+
/**
|
|
27284
|
+
* The whole cell list at once. A per-cell patch would need an ordering the
|
|
27285
|
+
* editor does not have, and a half-applied layout is a picture nobody asked
|
|
27286
|
+
* for.
|
|
27287
|
+
*/
|
|
27288
|
+
cells: array(GridLayoutCellSchema).max(16)
|
|
27289
|
+
});
|
|
27290
|
+
DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), GridLayoutViewSchema.nullable(), { auth: "admin" }), method(GridLayoutPatchSchema, GridLayoutViewSchema, {
|
|
27291
|
+
kind: "mutation",
|
|
27292
|
+
auth: "admin"
|
|
27293
|
+
});
|
|
27294
|
+
/**
|
|
27169
27295
|
* Motion-zones share the same MaskShape vocabulary as privacy-mask — the
|
|
27170
27296
|
* on-camera motion-detection mask is a single `grid` region (a row-major
|
|
27171
27297
|
* boolean cell lattice the camera's onboard VMD evaluates). Composing it as
|
|
@@ -28865,6 +28991,26 @@ var PtzHomePresetSchema = object({
|
|
|
28865
28991
|
"none"
|
|
28866
28992
|
])
|
|
28867
28993
|
});
|
|
28994
|
+
/**
|
|
28995
|
+
* The camera's own idle-return behaviour: whether it goes home by itself, and
|
|
28996
|
+
* after how long.
|
|
28997
|
+
*
|
|
28998
|
+
* ONE shape, not two scalars, because on the camera they are ONE fact —
|
|
28999
|
+
* Reolink's guard point carries `benable` and `timeout` in the same element,
|
|
29000
|
+
* written by the same command. Reading them apart means two round-trips that
|
|
29001
|
+
* can disagree.
|
|
29002
|
+
*
|
|
29003
|
+
* `enabled` and `seconds` are INDEPENDENT: a camera can hold a 68 s delay with
|
|
29004
|
+
* the behaviour switched off, which is exactly what the vendor app leaves when
|
|
29005
|
+
* you turn the guard point off without clearing it. The first version of this
|
|
29006
|
+
* cap reported only the delay, so that state was invisible — a camera could be
|
|
29007
|
+
* configured to return after 68 seconds with no way to say whether it should
|
|
29008
|
+
* return at all.
|
|
29009
|
+
*/
|
|
29010
|
+
var PtzHomeReturnSchema = object({
|
|
29011
|
+
enabled: boolean(),
|
|
29012
|
+
seconds: number().int()
|
|
29013
|
+
});
|
|
28868
29014
|
DeviceType.Camera, method(PtzMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }), method(PtzMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), array(PtzPresetSchema)), method(object({
|
|
28869
29015
|
deviceId: number(),
|
|
28870
29016
|
presetId: string()
|
|
@@ -28890,8 +29036,9 @@ DeviceType.Camera, method(PtzMoveCommandSchema.extend({ deviceId: number() }), _
|
|
|
28890
29036
|
}), method(object({ deviceId: number() }), _void(), {
|
|
28891
29037
|
kind: "mutation",
|
|
28892
29038
|
auth: "admin"
|
|
28893
|
-
}), method(object({ deviceId: number() }),
|
|
29039
|
+
}), method(object({ deviceId: number() }), PtzHomeReturnSchema.nullable()), method(object({
|
|
28894
29040
|
deviceId: number(),
|
|
29041
|
+
enabled: boolean(),
|
|
28895
29042
|
seconds: number().int().min(0).max(3600)
|
|
28896
29043
|
}), _void(), {
|
|
28897
29044
|
kind: "mutation",
|
|
@@ -32173,6 +32320,18 @@ Object.freeze({
|
|
|
32173
32320
|
addonId: null,
|
|
32174
32321
|
access: "view"
|
|
32175
32322
|
},
|
|
32323
|
+
"cameraGridLayout.getLayout": {
|
|
32324
|
+
capName: "camera-grid-layout",
|
|
32325
|
+
capScope: "device",
|
|
32326
|
+
addonId: null,
|
|
32327
|
+
access: "view"
|
|
32328
|
+
},
|
|
32329
|
+
"cameraGridLayout.saveLayout": {
|
|
32330
|
+
capName: "camera-grid-layout",
|
|
32331
|
+
capScope: "device",
|
|
32332
|
+
addonId: null,
|
|
32333
|
+
access: "create"
|
|
32334
|
+
},
|
|
32176
32335
|
"cameraStreams.getBrokerStreams": {
|
|
32177
32336
|
capName: "camera-streams",
|
|
32178
32337
|
capScope: "device",
|
|
@@ -35923,7 +36082,7 @@ Object.freeze({
|
|
|
35923
36082
|
addonId: null,
|
|
35924
36083
|
access: "view"
|
|
35925
36084
|
},
|
|
35926
|
-
"ptz.
|
|
36085
|
+
"ptz.getHomeReturn": {
|
|
35927
36086
|
capName: "ptz",
|
|
35928
36087
|
capScope: "device",
|
|
35929
36088
|
addonId: null,
|
|
@@ -35983,7 +36142,7 @@ Object.freeze({
|
|
|
35983
36142
|
addonId: null,
|
|
35984
36143
|
access: "create"
|
|
35985
36144
|
},
|
|
35986
|
-
"ptz.
|
|
36145
|
+
"ptz.setHomeReturn": {
|
|
35987
36146
|
capName: "ptz",
|
|
35988
36147
|
capScope: "device",
|
|
35989
36148
|
addonId: null,
|
|
@@ -37872,6 +38031,21 @@ Object.freeze({
|
|
|
37872
38031
|
form: "single",
|
|
37873
38032
|
optional: false
|
|
37874
38033
|
}],
|
|
38034
|
+
"cameraGridLayout.getLayout": [{
|
|
38035
|
+
name: "deviceId",
|
|
38036
|
+
form: "single",
|
|
38037
|
+
optional: false
|
|
38038
|
+
}],
|
|
38039
|
+
"cameraGridLayout.saveLayout": [{
|
|
38040
|
+
name: "cells",
|
|
38041
|
+
form: "object-array",
|
|
38042
|
+
optional: false,
|
|
38043
|
+
itemField: "deviceId"
|
|
38044
|
+
}, {
|
|
38045
|
+
name: "deviceId",
|
|
38046
|
+
form: "single",
|
|
38047
|
+
optional: false
|
|
38048
|
+
}],
|
|
37875
38049
|
"cameraStreams.getBrokerStreams": [{
|
|
37876
38050
|
name: "deviceId",
|
|
37877
38051
|
form: "single",
|
|
@@ -39172,7 +39346,7 @@ Object.freeze({
|
|
|
39172
39346
|
form: "single",
|
|
39173
39347
|
optional: false
|
|
39174
39348
|
}],
|
|
39175
|
-
"ptz.
|
|
39349
|
+
"ptz.getHomeReturn": [{
|
|
39176
39350
|
name: "deviceId",
|
|
39177
39351
|
form: "single",
|
|
39178
39352
|
optional: false
|
|
@@ -39222,7 +39396,7 @@ Object.freeze({
|
|
|
39222
39396
|
form: "single",
|
|
39223
39397
|
optional: false
|
|
39224
39398
|
}],
|
|
39225
|
-
"ptz.
|
|
39399
|
+
"ptz.setHomeReturn": [{
|
|
39226
39400
|
name: "deviceId",
|
|
39227
39401
|
form: "single",
|
|
39228
39402
|
optional: false
|
|
@@ -40280,7 +40454,7 @@ var AdminUIAddon = class extends BaseAddon {
|
|
|
40280
40454
|
capability: adminUiCapability,
|
|
40281
40455
|
provider: {
|
|
40282
40456
|
getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
|
|
40283
|
-
getVersion: async () => ({ version: "1.2.
|
|
40457
|
+
getVersion: async () => ({ version: "1.2.215" })
|
|
40284
40458
|
}
|
|
40285
40459
|
}];
|
|
40286
40460
|
}
|
package/package.json
CHANGED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{I as e,K as t,Q as n,S as r,W as i,a,b as o,q as s,t as c,x as l,z as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{Z as d,_t as f,at as p,ct as m,gt as h,q as g,st as _}from"./player-overlays-C64C5sp1.js";import{At as v,Dl as y,El as b,Et as x,Ft as S,Gt as C,Hl as w,Ic as T,Il as E,It as D,Jc as O,Lt as k,Nt as A,Ot as j,Pt as M,Tt as N,Yt as P,Zr as F,_ as ee,_l as I,il as te,it as L,jt as ne,kt as R,nu as z,ol as B,qc as V,rl as H,rt as U,wt as W,yc as re,zl as G}from"./src-DvETVhyy.js";import{t as ie}from"./boxes-B7kNLelh.js";import{t as ae}from"./send-LQeZq7ZP.js";import{ut as K}from"./src-Bqn0Lh4Q.js";import{n as q}from"./index-BFpVtoWO.js";import{t as J}from"./AdminPage-CiKtOLQm.js";import{t as oe}from"./AdminTabs-BhF-e7Yr.js";var se=f(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]);n();var ce=[`llm`,`listProfiles`],le=[`llm`,`listProfileKinds`],ue=[`llm`,`getDefaults`],de=[`llm`,`listRuntimeNodes`],fe=[`llm`,`listModelCatalog`],pe=[`llm`,`getUsage`],me=[{purpose:`vision`,visionOnly:!0},{purpose:`text`,visionOnly:!1}],he=new Map(Object.entries({openai:w,anthropic:w,google:w,"openai-compatible":H,"managed-local":G}));function ge(e){return he.get(e)??null}function Y(e){return typeof e==`string`&&e.length>0?e:void 0}function X(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`&&e.trim()!==``){let t=Number(e);return Number.isFinite(t)?t:void 0}}function Z(e){return e===!0}function _e(e){return{model:e.model,baseUrl:e.baseUrl,apiKey:e.apiKey,supportsVision:e.supportsVision,temperature:e.temperature,topP:e.topP,topK:e.topK,maxTokens:e.maxTokens,contextLength:e.contextLength,systemPrompt:e.systemPrompt,timeoutMs:e.timeoutMs,connectTimeoutMs:e.connectTimeoutMs,firstTokenTimeoutMs:e.firstTokenTimeoutMs,idleTimeoutMs:e.idleTimeoutMs,retryEnabled:e.retry.enabled,retryMaxAttempts:e.retry.maxAttempts,toolsEnabled:e.toolsEnabled,contextSize:e.runtime?.contextSize,gpuLayers:e.runtime?.gpuLayers,threads:e.runtime?.threads,parallel:e.runtime?.parallel,idleStopMinutes:e.runtime?.idleStopMinutes,batchSize:e.runtime?.batchSize,ubatchSize:e.runtime?.ubatchSize,flashAttention:e.runtime?.flashAttention,mlock:e.runtime?.mlock,noMmap:e.runtime?.noMmap,cacheTypeK:e.runtime?.cacheTypeK,cacheTypeV:e.runtime?.cacheTypeV,extraArgs:xe(e.runtime?.extraArgs??[])}}var ve=[`f32`,`f16`,`q8_0`,`q5_1`,`q5_0`,`q4_1`,`q4_0`];function ye(e){return typeof e==`string`&&ve.includes(e)?e:void 0}function be(e){let t=[],n=``,r=null;for(let i of e){if(r!==null){i===r?r=null:n+=i;continue}if(i===`"`||i===`'`){r=i;continue}if(/\s/.test(i)){n!==``&&t.push(n),n=``;continue}n+=i}return n!==``&&t.push(n),t}function xe(e){return e.map(e=>/\s/.test(e)?`"${e}"`:e).join(` `)}var Se=[`--jinja`,`--cont-batching`];function Ce(e,t,n){let r=X(e.threads),i=X(e.batchSize),a=X(e.ubatchSize),o=ye(e.cacheTypeK),s=ye(e.cacheTypeV);return{nodeId:t,engine:`llama-cpp`,model:n,extraArgs:[...be(Y(e.extraArgs)??``)],contextSize:X(e.contextSize)??4096,gpuLayers:X(e.gpuLayers)??0,...r===void 0?{}:{threads:r},parallel:X(e.parallel)??1,...i===void 0?{}:{batchSize:i},...a===void 0?{}:{ubatchSize:a},flashAttention:Z(e.flashAttention),mlock:Z(e.mlock),noMmap:Z(e.noMmap),...o===void 0?{}:{cacheTypeK:o},...s===void 0?{}:{cacheTypeV:s},autoStart:Z(e.autoStart),idleStopMinutes:X(e.idleStopMinutes)??30}}function we(e,t,n,r,i){let a={id:n?.id??crypto.randomUUID(),name:t,kind:e,addonId:`ai`,enabled:n?.enabled??!0,model:Y(r.model)??n?.model??``,supportsVision:i?.supportsVision??Z(r.supportsVision),timeoutMs:X(r.timeoutMs)??K.totalMs,connectTimeoutMs:X(r.connectTimeoutMs)??K.connectMs,firstTokenTimeoutMs:X(r.firstTokenTimeoutMs)??K.firstTokenMs,idleTimeoutMs:X(r.idleTimeoutMs)??K.idleMs,retry:{enabled:Z(r.retryEnabled),maxAttempts:X(r.retryMaxAttempts)??1},toolsEnabled:Z(r.toolsEnabled)},o=Y(r.baseUrl),s=Y(r.apiKey),c=X(r.temperature),l=X(r.topP),u=X(r.topK),d=X(r.maxTokens),f=X(r.contextLength),p=Y(r.systemPrompt);return{...a,...o===void 0?{}:{baseUrl:o},...s===void 0?{}:{apiKey:s},...c===void 0?{}:{temperature:c},...l===void 0?{}:{topP:l},...u===void 0?{}:{topK:u},...d===void 0?{}:{maxTokens:d},...f===void 0?{}:{contextLength:f},...p===void 0?{}:{systemPrompt:p},...i===void 0?{}:{model:i.modelId,runtime:Ce(r,i.nodeId,i.model)}}}function Te(e){let t=new Map;for(let n of e){let e=t.get(n.addonId)??[];e.push(n),t.set(n.addonId,e)}return[...t.entries()].map(([e,t])=>({addonId:e,kinds:t}))}var Ee=2e3;function Q(e){return`${(e/1e9).toFixed(2)} GB`}function De(e){return e===null?``:e.model.kind===`catalog`?`catalog:${e.model.catalogId}`:e.model.kind===`path`?`node:${e.modelId}`:`custom`}function Oe({nodeId:e,value:t,onChange:n}){let{t:o}=q(),u=p(),[d,f]=s(``),[m,h]=s(null),[g,_]=s(!1),v=a({queryKey:fe,queryFn:()=>u.trpcClient.llm.listModelCatalog.query({})}),y=a({queryKey:[`llm`,`listNodeModels`,e],queryFn:()=>u.trpcClient.llm.listNodeModels.query({nodeId:e})}),b=c({mutationFn:e=>u.trpcClient.llm.resolveModelRef.mutate(e),onSuccess:e=>{h(e),_(!1),e.ok&&n({model:e.model,modelId:e.label,supportsVision:e.purpose===`vision`})}}),x=c({mutationFn:t=>u.trpcClient.llm.installModel.mutate({nodeId:e,model:t}),onSuccess:()=>{_(!0),y.refetch()}}),S=a({queryKey:de,enabled:x.isPending,refetchInterval:x.isPending?Ee:!1,queryFn:()=>u.trpcClient.llm.listRuntimeNodes.query({})}).data?.find(t=>t.nodeId===e)?.status?.download,C=i(()=>{let t=(v.data??[]).map(e=>({value:`catalog:${e.id}`,label:`${e.label} · ${e.quantization} · ${Q(e.sizeBytes)}`})),n=(y.data??[]).filter(e=>e.catalogId===void 0&&e.path!==void 0).map(t=>({value:`node:${t.file}`,label:o(`ai.onNode`,`{{file}} · {{size}} · on {{node}}`,{file:t.file,size:Q(t.sizeBytes),node:e})})),r=m?.ok===!0?[{value:`custom`,label:`${m.label} · ${Q(m.totalBytes)}`}]:[];return[{value:``,label:o(`ai.selectModel`,`Select a model…`)},...t,...n,...r]},[v.data,y.data,m,e,o]),w=e=>{if(e===``){n(null);return}if(e===`custom`){if(m?.ok!==!0)return;n({model:m.model,modelId:m.label,supportsVision:m.purpose===`vision`});return}if(e.startsWith(`catalog:`)){let t=e.slice(8),r=v.data?.find(e=>e.id===t);n({model:{kind:`catalog`,catalogId:t},modelId:t,supportsVision:r?.purpose===`vision`});return}let t=e.slice(5),r=y.data?.find(e=>e.file===t);r?.path!==void 0&&n({model:{kind:`path`,path:r.path},modelId:t,supportsVision:!1})},T=e=>{d.trim()!==``&&b.mutate({ref:d.trim(),...e===void 0?{}:{maxBytes:e}})};return r(`div`,{className:`space-y-2`,children:[r(`div`,{children:[l(`label`,{className:`mb-1 block text-[11px] font-medium text-foreground`,htmlFor:`ai-model`,children:o(`ai.model`,`Model`)}),l(A,{id:`ai-model`,value:De(t),options:C,onChange:e=>w(e.target.value)})]}),r(`div`,{className:`rounded-md border border-border bg-surface-subtle px-3 py-2.5`,children:[l(`div`,{className:`mb-1 text-[11px] font-medium text-foreground`,children:o(`ai.hfTitle`,`Add a model from Hugging Face`)}),l(`p`,{className:`mb-2 text-[10px] leading-relaxed text-foreground-subtle`,children:o(`ai.hfHint`,`Paste a GGUF file URL, or type org/repo — add :QUANT (e.g. unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_M) when the repo publishes more than one quantization.`)}),r(`div`,{className:`flex gap-2`,children:[l(M,{value:d,onChange:e=>f(e.target.value),placeholder:`unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_M`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),T())}}),r(k,{size:`sm`,variant:`secondary`,type:`button`,disabled:d.trim()===``||b.isPending,onClick:()=>T(),children:[b.isPending?l(I,{className:`h-3.5 w-3.5 animate-spin`}):l(O,{className:`h-3.5 w-3.5`}),o(`ai.hfCheck`,`Check`)]})]}),b.isError&&l(`p`,{className:`mt-2 text-[11px] text-danger`,children:b.error instanceof Error?b.error.message:o(`common.error`,`Error`)}),m?.ok===!1&&r(`div`,{className:`mt-2 rounded-md border border-danger/40 bg-danger/10 px-2.5 py-2`,children:[l(`p`,{className:`text-[11px] text-danger`,children:m.message}),m.candidates!==void 0&&m.candidates.length>0&&l(`div`,{className:`mt-1.5 flex flex-wrap gap-1`,children:m.candidates.map(e=>l(`button`,{type:`button`,className:`rounded border border-border bg-surface px-1.5 py-0.5 text-[10px] text-foreground hover:border-primary/50`,onClick:()=>{let t=`${d.trim().split(`:`)[0]??``}:${e}`;f(t),b.mutate({ref:t})},children:e},e))}),m.requiredBytes!==void 0&&l(k,{size:`sm`,variant:`secondary`,type:`button`,className:`mt-2`,onClick:()=>T(m.requiredBytes),children:o(`ai.hfOverride`,`Install anyway ({{size}})`,{size:Q(m.requiredBytes)})})]}),m?.ok===!0&&r(`div`,{className:`mt-2 rounded-md border border-border bg-surface px-2.5 py-2`,children:[r(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[l(`span`,{className:`text-[11px] font-medium text-foreground`,children:m.label}),l(D,{variant:m.purpose===`vision`?`info`:`default`,children:m.purpose}),l(D,{variant:`default`,children:Q(m.totalBytes)})]}),m.extraFilenames.length>0&&l(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:o(`ai.hfExtras`,`Also downloads: {{files}}`,{files:m.extraFilenames.join(`, `)})}),r(`div`,{className:`mt-2 flex items-center gap-2`,children:[r(k,{size:`sm`,type:`button`,disabled:x.isPending||g,onClick:()=>x.mutate(m.model),children:[x.isPending?l(I,{className:`h-3.5 w-3.5 animate-spin`}):l(E,{className:`h-3.5 w-3.5`}),g?o(`ai.hfInstalled`,`Downloaded`):o(`ai.hfInstall`,`Download to {{node}}`,{node:e})]}),S!==void 0&&l(`span`,{className:`text-[10px] text-foreground-subtle`,children:S.phase===`verifying`?o(`ai.hfVerifying`,`verifying {{file}}…`,{file:S.file}):o(`ai.hfDownloading`,`{{file}} ({{index}}/{{count}}) — {{done}}{{total}}`,{file:S.file,index:S.fileIndex,count:S.fileCount,done:Q(S.downloadedBytes),total:S.totalBytes===void 0?``:` / ${Q(S.totalBytes)}`})})]}),x.isError&&l(`p`,{className:`mt-1.5 text-[11px] text-danger`,children:x.error instanceof Error?x.error.message:o(`common.error`,`Error`)})]})]})]})}n();function ke({kind:e,className:t}){let n=ge(e.kind);return n===null?l(`span`,{className:t,children:e.icon}):l(n,{className:t})}function Ae({kinds:e,onPick:t,onCancel:n}){let{t:a}=q(),o=i(()=>Te(e),[e]);return l(W,{open:!0,onOpenChange:e=>!e&&n(),children:r(x,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[l(R,{children:l(v,{children:a(`ai.chooseKind`,`Choose a profile type`)})}),r(N,{className:`space-y-4 pr-1`,children:[o.length===0&&l(`p`,{className:`text-xs text-foreground-subtle`,children:a(`ai.noKinds`,`No AI provider is installed.`)}),o.map(e=>r(`div`,{children:[l(`div`,{className:`mb-1.5 text-[10px] font-semibold uppercase tracking-wider text-foreground-subtle`,children:e.addonId}),l(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:e.kinds.map(n=>r(`button`,{type:`button`,onClick:()=>t(n),className:`flex flex-col items-center gap-1.5 rounded-lg border border-border bg-surface px-3 py-3 text-xs transition-colors hover:border-primary/50 hover:bg-surface-hover`,children:[l(ke,{kind:n,className:`h-5 w-5 text-foreground-subtle`}),l(`span`,{className:`font-medium text-foreground`,children:n.label})]},`${e.addonId}:${n.kind}`))})]},e.addonId))]}),l(j,{children:l(k,{size:`sm`,variant:`secondary`,type:`button`,onClick:n,children:a(`common.cancel`,`Cancel`)})})]})})}function je({kind:e,existing:t,onSave:n,onCancel:a,saving:c,error:u}){let{t:d}=q(),f=e.kind===`managed-local`,[p,m]=s(t?.name??e.label),[h,g]=s(()=>t===null?{}:_e(t)),[_,y]=s(t?.runtime?.nodeId??`hub`),[b,S]=s(()=>t?.runtime===void 0?null:{model:t.runtime.model,modelId:t.model,supportsVision:t.supportsVision}),w=i(()=>be(Y(h.extraArgs)??``),[h.extraArgs]),T=()=>{if(!f){n(we(e.kind,p,t,h));return}b!==null&&n(we(e.kind,p,t,h,{nodeId:_,model:b.model,modelId:b.modelId,supportsVision:b.supportsVision}))},E=c||p.trim()===``||f&&b===null;return l(W,{open:!0,onOpenChange:e=>!e&&a(),children:r(x,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[l(R,{children:r(v,{className:`flex items-center gap-2`,children:[l(ke,{kind:e,className:`h-4 w-4 text-foreground-subtle`}),t===null?d(`ai.newProfile`,`New {{kind}} profile`,{kind:e.label}):d(`ai.editProfile`,`Edit {{name}}`,{name:t.name})]})}),r(N,{className:`space-y-3 pr-1`,children:[u!==null&&l(`div`,{className:`rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-xs text-danger`,children:u}),r(`div`,{children:[l(`label`,{className:`mb-1 block text-[11px] font-medium text-foreground`,htmlFor:`ai-profile-name`,children:d(`ai.name`,`Name`)}),l(M,{id:`ai-profile-name`,value:p,onChange:e=>m(e.target.value),placeholder:e.label})]}),f&&r(o,{children:[l(ee,{selectedNodeId:_,onSelect:y,label:d(`ai.runtimeNode`,`Runtime node`),alwaysShow:!0}),l(Oe,{nodeId:_,value:b,onChange:S}),r(`div`,{children:[l(`label`,{className:`mb-1 block text-[11px] font-medium text-foreground`,htmlFor:`ai-extra-args`,children:d(`ai.extraArgs`,`Additional llama-server arguments`)}),l(M,{id:`ai-extra-args`,value:Y(h.extraArgs)??``,onChange:e=>g({...h,extraArgs:e.target.value}),placeholder:Se.join(` `)}),w.length>0&&l(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:w.map((e,t)=>l(D,{variant:`default`,children:e},`${e}-${String(t)}`))}),l(`p`,{className:`mt-1 text-[10px] leading-relaxed text-foreground-subtle`,children:d(`ai.extraArgsHint`,`Flags this form does not already own. Vision models generally need --jinja; some language-only models do not like it. Context size, GPU layers, parallel slots, flash attention and the KV-cache types are set in the fields below — repeating one here is rejected at start.`)})]})]}),l(C,{schema:e.configSchema,values:h,onChange:g}),t!==null&&l(`p`,{className:`text-[10px] text-foreground-subtle`,children:d(`ai.secretHint`,`A stored API key is never shown. Leave it as-is to keep it; type a new value to replace it.`)})]}),r(j,{children:[f&&b===null&&l(D,{variant:`warning`,children:d(`ai.pickModelFirst`,`pick a model`)}),l(k,{size:`sm`,variant:`secondary`,type:`button`,onClick:a,children:d(`common.cancel`,`Cancel`)}),r(k,{size:`sm`,type:`button`,disabled:E,onClick:T,children:[c&&l(I,{className:`h-3.5 w-3.5 animate-spin`}),t===null?d(`ai.createProfile`,`Create profile`):d(`ai.saveChanges`,`Save changes`)]})]})]})})}n();function Me(e){return[{key:`name`,header:e.t(`ai.colProfile`,`Profile`),render:t=>{let n=e.kindByName.get(t.kind);return r(`span`,{className:`flex items-center gap-2`,children:[l(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface`,title:n?.label??t.kind,children:n===void 0?l(`span`,{className:`text-xs text-foreground-subtle`,children:`?`}):l(ke,{kind:n,className:`h-4 w-4 text-foreground-subtle`})}),r(`span`,{className:`min-w-0`,children:[l(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:t.name}),e.testResult?.id===t.id&&l(`span`,{className:`block truncate text-[10px] ${e.testResult.ok?`text-success`:`text-danger`}`,children:e.testResult.text})]})]})}},{key:`kind`,header:e.t(`ai.colKind`,`Kind`),nowrap:!0,render:t=>l(`span`,{className:`text-[11px] text-foreground-subtle`,children:e.kindByName.get(t.kind)?.label??t.kind})},{key:`model`,header:e.t(`ai.colModel`,`Model`),render:e=>l(`span`,{className:`text-[11px] text-foreground`,children:e.model})},{key:`vision`,header:e.t(`ai.colVision`,`Vision`),align:`center`,nowrap:!0,render:t=>t.supportsVision?l(D,{variant:`info`,style:`outline`,children:e.t(`ai.vision`,`vision`)}):l(`span`,{className:`text-[11px] text-foreground-subtle`,children:`—`})},{key:`node`,header:e.t(`ai.colNode`,`Node`),nowrap:!0,render:e=>e.runtime===void 0?l(`span`,{className:`text-[11px] text-foreground-subtle`,children:`—`}):l(D,{variant:`default`,children:e.runtime.nodeId})},{key:`enabled`,header:e.t(`ai.colOn`,`On`),align:`center`,nowrap:!0,render:t=>l(ne,{checked:t.enabled,onCheckedChange:()=>e.onToggle(t),"aria-label":`toggle ${t.name}`})},{key:`actions`,header:``,align:`right`,nowrap:!0,render:t=>r(`span`,{className:`flex items-center justify-end gap-1`,children:[l(k,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>e.onTest(t),title:e.t(`ai.test`,`Test`),children:e.testingId===t.id?l(I,{className:`h-3.5 w-3.5 animate-spin`}):l(ae,{className:`h-3.5 w-3.5`})}),l(k,{size:`sm`,variant:`ghost`,type:`button`,disabled:!e.kindByName.has(t.kind),onClick:()=>e.onEdit(t),title:e.t(`common.edit`,`Edit`),children:l(B,{className:`h-3.5 w-3.5`})}),l(k,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>e.onDelete(t),title:e.t(`common.delete`,`Delete`),children:l(_,{className:`h-3.5 w-3.5 text-danger`})})]})}]}function Ne(){let{t:e}=q(),t=p(),[n,o]=s({mode:`closed`}),[u,d]=s(null),[f,m]=s(null),h=a({queryKey:ce,queryFn:()=>t.trpcClient.llm.listProfiles.query({})}),g=a({queryKey:le,queryFn:async()=>(await t.trpcClient.llm.listProfileKinds.query({})).map(e=>({...e,configSchema:e.configSchema}))}),_=()=>{h.refetch()},v=c({mutationFn:e=>t.trpcClient.llm.upsertProfile.mutate({profile:e}),onSuccess:()=>{o({mode:`closed`}),m(null),_()},onError:t=>m(t instanceof Error?t.message:e(`ai.saveFailed`,`Save failed`))}),y=c({mutationFn:e=>t.trpcClient.llm.deleteProfile.mutate({addonId:e.addonId,profileId:e.id}),onSuccess:_}),b=c({mutationFn:e=>t.trpcClient.llm.testProfile.mutate({addonId:e.addonId,profileId:e.id}),onSuccess:(e,t)=>d({id:t.id,ok:e.ok,text:e.ok?`${e.text} (${String(e.usage.outputTokens)} tok, ${String(e.latencyMs)}ms)`:`${e.code}: ${e.message}`})}),x=h.data??[],C=i(()=>g.data??[],[g.data]),w=i(()=>{let e=new Map;for(let t of C)e.set(t.kind,t);return e},[C]);return r(J,{icon:T,title:e(`ai.profilesTitle`,`AI profiles`),subtitle:e(`ai.profilesSubtitle`,`One row = one usable model endpoint. The defaults below decide who answers when a feature names no profile.`),actions:r(k,{size:`sm`,type:`button`,onClick:()=>{m(null),o({mode:`pick-kind`})},children:[l(te,{className:`h-3.5 w-3.5`}),e(`ai.addProfile`,`Add profile`)]}),children:[h.isError&&l(P,{title:e(`ai.loadFailed`,`Failed to load profiles`),message:h.error instanceof Error?h.error.message:e(`common.error`,`Error`),onRetry:()=>void h.refetch()}),l(Pe,{profiles:x}),h.isLoading&&l(`div`,{className:`flex items-center justify-center py-16`,children:l(I,{className:`h-6 w-6 animate-spin text-primary`})}),!h.isLoading&&x.length===0&&l(`div`,{className:`py-16 text-center text-xs text-foreground-subtle`,children:e(`ai.noProfiles`,`No AI profiles yet. Click "Add profile" to configure one.`)}),x.length>0&&l(S,{children:l(U,{columns:Me({kindByName:w,testResult:u,testingId:b.isPending?b.variables?.id??null:null,t:e,onToggle:e=>v.mutate({...e,enabled:!e.enabled,apiKey:`__redacted__`}),onTest:e=>b.mutate(e),onEdit:e=>{let t=w.get(e.kind);t!==void 0&&(m(null),o({mode:`form`,kind:t,profile:e}))},onDelete:e=>y.mutate(e)}),rows:x,rowKey:e=>e.id,minWidthPx:760,bordered:!1,mobileMode:`scroll`,maxBodyHeight:`max-h-[60vh]`})}),n.mode===`pick-kind`&&l(Ae,{kinds:C,onCancel:()=>o({mode:`closed`}),onPick:e=>o({mode:`form`,kind:e,profile:null})}),n.mode===`form`&&l(je,{kind:n.kind,existing:n.profile,saving:v.isPending,error:f,onSave:e=>v.mutate(e),onCancel:()=>o({mode:`closed`})})]})}function Pe({profiles:e}){let{t}=q(),n=p(),i=a({queryKey:ue,queryFn:()=>n.trpcClient.llm.getDefaults.query({})}),o=c({mutationFn:e=>n.trpcClient.llm.setDefault.mutate({selector:{purpose:e.purpose},profileId:e.profileId}),onSuccess:()=>{i.refetch()}}),s=e=>(i.data??[]).find(t=>`purpose`in t.selector&&t.selector.purpose===e)?.profileId??``,u=e=>e===`vision`?t(`ai.defaultVision`,`Default vision profile`):t(`ai.defaultText`,`Default text profile`);return l(S,{children:l(`div`,{className:`grid gap-4 p-4 sm:grid-cols-2`,children:me.map(({purpose:n,visionOnly:i})=>{let a=i?e.filter(e=>e.supportsVision):e,c=s(n),d=e.find(e=>e.id===c);return r(`div`,{children:[l(`label`,{className:`mb-1 block text-[11px] font-medium text-foreground`,htmlFor:`llm-default-${n}`,children:u(n)}),r(`select`,{id:`llm-default-${n}`,"aria-label":u(n),className:`h-7 w-full rounded-md border border-border bg-surface px-2.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`,value:c,onChange:e=>o.mutate({purpose:n,profileId:e.target.value===``?null:e.target.value}),children:[l(`option`,{value:``,children:t(`ai.none`,`None`)}),c!==``&&!a.some(e=>e.id===c)&&l(`option`,{value:c,children:d?.name??c}),a.map(e=>r(`option`,{value:e.id,children:[e.name,` · `,e.model]},e.id))]}),c!==``&&d===void 0&&l(`p`,{className:`mt-1 text-[10px] text-danger`,children:t(`ai.defaultMissing`,`This default names a profile that no longer exists.`)}),d!==void 0&&!d.enabled&&l(`p`,{className:`mt-1 text-[10px] text-warning`,children:t(`ai.defaultDisabled`,`This default profile is disabled — callers resolve to no profile.`)}),o.error!=null&&l(`p`,{className:`mt-1 text-[10px] text-danger`,children:String(o.error)})]},n)})})})}n();var Fe=5e3;function Ie(e){return`${(e/1e9).toFixed(1)} GB`}function Le(){let{t:e}=q(),t=p(),n=a({queryKey:de,refetchInterval:Fe,queryFn:()=>t.trpcClient.llm.listRuntimeNodes.query({})}),o=i(()=>[{key:`node`,header:e(`ai.colNode`,`Node`),render:e=>l(`span`,{className:`text-sm font-medium text-foreground`,children:e.nodeId})},{key:`state`,header:e(`ai.colState`,`State`),nowrap:!0,render:t=>r(`span`,{className:`flex items-center gap-1.5`,children:[l(D,{variant:t.reachable?`success`:`danger`,children:t.reachable?t.status?.state??e(`ai.ready`,`ready`):e(`ai.unreachable`,`unreachable`)}),t.status?.downloadProgress!==void 0&&l(D,{variant:`info`,children:`${String(Math.round(t.status.downloadProgress*100))}%`})]})},{key:`model`,header:e(`ai.colModel`,`Model`),render:e=>l(`span`,{className:`text-[11px] text-foreground`,children:e.status?.modelId??`—`})},{key:`disk`,header:e(`ai.colDisk`,`On disk`),align:`right`,nowrap:!0,render:e=>l(`span`,{className:`text-[11px] text-foreground-subtle`,children:e.disk===void 0?`—`:Ie(e.disk.modelsBytes)})},{key:`error`,header:e(`ai.colError`,`Error`),render:e=>e.error===void 0?l(`span`,{className:`text-[11px] text-foreground-subtle`,children:`—`}):l(`span`,{className:`text-[11px] text-danger`,children:e.error})}],[e]),s=n.data??[];return r(J,{icon:V,title:e(`ai.runtimesTitle`,`Managed runtimes`),subtitle:e(`ai.runtimesSubtitle`,`Nodes advertising the llm-runtime capability: what each has loaded, what it is downloading, and how much model data sits on its disk.`),children:[n.isError&&l(P,{title:e(`ai.runtimesFailed`,`Failed to read runtime nodes`),message:n.error instanceof Error?n.error.message:e(`common.error`,`Error`),onRetry:()=>void n.refetch()}),s.length===0?l(`div`,{className:`py-16 text-center text-xs text-foreground-subtle`,children:e(`ai.noRuntimes`,`No node advertises the llm-runtime capability.`)}):l(S,{children:l(U,{columns:o,rows:s,rowKey:e=>e.nodeId,minWidthPx:640,bordered:!1,mobileMode:`scroll`,maxBodyHeight:L})})]})}var Re=d(`/addon/ai/test-chat`),ze=d(`/addon/ai/test-chat/chats`),Be=6e5;function Ve(e){let t=e.firstTokenTimeoutMs;if(!(typeof t!=`number`||!Number.isFinite(t)||t<=0))return Math.min(Math.round(t),Be)}function He(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ue(e){if(!He(e))return null;let t=e.kind;return t!==`snapshot`&&t!==`track`||typeof e.mimeType!=`string`||typeof e.sizeBytes!=`number`?null:{kind:t,mimeType:e.mimeType,sizeBytes:e.sizeBytes,...typeof e.mediaKind==`string`?{mediaKind:e.mediaKind}:{},...typeof e.capturedAt==`number`?{capturedAt:e.capturedAt}:{},...typeof e.thumbnailBase64==`string`?{thumbnailBase64:e.thumbnailBase64}:{}}}var We=[`resolving-image`,`connecting`,`first-token-wait`,`streaming`];function Ge(e){let t;try{t=JSON.parse(e)}catch{return null}if(!He(t))return null;switch(t.kind){case`status`:{let e=We.find(e=>e===t.phase);return e===void 0?null:{kind:`status`,phase:e}}case`meta`:return typeof t.profileName!=`string`||typeof t.model!=`string`?null:{kind:`meta`,profileName:t.profileName,model:t.model,mediaSent:Ue(t.mediaSent),streamed:t.streamed===!0,firstTokenTimeoutMs:typeof t.firstTokenTimeoutMs==`number`?t.firstTokenTimeoutMs:0};case`token`:return typeof t.text==`string`?{kind:`token`,text:t.text}:null;case`done`:return{kind:`done`,inputTokens:typeof t.inputTokens==`number`?t.inputTokens:0,outputTokens:typeof t.outputTokens==`number`?t.outputTokens:0,latencyMs:typeof t.latencyMs==`number`?t.latencyMs:0,truncated:t.truncated===!0,...typeof t.conversationId==`string`?{conversationId:t.conversationId}:{}};case`error`:return{kind:`error`,code:typeof t.code==`string`?t.code:`adapter-error`,message:typeof t.message==`string`?t.message:`the provider returned an error`};default:return null}}async function*Ke(e){let t=e.getReader(),n=new TextDecoder,r=``;try{for(;;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.indexOf(`
|
|
2
|
-
`);for(;a>=0;){let e=r.slice(0,a).trim();if(r=r.slice(a+1),e.length>0){let t=Ge(e);t!==null&&(yield t)}a=r.indexOf(`
|
|
3
|
-
`)}}let e=r.trim();if(e.length>0){let t=Ge(e);t!==null&&(yield t)}}finally{t.releaseLock()}}function qe(e){return e.filter(e=>e.failed!==!0&&e.content.length>0).map(e=>({role:e.role,content:e.content}))}function Je(e){return e.thumbnailBase64===void 0||e.thumbnailBase64.length===0?null:`data:${e.mimeType};base64,${e.thumbnailBase64}`}function Ye(e){return e.messages.map((t,n)=>{let r=t.mediaSent??void 0;return{id:`${e.id}-${String(n)}`,role:t.role,content:t.content,...t.attachment===void 0?{}:{attachmentRef:t.attachment,attachmentKind:t.attachment.kind},...r===void 0?{}:{attachment:r}}})}function Xe(e){let t=e.sizeBytes<1024*1024?`${(e.sizeBytes/1024).toFixed(0)} KB`:`${(e.sizeBytes/(1024*1024)).toFixed(1)} MB`,n=[e.kind===`snapshot`?`camera snapshot`:`track best-shot`,t];return e.mediaKind!==void 0&&n.push(e.mediaKind),e.capturedAt!==void 0&&n.push(new Date(e.capturedAt).toLocaleTimeString()),n.join(` · `)}function Ze(e,t){switch(e){case`resolving-image`:return`fetching the picture…`;case`connecting`:return`connecting to the provider…`;case`first-token-wait`:return t>0?`the model is loading / thinking — a cold load can take minutes (up to ${String(Math.round(t/1e3))}s)`:`the model is loading / thinking — a cold load can take minutes`;case`streaming`:return`answering…`}}n();var Qe=[`pipelineAnalytics`,`listRecentTracks`,`ai-test`],$e=360*60*1e3,et=40,tt=160,$={phase:`connecting`,firstTokenTimeoutMs:0,text:``,mediaSent:null};function nt(){let{t:n}=q(),o=p(),[c,d]=s(``),[f,g]=s(``),[v,b]=s(``),[x,C]=s([]),[w,T]=s(null),[E,D]=s(`none`),[O,j]=s(`throwaway`),[N,F]=s(null),[ee,I]=s([]),[te,L]=s(null),[ne,R]=s(null),B=t(null);u(()=>()=>B.current?.abort(),[]);let V=e(async()=>{let e=await fetch(ze,{credentials:`same-origin`});e.ok&&I((await e.json()).chats??[])},[]);u(()=>{O===`persistent`&&V()},[O,V]);let H=a({queryKey:ce,queryFn:()=>o.trpcClient.llm.listProfiles.query({})}),U=i(()=>(H.data??[]).filter(e=>e.enabled),[H.data]),W=U.find(e=>e.id===c)??null,G=ne!==null,ie=e(async(e,t)=>{let r=new AbortController;B.current=r,L(null);let i=Ve(W??{});R({...$,firstTokenTimeoutMs:i??0});let a=``,o=null,s,l=null,u=null,d;try{let n=await fetch(Re,{method:`POST`,headers:{"content-type":`application/json`},credentials:`same-origin`,signal:r.signal,body:JSON.stringify({profileId:c,messages:e,...f.trim()===``?{}:{system:f.trim()},...t===void 0?{}:{attachment:t},...i===void 0?{}:{firstTokenTimeoutMs:i},...O===`persistent`?{persist:!0,...N===null?{}:{conversationId:N}}:{}})});if(!n.ok||n.body===null){let e=await n.text().catch(()=>``);throw Error(e.length>0?e:`HTTP ${String(n.status)}`)}for await(let e of Ke(n.body))switch(e.kind){case`status`:R(t=>({...t??$,phase:e.phase}));break;case`meta`:o=e.mediaSent,s=e.model,R(t=>({...t??$,firstTokenTimeoutMs:e.firstTokenTimeoutMs,mediaSent:e.mediaSent}));break;case`token`:a+=e.text,R(e=>({...e??$,text:a}));break;case`done`:u={outputTokens:e.outputTokens,latencyMs:e.latencyMs},d=e.conversationId;break;case`error`:l=`${e.code}: ${e.message}`;break}}catch(e){r.signal.aborted||L(e instanceof Error?e.message:n(`common.error`,`Error`))}finally{B.current=null,R(null)}d!==void 0&&(F(d),V());let p=r.signal.aborted&&a.length>0;l===null&&a.length===0&&!p||C(e=>[...e,{id:`a-${String(Date.now())}`,role:`assistant`,content:l??a,...l===null?{}:{failed:!0},...o===null?{}:{attachment:o},...s!==void 0&&l===null?{model:s}:{},...u===null?{}:u}])},[O,N,W,c,V,f,n]),K=e(()=>{let e=v.trim();if(e===``||c===``||G)return;let t={id:`u-${String(Date.now())}`,role:`user`,content:e,...w===null?{}:{attachmentLabel:w.label,attachmentKind:w.ref.kind}},n=[...x,t];C(n),b(``);let r=w?.ref;T(null),D(`none`),ie(O===`persistent`&&N!==null?[{role:`user`,content:e}]:qe(n),r)},[O,N,v,w,c,ie,G,x]),oe=()=>B.current?.abort(),le=()=>{B.current?.abort(),C([]),T(null),b(``),L(null),R(null),F(null)},ue=async e=>{B.current?.abort();let t=await fetch(`${ze}/${e}`,{credentials:`same-origin`});if(!t.ok)return;let n=await t.json();F(e),C(Ye(n)),R(null),L(null)};return r(J,{icon:y,title:n(`ai.testTitle`,`Test chat`),subtitle:n(O===`persistent`?`ai.testSubtitlePersistent`:`ai.testSubtitle`,O===`persistent`?`Conversations are saved for you and can be reopened. Throwaway mode is still available.`:`A throwaway conversation with one profile. Attach a live camera snapshot or a recent track to check the model can actually read a picture. Nothing is saved — only the usage row.`),actions:r(k,{size:`sm`,variant:`secondary`,type:`button`,disabled:x.length===0&&w===null,onClick:le,children:[l(_,{className:`h-3.5 w-3.5`}),n(`ai.clearChat`,`Clear`)]}),children:[r(S,{className:`space-y-3 p-4`,children:[r(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[r(`div`,{children:[l(`label`,{className:`mb-1 block text-[11px] font-medium text-foreground`,htmlFor:`ai-test-profile`,children:n(`ai.profile`,`Profile`)}),l(A,{id:`ai-test-profile`,value:c,onChange:e=>d(e.target.value),options:[{value:``,label:n(`ai.selectProfile`,`Select a profile…`)},...U.map(e=>({value:e.id,label:`${e.name} · ${e.model}${e.supportsVision?` · vision`:``}`}))]}),U.length===0&&!H.isLoading&&l(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:n(`ai.noEnabledProfiles`,`No enabled profile. Add one on the Profiles tab.`)})]}),r(`div`,{children:[l(`label`,{className:`mb-1 block text-[11px] font-medium text-foreground`,htmlFor:`ai-test-system`,children:n(`ai.systemPrompt`,`System prompt (optional)`)}),l(M,{id:`ai-test-system`,value:f,onChange:e=>g(e.target.value),placeholder:n(`ai.systemPlaceholder`,`Answer in one short sentence.`)})]})]}),r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[l(k,{size:`sm`,variant:O===`throwaway`?`primary`:`outline`,type:`button`,onClick:()=>{j(`throwaway`),F(null)},children:n(`ai.throwawayMode`,`Throwaway`)}),l(k,{size:`sm`,variant:O===`persistent`?`primary`:`outline`,type:`button`,onClick:()=>j(`persistent`),children:n(`ai.saveConversation`,`Save conversation`)})]}),O===`persistent`&&r(`div`,{className:`space-y-2`,children:[l(`div`,{className:`flex items-center gap-2`,children:r(k,{size:`sm`,variant:`secondary`,type:`button`,onClick:le,children:[l(se,{className:`h-3.5 w-3.5`}),n(`ai.newChat`,`New chat`)]})}),ee.length>0&&l(`div`,{className:`max-h-36 divide-y divide-border overflow-y-auto rounded-md border border-border`,children:ee.map(e=>l(`button`,{type:`button`,onClick:()=>void ue(e.id),className:`flex w-full px-2.5 py-1.5 text-left text-[11px] hover:bg-surface-hover ${e.id===N?`bg-primary/10`:``}`,children:l(`span`,{className:`min-w-0 flex-1 truncate text-foreground`,children:e.title})},e.id))})]}),l(`p`,{className:`text-[10px] text-foreground-subtle`,children:n(`ai.streamNote`,`The answer streams as the model produces it. A cold model can take a while to load — the status line says which phase it is in.`)}),W!==null&&!W.supportsVision&&l(`p`,{className:`text-[10px] text-warning`,children:n(`ai.notVision`,`This profile is not vision-capable — an attached image will be refused before anything is read.`)})]}),te!==null&&l(P,{title:n(`ai.chatFailed`,`The test call failed`),message:te}),l(rt,{turns:x,live:ne}),r(S,{className:`space-y-2 p-3`,children:[w!==null&&r(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-surface px-2.5 py-1.5`,children:[w.ref.kind===`snapshot`?l(h,{className:`h-3.5 w-3.5 text-foreground-subtle`}):l(z,{className:`h-3.5 w-3.5 text-foreground-subtle`}),l(`span`,{className:`min-w-0 flex-1 truncate text-[11px] text-foreground`,children:w.label}),l(k,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>T(null),children:l(re,{className:`h-3.5 w-3.5`})})]}),r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(k,{size:`sm`,variant:E===`snapshot`?`primary`:`outline`,type:`button`,onClick:()=>D(E===`snapshot`?`none`:`snapshot`),children:[l(h,{className:`h-3.5 w-3.5`}),n(`ai.attachSnapshot`,`Camera snapshot`)]}),r(k,{size:`sm`,variant:E===`track`?`primary`:`outline`,type:`button`,onClick:()=>D(E===`track`?`none`:`track`),children:[l(z,{className:`h-3.5 w-3.5`}),n(`ai.attachTrack`,`Recent track`)]})]}),E===`snapshot`&&l(ot,{onPick:e=>{T({ref:{kind:`snapshot`,deviceId:e.id},label:n(`ai.snapshotOf`,`Snapshot of {{name}}`,{name:e.name})}),D(`none`)}}),E===`track`&&l(ct,{onPick:(e,t)=>{T({ref:{kind:`track`,trackId:e.trackId,deviceId:e.deviceId},label:n(`ai.trackOf`,`{{class}} on {{name}}`,{class:e.label??e.className,name:t})}),D(`none`)}}),r(`div`,{className:`flex items-center gap-2`,children:[l(M,{value:v,onChange:e=>b(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),K())},placeholder:n(`ai.messagePlaceholder`,`Ask the model something…`),"aria-label":n(`ai.message`,`Message`)}),G?r(k,{size:`sm`,variant:`secondary`,type:`button`,onClick:oe,children:[l(m,{className:`h-3.5 w-3.5`}),n(`ai.stop`,`Stop`)]}):r(k,{size:`sm`,type:`button`,disabled:v.trim()===``||c===``,onClick:K,children:[l(ae,{className:`h-3.5 w-3.5`}),n(`ai.send`,`Send`)]})]})]})]})}function rt({turns:e,live:t}){let{t:n}=q();return e.length===0&&t===null?l(`div`,{className:`py-12 text-center text-xs text-foreground-subtle`,children:n(`ai.chatEmpty`,`Pick a profile, optionally attach a camera snapshot or a recent track, and send a message. Nothing here is saved.`)}):l(S,{children:r(`div`,{className:`max-h-[50vh] space-y-2 overflow-y-auto p-3`,children:[e.map(e=>l(it,{turn:e},e.id)),t!==null&&r(`div`,{className:`space-y-1`,children:[t.mediaSent!==null&&l(at,{attachment:t.mediaSent}),t.text.length>0&&l(it,{turn:{id:`live`,role:`assistant`,content:t.text},streaming:!0}),r(`div`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[l(I,{className:`h-3.5 w-3.5 animate-spin`}),Ze(t.phase,t.firstTokenTimeoutMs)]})]})]})})}function it({turn:e,streaming:t=!1}){let n=e.role===`user`,i=e.failed===!0?`border-danger/40 bg-danger/10`:`border-border bg-surface`;return l(`div`,{className:`flex ${n?`justify-end`:`justify-start`}`,children:r(`div`,{className:`max-w-[85%] rounded-lg border px-3 py-2 ${n?`border-primary/40 bg-primary/10`:i}`,children:[r(`p`,{className:`whitespace-pre-wrap break-words text-xs text-foreground`,children:[e.content,t&&l(`span`,{className:`ml-0.5 animate-pulse text-primary`,children:`▌`})]}),e.attachment!==void 0&&l(at,{attachment:e.attachment}),e.attachmentLabel!==void 0&&r(`p`,{className:`mt-1 flex items-center gap-1 text-[10px] text-foreground-subtle`,children:[e.attachmentKind===`track`?l(z,{className:`h-3 w-3`}):l(h,{className:`h-3 w-3`}),e.attachmentLabel]}),e.attachment!==void 0&&r(`p`,{className:`mt-1 flex items-center gap-1 text-[10px] text-foreground-subtle`,children:[e.attachment.kind===`snapshot`?l(h,{className:`h-3 w-3`}):l(z,{className:`h-3 w-3`}),Xe(e.attachment)]}),e.model!==void 0&&l(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:`${e.model} · ${String(e.outputTokens??0)} tok · ${String(e.latencyMs??0)} ms`})]})})}function at({attachment:e}){let t=Je(e);return t===null?null:l(`img`,{src:t,alt:`sent to the model`,className:`mt-1 max-h-32 rounded-md border border-border object-contain`})}function ot({onPick:e}){let{t}=q(),n=F({isCamera:!0,projection:`slim`}),r=(n.data??[]).filter(e=>!e.disabled);return n.isLoading?l(I,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):r.length===0?l(`p`,{className:`text-[11px] text-foreground-subtle`,children:t(`ai.noCameras`,`No camera found.`)}):l(`div`,{className:`grid max-h-56 grid-cols-2 gap-2 overflow-y-auto sm:grid-cols-4`,children:r.map(t=>l(st,{device:t,onPick:e},t.id))})}function st({device:e,onPick:t}){let{src:n}=g(e.id,{width:tt});return r(`button`,{type:`button`,onClick:()=>t(e),className:`overflow-hidden rounded-md border border-border bg-surface text-left transition-colors hover:border-primary/50`,children:[l(`span`,{className:`block aspect-video w-full bg-background-elevated`,children:n!==null&&l(`img`,{src:n,alt:``,className:`h-full w-full object-cover`,loading:`lazy`})}),r(`span`,{className:`flex items-center gap-1 px-2 py-1`,children:[!e.online&&l(D,{variant:`warning`,children:`off`}),l(`span`,{className:`truncate text-[10px] text-foreground`,children:e.name})]})]})}function ct({onPick:e}){let{t}=q(),n=p(),o=F({isCamera:!0,projection:`slim`}),s=i(()=>(o.data??[]).map(e=>e.id),[o.data]),c=i(()=>{let e=new Map;for(let t of o.data??[])e.set(t.id,t.name);return e},[o.data]),u=a({queryKey:[...Qe,s.length],enabled:s.length>0,queryFn:()=>n.trpcClient.pipelineAnalytics.listRecentTracks.query({deviceIds:[...s],since:Date.now()-$e,limit:et,projection:`slim`})});if(o.isLoading||u.isLoading)return l(I,{className:`h-4 w-4 animate-spin text-foreground-subtle`});let d=u.data?.tracks??[];return d.length===0?l(`p`,{className:`text-[11px] text-foreground-subtle`,children:t(`ai.noTracks`,`No track in the last 6 hours.`)}):l(`div`,{className:`max-h-56 divide-y divide-border overflow-y-auto rounded-md border border-border`,children:d.map(t=>r(`button`,{type:`button`,onClick:()=>e(t,c.get(t.deviceId)??String(t.deviceId)),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-[11px] hover:bg-surface-hover`,children:[l(z,{className:`h-3.5 w-3.5 shrink-0 text-foreground-subtle`}),l(`span`,{className:`min-w-0 flex-1 truncate text-foreground`,children:t.label??t.className}),l(`span`,{className:`shrink-0 text-foreground-subtle`,children:c.get(t.deviceId)??t.deviceId}),l(`span`,{className:`shrink-0 text-foreground-subtle`,children:new Date(t.lastSeen).toLocaleTimeString()})]},t.trackId))})}n();var lt=1440*60*1e3,ut=[1,7,30,90];function dt(){let{t:e}=q(),t=p(),[n,o]=s(7),c=i(()=>{let e=new Date;return e.setHours(0,0,0,0),e.getTime()-(n-1)*lt},[n]),u=a({queryKey:ce,queryFn:()=>t.trpcClient.llm.listProfiles.query({})}),d=a({queryKey:[...pe,n],queryFn:()=>t.trpcClient.llm.getUsage.query({since:c})}),f=i(()=>{let e=new Map;for(let t of u.data??[])e.set(t.id,t.name);return e},[u.data]),m=i(()=>[{key:`day`,header:e(`ai.colDay`,`Day`),nowrap:!0,render:e=>e.day},{key:`consumer`,header:e(`ai.colConsumer`,`Consumer`),nowrap:!0,render:e=>l(`span`,{className:`text-[11px] text-foreground`,children:e.consumer})},{key:`profile`,header:e(`ai.colProfile`,`Profile`),render:e=>l(`span`,{className:`text-[11px] text-foreground`,children:f.get(e.profileId)??e.profileId})},{key:`calls`,header:e(`ai.colCalls`,`Calls`),align:`right`,nowrap:!0,render:e=>String(e.calls)},{key:`okErr`,header:e(`ai.colOkErr`,`OK / err`),align:`right`,nowrap:!0,render:e=>l(`span`,{className:e.errorCalls>0?`text-danger`:void 0,children:`${String(e.okCalls)} / ${String(e.errorCalls)}`})},{key:`tokens`,header:e(`ai.colTokens`,`In / out tok`),align:`right`,nowrap:!0,render:e=>`${String(e.inputTokens)} / ${String(e.outputTokens)}`},{key:`latency`,header:e(`ai.colAvgMs`,`Avg ms`),align:`right`,nowrap:!0,render:e=>String(Math.round(e.avgLatencyMs))}],[f,e]),h=d.data??[];return r(J,{icon:b,title:e(`ai.usageTitle`,`Usage`),subtitle:e(`ai.usageSubtitle`,`Server-side rollup per day, consumer and profile — never raw call rows. Errors are counted, so a profile that always fails is visible here before a feature reports it.`),actions:l(`div`,{className:`w-40`,children:l(A,{"aria-label":e(`ai.window`,`Window`),value:String(n),options:ut.map(t=>({value:String(t),label:e(`ai.lastDays`,`Last {{days}} days`,{days:t})})),onChange:e=>o(Number(e.target.value))})}),children:[d.isError&&l(P,{title:e(`ai.usageFailed`,`Failed to read usage`),message:d.error instanceof Error?d.error.message:e(`common.error`,`Error`),onRetry:()=>void d.refetch()}),h.length===0?l(`div`,{className:`py-16 text-center text-xs text-foreground-subtle`,children:e(`ai.noUsage`,`No AI calls in this window.`)}):l(S,{children:l(U,{columns:m,rows:h,rowKey:e=>`${e.day}|${e.consumer}|${e.profileId}`,minWidthPx:720,bordered:!1,mobileMode:`scroll`,maxBodyHeight:L})})]})}function ft(){let{t:e}=q();return l(`div`,{className:`flex flex-col p-4`,children:l(oe,{tabs:[{id:`profiles`,label:e(`ai.tabProfiles`,`Profiles`),icon:ie,content:l(Ne,{})},{id:`runtimes`,label:e(`ai.tabRuntimes`,`Runtimes`),icon:V,content:l(Le,{})},{id:`usage`,label:e(`ai.tabUsage`,`Usage`),icon:b,content:l(dt,{})},{id:`test`,label:e(`ai.tabTest`,`Test`),icon:y,content:l(nt,{})}]})})}export{ft as AiProfilesPage,ft as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_t as e}from"./player-overlays-C64C5sp1.js";var t=e(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]);export{t};
|