@bobfrankston/msgapidefs 0.1.40 → 0.1.41

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/.commitmsg ADDED
@@ -0,0 +1 @@
1
+ diag.requestHome() and MsgInstallInfo.isHomeApp (msga 1.5.52): make msga the device's Home app via Android's own confirmation dialog so relaunch after self-update / WebView update / crash is automatic; README Diagnostics documents getInstallInfo/requestHome/requestOverlay and the per-start "Relaunched <gap>" log line.
package/README.md CHANGED
@@ -216,7 +216,21 @@ for (const e of exits) {
216
216
 
217
217
  Interpreting common reasons: `LowMemory` = killed by the low-memory killer; `Anr` = main thread hung; `Crash`/`CrashNative` = unhandled exception / native crash; `Freezer` = app was frozen (Android 12+ cached-app freezing — UDP listeners silently suspended, app not actually dead); `UserRequested` = swiped away from recents; `PackageUpdated` = replaced by an APK update; `Signaled` = killed by signal (check `description`).
218
218
 
219
- msga also logs new exit records via MsgALog at startup when `LOGGING=true` in msga.env (`Previous exit: ...`), deduplicated across runs via a `lastSeenExitTimestamp` preference. See [msga/exit-diagnostics.md](../msga/exit-diagnostics.md) for the full design notes.
219
+ msga also logs new exit records via MsgALog at startup when `LOGGING=true` in msga.env (`Previous exit: ...`), deduplicated across runs via a `lastSeenExitTimestamp` preference, plus one `Relaunched <gap> after previous exit: ...` line per start (held until logging is turned on). See [msga/exit-diagnostics.md](../msga/exit-diagnostics.md) for the full design notes.
220
+
221
+ **Staying alive / coming back** (msga Android; other hosts resolve `'n/a'`):
222
+
223
+ - `diag.getInstallInfo()` - Returns `MsgInstallInfo`: `installer` / `selfInstalled` (whether the next update can be silent), `canDrawOverlays`, `canInstallPackages`, `isHomeApp` (1.5.52+), `sdkInt`.
224
+ - `diag.requestHome()` - Make msga the device's **Home app**. Android relaunches the Home app after *any* process death — self-update, System WebView update, crash, low-memory kill — with no other permission. On Android 10+ this shows the system's own one-button "Set as default Home app?" confirmation and resolves `'granted'` / `'denied'`; older Android opens the Home-settings list (`'opened'`). `'already'` if it is Home already. Recommended one-time step for a wall panel; a web app can offer it whenever `isHomeApp` is false. (msga 1.5.52+)
225
+ - `diag.requestOverlay()` - Opens the "Display over other apps" settings page (`'already'` / `'opened'`). The older alternative: with the grant, the post-self-update relaunch is allowed to reach the foreground, but it does nothing for a WebView-update kill. Prefer `requestHome()`.
226
+
227
+ ```javascript
228
+ // Panel setup: one tap, Android's own dialog
229
+ const info = await window.msgapi?.diag?.getInstallInfo?.();
230
+ if (info && info.isHomeApp === false) {
231
+ const r = await window.msgapi.diag.requestHome(); // 'granted' | 'denied' | 'opened' | ...
232
+ }
233
+ ```
220
234
 
221
235
  ### Window Control
222
236
 
package/msgapidefs.ts CHANGED
@@ -101,6 +101,7 @@ export interface MsgInstallInfo {
101
101
  selfInstalled: boolean; // true => next update can be silent
102
102
  canDrawOverlays: boolean; // true => post-update relaunch is allowed to foreground
103
103
  canInstallPackages: boolean;// "Install unknown apps" for this app
104
+ isHomeApp?: boolean; // true => msga is the device's Home app: Android relaunches it after ANY process death (msga 1.5.52+)
104
105
  sdkInt: number;
105
106
  }
106
107
 
@@ -134,6 +135,7 @@ export interface MsgAPI {
134
135
  getExitReasons(max?: number): Promise<MsgExitInfo[]>; // Previous-run exit records, newest first (default max 5). msga Android 11+ only; [] elsewhere.
135
136
  getInstallInfo?(): Promise<MsgInstallInfo>; // Installer of record + permission state (msga 1.5.48+)
136
137
  requestOverlay?(): Promise<'already' | 'opened' | 'n/a'>; // Open the Display-over-other-apps settings page
138
+ requestHome?(): Promise<'already' | 'granted' | 'denied' | 'opened' | 'n/a'>; // Make msga the Home app: system one-button confirmation (Android 10+), settings list before. Home app = automatic relaunch after self-update / WebView update / crash. msga 1.5.52+
137
139
  };
138
140
 
139
141
  // ── Window Control ──────────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/msgapidefs",
3
- "version": "0.1.40",
3
+ "version": "0.1.41",
4
4
  "description": "TypeScript definitions for msgapi JavaScript API (msgview/msger)",
5
5
  "type": "module",
6
6
  "main": "./msgapidefs.js",
package/tsconfig.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "compilerOptions": {
3
3
  "types": ["node"],
4
4
  "target": "ES2020",
5
- "module": "ES2020",
5
+ "module": "NodeNext",
6
6
  "lib": ["ES2020", "DOM"],
7
7
  "declaration": true,
8
8
  "outDir": ".",
@@ -11,7 +11,7 @@
11
11
  "esModuleInterop": true,
12
12
  "skipLibCheck": true,
13
13
  "forceConsistentCasingInFileNames": true,
14
- "moduleResolution": "node",
14
+ "moduleResolution": "NodeNext",
15
15
  "newLine": "lf"
16
16
  },
17
17
  "include": ["msgapidefs.ts"],