@a-t-h-i/bot-lobby 0.6.12 → 0.6.13

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 (62) hide show
  1. package/README.md +11 -3
  2. package/package.json +31 -4
  3. package/src/ask/tool.ts +2 -1
  4. package/src/lobby/keys.ts +14 -1
  5. package/src/lobby/mini.ts +9 -1
  6. package/src/lobby/models/metrics.ts +14 -0
  7. package/src/lobby/planner.ts +1 -1
  8. package/src/lobby/prompt-hub.ts +161 -0
  9. package/src/lobby/prompts.ts +35 -0
  10. package/src/lobby/runtime.ts +115 -566
  11. package/src/lobby/service.ts +655 -0
  12. package/src/lobby/tabs/home.ts +1 -1
  13. package/src/lobby/tabs/metrics.ts +4 -6
  14. package/src/lobby/topics.ts +78 -0
  15. package/src/lobby/view.ts +29 -24
  16. package/src/pi/commands.ts +8 -2
  17. package/src/pi/owner.ts +2 -0
  18. package/src/pi/settings-ui.ts +52 -1
  19. package/src/pi/tools.ts +4 -3
  20. package/src/schemas/configuration.ts +33 -1
  21. package/src/state/changes.ts +1 -1
  22. package/src/state/persistence.ts +1 -1
  23. package/src/state/presence.ts +2 -0
  24. package/src/webui/api/excalidraw.ts +105 -0
  25. package/src/webui/api/gh-error.ts +17 -0
  26. package/src/webui/api/git.ts +98 -0
  27. package/src/webui/api/index.ts +379 -0
  28. package/src/webui/api/issues.ts +50 -0
  29. package/src/webui/api/knowledge.ts +79 -0
  30. package/src/webui/api/lobby.ts +91 -0
  31. package/src/webui/api/metrics.ts +63 -0
  32. package/src/webui/api/plan-facts.ts +29 -0
  33. package/src/webui/api/planner.ts +98 -0
  34. package/src/webui/api/plans.ts +44 -0
  35. package/src/webui/api/prompts.ts +35 -0
  36. package/src/webui/api/quickfix.ts +48 -0
  37. package/src/webui/api/sessions.ts +114 -0
  38. package/src/webui/api/settings.ts +93 -0
  39. package/src/webui/api/status.ts +55 -0
  40. package/src/webui/api/tasks.ts +204 -0
  41. package/src/webui/auth.ts +153 -0
  42. package/src/webui/command.ts +152 -0
  43. package/src/webui/dev/fake-service.ts +546 -0
  44. package/src/webui/dev/fixtures.ts +180 -0
  45. package/src/webui/dev/serve.ts +54 -0
  46. package/src/webui/events.ts +207 -0
  47. package/src/webui/files.ts +88 -0
  48. package/src/webui/notices.ts +61 -0
  49. package/src/webui/open.ts +35 -0
  50. package/src/webui/protocol.ts +565 -0
  51. package/src/webui/server.ts +315 -0
  52. package/src/webui/static.ts +125 -0
  53. package/webui/dist/assets/index-Bk-lpAGm.css +2 -0
  54. package/webui/dist/assets/index-E6MPcbdC.js +80 -0
  55. package/webui/dist/build.json +494 -0
  56. package/webui/dist/icon-192.png +0 -0
  57. package/webui/dist/icon-512.png +0 -0
  58. package/webui/dist/index.html +18 -0
  59. package/webui/dist/manifest.webmanifest +36 -0
  60. package/webui/dist/offline.html +57 -0
  61. package/webui/dist/sw.js +88 -0
  62. package/webui/dist/vite.svg +1 -0
@@ -0,0 +1,88 @@
1
+ /*
2
+ * bot-lobby service worker: cache the shell only.
3
+ *
4
+ * - `/api/` and `/files/` are never cached, never answered from cache, and
5
+ * never intercepted at all; the page always reaches Pi for them.
6
+ * - On install, `index.html` and the hashed assets it names are cached, plus
7
+ * an offline page. The cache name carries the build hash from
8
+ * `dist/build.json`, so a new build installs a new cache, activates and
9
+ * deletes the old one (the registration uses `updateViaCache: "none"`).
10
+ * - On fetch, a same-origin GET goes to the network first; a cache match (or
11
+ * the offline page for a navigation) is only used when the network fails.
12
+ */
13
+ const SHELL = [
14
+ "/index.html",
15
+ "/offline.html",
16
+ "/manifest.webmanifest",
17
+ "/icon-192.png",
18
+ "/icon-512.png",
19
+ "/vite.svg",
20
+ ]
21
+ const PREFIX = "bot-lobby-shell-"
22
+ const NEVER = /^\/(?:api|files)(?:\/|$)/
23
+
24
+ let cacheName = `${PREFIX}dev`
25
+
26
+ async function buildName() {
27
+ try {
28
+ const build = await fetch("/build.json", { cache: "no-store" }).then((response) => response.json())
29
+ if (build && typeof build.hash === "string" && build.hash) return `${PREFIX}${build.hash.slice(0, 16)}`
30
+ } catch {
31
+ // No build info (a mock or a first run): keep the default cache.
32
+ }
33
+ return cacheName
34
+ }
35
+
36
+ async function assets() {
37
+ try {
38
+ const html = await fetch("/index.html", { cache: "no-store" }).then((response) => response.text())
39
+ return Array.from(new Set([...SHELL, ...html.match(/\/(?:assets|@vite)[^"']+/g) ?? []]))
40
+ } catch {
41
+ return SHELL
42
+ }
43
+ }
44
+
45
+ async function install() {
46
+ cacheName = await buildName()
47
+ const cache = await caches.open(cacheName)
48
+ await cache.addAll(await assets())
49
+ }
50
+
51
+ self.addEventListener("install", (event) => {
52
+ event.waitUntil(install().then(() => self.skipWaiting()).catch(() => undefined))
53
+ })
54
+
55
+ self.addEventListener("activate", (event) => {
56
+ event.waitUntil(
57
+ caches
58
+ .keys()
59
+ .then((keys) => Promise.all(keys.filter((key) => key.startsWith(PREFIX) && key !== cacheName).map((key) => caches.delete(key))))
60
+ .then(() => self.clients.claim())
61
+ )
62
+ })
63
+
64
+ function cacheable(url) {
65
+ return url.origin === self.location.origin && !NEVER.test(url.pathname)
66
+ }
67
+
68
+ async function respond(request) {
69
+ try {
70
+ return await fetch(request)
71
+ } catch {
72
+ const cache = await caches.open(cacheName)
73
+ const hit = await cache.match(request, { ignoreSearch: true })
74
+ if (hit) return hit
75
+ if (request.mode === "navigate") {
76
+ const offline = await cache.match("/offline.html")
77
+ if (offline) return offline
78
+ }
79
+ throw new Error("offline")
80
+ }
81
+ }
82
+
83
+ self.addEventListener("fetch", (event) => {
84
+ const request = event.request
85
+ if (request.method !== "GET") return
86
+ if (!cacheable(new URL(request.url))) return
87
+ event.respondWith(respond(request))
88
+ })
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>