@camstack/addon-admin-ui 1.2.498 → 1.2.499
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/CHANGELOG.md +7 -0
- package/dist/assets/{AddonAssetIcon-LAWfltAP.js → AddonAssetIcon-DjkuwW5K.js} +1 -1
- package/dist/assets/{Addons-Cv5HTMfp.js → Addons-PTfAXTcl.js} +1 -1
- package/dist/assets/{AdminPage-YL33-tyD.js → AdminPage-CdqsBsG5.js} +1 -1
- package/dist/assets/{AdminSectionedPage-D4ha_mUd.js → AdminSectionedPage-BYs8ku8k.js} +1 -1
- package/dist/assets/AiProfiles-BaIX3xlW.js +3 -0
- package/dist/assets/{BrokerEditorDialog-CMDS1NbD.js → BrokerEditorDialog-CONeUoQZ.js} +1 -1
- package/dist/assets/{Build-CWS3kbeT.js → Build-64GFrVBv.js} +1 -1
- package/dist/assets/{Calendars-B9XaYLYf.js → Calendars-Cr9FOfbM.js} +1 -1
- package/dist/assets/{Cluster-Bl0HEiV5.js → Cluster-CaDZt6wf.js} +1 -1
- package/dist/assets/{CompositionBlockEditor-B2Dtyllz.js → CompositionBlockEditor-Cu_GMMSI.js} +1 -1
- package/dist/assets/{CompositionEditorPage-D2KS8wDM.js → CompositionEditorPage-DHmZe045.js} +1 -1
- package/dist/assets/{Data-CvNv_xFm.js → Data-CLUboL1k.js} +1 -1
- package/dist/assets/{DeviceDetail-DGQtYXOf.js → DeviceDetail-PeXgC7D7.js} +1 -1
- package/dist/assets/{DeviceDoActionFields-C-dtW77F.js → DeviceDoActionFields-CTqHC6sW.js} +1 -1
- package/dist/assets/{Devices-B-dYYyDP.js → Devices-72RGQIZG.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-BWc6nJSP.js → EmbedPlayerPage-Ba0hOImQ.js} +1 -1
- package/dist/assets/{HelperWizard-CWHf-XYG.js → HelperWizard-pM6WaJkS.js} +1 -1
- package/dist/assets/{History-TLceoLRj.js → History-Dw72vHO6.js} +1 -1
- package/dist/assets/{Identity-BX-efitc.js → Identity-CPnY-pTg.js} +1 -1
- package/dist/assets/{IntegrationDetail-DkcGd4l3.js → IntegrationDetail-DCuJRrDX.js} +1 -1
- package/dist/assets/{IntegrationHub-BkdAThbE.js → IntegrationHub-AlH87vBq.js} +1 -1
- package/dist/assets/{Integrations-W0LYv3gl.js → Integrations-CEyrrglP.js} +1 -1
- package/dist/assets/{Integrations-BKYlNn1o.js → Integrations-UhKXHXBR.js} +1 -1
- package/dist/assets/{Library-C5SfudKb.js → Library-BGe2f4pB.js} +1 -1
- package/dist/assets/{Locations-CzAqVkVS.js → Locations-BjT72gvn.js} +1 -1
- package/dist/assets/{Logs-CXNhg_YQ.js → Logs-C_7aqJhI.js} +1 -1
- package/dist/assets/{MaskShapeCanvas-j6RMQiMm.js → MaskShapeCanvas-BfY6UgU8.js} +1 -1
- package/dist/assets/{MotionZonesSettings-DRxYOnxX.js → MotionZonesSettings-Dn5IgvFT.js} +1 -1
- package/dist/assets/{MyAccess-D-nrzTN3.js → MyAccess-Bo_FOLPs.js} +1 -1
- package/dist/assets/{Network-DcCZa3ZV.js → Network-BX6Y8dwk.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-Ck6jsPrm.js → NodeAddonsSettingsPanel-2TqELGQC.js} +1 -1
- package/dist/assets/{Notifications-IwqrFjjj.js → Notifications-T_G8vhSu.js} +1 -1
- package/dist/assets/{Pipeline-CMeCAGZ1.js → Pipeline-BRYPZ_2h.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-NLJ10VzM.js → PrivacyMaskSettings-BCqWKR8b.js} +1 -1
- package/dist/assets/{Recordings-B_WZxjZd.js → Recordings-CqsVLa2F.js} +1 -1
- package/dist/assets/{ScanNetworkModal-DPa0iYIB.js → ScanNetworkModal-DAFJTCNh.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-B3zFmZd9.js → SceneMonitorEditor-DOi8VJsT.js} +1 -1
- package/dist/assets/{SessionsList-DNiLlvf_.js → SessionsList-zyzKyjyE.js} +1 -1
- package/dist/assets/{Showroom-C-3nnsif.js → Showroom-DHXru4Aa.js} +1 -1
- package/dist/assets/{System-DDO8AZr2.js → System-qySy6YJm.js} +1 -1
- package/dist/assets/{Terminal-B9gp39yV.js → Terminal-B6xVGljU.js} +1 -1
- package/dist/assets/{Viewer-Dx2j8r4R.js → Viewer-X0_CVWn_.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-C3CwnCPL.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-D7ATU8Xn.js} +1 -1
- package/dist/assets/{addon-icons-context-CEYaWEX1.js → addon-icons-context-BOriiEsT.js} +1 -1
- package/dist/assets/{archive-D_KOsrY_.js → archive-BXVJNilF.js} +1 -1
- package/dist/assets/{assignment-candidates-C0MEJ7d1.js → assignment-candidates-DXAO7Cbf.js} +1 -1
- package/dist/assets/{authed-media-Cub-CoaA.js → authed-media-DH0VgksC.js} +1 -1
- package/dist/assets/{bell-off-C6pKJ66E.js → bell-off-Cje1_WzG.js} +1 -1
- package/dist/assets/{board-model-Cv0wQ5kS.js → board-model-DjKb-Uu4.js} +1 -1
- package/dist/assets/{boxes-Bt-KysP0.js → boxes-Bmx0I9xI.js} +1 -1
- package/dist/assets/circle-slash-CV1_3oBt.js +1 -0
- package/dist/assets/{client-Dzvv4_Sl.js → client-Gv3pB3LY.js} +11 -11
- package/dist/assets/{cloud-upload-sMEfbX0O.js → cloud-upload-DOZOWIaX.js} +1 -1
- package/dist/assets/crop-BPFdBdvk.js +1 -0
- package/dist/assets/{device-integration-icon-BEwalLrp.js → device-integration-icon-DeM12QWn.js} +1 -1
- package/dist/assets/device-picker-model-Bf0X4ydS.js +1 -0
- package/dist/assets/dist-CBReFtub.js +648 -0
- package/dist/assets/{dist-8AtsFXrb.js → dist-DjoKQtup.js} +1 -1
- package/dist/assets/{eraser-DrEgEC1O.js → eraser-CVudvbRZ.js} +1 -1
- package/dist/assets/{format-DRuwpktU.js → format-bLJqYfjk.js} +1 -1
- package/dist/assets/{hard-drive-download-ztREprcM.js → hard-drive-download-D7rFyG82.js} +1 -1
- package/dist/assets/{hostInit-Bi1YBD13.js → hostInit-DI-nfbwk.js} +1 -1
- package/dist/assets/i18n-D0vRhk5m.js +1 -0
- package/dist/assets/{icons-BcEj3oT7.js → icons-DHFi8jjf.js} +1 -1
- package/dist/assets/{index-uSU5d3OQ.js → index-D_AGxR1C.js} +3 -3
- package/dist/assets/{key-BcZzze2E.js → key-Bx56zYph.js} +1 -1
- package/dist/assets/{key-round-Bt2Dzta7.js → key-round-Dzh0-Y90.js} +1 -1
- package/dist/assets/{layers-CoV_OFyG.js → layers-6nDyzJGk.js} +1 -1
- package/dist/assets/{linked-devices-model-CjZtQz45.js → linked-devices-model-C3vv05kt.js} +1 -1
- package/dist/assets/{list-ordered-O0jSf7Ri.js → list-ordered-CT5RBbXf.js} +1 -1
- package/dist/assets/{location-owned-usage-Crp_-LlT.js → location-owned-usage-Bx1OkT8H.js} +1 -1
- package/dist/assets/{log-in-djHfeOZ2.js → log-in-CANFQKog.js} +1 -1
- package/dist/assets/{memory-stick-BKIVHC3r.js → memory-stick-CRaTDBUV.js} +1 -1
- package/dist/assets/{message-square-plus-CFvuhQK7.js → message-square-plus-BxGpiezi.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-1297cc9e.js → mf-entry-bootstrap-0-6afad399.js} +2 -2
- package/dist/assets/{mic-off-DNHO5Uh-.js → mic-off-DyTS6uuu.js} +1 -1
- package/dist/assets/{monitor-off-BqgH6u3j.js → monitor-off-BgwnbqXX.js} +1 -1
- package/dist/assets/{monitor-smartphone-DkJ_Kwv6.js → monitor-smartphone-Bv0ribmJ.js} +1 -1
- package/dist/assets/mount-Bf0X4ydS.js +1 -0
- package/dist/assets/{player-overlays-B_erfGbP.js → player-overlays-DmlN4sZb.js} +1 -1
- package/dist/assets/{recycle-B1-Imvoy.js → recycle-DHY8PHbW.js} +1 -1
- package/dist/assets/remoteEntry-BXlJ18mT.js +1 -0
- package/dist/assets/{scan-eye-C7gibbar.js → scan-eye-BhtfT2TC.js} +1 -1
- package/dist/assets/{scissors-XNVbVUmK.js → scissors-Dj546Wu-.js} +1 -1
- package/dist/assets/{search-x-gfbcSlaX.js → search-x-De3-l_vz.js} +1 -1
- package/dist/assets/{send-v9HSmmLd.js → send-DC9n_ItK.js} +1 -1
- package/dist/assets/{settings-2-rm-AU3MK.js → settings-2-N6ClOXOl.js} +1 -1
- package/dist/assets/{sigma-i18i7ZA4.js → sigma-deG3J-yB.js} +1 -1
- package/dist/assets/{speaker-D1o8lxVE.js → speaker-DGGo7wtR.js} +1 -1
- package/dist/assets/{src-RqdhpHCS.js → src-DWX1wfhS.js} +3 -3
- package/dist/assets/{step-inspector-model-deYjxTsF.js → step-inspector-model-BxKcZWYu.js} +1 -1
- package/dist/assets/{table-2-BnD3UPDB.js → table-2-3euQhw5E.js} +1 -1
- package/dist/assets/{timer-reset-dP3S4Mma.js → timer-reset-BdIAmvAS.js} +1 -1
- package/dist/assets/{ungroup-CrrXZ1cz.js → ungroup-CbtqPFVa.js} +1 -1
- package/dist/assets/{unlink-yi5Oc_VQ.js → unlink-aJqh9mCl.js} +1 -1
- package/dist/assets/{usb-Zjmyi0W6.js → usb-CYLx4jAF.js} +1 -1
- package/dist/assets/{use-scenes-feed-CItArhIy.js → use-scenes-feed-C_iMGuNF.js} +1 -1
- package/dist/assets/{use-stationary-objects-B8nnm1dO.js → use-stationary-objects-h9SgJ5H7.js} +1 -1
- package/dist/assets/useEventInvalidation-Bf0X4ydS.js +1 -0
- package/dist/assets/{useNodeUrlSelection-oH35Ymt2.js → useNodeUrlSelection-CO3V-rVN.js} +1 -1
- package/dist/assets/user-round-DORzQt2o.js +1 -0
- package/dist/assets/{user-x-BS1jRQsE.js → user-x-DuE_Nzjl.js} +1 -1
- package/dist/assets/{video-DwweJlSM.js → video-TyyuRVZ9.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-tCkMTYHY.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DHSRAP7h.js} +2 -2
- package/dist/index.html +9 -9
- package/dist/server/addon.js +1 -1
- package/package.json +1 -1
- package/dist/assets/AiProfiles-DQK0aSxp.js +0 -3
- package/dist/assets/circle-slash-BEeFS4kg.js +0 -1
- package/dist/assets/crop-mxvg6wAl.js +0 -1
- package/dist/assets/device-picker-model-e0EF82Y0.js +0 -1
- package/dist/assets/dist-CkItzPTy.js +0 -648
- package/dist/assets/i18n-DfYHkTg0.js +0 -1
- package/dist/assets/mount-e0EF82Y0.js +0 -1
- package/dist/assets/remoteEntry-CmR61kgd.js +0 -1
- package/dist/assets/useEventInvalidation-e0EF82Y0.js +0 -1
- package/dist/assets/user-round-Cps4mbp-.js +0 -1
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{C as e,J as t,K as n,R as r,S as i,V as a,Y as o,a as s,et as c,t as l,x as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{D as d,En as f,Fn as p,G as m,Ht as h,L as g,Li as _,Ni as v,Pn as y,Pr as b,Q as x,Ri as S,Vn as C,Xr as w,_n as T,ai as E,dt as D,fr as O,gt as ee,na as k,ni as A,rn as j,st as M,tn as N,vn as P}from"./player-overlays-B_erfGbP.js";import{$a as te,Br as F,zr as I}from"./client-Dzvv4_Sl.js";import{n as L,t as ne}from"./send-v9HSmmLd.js";import{t as R}from"./message-square-plus-CFvuhQK7.js";import{Cn as z,Dr as B,Er as V,Fr as re,Hn as H,Or as U,Qn as ie,Sn as W,Tr as G,Wn as ae,Yr as K,_o as oe,ad as q,bn as J,bt as Y,ed as se,ft as ce,mt as le,ni as X,od as ue,or as de,rt as fe,xt as pe}from"./src-RqdhpHCS.js";import{t as Z}from"./i18n-DfYHkTg0.js";import{t as Q}from"./useTranslation-BJr-n0es.js";import"./mount-e0EF82Y0.js";import{S as me,gr as he}from"./index-uSU5d3OQ.js";import{t as ge}from"./AdminSectionedPage-D4ha_mUd.js";import{t as _e}from"./AdminPage-YL33-tyD.js";c();var ve=`__redacted__`,ye=[`llm`,`listProfiles`],be=[`llm`,`listProfileKinds`],xe=[`llm`,`getDefaults`],Se=[`llm`,`listRuntimeNodes`],Ce=[`llm`,`listModelCatalog`],we=[`llm`,`getUsage`],Te=[{purpose:`vision`,visionOnly:!0},{purpose:`text`,visionOnly:!1}],Ee=new Map([[`cloud`,E],[`plug`,y],[`cpu`,A],[`server`,T],[`sparkles`,j]]);function De(e){return Ee.get(e)??S}function Oe(e){return typeof e==`string`&&e.length>0?e:void 0}function ke(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 Ae(e){return e===!0}function je(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 Me={deviceNotEligible:{key:`ai.appleNotEligible`,tone:`default`},appleIntelligenceNotEnabled:{key:`ai.appleIntelligenceOff`,tone:`warning`},modelNotReady:{key:`ai.appleModelNotReady`,tone:`warning`},osTooOld:{key:`ai.appleOsTooOld`,tone:`default`},helperMissing:{key:`ai.appleHelperMissing`,tone:`danger`},helperCrashed:{key:`ai.appleHelperCrashed`,tone:`danger`}};function Ne(e){let t=t=>({nodeId:e.nodeId,selectable:!1,labelKey:`ai.appleUnknown`,labelDefault:Z.t(`ai.appleUnknown`),detail:t,tone:`default`});if(!e.reachable)return t(e.error??null);let n=e.apple;if(n===void 0)return t(null);switch(n.state){case`available`:return{nodeId:e.nodeId,selectable:!0,labelKey:`ai.appleAvailable`,labelDefault:Z.t(`ai.appleAvailable`),detail:Z.t(n.imageInput?`helpers.aiPage.appleDetailImages`:`helpers.aiPage.appleDetailText`,{version:n.osVersion}),tone:`success`};case`unavailable`:{let t=Me[n.reason];return{nodeId:e.nodeId,selectable:!1,labelKey:t.key,labelDefault:Z.t(t.key),detail:n.detail,tone:t.tone}}case`unsupported-platform`:return{nodeId:e.nodeId,selectable:!1,labelKey:`ai.appleNotMac`,labelDefault:Z.t(`ai.appleNotMac`),detail:n.platform,tone:`default`};case`unknown`:return t(n.error)}}var Pe={ready:`success`,downloading:`info`,starting:`info`,stopped:`danger`,crashed:`danger`,failed:`danger`};function Fe(e){return e.reachable?e.status===void 0?`success`:Pe[e.status.state]:`danger`}function Ie(e){if(!e.reachable)return[];let t=[],n=e.apple;if(n?.state===`available`)t.push({id:`apple`,labelKey:`ai.featureApple`,tone:`success`,detail:Ne(e).detail}),n.imageInput&&t.push({id:`apple-images`,labelKey:`ai.featureAppleImages`,tone:`success`,detail:null});else if(n?.state===`unavailable`){let n=Ne(e);t.push({id:`apple`,labelKey:`ai.featureApple`,tone:n.tone,detail:n.labelDefault})}let r=e.status?.vramBytes;return r!==void 0&&r>0&&t.push({id:`gpu`,labelKey:`ai.featureGpu`,tone:`info`,detail:null}),t}function Le(){return{temperature:[{type:`slider`,key:`temperature`,label:Z.t(`helpers.aiProfileForm.temperature`),min:0,max:2,step:.1,showValue:!0,showStepper:!0,nullable:!0,nullLabel:`Provider default`,description:Z.t(`helpers.aiProfileForm.temperatureHint`)}],topP:[{type:`slider`,key:`topP`,label:Z.t(`helpers.aiProfileForm.topP`),min:0,max:1,step:.05,showValue:!0,showStepper:!0,nullable:!0,nullLabel:`Provider default`}],topK:[{type:`number`,key:`topK`,label:Z.t(`helpers.aiProfileForm.topK`),min:1}],maxTokens:[{type:`number`,key:`maxTokens`,label:Z.t(`helpers.aiProfileForm.maxTokens`),min:1}],contextLength:[{type:`number`,key:`contextLength`,label:Z.t(`helpers.aiProfileForm.contextLength`),min:512,unit:`tokens`,description:Z.t(`helpers.aiProfileForm.contextLengthHint`)}],systemPrompt:[{type:`textarea`,key:`systemPrompt`,label:Z.t(`helpers.aiProfileForm.systemPrompt`),rows:4,maxLength:4e3,span:2,description:Z.t(`helpers.aiProfileForm.systemPromptHint`)}],timeoutMs:[{type:`number`,key:`timeoutMs`,label:Z.t(`helpers.aiProfileForm.timeoutTotal`),min:1e3,default:F.totalMs,unit:`ms`,description:Z.t(`helpers.aiProfileForm.timeoutTotalHint`)}],connectTimeoutMs:[{type:`number`,key:`connectTimeoutMs`,label:Z.t(`helpers.aiProfileForm.timeoutConnect`),min:500,default:F.connectMs,unit:`ms`,description:Z.t(`helpers.aiProfileForm.timeoutConnectHint`)}],firstTokenTimeoutMs:[{type:`number`,key:`firstTokenTimeoutMs`,label:Z.t(`helpers.aiProfileForm.timeoutFirstToken`),min:1e3,default:F.firstTokenMs,unit:`ms`,description:Z.t(`helpers.aiProfileForm.timeoutFirstTokenHint`)}],idleTimeoutMs:[{type:`number`,key:`idleTimeoutMs`,label:Z.t(`helpers.aiProfileForm.timeoutIdle`),min:1e3,default:F.idleMs,unit:`ms`,description:Z.t(`helpers.aiProfileForm.timeoutIdleHint`)}],retry:[{type:`boolean`,key:`retryEnabled`,label:Z.t(`helpers.aiProfileForm.retry`),description:Z.t(`helpers.aiProfileForm.retryHint`)},{type:`number`,key:`retryMaxAttempts`,label:Z.t(`helpers.aiProfileForm.retryMaxAttempts`),min:1,max:5,default:1,showWhen:{field:`retryEnabled`,equals:!0}}],toolsEnabled:[{type:`boolean`,key:`toolsEnabled`,label:Z.t(`helpers.aiProfileForm.toolsEnabled`),description:Z.t(`helpers.aiProfileForm.toolsEnabledHint`)}]}}var Re=[`temperature`,`topP`,`topK`,`maxTokens`,`contextLength`,`systemPrompt`],ze=[`timeoutMs`,`connectTimeoutMs`,`firstTokenTimeoutMs`,`idleTimeoutMs`,`retry`,`toolsEnabled`];function Be(e,t){let n=Le();return t.filter(t=>e.includes(t)).flatMap(e=>n[e])}function Ve(e){let t=Be(e,Re);return t.length===0?null:{sections:[{id:`generation`,title:Z.t(`helpers.aiProfileForm.generation`),fields:t}]}}function He(e){let t=Be(e,ze);return t.length===0?null:{sections:[{id:`bounds`,title:Z.t(`helpers.aiProfileForm.bounds`),fields:t}]}}function Ue(e){return e===null?{}:{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}}function We(e,t){return{...e.features,...t?.features}}function Ge(e,t){return t===null?e.modelCatalog===`static`?e.staticModels??[]:[]:t}function Ke(e,t,n){let r=e.profileFields,i=n.common,a=(e,t,n)=>r.includes(e)?ke(i[e])??t:n??t,o=e=>r.includes(e)?ke(i[e]):t?.[e],s=o(`temperature`),c=o(`topP`),l=o(`topK`),u=o(`maxTokens`),d=o(`contextLength`),f=r.includes(`systemPrompt`)?Oe(i.systemPrompt):t?.systemPrompt;return{id:t?.id??crypto.randomUUID(),name:n.name,kind:e.kind,addonId:e.addonId.length>0?e.addonId:`ai`,enabled:t?.enabled??!0,model:n.model,supportsVision:n.supportsVision,timeoutMs:a(`timeoutMs`,F.totalMs,t?.timeoutMs),connectTimeoutMs:a(`connectTimeoutMs`,F.connectMs,t?.connectTimeoutMs),firstTokenTimeoutMs:a(`firstTokenTimeoutMs`,F.firstTokenMs,t?.firstTokenTimeoutMs),idleTimeoutMs:a(`idleTimeoutMs`,F.idleMs,t?.idleTimeoutMs),retry:r.includes(`retry`)?{enabled:Ae(i.retryEnabled),maxAttempts:ke(i.retryMaxAttempts)??1}:t?.retry??{enabled:!1,maxAttempts:1},toolsEnabled:r.includes(`toolsEnabled`)?Ae(i.toolsEnabled):t?.toolsEnabled??!1,...s===void 0?{}:{temperature:s},...c===void 0?{}:{topP:c},...l===void 0?{}:{topK:l},...u===void 0?{}:{maxTokens:u},...d===void 0?{}:{contextLength:d},...f===void 0?{}:{systemPrompt:f},providerConfig:n.providerConfig}}var qe=2e3;function $(e){return Z.t(`system.aiModelPicker.sizeGb`,{value:(e/1e9).toFixed(2)})}function Je(e){return e===null?``:e.model.kind===`catalog`?`catalog:${e.model.catalogId}`:e.model.kind===`path`?`node:${e.modelId}`:`custom`}function Ye({nodeId:t,value:r,onChange:a}){let{t:c}=Q(),u=D(),[d,f]=o(``),[p,m]=o(null),[h,g]=o(!1),_=s({queryKey:Ce,queryFn:()=>u.trpcClient.llm.listModelCatalog.query({})}),v=s({queryKey:[`llm`,`listNodeModels`,t],queryFn:()=>u.trpcClient.llm.listNodeModels.query({nodeId:t})}),y=l({mutationFn:e=>u.trpcClient.llm.resolveModelRef.mutate(e),onSuccess:e=>{m(e),g(!1),e.ok&&a({model:e.model,modelId:e.label,supportsVision:e.purpose===`vision`})}}),b=l({mutationFn:e=>u.trpcClient.llm.installModel.mutate({nodeId:t,model:e}),onSuccess:()=>{g(!0),v.refetch()}}),x=s({queryKey:Se,enabled:b.isPending,refetchInterval:b.isPending?qe:!1,queryFn:()=>u.trpcClient.llm.listRuntimeNodes.query({})}).data?.find(e=>e.nodeId===t)?.status?.download,S=n(()=>{let e=(_.data??[]).map(e=>({value:`catalog:${e.id}`,label:`${e.label} · ${e.quantization} · ${$(e.sizeBytes)}`})),n=(v.data??[]).filter(e=>e.catalogId===void 0&&e.path!==void 0).map(e=>({value:`node:${e.file}`,label:c(`ai.onNode`,`{{file}} · {{size}} · on {{node}}`,{file:e.file,size:$(e.sizeBytes),node:t})})),r=p?.ok===!0?[{value:`custom`,label:`${p.label} · ${$(p.totalBytes)}`}]:[];return[{value:``,label:c(`ai.selectModel`,`Select a model…`)},...e,...n,...r]},[_.data,v.data,p,t,c]),C=e=>{if(e===``){a(null);return}if(e===`custom`){if(p?.ok!==!0)return;a({model:p.model,modelId:p.label,supportsVision:p.purpose===`vision`});return}if(e.startsWith(`catalog:`)){let t=e.slice(8),n=_.data?.find(e=>e.id===t);a({model:{kind:`catalog`,catalogId:t},modelId:t,supportsVision:n?.purpose===`vision`});return}let t=e.slice(5),n=v.data?.find(e=>e.file===t);n?.path!==void 0&&a({model:{kind:`path`,path:n.path},modelId:t,supportsVision:!1})},T=e=>{d.trim()!==``&&y.mutate({ref:d.trim(),...e===void 0?{}:{maxBytes:e}})};return e(`div`,{className:`space-y-3`,children:[i(pe,{label:c(`ai.model`,`Model`),required:!0,children:i(se,{id:`ai-model`,"aria-label":c(`ai.model`,`Model`),value:Je(r),options:S,onChange:e=>C(e.target.value)})}),i(pe,{label:c(`ai.hfTitle`,`Add a model from Hugging Face`),description:c(`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.`),children:e(`div`,{className:`flex gap-2`,children:[i(q,{"aria-label":c(`ai.hfTitle`,`Add a model from Hugging Face`),value:d,onChange:e=>f(e.target.value),placeholder:c(`system.aiModelPicker.unslothQwen3635bA3b`,`unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_M`),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),T())}}),e(K,{size:`sm`,variant:`secondary`,type:`button`,disabled:d.trim()===``||y.isPending,onClick:()=>T(),children:[y.isPending?i(O,{className:`h-3.5 w-3.5 animate-spin`}):i(P,{className:`h-3.5 w-3.5`}),c(`ai.hfCheck`,`Check`)]})]})}),y.isError&&i(G,{message:y.error instanceof Error?y.error.message:c(`common.error`,`Error`)}),p?.ok===!1&&i(G,{message:p.message,action:e(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(p.candidates??[]).map(e=>i(K,{size:`sm`,variant:`outline`,type:`button`,onClick:()=>{let t=`${d.trim().split(`:`)[0]??``}:${e}`;f(t),y.mutate({ref:t})},children:e},e)),p.requiredBytes!==void 0&&i(K,{size:`sm`,variant:`secondary`,type:`button`,onClick:()=>T(p.requiredBytes),children:c(`ai.hfOverride`,`Install anyway ({{size}})`,{size:$(p.requiredBytes)})})]})}),p?.ok===!0&&e(`div`,{className:`space-y-2 rounded-md border border-border bg-surface p-2.5`,children:[e(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[i(`span`,{className:`text-[11px] font-medium text-foreground`,children:p.label}),i(X,{variant:p.purpose===`vision`?`info`:`default`,children:p.purpose}),i(X,{variant:`default`,children:$(p.totalBytes)})]}),p.extraFilenames.length>0&&i(`p`,{className:`text-[10px] text-foreground-subtle`,children:c(`ai.hfExtras`,`Also downloads: {{files}}`,{files:p.extraFilenames.join(`, `)})}),e(`div`,{className:`flex items-center gap-2`,children:[e(K,{size:`sm`,type:`button`,disabled:b.isPending||h,onClick:()=>b.mutate(p.model),children:[b.isPending?i(O,{className:`h-3.5 w-3.5 animate-spin`}):i(w,{className:`h-3.5 w-3.5`}),h?c(`ai.hfInstalled`,`Downloaded`):c(`ai.hfInstall`,`Download to {{node}}`,{node:t})]}),x!==void 0&&i(`span`,{className:`text-[10px] text-foreground-subtle`,children:x.phase===`verifying`?c(`ai.hfVerifying`,`verifying {{file}}…`,{file:x.file}):c(`ai.hfDownloading`,`{{file}} ({{index}}/{{count}}) — {{done}}{{total}}`,{file:x.file,index:x.fileIndex,count:x.fileCount,done:$(x.downloadedBytes),total:x.totalBytes===void 0?``:` / ${$(x.totalBytes)}`})})]}),b.isError&&i(G,{message:b.error instanceof Error?b.error.message:c(`common.error`,`Error`)})]})]})}function Xe({value:t,onChange:n}){let{t:r}=Q(),a=D(),o=s({queryKey:Se,queryFn:()=>a.trpcClient.llm.listRuntimeNodes.query({})});return e(`div`,{children:[i(`div`,{className:`mb-1 text-[11px] font-medium text-foreground`,children:r(`ai.appleNode`,`Mac that runs it`)}),o.isPending&&e(`div`,{className:`flex items-center gap-1.5 text-[11px] text-foreground-subtle`,children:[i(O,{className:`h-3.5 w-3.5 animate-spin`}),r(`ai.appleAsking`,`Asking the nodes…`)]}),o.isError&&i(`p`,{className:`text-[11px] text-danger`,children:o.error instanceof Error?o.error.message:r(`ai.runtimesFailed`,`Failed to read runtime nodes`)}),o.isSuccess&&o.data.length===0&&i(`p`,{className:`text-[11px] text-foreground-subtle`,children:r(`ai.noRuntimes`,`No node advertises the llm-runtime capability.`)}),o.isSuccess&&o.data.length>0&&i(`div`,{role:`radiogroup`,className:`space-y-1.5`,children:o.data.map(a=>{let o=Ne(a),s=o.nodeId===t;return e(`button`,{type:`button`,role:`radio`,"aria-checked":s,disabled:!o.selectable&&!s,onClick:()=>n(o.nodeId),className:`flex w-full items-center justify-between gap-2 rounded-md border px-3 py-2 text-left text-xs transition-colors disabled:cursor-not-allowed disabled:opacity-60 ${s?`border-primary bg-primary/10`:`border-border bg-surface hover:bg-surface-hover`}`,children:[e(`span`,{className:`min-w-0`,children:[i(`span`,{className:`block font-medium text-foreground`,children:o.nodeId}),o.detail!==null&&i(`span`,{className:`block truncate text-[10px] text-foreground-subtle`,children:o.detail})]}),i(X,{variant:o.tone,children:r(o.labelKey,o.labelDefault)})]},o.nodeId)})}),i(`p`,{className:`mt-1.5 text-[10px] leading-relaxed text-foreground-subtle`,children:r(`ai.appleHint`,`Text only for now — notification titles and summaries. Apple refuses prompts framed as surveillance; when it does, the next profile in the chain answers instead.`)})]})}function Ze(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:null}function Qe({providerConfig:e,onProviderConfigChange:t}){return i(Xe,{value:Ze(e,`nodeId`),onChange:n=>t({...e,nodeId:n})})}function $e({providerConfig:e,onProviderConfigChange:t,model:n,onModelChange:r}){let a=I.safeParse(e.model),o=a.success?{model:a.data,modelId:n.id,supportsVision:n.supportsVision}:null;return i(Ye,{nodeId:Ze(e,`nodeId`)??`hub`,value:o,onChange:n=>{if(n===null){let{model:n,...i}=e;t(i),r({id:``,supportsVision:!1});return}t({...e,model:n.model}),r({id:n.modelId,supportsVision:n.supportsVision})}})}var et=new Map([[`ai/apple-node`,Qe],[`ai/managed-model`,$e]]);function tt(e){return et.get(e)??null}c();function nt({kind:e,className:t}){return i(De(e.icon),{className:t,"aria-hidden":!0})}function rt({kinds:e,onPick:t,onCancel:r}){let{t:a}=Q(),o=n(()=>je(e),[e]),s=n(()=>new Map(e.map(e=>[`${e.addonId}:${e.kind}`,e])),[e]);return i(le,{open:!0,onClose:r,title:a(`ai.chooseKind`,`Choose a profile type`),width:`lg`,testId:`ai-kind-picker`,children:i(Y,{emptyMessage:a(`ai.noKinds`,`No AI provider is installed.`),onPick:e=>{let n=s.get(e);n!==void 0&&t(n)},groups:o.map(e=>({id:e.addonId,label:e.addonId,tiles:e.kinds.map(t=>({key:`${e.addonId}:${t.kind}`,label:t.label,testId:`ai-kind-${t.kind}`,icon:i(nt,{kind:t,className:`h-5 w-5 text-foreground-subtle`})}))}))})})}function it(e){return(e?.sections??[]).flatMap(e=>e.fields)}function at(...e){let t={};for(let n of e)for(let e of it(n))`default`in e&&e.default!==void 0&&(t[e.key]=e.default);return t}function ot(e){return e==null?!1:typeof e==`string`?e.trim().length>0:!0}function st(e,t){return it(e).filter(e=>`required`in e&&e.required===!0&&!ot(t[e.key])).map(e=>`label`in e&&typeof e.label==`string`?e.label:e.key)}var ct={auth:{key:`ai.listAuth`,fallback:`Credentials refused`},network:{key:`ai.listNetwork`,fallback:`Endpoint unreachable`},unsupported:{key:`ai.listUnsupported`,fallback:`No model list`},invalid:{key:`ai.listInvalid`,fallback:`Connection incomplete`}};function lt(e,t){if(t!==null)return{id:t.model,supportsVision:t.supportsVision};let n=e.modelCatalog===`static`&&e.staticModels?.length===1?e.staticModels?.[0]:void 0;return{id:n?.id??``,supportsVision:We(e,n).vision}}function ut({kind:t,existing:r,onSave:a,onCancel:s,onChangeKind:c,saving:p,error:m}){let{t:h}=Q(),_=D(),[v,y]=o(r?.name??t.label),[b,x]=o(()=>r===null?at(t.connectionSchema,t.advancedSchema):{...r.providerConfig}),[S,C]=o(()=>Ue(r)),[w,T]=o(()=>lt(t,r)),[E,ee]=o(!1),A=t.providerWidgets??[],j=A.filter(e=>e.placement===`connection`),M=A.find(e=>e.placement===`model`)??null,N=n(()=>[...te(t.connectionSchema)].some(e=>r?.providerConfig[e]===ve),[r,t.connectionSchema]),P=l({mutationFn:()=>_.trpcClient.llm.listModels.mutate({addonId:t.addonId,kind:t.kind,connection:b,...r===null?{}:{profileId:r.id}}),onSuccess:e=>{e.ok&&T(n=>{let r=e.models.find(e=>e.id===n.id);return r===void 0?n:{id:n.id,supportsVision:We(t,r).vision}})}}),F=Ge(t,P.data?.ok===!0?P.data.models:null),I=F.find(e=>e.id===w.id),L=We(t,I),ne=Ve(t.profileFields),R=He(t.profileFields),z=st(t.connectionSchema,b),B=A.some(e=>(e.requires??[]).some(e=>!ot(b[e]))),V=t.modelCatalog===`fetch`&&M===null,re=it(t.connectionSchema).length>0||j.length>0,U=e=>{T({id:e,supportsVision:We(t,F.find(t=>t.id===e)).vision})},W=p||v.trim()===``||w.id.trim()===``||z.length>0||B,ae=()=>{a(Ke(t,r,{name:v.trim(),model:w.id.trim(),supportsVision:t.visionEditable?w.supportsVision:!1,common:S,providerConfig:b}))},oe=r===null?h(`ai.newProfile`,`New {{kind}} profile`,{kind:t.label}):h(`ai.editProfile`,`Edit {{name}}`,{name:r.name}),Y=e=>{let n=tt(e);return n===null?i(G,{variant:`warning`,message:h(`ai.unknownWidget`,`This provider needs an editor part this build does not have ({{id}}).`,{id:e})}):i(n,{descriptor:t,providerConfig:b,onProviderConfigChange:x,model:w,onModelChange:T},e)};return i(le,{open:!0,onClose:s,title:oe,error:m,width:`lg`,testId:`ai-profile-editor`,footer:e(u,{children:[z.length>0&&i(X,{variant:`warning`,children:h(`ai.missingRequired`,`required: {{fields}}`,{fields:z.join(`, `)})}),z.length===0&&B&&i(X,{variant:`warning`,children:h(`ai.completeProvider`,`complete the provider settings`)}),z.length===0&&!B&&w.id.trim()===``&&i(X,{variant:`warning`,children:h(`ai.pickModelFirst`,`pick a model`)}),e(K,{size:`sm`,type:`button`,disabled:W,onClick:ae,children:[p&&i(O,{className:`h-3.5 w-3.5 animate-spin`}),r===null?h(`ai.createProfile`,`Create profile`):h(`ai.saveChanges`,`Save changes`)]})]}),children:e(`div`,{className:g,children:[e(`div`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`ai-editor-provider`,children:[i(nt,{kind:t,className:`h-4 w-4 text-foreground-subtle`}),i(`span`,{className:`text-xs font-medium text-foreground`,children:t.label}),i(X,{variant:`neutral`,children:t.addonId}),c!==void 0&&e(K,{size:`sm`,variant:`ghost`,type:`button`,onClick:c,children:[i(k,{className:`h-3.5 w-3.5`}),h(`ai.changeKind`,`Change type`)]})]}),i(pe,{label:h(`ai.name`,`Name`),required:!0,children:i(q,{id:`ai-profile-name`,"aria-label":h(`ai.name`,`Name`),value:v,onChange:e=>y(e.target.value),placeholder:t.label})}),re&&i(J,{headingId:`ai-editor-connection`,title:h(`ai.sectionConnection`,`Connection`),actions:V?e(K,{size:`sm`,variant:`secondary`,type:`button`,disabled:P.isPending,onClick:()=>P.mutate(),"data-testid":`ai-verify-models`,children:[P.isPending?i(O,{className:`h-3.5 w-3.5 animate-spin`}):i(f,{className:`h-3.5 w-3.5`}),h(`ai.verifyModels`,`Verify & load models`)]}):void 0,children:e(`div`,{className:`p-2 sm:p-3 lg:p-4 space-y-3`,children:[it(t.connectionSchema).length>0&&i(de,{bare:!0,schema:t.connectionSchema,values:b,onChange:x}),j.map(e=>Y(e.id)),N&&i(`p`,{className:`text-[10px] text-foreground-subtle`,children:h(`ai.secretHint`,`A stored API key is never shown. Leave it as-is to keep it; type a new value to replace it.`)}),P.data?.ok===!0&&i(X,{variant:`success`,"data-testid":`ai-models-found`,children:h(`ai.modelsFound`,`{{count}} models found`,{count:P.data.models.length})}),P.data?.ok===!1&&i(G,{title:h(ct[P.data.code]?.key??`ai.listNetwork`,ct[P.data.code]?.fallback??`Endpoint unreachable`),message:P.data.message}),P.isError&&i(G,{message:P.error instanceof Error?P.error.message:h(`common.error`,`Error`)})]})}),i(J,{headingId:`ai-editor-model`,title:h(`ai.sectionModel`,`Model`),children:e(`div`,{className:`${d} space-y-3`,children:[M===null?e(u,{children:[F.length>0&&i(se,{id:`ai-model-pick`,"aria-label":h(`ai.selectModel`,`Select a model…`),value:I===void 0?``:I.id,options:[{value:``,label:h(`ai.selectModel`,`Select a model…`)},...F.map(e=>({value:e.id,label:e.label??e.id}))],onChange:e=>{e.target.value!==``&&U(e.target.value)}}),i(pe,{label:h(`ai.customModel`,`Model id`),description:h(`ai.customModelHint`,`Pick one from the list, or type any model id the provider accepts.`),required:!0,children:i(q,{id:`ai-model-id`,"aria-label":h(`ai.customModel`,`Model id`),value:w.id,onChange:e=>T({...w,id:e.target.value}),placeholder:F[0]?.id??`model-id`})})]}):Y(M.id),e(`div`,{className:`flex flex-wrap items-center gap-1.5`,"data-testid":`ai-model-features`,children:[(w.supportsVision||!t.visionEditable&&L.vision)&&i(X,{variant:`info`,children:h(`ai.featureVision`,`vision`)}),L.tools&&i(X,{variant:`neutral`,children:h(`ai.featureTools`,`tools`)}),L.streaming&&i(X,{variant:`neutral`,children:h(`ai.featureStreaming`,`streaming`)})]}),t.visionEditable&&i(pe,{orientation:`horizontal`,label:h(`ai.supportsVision`,`Supports vision`),description:h(`ai.supportsVisionHint`,`A vision call against a text-only profile is refused, never downgraded.`),children:i(H,{checked:w.supportsVision,onCheckedChange:e=>T({...w,supportsVision:e}),"aria-label":h(`ai.supportsVision`,`Supports vision`)})})]})}),ne!==null&&i(J,{headingId:`ai-editor-generation`,title:h(`ai.sectionGeneration`,`Generation`),children:i(`div`,{className:`p-2 sm:p-3 lg:p-4`,children:i(de,{bare:!0,schema:ne,values:S,onChange:C})})}),(R!==null||t.advancedSchema!==void 0)&&i(ie,{expanded:E,onExpandedChange:ee,header:i(`span`,{className:`text-[11px] font-semibold uppercase tracking-wider text-foreground-subtle`,children:h(`ai.sectionAdvanced`,`Advanced`)}),children:e(`div`,{className:`p-2 sm:p-3 lg:p-4 space-y-3`,children:[R!==null&&i(de,{bare:!0,schema:R,values:S,onChange:C}),t.advancedSchema!==void 0&&i(de,{bare:!0,schema:t.advancedSchema,values:b,onChange:x})]})})]})})}c();function dt(t){return[{key:`name`,header:t.t(`ai.colProfile`,`Profile`),render:n=>{let r=t.kindByName.get(n.kind);return e(`span`,{className:`flex items-center gap-2`,children:[i(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface`,title:r?.label??n.kind,children:r===void 0?i(`span`,{className:`text-xs text-foreground-subtle`,children:`?`}):i(nt,{kind:r,className:`h-4 w-4 text-foreground-subtle`})}),e(`span`,{className:`min-w-0`,children:[i(`span`,{className:`block truncate font-medium text-foreground`,children:n.name}),t.testResult?.id===n.id&&i(`span`,{className:`block truncate ${t.testResult.ok?`text-success`:`text-danger`}`,children:t.testResult.text})]})]})}},{key:`kind`,header:t.t(`ai.colKind`,`Kind`),nowrap:!0,render:e=>i(`span`,{className:`text-foreground-muted`,children:t.kindByName.get(e.kind)?.label??e.kind})},{key:`model`,header:t.t(`ai.colModel`,`Model`),render:e=>i(`span`,{className:`text-foreground`,children:e.model})},{key:`vision`,header:t.t(`ai.colVision`,`Vision`),align:`center`,nowrap:!0,render:e=>e.supportsVision?i(X,{variant:`info`,style:`outline`,children:t.t(`ai.vision`,`vision`)}):i(`span`,{className:`text-foreground-subtle`,children:`—`})},{key:`node`,header:t.t(`ai.colNode`,`Node`),nowrap:!0,render:e=>typeof e.providerConfig.nodeId==`string`?i(X,{variant:`default`,children:e.providerConfig.nodeId}):i(`span`,{className:`text-foreground-subtle`,children:`—`})},{key:`enabled`,header:t.t(`ai.colOn`,`On`),align:`center`,nowrap:!0,render:e=>i(H,{checked:e.enabled,onCheckedChange:()=>t.onToggle(e),"aria-label":Z.t(`system.aiProfilesTab.toggle`,`toggle {{name}}`,{name:e.name})})},{key:`actions`,header:``,align:`right`,nowrap:!0,render:n=>e(`span`,{className:`flex items-center justify-end gap-1`,children:[i(K,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>t.onTest(n),"aria-label":t.t(`ai.test`,`Test`),title:t.t(`ai.test`,`Test`),children:t.testingId===n.id?i(O,{className:`h-3.5 w-3.5 animate-spin`}):i(ne,{className:`h-3.5 w-3.5`})}),i(K,{size:`sm`,variant:`ghost`,type:`button`,disabled:!t.kindByName.has(n.kind),onClick:()=>t.onEdit(n),"aria-label":t.t(`common.edit`,`Edit`),title:t.t(`common.edit`,`Edit`),children:i(C,{className:`h-3.5 w-3.5`})}),i(K,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>t.onDelete(n),"aria-label":t.t(`common.delete`,`Delete`),title:t.t(`common.delete`,`Delete`),children:i(h,{className:`h-3.5 w-3.5 text-danger`})})]})}]}function ft(){let{t}=Q(),c=D(),{state:u,openEdit:f,close:p}=ce(),m=M(),[h,_]=o(null),[v,y]=o(null),[b,x]=o(null),S=s({queryKey:ye,queryFn:()=>c.trpcClient.llm.listProfiles.query({})}),C=s({queryKey:be,queryFn:async()=>(await c.trpcClient.llm.listProfileKinds.query({})).map(({connectionSchema:e,advancedSchema:t,...n})=>({...n,connectionSchema:e,...t===void 0?{}:{advancedSchema:t}}))}),w=()=>{S.refetch()},T=r(()=>{_(null),x(null),p()},[p]);a(()=>{u.mode===`closed`&&_(null)},[u.mode]);let E=l({mutationFn:e=>c.trpcClient.llm.upsertProfile.mutate({profile:e}),onSuccess:()=>{T(),w()},onError:e=>x(e instanceof Error?e.message:t(`ai.saveFailed`,`Save failed`))}),O=l({mutationFn:e=>c.trpcClient.llm.deleteProfile.mutate({addonId:e.addonId,profileId:e.id}),onSuccess:w}),ee=l({mutationFn:e=>c.trpcClient.llm.testProfile.mutate({addonId:e.addonId,profileId:e.id}),onSuccess:(e,t)=>y({id:t.id,ok:e.ok,text:e.ok?Z.t(`system.aiProfilesTab.testOk`,{text:e.text,tokens:e.usage.outputTokens,ms:e.latencyMs}):`${e.code}: ${e.message}`})}),k=S.data??[],A=n(()=>C.data??[],[C.data]),N=n(()=>{let e=new Map;for(let t of A)e.set(t.kind,t);return e},[A]),P=u.mode===`edit`?k.find(e=>e.id===u.id)??null:null,te=P===null?null:N.get(P.kind)??null,F=u.mode===`new`&&h===null,I=u.mode===`new`?h:te,L=u.mode===`edit`?P:null,ne=I!==null&&(u.mode===`new`||L!==null),R=async e=>{await m({title:t(`ai.deleteProfileTitle`,`Delete profile?`),message:t(`ai.deleteProfileMessage`,`Delete "{{name}}". Features that name it will no longer get an answer from it.`,{name:e.name}),confirmLabel:t(`common.delete`,`Delete`),variant:`danger`})&&O.mutate(e)};return e(`div`,{className:g,children:[i(pt,{profiles:k}),i(J,{headingId:`ai-profiles-list`,title:t(`ai.profilesList`,`Profiles`),children:S.isPending?e(`div`,{className:`${d} space-y-2`,"data-testid":`ai-profiles-loading`,children:[i(U,{className:`h-8 w-full`}),i(U,{className:`h-8 w-full`}),i(U,{className:`h-8 w-full`})]}):S.isError?i(`div`,{className:d,children:i(G,{title:t(`ai.loadFailed`,`Failed to load profiles`),message:S.error instanceof Error?S.error.message:t(`common.error`,`Error`),onRetry:()=>void S.refetch()})}):k.length===0?i(V,{icon:j,title:t(`ai.noProfilesTitle`,`No AI profiles yet`),description:t(`ai.noProfiles`,`No AI profiles yet. Click "Add profile" to configure one.`)}):i(W,{columns:dt({kindByName:N,testResult:v,testingId:ee.isPending?ee.variables?.id??null:null,t,onToggle:e=>E.mutate({...e,enabled:!e.enabled}),onTest:e=>ee.mutate(e),onEdit:e=>{N.has(e.kind)&&(x(null),_(null),f(e.id))},onDelete:e=>void R(e)}),rows:k,rowKey:e=>e.id,minWidthPx:760,bordered:!1,maxBodyHeight:z})}),F&&i(rt,{kinds:A,onCancel:T,onPick:e=>{x(null),_(e)}}),ne&&I!==null&&i(ut,{kind:I,existing:L,saving:E.isPending,error:b,onSave:e=>E.mutate(e),onCancel:T,...u.mode===`new`?{onChangeKind:()=>{x(null),_(null)}}:{}})]})}function pt({profiles:t}){let{t:n}=Q(),r=D(),a=s({queryKey:xe,queryFn:()=>r.trpcClient.llm.getDefaults.query({})}),o=l({mutationFn:e=>r.trpcClient.llm.setDefault.mutate({selector:{purpose:e.purpose},profileId:e.profileId}),onSuccess:()=>{a.refetch()}}),c=e=>(a.data??[]).find(t=>`purpose`in t.selector&&t.selector.purpose===e)?.profileId??``,u=e=>e===`vision`?n(`ai.defaultVision`,`Default vision profile`):n(`ai.defaultText`,`Default text profile`);return i(J,{headingId:`ai-profiles-defaults`,title:n(`ai.defaultsTitle`,`Defaults`),children:i(`div`,{className:`${d} grid gap-4 sm:grid-cols-2`,children:Te.map(({purpose:r,visionOnly:a})=>{let s=a?t.filter(e=>e.supportsVision):t,l=c(r),d=t.find(e=>e.id===l);return e(`div`,{children:[i(ae,{className:`mb-1 block`,htmlFor:`llm-default-${r}`,children:u(r)}),i(se,{id:`llm-default-${r}`,"aria-label":u(r),value:l,onChange:e=>o.mutate({purpose:r,profileId:e.target.value===``?null:e.target.value}),options:[{value:``,label:n(`ai.none`,`None`)},...l!==``&&!s.some(e=>e.id===l)?[{value:l,label:d?.name??l}]:[],...s.map(e=>({value:e.id,label:`${e.name} · ${e.model}`}))]}),l!==``&&d===void 0&&i(`p`,{className:`mt-1 text-xs text-danger`,children:n(`ai.defaultMissing`,`This default names a profile that no longer exists.`)}),d!==void 0&&!d.enabled&&i(`p`,{className:`mt-1 text-xs text-warning`,children:n(`ai.defaultDisabled`,`This default profile is disabled — callers resolve to no profile.`)}),o.error!=null&&i(`p`,{className:`mt-1 text-xs text-danger`,children:String(o.error)})]},r)})})})}c();var mt=5e3;function ht(e){return Z.t(`system.aiRuntimes.sizeGb`,{value:(e/1e9).toFixed(1)})}function gt(){let{t}=Q(),r=D(),a=s({queryKey:Se,refetchInterval:mt,queryFn:()=>r.trpcClient.llm.listRuntimeNodes.query({})}),o=n(()=>[{key:`node`,header:t(`ai.colNode`,`Node`),render:e=>i(`span`,{className:`font-medium text-foreground`,children:e.nodeId})},{key:`state`,header:t(`ai.colState`,`State`),nowrap:!0,render:n=>e(`span`,{className:`flex items-center gap-1.5`,children:[i(X,{variant:Fe(n),children:n.reachable?n.status?.state??t(`ai.ready`,`ready`):t(`ai.unreachable`,`unreachable`)}),n.status?.downloadProgress!==void 0&&i(X,{variant:`info`,children:`${String(Math.round(n.status.downloadProgress*100))}%`})]})},{key:`model`,header:t(`ai.colModel`,`Model`),render:e=>i(`span`,{className:`text-foreground`,children:e.status?.modelId??`—`})},{key:`disk`,header:t(`ai.colDisk`,`On disk`),align:`right`,nowrap:!0,render:e=>i(`span`,{className:`tabular-nums text-foreground-muted`,children:e.disk===void 0?`—`:ht(e.disk.modelsBytes)})},{key:`features`,header:t(`ai.colFeatures`,`Features`),render:n=>{let r=Ie(n);if(r.length===0)return i(`span`,{className:`text-foreground-subtle`,children:`—`});let a=r.flatMap(e=>e.detail===null?[]:[e.detail]);return e(`span`,{className:`flex flex-col items-start gap-0.5`,children:[i(`span`,{className:`flex flex-wrap gap-1`,children:r.map(e=>i(X,{variant:e.tone,children:t(e.labelKey)},e.id))}),a.length>0&&i(`span`,{className:`text-foreground-subtle`,children:a.join(` · `)})]})}},{key:`error`,header:t(`ai.colError`,`Error`),render:e=>e.error===void 0?i(`span`,{className:`text-foreground-subtle`,children:`—`}):i(`span`,{className:`text-danger`,children:e.error})}],[t]),c=a.data??[];return i(J,{headingId:`ai-runtimes-list`,title:t(`ai.runtimesList`,`Nodes`),children:a.isPending?e(`div`,{className:`${d} space-y-2`,"data-testid":`ai-runtimes-loading`,children:[i(U,{className:`h-8 w-full`}),i(U,{className:`h-8 w-full`})]}):a.isError?i(`div`,{className:d,children:i(G,{title:t(`ai.runtimesFailed`,`Failed to read runtime nodes`),message:a.error instanceof Error?a.error.message:t(`common.error`,`Error`),onRetry:()=>void a.refetch()})}):c.length===0?i(V,{icon:T,title:t(`ai.noRuntimesTitle`,`No runtime nodes`),description:t(`ai.noRuntimes`,`No node advertises the llm-runtime capability.`)}):i(W,{columns:o,rows:c,rowKey:e=>e.nodeId,minWidthPx:760,bordered:!1,maxBodyHeight:z})})}var _t=x(`/addon/ai/test-chat`),vt=x(`/addon/ai/test-chat/chats`),yt=6e5;function bt(e){let t=e.firstTokenTimeoutMs;if(!(typeof t!=`number`||!Number.isFinite(t)||t<=0))return Math.min(Math.round(t),yt)}function xt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function St(e){if(!xt(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 Ct=[`resolving-image`,`connecting`,`first-token-wait`,`streaming`];function wt(e){let t;try{t=JSON.parse(e)}catch{return null}if(!xt(t))return null;switch(t.kind){case`status`:{let e=Ct.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:St(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:Z.t(`helpers.aiTestChat.providerError`)};default:return null}}async function*Tt(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=wt(e);t!==null&&(yield t)}a=r.indexOf(`
|
|
3
|
-
`)}}let e=r.trim();if(e.length>0){let t=wt(e);t!==null&&(yield t)}}finally{t.releaseLock()}}function Et(e){return e.filter(e=>e.failed!==!0&&e.content.length>0).map(e=>({role:e.role,content:e.content}))}function Dt(e){return e.thumbnailBase64===void 0||e.thumbnailBase64.length===0?null:`data:${e.mimeType};base64,${e.thumbnailBase64}`}function Ot(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 kt(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 At(e,t){switch(e){case`resolving-image`:return Z.t(`helpers.aiTestChat.phaseImage`);case`connecting`:return Z.t(`helpers.aiTestChat.phaseConnecting`);case`first-token-wait`:return t>0?Z.t(`helpers.aiTestChat.phaseWaitUpTo`,{seconds:Math.round(t/1e3)}):Z.t(`helpers.aiTestChat.phaseWait`);case`streaming`:return Z.t(`helpers.aiTestChat.phaseAnswering`)}}c();var jt=[`pipelineAnalytics`,`listRecentTracks`,`ai-test`],Mt=360*60*1e3,Nt=40,Pt=160,Ft={phase:`connecting`,firstTokenTimeoutMs:0,text:``,mediaSent:null};function It(){let{t:c}=Q(),l=D(),[u,f]=o(``),[p,m]=o(``),[y,b]=o(``),[x,S]=o([]),[C,w]=o(null),[T,E]=o(`none`),[O,k]=o(`throwaway`),[A,j]=o(null),[M,P]=o([]),[te,F]=o(null),[I,L]=o(null),z=t(null);a(()=>()=>z.current?.abort(),[]);let B=r(async()=>{let e=await fetch(vt,{credentials:`same-origin`});e.ok&&P((await e.json()).chats??[])},[]);a(()=>{O===`persistent`&&B()},[O,B]);let V=s({queryKey:ye,queryFn:()=>l.trpcClient.llm.listProfiles.query({})}),re=n(()=>(V.data??[]).filter(e=>e.enabled),[V.data]),H=re.find(e=>e.id===u)??null,U=I!==null,ie=r(async(e,t)=>{let n=new AbortController;z.current=n,F(null);let r=bt(H??{});L({...Ft,firstTokenTimeoutMs:r??0});let i=``,a=null,o,s=null,l=null,d;try{let c=await fetch(_t,{method:`POST`,headers:{"content-type":`application/json`},credentials:`same-origin`,signal:n.signal,body:JSON.stringify({profileId:u,messages:e,...p.trim()===``?{}:{system:p.trim()},...t===void 0?{}:{attachment:t},...r===void 0?{}:{firstTokenTimeoutMs:r},...O===`persistent`?{persist:!0,...A===null?{}:{conversationId:A}}:{}})});if(!c.ok||c.body===null){let e=await c.text().catch(()=>``);throw Error(e.length>0?e:`HTTP ${String(c.status)}`)}for await(let e of Tt(c.body))switch(e.kind){case`status`:L(t=>({...t??Ft,phase:e.phase}));break;case`meta`:a=e.mediaSent,o=e.model,L(t=>({...t??Ft,firstTokenTimeoutMs:e.firstTokenTimeoutMs,mediaSent:e.mediaSent}));break;case`token`:i+=e.text,L(e=>({...e??Ft,text:i}));break;case`done`:l={outputTokens:e.outputTokens,latencyMs:e.latencyMs},d=e.conversationId;break;case`error`:s=`${e.code}: ${e.message}`;break}}catch(e){n.signal.aborted||F(e instanceof Error?e.message:c(`common.error`,`Error`))}finally{z.current=null,L(null)}d!==void 0&&(j(d),B());let f=n.signal.aborted&&i.length>0;s===null&&i.length===0&&!f||S(e=>[...e,{id:`a-${String(Date.now())}`,role:`assistant`,content:s??i,...s===null?{}:{failed:!0},...a===null?{}:{attachment:a},...o!==void 0&&s===null?{model:o}:{},...l===null?{}:l}])},[O,A,H,u,B,p,c]),W=r(()=>{let e=y.trim();if(e===``||u===``||U)return;let t={id:`u-${String(Date.now())}`,role:`user`,content:e,...C===null?{}:{attachmentLabel:C.label,attachmentKind:C.ref.kind}},n=[...x,t];S(n),b(``);let r=C?.ref;w(null),E(`none`),ie(O===`persistent`&&A!==null?[{role:`user`,content:e}]:Et(n),r)},[O,A,y,C,u,ie,U,x]),oe=()=>z.current?.abort(),Y=()=>{z.current?.abort(),S([]),w(null),b(``),F(null),L(null),j(null)},ce=async e=>{z.current?.abort();let t=await fetch(`${vt}/${e}`,{credentials:`same-origin`});if(!t.ok)return;let n=await t.json();j(e),S(Ot(n)),L(null),F(null)};return e(`div`,{className:g,children:[i(J,{headingId:`ai-test-setup`,title:c(`ai.testSetup`,`Setup`),children:e(`div`,{className:`${d} space-y-3`,children:[e(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[e(`div`,{children:[i(ae,{className:`mb-1 block`,htmlFor:`ai-test-profile`,children:c(`ai.profile`,`Profile`)}),i(se,{id:`ai-test-profile`,value:u,onChange:e=>f(e.target.value),options:[{value:``,label:c(`ai.selectProfile`,`Select a profile…`)},...re.map(e=>({value:e.id,label:`${e.name} · ${e.model}${e.supportsVision?` · vision`:``}`}))]}),re.length===0&&!V.isLoading&&i(`p`,{className:`mt-1 text-xs text-foreground-subtle`,children:c(`ai.noEnabledProfiles`,`No enabled profile. Add one on the Profiles tab.`)})]}),e(`div`,{children:[i(ae,{className:`mb-1 block`,htmlFor:`ai-test-system`,children:c(`ai.systemPrompt`,`System prompt (optional)`)}),i(q,{id:`ai-test-system`,value:p,onChange:e=>m(e.target.value),placeholder:c(`ai.systemPlaceholder`,`Answer in one short sentence.`)})]})]}),i(fe,{label:c(`ai.chatMode`,`Conversation mode`),value:O,options:[{value:`throwaway`,label:c(`ai.throwawayMode`,`Throwaway`)},{value:`persistent`,label:c(`ai.saveConversation`,`Save conversation`)}],onChange:e=>{k(e),e===`throwaway`&&j(null)}}),O===`persistent`&&e(`div`,{className:`space-y-2`,children:[i(`p`,{className:`text-xs text-foreground-subtle`,children:c(`ai.testSubtitlePersistent`,`Conversations are saved for you and can be reopened. Throwaway mode is still available.`)}),e(K,{size:`sm`,variant:`secondary`,type:`button`,onClick:Y,children:[i(R,{className:`h-3.5 w-3.5`}),c(`ai.newChat`,`New chat`)]}),M.length>0&&i(`div`,{className:`max-h-36 divide-y divide-border overflow-y-auto rounded-md border border-border`,children:M.map(e=>i(`button`,{type:`button`,onClick:()=>void ce(e.id),className:`flex w-full px-2.5 py-1.5 text-left text-xs hover:bg-surface-hover ${e.id===A?`bg-primary/10`:``}`,children:i(`span`,{className:`min-w-0 flex-1 truncate text-foreground`,children:e.title})},e.id))})]}),i(`p`,{className:`text-xs text-foreground-subtle`,children:c(`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.`)}),H!==null&&!H.supportsVision&&i(`p`,{className:`text-xs text-warning`,children:c(`ai.notVision`,`This profile is not vision-capable — an attached image will be refused before anything is read.`)})]})}),te!==null&&i(G,{title:c(`ai.chatFailed`,`The test call failed`),message:te}),e(J,{headingId:`ai-test-conversation`,title:c(`ai.testConversation`,`Conversation`),actions:e(K,{size:`sm`,variant:`ghost`,type:`button`,disabled:x.length===0&&C===null,onClick:Y,children:[i(h,{className:`h-3.5 w-3.5`}),c(`ai.clearChat`,`Clear`)]}),children:[i(Lt,{turns:x,live:I}),e(`div`,{className:`${d} space-y-2 border-t border-border`,children:[C!==null&&e(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-background px-2.5 py-1.5`,children:[C.ref.kind===`snapshot`?i(v,{className:`h-3.5 w-3.5 text-foreground-subtle`}):i(_,{className:`h-3.5 w-3.5 text-foreground-subtle`}),i(`span`,{className:`min-w-0 flex-1 truncate text-xs text-foreground`,children:C.label}),i(ue,{size:`sm`,variant:`ghost`,type:`button`,icon:ee,"aria-label":c(`ai.removeAttachment`,`Remove attachment`),onClick:()=>w(null)})]}),e(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e(K,{size:`sm`,variant:T===`snapshot`?`primary`:`outline`,type:`button`,onClick:()=>E(T===`snapshot`?`none`:`snapshot`),children:[i(v,{className:`h-3.5 w-3.5`}),c(`ai.attachSnapshot`,`Camera snapshot`)]}),e(K,{size:`sm`,variant:T===`track`?`primary`:`outline`,type:`button`,onClick:()=>E(T===`track`?`none`:`track`),children:[i(_,{className:`h-3.5 w-3.5`}),c(`ai.attachTrack`,`Recent track`)]})]}),T===`snapshot`&&i(Bt,{onPick:(e,t)=>{w({ref:{kind:`snapshot`,deviceId:e.id},label:c(`ai.snapshotOf`,`Snapshot of {{name}}`,{name:t})}),E(`none`)}}),T===`track`&&i(Ht,{onPick:(e,t)=>{w({ref:{kind:`track`,trackId:e.trackId,deviceId:e.deviceId},label:c(`ai.trackOf`,`{{class}} on {{name}}`,{class:e.label??e.className,name:t})}),E(`none`)}}),e(`div`,{className:`flex items-center gap-2`,children:[i(q,{value:y,onChange:e=>b(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),W())},placeholder:c(`ai.messagePlaceholder`,`Ask the model something…`),"aria-label":c(`ai.message`,`Message`)}),U?e(K,{size:`sm`,variant:`secondary`,type:`button`,onClick:oe,children:[i(N,{className:`h-3.5 w-3.5`}),c(`ai.stop`,`Stop`)]}):e(K,{size:`sm`,type:`button`,disabled:y.trim()===``||u===``,onClick:W,children:[i(ne,{className:`h-3.5 w-3.5`}),c(`ai.send`,`Send`)]})]})]})]})]})}function Lt({turns:t,live:n}){let{t:r}=Q();return t.length===0&&n===null?i(V,{icon:L,title:r(`ai.chatEmptyTitle`,`No messages yet`),description:r(`ai.chatEmpty`,`Pick a profile, optionally attach a camera snapshot or a recent track, and send a message. Nothing here is saved.`)}):e(`div`,{className:`max-h-[50vh] space-y-2 overflow-y-auto ${d}`,children:[t.map(e=>i(Rt,{turn:e},e.id)),n!==null&&e(`div`,{className:`space-y-1`,children:[n.mediaSent!==null&&i(zt,{attachment:n.mediaSent}),n.text.length>0&&i(Rt,{turn:{id:`live`,role:`assistant`,content:n.text},streaming:!0}),e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[i(O,{className:`h-3.5 w-3.5 animate-spin`}),At(n.phase,n.firstTokenTimeoutMs)]})]})]})}function Rt({turn:t,streaming:n=!1}){let{t:r}=Q(),a=t.role===`user`,o=t.failed===!0?`border-danger/40 bg-danger/10`:`border-border bg-surface`;return i(`div`,{className:`flex ${a?`justify-end`:`justify-start`}`,children:e(`div`,{className:`max-w-[85%] rounded-lg border px-3 py-2 ${a?`border-primary/40 bg-primary/10`:o}`,children:[e(`p`,{className:`whitespace-pre-wrap break-words text-xs text-foreground`,children:[t.content,n&&i(`span`,{className:`ml-0.5 animate-pulse text-primary`,children:`▌`})]}),t.attachment!==void 0&&i(zt,{attachment:t.attachment}),t.attachmentLabel!==void 0&&e(`p`,{className:`mt-1 flex items-center gap-1 text-[10px] text-foreground-subtle`,children:[t.attachmentKind===`track`?i(_,{className:`h-3 w-3`}):i(v,{className:`h-3 w-3`}),t.attachmentLabel]}),t.attachment!==void 0&&e(`p`,{className:`mt-1 flex items-center gap-1 text-[10px] text-foreground-subtle`,children:[t.attachment.kind===`snapshot`?i(v,{className:`h-3 w-3`}):i(_,{className:`h-3 w-3`}),kt(t.attachment)]}),t.model!==void 0&&i(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:r(`system.aiTestChat.tokMs`,`{{model}} · {{value2}} tok · {{value3}} ms`,{model:t.model,value2:String(t.outputTokens??0),value3:String(t.latencyMs??0)})})]})})}function zt({attachment:e}){let{t}=Q(),n=Dt(e);return n===null?null:i(`img`,{src:n,alt:t(`system.aiTestChat.sentToTheModel`,`sent to the model`),className:`mt-1 max-h-32 rounded-md border border-border object-contain`})}function Bt({onPick:e}){let{t}=Q(),n=oe({isCamera:!0,projection:`slim`}),r=(n.data??[]).filter(e=>!e.disabled);return n.isLoading?i(O,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):r.length===0?i(`p`,{className:`text-[11px] text-foreground-subtle`,children:t(`ai.noCameras`,`No camera found.`)}):i(`div`,{className:`grid max-h-56 grid-cols-2 gap-2 overflow-y-auto sm:grid-cols-4`,children:r.map(t=>i(Vt,{device:t,onPick:e},t.id))})}function Vt({device:t,onPick:n}){let{t:r}=Q(),a=re(t,`compact`),{src:o}=m(t.id,{width:Pt});return e(`button`,{type:`button`,onClick:()=>n(t,a),className:`overflow-hidden rounded-md border border-border bg-surface text-left transition-colors hover:border-primary/50`,children:[i(`span`,{className:`block aspect-video w-full bg-background-elevated`,children:o!==null&&i(`img`,{src:o,alt:``,className:`h-full w-full object-cover`,loading:`lazy`})}),e(`span`,{className:`flex items-center gap-1 px-2 py-1`,children:[!t.online&&i(X,{variant:`warning`,children:r(`common.off`)}),i(`span`,{className:`truncate text-[10px] text-foreground`,children:a})]})]})}function Ht({onPick:t}){let{t:r}=Q(),a=D(),o=oe({isCamera:!0,projection:`slim`}),c=n(()=>(o.data??[]).map(e=>e.id),[o.data]),l=n(()=>{let e=new Map;for(let t of o.data??[])e.set(t.id,t.name);return e},[o.data]),u=s({queryKey:[...jt,c.length],enabled:c.length>0,queryFn:()=>a.trpcClient.pipelineAnalytics.listRecentTracks.query({deviceIds:[...c],since:Date.now()-Mt,limit:Nt,projection:`slim`})});if(o.isLoading||u.isLoading)return i(O,{className:`h-4 w-4 animate-spin text-foreground-subtle`});let d=u.data?.tracks??[];return d.length===0?i(`p`,{className:`text-[11px] text-foreground-subtle`,children:r(`ai.noTracks`,`No track in the last 6 hours.`)}):i(`div`,{className:`max-h-56 divide-y divide-border overflow-y-auto rounded-md border border-border`,children:d.map(n=>e(`button`,{type:`button`,onClick:()=>t(n,l.get(n.deviceId)??String(n.deviceId)),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-[11px] hover:bg-surface-hover`,children:[i(_,{className:`h-3.5 w-3.5 shrink-0 text-foreground-subtle`}),i(`span`,{className:`min-w-0 flex-1 truncate text-foreground`,children:n.label??n.className}),i(`span`,{className:`shrink-0 text-foreground-subtle`,children:l.get(n.deviceId)??n.deviceId}),i(`span`,{className:`shrink-0 text-foreground-subtle`,children:new Date(n.lastSeen).toLocaleTimeString()})]},n.trackId))})}c();var Ut=1440*60*1e3,Wt=[1,7,30,90];function Gt(){let{t}=Q(),r=D(),[a,c]=o(7),l=n(()=>{let e=new Date;return e.setHours(0,0,0,0),e.getTime()-(a-1)*Ut},[a]),u=s({queryKey:ye,queryFn:()=>r.trpcClient.llm.listProfiles.query({})}),f=s({queryKey:[...we,a],queryFn:()=>r.trpcClient.llm.getUsage.query({since:l})}),p=n(()=>{let e=new Map;for(let t of u.data??[])e.set(t.id,t.name);return e},[u.data]),m=n(()=>[{key:`day`,header:t(`ai.colDay`,`Day`),nowrap:!0,render:e=>i(`span`,{className:`tabular-nums`,children:e.day})},{key:`consumer`,header:t(`ai.colConsumer`,`Consumer`),nowrap:!0,render:e=>i(`span`,{className:`text-foreground`,children:e.consumer})},{key:`profile`,header:t(`ai.colProfile`,`Profile`),render:e=>i(`span`,{className:`text-foreground`,children:p.get(e.profileId)??e.profileId})},{key:`calls`,header:t(`ai.colCalls`,`Calls`),align:`right`,nowrap:!0,render:e=>i(`span`,{className:`tabular-nums`,children:String(e.calls)})},{key:`okErr`,header:t(`ai.colOkErr`,`OK / err`),align:`right`,nowrap:!0,render:e=>i(`span`,{className:`tabular-nums ${e.errorCalls>0?`text-danger`:``}`,children:`${String(e.okCalls)} / ${String(e.errorCalls)}`})},{key:`tokens`,header:t(`ai.colTokens`,`In / out tok`),align:`right`,nowrap:!0,render:e=>i(`span`,{className:`tabular-nums`,children:`${String(e.inputTokens)} / ${String(e.outputTokens)}`})},{key:`latency`,header:t(`ai.colAvgMs`,`Avg ms`),align:`right`,nowrap:!0,render:e=>i(`span`,{className:`tabular-nums`,children:String(Math.round(e.avgLatencyMs))})}],[p,t]),h=f.data??[],g=i(`div`,{className:`w-36`,children:i(se,{"aria-label":t(`ai.window`,`Window`),value:String(a),options:Wt.map(e=>({value:String(e),label:t(`ai.lastDays`,`Last {{days}} days`,{days:e})})),onChange:e=>c(Number(e.target.value))})});return i(J,{headingId:`ai-usage-list`,title:t(`ai.usageList`,`Rollup`),actions:g,children:f.isPending?e(`div`,{className:`${d} space-y-2`,"data-testid":`ai-usage-loading`,children:[i(U,{className:`h-8 w-full`}),i(U,{className:`h-8 w-full`}),i(U,{className:`h-8 w-full`})]}):f.isError?i(`div`,{className:d,children:i(G,{title:t(`ai.usageFailed`,`Failed to read usage`),message:f.error instanceof Error?f.error.message:t(`common.error`,`Error`),onRetry:()=>void f.refetch()})}):h.length===0?i(V,{icon:b,title:t(`ai.noUsage`,`No AI calls in this window.`)}):i(W,{columns:m,rows:h,rowKey:e=>`${e.day}|${e.consumer}|${e.profileId}`,minWidthPx:720,bordered:!1,maxBodyHeight:z})})}var Kt=`llm`,qt=[`profiles`,`runtimes`,`usage`,`test`],Jt=[`new`,`edit`];function Yt(e){return qt.some(t=>t===e)}function Xt(){let{t}=Q(),n=B(Kt),[r]=he(),{openNew:a}=ce(),o=me(`/system/ai`,{t,isAdmin:!0})??{icon:j,title:t(`system.ai`,`AI`)};if(n!==`present`)return i(_e,{icon:o.icon,title:o.title,children:i(Zt,{presence:n})});let s=r.get(`tab`),c=Yt(s)?s:`profiles`,l={profiles:t(`ai.profilesSubtitle`,`One row = one usable model endpoint. The defaults below decide who answers when a feature names no profile.`),runtimes:t(`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.`),usage:t(`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.`),test:t(`ai.testSubtitle`,`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.`)},u=c===`profiles`?e(K,{size:`sm`,type:`button`,"data-testid":`ai-add-profile`,onClick:a,children:[i(p,{className:`h-3.5 w-3.5`}),t(`ai.addProfile`,`Add profile`)]}):void 0;return i(ge,{icon:o.icon,title:o.title,subtitle:l[c],actions:u,defaultSection:`profiles`,sectionsLabel:`${o.title} sections`,sections:[{id:`profiles`,label:t(`ai.tabProfiles`,`Profiles`),content:i(ft,{}),ownedParams:Jt},{id:`runtimes`,label:t(`ai.tabRuntimes`,`Runtimes`),content:i(gt,{})},{id:`usage`,label:t(`ai.tabUsage`,`Usage`),content:i(Gt,{})},{id:`test`,label:t(`ai.tabTest`,`Test`),content:i(It,{})}]})}function Zt({presence:t}){let{t:n}=Q();return t===`pending`?e(`div`,{className:`space-y-3`,"data-testid":`ai-presence-pending`,children:[i(U,{className:`h-8 w-64`}),i(U,{className:`h-40 w-full`})]}):t===`unknown`?i(G,{title:n(`ai.presenceUnknownTitle`,`Could not check whether AI is installed`),message:n(`ai.presenceUnknown`,`The hub did not answer the capability check. Reload the page to try again.`)}):i(V,{icon:j,title:n(`ai.absentTitle`,`AI is not installed`),description:n(`ai.absentDescription`,`Install the AI addon from System → Addons to add model profiles.`)})}export{Xt as AiProfilesPage,Xt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ca as e}from"./player-overlays-B_erfGbP.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ca as e}from"./player-overlays-B_erfGbP.js";var t=e(`crop`,[[`path`,{d:`M6 2v14a2 2 0 0 0 2 2h14`,key:`ron5a4`}],[`path`,{d:`M18 22V8a2 2 0 0 0-2-2H2`,key:`7s9ehn`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./src-RqdhpHCS.js";
|