lampson 0.2.8 → 0.2.10
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/.env.example +10 -1
- package/README.md +8 -3
- package/bin/lampson.js +1 -1
- package/chat.syn +111 -7
- package/cli.syn +143 -7
- package/edge.syn +26 -0
- package/hub.tpl.syn +127 -6
- package/lampson.ps1 +43 -2
- package/lampson.sh +40 -2
- package/lib/agents.syn +27 -6
- package/lib/approvals.syn +2 -2
- package/lib/auth.syn +274 -0
- package/lib/computer.syn +2000 -0
- package/lib/computer_judge.syn +410 -0
- package/lib/fs.syn +19 -3
- package/lib/git.syn +2 -2
- package/lib/judge.syn +78 -0
- package/lib/line.syn +2 -2
- package/lib/loop.syn +36 -4
- package/lib/lsp.syn +4 -4
- package/lib/mcp.syn +20 -4
- package/lib/md.syn +11 -11
- package/lib/origin.syn +67 -0
- package/lib/permission.syn +21 -2
- package/lib/prompt.syn +9 -1
- package/lib/provider.syn +70 -20
- package/lib/schedule.syn +12 -12
- package/lib/session.syn +5 -5
- package/lib/settings.syn +65 -1
- package/lib/skills.syn +22 -6
- package/lib/tools/bash.syn +1 -1
- package/lib/tools/common.syn +1 -1
- package/lib/tools/fetch.syn +98 -71
- package/lib/tools/grep.syn +1 -1
- package/lib/tools/memo.syn +3 -3
- package/lib/tools/proc.syn +38 -20
- package/lib/tools/qr.js +26 -0
- package/lib/tools/url.syn +5 -5
- package/lib/tools.syn +23 -2
- package/lib/trace.syn +2 -2
- package/lib/tree.syn +29 -13
- package/lib/update.syn +1 -1
- package/lib/workspaces.syn +202 -36
- package/package.json +3 -2
- package/public/apple-touch-icon.png +0 -0
- package/public/badge-96.png +0 -0
- package/public/css/code.css +48 -0
- package/public/css/hub.css +9 -0
- package/public/css/login.css +16 -0
- package/public/css/mobile.css +95 -0
- package/public/css/panel.css +30 -0
- package/public/css/tokens.css +1 -1
- package/public/hub.html +11 -1
- package/public/icon-192.png +0 -0
- package/public/icon-512.png +0 -0
- package/public/icon-maskable-512.png +0 -0
- package/public/icons-src/badge.svg +12 -0
- package/public/icons-src/icon-maskable.svg +15 -0
- package/public/icons-src/icon.svg +13 -0
- package/public/index.html +16 -3
- package/public/js/agents.js +1 -1
- package/public/js/chat.js +1 -1
- package/public/js/config.js +145 -2
- package/public/js/core.js +4 -2
- package/public/js/devices.js +80 -0
- package/public/js/editor.js +232 -0
- package/public/js/login.js +78 -0
- package/public/js/mobile.js +122 -0
- package/public/js/procs.js +1 -1
- package/public/js/pwa.js +5 -0
- package/public/js/terminal.js +1 -1
- package/public/js/tree.js +12 -4
- package/public/login.html +43 -0
- package/public/manifest.webmanifest +16 -0
- package/public/offline.html +24 -0
- package/public/sw.js +63 -0
- package/public/vendor/highlight.min.js +1343 -0
- package/public/vendor/qrcode.js +2297 -0
- package/skills/computer-use/SKILL.md +178 -0
- package/skills/lampson/SKILL.md +5 -0
- package/web.syn +67 -6
package/public/sw.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// sw.js — service worker de la PWA de lampson (base: el scaffold de `synsema init --pwa`).
|
|
2
|
+
// Red primero para todo: lampson cambia seguido y es una herramienta en vivo; mostrar una versión vieja de la UI
|
|
3
|
+
// sería peor que avisar. El caché solo sirve para abrir sin red: íconos, CSS/JS/fuentes y una página «sin conexión».
|
|
4
|
+
// Nunca se cachea el API (/api/…, /w/<slug>/api/…) ni una respuesta que falló, ni las páginas con datos del usuario.
|
|
5
|
+
const CACHE = "lampson-shell-v2";
|
|
6
|
+
const SHELL = ["/offline.html", "/manifest.webmanifest", "/icon-192.png", "/favicon.svg", "/css/tokens.css"];
|
|
7
|
+
|
|
8
|
+
self.addEventListener("install", (e) => {
|
|
9
|
+
e.waitUntil(caches.open(CACHE).then((c) => c.addAll(SHELL)).then(() => self.skipWaiting()));
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
self.addEventListener("activate", (e) => {
|
|
13
|
+
e.waitUntil(
|
|
14
|
+
caches.keys()
|
|
15
|
+
.then((keys) => Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k))))
|
|
16
|
+
.then(() => self.clients.claim())
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const tunnelDown = (res) => res.headers.get("x-synsema-tunnel") === "offline" || [502, 503, 504, 521, 522, 523, 524, 530].includes(res.status);
|
|
21
|
+
const isApi = (p) => p.startsWith("/api/") || /^\/w\/[^/]+\/(api|approve)\//.test(p);
|
|
22
|
+
const isAsset = (p) => /^\/(css|js|fonts|vendor)\//.test(p) || /\.(png|svg|webmanifest|woff2)$/.test(p);
|
|
23
|
+
|
|
24
|
+
self.addEventListener("fetch", (e) => {
|
|
25
|
+
const url = new URL(e.request.url);
|
|
26
|
+
if (e.request.method !== "GET" || url.origin !== self.location.origin) return;
|
|
27
|
+
if (isApi(url.pathname)) return; // SSE, WebSocket y JSON van directo a la red, sin tocar
|
|
28
|
+
if (e.request.mode === "navigate") {
|
|
29
|
+
// PC apagada o lampson caído: sin red → error de fetch; detrás de un túnel, el túnel SÍ responde, con su propia
|
|
30
|
+
// página de error (Cloudflare: 530/1033, 502, 504; un túnel de la plataforma marca X-Synsema-Tunnel: offline).
|
|
31
|
+
// En los dos casos, la pantalla de lampson. El hub nunca responde una página con esos códigos.
|
|
32
|
+
e.respondWith(fetch(e.request).then((res) => {
|
|
33
|
+
if (tunnelDown(res)) return caches.match("/offline.html").then((c) => c || res);
|
|
34
|
+
return res;
|
|
35
|
+
}).catch(() => caches.match("/offline.html")));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (isAsset(url.pathname)) {
|
|
39
|
+
e.respondWith(fetch(e.request).then(async (res) => {
|
|
40
|
+
if (res.ok) { const c = await caches.open(CACHE); await c.put(e.request, res.clone()); }
|
|
41
|
+
return res;
|
|
42
|
+
}).catch(async () => (await caches.match(e.request)) || Response.error()));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// push (para después: avisos de aprobaciones y de tareas terminadas)
|
|
47
|
+
self.addEventListener("push", (e) => {
|
|
48
|
+
let data = {};
|
|
49
|
+
try { data = e.data ? e.data.json() : {}; } catch (_) { data = { body: e.data ? e.data.text() : "" }; }
|
|
50
|
+
const opts = { body: data.body || "", icon: "/icon-192.png", badge: "/badge-96.png", data };
|
|
51
|
+
if (data.tag) { opts.tag = String(data.tag); opts.renotify = true; }
|
|
52
|
+
e.waitUntil(self.registration.showNotification(data.title || "Lampson", opts));
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
self.addEventListener("notificationclick", (e) => {
|
|
56
|
+
e.notification.close();
|
|
57
|
+
const url = (e.notification.data && e.notification.data.url) || "/";
|
|
58
|
+
e.waitUntil(clients.matchAll({ type: "window", includeUncontrolled: true }).then((wins) => {
|
|
59
|
+
const win = wins.find((w) => "focus" in w);
|
|
60
|
+
if (win) { win.postMessage({ type: "notificationclick", url }); return win.focus(); }
|
|
61
|
+
return clients.openWindow(url);
|
|
62
|
+
}));
|
|
63
|
+
});
|