Add memory-viewer from silicondawn
- Web UI for browsing and editing OpenClaw memory files - Cloned from https://github.com/silicondawn/memory-viewer - Built and running on port 8901 - Features: file tree, markdown rendering, search, live reload - Full access to MEMORY.md, daily notes, skills, automations
This commit is contained in:
BIN
memory-viewer/public/icon-192.png
Normal file
BIN
memory-viewer/public/icon-192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.8 KiB |
BIN
memory-viewer/public/icon-512.png
Normal file
BIN
memory-viewer/public/icon-512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
21
memory-viewer/public/manifest.json
Normal file
21
memory-viewer/public/manifest.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "Memory Viewer",
|
||||
"short_name": "Memory",
|
||||
"description": "Browse and edit your AI agent's memory files",
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"background_color": "#030712",
|
||||
"theme_color": "#030712",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/icon-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/icon-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
]
|
||||
}
|
||||
60
memory-viewer/public/sw.js
Normal file
60
memory-viewer/public/sw.js
Normal file
@@ -0,0 +1,60 @@
|
||||
const CACHE_NAME = 'memory-viewer-v1';
|
||||
const STATIC_ASSETS = ['/'];
|
||||
|
||||
// Install: cache shell
|
||||
self.addEventListener('install', (e) => {
|
||||
e.waitUntil(
|
||||
caches.open(CACHE_NAME).then((cache) => cache.addAll(STATIC_ASSETS))
|
||||
);
|
||||
self.skipWaiting();
|
||||
});
|
||||
|
||||
// Activate: clean old caches
|
||||
self.addEventListener('activate', (e) => {
|
||||
e.waitUntil(
|
||||
caches.keys().then((keys) =>
|
||||
Promise.all(keys.filter((k) => k !== CACHE_NAME).map((k) => caches.delete(k)))
|
||||
)
|
||||
);
|
||||
self.clients.claim();
|
||||
});
|
||||
|
||||
// Fetch: network-first for API, cache-first for assets
|
||||
self.addEventListener('fetch', (e) => {
|
||||
const url = new URL(e.request.url);
|
||||
|
||||
// API calls: network only
|
||||
if (url.pathname.startsWith('/api/') || url.pathname.startsWith('/ws')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Assets with hash in filename: cache-first (immutable)
|
||||
if (url.pathname.startsWith('/assets/') && url.pathname.match(/\-[a-zA-Z0-9_-]{8}\./)) {
|
||||
e.respondWith(
|
||||
caches.match(e.request).then((cached) => {
|
||||
if (cached) return cached;
|
||||
return fetch(e.request).then((resp) => {
|
||||
if (resp.ok) {
|
||||
const clone = resp.clone();
|
||||
caches.open(CACHE_NAME).then((cache) => cache.put(e.request, clone));
|
||||
}
|
||||
return resp;
|
||||
});
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// HTML: network-first, fallback to cache
|
||||
e.respondWith(
|
||||
fetch(e.request)
|
||||
.then((resp) => {
|
||||
if (resp.ok) {
|
||||
const clone = resp.clone();
|
||||
caches.open(CACHE_NAME).then((cache) => cache.put(e.request, clone));
|
||||
}
|
||||
return resp;
|
||||
})
|
||||
.catch(() => caches.match(e.request))
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user