@glassly/engine 0.3.4-dev.704 → 0.3.5-dev.705

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/build/generated/releaseMetadata.js +4 -4
  2. package/build/generated/releaseMetadata.js.map +1 -1
  3. package/build/index.d.ts +1 -1
  4. package/build/index.d.ts.map +1 -1
  5. package/build/index.js +1 -1
  6. package/build/index.js.map +1 -1
  7. package/build/services/AppRegistry.d.ts +3 -1
  8. package/build/services/AppRegistry.d.ts.map +1 -1
  9. package/build/services/AppRegistry.js +5 -2
  10. package/build/services/AppRegistry.js.map +1 -1
  11. package/build/services/LocalMiniappRuntime.d.ts +32 -0
  12. package/build/services/LocalMiniappRuntime.d.ts.map +1 -1
  13. package/build/services/LocalMiniappRuntime.js +332 -1
  14. package/build/services/LocalMiniappRuntime.js.map +1 -1
  15. package/build/services/MiniappLauncher.d.ts.map +1 -1
  16. package/build/services/MiniappLauncher.js +2 -0
  17. package/build/services/MiniappLauncher.js.map +1 -1
  18. package/build/services/MiniappWidgetMode.d.ts +24 -0
  19. package/build/services/MiniappWidgetMode.d.ts.map +1 -0
  20. package/build/services/MiniappWidgetMode.js +58 -0
  21. package/build/services/MiniappWidgetMode.js.map +1 -0
  22. package/build/services/manifestActions.d.ts +8 -1
  23. package/build/services/manifestActions.d.ts.map +1 -1
  24. package/build/services/manifestActions.js +29 -0
  25. package/build/services/manifestActions.js.map +1 -1
  26. package/build/services/widgetPlacements.d.ts +43 -0
  27. package/build/services/widgetPlacements.d.ts.map +1 -0
  28. package/build/services/widgetPlacements.js +83 -0
  29. package/build/services/widgetPlacements.js.map +1 -0
  30. package/build/stores/apps.d.ts +3 -1
  31. package/build/stores/apps.d.ts.map +1 -1
  32. package/build/stores/apps.js +37 -11
  33. package/build/stores/apps.js.map +1 -1
  34. package/build/types/applet.d.ts +16 -0
  35. package/build/types/applet.d.ts.map +1 -1
  36. package/build/types/applet.js.map +1 -1
  37. package/package.json +7 -7
  38. package/src/generated/releaseMetadata.ts +4 -4
  39. package/src/index.ts +1 -0
  40. package/src/services/AppRegistry.ts +8 -2
  41. package/src/services/LocalMiniappRuntime.ts +362 -2
  42. package/src/services/MiniappLauncher.ts +3 -0
  43. package/src/services/MiniappWidgetMode.ts +62 -0
  44. package/src/services/manifestActions.ts +29 -1
  45. package/src/services/widgetPlacements.ts +121 -0
  46. package/src/stores/apps.ts +45 -11
  47. package/src/types/applet.ts +18 -0
@@ -23,6 +23,7 @@ import sttModelManager from "../services/STTModelManager";
23
23
  import { miniappLauncher } from "../services/MiniappLauncher";
24
24
  import { isMiniappsPaused, onMiniappsPauseChange } from "../services/MiniappPauseCoordinator";
25
25
  import { miniappRunningRegistry } from "../services/MiniappRunningRegistry";
26
+ import { miniappWidgetMode } from "../services/MiniappWidgetMode";
26
27
  import { defaultHiddenStatus, isGatedByDevTools, isGatedUntilPaired, resolveHiddenStatus } from "./appVisibility";
27
28
  import { SETTINGS, useSettingsStore } from "./settings";
28
29
  import BluetoothSdk from "@glassly/bluetooth-sdk";
