experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(diagnostic): migrate to tile-preload + strict shims (Phase 3.11b-diagnostic)

- Replace api.invoke('backup-create/list/get-config') with api.backup.create/list/getConfig()
- Replace api.invoke('shell-open-path', {path}) with api.shell.openPath(path)
- Hardcode tile-preload assignment for peek://app/diagnostic.html in ipc.ts window-open
handler (Option A): mint a trustedBuiltin token on-the-fly using createTrustedBuiltinGrant
+ generateToken, same pattern as hud-glue/cmd-glue — no manifest file needed
- Import createTrustedBuiltinGrant from tile-manifest.js and generateToken from tile-tokens.js
- Zero api.invoke() calls remain in diagnostic.html; api.datastore.getTable kept as-is

+27 -5
+4 -4
app/diagnostic.html
··· 152 152 window.createBackup = async function() { 153 153 logBackup('Creating Backup', 'Please wait...'); 154 154 try { 155 - const result = await api.invoke('backup-create'); 155 + const result = await api.backup.create(); 156 156 if (result.success) { 157 157 logBackup('Backup Created', `Successfully created backup:\n${result.path}`); 158 158 } else { ··· 166 166 window.listBackups = async function() { 167 167 logBackup('Loading', 'Fetching backup list...'); 168 168 try { 169 - const result = await api.invoke('backup-list'); 169 + const result = await api.backup.list(); 170 170 if (result.success) { 171 171 const { backups, backupDir } = result.data; 172 172 ··· 202 202 203 203 window.openBackupFolder = async function() { 204 204 try { 205 - const configResult = await api.invoke('backup-get-config'); 205 + const configResult = await api.backup.getConfig(); 206 206 if (!configResult.success) { 207 207 logBackup('Error', 'Failed to get backup config: ' + configResult.error, true); 208 208 return; ··· 214 214 return; 215 215 } 216 216 217 - const result = await api.invoke('shell-open-path', { path: backupDir }); 217 + const result = await api.shell.openPath(backupDir); 218 218 if (result.success) { 219 219 logBackup('Opened', `Opened backup folder:\n${backupDir}`); 220 220 } else {
+23 -1
backend/electron/ipc.ts
··· 87 87 88 88 import { getTileWebPreferencesForUrl } from './tile-launcher.js'; 89 89 import { getLazyTileManifest } from './tile-lazy.js'; 90 + import { createTrustedBuiltinGrant } from './tile-manifest.js'; 91 + import { generateToken } from './tile-tokens.js'; 90 92 91 93 import { 92 94 captureThumbnail, ··· 1032 1034 // 1033 1035 // Non-tile URLs (web pages, legacy extension content, new-tab, etc.) 1034 1036 // fall back to the legacy preload.js. 1035 - const tileWebPrefs = getTileWebPreferencesForUrl( 1037 + let tileWebPrefs = getTileWebPreferencesForUrl( 1036 1038 url, 1037 1039 getTilePreloadPath(), 1038 1040 getLazyTileManifest, 1039 1041 ); 1042 + 1043 + // Diagnostic is a developer-only utility; not a registered v2 tile but 1044 + // needs tile-preload so api.backup.* / api.shell.openPath strict shims work. 1045 + // Mint a trustedBuiltin token on-the-fly (same pattern as hud-glue / cmd-glue). 1046 + if (!tileWebPrefs && url === 'peek://app/diagnostic.html') { 1047 + const DIAG_ID = 'diagnostic'; 1048 + const DIAG_ENTRY = 'main'; 1049 + const diagGrant = createTrustedBuiltinGrant(DIAG_ID); 1050 + const diagToken = generateToken(DIAG_ID, DIAG_ENTRY, diagGrant); 1051 + tileWebPrefs = { 1052 + preload: getTilePreloadPath(), 1053 + additionalArguments: [ 1054 + `--tile-id=${DIAG_ID}`, 1055 + `--tile-entry=${DIAG_ENTRY}`, 1056 + `--tile-token=${diagToken}`, 1057 + ], 1058 + tileId: DIAG_ID, 1059 + entryId: DIAG_ENTRY, 1060 + }; 1061 + } 1040 1062 1041 1063 // Prepare browser window options 1042 1064 const winOptions: Electron.BrowserWindowConstructorOptions = {