bom-pi 0.0.0-stage → 0.0.2

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 (131) hide show
  1. package/README.md +33 -2
  2. package/apps/README.md +7 -0
  3. package/apps/web/README.md +21 -0
  4. package/apps/web/pocket-adapter.mjs +323 -0
  5. package/apps/web/public/LICENSE.pocket +21 -0
  6. package/apps/web/public/activity-fold.js +28 -0
  7. package/apps/web/public/agent-now.js +37 -0
  8. package/apps/web/public/agent-tile.js +79 -0
  9. package/apps/web/public/app.js +975 -0
  10. package/apps/web/public/apple-touch-icon.png +0 -0
  11. package/apps/web/public/artifact-bridge.js +687 -0
  12. package/apps/web/public/avatar.js +87 -0
  13. package/apps/web/public/back.js +554 -0
  14. package/apps/web/public/box-keys.js +216 -0
  15. package/apps/web/public/browser-panel.js +1097 -0
  16. package/apps/web/public/browser.js +68 -0
  17. package/apps/web/public/calls.js +139 -0
  18. package/apps/web/public/chat.js +919 -0
  19. package/apps/web/public/clock.js +34 -0
  20. package/apps/web/public/commands.js +578 -0
  21. package/apps/web/public/composer.js +2068 -0
  22. package/apps/web/public/diff-parse.js +672 -0
  23. package/apps/web/public/diff.js +1646 -0
  24. package/apps/web/public/dock.js +299 -0
  25. package/apps/web/public/extension-ui.js +2734 -0
  26. package/apps/web/public/files-panel.js +775 -0
  27. package/apps/web/public/files.js +368 -0
  28. package/apps/web/public/fonts/FiraCode-VF.woff2 +0 -0
  29. package/apps/web/public/fonts/Geist.woff2 +0 -0
  30. package/apps/web/public/fonts/IBMPlexMono-Variable-Italic.woff2 +0 -0
  31. package/apps/web/public/fonts/IBMPlexMono-Variable.woff2 +0 -0
  32. package/apps/web/public/fonts/InterVariable-Italic.woff2 +0 -0
  33. package/apps/web/public/fonts/InterVariable.woff2 +0 -0
  34. package/apps/web/public/fonts/Iosevka-Bold.woff2 +0 -0
  35. package/apps/web/public/fonts/Iosevka-BoldItalic.woff2 +0 -0
  36. package/apps/web/public/fonts/Iosevka-Italic.woff2 +0 -0
  37. package/apps/web/public/fonts/Iosevka-Regular.woff2 +0 -0
  38. package/apps/web/public/fonts/Iosevka-SemiBold.woff2 +0 -0
  39. package/apps/web/public/fonts/Iosevka-SemiBoldItalic.woff2 +0 -0
  40. package/apps/web/public/fonts/JetBrainsMono-Italic.woff2 +0 -0
  41. package/apps/web/public/fonts/JetBrainsMono.woff2 +0 -0
  42. package/apps/web/public/fonts/NerdFontsSymbolsMono.woff2 +0 -0
  43. package/apps/web/public/fonts/SOURCES.md +69 -0
  44. package/apps/web/public/gestures.js +610 -0
  45. package/apps/web/public/highlight.js +480 -0
  46. package/apps/web/public/history.js +70 -0
  47. package/apps/web/public/home.js +169 -0
  48. package/apps/web/public/icon-192.png +0 -0
  49. package/apps/web/public/icon-512.png +0 -0
  50. package/apps/web/public/icon-maskable-512.png +0 -0
  51. package/apps/web/public/icon.svg +16 -0
  52. package/apps/web/public/index.html +71 -0
  53. package/apps/web/public/launcher.js +1293 -0
  54. package/apps/web/public/linked-sessions.js +55 -0
  55. package/apps/web/public/live.js +39 -0
  56. package/apps/web/public/manifest.webmanifest +32 -0
  57. package/apps/web/public/model-refresh.js +73 -0
  58. package/apps/web/public/notify.js +251 -0
  59. package/apps/web/public/peeks.js +920 -0
  60. package/apps/web/public/pip-attachments.js +182 -0
  61. package/apps/web/public/pip-window.js +141 -0
  62. package/apps/web/public/pip.js +1217 -0
  63. package/apps/web/public/quote-reply.js +109 -0
  64. package/apps/web/public/quote-text.js +31 -0
  65. package/apps/web/public/rich.js +403 -0
  66. package/apps/web/public/run-frame.js +106 -0
  67. package/apps/web/public/safe-mode.js +71 -0
  68. package/apps/web/public/seen.js +169 -0
  69. package/apps/web/public/session-tree.js +117 -0
  70. package/apps/web/public/sessions.js +2695 -0
  71. package/apps/web/public/share.js +126 -0
  72. package/apps/web/public/sheets/appearance.js +820 -0
  73. package/apps/web/public/sheets/branch.js +353 -0
  74. package/apps/web/public/sheets/extensions.js +818 -0
  75. package/apps/web/public/sheets/file.js +318 -0
  76. package/apps/web/public/sheets/find.js +250 -0
  77. package/apps/web/public/sheets/folder.js +680 -0
  78. package/apps/web/public/sheets/gallery.js +2340 -0
  79. package/apps/web/public/sheets/hooks.js +350 -0
  80. package/apps/web/public/sheets/memory.js +531 -0
  81. package/apps/web/public/sheets/menu.js +580 -0
  82. package/apps/web/public/sheets/message.js +220 -0
  83. package/apps/web/public/sheets/model.js +412 -0
  84. package/apps/web/public/sheets/people.js +414 -0
  85. package/apps/web/public/sheets/pi-sessions.js +264 -0
  86. package/apps/web/public/sheets/providers.js +525 -0
  87. package/apps/web/public/sheets/running.js +130 -0
  88. package/apps/web/public/sheets/schedules.js +71 -0
  89. package/apps/web/public/sheets/session.js +249 -0
  90. package/apps/web/public/sheets/shortcuts.js +101 -0
  91. package/apps/web/public/sheets/spend.js +150 -0
  92. package/apps/web/public/sheets/text.js +53 -0
  93. package/apps/web/public/sheets/viewers.js +363 -0
  94. package/apps/web/public/sheets/worktree.js +50 -0
  95. package/apps/web/public/sheets.js +410 -0
  96. package/apps/web/public/signin.js +57 -0
  97. package/apps/web/public/slots.js +208 -0
  98. package/apps/web/public/store.js +1760 -0
  99. package/apps/web/public/style.css +18625 -0
  100. package/apps/web/public/subagents-board.js +879 -0
  101. package/apps/web/public/subagents.js +273 -0
  102. package/apps/web/public/sw.js +169 -0
  103. package/apps/web/public/taps.js +26 -0
  104. package/apps/web/public/theme-surface.d.ts +4 -0
  105. package/apps/web/public/theme-surface.js +266 -0
  106. package/apps/web/public/theme.js +845 -0
  107. package/apps/web/public/themes/lantern/colors.toml +25 -0
  108. package/apps/web/public/themes/lantern/direction.css +60 -0
  109. package/apps/web/public/themes/lantern/frame.css +254 -0
  110. package/apps/web/public/themes/lantern/theme.css +10 -0
  111. package/apps/web/public/themes/lantern/theme.json +7 -0
  112. package/apps/web/public/themes/pocket/theme.css +189 -0
  113. package/apps/web/public/themes/pocket/theme.json +6 -0
  114. package/apps/web/public/themes.js +556 -0
  115. package/apps/web/public/transcript.js +3348 -0
  116. package/apps/web/public/trust.js +295 -0
  117. package/apps/web/public/turns.js +507 -0
  118. package/apps/web/public/ui.js +1910 -0
  119. package/apps/web/public/voice.js +345 -0
  120. package/apps/web/server.mjs +774 -0
  121. package/package.json +43 -4
  122. package/packages/cli/src/bom-pi.mjs +452 -0
  123. package/packages/cli/templates/blank.factory.json +7 -0
  124. package/packages/cli/templates/dev.factory.json +11 -0
  125. package/packages/cli/templates/docs.factory.json +12 -0
  126. package/packages/cli/templates/ops.factory.json +14 -0
  127. package/packages/cli/templates/triage.factory.json +10 -0
  128. package/packages/core/src/daemon.mjs +2047 -0
  129. package/packages/core/src/limit-gate.mjs +192 -0
  130. package/packages/core/src/rpc-client.mjs +66 -0
  131. package/systemd/README.md +11 -0