@@ -273,15 +274,19 @@ export const useAppStatusStore = create((set, get) => ({
273
274
  useSettingsStore.getState().setSetting(SETTINGS.has_ever_activated_app.key, true);
274
275
  // If the tapped app is already running, this is a re-open: the nav/foreground
275
276
  // above already drove the animation, and there's nothing to spawn. Short-
276
- // circuit before the spawn pipeline.
277
- if (app.running) {
277
+ // circuit before the spawn pipeline. An app running only for its widget
278
+ // is promoted instead: it keeps its context and takes the foreground.
279
+ if (app.running && !app.widgetOnly) {
278
280
  saveLastOpenTime(packageName);
279
281
  return true;
280
282
  }
283
+ if (app.widgetOnly)
284
+ miniappWidgetMode.setWidgetOnly(packageName, false);
281
285
  // Only-one rules: one standard app in the foreground, one dashboard
282
- // drawing the overlay. Starting another stops the one running.
286
+ // drawing the overlay. Starting another stops the one running. Widget-only
287
+ // peers hold no foreground, so they stay.
283
288
  if (app.type === "standard" || app.type === "dashboard") {
284
- const runningPeers = state.apps.filter((a) => a.running && a.type === app.type && a.packageName !== packageName);
289
+ const runningPeers = state.apps.filter((a) => a.running && !a.widgetOnly && a.type === app.type && a.packageName !== packageName);
285
290
  for (const r of runningPeers) {
286
291
  await get().stop(r.packageName);
287
292
  }
@@ -323,6 +328,19 @@ export const useAppStatusStore = create((set, get) => ({
323
328
  console.error(`ISLAND: app not found for package name: ${packageName}`);
324
329
  return;
325
330
  }
331
+ // A placed widget provider is the dashboard's to keep: closing it from
332
+ // the tray takes its card and its frame, and it runs on in widget mode.
333
+ if (app.local && app.running && miniappWidgetMode.isPlaced(packageName)) {
334
+ if (!app.widgetOnly) {
335
+ miniappWidgetMode.setWidgetOnly(packageName, true);
336
+ localDisplayManager.onUnmount(packageName);
337
+ set((s) => ({
338
+ foregroundedPackage: s.foregroundedPackage === packageName ? null : s.foregroundedPackage,
339
+ apps: s.apps.map((a) => a.packageName === packageName ? { ...a, screenshot: undefined, foregrounded: false, loading: false } : a),
340
+ }));
341
+ }
342
+ return;
343
+ }
326
344
  set((s) => ({
327
345
  apps: s.apps.map((a) => a.packageName === packageName ? { ...a, running: false, screenshot: undefined, loading: false } : a),
328
346
  }));
@@ -380,7 +398,8 @@ export const useAppStatusStore = create((set, get) => ({
380
398
  stopAll: () => {
381
399
  return Res.try_async(async () => {
382
400
  // Always On apps stay up; they stop one at a time from the switcher.
383
- const running = get().apps.filter((a) => a.running && !a.alwaysOn);
401
+ // Widget-only apps have no card to close; they are the dashboard's.
402
+ const running = get().apps.filter((a) => a.running && !a.alwaysOn && !a.widgetOnly);
384
403
  for (const a of running) {
385
404
  await get().stop(a.packageName);
386
405
  }
@@ -463,16 +482,18 @@ function projectLocalRunningState() {
463
482
  return app;
464
483
  const next = running.has(app.packageName);
465
484
  const paused = next && pausedNow;
466
- if (app.running === next && (app.paused ?? false) === paused)
485
+ const widgetOnly = next && miniappWidgetMode.isWidgetOnly(app.packageName);
486
+ if (app.running === next && (app.paused ?? false) === paused && (app.widgetOnly ?? false) === widgetOnly)
467
487
  return app;
468
488
  changed = true;
469
- return { ...app, running: next, paused };
489
+ return { ...app, running: next, paused, widgetOnly };
470
490
  });
471
491
  if (changed) {
472
492
  useAppStatusStore.setState({ apps: updated });
473
493
  }
474
494
  }
475
495
  miniappRunningRegistry.subscribe(projectLocalRunningState);
496
+ miniappWidgetMode.subscribe(projectLocalRunningState);
476
497
  onMiniappsPauseChange(projectLocalRunningState);
477
498
  // The display-manager's core (foreground) slot is DERIVED state: always the
478
499
  // currently-running standard app, no matter HOW it came to run — user tap
@@ -481,7 +502,7 @@ onMiniappsPauseChange(projectLocalRunningState);
481
502
  // sites, so no launch/stop path can forget to claim or release the slot.
482
503
  // onCoreAppChange is idempotent, so firing on every store write is free.
483
504
  useAppStatusStore.subscribe((state) => {
484
- const core = state.apps.find((a) => a.running && (a.type === "standard" || !a.type));
505
+ const core = state.apps.find((a) => a.running && !a.widgetOnly && (a.type === "standard" || !a.type));
485
506
  localDisplayManager.onCoreAppChange(core?.packageName ?? null);
486
507
  });
487
508
  // AppRegistry change events trigger a store refresh.
@@ -526,10 +547,15 @@ export const useRefresh = () => useAppStatusStore((state) => state.refresh);
526
547
  export const useStopAll = () => useAppStatusStore((state) => state.stopAll);
527
548
  export const useInstall = () => useAppStatusStore((state) => state.install);
528
549
  export const useUninstall = () => useAppStatusStore((state) => state.uninstall);
529
- /** Every running app; each one has a card in the app switcher tray. */
550
+ /** Every running app with a card in the app switcher tray: widget-only apps have none. */
530
551
  export const useActiveApps = () => {
531
552
  const apps = useApps();
532
- return useMemo(() => apps.filter((app) => app.running), [apps]);
553
+ return useMemo(() => apps.filter((app) => app.running && !app.widgetOnly), [apps]);
554
+ };
555
+ /** Apps running only for a widget the dashboard placed; the switcher's Widgets pill lists them. */
556
+ export const useWidgetApps = () => {
557
+ const apps = useApps();
558
+ return useMemo(() => apps.filter((app) => app.running && app.widgetOnly), [apps]);
533
559
  };
534
560
  /** Always On apps whose background task is running, card or no card. */
535
561
  export const useRunningAlwaysOnApps = () => {
@@ -551,7 +577,7 @@ export const useBackgroundApps = () => {
551
577
  };
552
578
  export const useActiveForegroundApp = () => {
553
579
  const apps = useApps();
554
- return useMemo(() => apps.find((app) => (app.type === "standard" || !app.type) && app.running) ?? null, [apps]);
580
+ return useMemo(() => apps.find((app) => (app.type === "standard" || !app.type) && app.running && !app.widgetOnly) ?? null, [apps]);
555
581
  };
556
582
  /**
557
583
  * The single app currently foregrounded in the Compositor overlay, or null.
@@ -1 +1 @@
1
- {"version":3,"file":"apps.js","sourceRoot":"","sources":["../../src/stores/apps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAsB,MAAM,IAAI,GAAG,EAAC,MAAM,aAAa,CAAA;AAC9D,OAAO,EAAC,MAAM,EAAC,MAAM,SAAS,CAAA;AAG9B,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAC,oBAAoB,EAAC,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAC,qBAAqB,EAA2B,MAAM,4BAA4B,CAAA;AAC1F,OAAO,EAAC,OAAO,EAAC,MAAM,0BAA0B,CAAA;AAChD,OAAO,WAAW,EAAE,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAA;AACzE,OAAO,mBAAmB,MAAM,iCAAiC,CAAA;AACjE,OAAO,EAAC,mBAAmB,EAAC,MAAM,kCAAkC,CAAA;AACpE,OAAO,eAAe,MAAM,6BAA6B,CAAA;AACzD,OAAO,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAA;AAC3D,OAAO,EAAC,gBAAgB,EAAE,qBAAqB,EAAC,MAAM,qCAAqC,CAAA;AAC3F,OAAO,EAAC,sBAAsB,EAAC,MAAM,oCAAoC,CAAA;AACzE,OAAO,EAAC,mBAAmB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,mBAAmB,EAAC,MAAM,iBAAiB,CAAA;AAC/G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I,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;AAChG,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAA;IACtB,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;AAC/D,CAAC,CAAA","sourcesContent":["/**\n * Engine apps store — runtime state of installed and local applets.\n *\n * The OEM-facing API: subscribe to the running set, install/uninstall\n * miniapps, start/stop them. The store delegates install plumbing to\n * AppRegistry, and exposes hooks (`useApps`, `useStart`, `useStop`,\n * `useRefresh`, `useStopAll`) that the host UI can read.\n *\n * Source of `apps`:\n * - Local: appRegistry.getInstalledMiniapps() (always)\n */\n\nimport {useMemo} from \"react\"\nimport {AsyncResult, Result, result as Res} from \"typesafe-ts\"\nimport {create} from \"zustand\"\n\nimport type {ClientApp} from \"../types/applet\"\nimport {DeviceTypes} from \"../types/enums\"\nimport {getModelCapabilities} from \"../types/hardware\"\nimport {HardwareCompatibility, type CompatibilityResult} from \"../utils/hardware/hardware\"\nimport {storage} from \"../utils/storage/storage\"\nimport appRegistry, {saveAlwaysOnOverride} from \"../services/AppRegistry\"\nimport localDisplayManager from \"../services/LocalDisplayManager\"\nimport {islandNotifications} from \"../services/NotificationsEmitter\"\nimport sttModelManager from \"../services/STTModelManager\"\nimport {miniappLauncher} from \"../services/MiniappLauncher\"\nimport {isMiniappsPaused, onMiniappsPauseChange} from \"../services/MiniappPauseCoordinator\"\nimport {miniappRunningRegistry} from \"../services/MiniappRunningRegistry\"\nimport {defaultHiddenStatus, isGatedByDevTools, isGatedUntilPaired, resolveHiddenStatus} from \"./appVisibility\"\nimport {SETTINGS, useSettingsStore} from \"./settings\"\nimport BluetoothSdk from \"@glassly/bluetooth-sdk\"\nimport type {MiniappLaunchSource} from \"@glassly/miniapp\"\n\n// ---------------------------------------------------------------------------\n// Configuration / hooks\n// ---------------------------------------------------------------------------\n\nexport interface StartOptions {\n skipNavigation?: boolean\n /** Reported to the miniapp on connect. Defaults to \"phone\". */\n launchSource?: MiniappLaunchSource\n}\n\nexport interface AppStoreHooks {\n /**\n * A start was blocked because the app is hardware-incompatible. Engine made\n * the decision (and raised the `version_incompatible` notification); the host\n * renders its branded alert here.\n */\n onIncompatibleBlocked?: (app: ClientApp) => void\n /**\n * A start was blocked because the app requires the on-device STT model\n * (declared at registration — see AppRegistry.installOfflineApp) and none is\n * installed. Engine decided via its model manager; the host renders the\n * alert / settings navigation here.\n */\n onMissingSpeechModel?: (app: ClientApp) => void\n /**\n * An open request passed the gates — fired on EVERY open, including\n * re-opening an already-running app, so the host's navigation / open\n * animation always plays.\n */\n onOpenRequested?: (app: ClientApp, opts?: StartOptions) => void\n}\n\nlet hostHooks: AppStoreHooks = {}\n\nexport function installAppStoreHooks(hooks: AppStoreHooks): void {\n hostHooks = {...hostHooks, ...hooks}\n}\n\n// ---------------------------------------------------------------------------\n// Store\n// ---------------------------------------------------------------------------\n\ninterface AppStatusState {\n apps: ClientApp[]\n /**\n * Source of truth for which app is foregrounded in the Compositor overlay.\n * The per-app `foregrounded` boolean is derived from this in `projectApps`\n * so a refresh can never drop the flag when an app is transiently missing\n * from one of the two refresh passes (local-only then merged). See\n * `projectApps` / `setForeground` / `clearForeground`.\n */\n foregroundedPackage: string | null\n refresh: () => Promise<void>\n /** Resolves true if the app actually started; false if a host gate aborted it or its JS context failed to spawn. */\n start: (app: ClientApp, opts?: StartOptions) => Promise<boolean>\n stop: (packageName: string) => Promise<void>\n setForeground: (packageName: string) => Promise<void>\n clearForeground: () => void\n stopAll: () => AsyncResult<void, Error>\n install: (url: string, opts?: {versionOverride?: string}) => AsyncResult<void, Error>\n uninstall: (packageName: string, version?: string) => AsyncResult<void, Error>\n saveScreenshot: (packageName: string, screenshot: string) => Promise<void>\n setHiddenStatus: (packageName: string, status: boolean) => void\n getHiddenStatus: (packageName: string) => boolean\n /**\n * Mark a miniapp Always On: it starts at launch and only stops from the\n * app switcher's Always On pill (its card cannot be swiped away and the\n * capsule close minimizes it). Turning it on starts the app; turning it\n * off leaves it running. Persists the wearer's choice beside the hidden flag.\n */\n setAlwaysOn: (packageName: string, status: boolean) => Promise<void>\n /** Replace the whole apps array. Hosts use this when their extra source changes. */\n setApps: (apps: ClientApp[]) => void\n}\n\nexport const DUMMY_APPLET: ClientApp = {\n packageName: \"\",\n name: \"\",\n webviewUrl: \"\",\n logoUrl: \"\",\n type: \"standard\",\n permissions: [],\n running: false,\n loading: false,\n healthy: true,\n hardwareRequirements: [],\n offline: true,\n offlineRoute: \"\",\n local: false,\n hidden: false,\n}\n\nexport type OrderMap = Record<string, number>\nconst APP_ORDER_KEY = \"foreground_apps_order\"\n\nexport const saveAppsOrder = (orderMap: OrderMap): Result<void, Error> => {\n return storage.save(APP_ORDER_KEY, orderMap)\n}\n\nexport const getAppsOrder = (): Result<OrderMap, Error> => {\n return storage.load<OrderMap>(APP_ORDER_KEY)\n}\n\n// In-memory cache for hidden flags. `projectApps` reads getHiddenStatus once\n// per app per refresh — without a cache that was a synchronous JNI hop per\n// app per refresh on a hot UI path. Kept consistent with disk by writing\n// through in setHiddenStatus. Map of packageName → hidden boolean.\nconst hiddenStatusCache = new Map<string, boolean>()\n\nconst getRawPackageNamePriority = (pkg: string): number => {\n if (pkg.includes(\"@empty\")) {\n return 1000\n }\n return 0\n}\n\nexport const sortAppsByPackageNamePriority = (a: ClientApp, b: ClientApp): number => {\n const pa = getRawPackageNamePriority(a.packageName)\n const pb = getRawPackageNamePriority(b.packageName)\n if (pa !== pb) {\n return pa - pb\n }\n return a.name.localeCompare(b.name)\n}\n\nexport const saveLastOpenTime = (packageName: string): void => {\n storage.save(`${packageName}_last_open_time`, Date.now())\n}\n\nexport const getLastOpenTime = (packageName: string): number => {\n const res = storage.load<number>(`${packageName}_last_open_time`)\n if (res.is_ok()) return res.value\n return 0\n}\n\nexport const sortAppsByLastOpenTime = async <T extends {packageName: string}>(apps: T[]): Promise<T[]> => {\n const timestamps = apps.map((app) => ({app, time: getLastOpenTime(app.packageName)}))\n return timestamps.sort((a, b) => a.time - b.time).map((entry) => entry.app)\n}\n\nconst startStopApp = async (app: ClientApp, status: boolean): Promise<void> => {\n if (!status && app.onStop) {\n try {\n app.onStop()\n } catch (e) {\n console.warn(`ISLAND: onStop threw for ${app.packageName}`, e)\n }\n }\n if (status && app.onStart) {\n try {\n app.onStart()\n } catch (e) {\n console.warn(`ISLAND: onStart threw for ${app.packageName}`, e)\n }\n }\n}\n\n/**\n * Build the final `apps` array for the store from the installed/offline app\n * source. Pure — same inputs -> same outputs.\n */\nfunction projectApps(previousState: AppStatusState, localApps: ClientApp[]): ClientApp[] {\n // Dedupe by packageName, keep first occurrence.\n const byPackage = new Map<string, ClientApp>()\n for (const app of localApps) {\n if (!byPackage.has(app.packageName)) byPackage.set(app.packageName, app)\n }\n\n // Index previous snapshot for cheap lookups (was O(N²) via .find()).\n const previousByPackage = new Map<string, ClientApp>()\n for (const oldApp of previousState.apps) {\n previousByPackage.set(oldApp.packageName, oldApp)\n }\n\n const defaultWearable =\n (useSettingsStore.getState().getSetting(SETTINGS.default_wearable.key) as DeviceTypes | undefined) ||\n DeviceTypes.NONE\n const capabilities = getModelCapabilities(defaultWearable)\n const devToolsEnabled = useSettingsStore.getState().getSetting(SETTINGS.dev_tools.key) === true\n const hasPairedGlasses = useSettingsStore.getState().getSetting(SETTINGS.has_paired_glasses.key) === true\n\n // Single pass: dedupe → screenshot carry-over → compat → hidden, all into\n // fresh objects. The previous in-place mutation re-used object references\n // across refreshes, which broke React.memo / referential-equality\n // memoization downstream (every refresh propagated re-renders even when\n // nothing meaningful changed) AND tripped Reanimated's \"tried to modify\n // key of an object already passed to a worklet\" warning whenever the home\n // screen's animated app cards held a reference to a previous snapshot's\n // app object that we then mutated.\n //\n // Identity stability: refresh() is event-driven and fires repeatedly (and\n // twice per cycle via the local-only → merged two-pass emit). If we always\n // returned fresh objects, every poll changed the identity of EVERY app —\n // which re-rendered the Compositor (via useForegroundApp) mid-slide and made\n // the open/close animation hitch, and churned the home grid / switcher pill.\n // So we build the candidate object, then REUSE the previous reference when\n // nothing meaningful changed. Same pattern as the miniappRunningRegistry\n // projection below. A stable foreground-app reference lets the Compositor's\n // slide run uninterrupted on the UI thread.\n return Array.from(byPackage.values())\n .filter(\n (app) =>\n !isGatedByDevTools(app.packageName, devToolsEnabled) &&\n !isGatedUntilPaired(app.packageName, devToolsEnabled, hasPairedGlasses),\n )\n .map((app) => {\n const next: ClientApp = {\n ...app,\n screenshot: previousByPackage.get(app.packageName)?.screenshot ?? app.screenshot,\n compatibility: HardwareCompatibility.checkCompatibility(app.hardwareRequirements, capabilities),\n // A registry source can force an app off the primary home screen.\n // Compose that gate with the user's persisted home-screen layout instead\n // of replacing it, otherwise a default-false persisted value makes a\n // source-hidden app visible again during projection.\n hidden: resolveHiddenStatus(app.hidden, previousState.getHiddenStatus(app.packageName)),\n // Derive the foreground flag from the store's single source of truth\n // (`foregroundedPackage`), NOT from the previous snapshot. Carrying it over\n // per-app meant a refresh that momentarily omitted an app (e.g. the\n // two-pass local-only → merged emit) would reset its flag to false — which\n // raced OfflineAppHost's interceptor guard and made the hosted miniapp fall\n // through to the root router (restart). Deriving here keeps the flag stable\n // across both passes.\n foregrounded: app.packageName === previousState.foregroundedPackage,\n paused: app.local && app.running && isMiniappsPaused(),\n }\n const prev = previousByPackage.get(app.packageName)\n return prev && shallowEqualApp(prev, next) ? prev : next\n })\n}\n\n// Cheap equality check used by projectApps to preserve object identity across\n// refreshes when nothing meaningful changed. Most keys are compared by\n// reference (the source app's nested fields — permissions, hardwareRequirements,\n// parameters — are reference-stable within a refresh). The ONE exception is\n// `compatibility`, which projectApps recomputes into a fresh object every call;\n// comparing it by reference would always differ and defeat the whole point. We\n// compare it structurally instead so identity is only broken when the device's\n// actual compatibility verdict changes (e.g. glasses connect/disconnect).\nfunction shallowEqualApp(a: ClientApp, b: ClientApp): boolean {\n const aKeys = Object.keys(a) as (keyof ClientApp)[]\n const bKeys = Object.keys(b) as (keyof ClientApp)[]\n if (aKeys.length !== bKeys.length) return false\n for (const k of aKeys) {\n if (k === \"compatibility\") {\n if (!compatibilityEqual(a.compatibility, b.compatibility)) return false\n continue\n }\n if (a[k] !== b[k]) return false\n }\n return true\n}\n\nfunction compatibilityEqual(a?: CompatibilityResult, b?: CompatibilityResult): boolean {\n if (a === b) return true\n if (!a || !b) return false\n return (\n a.isCompatible === b.isCompatible &&\n a.missingRequired.length === b.missingRequired.length &&\n a.missingOptional.length === b.missingOptional.length &&\n a.warnings.length === b.warnings.length\n )\n}\n\nexport const useAppStatusStore = create<AppStatusState>((set, get) => ({\n apps: [],\n foregroundedPackage: null,\n\n refresh: async () => {\n const previousState = get()\n const localApps = await appRegistry.getInstalledMiniapps()\n set({apps: projectApps(previousState, localApps)})\n },\n\n start: async (clientApp: ClientApp, opts?: StartOptions) => {\n const state = get()\n const packageName = clientApp.packageName\n const app = state.apps.find((a) => a.packageName === packageName)\n if (!app) {\n console.error(`ISLAND: app not found for package name: ${packageName}`)\n return false\n }\n\n // Skip spawning a NEW app while another is mid-launch — concurrent spawns\n // race the foreground-only-one teardown. This is checked BEFORE the gates\n // and the onOpenRequested seam (which navigates/foregrounds) so a gated\n // launch doesn't paint a splash it can't back. Re-opening an already-running\n // app is exempt: it has nothing to spawn, so it skips this gate and is\n // allowed to re-navigate/animate below.\n // That exemption is the fix for the \"second tap during another app's launch\n // window silently does nothing\" bug.\n if (!app.running && state.apps.some((a) => a.loading)) {\n console.log(`ISLAND: skipping start ${packageName} — another app is loading`)\n return false\n }\n\n if (!app.offline && !app.local) {\n console.warn(`ISLAND: cloud-v1 app entries are no longer supported: ${packageName}`)\n return false\n }\n\n // Hardware-compatibility gate — engine decides and blocks; the host renders\n // its branded alert via onIncompatibleBlocked (and/or the structured\n // notification below). `!isCompatible` (not `=== false`) keeps the semantics\n // of the host gate this replaces: an unknown verdict blocks, not launches.\n if (!app.compatibility?.isCompatible) {\n islandNotifications.emit({\n kind: \"version_incompatible\",\n packageName,\n reason: `${app.name ?? packageName} is not compatible with the connected glasses`,\n metadata: {missingRequired: app.compatibility?.missingRequired ?? []},\n timestamp: Date.now(),\n })\n hostHooks.onIncompatibleBlocked?.(app)\n return false\n }\n\n // Missing-speech-model gate for apps registered with requiresLocalSttModel.\n // Engine decides via its own model manager; the host renders the alert and\n // any settings navigation via onMissingSpeechModel.\n if (appRegistry.requiresLocalSttModel(packageName) && !(await sttModelManager.isModelAvailable())) {\n islandNotifications.emit({\n kind: \"missing_speech_model\",\n packageName,\n reason: `${app.name ?? packageName} needs an on-device speech model before it can start`,\n timestamp: Date.now(),\n })\n hostHooks.onMissingSpeechModel?.(app)\n return false\n }\n\n // Host navigation / open-animation seam. Runs on EVERY accepted open —\n // including re-opening an already-running app — so the animation always\n // plays (BuiltInMiniappCatalog.navigateForApp: overlay apps setForeground\n // for the slide).\n hostHooks.onOpenRequested?.(app, opts)\n\n // First-activation mark (moved from the host's old beforeStart — engine\n // owns the settings store).\n useSettingsStore.getState().setSetting(SETTINGS.has_ever_activated_app.key, true)\n\n // If the tapped app is already running, this is a re-open: the nav/foreground\n // above already drove the animation, and there's nothing to spawn. Short-\n // circuit before the spawn pipeline.\n if (app.running) {\n saveLastOpenTime(packageName)\n return true\n }\n\n // Only-one rules: one standard app in the foreground, one dashboard\n // drawing the overlay. Starting another stops the one running.\n if (app.type === \"standard\" || app.type === \"dashboard\") {\n const runningPeers = state.apps.filter((a) => a.running && a.type === app.type && a.packageName !== packageName)\n for (const r of runningPeers) {\n await get().stop(r.packageName)\n }\n }\n\n set((s) => ({\n apps: s.apps.map((a) => (a.packageName === packageName ? {...a, running: true, loading: false} : a)),\n }))\n\n saveLastOpenTime(packageName)\n await startStopApp(app, true)\n\n // Spawn the background JS context for local miniapps. This used to be a\n // side effect of LocalMiniappView mounting on foreground; pulling it here\n // lets start() actually run the app even when nothing foregrounds it (e.g.\n // a system app launching another miniapp via session.miniapps). Idempotent\n // with the view's own ensureRunning; a no-op for native offline built-ins\n // (no JS bundle).\n if (app.local) {\n try {\n await miniappLauncher.ensureRunning(packageName, {launchSource: opts?.launchSource ?? \"phone\"})\n } catch (e) {\n // Spawn / bundle-resolve failed — revert the optimistic running flag so\n // the home list and miniapps.list() don't show a \"running\" app with no\n // JS context, and report failure to the caller (session.miniapps.start).\n console.warn(`ISLAND: launcher.ensureRunning failed for ${packageName}`, e)\n set((s) => ({\n apps: s.apps.map((a) => (a.packageName === packageName ? {...a, running: false, loading: false} : a)),\n }))\n // onStart already ran before the spawn; run onStop to undo it.\n await startStopApp(app, false)\n return false\n }\n }\n\n return true\n },\n\n stop: async (packageName: string) => {\n const state = get()\n const app = state.apps.find((a) => a.packageName === packageName)\n if (!app) {\n console.error(`ISLAND: app not found for package name: ${packageName}`)\n return\n }\n\n set((s) => ({\n apps: s.apps.map((a) =>\n a.packageName === packageName ? {...a, running: false, screenshot: undefined, loading: false} : a,\n ),\n }))\n\n // if there are no apps running, call clearDisplay():\n // read fresh state via get() — `state` was captured before the set() above, so it still shows\n // this app as running and would never reach 0 when stopping the last app.\n if (get().apps.filter((a) => a.running).length === 0) {\n BluetoothSdk.clearDisplay()\n }\n await startStopApp(app, false)\n\n // Tear down the background JS context for local miniapps. No-op for native\n // offline built-ins.\n if (app.local) {\n try {\n await miniappLauncher.stop(packageName)\n } catch (e) {\n console.warn(`ISLAND: launcher.stop failed for ${packageName}`, e)\n }\n }\n },\n\n setForeground: async (packageName: string) => {\n const app = get().apps.find((a) => a.packageName === packageName)\n if (!app) {\n console.error(`ISLAND: setForeground — app not found: ${packageName}`)\n return\n }\n\n // Flip the foreground flag synchronously so the Compositor's open\n // animation starts on the same frame as the tap. We do NOT await start()\n // first — that gated the flag (and thus the animation) behind the whole\n // JSContext-spawn chain, which was the perceived launch delay. The\n // Compositor/LocalMiniappView already handle the spawn being in-flight\n // (the phase machine), so foregrounding needn't wait for it.\n saveLastOpenTime(packageName)\n set((s) => ({\n foregroundedPackage: packageName,\n apps: s.apps.map((a) => ({...a, foregrounded: a.packageName === packageName})),\n }))\n\n // Ensure the JSContext exists. start() is idempotent for an\n // already-running app and enforces the foreground-only-one rule for\n // standard apps. Fire-and-forget after the flag flip so it doesn't block\n // paint.\n // if (!app.running) {\n // get().start(app)\n // }\n },\n\n clearForeground: () => {\n set((s) => ({\n foregroundedPackage: null,\n apps: s.apps.some((a) => a.foregrounded)\n ? s.apps.map((a) => (a.foregrounded ? {...a, foregrounded: false} : a))\n : s.apps,\n }))\n },\n\n stopAll: () => {\n return Res.try_async(async () => {\n // Always On apps stay up; they stop one at a time from the switcher.\n const running = get().apps.filter((a) => a.running && !a.alwaysOn)\n for (const a of running) {\n await get().stop(a.packageName)\n }\n })\n },\n\n install: (url, opts) => appRegistry.installFromUrl(url, opts),\n\n uninstall: (packageName, version) => {\n return Res.try_async(async () => {\n const res = await appRegistry.uninstall(packageName, version)\n if (res.is_error()) throw res.error\n set((s) => ({apps: s.apps.filter((a) => a.packageName !== packageName)}))\n })\n },\n\n saveScreenshot: async (packageName: string, screenshot: string) => {\n storage.save(`${packageName}_screenshot`, screenshot)\n set((s) => ({\n apps: s.apps.map((a) => (a.packageName === packageName ? {...a, screenshot} : a)),\n }))\n },\n\n setHiddenStatus: (packageName: string, status: boolean) => {\n hiddenStatusCache.set(packageName, status)\n set((s) => ({\n apps: s.apps.map((a) => (a.packageName === packageName ? {...a, hidden: status} : a)),\n }))\n storage.save(`${packageName}_hidden`, status)\n if (!status) {\n const orderMap = getAppsOrder()\n if (orderMap.is_ok()) {\n delete orderMap.value[packageName]\n saveAppsOrder(orderMap.value)\n }\n }\n },\n\n getHiddenStatus: (packageName: string): boolean => {\n const cached = hiddenStatusCache.get(packageName)\n if (cached !== undefined) return cached\n const res = storage.load<boolean>(`${packageName}_hidden`)\n const value = res.is_ok() ? res.value : defaultHiddenStatus(packageName)\n hiddenStatusCache.set(packageName, value)\n return value\n },\n\n setAlwaysOn: async (packageName: string, status: boolean) => {\n const app = get().apps.find((a) => a.packageName === packageName)\n if (!app) return\n // One dashboard is Always On at a time: marking this one clears the others.\n const cleared =\n status && app.type === \"dashboard\"\n ? get().apps.filter((a) => a.type === \"dashboard\" && a.alwaysOn && a.packageName !== packageName)\n : []\n saveAlwaysOnOverride(packageName, status)\n for (const other of cleared) saveAlwaysOnOverride(other.packageName, false)\n set((s) => ({\n apps: s.apps.map((a) => {\n if (a.packageName === packageName) return {...a, alwaysOn: status}\n if (cleared.includes(a)) return {...a, alwaysOn: false}\n return a\n }),\n }))\n if (status && !app.running) await get().start(app, {skipNavigation: true})\n },\n\n setApps: (apps) => set({apps}),\n}))\n\n// Project miniappRunningRegistry membership into the store's `running` field\n// (and the pause coordinator's state into `paused`) for local apps so the home\n// tray and switcher reflect actual mount state without waiting for the next\n// refresh() cycle.\nfunction projectLocalRunningState(): void {\n const running = new Set(miniappRunningRegistry.getAll())\n const pausedNow = isMiniappsPaused()\n const state = useAppStatusStore.getState()\n let changed = false\n const updated = state.apps.map((app) => {\n if (!app.local) return app\n const next = running.has(app.packageName)\n const paused = next && pausedNow\n if (app.running === next && (app.paused ?? false) === paused) return app\n changed = true\n return {...app, running: next, paused}\n })\n if (changed) {\n useAppStatusStore.setState({apps: updated})\n }\n}\nminiappRunningRegistry.subscribe(projectLocalRunningState)\nonMiniappsPauseChange(projectLocalRunningState)\n\n// The display-manager's core (foreground) slot is DERIVED state: always the\n// currently-running standard app, no matter HOW it came to run — user tap\n// (start()), boot restore (autostartLocalMiniapps → registry projection\n// above), crash-respawn, or interop. One reconciler instead of per-path call\n// sites, so no launch/stop path can forget to claim or release the slot.\n// onCoreAppChange is idempotent, so firing on every store write is free.\nuseAppStatusStore.subscribe((state) => {\n const core = state.apps.find((a) => a.running && (a.type === \"standard\" || !a.type))\n localDisplayManager.onCoreAppChange(core?.packageName ?? null)\n})\n\n// AppRegistry change events trigger a store refresh.\nappRegistry.subscribe(() => {\n void useAppStatusStore.getState().refresh()\n})\n\n// Re-evaluate hardware compatibility when the paired/default wearable changes.\nuseSettingsStore.subscribe(\n (state) => state.getSetting(SETTINGS.default_wearable.key),\n () => {\n void useAppStatusStore.getState().refresh()\n },\n)\n\n// Developer tools toggled: dev-only apps enter or leave the projection. When\n// they leave, stop any that are running first so the running registry doesn't\n// keep a miniapp alive that no launcher surface can reach.\nuseSettingsStore.subscribe(\n (state) => state.getSetting(SETTINGS.dev_tools.key) === true,\n (enabled) => {\n void (async () => {\n if (!enabled) {\n const state = useAppStatusStore.getState()\n const hasPairedGlasses = useSettingsStore.getState().getSetting(SETTINGS.has_paired_glasses.key) === true\n for (const app of state.apps) {\n const gated =\n isGatedByDevTools(app.packageName, false) || isGatedUntilPaired(app.packageName, false, hasPairedGlasses)\n if (app.running && gated) await state.stop(app.packageName)\n }\n }\n await useAppStatusStore.getState().refresh()\n })()\n },\n)\n\n// First real pairing latched: the Store enters the projection. One-way, so\n// nothing ever leaves here.\nuseSettingsStore.subscribe(\n (state) => state.getSetting(SETTINGS.has_paired_glasses.key) === true,\n () => {\n void useAppStatusStore.getState().refresh()\n },\n)\n\n// ---------------------------------------------------------------------------\n// Public hooks\n// ---------------------------------------------------------------------------\n\nexport const useApps = () => useAppStatusStore((state) => state.apps)\nexport const useStart = () => useAppStatusStore((state) => state.start)\nexport const useStop = () => useAppStatusStore((state) => state.stop)\nexport const useSetForeground = () => useAppStatusStore((state) => state.setForeground)\nexport const useClearForeground = () => useAppStatusStore((state) => state.clearForeground)\nexport const useRefresh = () => useAppStatusStore((state) => state.refresh)\nexport const useStopAll = () => useAppStatusStore((state) => state.stopAll)\nexport const useInstall = () => useAppStatusStore((state) => state.install)\nexport const useUninstall = () => useAppStatusStore((state) => state.uninstall)\n\n/** Every running app; each one has a card in the app switcher tray. */\nexport const useActiveApps = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => app.running), [apps])\n}\n\n/** Always On apps whose background task is running, card or no card. */\nexport const useRunningAlwaysOnApps = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => app.alwaysOn && app.running), [apps])\n}\n\n/** Apps that run without a foreground surface: background ones and dashboards. */\nconst isBackgroundApp = (app: ClientApp): boolean => app.type === \"background\" || app.type === \"dashboard\"\n\nexport const useActiveBackgroundApps = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => isBackgroundApp(app) && app.running), [apps])\n}\n\nexport const useBackgroundApps = () => {\n const apps = useApps()\n return useMemo(\n () => ({\n active: apps.filter((app) => isBackgroundApp(app) && app.running),\n inactive: apps.filter((app) => isBackgroundApp(app) && !app.running),\n }),\n [apps],\n )\n}\n\nexport const useActiveForegroundApp = () => {\n const apps = useApps()\n return useMemo(() => apps.find((app) => (app.type === \"standard\" || !app.type) && app.running) ?? null, [apps])\n}\n\n/**\n * The single app currently foregrounded in the Compositor overlay, or null.\n * Driven by setForeground/clearForeground — distinct from the \"active\n * standard app\" (running) selector above.\n */\nexport const useForegroundApp = () => {\n const apps = useApps()\n return useMemo(() => apps.find((app) => app.foregrounded) ?? null, [apps])\n}\n\nexport const useActiveBackgroundAppsCount = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => isBackgroundApp(app) && app.running).length, [apps])\n}\n\nexport const useLocalMiniApps = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => app.local), [apps])\n}\n"]}
1
+ {"version":3,"file":"apps.js","sourceRoot":"","sources":["../../src/stores/apps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAsB,MAAM,IAAI,GAAG,EAAC,MAAM,aAAa,CAAA;AAC9D,OAAO,EAAC,MAAM,EAAC,MAAM,SAAS,CAAA;AAG9B,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAC,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,OAAO,EAAE,CAAA;IACtB,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;AAC/D,CAAC,CAAA","sourcesContent":["/**\n * Engine apps store — runtime state of installed and local applets.\n *\n * The OEM-facing API: subscribe to the running set, install/uninstall\n * miniapps, start/stop them. The store delegates install plumbing to\n * AppRegistry, and exposes hooks (`useApps`, `useStart`, `useStop`,\n * `useRefresh`, `useStopAll`) that the host UI can read.\n *\n * Source of `apps`:\n * - Local: appRegistry.getInstalledMiniapps() (always)\n */\n\nimport {useMemo} from \"react\"\nimport {AsyncResult, Result, result as Res} from \"typesafe-ts\"\nimport {create} from \"zustand\"\n\nimport type {ClientApp} from \"../types/applet\"\nimport {DeviceTypes} from \"../types/enums\"\nimport {getModelCapabilities} from \"../types/hardware\"\nimport {HardwareCompatibility, type CompatibilityResult} from \"../utils/hardware/hardware\"\nimport {storage} from \"../utils/storage/storage\"\nimport appRegistry, {saveAlwaysOnOverride} from \"../services/AppRegistry\"\nimport localDisplayManager from \"../services/LocalDisplayManager\"\nimport {islandNotifications} from \"../services/NotificationsEmitter\"\nimport sttModelManager from \"../services/STTModelManager\"\nimport {miniappLauncher} from \"../services/MiniappLauncher\"\nimport {isMiniappsPaused, onMiniappsPauseChange} from \"../services/MiniappPauseCoordinator\"\nimport {miniappRunningRegistry} from \"../services/MiniappRunningRegistry\"\nimport {miniappWidgetMode} from \"../services/MiniappWidgetMode\"\nimport {defaultHiddenStatus, isGatedByDevTools, isGatedUntilPaired, resolveHiddenStatus} from \"./appVisibility\"\nimport {SETTINGS, useSettingsStore} from \"./settings\"\nimport BluetoothSdk from \"@glassly/bluetooth-sdk\"\nimport type {MiniappLaunchSource} from \"@glassly/miniapp\"\n\n// ---------------------------------------------------------------------------\n// Configuration / hooks\n// ---------------------------------------------------------------------------\n\nexport interface StartOptions {\n skipNavigation?: boolean\n /** Reported to the miniapp on connect. Defaults to \"phone\". */\n launchSource?: MiniappLaunchSource\n}\n\nexport interface AppStoreHooks {\n /**\n * A start was blocked because the app is hardware-incompatible. Engine made\n * the decision (and raised the `version_incompatible` notification); the host\n * renders its branded alert here.\n */\n onIncompatibleBlocked?: (app: ClientApp) => void\n /**\n * A start was blocked because the app requires the on-device STT model\n * (declared at registration — see AppRegistry.installOfflineApp) and none is\n * installed. Engine decided via its model manager; the host renders the\n * alert / settings navigation here.\n */\n onMissingSpeechModel?: (app: ClientApp) => void\n /**\n * An open request passed the gates — fired on EVERY open, including\n * re-opening an already-running app, so the host's navigation / open\n * animation always plays.\n */\n onOpenRequested?: (app: ClientApp, opts?: StartOptions) => void\n}\n\nlet hostHooks: AppStoreHooks = {}\n\nexport function installAppStoreHooks(hooks: AppStoreHooks): void {\n hostHooks = {...hostHooks, ...hooks}\n}\n\n// ---------------------------------------------------------------------------\n// Store\n// ---------------------------------------------------------------------------\n\ninterface AppStatusState {\n apps: ClientApp[]\n /**\n * Source of truth for which app is foregrounded in the Compositor overlay.\n * The per-app `foregrounded` boolean is derived from this in `projectApps`\n * so a refresh can never drop the flag when an app is transiently missing\n * from one of the two refresh passes (local-only then merged). See\n * `projectApps` / `setForeground` / `clearForeground`.\n */\n foregroundedPackage: string | null\n refresh: () => Promise<void>\n /** Resolves true if the app actually started; false if a host gate aborted it or its JS context failed to spawn. */\n start: (app: ClientApp, opts?: StartOptions) => Promise<boolean>\n stop: (packageName: string) => Promise<void>\n setForeground: (packageName: string) => Promise<void>\n clearForeground: () => void\n stopAll: () => AsyncResult<void, Error>\n install: (url: string, opts?: {versionOverride?: string}) => AsyncResult<void, Error>\n uninstall: (packageName: string, version?: string) => AsyncResult<void, Error>\n saveScreenshot: (packageName: string, screenshot: string) => Promise<void>\n setHiddenStatus: (packageName: string, status: boolean) => void\n getHiddenStatus: (packageName: string) => boolean\n /**\n * Mark a miniapp Always On: it starts at launch and only stops from the\n * app switcher's Always On pill (its card cannot be swiped away and the\n * capsule close minimizes it). Turning it on starts the app; turning it\n * off leaves it running. Persists the wearer's choice beside the hidden flag.\n */\n setAlwaysOn: (packageName: string, status: boolean) => Promise<void>\n /** Replace the whole apps array. Hosts use this when their extra source changes. */\n setApps: (apps: ClientApp[]) => void\n}\n\nexport const DUMMY_APPLET: ClientApp = {\n packageName: \"\",\n name: \"\",\n webviewUrl: \"\",\n logoUrl: \"\",\n type: \"standard\",\n permissions: [],\n running: false,\n loading: false,\n healthy: true,\n hardwareRequirements: [],\n offline: true,\n offlineRoute: \"\",\n local: false,\n hidden: false,\n}\n\nexport type OrderMap = Record<string, number>\nconst APP_ORDER_KEY = \"foreground_apps_order\"\n\nexport const saveAppsOrder = (orderMap: OrderMap): Result<void, Error> => {\n return storage.save(APP_ORDER_KEY, orderMap)\n}\n\nexport const getAppsOrder = (): Result<OrderMap, Error> => {\n return storage.load<OrderMap>(APP_ORDER_KEY)\n}\n\n// In-memory cache for hidden flags. `projectApps` reads getHiddenStatus once\n// per app per refresh — without a cache that was a synchronous JNI hop per\n// app per refresh on a hot UI path. Kept consistent with disk by writing\n// through in setHiddenStatus. Map of packageName → hidden boolean.\nconst hiddenStatusCache = new Map<string, boolean>()\n\nconst getRawPackageNamePriority = (pkg: string): number => {\n if (pkg.includes(\"@empty\")) {\n return 1000\n }\n return 0\n}\n\nexport const sortAppsByPackageNamePriority = (a: ClientApp, b: ClientApp): number => {\n const pa = getRawPackageNamePriority(a.packageName)\n const pb = getRawPackageNamePriority(b.packageName)\n if (pa !== pb) {\n return pa - pb\n }\n return a.name.localeCompare(b.name)\n}\n\nexport const saveLastOpenTime = (packageName: string): void => {\n storage.save(`${packageName}_last_open_time`, Date.now())\n}\n\nexport const getLastOpenTime = (packageName: string): number => {\n const res = storage.load<number>(`${packageName}_last_open_time`)\n if (res.is_ok()) return res.value\n return 0\n}\n\nexport const sortAppsByLastOpenTime = async <T extends {packageName: string}>(apps: T[]): Promise<T[]> => {\n const timestamps = apps.map((app) => ({app, time: getLastOpenTime(app.packageName)}))\n return timestamps.sort((a, b) => a.time - b.time).map((entry) => entry.app)\n}\n\nconst startStopApp = async (app: ClientApp, status: boolean): Promise<void> => {\n if (!status && app.onStop) {\n try {\n app.onStop()\n } catch (e) {\n console.warn(`ISLAND: onStop threw for ${app.packageName}`, e)\n }\n }\n if (status && app.onStart) {\n try {\n app.onStart()\n } catch (e) {\n console.warn(`ISLAND: onStart threw for ${app.packageName}`, e)\n }\n }\n}\n\n/**\n * Build the final `apps` array for the store from the installed/offline app\n * source. Pure — same inputs -> same outputs.\n */\nfunction projectApps(previousState: AppStatusState, localApps: ClientApp[]): ClientApp[] {\n // Dedupe by packageName, keep first occurrence.\n const byPackage = new Map<string, ClientApp>()\n for (const app of localApps) {\n if (!byPackage.has(app.packageName)) byPackage.set(app.packageName, app)\n }\n\n // Index previous snapshot for cheap lookups (was O(N²) via .find()).\n const previousByPackage = new Map<string, ClientApp>()\n for (const oldApp of previousState.apps) {\n previousByPackage.set(oldApp.packageName, oldApp)\n }\n\n const defaultWearable =\n (useSettingsStore.getState().getSetting(SETTINGS.default_wearable.key) as DeviceTypes | undefined) ||\n DeviceTypes.NONE\n const capabilities = getModelCapabilities(defaultWearable)\n const devToolsEnabled = useSettingsStore.getState().getSetting(SETTINGS.dev_tools.key) === true\n const hasPairedGlasses = useSettingsStore.getState().getSetting(SETTINGS.has_paired_glasses.key) === true\n\n // Single pass: dedupe → screenshot carry-over → compat → hidden, all into\n // fresh objects. The previous in-place mutation re-used object references\n // across refreshes, which broke React.memo / referential-equality\n // memoization downstream (every refresh propagated re-renders even when\n // nothing meaningful changed) AND tripped Reanimated's \"tried to modify\n // key of an object already passed to a worklet\" warning whenever the home\n // screen's animated app cards held a reference to a previous snapshot's\n // app object that we then mutated.\n //\n // Identity stability: refresh() is event-driven and fires repeatedly (and\n // twice per cycle via the local-only → merged two-pass emit). If we always\n // returned fresh objects, every poll changed the identity of EVERY app —\n // which re-rendered the Compositor (via useForegroundApp) mid-slide and made\n // the open/close animation hitch, and churned the home grid / switcher pill.\n // So we build the candidate object, then REUSE the previous reference when\n // nothing meaningful changed. Same pattern as the miniappRunningRegistry\n // projection below. A stable foreground-app reference lets the Compositor's\n // slide run uninterrupted on the UI thread.\n return Array.from(byPackage.values())\n .filter(\n (app) =>\n !isGatedByDevTools(app.packageName, devToolsEnabled) &&\n !isGatedUntilPaired(app.packageName, devToolsEnabled, hasPairedGlasses),\n )\n .map((app) => {\n const next: ClientApp = {\n ...app,\n screenshot: previousByPackage.get(app.packageName)?.screenshot ?? app.screenshot,\n compatibility: HardwareCompatibility.checkCompatibility(app.hardwareRequirements, capabilities),\n // A registry source can force an app off the primary home screen.\n // Compose that gate with the user's persisted home-screen layout instead\n // of replacing it, otherwise a default-false persisted value makes a\n // source-hidden app visible again during projection.\n hidden: resolveHiddenStatus(app.hidden, previousState.getHiddenStatus(app.packageName)),\n // Derive the foreground flag from the store's single source of truth\n // (`foregroundedPackage`), NOT from the previous snapshot. Carrying it over\n // per-app meant a refresh that momentarily omitted an app (e.g. the\n // two-pass local-only → merged emit) would reset its flag to false — which\n // raced OfflineAppHost's interceptor guard and made the hosted miniapp fall\n // through to the root router (restart). Deriving here keeps the flag stable\n // across both passes.\n foregrounded: app.packageName === previousState.foregroundedPackage,\n paused: app.local && app.running && isMiniappsPaused(),\n }\n const prev = previousByPackage.get(app.packageName)\n return prev && shallowEqualApp(prev, next) ? prev : next\n })\n}\n\n// Cheap equality check used by projectApps to preserve object identity across\n// refreshes when nothing meaningful changed. Most keys are compared by\n// reference (the source app's nested fields — permissions, hardwareRequirements,\n// parameters — are reference-stable within a refresh). The ONE exception is\n// `compatibility`, which projectApps recomputes into a fresh object every call;\n// comparing it by reference would always differ and defeat the whole point. We\n// compare it structurally instead so identity is only broken when the device's\n// actual compatibility verdict changes (e.g. glasses connect/disconnect).\nfunction shallowEqualApp(a: ClientApp, b: ClientApp): boolean {\n const aKeys = Object.keys(a) as (keyof ClientApp)[]\n const bKeys = Object.keys(b) as (keyof ClientApp)[]\n if (aKeys.length !== bKeys.length) return false\n for (const k of aKeys) {\n if (k === \"compatibility\") {\n if (!compatibilityEqual(a.compatibility, b.compatibility)) return false\n continue\n }\n if (a[k] !== b[k]) return false\n }\n return true\n}\n\nfunction compatibilityEqual(a?: CompatibilityResult, b?: CompatibilityResult): boolean {\n if (a === b) return true\n if (!a || !b) return false\n return (\n a.isCompatible === b.isCompatible &&\n a.missingRequired.length === b.missingRequired.length &&\n a.missingOptional.length === b.missingOptional.length &&\n a.warnings.length === b.warnings.length\n )\n}\n\nexport const useAppStatusStore = create<AppStatusState>((set, get) => ({\n apps: [],\n foregroundedPackage: null,\n\n refresh: async () => {\n const previousState = get()\n const localApps = await appRegistry.getInstalledMiniapps()\n set({apps: projectApps(previousState, localApps)})\n },\n\n start: async (clientApp: ClientApp, opts?: StartOptions) => {\n const state = get()\n const packageName = clientApp.packageName\n const app = state.apps.find((a) => a.packageName === packageName)\n if (!app) {\n console.error(`ISLAND: app not found for package name: ${packageName}`)\n return false\n }\n\n // Skip spawning a NEW app while another is mid-launch — concurrent spawns\n // race the foreground-only-one teardown. This is checked BEFORE the gates\n // and the onOpenRequested seam (which navigates/foregrounds) so a gated\n // launch doesn't paint a splash it can't back. Re-opening an already-running\n // app is exempt: it has nothing to spawn, so it skips this gate and is\n // allowed to re-navigate/animate below.\n // That exemption is the fix for the \"second tap during another app's launch\n // window silently does nothing\" bug.\n if (!app.running && state.apps.some((a) => a.loading)) {\n console.log(`ISLAND: skipping start ${packageName} — another app is loading`)\n return false\n }\n\n if (!app.offline && !app.local) {\n console.warn(`ISLAND: cloud-v1 app entries are no longer supported: ${packageName}`)\n return false\n }\n\n // Hardware-compatibility gate — engine decides and blocks; the host renders\n // its branded alert via onIncompatibleBlocked (and/or the structured\n // notification below). `!isCompatible` (not `=== false`) keeps the semantics\n // of the host gate this replaces: an unknown verdict blocks, not launches.\n if (!app.compatibility?.isCompatible) {\n islandNotifications.emit({\n kind: \"version_incompatible\",\n packageName,\n reason: `${app.name ?? packageName} is not compatible with the connected glasses`,\n metadata: {missingRequired: app.compatibility?.missingRequired ?? []},\n timestamp: Date.now(),\n })\n hostHooks.onIncompatibleBlocked?.(app)\n return false\n }\n\n // Missing-speech-model gate for apps registered with requiresLocalSttModel.\n // Engine decides via its own model manager; the host renders the alert and\n // any settings navigation via onMissingSpeechModel.\n if (appRegistry.requiresLocalSttModel(packageName) && !(await sttModelManager.isModelAvailable())) {\n islandNotifications.emit({\n kind: \"missing_speech_model\",\n packageName,\n reason: `${app.name ?? packageName} needs an on-device speech model before it can start`,\n timestamp: Date.now(),\n })\n hostHooks.onMissingSpeechModel?.(app)\n return false\n }\n\n // Host navigation / open-animation seam. Runs on EVERY accepted open —\n // including re-opening an already-running app — so the animation always\n // plays (BuiltInMiniappCatalog.navigateForApp: overlay apps setForeground\n // for the slide).\n hostHooks.onOpenRequested?.(app, opts)\n\n // First-activation mark (moved from the host's old beforeStart — engine\n // owns the settings store).\n useSettingsStore.getState().setSetting(SETTINGS.has_ever_activated_app.key, true)\n\n // If the tapped app is already running, this is a re-open: the nav/foreground\n // above already drove the animation, and there's nothing to spawn. Short-\n // circuit before the spawn pipeline. An app running only for its widget\n // is promoted instead: it keeps its context and takes the foreground.\n if (app.running && !app.widgetOnly) {\n saveLastOpenTime(packageName)\n return true\n }\n if (app.widgetOnly) miniappWidgetMode.setWidgetOnly(packageName, false)\n\n // Only-one rules: one standard app in the foreground, one dashboard\n // drawing the overlay. Starting another stops the one running. Widget-only\n // peers hold no foreground, so they stay.\n if (app.type === \"standard\" || app.type === \"dashboard\") {\n const runningPeers = state.apps.filter(\n (a) => a.running && !a.widgetOnly && a.type === app.type && a.packageName !== packageName,\n )\n for (const r of runningPeers) {\n await get().stop(r.packageName)\n }\n }\n\n set((s) => ({\n apps: s.apps.map((a) => (a.packageName === packageName ? {...a, running: true, loading: false} : a)),\n }))\n\n saveLastOpenTime(packageName)\n await startStopApp(app, true)\n\n // Spawn the background JS context for local miniapps. This used to be a\n // side effect of LocalMiniappView mounting on foreground; pulling it here\n // lets start() actually run the app even when nothing foregrounds it (e.g.\n // a system app launching another miniapp via session.miniapps). Idempotent\n // with the view's own ensureRunning; a no-op for native offline built-ins\n // (no JS bundle).\n if (app.local) {\n try {\n await miniappLauncher.ensureRunning(packageName, {launchSource: opts?.launchSource ?? \"phone\"})\n } catch (e) {\n // Spawn / bundle-resolve failed — revert the optimistic running flag so\n // the home list and miniapps.list() don't show a \"running\" app with no\n // JS context, and report failure to the caller (session.miniapps.start).\n console.warn(`ISLAND: launcher.ensureRunning failed for ${packageName}`, e)\n set((s) => ({\n apps: s.apps.map((a) => (a.packageName === packageName ? {...a, running: false, loading: false} : a)),\n }))\n // onStart already ran before the spawn; run onStop to undo it.\n await startStopApp(app, false)\n return false\n }\n }\n\n return true\n },\n\n stop: async (packageName: string) => {\n const state = get()\n const app = state.apps.find((a) => a.packageName === packageName)\n if (!app) {\n console.error(`ISLAND: app not found for package name: ${packageName}`)\n return\n }\n\n // A placed widget provider is the dashboard's to keep: closing it from\n // the tray takes its card and its frame, and it runs on in widget mode.\n if (app.local && app.running && miniappWidgetMode.isPlaced(packageName)) {\n if (!app.widgetOnly) {\n miniappWidgetMode.setWidgetOnly(packageName, true)\n localDisplayManager.onUnmount(packageName)\n set((s) => ({\n foregroundedPackage: s.foregroundedPackage === packageName ? null : s.foregroundedPackage,\n apps: s.apps.map((a) =>\n a.packageName === packageName ? {...a, screenshot: undefined, foregrounded: false, loading: false} : a,\n ),\n }))\n }\n return\n }\n\n set((s) => ({\n apps: s.apps.map((a) =>\n a.packageName === packageName ? {...a, running: false, screenshot: undefined, loading: false} : a,\n ),\n }))\n\n // if there are no apps running, call clearDisplay():\n // read fresh state via get() — `state` was captured before the set() above, so it still shows\n // this app as running and would never reach 0 when stopping the last app.\n if (get().apps.filter((a) => a.running).length === 0) {\n BluetoothSdk.clearDisplay()\n }\n await startStopApp(app, false)\n\n // Tear down the background JS context for local miniapps. No-op for native\n // offline built-ins.\n if (app.local) {\n try {\n await miniappLauncher.stop(packageName)\n } catch (e) {\n console.warn(`ISLAND: launcher.stop failed for ${packageName}`, e)\n }\n }\n },\n\n setForeground: async (packageName: string) => {\n const app = get().apps.find((a) => a.packageName === packageName)\n if (!app) {\n console.error(`ISLAND: setForeground — app not found: ${packageName}`)\n return\n }\n\n // Flip the foreground flag synchronously so the Compositor's open\n // animation starts on the same frame as the tap. We do NOT await start()\n // first — that gated the flag (and thus the animation) behind the whole\n // JSContext-spawn chain, which was the perceived launch delay. The\n // Compositor/LocalMiniappView already handle the spawn being in-flight\n // (the phase machine), so foregrounding needn't wait for it.\n saveLastOpenTime(packageName)\n set((s) => ({\n foregroundedPackage: packageName,\n apps: s.apps.map((a) => ({...a, foregrounded: a.packageName === packageName})),\n }))\n\n // Ensure the JSContext exists. start() is idempotent for an\n // already-running app and enforces the foreground-only-one rule for\n // standard apps. Fire-and-forget after the flag flip so it doesn't block\n // paint.\n // if (!app.running) {\n // get().start(app)\n // }\n },\n\n clearForeground: () => {\n set((s) => ({\n foregroundedPackage: null,\n apps: s.apps.some((a) => a.foregrounded)\n ? s.apps.map((a) => (a.foregrounded ? {...a, foregrounded: false} : a))\n : s.apps,\n }))\n },\n\n stopAll: () => {\n return Res.try_async(async () => {\n // Always On apps stay up; they stop one at a time from the switcher.\n // Widget-only apps have no card to close; they are the dashboard's.\n const running = get().apps.filter((a) => a.running && !a.alwaysOn && !a.widgetOnly)\n for (const a of running) {\n await get().stop(a.packageName)\n }\n })\n },\n\n install: (url, opts) => appRegistry.installFromUrl(url, opts),\n\n uninstall: (packageName, version) => {\n return Res.try_async(async () => {\n const res = await appRegistry.uninstall(packageName, version)\n if (res.is_error()) throw res.error\n set((s) => ({apps: s.apps.filter((a) => a.packageName !== packageName)}))\n })\n },\n\n saveScreenshot: async (packageName: string, screenshot: string) => {\n storage.save(`${packageName}_screenshot`, screenshot)\n set((s) => ({\n apps: s.apps.map((a) => (a.packageName === packageName ? {...a, screenshot} : a)),\n }))\n },\n\n setHiddenStatus: (packageName: string, status: boolean) => {\n hiddenStatusCache.set(packageName, status)\n set((s) => ({\n apps: s.apps.map((a) => (a.packageName === packageName ? {...a, hidden: status} : a)),\n }))\n storage.save(`${packageName}_hidden`, status)\n if (!status) {\n const orderMap = getAppsOrder()\n if (orderMap.is_ok()) {\n delete orderMap.value[packageName]\n saveAppsOrder(orderMap.value)\n }\n }\n },\n\n getHiddenStatus: (packageName: string): boolean => {\n const cached = hiddenStatusCache.get(packageName)\n if (cached !== undefined) return cached\n const res = storage.load<boolean>(`${packageName}_hidden`)\n const value = res.is_ok() ? res.value : defaultHiddenStatus(packageName)\n hiddenStatusCache.set(packageName, value)\n return value\n },\n\n setAlwaysOn: async (packageName: string, status: boolean) => {\n const app = get().apps.find((a) => a.packageName === packageName)\n if (!app) return\n // One dashboard is Always On at a time: marking this one clears the others.\n const cleared =\n status && app.type === \"dashboard\"\n ? get().apps.filter((a) => a.type === \"dashboard\" && a.alwaysOn && a.packageName !== packageName)\n : []\n saveAlwaysOnOverride(packageName, status)\n for (const other of cleared) saveAlwaysOnOverride(other.packageName, false)\n set((s) => ({\n apps: s.apps.map((a) => {\n if (a.packageName === packageName) return {...a, alwaysOn: status}\n if (cleared.includes(a)) return {...a, alwaysOn: false}\n return a\n }),\n }))\n if (status && !app.running) await get().start(app, {skipNavigation: true})\n },\n\n setApps: (apps) => set({apps}),\n}))\n\n// Project miniappRunningRegistry membership into the store's `running` field\n// (and the pause coordinator's state into `paused`) for local apps so the home\n// tray and switcher reflect actual mount state without waiting for the next\n// refresh() cycle.\nfunction projectLocalRunningState(): void {\n const running = new Set(miniappRunningRegistry.getAll())\n const pausedNow = isMiniappsPaused()\n const state = useAppStatusStore.getState()\n let changed = false\n const updated = state.apps.map((app) => {\n if (!app.local) return app\n const next = running.has(app.packageName)\n const paused = next && pausedNow\n const widgetOnly = next && miniappWidgetMode.isWidgetOnly(app.packageName)\n if (app.running === next && (app.paused ?? false) === paused && (app.widgetOnly ?? false) === widgetOnly) return app\n changed = true\n return {...app, running: next, paused, widgetOnly}\n })\n if (changed) {\n useAppStatusStore.setState({apps: updated})\n }\n}\nminiappRunningRegistry.subscribe(projectLocalRunningState)\nminiappWidgetMode.subscribe(projectLocalRunningState)\nonMiniappsPauseChange(projectLocalRunningState)\n\n// The display-manager's core (foreground) slot is DERIVED state: always the\n// currently-running standard app, no matter HOW it came to run — user tap\n// (start()), boot restore (autostartLocalMiniapps → registry projection\n// above), crash-respawn, or interop. One reconciler instead of per-path call\n// sites, so no launch/stop path can forget to claim or release the slot.\n// onCoreAppChange is idempotent, so firing on every store write is free.\nuseAppStatusStore.subscribe((state) => {\n const core = state.apps.find((a) => a.running && !a.widgetOnly && (a.type === \"standard\" || !a.type))\n localDisplayManager.onCoreAppChange(core?.packageName ?? null)\n})\n\n// AppRegistry change events trigger a store refresh.\nappRegistry.subscribe(() => {\n void useAppStatusStore.getState().refresh()\n})\n\n// Re-evaluate hardware compatibility when the paired/default wearable changes.\nuseSettingsStore.subscribe(\n (state) => state.getSetting(SETTINGS.default_wearable.key),\n () => {\n void useAppStatusStore.getState().refresh()\n },\n)\n\n// Developer tools toggled: dev-only apps enter or leave the projection. When\n// they leave, stop any that are running first so the running registry doesn't\n// keep a miniapp alive that no launcher surface can reach.\nuseSettingsStore.subscribe(\n (state) => state.getSetting(SETTINGS.dev_tools.key) === true,\n (enabled) => {\n void (async () => {\n if (!enabled) {\n const state = useAppStatusStore.getState()\n const hasPairedGlasses = useSettingsStore.getState().getSetting(SETTINGS.has_paired_glasses.key) === true\n for (const app of state.apps) {\n const gated =\n isGatedByDevTools(app.packageName, false) || isGatedUntilPaired(app.packageName, false, hasPairedGlasses)\n if (app.running && gated) await state.stop(app.packageName)\n }\n }\n await useAppStatusStore.getState().refresh()\n })()\n },\n)\n\n// First real pairing latched: the Store enters the projection. One-way, so\n// nothing ever leaves here.\nuseSettingsStore.subscribe(\n (state) => state.getSetting(SETTINGS.has_paired_glasses.key) === true,\n () => {\n void useAppStatusStore.getState().refresh()\n },\n)\n\n// ---------------------------------------------------------------------------\n// Public hooks\n// ---------------------------------------------------------------------------\n\nexport const useApps = () => useAppStatusStore((state) => state.apps)\nexport const useStart = () => useAppStatusStore((state) => state.start)\nexport const useStop = () => useAppStatusStore((state) => state.stop)\nexport const useSetForeground = () => useAppStatusStore((state) => state.setForeground)\nexport const useClearForeground = () => useAppStatusStore((state) => state.clearForeground)\nexport const useRefresh = () => useAppStatusStore((state) => state.refresh)\nexport const useStopAll = () => useAppStatusStore((state) => state.stopAll)\nexport const useInstall = () => useAppStatusStore((state) => state.install)\nexport const useUninstall = () => useAppStatusStore((state) => state.uninstall)\n\n/** Every running app with a card in the app switcher tray: widget-only apps have none. */\nexport const useActiveApps = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => app.running && !app.widgetOnly), [apps])\n}\n\n/** Apps running only for a widget the dashboard placed; the switcher's Widgets pill lists them. */\nexport const useWidgetApps = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => app.running && app.widgetOnly), [apps])\n}\n\n/** Always On apps whose background task is running, card or no card. */\nexport const useRunningAlwaysOnApps = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => app.alwaysOn && app.running), [apps])\n}\n\n/** Apps that run without a foreground surface: background ones and dashboards. */\nconst isBackgroundApp = (app: ClientApp): boolean => app.type === \"background\" || app.type === \"dashboard\"\n\nexport const useActiveBackgroundApps = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => isBackgroundApp(app) && app.running), [apps])\n}\n\nexport const useBackgroundApps = () => {\n const apps = useApps()\n return useMemo(\n () => ({\n active: apps.filter((app) => isBackgroundApp(app) && app.running),\n inactive: apps.filter((app) => isBackgroundApp(app) && !app.running),\n }),\n [apps],\n )\n}\n\nexport const useActiveForegroundApp = () => {\n const apps = useApps()\n return useMemo(\n () => apps.find((app) => (app.type === \"standard\" || !app.type) && app.running && !app.widgetOnly) ?? null,\n [apps],\n )\n}\n\n/**\n * The single app currently foregrounded in the Compositor overlay, or null.\n * Driven by setForeground/clearForeground — distinct from the \"active\n * standard app\" (running) selector above.\n */\nexport const useForegroundApp = () => {\n const apps = useApps()\n return useMemo(() => apps.find((app) => app.foregrounded) ?? null, [apps])\n}\n\nexport const useActiveBackgroundAppsCount = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => isBackgroundApp(app) && app.running).length, [apps])\n}\n\nexport const useLocalMiniApps = () => {\n const apps = useApps()\n return useMemo(() => apps.filter((app) => app.local), [apps])\n}\n"]}
@@ -81,6 +81,14 @@ export interface DeclaredAction {
81
81
  */
82
82
  visibility?: "public" | "system";
83
83
  }
84
+ export type DeclaredWidgetSize = "XS" | "SM" | "MD" | "LG";
85
+ /** A dashboard widget a miniapp declares in `miniapp.json` and serves through `session.widgets`. */
86
+ export interface DeclaredWidget {
87
+ id: string;
88
+ name: string;
89
+ sizes: DeclaredWidgetSize[];
90
+ defaultSize: DeclaredWidgetSize;
91
+ }
84
92
  export interface ClientApp extends AppletInterface {
85
93
  offline: boolean;
86
94
  offlineRoute: string;
@@ -116,5 +124,13 @@ export interface ClientApp extends AppletInterface {
116
124
  isMiniappDev?: boolean;
117
125
  /** Manifest-declared actions (for session.miniapps.list + invoke gating). */
118
126
  actions?: DeclaredAction[];
127
+ /** Manifest-declared dashboard widgets. */
128
+ widgets?: DeclaredWidget[];
129
+ /**
130
+ * Running only because a host placed one of its widgets: no card in the
131
+ * app switcher, no frame of its own on the glasses. Opening the app from
132
+ * the home screen promotes it to a normal run.
133
+ */
134
+ widgetOnly?: boolean;
119
135
  }
120
136
  //# sourceMappingURL=applet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"applet.d.ts","sourceRoot":"","sources":["../../src/types/applet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,2BAA2B,CAAA;AACrE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAA;A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AC,EAAE,OAAO,CAAA;IACtB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,cAAc,EAAE,CAAA;IAC1B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,cAAc,EAAE,CAAA;IAC1B;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"applet.js","sourceRoot":"","sources":["../../src/types/applet.ts"],"names":[],"mappings":"","sourcesContent":["import type {ManifestPermissionType} from \"@glassly/miniapp/manifest\"\nimport type {ReactNode} from \"react\"\n/**\n * App and miniapp types owned by @glassly/engine.\n */\n\nimport {HardwareRequirement} from \"./hardware\"\n\nimport type {CompatibilityResult} from \"../utils/hardware/hardware\"\n\n/**\n * App execution model types\n */\nexport type AppletType = \"standard\" | \"background\" | \"dashboard\"\n\n/**\n * Permission types that apps can request: the manifest vocabulary from the\n * SDK (the single source the CLI validator reads too) plus the host-only ALL.\n */\nexport type AppPermissionType = \"ALL\" | ManifestPermissionType\n\n/**\n * Permission object with type and description\n */\nexport interface AppletPermission {\n type: AppPermissionType\n description?: string\n required?: boolean\n}\n\n/**\n * Minimal app interface for client home screen display\n * Optimized for fast rendering - only essential fields\n *\n * This is the client-facing interface used by mobile apps.\n * Internal cloud services use AppI from models (more fields).\n */\nexport interface AppletInterface {\n packageName: string\n name: string\n webviewUrl: string\n logoUrl: string\n iconComponent?: ReactNode\n type: AppletType\n permissions: AppletPermission[]\n running: boolean\n /**\n * True while this app's UI WebView is mounted in the Compositor overlay.\n * At most one app is foregrounded at a time. Distinct from `running`:\n * a foregrounded app is always running, but a running app may be\n * backgrounded (JSContext alive, WebView torn down). Normalized to a\n * concrete boolean by the apps store's projectApps; literal call sites\n * may omit it.\n */\n foregrounded?: boolean\n healthy: boolean\n hardwareRequirements: HardwareRequirement[]\n /** ISO date string when the app was installed */\n installedDate?: string\n /** ISO date string when the app was last run. Undefined if never run (app is \"new\") */\n lastActiveAt?: string\n}\n\n/**\n * Runtime applet shape used by the engine apps store and OEM hosts.\n *\n * Extends AppletInterface with the host-side fields the manager / OEM tracks\n * outside the manifest: offline routing, hardware compatibility result,\n * loading/hidden/local flags, lifecycle hooks, screenshot, and the\n * dev-miniapp escape hatches (`devUrl` / `isMiniappDev`) that surface a\n * `glassly dev` snapshot.\n */\n/**\n * A manifest-declared action a miniapp exposes for other miniapps to invoke\n * via `session.actions`. Populated from `miniapp.json`'s `actions` field.\n * Shape maps 1:1 onto an MCP tool (id→name, description, parameters→inputSchema).\n */\nexport interface DeclaredAction {\n id: string\n description: string\n /** JSON-Schema input descriptor (MCP-compatible subset). */\n parameters?: Record<string, unknown>\n /** JSON-Schema descriptor for the action's structured result. */\n outputSchema?: Record<string, unknown>\n /**\n * Who may invoke the action: \"public\" (default — any installed miniapp) or\n * \"system\" (system miniapps such as the AI assistant only).\n */\n visibility?: \"public\" | \"system\"\n}\n\nexport interface ClientApp extends AppletInterface {\n offline: boolean\n offlineRoute: string\n compatibility?: CompatibilityResult\n loading: boolean\n local: boolean\n hidden: boolean\n /**\n * Always On miniapp: the host starts it at launch and it only stops from\n * the app switcher's Always On pill; its card cannot be swiped away and\n * the capsule close minimizes it. Manifest `alwaysOn` gives the default;\n * the wearer's choice persists beside the hidden flag.\n */\n alwaysOn?: boolean\n /** Running, but paused while the paired glasses are disconnected (MiniappPauseCoordinator). */\n paused?: boolean\n onStart?: () => void\n onStop?: () => void\n screenshot?: string\n runtimePermissions?: string[]\n declaredPermissions?: string[]\n version?: string\n /** Manifest `description`: the paragraph the store and the info page show. */\n description?: string\n /** Manifest `tagline`: one line under the name. */\n tagline?: string\n /** Manifest `tags`: lowercase store tag slugs. */\n tags?: string[]\n needsPcm?: boolean\n needsTranscript?: boolean\n devUrl?: string\n devPort?: number\n isMiniappDev?: boolean\n /** Manifest-declared actions (for session.miniapps.list + invoke gating). */\n actions?: DeclaredAction[]\n}\n"]}
1
+ {"version":3,"file":"applet.js","sourceRoot":"","sources":["../../src/types/applet.ts"],"names":[],"mappings":"","sourcesContent":["import type {ManifestPermissionType} from \"@glassly/miniapp/manifest\"\nimport type {ReactNode} from \"react\"\n/**\n * App and miniapp types owned by @glassly/engine.\n */\n\nimport {HardwareRequirement} from \"./hardware\"\n\nimport type {CompatibilityResult} from \"../utils/hardware/hardware\"\n\n/**\n * App execution model types\n */\nexport type AppletType = \"standard\" | \"background\" | \"dashboard\"\n\n/**\n * Permission types that apps can request: the manifest vocabulary from the\n * SDK (the single source the CLI validator reads too) plus the host-only ALL.\n */\nexport type AppPermissionType = \"ALL\" | ManifestPermissionType\n\n/**\n * Permission object with type and description\n */\nexport interface AppletPermission {\n type: AppPermissionType\n description?: string\n required?: boolean\n}\n\n/**\n * Minimal app interface for client home screen display\n * Optimized for fast rendering - only essential fields\n *\n * This is the client-facing interface used by mobile apps.\n * Internal cloud services use AppI from models (more fields).\n */\nexport interface AppletInterface {\n packageName: string\n name: string\n webviewUrl: string\n logoUrl: string\n iconComponent?: ReactNode\n type: AppletType\n permissions: AppletPermission[]\n running: boolean\n /**\n * True while this app's UI WebView is mounted in the Compositor overlay.\n * At most one app is foregrounded at a time. Distinct from `running`:\n * a foregrounded app is always running, but a running app may be\n * backgrounded (JSContext alive, WebView torn down). Normalized to a\n * concrete boolean by the apps store's projectApps; literal call sites\n * may omit it.\n */\n foregrounded?: boolean\n healthy: boolean\n hardwareRequirements: HardwareRequirement[]\n /** ISO date string when the app was installed */\n installedDate?: string\n /** ISO date string when the app was last run. Undefined if never run (app is \"new\") */\n lastActiveAt?: string\n}\n\n/**\n * Runtime applet shape used by the engine apps store and OEM hosts.\n *\n * Extends AppletInterface with the host-side fields the manager / OEM tracks\n * outside the manifest: offline routing, hardware compatibility result,\n * loading/hidden/local flags, lifecycle hooks, screenshot, and the\n * dev-miniapp escape hatches (`devUrl` / `isMiniappDev`) that surface a\n * `glassly dev` snapshot.\n */\n/**\n * A manifest-declared action a miniapp exposes for other miniapps to invoke\n * via `session.actions`. Populated from `miniapp.json`'s `actions` field.\n * Shape maps 1:1 onto an MCP tool (id→name, description, parameters→inputSchema).\n */\nexport interface DeclaredAction {\n id: string\n description: string\n /** JSON-Schema input descriptor (MCP-compatible subset). */\n parameters?: Record<string, unknown>\n /** JSON-Schema descriptor for the action's structured result. */\n outputSchema?: Record<string, unknown>\n /**\n * Who may invoke the action: \"public\" (default — any installed miniapp) or\n * \"system\" (system miniapps such as the AI assistant only).\n */\n visibility?: \"public\" | \"system\"\n}\n\nexport type DeclaredWidgetSize = \"XS\" | \"SM\" | \"MD\" | \"LG\"\n\n/** A dashboard widget a miniapp declares in `miniapp.json` and serves through `session.widgets`. */\nexport interface DeclaredWidget {\n id: string\n name: string\n sizes: DeclaredWidgetSize[]\n defaultSize: DeclaredWidgetSize\n}\n\nexport interface ClientApp extends AppletInterface {\n offline: boolean\n offlineRoute: string\n compatibility?: CompatibilityResult\n loading: boolean\n local: boolean\n hidden: boolean\n /**\n * Always On miniapp: the host starts it at launch and it only stops from\n * the app switcher's Always On pill; its card cannot be swiped away and\n * the capsule close minimizes it. Manifest `alwaysOn` gives the default;\n * the wearer's choice persists beside the hidden flag.\n */\n alwaysOn?: boolean\n /** Running, but paused while the paired glasses are disconnected (MiniappPauseCoordinator). */\n paused?: boolean\n onStart?: () => void\n onStop?: () => void\n screenshot?: string\n runtimePermissions?: string[]\n declaredPermissions?: string[]\n version?: string\n /** Manifest `description`: the paragraph the store and the info page show. */\n description?: string\n /** Manifest `tagline`: one line under the name. */\n tagline?: string\n /** Manifest `tags`: lowercase store tag slugs. */\n tags?: string[]\n needsPcm?: boolean\n needsTranscript?: boolean\n devUrl?: string\n devPort?: number\n isMiniappDev?: boolean\n /** Manifest-declared actions (for session.miniapps.list + invoke gating). */\n actions?: DeclaredAction[]\n /** Manifest-declared dashboard widgets. */\n widgets?: DeclaredWidget[]\n /**\n * Running only because a host placed one of its widgets: no card in the\n * app switcher, no frame of its own on the glasses. Opening the app from\n * the home screen promotes it to a normal run.\n */\n widgetOnly?: boolean\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glassly/engine",
3
- "version": "0.3.4-dev.704",
3
+ "version": "0.3.5-dev.705",
4
4
  "description": "Glassly Engine — miniapp registry, WebView bridge, and miniapp store",
5
5
  "main": "build/index.js",
6
6
  "react-native": "src/index.ts",
@@ -97,17 +97,17 @@
97
97
  "registry": "https://registry.npmjs.org/"
98
98
  },
99
99
  "dependencies": {
100
- "@glassly/bluetooth-sdk": "0.3.4-dev.704",
101
- "@glassly/cloud-client": "0.3.4-dev.704",
102
- "@glassly/cloud-protocol": "0.3.4-dev.704",
103
- "@glassly/crust": "0.3.4-dev.704",
104
- "@glassly/miniapp": "0.3.4-dev.704",
100
+ "@glassly/bluetooth-sdk": "0.3.5-dev.705",
101
+ "@glassly/cloud-client": "0.3.5-dev.705",
102
+ "@glassly/cloud-protocol": "0.3.5-dev.705",
103
+ "@glassly/crust": "0.3.5-dev.705",
104
+ "@glassly/miniapp": "0.3.5-dev.705",
105
105
  "buffer": "^6.0.3",
106
106
  "events": "^3.3.0",
107
107
  "react-native-marked": "8.1.1",
108
108
  "semver": "^7.7.4",
109
109
  "typesafe-ts": "^1.7.1",
110
- "@glassly/llm-providers": "0.3.4-dev.704",
110
+ "@glassly/llm-providers": "0.3.5-dev.705",
111
111
  "@huggingface/jinja": "^0.5.9",
112
112
  "jsonrepair": "^3.12.0"
113
113
  },
@@ -11,10 +11,10 @@ export interface EngineReleaseMetadata {
11
11
 
12
12
  export const ENGINE_RELEASE_METADATA: Readonly<EngineReleaseMetadata> = Object.freeze({
13
13
  "schemaVersion": 1,
14
- "familyBaseVersion": "0.3.4",
15
- "releaseIdentity": "0.3.4-dev.704",
16
- "releaseSetId": "glassly-0.3.4-dev.704",
17
- "sourceCommit": "db2c705927e6226277e89af2ef9e7464f92b3fde",
14
+ "familyBaseVersion": "0.3.5",
15
+ "releaseIdentity": "0.3.5-dev.705",
16
+ "releaseSetId": "glassly-0.3.5-dev.705",
17
+ "sourceCommit": "bf24ba8799753840b8f21a9b5a767a3dd4da6247",
18
18
  "otaManifestUrl": null,
19
19
  "otaManifestSha256": null
20
20
  })
package/src/index.ts CHANGED
@@ -195,6 +195,7 @@ export {
195
195
  useUninstall,
196
196
  useActiveApps,
197
197
  useRunningAlwaysOnApps,
198
+ useWidgetApps,
198
199
  useActiveBackgroundApps,
199
200
  useBackgroundApps,
200
201
  useActiveForegroundApp,
@@ -28,11 +28,11 @@ import {configuredDevHost} from "../utils/configuredDevHost"
28
28
  import {storage} from "../utils/storage/storage"
29
29
  import {printDirectory} from "../utils/storage/zip"
30
30
  import {checkManifestVersions} from "./manifestVersionGate"
31
- import {normalizeManifestActions} from "./manifestActions"
31
+ import {normalizeManifestActions, normalizeManifestWidgets} from "./manifestActions"
32
32
  import {normalizeManifestTags, normalizeManifestText} from "./manifestFields"
33
33
  import {miniappRunningRegistry} from "./MiniappRunningRegistry"
34
34
 
35
- export {normalizeManifestActions} from "./manifestActions"
35
+ export {normalizeManifestActions, normalizeManifestWidgets} from "./manifestActions"
36
36
 
37
37
  const ALLOWED_PERMISSION_TYPES: ReadonlySet<AppPermissionType> = new Set<AppPermissionType>([
38
38
  "MICROPHONE",
@@ -764,6 +764,7 @@ class AppRegistry {
764
764
  outputSchema?: unknown
765
765
  visibility?: unknown
766
766
  }>
767
+ widgets?: unknown
767
768
  } | null
768
769
 
769
770
  const permissions = normalizeManifestPermissions(manifest?.permissions)
@@ -775,6 +776,7 @@ class AppRegistry {
775
776
 
776
777
  // Declared actions (for session.miniapps.list + invoke gating).
777
778
  const actions = normalizeManifestActions(manifest?.actions)
779
+ const widgets = normalizeManifestWidgets(manifest?.widgets)
778
780
 
779
781
  // Dev miniapps live in the same lmas/ tree as installed ones, but
780
782
  // their version directory name starts with "dev-".
@@ -809,6 +811,7 @@ class AppRegistry {
809
811
  // declared-action membership unconditionally — an app with no declared
810
812
  // actions must reject every invoke, not bypass the check.
811
813
  actions,
814
+ ...(widgets.length > 0 ? {widgets} : {}),
812
815
  ...(isMiniappDev ? {isMiniappDev: true} : {}),
813
816
  ...(devUrl ? {devUrl} : {}),
814
817
  })
@@ -861,6 +864,7 @@ class AppRegistry {
861
864
  permissions,
862
865
  hardwareRequirements,
863
866
  actions: normalizeManifestActions(rec.actions),
867
+ ...(normalizeManifestWidgets(rec.widgets).length > 0 ? {widgets: normalizeManifestWidgets(rec.widgets)} : {}),
864
868
  isMiniappDev: true,
865
869
  devUrl: rec.devUrl,
866
870
  devPort: rec.devPort,
@@ -998,6 +1002,8 @@ export interface DevAppRecord {
998
1002
  outputSchema?: unknown
999
1003
  visibility?: unknown
1000
1004
  }>
1005
+ /** Manifest-declared dashboard widgets. */
1006
+ widgets?: unknown
1001
1007
  /** Legacy single-slot migration field. New records use the real packageName directly. */
1002
1008
  sourcePackageName?: string
1003
1009
  /**