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.
- package/README.md +33 -2
- package/apps/README.md +7 -0
- package/apps/web/README.md +21 -0
- package/apps/web/pocket-adapter.mjs +323 -0
- package/apps/web/public/LICENSE.pocket +21 -0
- package/apps/web/public/activity-fold.js +28 -0
- package/apps/web/public/agent-now.js +37 -0
- package/apps/web/public/agent-tile.js +79 -0
- package/apps/web/public/app.js +975 -0
- package/apps/web/public/apple-touch-icon.png +0 -0
- package/apps/web/public/artifact-bridge.js +687 -0
- package/apps/web/public/avatar.js +87 -0
- package/apps/web/public/back.js +554 -0
- package/apps/web/public/box-keys.js +216 -0
- package/apps/web/public/browser-panel.js +1097 -0
- package/apps/web/public/browser.js +68 -0
- package/apps/web/public/calls.js +139 -0
- package/apps/web/public/chat.js +919 -0
- package/apps/web/public/clock.js +34 -0
- package/apps/web/public/commands.js +578 -0
- package/apps/web/public/composer.js +2068 -0
- package/apps/web/public/diff-parse.js +672 -0
- package/apps/web/public/diff.js +1646 -0
- package/apps/web/public/dock.js +299 -0
- package/apps/web/public/extension-ui.js +2734 -0
- package/apps/web/public/files-panel.js +775 -0
- package/apps/web/public/files.js +368 -0
- package/apps/web/public/fonts/FiraCode-VF.woff2 +0 -0
- package/apps/web/public/fonts/Geist.woff2 +0 -0
- package/apps/web/public/fonts/IBMPlexMono-Variable-Italic.woff2 +0 -0
- package/apps/web/public/fonts/IBMPlexMono-Variable.woff2 +0 -0
- package/apps/web/public/fonts/InterVariable-Italic.woff2 +0 -0
- package/apps/web/public/fonts/InterVariable.woff2 +0 -0
- package/apps/web/public/fonts/Iosevka-Bold.woff2 +0 -0
- package/apps/web/public/fonts/Iosevka-BoldItalic.woff2 +0 -0
- package/apps/web/public/fonts/Iosevka-Italic.woff2 +0 -0
- package/apps/web/public/fonts/Iosevka-Regular.woff2 +0 -0
- package/apps/web/public/fonts/Iosevka-SemiBold.woff2 +0 -0
- package/apps/web/public/fonts/Iosevka-SemiBoldItalic.woff2 +0 -0
- package/apps/web/public/fonts/JetBrainsMono-Italic.woff2 +0 -0
- package/apps/web/public/fonts/JetBrainsMono.woff2 +0 -0
- package/apps/web/public/fonts/NerdFontsSymbolsMono.woff2 +0 -0
- package/apps/web/public/fonts/SOURCES.md +69 -0
- package/apps/web/public/gestures.js +610 -0
- package/apps/web/public/highlight.js +480 -0
- package/apps/web/public/history.js +70 -0
- package/apps/web/public/home.js +169 -0
- package/apps/web/public/icon-192.png +0 -0
- package/apps/web/public/icon-512.png +0 -0
- package/apps/web/public/icon-maskable-512.png +0 -0
- package/apps/web/public/icon.svg +16 -0
- package/apps/web/public/index.html +71 -0
- package/apps/web/public/launcher.js +1293 -0
- package/apps/web/public/linked-sessions.js +55 -0
- package/apps/web/public/live.js +39 -0
- package/apps/web/public/manifest.webmanifest +32 -0
- package/apps/web/public/model-refresh.js +73 -0
- package/apps/web/public/notify.js +251 -0
- package/apps/web/public/peeks.js +920 -0
- package/apps/web/public/pip-attachments.js +182 -0
- package/apps/web/public/pip-window.js +141 -0
- package/apps/web/public/pip.js +1217 -0
- package/apps/web/public/quote-reply.js +109 -0
- package/apps/web/public/quote-text.js +31 -0
- package/apps/web/public/rich.js +403 -0
- package/apps/web/public/run-frame.js +106 -0
- package/apps/web/public/safe-mode.js +71 -0
- package/apps/web/public/seen.js +169 -0
- package/apps/web/public/session-tree.js +117 -0
- package/apps/web/public/sessions.js +2695 -0
- package/apps/web/public/share.js +126 -0
- package/apps/web/public/sheets/appearance.js +820 -0
- package/apps/web/public/sheets/branch.js +353 -0
- package/apps/web/public/sheets/extensions.js +818 -0
- package/apps/web/public/sheets/file.js +318 -0
- package/apps/web/public/sheets/find.js +250 -0
- package/apps/web/public/sheets/folder.js +680 -0
- package/apps/web/public/sheets/gallery.js +2340 -0
- package/apps/web/public/sheets/hooks.js +350 -0
- package/apps/web/public/sheets/memory.js +531 -0
- package/apps/web/public/sheets/menu.js +580 -0
- package/apps/web/public/sheets/message.js +220 -0
- package/apps/web/public/sheets/model.js +412 -0
- package/apps/web/public/sheets/people.js +414 -0
- package/apps/web/public/sheets/pi-sessions.js +264 -0
- package/apps/web/public/sheets/providers.js +525 -0
- package/apps/web/public/sheets/running.js +130 -0
- package/apps/web/public/sheets/schedules.js +71 -0
- package/apps/web/public/sheets/session.js +249 -0
- package/apps/web/public/sheets/shortcuts.js +101 -0
- package/apps/web/public/sheets/spend.js +150 -0
- package/apps/web/public/sheets/text.js +53 -0
- package/apps/web/public/sheets/viewers.js +363 -0
- package/apps/web/public/sheets/worktree.js +50 -0
- package/apps/web/public/sheets.js +410 -0
- package/apps/web/public/signin.js +57 -0
- package/apps/web/public/slots.js +208 -0
- package/apps/web/public/store.js +1760 -0
- package/apps/web/public/style.css +18625 -0
- package/apps/web/public/subagents-board.js +879 -0
- package/apps/web/public/subagents.js +273 -0
- package/apps/web/public/sw.js +169 -0
- package/apps/web/public/taps.js +26 -0
- package/apps/web/public/theme-surface.d.ts +4 -0
- package/apps/web/public/theme-surface.js +266 -0
- package/apps/web/public/theme.js +845 -0
- package/apps/web/public/themes/lantern/colors.toml +25 -0
- package/apps/web/public/themes/lantern/direction.css +60 -0
- package/apps/web/public/themes/lantern/frame.css +254 -0
- package/apps/web/public/themes/lantern/theme.css +10 -0
- package/apps/web/public/themes/lantern/theme.json +7 -0
- package/apps/web/public/themes/pocket/theme.css +189 -0
- package/apps/web/public/themes/pocket/theme.json +6 -0
- package/apps/web/public/themes.js +556 -0
- package/apps/web/public/transcript.js +3348 -0
- package/apps/web/public/trust.js +295 -0
- package/apps/web/public/turns.js +507 -0
- package/apps/web/public/ui.js +1910 -0
- package/apps/web/public/voice.js +345 -0
- package/apps/web/server.mjs +774 -0
- package/package.json +43 -4
- package/packages/cli/src/bom-pi.mjs +452 -0
- package/packages/cli/templates/blank.factory.json +7 -0
- package/packages/cli/templates/dev.factory.json +11 -0
- package/packages/cli/templates/docs.factory.json +12 -0
- package/packages/cli/templates/ops.factory.json +14 -0
- package/packages/cli/templates/triage.factory.json +10 -0
- package/packages/core/src/daemon.mjs +2047 -0
- package/packages/core/src/limit-gate.mjs +192 -0
- package/packages/core/src/rpc-client.mjs +66 -0
- package/systemd/README.md +11 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Things shared to Pi Pocket from another app: a link, some text, a screenshot. The service worker keeps them (see
|
|
2
|
+
// sw.js), and this sheet puts them into the message box of a session, to send from there.
|
|
3
|
+
import {
|
|
4
|
+
actions,
|
|
5
|
+
attempt,
|
|
6
|
+
canSteer,
|
|
7
|
+
closeSheet,
|
|
8
|
+
insertIntoComposer,
|
|
9
|
+
navigate,
|
|
10
|
+
scoped,
|
|
11
|
+
store,
|
|
12
|
+
} from "./store.js";
|
|
13
|
+
import { html, Icon, Loader, shortPath, Sheet, timeAgo } from "./ui.js";
|
|
14
|
+
|
|
15
|
+
const SHARE_CACHE = "pocket-share";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* What was shared under `id`: `{ text, files }`, or null when it is gone. Taking it removes it, with anything an
|
|
19
|
+
* earlier share left behind: one share is picked up at a time, as each opens the app.
|
|
20
|
+
*/
|
|
21
|
+
export async function takeShare(id) {
|
|
22
|
+
if (!("caches" in globalThis)) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const cache = await caches.open(SHARE_CACHE);
|
|
27
|
+
const stored = await cache.match(`/share/${id}/meta`);
|
|
28
|
+
|
|
29
|
+
if (!stored) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const meta = await stored.json();
|
|
34
|
+
const files = [];
|
|
35
|
+
|
|
36
|
+
for (const [index, file] of meta.files.entries()) {
|
|
37
|
+
const body = await cache.match(`/share/${id}/file/${index}`);
|
|
38
|
+
|
|
39
|
+
if (body) {
|
|
40
|
+
files.push(
|
|
41
|
+
new File([await body.blob()], file.name || `shared-${index + 1}`, {
|
|
42
|
+
type: file.type,
|
|
43
|
+
}),
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
await caches.delete(SHARE_CACHE);
|
|
49
|
+
|
|
50
|
+
return { text: shareText(meta), files };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Apps fill the title, text, and link differently, and often repeat one in another: each part once. */
|
|
54
|
+
function shareText({ title = "", text = "", url = "" }) {
|
|
55
|
+
const parts = [];
|
|
56
|
+
|
|
57
|
+
for (const part of [title, text, url].map((each) => each.trim())) {
|
|
58
|
+
if (part === "" || parts.some((kept) => kept.includes(part))) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// A longer part that holds one kept already replaces it.
|
|
63
|
+
for (let index = parts.length - 1; index >= 0; index--) {
|
|
64
|
+
if (part.includes(parts[index])) {
|
|
65
|
+
parts.splice(index, 1);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
parts.push(part);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return parts.join("\n\n");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Where the shared things go: a new session, or one of the recent ones. */
|
|
76
|
+
export function ShareSheet({ share }) {
|
|
77
|
+
const { sessions, sessionsLoaded, server } = store.state;
|
|
78
|
+
const recent = sessions.filter((session) => !session.archived).slice(0, 8);
|
|
79
|
+
|
|
80
|
+
const deliver = (id) => {
|
|
81
|
+
navigate(id);
|
|
82
|
+
insertIntoComposer(share.text, share.files);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const startNew = () =>
|
|
86
|
+
attempt(async () => {
|
|
87
|
+
const created = await actions.createSession(recent[0]?.cwd ?? server?.defaultCwd);
|
|
88
|
+
|
|
89
|
+
deliver(created.id);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
return html`<${Sheet} title="Share to Pi" onClose=${closeSheet}>
|
|
93
|
+
${share.text && html`<p class="share-text">${share.text}</p>`}
|
|
94
|
+
${
|
|
95
|
+
share.files.length > 0 &&
|
|
96
|
+
html`<div class="attachments">
|
|
97
|
+
${share.files.map((file) => html`<span class="chip">📎 ${file.name}</span>`)}
|
|
98
|
+
</div>`
|
|
99
|
+
}
|
|
100
|
+
${
|
|
101
|
+
!canSteer()
|
|
102
|
+
? html`<p class="muted">You can view sessions here but not send to Pi.</p>`
|
|
103
|
+
: html`<p class="muted small">
|
|
104
|
+
It goes into the message box, so you can add to it before you send.
|
|
105
|
+
</p>
|
|
106
|
+
${
|
|
107
|
+
!scoped() &&
|
|
108
|
+
html`<button class="list-item" onClick=${startNew}>
|
|
109
|
+
<span><${Icon} name="plus" size=${15} /> New session</span>
|
|
110
|
+
<span class="muted small mono">
|
|
111
|
+
${shortPath(recent[0]?.cwd ?? server?.defaultCwd, server?.home)}
|
|
112
|
+
</span>
|
|
113
|
+
</button>`
|
|
114
|
+
}
|
|
115
|
+
<div class="group-title">Recent sessions</div>
|
|
116
|
+
${!sessionsLoaded && html`<${Loader} label="Loading sessions" />`}
|
|
117
|
+
${recent.map(
|
|
118
|
+
(session) =>
|
|
119
|
+
html`<button class="list-item" onClick=${() => deliver(session.id)}>
|
|
120
|
+
<span>${session.title ?? "New session"}</span>
|
|
121
|
+
<span class="muted small">${timeAgo(session.updatedAt)}</span>
|
|
122
|
+
</button>`,
|
|
123
|
+
)}`
|
|
124
|
+
}
|
|
125
|
+
<//>`;
|
|
126
|
+
}
|