@elizaos/capacitor-desktop 1.0.0 → 2.0.3-beta.2

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/plugin.js CHANGED
@@ -6,40 +6,173 @@ var capacitorDesktop = (function (exports, core) {
6
6
  web: loadWeb,
7
7
  });
8
8
 
9
+ const BROWSER_PERMISSION_IDS = new Set([
10
+ "camera",
11
+ "microphone",
12
+ "location",
13
+ "notifications",
14
+ ]);
15
+ const SAFE_EXTERNAL_PROTOCOLS = new Set(["http:", "https:", "mailto:", "tel:"]);
16
+ function assertSafeExternalUrl(url) {
17
+ if (typeof url !== "string" || url.trim().length === 0) {
18
+ throw new Error("url must be a non-empty external URL");
19
+ }
20
+ let parsed;
21
+ try {
22
+ parsed = new URL(url);
23
+ }
24
+ catch {
25
+ throw new Error("url must be a valid external URL");
26
+ }
27
+ if (!SAFE_EXTERNAL_PROTOCOLS.has(parsed.protocol)) {
28
+ throw new Error("url protocol is not allowed");
29
+ }
30
+ return parsed.toString();
31
+ }
32
+ function getDesktopRpc() {
33
+ const g = globalThis;
34
+ if (typeof window !== "undefined") {
35
+ return window.__ELIZA_ELECTROBUN_RPC__;
36
+ }
37
+ return g.window?.__ELIZA_ELECTROBUN_RPC__ ?? g.__ELIZA_ELECTROBUN_RPC__;
38
+ }
39
+ function currentPlatform() {
40
+ const proc = globalThis.process;
41
+ const p = proc?.platform;
42
+ if (p === "darwin" || p === "win32" || p === "linux")
43
+ return p;
44
+ if (typeof navigator !== "undefined") {
45
+ const platform = navigator.platform.toLowerCase();
46
+ if (platform.includes("mac"))
47
+ return "darwin";
48
+ if (platform.includes("win"))
49
+ return "win32";
50
+ }
51
+ return "linux";
52
+ }
53
+ function isRecord(value) {
54
+ return Boolean(value) && typeof value === "object";
55
+ }
56
+ function isDesktopPermissionState(value, id) {
57
+ return (isRecord(value) &&
58
+ value.id === id &&
59
+ typeof value.status === "string" &&
60
+ typeof value.canRequest === "boolean" &&
61
+ typeof value.lastChecked === "number");
62
+ }
63
+ function stateFromStatus(id, status, options = {}) {
64
+ const state = {
65
+ id,
66
+ status,
67
+ lastChecked: options.lastChecked ?? Date.now(),
68
+ canRequest: options.canRequest ?? status === "not-determined",
69
+ platform: options.platform ?? currentPlatform(),
70
+ };
71
+ if (options.lastRequested !== undefined) {
72
+ state.lastRequested = options.lastRequested;
73
+ }
74
+ if (options.restrictedReason !== undefined) {
75
+ state.restrictedReason = options.restrictedReason;
76
+ }
77
+ return state;
78
+ }
79
+ function mapBrowserPermissionState(state) {
80
+ if (state === "granted")
81
+ return "granted";
82
+ if (state === "denied")
83
+ return "denied";
84
+ if (state === "prompt" || state === "default")
85
+ return "not-determined";
86
+ return null;
87
+ }
88
+ async function queryBrowserPermission(id) {
89
+ if (!BROWSER_PERMISSION_IDS.has(id) || typeof navigator === "undefined") {
90
+ return null;
91
+ }
92
+ if (id === "notifications" && typeof Notification !== "undefined") {
93
+ const status = mapBrowserPermissionState(Notification.permission);
94
+ return status ? stateFromStatus(id, status) : null;
95
+ }
96
+ if (!navigator.permissions?.query) {
97
+ return null;
98
+ }
99
+ const permissionName = id === "location" ? "geolocation" : id;
100
+ try {
101
+ const result = await navigator.permissions.query({
102
+ name: permissionName,
103
+ });
104
+ const status = mapBrowserPermissionState(result.state);
105
+ return status ? stateFromStatus(id, status) : null;
106
+ }
107
+ catch {
108
+ return null;
109
+ }
110
+ }
111
+ async function requestBrowserPermission(id) {
112
+ if (!BROWSER_PERMISSION_IDS.has(id) || typeof navigator === "undefined") {
113
+ return null;
114
+ }
115
+ if (id === "camera" || id === "microphone") {
116
+ try {
117
+ const stream = await navigator.mediaDevices?.getUserMedia?.({
118
+ video: id === "camera",
119
+ audio: id === "microphone",
120
+ });
121
+ for (const track of stream?.getTracks?.() ?? []) {
122
+ track.stop();
123
+ }
124
+ }
125
+ catch {
126
+ // Query below returns denied when the browser recorded a denial.
127
+ }
128
+ const checked = await queryBrowserPermission(id);
129
+ return checked ? { ...checked, lastRequested: Date.now() } : null;
130
+ }
131
+ if (id === "location" && navigator.geolocation) {
132
+ const requestedStatus = await new Promise((resolve) => {
133
+ navigator.geolocation.getCurrentPosition(() => resolve("granted"), (err) => resolve(err.code === err.PERMISSION_DENIED ? "denied" : null), { maximumAge: 0, timeout: 10000 });
134
+ });
135
+ const checked = await queryBrowserPermission(id);
136
+ if (checked)
137
+ return { ...checked, lastRequested: Date.now() };
138
+ return requestedStatus
139
+ ? stateFromStatus(id, requestedStatus, { lastRequested: Date.now() })
140
+ : null;
141
+ }
142
+ if (id === "notifications" && typeof Notification !== "undefined") {
143
+ const status = mapBrowserPermissionState(await Notification.requestPermission());
144
+ return status
145
+ ? stateFromStatus(id, status, { lastRequested: Date.now() })
146
+ : null;
147
+ }
148
+ return queryBrowserPermission(id);
149
+ }
9
150
  class DesktopWeb extends core.WebPlugin {
10
151
  constructor() {
11
152
  super(...arguments);
12
153
  this.pluginListeners = [];
13
154
  }
14
155
  // System Tray - Not available in browser
15
- async createTray(_options) {
16
- }
17
- async updateTray(_options) {
18
- }
19
- async destroyTray() {
20
- }
21
- async setTrayMenu(_options) {
22
- }
156
+ async createTray(_options) { }
157
+ async updateTray(_options) { }
158
+ async destroyTray() { }
159
+ async setTrayMenu(_options) { }
23
160
  // Global Shortcuts - Not available in browser
24
161
  async registerShortcut(_options) {
25
162
  return { success: false };
26
163
  }
27
- async unregisterShortcut(_options) {
28
- }
29
- async unregisterAllShortcuts() {
30
- }
164
+ async unregisterShortcut(_options) { }
165
+ async unregisterAllShortcuts() { }
31
166
  async isShortcutRegistered(_options) {
32
167
  return { registered: false };
33
168
  }
34
169
  // Auto Launch - Not available in browser
35
- async setAutoLaunch(_options) {
36
- }
170
+ async setAutoLaunch(_options) { }
37
171
  async getAutoLaunchStatus() {
38
172
  return { enabled: false, openAsHidden: false };
39
173
  }
40
174
  // Window Management - Limited in browser
41
- async setWindowOptions(_options) {
42
- }
175
+ async setWindowOptions(_options) { }
43
176
  async getWindowBounds() {
44
177
  return {
45
178
  x: window.screenX,
@@ -48,22 +181,17 @@ var capacitorDesktop = (function (exports, core) {
48
181
  height: window.outerHeight,
49
182
  };
50
183
  }
51
- async setWindowBounds(_options) {
52
- }
53
- async minimizeWindow() {
54
- }
55
- async maximizeWindow() {
56
- }
57
- async unmaximizeWindow() {
58
- }
184
+ async setWindowBounds(_options) { }
185
+ async minimizeWindow() { }
186
+ async maximizeWindow() { }
187
+ async unmaximizeWindow() { }
59
188
  async closeWindow() {
60
189
  window.close();
61
190
  }
62
191
  async showWindow() {
63
192
  window.focus();
64
193
  }
65
- async hideWindow() {
66
- }
194
+ async hideWindow() { }
67
195
  async focusWindow() {
68
196
  window.focus();
69
197
  }
@@ -79,15 +207,13 @@ var capacitorDesktop = (function (exports, core) {
79
207
  async isWindowFocused() {
80
208
  return { focused: document.hasFocus() };
81
209
  }
82
- async setAlwaysOnTop(_options) {
83
- }
210
+ async setAlwaysOnTop(_options) { }
84
211
  async setFullscreen(options) {
85
212
  options.flag
86
213
  ? document.documentElement.requestFullscreen()
87
214
  : document.exitFullscreen();
88
215
  }
89
- async setOpacity(_options) {
90
- }
216
+ async setOpacity(_options) { }
91
217
  // Notifications - Using Web Notification API
92
218
  async showNotification(options) {
93
219
  const id = `notification_${Date.now()}`;
@@ -129,10 +255,14 @@ var capacitorDesktop = (function (exports, core) {
129
255
  if (getBattery) {
130
256
  try {
131
257
  const battery = await getBattery.call(navigator);
258
+ const level = typeof battery.level === "number" && Number.isFinite(battery.level)
259
+ ? Math.max(0, Math.min(100, battery.level * 100))
260
+ : undefined;
261
+ const charging = typeof battery.charging === "boolean" ? battery.charging : undefined;
132
262
  return {
133
- onBattery: !battery.charging,
134
- batteryLevel: battery.level * 100,
135
- isCharging: battery.charging,
263
+ onBattery: charging === undefined ? false : !charging,
264
+ batteryLevel: level,
265
+ isCharging: charging,
136
266
  idleState: "active", // Idle detection not available on web
137
267
  idleTime: 0,
138
268
  };
@@ -193,10 +323,9 @@ var capacitorDesktop = (function (exports, core) {
193
323
  }
194
324
  // Shell
195
325
  async openExternal(options) {
196
- window.open(options.url, "_blank");
197
- }
198
- async showItemInFolder(_options) {
326
+ window.open(assertSafeExternalUrl(options.url), "_blank", "noopener");
199
327
  }
328
+ async showItemInFolder(_options) { }
200
329
  async beep() {
201
330
  const ctx = new AudioContext();
202
331
  const osc = ctx.createOscillator();
@@ -257,6 +386,42 @@ var capacitorDesktop = (function (exports, core) {
257
386
  l.callback(data);
258
387
  });
259
388
  }
389
+ async checkPermission(options) {
390
+ const rpc = getDesktopRpc();
391
+ const request = rpc?.request?.permissionsCheck;
392
+ if (request) {
393
+ const bridged = await request.call(rpc.request, { id: options.id });
394
+ if (isDesktopPermissionState(bridged, options.id))
395
+ return bridged;
396
+ }
397
+ const browserState = await queryBrowserPermission(options.id);
398
+ if (browserState)
399
+ return browserState;
400
+ return {
401
+ id: options.id,
402
+ status: "not-applicable",
403
+ restrictedReason: "platform_unsupported",
404
+ lastChecked: Date.now(),
405
+ canRequest: false,
406
+ platform: currentPlatform(),
407
+ };
408
+ }
409
+ async requestPermission(options) {
410
+ const rpc = getDesktopRpc();
411
+ const request = rpc?.request?.permissionsRequest;
412
+ if (request) {
413
+ const bridged = await request.call(rpc.request, { id: options.id });
414
+ if (isDesktopPermissionState(bridged, options.id)) {
415
+ if (bridged.status === "not-determined" &&
416
+ BROWSER_PERMISSION_IDS.has(options.id)) {
417
+ return (await requestBrowserPermission(options.id)) ?? bridged;
418
+ }
419
+ return bridged;
420
+ }
421
+ }
422
+ return ((await requestBrowserPermission(options.id)) ??
423
+ this.checkPermission({ id: options.id }));
424
+ }
260
425
  }
261
426
 
262
427
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nexport * from \"./definitions\";\nconst loadWeb = () => import(\"./web\").then((m) => new m.DesktopWeb());\nexport const Desktop = registerPlugin(\"Desktop\", {\n web: loadWeb,\n});\n","import { WebPlugin } from \"@capacitor/core\";\n// No-op for features unavailable on web; callers should check return values.\nconst webUnavailable = (_feature) => { };\nexport class DesktopWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.pluginListeners = [];\n }\n // System Tray - Not available in browser\n async createTray(_options) {\n webUnavailable(\"System tray\");\n }\n async updateTray(_options) {\n webUnavailable(\"System tray\");\n }\n async destroyTray() {\n webUnavailable(\"System tray\");\n }\n async setTrayMenu(_options) {\n webUnavailable(\"System tray\");\n }\n // Global Shortcuts - Not available in browser\n async registerShortcut(_options) {\n webUnavailable(\"Global shortcuts\");\n return { success: false };\n }\n async unregisterShortcut(_options) {\n webUnavailable(\"Global shortcuts\");\n }\n async unregisterAllShortcuts() {\n webUnavailable(\"Global shortcuts\");\n }\n async isShortcutRegistered(_options) {\n return { registered: false };\n }\n // Auto Launch - Not available in browser\n async setAutoLaunch(_options) {\n webUnavailable(\"Auto launch\");\n }\n async getAutoLaunchStatus() {\n return { enabled: false, openAsHidden: false };\n }\n // Window Management - Limited in browser\n async setWindowOptions(_options) {\n webUnavailable(\"Window options\");\n }\n async getWindowBounds() {\n return {\n x: window.screenX,\n y: window.screenY,\n width: window.outerWidth,\n height: window.outerHeight,\n };\n }\n async setWindowBounds(_options) {\n webUnavailable(\"Setting window bounds\");\n }\n async minimizeWindow() {\n webUnavailable(\"Window minimize\");\n }\n async maximizeWindow() {\n webUnavailable(\"Window maximize\");\n }\n async unmaximizeWindow() {\n webUnavailable(\"Window unmaximize\");\n }\n async closeWindow() {\n window.close();\n }\n async showWindow() {\n window.focus();\n }\n async hideWindow() {\n webUnavailable(\"Window hide\");\n }\n async focusWindow() {\n window.focus();\n }\n async isWindowMaximized() {\n return { maximized: false };\n }\n async isWindowMinimized() {\n return { minimized: document.hidden };\n }\n async isWindowVisible() {\n return { visible: !document.hidden };\n }\n async isWindowFocused() {\n return { focused: document.hasFocus() };\n }\n async setAlwaysOnTop(_options) {\n webUnavailable(\"Always on top\");\n }\n async setFullscreen(options) {\n options.flag\n ? document.documentElement.requestFullscreen()\n : document.exitFullscreen();\n }\n async setOpacity(_options) {\n webUnavailable(\"Window opacity\");\n }\n // Notifications - Using Web Notification API\n async showNotification(options) {\n const id = `notification_${Date.now()}`;\n if (!(\"Notification\" in window)) {\n return {\n id,\n shown: false,\n error: \"Notification API not available in this browser\",\n };\n }\n if (Notification.permission === \"denied\") {\n return { id, shown: false, error: \"Notification permission denied\" };\n }\n if (Notification.permission !== \"granted\") {\n const permission = await Notification.requestPermission();\n if (permission !== \"granted\") {\n return {\n id,\n shown: false,\n error: \"Notification permission not granted\",\n };\n }\n }\n const notification = new Notification(options.title, {\n body: options.body,\n icon: options.icon,\n silent: options.silent,\n });\n notification.onclick = () => this.notifyListeners(\"notificationClick\", {});\n return { id, shown: true };\n }\n async closeNotification(_options) {\n // Web Notification API doesn't provide a way to close notifications by ID.\n // Notifications auto-close or the user dismisses them.\n }\n // Power Monitor\n async getPowerState() {\n const getBattery = navigator.getBattery;\n if (getBattery) {\n try {\n const battery = await getBattery.call(navigator);\n return {\n onBattery: !battery.charging,\n batteryLevel: battery.level * 100,\n isCharging: battery.charging,\n idleState: \"active\", // Idle detection not available on web\n idleTime: 0,\n };\n }\n catch (err) {\n console.debug(\"[Desktop] Battery API access failed:\", err);\n }\n }\n return {\n onBattery: false, // Unknown, defaulting to false\n idleState: \"unknown\",\n idleTime: 0,\n };\n }\n // App\n async quit() {\n window.close();\n }\n async relaunch() {\n window.location.reload();\n }\n async getVersion() {\n // On web platform, version info is limited. Return actual browser info where available.\n // Note: \"version\" and \"name\" would need to come from app config - returning \"unknown\" to indicate unavailability\n return {\n version: \"unknown\", // App version not available on web - would need to be injected at build time\n name: \"unknown\", // App name not available on web - would need to be injected at build time\n runtime: \"N/A\", // Not running in the desktop runtime\n chrome: navigator.userAgent.match(/Chrome\\/([0-9.]+)/)?.[1] ?? \"unknown\",\n node: \"N/A\", // Not running in Node\n };\n }\n async isPackaged() {\n return { packaged: false };\n }\n async getPath(_options) {\n throw new Error(\"File system paths are not available in browser environment\");\n }\n // Clipboard\n async writeToClipboard(options) {\n if (options.text) {\n await navigator.clipboard.writeText(options.text);\n return;\n }\n if (options.html) {\n await navigator.clipboard.write([\n new ClipboardItem({\n \"text/html\": new Blob([options.html], { type: \"text/html\" }),\n }),\n ]);\n }\n }\n async readFromClipboard() {\n return { text: await navigator.clipboard.readText(), hasImage: false };\n }\n async clearClipboard() {\n await navigator.clipboard.writeText(\"\");\n }\n // Shell\n async openExternal(options) {\n window.open(options.url, \"_blank\");\n }\n async showItemInFolder(_options) {\n webUnavailable(\"Show in folder\");\n }\n async beep() {\n const ctx = new AudioContext();\n const osc = ctx.createOscillator();\n const gain = ctx.createGain();\n osc.connect(gain).connect(ctx.destination);\n osc.frequency.value = 800;\n osc.type = \"sine\";\n gain.gain.setValueAtTime(0.3, ctx.currentTime);\n gain.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + 0.1);\n osc.start(ctx.currentTime);\n osc.stop(ctx.currentTime + 0.1);\n }\n // Events\n async addListener(eventName, listenerFunc) {\n const entry = { eventName, callback: listenerFunc };\n // Create and track window event listeners to avoid memory leaks\n if (eventName === \"windowFocus\") {\n entry.windowListener = () => listenerFunc(undefined);\n window.addEventListener(\"focus\", entry.windowListener);\n }\n else if (eventName === \"windowBlur\") {\n entry.windowListener = () => listenerFunc(undefined);\n window.addEventListener(\"blur\", entry.windowListener);\n }\n this.pluginListeners.push(entry);\n return {\n remove: async () => {\n const i = this.pluginListeners.indexOf(entry);\n if (i >= 0) {\n // Remove window event listener if it exists\n if (entry.windowListener) {\n if (entry.eventName === \"windowFocus\")\n window.removeEventListener(\"focus\", entry.windowListener);\n else if (entry.eventName === \"windowBlur\")\n window.removeEventListener(\"blur\", entry.windowListener);\n }\n this.pluginListeners.splice(i, 1);\n }\n },\n };\n }\n async removeAllListeners() {\n // Clean up all window event listeners before clearing\n for (const entry of this.pluginListeners) {\n if (entry.windowListener) {\n if (entry.eventName === \"windowFocus\")\n window.removeEventListener(\"focus\", entry.windowListener);\n else if (entry.eventName === \"windowBlur\")\n window.removeEventListener(\"blur\", entry.windowListener);\n }\n }\n this.pluginListeners = [];\n }\n notifyListeners(eventName, data) {\n this.pluginListeners\n .filter((l) => l.eventName === eventName)\n .forEach((l) => {\n l.callback(data);\n });\n }\n}\n"],"names":["registerPlugin","WebPlugin"],"mappings":";;;IAEA,MAAM,OAAO,GAAG,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;AACzD,UAAC,OAAO,GAAGA,mBAAc,CAAC,SAAS,EAAE;IACjD,IAAI,GAAG,EAAE,OAAO;IAChB,CAAC;;ICFM,MAAM,UAAU,SAASC,cAAS,CAAC;IAC1C,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;IAC3B,QAAQ,IAAI,CAAC,eAAe,GAAG,EAAE;IACjC,IAAI;IACJ;IACA,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAE/B,IAAI;IACJ,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAE/B,IAAI;IACJ,IAAI,MAAM,WAAW,GAAG;IAExB,IAAI;IACJ,IAAI,MAAM,WAAW,CAAC,QAAQ,EAAE;IAEhC,IAAI;IACJ;IACA,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;IAErC,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ,IAAI,MAAM,kBAAkB,CAAC,QAAQ,EAAE;IAEvC,IAAI;IACJ,IAAI,MAAM,sBAAsB,GAAG;IAEnC,IAAI;IACJ,IAAI,MAAM,oBAAoB,CAAC,QAAQ,EAAE;IACzC,QAAQ,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE;IACpC,IAAI;IACJ;IACA,IAAI,MAAM,aAAa,CAAC,QAAQ,EAAE;IAElC,IAAI;IACJ,I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AAC,OAAO,EAAE,KAAK,CAAC,cAAc,CAAC;IAC7E,qBAAqB,IAAI,KAAK,CAAC,SAAS,KAAK,YAAY;IACzD,oBAAoB,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC;IAC5E,YAAY;IACZ,QAAQ;IACR,QAAQ,IAAI,CAAC,eAAe,GAAG,EAAE;IACjC,IAAI;IACJ,IAAI,eAAe,CAAC,SAAS,EAAE,IAAI,EAAE;IACrC,QAAQ,IAAI,CAAC;IACb,aAAa,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,KAAK,SAAS;IACpD,aAAa,OAAO,CAAC,CAAC,CAAC,KAAK;IAC5B,YAAY,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,QAAQ,CAAC,CAAC;IACV,IAAI;IACJ;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nexport * from \"./definitions\";\nconst loadWeb = () => import(\"./web\").then((m) => new m.DesktopWeb());\nexport const Desktop = registerPlugin(\"Desktop\", {\n web: loadWeb,\n});\n","import { WebPlugin } from \"@capacitor/core\";\nconst BROWSER_PERMISSION_IDS = new Set([\n \"camera\",\n \"microphone\",\n \"location\",\n \"notifications\",\n]);\nconst SAFE_EXTERNAL_PROTOCOLS = new Set([\"http:\", \"https:\", \"mailto:\", \"tel:\"]);\nfunction assertSafeExternalUrl(url) {\n if (typeof url !== \"string\" || url.trim().length === 0) {\n throw new Error(\"url must be a non-empty external URL\");\n }\n let parsed;\n try {\n parsed = new URL(url);\n }\n catch {\n throw new Error(\"url must be a valid external URL\");\n }\n if (!SAFE_EXTERNAL_PROTOCOLS.has(parsed.protocol)) {\n throw new Error(\"url protocol is not allowed\");\n }\n return parsed.toString();\n}\nfunction getDesktopRpc() {\n const g = globalThis;\n if (typeof window !== \"undefined\") {\n return window.__ELIZA_ELECTROBUN_RPC__;\n }\n return g.window?.__ELIZA_ELECTROBUN_RPC__ ?? g.__ELIZA_ELECTROBUN_RPC__;\n}\nfunction currentPlatform() {\n const proc = globalThis.process;\n const p = proc?.platform;\n if (p === \"darwin\" || p === \"win32\" || p === \"linux\")\n return p;\n if (typeof navigator !== \"undefined\") {\n const platform = navigator.platform.toLowerCase();\n if (platform.includes(\"mac\"))\n return \"darwin\";\n if (platform.includes(\"win\"))\n return \"win32\";\n }\n return \"linux\";\n}\nfunction isRecord(value) {\n return Boolean(value) && typeof value === \"object\";\n}\nfunction isDesktopPermissionState(value, id) {\n return (isRecord(value) &&\n value.id === id &&\n typeof value.status === \"string\" &&\n typeof value.canRequest === \"boolean\" &&\n typeof value.lastChecked === \"number\");\n}\nfunction stateFromStatus(id, status, options = {}) {\n const state = {\n id,\n status,\n lastChecked: options.lastChecked ?? Date.now(),\n canRequest: options.canRequest ?? status === \"not-determined\",\n platform: options.platform ?? currentPlatform(),\n };\n if (options.lastRequested !== undefined) {\n state.lastRequested = options.lastRequested;\n }\n if (options.restrictedReason !== undefined) {\n state.restrictedReason = options.restrictedReason;\n }\n return state;\n}\nfunction mapBrowserPermissionState(state) {\n if (state === \"granted\")\n return \"granted\";\n if (state === \"denied\")\n return \"denied\";\n if (state === \"prompt\" || state === \"default\")\n return \"not-determined\";\n return null;\n}\nasync function queryBrowserPermission(id) {\n if (!BROWSER_PERMISSION_IDS.has(id) || typeof navigator === \"undefined\") {\n return null;\n }\n if (id === \"notifications\" && typeof Notification !== \"undefined\") {\n const status = mapBrowserPermissionState(Notification.permission);\n return status ? stateFromStatus(id, status) : null;\n }\n if (!navigator.permissions?.query) {\n return null;\n }\n const permissionName = id === \"location\" ? \"geolocation\" : id;\n try {\n const result = await navigator.permissions.query({\n name: permissionName,\n });\n const status = mapBrowserPermissionState(result.state);\n return status ? stateFromStatus(id, status) : null;\n }\n catch {\n return null;\n }\n}\nasync function requestBrowserPermission(id) {\n if (!BROWSER_PERMISSION_IDS.has(id) || typeof navigator === \"undefined\") {\n return null;\n }\n if (id === \"camera\" || id === \"microphone\") {\n try {\n const stream = await navigator.mediaDevices?.getUserMedia?.({\n video: id === \"camera\",\n audio: id === \"microphone\",\n });\n for (const track of stream?.getTracks?.() ?? []) {\n track.stop();\n }\n }\n catch {\n // Query below returns denied when the browser recorded a denial.\n }\n const checked = await queryBrowserPermission(id);\n return checked ? { ...checked, lastRequested: Date.now() } : null;\n }\n if (id === \"location\" && navigator.geolocation) {\n const requestedStatus = await new Promise((resolve) => {\n navigator.geolocation.getCurrentPosition(() => resolve(\"granted\"), (err) => resolve(err.code === err.PERMISSION_DENIED ? \"denied\" : null), { maximumAge: 0, timeout: 10000 });\n });\n const checked = await queryBrowserPermission(id);\n if (checked)\n return { ...checked, lastRequested: Date.now() };\n return requestedStatus\n ? stateFromStatus(id, requestedStatus, { lastRequested: Date.now() })\n : null;\n }\n if (id === \"notifications\" && typeof Notification !== \"undefined\") {\n const status = mapBrowserPermissionState(await Notification.requestPermission());\n return status\n ? stateFromStatus(id, status, { lastRequested: Date.now() })\n : null;\n }\n return queryBrowserPermission(id);\n}\nexport class DesktopWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.pluginListeners = [];\n }\n // System Tray - Not available in browser\n async createTray(_options) { }\n async updateTray(_options) { }\n async destroyTray() { }\n async setTrayMenu(_options) { }\n // Global Shortcuts - Not available in browser\n async registerShortcut(_options) {\n return { success: false };\n }\n async unregisterShortcut(_options) { }\n async unregisterAllShortcuts() { }\n async isShortcutRegistered(_options) {\n return { registered: false };\n }\n // Auto Launch - Not available in browser\n async setAutoLaunch(_options) { }\n async getAutoLaunchStatus() {\n return { enabled: false, openAsHidden: false };\n }\n // Window Management - Limited in browser\n async setWindowOptions(_options) { }\n async getWindowBounds() {\n return {\n x: window.screenX,\n y: window.screenY,\n width: window.outerWidth,\n height: window.outerHeight,\n };\n }\n async setWindowBounds(_options) { }\n async minimizeWindow() { }\n async maximizeWindow() { }\n async unmaximizeWindow() { }\n async closeWindow() {\n window.close();\n }\n async showWindow() {\n window.focus();\n }\n async hideWindow() { }\n async focusWindow() {\n window.focus();\n }\n async isWindowMaximized() {\n return { maximized: false };\n }\n async isWindowMinimized() {\n return { minimized: document.hidden };\n }\n async isWindowVisible() {\n return { visible: !document.hidden };\n }\n async isWindowFocused() {\n return { focused: document.hasFocus() };\n }\n async setAlwaysOnTop(_options) { }\n async setFullscreen(options) {\n options.flag\n ? document.documentElement.requestFullscreen()\n : document.exitFullscreen();\n }\n async setOpacity(_options) { }\n // Notifications - Using Web Notification API\n async showNotification(options) {\n const id = `notification_${Date.now()}`;\n if (!(\"Notification\" in window)) {\n return {\n id,\n shown: false,\n error: \"Notification API not available in this browser\",\n };\n }\n if (Notification.permission === \"denied\") {\n return { id, shown: false, error: \"Notification permission denied\" };\n }\n if (Notification.permission !== \"granted\") {\n const permission = await Notification.requestPermission();\n if (permission !== \"granted\") {\n return {\n id,\n shown: false,\n error: \"Notification permission not granted\",\n };\n }\n }\n const notification = new Notification(options.title, {\n body: options.body,\n icon: options.icon,\n silent: options.silent,\n });\n notification.onclick = () => this.notifyListeners(\"notificationClick\", {});\n return { id, shown: true };\n }\n async closeNotification(_options) {\n // Web Notification API doesn't provide a way to close notifications by ID.\n // Notifications auto-close or the user dismisses them.\n }\n // Power Monitor\n async getPowerState() {\n const getBattery = navigator.getBattery;\n if (getBattery) {\n try {\n const battery = await getBattery.call(navigator);\n const level = typeof battery.level === \"number\" && Number.isFinite(battery.level)\n ? Math.max(0, Math.min(100, battery.level * 100))\n : undefined;\n const charging = typeof battery.charging === \"boolean\" ? battery.charging : undefined;\n return {\n onBattery: charging === undefined ? false : !charging,\n batteryLevel: level,\n isCharging: charging,\n idleState: \"active\", // Idle detection not available on web\n idleTime: 0,\n };\n }\n catch (err) {\n console.debug(\"[Desktop] Battery API access failed:\", err);\n }\n }\n return {\n onBattery: false, // Unknown, defaulting to false\n idleState: \"unknown\",\n idleTime: 0,\n };\n }\n // App\n async quit() {\n window.close();\n }\n async relaunch() {\n window.location.reload();\n }\n async getVersion() {\n // On web platform, version info is limited. Return actual browser info where available.\n // Note: \"version\" and \"name\" would need to come from app config - returning \"unknown\" to indicate unavailability\n return {\n version: \"unknown\", // App version not available on web - would need to be injected at build time\n name: \"unknown\", // App name not available on web - would need to be injected at build time\n runtime: \"N/A\", // Not running in the desktop runtime\n chrome: navigator.userAgent.match(/Chrome\\/([0-9.]+)/)?.[1] ?? \"unknown\",\n node: \"N/A\", // Not running in Node\n };\n }\n async isPackaged() {\n return { packaged: false };\n }\n async getPath(_options) {\n throw new Error(\"File system paths are not available in browser environment\");\n }\n // Clipboard\n async writeToClipboard(options) {\n if (options.text) {\n await navigator.clipboard.writeText(options.text);\n return;\n }\n if (options.html) {\n await navigator.clipboard.write([\n new ClipboardItem({\n \"text/html\": new Blob([options.html], { type: \"text/html\" }),\n }),\n ]);\n }\n }\n async readFromClipboard() {\n return { text: await navigator.clipboard.readText(), hasImage: false };\n }\n async clearClipboard() {\n await navigator.clipboard.writeText(\"\");\n }\n // Shell\n async openExternal(options) {\n window.open(assertSafeExternalUrl(options.url), \"_blank\", \"noopener\");\n }\n async showItemInFolder(_options) { }\n async beep() {\n const ctx = new AudioContext();\n const osc = ctx.createOscillator();\n const gain = ctx.createGain();\n osc.connect(gain).connect(ctx.destination);\n osc.frequency.value = 800;\n osc.type = \"sine\";\n gain.gain.setValueAtTime(0.3, ctx.currentTime);\n gain.gain.exponentialRampToValueAtTime(0.01, ctx.currentTime + 0.1);\n osc.start(ctx.currentTime);\n osc.stop(ctx.currentTime + 0.1);\n }\n // Events\n async addListener(eventName, listenerFunc) {\n const entry = { eventName, callback: listenerFunc };\n // Create and track window event listeners to avoid memory leaks\n if (eventName === \"windowFocus\") {\n entry.windowListener = () => listenerFunc(undefined);\n window.addEventListener(\"focus\", entry.windowListener);\n }\n else if (eventName === \"windowBlur\") {\n entry.windowListener = () => listenerFunc(undefined);\n window.addEventListener(\"blur\", entry.windowListener);\n }\n this.pluginListeners.push(entry);\n return {\n remove: async () => {\n const i = this.pluginListeners.indexOf(entry);\n if (i >= 0) {\n // Remove window event listener if it exists\n if (entry.windowListener) {\n if (entry.eventName === \"windowFocus\")\n window.removeEventListener(\"focus\", entry.windowListener);\n else if (entry.eventName === \"windowBlur\")\n window.removeEventListener(\"blur\", entry.windowListener);\n }\n this.pluginListeners.splice(i, 1);\n }\n },\n };\n }\n async removeAllListeners() {\n // Clean up all window event listeners before clearing\n for (const entry of this.pluginListeners) {\n if (entry.windowListener) {\n if (entry.eventName === \"windowFocus\")\n window.removeEventListener(\"focus\", entry.windowListener);\n else if (entry.eventName === \"windowBlur\")\n window.removeEventListener(\"blur\", entry.windowListener);\n }\n }\n this.pluginListeners = [];\n }\n notifyListeners(eventName, data) {\n this.pluginListeners\n .filter((l) => l.eventName === eventName)\n .forEach((l) => {\n l.callback(data);\n });\n }\n async checkPermission(options) {\n const rpc = getDesktopRpc();\n const request = rpc?.request?.permissionsCheck;\n if (request) {\n const bridged = await request.call(rpc.request, { id: options.id });\n if (isDesktopPermissionState(bridged, options.id))\n return bridged;\n }\n const browserState = await queryBrowserPermission(options.id);\n if (browserState)\n return browserState;\n return {\n id: options.id,\n status: \"not-applicable\",\n restrictedReason: \"platform_unsupported\",\n lastChecked: Date.now(),\n canRequest: false,\n platform: currentPlatform(),\n };\n }\n async requestPermission(options) {\n const rpc = getDesktopRpc();\n const request = rpc?.request?.permissionsRequest;\n if (request) {\n const bridged = await request.call(rpc.request, { id: options.id });\n if (isDesktopPermissionState(bridged, options.id)) {\n if (bridged.status === \"not-determined\" &&\n BROWSER_PERMISSION_IDS.has(options.id)) {\n return (await requestBrowserPermission(options.id)) ?? bridged;\n }\n return bridged;\n }\n }\n return ((await requestBrowserPermission(options.id)) ??\n this.checkPermission({ id: options.id }));\n }\n}\n"],"names":["registerPlugin","WebPlugin"],"mappings":";;;IAEA,MAAM,OAAO,GAAG,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,K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AAE,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC;IAC/E,YAAY,IAAI,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE;IAC/D,gBAAgB,IAAI,OAAO,CAAC,MAAM,KAAK,gBAAgB;IACvD,oBAAoB,sBAAsB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;IAC5D,oBAAoB,OAAO,CAAC,MAAM,wBAAwB,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,OAAO;IAClF,gBAAgB;IAChB,gBAAgB,OAAO,OAAO;IAC9B,YAAY;IACZ,QAAQ;IACR,QAAQ,QAAQ,CAAC,MAAM,wBAAwB,CAAC,OAAO,CAAC,EAAE,CAAC;IAC3D,YAAY,IAAI,CAAC,eAAe,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC;IACpD,IAAI;IACJ;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elizaos/capacitor-desktop",
3
- "version": "1.0.0",
3
+ "version": "2.0.3-beta.2",
4
4
  "description": "Adds tray icons, global shortcuts, notifications, and other desktop-only controls.",
5
5
  "keywords": [
6
6
  "desktop",
@@ -14,6 +14,8 @@
14
14
  "exports": {
15
15
  ".": {
16
16
  "types": "./dist/esm/index.d.ts",
17
+ "bun": "./src/index.ts",
18
+ "development": "./src/index.ts",
17
19
  "import": "./dist/esm/index.js",
18
20
  "require": "./dist/plugin.cjs.js"
19
21
  },
@@ -22,29 +24,28 @@
22
24
  "unpkg": "dist/plugin.js",
23
25
  "files": [
24
26
  "dist/",
25
- "electrobun/"
27
+ "dist"
26
28
  ],
27
29
  "author": "elizaOS",
28
30
  "license": "MIT",
29
- "dependencies": {
30
- "@elizaos/app-core": "2.0.0-alpha.537"
31
- },
32
31
  "repository": {
33
32
  "type": "git",
34
33
  "url": "https://github.com/elizaOS/eliza"
35
34
  },
36
35
  "scripts": {
37
- "build": "npm run clean && tsc && rollup -c rollup.config.mjs",
38
- "clean": "rimraf ./dist",
39
- "prepublishOnly": "npm run build",
40
- "watch": "tsc --watch"
36
+ "build": "node ../../packages/scripts/with-package-build-lock.mjs plugins/plugin-native-desktop -- bun run build:unlocked",
37
+ "clean": "node ../../packages/scripts/rm-path-recursive.mjs dist",
38
+ "test": "vitest run",
39
+ "prepublishOnly": "bun run build",
40
+ "watch": "tsc --watch",
41
+ "build:unlocked": "bun run clean && tsc && bunx rollup -c rollup.config.mjs"
41
42
  },
42
43
  "devDependencies": {
43
44
  "@capacitor/core": "^8.3.1",
44
45
  "@rollup/plugin-node-resolve": "^16.0.0",
45
- "rimraf": "^6.0.0",
46
46
  "rollup": "^4.60.2",
47
- "typescript": "^6.0.0"
47
+ "typescript": "^6.0.3",
48
+ "vitest": "^4.0.0"
48
49
  },
49
50
  "peerDependencies": {
50
51
  "@capacitor/core": "^8.3.1"
@@ -64,5 +65,6 @@
64
65
  "ios": false,
65
66
  "android": false
66
67
  }
67
- }
68
+ },
69
+ "gitHead": "82fe0f44215954c2417328203f5bd6510985c1fc"
68
70
  }