@northpeak/swarmai 0.0.1 → 0.0.3
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/dashboard/assets/bee-icon-BGLs4H9f.png +0 -0
- package/dashboard/assets/core-DhEqZVGG.js +2 -0
- package/dashboard/assets/core-DhEqZVGG.js.map +1 -0
- package/dashboard/assets/event-BK_86lmQ.js +2 -0
- package/dashboard/assets/event-BK_86lmQ.js.map +1 -0
- package/dashboard/assets/events-BPKUtuuR.js +3 -0
- package/dashboard/assets/events-BPKUtuuR.js.map +1 -0
- package/dashboard/assets/hub-icon-C01CRzKV.png +0 -0
- package/dashboard/assets/index-B9qRjiTt.css +32 -0
- package/dashboard/assets/index-LxLpkLv_.js +900 -0
- package/dashboard/assets/index-LxLpkLv_.js.map +1 -0
- package/dashboard/assets/inter-cyrillic-400-normal-HOLc17fK.woff +0 -0
- package/dashboard/assets/inter-cyrillic-400-normal-obahsSVq.woff2 +0 -0
- package/dashboard/assets/inter-cyrillic-500-normal-BasfLYem.woff2 +0 -0
- package/dashboard/assets/inter-cyrillic-500-normal-CxZf_p3X.woff +0 -0
- package/dashboard/assets/inter-cyrillic-600-normal-4D_pXhcN.woff +0 -0
- package/dashboard/assets/inter-cyrillic-600-normal-CWCymEST.woff2 +0 -0
- package/dashboard/assets/inter-cyrillic-700-normal-CjBOestx.woff2 +0 -0
- package/dashboard/assets/inter-cyrillic-700-normal-DrXBdSj3.woff +0 -0
- package/dashboard/assets/inter-cyrillic-ext-400-normal-BQZuk6qB.woff2 +0 -0
- package/dashboard/assets/inter-cyrillic-ext-400-normal-DQukG94-.woff +0 -0
- package/dashboard/assets/inter-cyrillic-ext-500-normal-B0yAr1jD.woff2 +0 -0
- package/dashboard/assets/inter-cyrillic-ext-500-normal-BmqWE9Dz.woff +0 -0
- package/dashboard/assets/inter-cyrillic-ext-600-normal-Bcila6Z-.woff +0 -0
- package/dashboard/assets/inter-cyrillic-ext-600-normal-Dfes3d0z.woff2 +0 -0
- package/dashboard/assets/inter-cyrillic-ext-700-normal-BjwYoWNd.woff2 +0 -0
- package/dashboard/assets/inter-cyrillic-ext-700-normal-LO58E6JB.woff +0 -0
- package/dashboard/assets/inter-greek-400-normal-B4URO6DV.woff2 +0 -0
- package/dashboard/assets/inter-greek-400-normal-q2sYcFCs.woff +0 -0
- package/dashboard/assets/inter-greek-500-normal-BIZE56-Y.woff2 +0 -0
- package/dashboard/assets/inter-greek-500-normal-Xzm54t5V.woff +0 -0
- package/dashboard/assets/inter-greek-600-normal-BZpKdvQh.woff +0 -0
- package/dashboard/assets/inter-greek-600-normal-plRanbMR.woff2 +0 -0
- package/dashboard/assets/inter-greek-700-normal-BUv2fZ6O.woff +0 -0
- package/dashboard/assets/inter-greek-700-normal-C3JjAnD8.woff2 +0 -0
- package/dashboard/assets/inter-greek-ext-400-normal-DGGRlc-M.woff2 +0 -0
- package/dashboard/assets/inter-greek-ext-400-normal-KugGGMne.woff +0 -0
- package/dashboard/assets/inter-greek-ext-500-normal-2j5mBUwD.woff +0 -0
- package/dashboard/assets/inter-greek-ext-500-normal-C4iEst2y.woff2 +0 -0
- package/dashboard/assets/inter-greek-ext-600-normal-B8X0CLgF.woff +0 -0
- package/dashboard/assets/inter-greek-ext-600-normal-DRtmH8MT.woff2 +0 -0
- package/dashboard/assets/inter-greek-ext-700-normal-BoQ6DsYi.woff +0 -0
- package/dashboard/assets/inter-greek-ext-700-normal-qfdV9bQt.woff2 +0 -0
- package/dashboard/assets/inter-latin-400-normal-C38fXH4l.woff2 +0 -0
- package/dashboard/assets/inter-latin-400-normal-CyCys3Eg.woff +0 -0
- package/dashboard/assets/inter-latin-500-normal-BL9OpVg8.woff +0 -0
- package/dashboard/assets/inter-latin-500-normal-Cerq10X2.woff2 +0 -0
- package/dashboard/assets/inter-latin-600-normal-CiBQ2DWP.woff +0 -0
- package/dashboard/assets/inter-latin-600-normal-LgqL8muc.woff2 +0 -0
- package/dashboard/assets/inter-latin-700-normal-BLAVimhd.woff +0 -0
- package/dashboard/assets/inter-latin-700-normal-Yt3aPRUw.woff2 +0 -0
- package/dashboard/assets/inter-latin-ext-400-normal-77YHD8bZ.woff +0 -0
- package/dashboard/assets/inter-latin-ext-400-normal-C1nco2VV.woff2 +0 -0
- package/dashboard/assets/inter-latin-ext-500-normal-BxGbmqWO.woff +0 -0
- package/dashboard/assets/inter-latin-ext-500-normal-CV4jyFjo.woff2 +0 -0
- package/dashboard/assets/inter-latin-ext-600-normal-CIVaiw4L.woff +0 -0
- package/dashboard/assets/inter-latin-ext-600-normal-D2bJ5OIk.woff2 +0 -0
- package/dashboard/assets/inter-latin-ext-700-normal-Ca8adRJv.woff2 +0 -0
- package/dashboard/assets/inter-latin-ext-700-normal-TidjK2hL.woff +0 -0
- package/dashboard/assets/inter-vietnamese-400-normal-Bbgyi5SW.woff +0 -0
- package/dashboard/assets/inter-vietnamese-400-normal-DMkecbls.woff2 +0 -0
- package/dashboard/assets/inter-vietnamese-500-normal-DOriooB6.woff2 +0 -0
- package/dashboard/assets/inter-vietnamese-500-normal-mJboJaSs.woff +0 -0
- package/dashboard/assets/inter-vietnamese-600-normal-BuLX-rYi.woff +0 -0
- package/dashboard/assets/inter-vietnamese-600-normal-Cc8MFFhd.woff2 +0 -0
- package/dashboard/assets/inter-vietnamese-700-normal-BZaoP0fm.woff +0 -0
- package/dashboard/assets/inter-vietnamese-700-normal-DlLaEgI2.woff2 +0 -0
- package/dashboard/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
- package/dashboard/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
- package/dashboard/assets/jetbrains-mono-cyrillic-500-normal-DJqRU3vO.woff +0 -0
- package/dashboard/assets/jetbrains-mono-cyrillic-500-normal-DmUKJPL_.woff2 +0 -0
- package/dashboard/assets/jetbrains-mono-cyrillic-600-normal-8K4wrrwR.woff +0 -0
- package/dashboard/assets/jetbrains-mono-cyrillic-600-normal-EVf6-Yzo.woff2 +0 -0
- package/dashboard/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
- package/dashboard/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
- package/dashboard/assets/jetbrains-mono-greek-500-normal-D7SFKleX.woff +0 -0
- package/dashboard/assets/jetbrains-mono-greek-500-normal-JpySY46c.woff2 +0 -0
- package/dashboard/assets/jetbrains-mono-greek-600-normal-H7WoG9Et.woff2 +0 -0
- package/dashboard/assets/jetbrains-mono-greek-600-normal-mc2nkWzM.woff +0 -0
- package/dashboard/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/dashboard/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dashboard/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- package/dashboard/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
- package/dashboard/assets/jetbrains-mono-latin-600-normal-BfsvjouI.woff +0 -0
- package/dashboard/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
- package/dashboard/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
- package/dashboard/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
- package/dashboard/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
- package/dashboard/assets/jetbrains-mono-latin-ext-500-normal-ckzbgY84.woff +0 -0
- package/dashboard/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
- package/dashboard/assets/jetbrains-mono-latin-ext-600-normal-DObL3zCW.woff +0 -0
- package/dashboard/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
- package/dashboard/assets/jetbrains-mono-vietnamese-500-normal-DNRqzVM1.woff +0 -0
- package/dashboard/assets/jetbrains-mono-vietnamese-600-normal-OWROknRo.woff +0 -0
- package/dashboard/assets/space-grotesk-latin-500-normal-CNSSEhBt.woff +0 -0
- package/dashboard/assets/space-grotesk-latin-500-normal-lFbtlQH6.woff2 +0 -0
- package/dashboard/assets/space-grotesk-latin-600-normal-BflQw4A9.woff +0 -0
- package/dashboard/assets/space-grotesk-latin-600-normal-DjKNqYRj.woff2 +0 -0
- package/dashboard/assets/space-grotesk-latin-700-normal-CwsQ-cCU.woff +0 -0
- package/dashboard/assets/space-grotesk-latin-700-normal-RjhwGPKo.woff2 +0 -0
- package/dashboard/assets/space-grotesk-latin-ext-500-normal-3dgZTiw9.woff +0 -0
- package/dashboard/assets/space-grotesk-latin-ext-500-normal-DUe3BAxM.woff2 +0 -0
- package/dashboard/assets/space-grotesk-latin-ext-600-normal-DxxdqCpr.woff2 +0 -0
- package/dashboard/assets/space-grotesk-latin-ext-600-normal-VcznFIpX.woff +0 -0
- package/dashboard/assets/space-grotesk-latin-ext-700-normal-BQnZhY3m.woff2 +0 -0
- package/dashboard/assets/space-grotesk-latin-ext-700-normal-HVCqSBdx.woff +0 -0
- package/dashboard/assets/space-grotesk-vietnamese-500-normal-BTqKIpxg.woff +0 -0
- package/dashboard/assets/space-grotesk-vietnamese-500-normal-BmEvtly_.woff2 +0 -0
- package/dashboard/assets/space-grotesk-vietnamese-600-normal-D6zpsUhD.woff +0 -0
- package/dashboard/assets/space-grotesk-vietnamese-600-normal-DUi7WF5p.woff2 +0 -0
- package/dashboard/assets/space-grotesk-vietnamese-700-normal-DMty7AZE.woff2 +0 -0
- package/dashboard/assets/space-grotesk-vietnamese-700-normal-Duxec5Rn.woff +0 -0
- package/dashboard/assets/tray-B3r8IGF8.js +2 -0
- package/dashboard/assets/tray-B3r8IGF8.js.map +1 -0
- package/dashboard/assets/updater-_PHjdeOI.js +2 -0
- package/dashboard/assets/updater-_PHjdeOI.js.map +1 -0
- package/dashboard/bee-180.png +0 -0
- package/dashboard/bee-32.png +0 -0
- package/dashboard/bee-64.png +0 -0
- package/dashboard/bee.png +0 -0
- package/dashboard/index.html +26 -0
- package/package.json +4 -3
- package/swarmai.js +179 -179
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as a,s as f,u as o,a as u,_ as y}from"./index-LxLpkLv_.js";function s(n,e,t){return t||n==="fallback-mock"?"mock":n==="open"&&e!=="down"?"connected":n==="connecting"||n==="reconnecting"?"reconnecting":"down"}async function l(n,e){if(!a())return null;try{const{invoke:t}=await y(async()=>{const{invoke:d}=await import("./core-DhEqZVGG.js");return{invoke:d}},[]);return await t(n,e)}catch(t){return console.warn(`[tauri-bridge] invoke ${n} failed`,t),null}}async function c(n){await l("update_tray_connection",{status:n})}async function _(n){const e=n.map(t=>({id:t.id,displayName:t.displayName,role:t.role,status:t.status}));await l("update_tray_agent_list",{agents:e})}let i=null;function g(){if(!a())return;i?.();const n=o.getState();c(s(n.ws,n.api,u())),i=o.subscribe((e,t)=>{(e.ws!==t.ws||e.api!==t.api)&&c(s(e.ws,e.api,u()))})}let r=null;function w(){a()&&(r?.(),r=f(n=>{_(n)}))}function T(){i?.(),i=null,r?.(),r=null}export{T as __resetTrayBridge,s as deriveTrayState,_ as updateTrayAgentList,c as updateTrayConnectionState,w as wireAgentRosterToTray,g as wireConnectionToTray};
|
|
2
|
+
//# sourceMappingURL=tray-B3r8IGF8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":"oEAuBO,SAASA,EACdC,EACAC,EACAC,EACmB,CACnB,OAAIA,GAAQF,IAAO,gBAAwB,OACvCA,IAAO,QAAUC,IAAQ,OAAe,YACxCD,IAAO,cAAgBA,IAAO,eAAuB,eAClD,MACT,CAEA,eAAeG,EAAwBC,EAAaC,EAAmD,CACrG,GAAI,CAACC,EAAA,EAAW,OAAO,KACvB,GAAI,CACF,KAAM,CAAE,OAAAC,CAAA,EAAW,MAAAC,EAAA,uBAAAD,GAAA,KAAM,QAAO,oBAAsB,gBAAAA,CAAA,OACtD,OAAQ,MAAMA,EAAOH,EAAKC,CAAI,CAChC,OAASI,EAAK,CACZ,eAAQ,KAAK,yBAAyBL,CAAG,UAAWK,CAAG,EAChD,IACT,CACF,CAGA,eAAsBC,EAA0BC,EAAyC,CACvF,MAAMR,EAAW,yBAA0B,CAAE,OAAQQ,EAAO,CAC9D,CAGA,eAAsBC,EAAoBC,EAAoC,CAC5E,MAAMC,EAAaD,EAAO,IAAKE,IAAO,CACpC,GAAIA,EAAE,GACN,YAAaA,EAAE,YACf,KAAMA,EAAE,KACR,OAAQA,EAAE,QACV,EACF,MAAMZ,EAAW,yBAA0B,CAAE,OAAQW,EAAY,CACnE,CAMA,IAAIE,EAAuC,KACpC,SAASC,GAA6B,CAC3C,GAAI,CAACX,IAAW,OAChBU,IAAA,EAEA,MAAME,EAAIC,EAAmB,WACxBT,EAA0BX,EAAgBmB,EAAE,GAAIA,EAAE,IAAKE,EAAA,CAAY,CAAC,EACzEJ,EAAkBG,EAAmB,UAAU,CAACR,EAAOU,IAAS,EAC1DV,EAAM,KAAOU,EAAK,IAAMV,EAAM,MAAQU,EAAK,MACxCX,EAA0BX,EAAgBY,EAAM,GAAIA,EAAM,IAAKS,EAAA,CAAY,CAAC,CAErF,CAAC,CACH,CAOA,IAAIE,EAAmC,KAChC,SAASC,GAA8B,CACvCjB,MACLgB,IAAA,EACAA,EAAcE,EAAiBX,GAAW,CACnCD,EAAoBC,CAAM,CACjC,CAAC,EACH,CAGO,SAASY,GAA0B,CACxCT,IAAA,EACAA,EAAkB,KAClBM,IAAA,EACAA,EAAc,IAChB","names":["deriveTrayState","ws","api","mock","safeInvoke","cmd","args","isTauri","invoke","__vitePreload","err","updateTrayConnectionState","state","updateTrayAgentList","agents","summarised","a","unsubConnection","wireConnectionToTray","s","useConnectionStore","isMockMode","prev","unsubAgents","wireAgentRosterToTray","subscribeAgents","__resetTrayBridge"],"ignoreList":[],"sources":["../../src/tauri-bridge/tray.ts"],"sourcesContent":["/**\r\n * Tray bridge — push frontend state into the system tray.\r\n *\r\n * The Rust shell owns the tray icon + menu; this module is the thin\r\n * adapter that translates store changes into `invoke()` calls so the\r\n * tray stays in sync with what the user sees in the dashboard.\r\n *\r\n * All exports are safe in web mode (they resolve to no-ops).\r\n */\r\n\r\nimport { isTauri } from './index.js';\r\nimport { useConnectionStore, type WsStatus, type ApiStatus } from '../services/connectionStore.js';\r\nimport { isMockMode } from '../services/eventStream.js';\r\nimport { subscribeAgents } from '../services/agentRegistry.js';\r\nimport type { AgentInfo } from '../types/agent.js';\r\n\r\nexport type TrayConnectionTag = 'connected' | 'reconnecting' | 'down' | 'mock';\r\n\r\n/**\r\n * Map the dashboard's WsStatus + ApiStatus into the four-state tag the\r\n * tray icon understands. The tray is intentionally coarse — users\r\n * don't need to see every backoff transition.\r\n */\r\nexport function deriveTrayState(\r\n ws: WsStatus,\r\n api: ApiStatus,\r\n mock: boolean,\r\n): TrayConnectionTag {\r\n if (mock || ws === 'fallback-mock') return 'mock';\r\n if (ws === 'open' && api !== 'down') return 'connected';\r\n if (ws === 'connecting' || ws === 'reconnecting') return 'reconnecting';\r\n return 'down';\r\n}\r\n\r\nasync function safeInvoke<T = unknown>(cmd: string, args?: Record<string, unknown>): Promise<T | null> {\r\n if (!isTauri()) return null;\r\n try {\r\n const { invoke } = await import('@tauri-apps/api/core');\r\n return (await invoke(cmd, args)) as T;\r\n } catch (err) {\r\n console.warn(`[tauri-bridge] invoke ${cmd} failed`, err);\r\n return null;\r\n }\r\n}\r\n\r\n/** Push the current connection state to the tray. Safe in web mode. */\r\nexport async function updateTrayConnectionState(state: TrayConnectionTag): Promise<void> {\r\n await safeInvoke('update_tray_connection', { status: state });\r\n}\r\n\r\n/** Push the agent roster to the tray menu. */\r\nexport async function updateTrayAgentList(agents: AgentInfo[]): Promise<void> {\r\n const summarised = agents.map((a) => ({\r\n id: a.id,\r\n displayName: a.displayName,\r\n role: a.role,\r\n status: a.status,\r\n }));\r\n await safeInvoke('update_tray_agent_list', { agents: summarised });\r\n}\r\n\r\n/**\r\n * Subscribe the connection store to the tray; called once at boot.\r\n * Idempotent — second call replaces the prior subscription.\r\n */\r\nlet unsubConnection: (() => void) | null = null;\r\nexport function wireConnectionToTray(): void {\r\n if (!isTauri()) return;\r\n unsubConnection?.();\r\n // Push initial state.\r\n const s = useConnectionStore.getState();\r\n void updateTrayConnectionState(deriveTrayState(s.ws, s.api, isMockMode()));\r\n unsubConnection = useConnectionStore.subscribe((state, prev) => {\r\n if (state.ws !== prev.ws || state.api !== prev.api) {\r\n void updateTrayConnectionState(deriveTrayState(state.ws, state.api, isMockMode()));\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Wire the agent roster into the tray. Subscribes to the live\r\n * agentRegistry; the registry itself owns the WS bridge + 30s\r\n * backstop poll. Tray menu re-syncs every time the roster changes.\r\n */\r\nlet unsubAgents: (() => void) | null = null;\r\nexport function wireAgentRosterToTray(): void {\r\n if (!isTauri()) return;\r\n unsubAgents?.();\r\n unsubAgents = subscribeAgents((agents) => {\r\n void updateTrayAgentList(agents);\r\n });\r\n}\r\n\r\n/** Test hook. */\r\nexport function __resetTrayBridge(): void {\r\n unsubConnection?.();\r\n unsubConnection = null;\r\n unsubAgents?.();\r\n unsubAgents = null;\r\n}\r\n"],"file":"assets/tray-B3r8IGF8.js"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as s,_ as l}from"./index-LxLpkLv_.js";let o=!1;async function c(){if(typeof Notification>"u")return"denied";if(Notification.permission==="granted")return"granted";if(Notification.permission==="denied")return"denied";if(o)return Notification.permission;o=!0;try{return await Notification.requestPermission()}catch{return"denied"}}async function n(t,i,r={}){if(s()){try{const{invoke:a}=await l(async()=>{const{invoke:u}=await import("./core-DhEqZVGG.js");return{invoke:u}},[]);await a("notify_user",{title:t,body:i})}catch(a){console.warn("[tauri-bridge] notify failed",a)}return}if(await c()==="granted")try{const a=new Notification(t,{body:i});r.url&&(a.onclick=()=>{window.focus(),window.location.href=r.url})}catch(a){console.warn("[tauri-bridge] web notification failed",a)}}async function f(t={}){if(!s())return!1;let i;try{i=await import(["@tauri-apps","plugin-updater"].join("/"))}catch(e){return console.warn("[tauri-bridge] updater plugin not available",e),!1}let r;try{r=await i.check()}catch(e){return console.warn("[tauri-bridge] update check failed",e),!1}if(!r||!r.available)return t.silentIfNone||await n("SwarmAI Console","You are running the latest version."),!1;await n("SwarmAI Console — update available",`Version ${r.version??"unknown"} is downloading. The app will restart when ready.`);try{await r.downloadAndInstall(e=>{console.debug("[tauri-bridge] update progress",e)}),await n("SwarmAI Console","Update installed. Restart to apply.");try{await(await import(["@tauri-apps","plugin-process"].join("/"))).relaunch()}catch(e){console.warn("[tauri-bridge] relaunch failed; user must restart manually",e)}return!0}catch(e){return console.warn("[tauri-bridge] update install failed",e),await n("SwarmAI Console",`Update failed: ${e.message}`),!1}}export{f as checkForUpdates};
|
|
2
|
+
//# sourceMappingURL=updater-_PHjdeOI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":"+CAmBA,IAAIA,EAAsB,GAE1B,eAAeC,GAAwD,CACrE,GAAI,OAAO,aAAiB,IAAa,MAAO,SAChD,GAAI,aAAa,aAAe,UAAW,MAAO,UAClD,GAAI,aAAa,aAAe,SAAU,MAAO,SACjD,GAAID,SAA4B,aAAa,WAC7CA,EAAsB,GACtB,GAAI,CACF,OAAO,MAAM,aAAa,mBAC5B,MAAQ,CACN,MAAO,QACT,CACF,CAMA,eAAsBE,EAAOC,EAAeC,EAAcC,EAAsB,GAAmB,CACjG,GAAIC,IAAW,CACb,GAAI,CACF,KAAM,CAAE,OAAAC,CAAA,EAAW,MAAAC,EAAA,uBAAAD,GAAA,KAAM,QAAO,oBAAsB,wBACtD,MAAMA,EAAO,cAAe,CAAE,MAAAJ,EAAO,KAAAC,EAAM,CAC7C,OAASK,EAAK,CACZ,QAAQ,KAAK,+BAAgCA,CAAG,CAClD,CACA,MACF,CAGA,GADmB,MAAMR,EAAA,IACN,UACnB,GAAI,CACF,MAAMS,EAAI,IAAI,aAAaP,EAAO,CAAE,KAAAC,EAAM,EACtCC,EAAK,MACPK,EAAE,QAAU,IAAM,CAChB,OAAO,QACP,OAAO,SAAS,KAAOL,EAAK,GAC9B,EAEJ,OAASI,EAAK,CACZ,QAAQ,KAAK,yCAA0CA,CAAG,CAC5D,CACF,CCnBA,eAAsBE,EAAgBC,EAAwB,GAAsB,CAClF,GAAI,CAACN,EAAA,EAAW,MAAO,GAEvB,IAAIO,EACJ,GAAI,CAOFA,EAAO,MAAM,OADS,CAAC,cAAe,gBAAgB,EAAE,KAAK,GAAG,EAElE,OAASJ,EAAK,CACZ,eAAQ,KAAK,8CAA+CA,CAAG,EACxD,EACT,CAEA,IAAIK,EACJ,GAAI,CACFA,EAAS,MAAMD,EAAI,OACrB,OAASJ,EAAK,CACZ,eAAQ,KAAK,qCAAsCA,CAAG,EAC/C,EACT,CAEA,GAAI,CAACK,GAAU,CAACA,EAAO,UACrB,OAAKF,EAAQ,cACX,MAAMV,EAAO,kBAAmB,qCAAqC,EAEhE,GAGT,MAAMA,EACJ,qCACA,WAAWY,EAAO,SAAW,SAAS,qDAGxC,GAAI,CACF,MAAMA,EAAO,mBAAoBC,GAAU,CAGzC,QAAQ,MAAM,iCAAkCA,CAAK,CACvD,CAAC,EACD,MAAMb,EAAO,kBAAmB,qCAAqC,EAErE,GAAI,CAKF,MADc,MAAM,OADE,CAAC,cAAe,gBAAgB,EAAE,KAAK,GAAG,IAErD,UACb,OAASO,EAAK,CACZ,QAAQ,KAAK,6DAA8DA,CAAG,CAChF,CACA,MAAO,EACT,OAASA,EAAK,CACZ,eAAQ,KAAK,uCAAwCA,CAAG,EACxD,MAAMP,EAAO,kBAAmB,kBAAmBO,EAAc,OAAO,EAAE,EACnE,EACT,CACF","names":["permissionRequested","requestWebPermission","notify","title","body","opts","isTauri","invoke","__vitePreload","err","n","checkForUpdates","options","mod","handle","event"],"ignoreList":[],"sources":["../../src/tauri-bridge/notification.ts","../../src/tauri-bridge/updater.ts"],"sourcesContent":["/**\r\n * Notification bridge — native OS toasts for important events.\r\n *\r\n * Used by:\r\n * - master-approval queue when a new gated action arrives,\r\n * - autonomy / supervisor escalations,\r\n * - long-running brief completion (the \"your report is ready\" ping).\r\n *\r\n * In web mode we fall back to the standard `Notification` API. Both\r\n * paths request permission lazily; callers don't need to gate.\r\n */\r\n\r\nimport { isTauri } from './index.js';\r\n\r\nexport interface NotifyOptions {\r\n /** Optional URL or anchor the user can click on; web mode only. */\r\n url?: string;\r\n}\r\n\r\nlet permissionRequested = false;\r\n\r\nasync function requestWebPermission(): Promise<NotificationPermission> {\r\n if (typeof Notification === 'undefined') return 'denied';\r\n if (Notification.permission === 'granted') return 'granted';\r\n if (Notification.permission === 'denied') return 'denied';\r\n if (permissionRequested) return Notification.permission;\r\n permissionRequested = true;\r\n try {\r\n return await Notification.requestPermission();\r\n } catch {\r\n return 'denied';\r\n }\r\n}\r\n\r\n/**\r\n * Fire a notification. Resolves once the OS / browser has accepted\r\n * the request; never throws.\r\n */\r\nexport async function notify(title: string, body: string, opts: NotifyOptions = {}): Promise<void> {\r\n if (isTauri()) {\r\n try {\r\n const { invoke } = await import('@tauri-apps/api/core');\r\n await invoke('notify_user', { title, body });\r\n } catch (err) {\r\n console.warn('[tauri-bridge] notify failed', err);\r\n }\r\n return;\r\n }\r\n\r\n const permission = await requestWebPermission();\r\n if (permission !== 'granted') return;\r\n try {\r\n const n = new Notification(title, { body });\r\n if (opts.url) {\r\n n.onclick = () => {\r\n window.focus();\r\n window.location.href = opts.url!;\r\n };\r\n }\r\n } catch (err) {\r\n console.warn('[tauri-bridge] web notification failed', err);\r\n }\r\n}\r\n","/**\r\n * Auto-updater bridge.\r\n *\r\n * Tauri 2's `tauri-plugin-updater` does the heavy lifting (signature\r\n * verification, download, install). We just expose a thin\r\n * `checkForUpdates()` that the bridge's init function fires on boot,\r\n * and that the tray's \"Check for Updates...\" menu item triggers\r\n * manually.\r\n *\r\n * Web mode: no-op. The dashboard hosted in a browser is updated by\r\n * Vite's normal cache-busted asset URLs (and a service-worker if/when\r\n * we add one); there is no installable artefact to replace.\r\n */\r\n\r\nimport { isTauri } from './index.js';\r\nimport { notify } from './notification.js';\r\n\r\nexport interface CheckOptions {\r\n /** When true, only show UI if an update is available. Default: false. */\r\n silentIfNone?: boolean;\r\n}\r\n\r\ninterface UpdaterModule {\r\n check(): Promise<UpdateHandle | null>;\r\n}\r\n\r\ninterface UpdateHandle {\r\n available: boolean;\r\n version?: string;\r\n body?: string;\r\n downloadAndInstall(progress?: (event: ProgressEvent) => void): Promise<void>;\r\n}\r\n\r\ninterface ProgressEvent {\r\n event: 'Started' | 'Progress' | 'Finished';\r\n data?: { contentLength?: number; chunkLength?: number };\r\n}\r\n\r\n/**\r\n * Check the configured update endpoint. Returns true if an update was\r\n * applied (caller should restart), false otherwise. Logs and resolves\r\n * without throwing on transport / config errors.\r\n */\r\nexport async function checkForUpdates(options: CheckOptions = {}): Promise<boolean> {\r\n if (!isTauri()) return false;\r\n\r\n let mod: UpdaterModule;\r\n try {\r\n // The optional Tauri plugins only exist inside a Tauri webview;\r\n // in a plain browser SPA Vite must not try to pre-bundle them.\r\n // `/* @vite-ignore */` was insufficient (Vite 5 still resolves\r\n // string-literal dynamic imports), so we build the specifier at\r\n // runtime — opaque to Vite's static analyser.\r\n const updaterModule = ['@tauri-apps', 'plugin-updater'].join('/');\r\n mod = (await import(/* @vite-ignore */ updaterModule)) as UpdaterModule;\r\n } catch (err) {\r\n console.warn('[tauri-bridge] updater plugin not available', err);\r\n return false;\r\n }\r\n\r\n let handle: UpdateHandle | null;\r\n try {\r\n handle = await mod.check();\r\n } catch (err) {\r\n console.warn('[tauri-bridge] update check failed', err);\r\n return false;\r\n }\r\n\r\n if (!handle || !handle.available) {\r\n if (!options.silentIfNone) {\r\n await notify('SwarmAI Console', 'You are running the latest version.');\r\n }\r\n return false;\r\n }\r\n\r\n await notify(\r\n 'SwarmAI Console — update available',\r\n `Version ${handle.version ?? 'unknown'} is downloading. The app will restart when ready.`,\r\n );\r\n\r\n try {\r\n await handle.downloadAndInstall((event) => {\r\n // Progress events arrive as { event: \"Started\" | \"Progress\" | \"Finished\" }.\r\n // We don't render a progress bar today; log for debug.\r\n console.debug('[tauri-bridge] update progress', event);\r\n });\r\n await notify('SwarmAI Console', 'Update installed. Restart to apply.');\r\n // Trigger graceful restart via the process plugin.\r\n try {\r\n // See updater plugin import above — runtime-constructed specifier\r\n // so Vite's static analyser cannot pre-resolve.\r\n const processModule = ['@tauri-apps', 'plugin-process'].join('/');\r\n const proc = (await import(/* @vite-ignore */ processModule)) as { relaunch(): Promise<void> };\r\n await proc.relaunch();\r\n } catch (err) {\r\n console.warn('[tauri-bridge] relaunch failed; user must restart manually', err);\r\n }\r\n return true;\r\n } catch (err) {\r\n console.warn('[tauri-bridge] update install failed', err);\r\n await notify('SwarmAI Console', `Update failed: ${(err as Error).message}`);\r\n return false;\r\n }\r\n}\r\n"],"file":"assets/updater-_PHjdeOI.js"}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en" data-theme="midnight-forge">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<meta name="color-scheme" content="dark light" />
|
|
7
|
+
<!-- QA-2026-05-09 #6 — bee favicon set. Source `bee.png` (1024px,
|
|
8
|
+
repo root) is the design master; the rendered icons live in
|
|
9
|
+
`public/` and are generated via the resize step in
|
|
10
|
+
scripts/build-favicons.mjs (see DEPLOY.md). The 32 px primary
|
|
11
|
+
keeps tab-icon download under 2 kB. -->
|
|
12
|
+
<link rel="icon" type="image/png" sizes="32x32" href="/bee-32.png" />
|
|
13
|
+
<link rel="icon" type="image/png" sizes="64x64" href="/bee-64.png" />
|
|
14
|
+
<link rel="apple-touch-icon" sizes="180x180" href="/bee-180.png" />
|
|
15
|
+
<title>SwarmAI Console</title>
|
|
16
|
+
<script type="module" crossorigin src="/assets/index-LxLpkLv_.js"></script>
|
|
17
|
+
<link rel="stylesheet" crossorigin href="/assets/index-B9qRjiTt.css">
|
|
18
|
+
</head>
|
|
19
|
+
<body class="bg-bg-base text-fg-primary antialiased">
|
|
20
|
+
<div id="root"></div>
|
|
21
|
+
<!-- Runtime config — populated by `swarmai ui` so the dashboard knows
|
|
22
|
+
which agent server to talk to without per-port rebuilds. Falls
|
|
23
|
+
back gracefully when missing (Tauri / Vite dev / static export). -->
|
|
24
|
+
<script src="/runtime-config.js"></script>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@northpeak/swarmai",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "SwarmAI — your personal multi-channel AI assistant.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"swarmai": "swarmai.js"
|
|
7
|
+
"swarmai": "./swarmai.js"
|
|
8
8
|
},
|
|
9
|
-
"main": "swarmai.js",
|
|
9
|
+
"main": "./swarmai.js",
|
|
10
10
|
"files": [
|
|
11
11
|
"swarmai.js",
|
|
12
12
|
"server.js",
|
|
13
13
|
"plugins/",
|
|
14
|
+
"dashboard/",
|
|
14
15
|
"bee.png",
|
|
15
16
|
"README.md",
|
|
16
17
|
"LICENSE"
|