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,182 @@
|
|
|
1
|
+
// PiP's browser-only draft, kept across panel mounts. No main-composer state or conversation lookup.
|
|
2
|
+
/** A scoped draft. Async work holds its original scope and item/token identity, never a newer draft. */
|
|
3
|
+
export function createPipDraft({ loadText, saveText, upload, onError }) {
|
|
4
|
+
const listeners = new Set();
|
|
5
|
+
let account;
|
|
6
|
+
let id;
|
|
7
|
+
let generation = 0;
|
|
8
|
+
let revision = 0;
|
|
9
|
+
// Each file's key, unique in this draft: crypto.randomUUID is missing on plain-http pages (a LAN address).
|
|
10
|
+
let keys = 0;
|
|
11
|
+
let state = { text: loadText(), files: [], pending: null };
|
|
12
|
+
|
|
13
|
+
const emit = () => {
|
|
14
|
+
for (const listener of listeners) {
|
|
15
|
+
listener(state);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const changeText = (text) => {
|
|
20
|
+
revision++;
|
|
21
|
+
state = { ...state, text };
|
|
22
|
+
saveText(text);
|
|
23
|
+
emit();
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const removeFile = (key) => {
|
|
27
|
+
const file = state.files.find((each) => each.key === key);
|
|
28
|
+
|
|
29
|
+
if (!file) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (file.preview) {
|
|
34
|
+
URL.revokeObjectURL(file.preview);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
state = { ...state, files: state.files.filter((each) => each !== file) };
|
|
38
|
+
emit();
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
get state() {
|
|
43
|
+
return state;
|
|
44
|
+
},
|
|
45
|
+
subscribe(listener) {
|
|
46
|
+
listeners.add(listener);
|
|
47
|
+
|
|
48
|
+
return () => listeners.delete(listener);
|
|
49
|
+
},
|
|
50
|
+
scope(nextAccount, nextId) {
|
|
51
|
+
// Unknown authentication during reconnect is not an account change.
|
|
52
|
+
if (nextAccount === undefined) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const changedAccount = account !== undefined && account !== nextAccount;
|
|
57
|
+
const loggedOut = nextAccount === null && account !== null;
|
|
58
|
+
// A missing ID during reconnect is not evidence that PiP's conversation changed.
|
|
59
|
+
const changedId = nextId !== undefined && id !== undefined && id !== nextId;
|
|
60
|
+
|
|
61
|
+
account = nextAccount;
|
|
62
|
+
id = nextAccount === null ? undefined : changedAccount ? nextId : (nextId ?? id);
|
|
63
|
+
|
|
64
|
+
if (!changedAccount && !changedId && !loggedOut) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
generation++;
|
|
69
|
+
|
|
70
|
+
for (const file of state.files) {
|
|
71
|
+
if (file.preview) {
|
|
72
|
+
URL.revokeObjectURL(file.preview);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
state = { ...state, files: [], pending: null };
|
|
77
|
+
|
|
78
|
+
if (changedAccount || loggedOut) {
|
|
79
|
+
changeText("");
|
|
80
|
+
} else {
|
|
81
|
+
emit();
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
syncText() {
|
|
85
|
+
const saved = loadText();
|
|
86
|
+
|
|
87
|
+
if (saved !== state.text) {
|
|
88
|
+
changeText(saved);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
changeText,
|
|
92
|
+
removeFile,
|
|
93
|
+
addFiles(files) {
|
|
94
|
+
if (id === undefined || account == null) {
|
|
95
|
+
onError("PiP is not ready yet. Try again in a moment.");
|
|
96
|
+
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const scope = generation;
|
|
101
|
+
const target = id;
|
|
102
|
+
|
|
103
|
+
for (const file of files) {
|
|
104
|
+
const item = {
|
|
105
|
+
key: `file-${++keys}`,
|
|
106
|
+
name: file.name,
|
|
107
|
+
size: file.size,
|
|
108
|
+
preview: file.type.startsWith("image/") ? URL.createObjectURL(file) : null,
|
|
109
|
+
state: "uploading",
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
state = { ...state, files: [...state.files, item] };
|
|
113
|
+
emit();
|
|
114
|
+
upload(target, file).then(
|
|
115
|
+
(attachment) => {
|
|
116
|
+
if (scope !== generation || !state.files.includes(item)) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
state = {
|
|
121
|
+
...state,
|
|
122
|
+
files: state.files.map((each) =>
|
|
123
|
+
each === item ? { ...item, state: "done", attachment } : each,
|
|
124
|
+
),
|
|
125
|
+
};
|
|
126
|
+
emit();
|
|
127
|
+
},
|
|
128
|
+
(error) => {
|
|
129
|
+
if (scope !== generation || !state.files.includes(item)) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
removeFile(item.key);
|
|
134
|
+
onError(`Upload failed: ${error.message ?? String(error)}`);
|
|
135
|
+
},
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
begin(compact = false) {
|
|
140
|
+
if (
|
|
141
|
+
state.pending ||
|
|
142
|
+
(!compact && state.files.some((file) => file.state === "uploading"))
|
|
143
|
+
) {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const token = {
|
|
148
|
+
generation,
|
|
149
|
+
text: state.text,
|
|
150
|
+
files: compact ? [] : [...state.files],
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
state = { ...state, pending: token };
|
|
154
|
+
changeText("");
|
|
155
|
+
token.revision = revision;
|
|
156
|
+
|
|
157
|
+
return token;
|
|
158
|
+
},
|
|
159
|
+
finish(token, success) {
|
|
160
|
+
if (token.generation !== generation || state.pending !== token) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
state = { ...state, pending: null };
|
|
165
|
+
|
|
166
|
+
if (success) {
|
|
167
|
+
for (const file of token.files) {
|
|
168
|
+
removeFile(file.key);
|
|
169
|
+
}
|
|
170
|
+
} else if (token.text !== "") {
|
|
171
|
+
// The person can type while sending, or close and reopen the panel. Keep both drafts on failure.
|
|
172
|
+
changeText(
|
|
173
|
+
revision === token.revision || state.text === ""
|
|
174
|
+
? token.text
|
|
175
|
+
: `${token.text}\n\n${state.text}`,
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
emit();
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// PiP's remembered floating size. CSS alone clamps it when the viewport shrinks, without losing the preference.
|
|
2
|
+
import { useEffect } from "preact/hooks";
|
|
3
|
+
|
|
4
|
+
export function usePipResize(ref, account) {
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const panel = ref.current;
|
|
7
|
+
|
|
8
|
+
if (!panel || !account) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const key = `pocket.pip.size.${account}`;
|
|
13
|
+
|
|
14
|
+
panel.style.removeProperty("--pip-width");
|
|
15
|
+
panel.style.removeProperty("--pip-height");
|
|
16
|
+
|
|
17
|
+
// Each dimension apart: a drag on the left edge chose a width only, and the height stays the default, which
|
|
18
|
+
// follows the window's height.
|
|
19
|
+
const size = ({ width, height }) => {
|
|
20
|
+
if (Number.isFinite(width)) {
|
|
21
|
+
panel.style.setProperty("--pip-width", `${Math.max(420, Math.min(800, width))}px`);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (Number.isFinite(height)) {
|
|
25
|
+
panel.style.setProperty("--pip-height", `${Math.max(360, height)}px`);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const saved = () => {
|
|
30
|
+
try {
|
|
31
|
+
return JSON.parse(localStorage.getItem(key)) ?? {};
|
|
32
|
+
} catch {
|
|
33
|
+
// A missing or invalid preference uses the normal CSS size.
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
size(saved());
|
|
39
|
+
|
|
40
|
+
let drag = null;
|
|
41
|
+
|
|
42
|
+
const stop = () => {
|
|
43
|
+
if (drag) {
|
|
44
|
+
const { id, selection } = drag;
|
|
45
|
+
|
|
46
|
+
drag = null;
|
|
47
|
+
document.documentElement.style.userSelect = selection;
|
|
48
|
+
|
|
49
|
+
if (panel.hasPointerCapture(id)) {
|
|
50
|
+
panel.releasePointerCapture(id);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const down = (event) => {
|
|
56
|
+
const edge = event.target.closest("[data-pip-resize]")?.dataset.pipResize;
|
|
57
|
+
|
|
58
|
+
if (!edge || event.button !== 0 || innerWidth < 768 || drag) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
event.preventDefault();
|
|
63
|
+
const rect = panel.getBoundingClientRect();
|
|
64
|
+
const style = getComputedStyle(panel);
|
|
65
|
+
|
|
66
|
+
drag = {
|
|
67
|
+
id: event.pointerId,
|
|
68
|
+
x: event.clientX,
|
|
69
|
+
y: event.clientY,
|
|
70
|
+
width: rect.width,
|
|
71
|
+
height: rect.height,
|
|
72
|
+
maxWidth: parseFloat(style.maxWidth),
|
|
73
|
+
maxHeight: parseFloat(style.maxHeight),
|
|
74
|
+
edge,
|
|
75
|
+
selection: document.documentElement.style.userSelect,
|
|
76
|
+
};
|
|
77
|
+
document.documentElement.style.userSelect = "none";
|
|
78
|
+
panel.setPointerCapture(event.pointerId);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const move = (event) => {
|
|
82
|
+
if (!drag || event.pointerId !== drag.id) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
drag.moved = true;
|
|
87
|
+
|
|
88
|
+
size({
|
|
89
|
+
...(drag.edge === "top"
|
|
90
|
+
? {}
|
|
91
|
+
: { width: Math.min(drag.maxWidth, drag.width + drag.x - event.clientX) }),
|
|
92
|
+
...(drag.edge === "left"
|
|
93
|
+
? {}
|
|
94
|
+
: { height: Math.min(drag.maxHeight, drag.height + drag.y - event.clientY) }),
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const up = (event) => {
|
|
99
|
+
if (!drag || event.pointerId !== drag.id) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Only a size someone chose: a tap on an edge keeps the default, which follows the window's height.
|
|
104
|
+
if (drag.moved) {
|
|
105
|
+
const rect = panel.getBoundingClientRect();
|
|
106
|
+
|
|
107
|
+
try {
|
|
108
|
+
localStorage.setItem(
|
|
109
|
+
key,
|
|
110
|
+
JSON.stringify({
|
|
111
|
+
...saved(),
|
|
112
|
+
...(drag.edge === "top" ? {} : { width: rect.width }),
|
|
113
|
+
...(drag.edge === "left" ? {} : { height: rect.height }),
|
|
114
|
+
}),
|
|
115
|
+
);
|
|
116
|
+
} catch {
|
|
117
|
+
// Resizing still works when browser storage is unavailable.
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
stop();
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
addEventListener("resize", stop);
|
|
125
|
+
panel.addEventListener("pointerdown", down);
|
|
126
|
+
panel.addEventListener("pointermove", move);
|
|
127
|
+
panel.addEventListener("pointerup", up);
|
|
128
|
+
panel.addEventListener("lostpointercapture", stop);
|
|
129
|
+
panel.addEventListener("pointercancel", stop);
|
|
130
|
+
|
|
131
|
+
return () => {
|
|
132
|
+
stop();
|
|
133
|
+
removeEventListener("resize", stop);
|
|
134
|
+
panel.removeEventListener("pointerdown", down);
|
|
135
|
+
panel.removeEventListener("pointermove", move);
|
|
136
|
+
panel.removeEventListener("pointerup", up);
|
|
137
|
+
panel.removeEventListener("lostpointercapture", stop);
|
|
138
|
+
panel.removeEventListener("pointercancel", stop);
|
|
139
|
+
};
|
|
140
|
+
}, [account]);
|
|
141
|
+
}
|