@@ -0,0 +1,169 @@
1
+ // The wide home screen, shown beside the session list when no session is open.
2
+
3
+ import { folderColor } from "./avatar.js";
4
+ import { useEffect, useRef } from "preact/hooks";
5
+ import { sessionMark } from "./sessions.js";
6
+ import { canSteer, navigate, openSheet, scoped, store, workspaceOrder } from "./store.js";
7
+ import { lookLabel, prefs } from "./theme.js";
8
+ import { html, Icon, Keys, shortPath, timeAgo } from "./ui.js";
9
+
10
+ const LOGO = [
11
+ "▗▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▖",
12
+ "▝▀▀▀▜██▀▀▀▀▀▀██▛▀▀▀▘",
13
+ " ▐██ ██▌ ",
14
+ " ▐██ ██▌ ",
15
+ " ▐██ ██▌ ",
16
+ " ▐██ ██▌ ",
17
+ " ▗██▘ ▝██▄▖ ",
18
+ " ▝▀▀ ▀▀▀▘",
19
+ ].join("\n");
20
+
21
+ /** The home screen on wide screens: what fastfetch shows for a machine, for this Pi Pocket. */
22
+ export function Splash() {
23
+ const { me, sessions, models, server, guard } = store.state;
24
+ const p = prefs();
25
+ const busy = sessions.filter((session) => session.busy && !session.archived).length;
26
+ const recent = workspaceOrder().slice(0, 5);
27
+ const splash = useRef(null);
28
+
29
+ // The keys beside Jump back in: a digit opens its session, as Alt and the digit does anywhere. Only where they
30
+ // show: on a narrow screen the home screen is hidden, and a digit there must do nothing.
31
+ useEffect(() => {
32
+ const onKey = (event) => {
33
+ const target = event.target;
34
+ const index = Number(event.key) - 1;
35
+
36
+ if (
37
+ event.defaultPrevented ||
38
+ event.altKey ||
39
+ event.ctrlKey ||
40
+ event.metaKey ||
41
+ !(index >= 0 && index < 5) ||
42
+ target?.closest?.("input, textarea, select, [contenteditable]") ||
43
+ store.state.sheet ||
44
+ store.state.launcher ||
45
+ !(
46
+ splash.current?.checkVisibility?.() ??
47
+ splash.current?.getClientRects().length > 0
48
+ )
49
+ ) {
50
+ return;
51
+ }
52
+
53
+ const session = workspaceOrder()[index];
54
+
55
+ if (session) {
56
+ event.preventDefault();
57
+ navigate(session.id);
58
+ }
59
+ };
60
+
61
+ addEventListener("keydown", onKey);
62
+
63
+ return () => removeEventListener("keydown", onKey);
64
+ }, []);
65
+ const rows = [
66
+ ["theme", lookLabel()],
67
+ [
68
+ "layout",
69
+ `${p.tiling ? "tiled windows" : "flat"}, sidebar ${p.sidebar === "rail" ? "folded" : "open"}`,
70
+ ],
71
+ [
72
+ "sessions",
73
+ `${sessions.filter((session) => !session.archived).length}${busy > 0 ? `, ${busy} running` : ""}`,
74
+ ],
75
+ ["models", String(models.length)],
76
+ ["folder", shortPath(server?.defaultCwd, server?.home) || "~"],
77
+ [
78
+ "guard",
79
+ guard?.enabled
80
+ ? guard.available === false
81
+ ? "failed to load"
82
+ : "Lancet Guard on"
83
+ : "off",
84
+ ],
85
+ ["you", `${me?.name ?? "?"} (${me?.role ?? "?"})`],
86
+ ];
87
+ const colors = [
88
+ "--o-red",
89
+ "--o-yellow",
90
+ "--o-green",
91
+ "--o-cyan",
92
+ "--o-blue",
93
+ "--o-magenta",
94
+ "--o-accent",
95
+ "--o-fg",
96
+ ];
97
+ const canStart = canSteer() && !scoped();
98
+ let line = 0;
99
+
100
+ return html`<div class="splash" data-part="home" ref=${splash}>
101
+ <div class="fetch" data-part="home-facts">
102
+ <pre class="fetch-logo" data-part="home-logo" aria-hidden="true">${LOGO}</pre>
103
+ <div class="fetch-info">
104
+ <div class="fetch-title" data-part="home-title" style=${`--i:${line++}`}>
105
+ <b>${(me?.name ?? "you").toLowerCase().replace(/\s+/g, "-")}</b>@<b>pi-pocket</b>
106
+ </div>
107
+ ${rows.map(
108
+ ([key, value]) => html`<dl
109
+ class="fetch-row"
110
+ data-part="home-fact"
111
+ style=${`--i:${line++}`}
112
+ >
113
+ <dt>${key}</dt>
114
+ <dd>${value}</dd>
115
+ </dl>`,
116
+ )}
117
+ <div class="fetch-colors" data-part="home-colors" style=${`--i:${line++}`}>
118
+ ${colors.map(
119
+ (name) =>
120
+ html`<span data-part="home-color" style=${`background:var(${name})`}></span>`,
121
+ )}
122
+ </div>
123
+ </div>
124
+ </div>
125
+ <div class="splash-actions" data-part="home-actions">
126
+ ${
127
+ canStart &&
128
+ html`<button
129
+ class="button primary"
130
+ onClick=${() => openSheet({ type: "cwd", mode: "new" })}
131
+ >
132
+ <${Icon} name="plus" size=${16} /> New session <${Keys} keys="Alt N" />
133
+ </button>`
134
+ }
135
+ <button class="button" onClick=${() => store.set({ launcher: true })}>
136
+ <${Icon} name="command" size=${16} /> Launcher <${Keys} keys="Mod K" />
137
+ </button>
138
+ <button class="button" onClick=${() => openSheet({ type: "appearance" })}>
139
+ <${Icon} name="palette" size=${16} /> Appearance
140
+ </button>
141
+ </div>
142
+ ${
143
+ recent.length > 0 &&
144
+ html`<div class="splash-recent" data-part="home-recent">
145
+ <div class="splash-heading" data-part="home-heading">Jump back in</div>
146
+ ${recent.map(
147
+ (session, index) => html`<button
148
+ class="splash-row"
149
+ data-part="home-recent-row"
150
+ onClick=${() => navigate(session.id)}
151
+ >
152
+ <span class="splash-key" data-part="home-recent-key">${index + 1}</span>
153
+ <span
154
+ class=${`state-mark ${sessionMark(session).shape}`}
155
+ data-part="session-mark"
156
+ style=${`--folder:${folderColor(session.cwd)}`}
157
+ aria-hidden="true"
158
+ ></span>
159
+ <span class="splash-title">${session.title ?? "New session"}</span>
160
+ <span class="splash-meta">
161
+ ${session.waiting ? html`<span class="session-needs">${canSteer() ? "needs you" : "waiting"}</span>` : session.busy ? "working · " : ""}
162
+ ${!session.waiting && timeAgo(session.updatedAt)}
163
+ </span>
164
+ </button>`,
165
+ )}
166
+ </div>`
167
+ }
168
+ </div>`;
169
+ }
Binary file
Binary file
@@ -0,0 +1,16 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
2
+ <!--
3
+ Pi Pocket's icon. See docs/map.md#icons for PNG regeneration commands.
4
+ Apple's rounded mask reaches as far in at the corners as the frame starts, so the frame's corners are
5
+ rounded to follow the mask's and stay clear of it.
6
+ -->
7
+ <defs>
8
+ <linearGradient id="active" x1="0" y1="1" x2="1" y2="0">
9
+ <stop offset="0" stop-color="#33ccff" />
10
+ <stop offset="1" stop-color="#00ff99" />
11
+ </linearGradient>
12
+ </defs>
13
+ <rect width="512" height="512" fill="#13141c" />
14
+ <rect x="40" y="40" width="432" height="432" rx="75" fill="#1a1b26" stroke="url(#active)" stroke-width="12" />
15
+ <text x="256" y="350" font-family="Georgia, 'Times New Roman', serif" font-size="280" text-anchor="middle" fill="#ff9e64">π</text>
16
+ </svg>
@@ -0,0 +1,71 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta
6
+ name="viewport"
7
+ content="width=device-width, initial-scale=1, viewport-fit=cover, interactive-widget=resizes-content"
8
+ />
9
+ <meta name="color-scheme" content="dark" />
10
+ <meta name="theme-color" content="#13141c" />
11
+ <meta name="mobile-web-app-capable" content="yes" />
12
+ <meta name="apple-mobile-web-app-capable" content="yes" />
13
+ <title>bom</title>
14
+ <link rel="manifest" href="/manifest.webmanifest" crossorigin="use-credentials" />
15
+ <link rel="icon" href="/icon.svg" type="image/svg+xml" />
16
+ <link rel="preload" href="/style.css" as="style" />
17
+ <!--
18
+ The cascade layers, in the order they win: the app's own CSS (pocket), then the
19
+ colors chosen in Appearance (palette). Sizes people choose stay inline and win
20
+ over both. Design system is Pi Pocket's (MIT) — see public/LICENSE.pocket.
21
+ -->
22
+ <style>
23
+ @layer pocket, palette;
24
+ @import url("/style.css") layer(pocket);
25
+ </style>
26
+ <!--
27
+ The palette before the first paint: no flash of the wrong colors. app.js sets
28
+ it from the theme the browser kept; this covers the first load.
29
+ -->
30
+ <script>
31
+ (function () {
32
+ try {
33
+ var look = JSON.parse(localStorage.getItem("bom.theme") || "null");
34
+ var palette = (look && look.palette) || null;
35
+ if (!palette) return;
36
+ var el = document.createElement("style");
37
+ el.id = "bom-palette";
38
+ el.textContent = "@layer palette{:root{" + palette + "}}";
39
+ document.head.appendChild(el);
40
+ document.documentElement.dataset.mode = (look && look.mode) || "dark";
41
+ document
42
+ .querySelector('meta[name="theme-color"]')
43
+ .setAttribute("content", (look && look.color) || "#13141c");
44
+ } catch (error) {}
45
+ })();
46
+ </script>
47
+ <script type="importmap">
48
+ {
49
+ "imports": {
50
+ "preact": "/vendor/preact.mjs",
51
+ "preact/hooks": "/vendor/preact-hooks.mjs",
52
+ "htm": "/vendor/htm.mjs",
53
+ "marked": "/vendor/marked.mjs",
54
+ "dompurify": "/vendor/purify.mjs"
55
+ }
56
+ }
57
+ </script>
58
+ </head>
59
+ <body>
60
+ <!-- The same boot screen the app shows while it starts (app.js draws it again), so
61
+ nothing jumps when the script takes over. -->
62
+ <div id="app">
63
+ <div class="boot" data-part="boot" role="status">
64
+ <div class="boot-mark" data-part="brand-mark" aria-hidden="true">b</div>
65
+ <div class="boot-bar" aria-hidden="true"><span></span></div>
66
+ <div class="boot-caption">starting</div>
67
+ </div>
68
+ </div>
69
+ <script type="module" src="/app.js"></script>
70
+ </body>
71
+ </html>