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,818 @@
|
|
|
1
|
+
// Extensions: the modules the owner can turn on and off, Lancet Guard, who may allow risky calls, and when PiP compacts
|
|
2
|
+
// its context.
|
|
3
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "preact/hooks";
|
|
4
|
+
import { browserModuleState, leaveSafeMode, safeMode } from "../extension-ui.js";
|
|
5
|
+
import { api, attempt, closeSheet, openSheet, store } from "../store.js";
|
|
6
|
+
import { html, Icon, Loader, Sheet, shortPath, Switch } from "../ui.js";
|
|
7
|
+
import { ACCESS_WORDS, galleryApi, galleryAvailable, Tile } from "./gallery.js";
|
|
8
|
+
|
|
9
|
+
/** The guide for people who write extensions: its first page, on the docs site, which describes the latest release. */
|
|
10
|
+
const GUIDE = "https://tannermidd.github.io/pi-pocket/docs/extensions/first-extension/";
|
|
11
|
+
|
|
12
|
+
/** What Lancet Guard does here, given the module's switch and Pi's own setting. */
|
|
13
|
+
function guardNote(module, guard) {
|
|
14
|
+
if (!guard.available) {
|
|
15
|
+
return { warn: true, text: guard.detail };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (!guard.enabled) {
|
|
19
|
+
return {
|
|
20
|
+
warn: true,
|
|
21
|
+
text: "Off in Pi's own settings (~/.pi/lancet-guard.json), so it does not run here either.",
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!module.enabled) {
|
|
26
|
+
return {
|
|
27
|
+
warn: true,
|
|
28
|
+
text: "Off in Pi Pocket: bash, background, write, and edit calls run unchecked here. Pi itself still uses it.",
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
warn: false,
|
|
34
|
+
text: "Checks bash, background, write, and edit calls. Risky ones wait for someone in the session to allow them.",
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** The LANCET model Lancet Guard scores commands with: a one-time download the owner starts here. */
|
|
39
|
+
function GuardModel({ owner, model, onStart }) {
|
|
40
|
+
if (!model || model.state === "ready") {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const downloading = model.state === "downloading";
|
|
45
|
+
|
|
46
|
+
return html`<div class="setting">
|
|
47
|
+
<div class="grow">
|
|
48
|
+
<div class="small">LANCET model</div>
|
|
49
|
+
<div class=${`small ${model.state === "failed" ? "warn" : "muted"}`}>
|
|
50
|
+
${
|
|
51
|
+
model.state === "missing"
|
|
52
|
+
? "Not downloaded yet. The guard needs it to score commands. The download (about 109 MB) comes from the LANCET-model GitHub release, is checked against fixed checksums, and Pi uses it too."
|
|
53
|
+
: model.detail
|
|
54
|
+
}
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
${
|
|
58
|
+
downloading
|
|
59
|
+
? html`<${Loader} label="Downloading" />`
|
|
60
|
+
: owner &&
|
|
61
|
+
html`<button class="button small primary" onClick=${onStart}>
|
|
62
|
+
${model.state === "failed" ? "Try again" : "Download"}
|
|
63
|
+
</button>`
|
|
64
|
+
}
|
|
65
|
+
</div>`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Who may allow a risky call: anyone who can steer, or (for guests) someone other than whoever asked for it. */
|
|
69
|
+
function ApprovalRule({ owner }) {
|
|
70
|
+
const others = store.state.server?.approvalRule === "others";
|
|
71
|
+
const change = () =>
|
|
72
|
+
attempt(() => api("settings", { approvalRule: others ? "anyone" : "others" }));
|
|
73
|
+
|
|
74
|
+
return html`<div class="setting">
|
|
75
|
+
<div class="grow">
|
|
76
|
+
<div class="small">Approvals need someone else</div>
|
|
77
|
+
<div class="muted small">
|
|
78
|
+
A guest cannot allow a call that their own message led to. You always can.
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
<${Switch}
|
|
82
|
+
on=${others}
|
|
83
|
+
disabled=${!owner}
|
|
84
|
+
label=${`Approvals need someone else: ${others ? "on" : "off"}`}
|
|
85
|
+
onChange=${change}
|
|
86
|
+
/>
|
|
87
|
+
</div>`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* A module's settings (`web.settings`), for the owner: each field as the module declared it, saved together. A secret
|
|
92
|
+
* shows only whether it is set; typing a new one replaces it, and Clear puts its default back.
|
|
93
|
+
*/
|
|
94
|
+
function ModuleSettings({ module }) {
|
|
95
|
+
const [shown, setShown] = useState(null);
|
|
96
|
+
const [draft, setDraft] = useState({});
|
|
97
|
+
const [error, setError] = useState(null);
|
|
98
|
+
const [busy, setBusy] = useState(false);
|
|
99
|
+
const path = `extension-settings/${encodeURIComponent(module)}`;
|
|
100
|
+
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
// Only the answer for the module shown now: a slower one for another module never takes its place.
|
|
103
|
+
let live = true;
|
|
104
|
+
|
|
105
|
+
setShown(null);
|
|
106
|
+
setDraft({});
|
|
107
|
+
setError(null);
|
|
108
|
+
api(path).then(
|
|
109
|
+
(answer) => live && setShown(answer),
|
|
110
|
+
(failure) => live && setError(failure.message),
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
return () => {
|
|
114
|
+
live = false;
|
|
115
|
+
};
|
|
116
|
+
}, [module]);
|
|
117
|
+
|
|
118
|
+
if (error && !shown) {
|
|
119
|
+
return html`<div class="error-box small">${error}</div>`;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (!shown) {
|
|
123
|
+
return html`<${Loader} label="Settings" />`;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// What a field shows: the owner's change, the default when they asked for it back (null), or the value now.
|
|
127
|
+
const value = (field) => {
|
|
128
|
+
if (!Object.hasOwn(draft, field.name)) {
|
|
129
|
+
return shown.values[field.name] ?? "";
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return draft[field.name] === null ? (field.default ?? "") : draft[field.name];
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const set = (name, next) => setDraft({ ...draft, [name]: next });
|
|
136
|
+
|
|
137
|
+
const save = async () => {
|
|
138
|
+
setError(null);
|
|
139
|
+
|
|
140
|
+
// A number is typed as text ("-", "1."), and becomes a number only now; an empty one puts the default back.
|
|
141
|
+
const unreadable = shown.fields.find(
|
|
142
|
+
(field) =>
|
|
143
|
+
field.type === "number" &&
|
|
144
|
+
typeof draft[field.name] === "string" &&
|
|
145
|
+
draft[field.name].trim() !== "" &&
|
|
146
|
+
!Number.isFinite(Number(draft[field.name])),
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
if (unreadable !== undefined) {
|
|
150
|
+
setError(`${unreadable.label} must be a number.`);
|
|
151
|
+
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
setBusy(true);
|
|
156
|
+
|
|
157
|
+
const change = Object.fromEntries(
|
|
158
|
+
Object.entries(draft).map(([name, next]) => {
|
|
159
|
+
const field = shown.fields.find((each) => each.name === name);
|
|
160
|
+
|
|
161
|
+
if (field?.type !== "number" || typeof next !== "string") {
|
|
162
|
+
return [name, next];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return [name, next.trim() === "" ? null : Number(next)];
|
|
166
|
+
}),
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
try {
|
|
170
|
+
setShown(await api(path, change, { method: "PUT" }));
|
|
171
|
+
setDraft({});
|
|
172
|
+
} catch (failure) {
|
|
173
|
+
setError(failure.message);
|
|
174
|
+
} finally {
|
|
175
|
+
setBusy(false);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
return html`<div class="ext-settings">
|
|
180
|
+
<div class="small"><b>Settings</b></div>
|
|
181
|
+
${shown.fields.map((field) => {
|
|
182
|
+
const secret = field.type === "text" && field.secret;
|
|
183
|
+
const id = `ext-setting-${module}-${field.name}`;
|
|
184
|
+
const range =
|
|
185
|
+
field.type === "number" && (field.min !== undefined || field.max !== undefined)
|
|
186
|
+
? `From ${field.min ?? "any"} to ${field.max ?? "any"}`
|
|
187
|
+
: undefined;
|
|
188
|
+
const hint =
|
|
189
|
+
secret && shown.set.includes(field.name)
|
|
190
|
+
? "Set: type to replace"
|
|
191
|
+
: (field.placeholder ?? "");
|
|
192
|
+
|
|
193
|
+
return html`<div class="setting wrap" key=${field.name}>
|
|
194
|
+
<div class="grow">
|
|
195
|
+
<label class="small" for=${id}>${field.label}</label>
|
|
196
|
+
${field.description && html`<div class="muted small">${field.description}</div>`}
|
|
197
|
+
</div>
|
|
198
|
+
${
|
|
199
|
+
field.type === "boolean"
|
|
200
|
+
? html`<${Switch}
|
|
201
|
+
on=${value(field) === true}
|
|
202
|
+
label=${field.label}
|
|
203
|
+
onChange=${() => set(field.name, value(field) !== true)}
|
|
204
|
+
/>`
|
|
205
|
+
: field.type === "choice"
|
|
206
|
+
? html`<select
|
|
207
|
+
id=${id}
|
|
208
|
+
value=${value(field)}
|
|
209
|
+
onChange=${(event) => set(field.name, event.currentTarget.value)}
|
|
210
|
+
>
|
|
211
|
+
${field.choices.map(
|
|
212
|
+
(choice) =>
|
|
213
|
+
html`<option value=${choice.value}>${choice.label}</option>`,
|
|
214
|
+
)}
|
|
215
|
+
</select>`
|
|
216
|
+
: html`<input
|
|
217
|
+
id=${id}
|
|
218
|
+
class="ext-setting-input"
|
|
219
|
+
type=${secret ? "password" : "text"}
|
|
220
|
+
inputmode=${field.type === "number" ? "decimal" : undefined}
|
|
221
|
+
autocomplete="off"
|
|
222
|
+
placeholder=${hint}
|
|
223
|
+
value=${secret ? (draft[field.name] ?? "") : value(field)}
|
|
224
|
+
title=${range}
|
|
225
|
+
onInput=${(event) => set(field.name, event.currentTarget.value)}
|
|
226
|
+
/>`
|
|
227
|
+
}
|
|
228
|
+
${
|
|
229
|
+
shown.set.includes(field.name) &&
|
|
230
|
+
html`<button
|
|
231
|
+
class="button small"
|
|
232
|
+
title="Put its default back"
|
|
233
|
+
disabled=${busy}
|
|
234
|
+
onClick=${() => set(field.name, null)}
|
|
235
|
+
>
|
|
236
|
+
${secret ? "Clear" : "Default"}
|
|
237
|
+
</button>`
|
|
238
|
+
}
|
|
239
|
+
</div>`;
|
|
240
|
+
})}
|
|
241
|
+
${error && html`<div class="error-box small">${error}</div>`}
|
|
242
|
+
<div class="ext-step-actions">
|
|
243
|
+
<button
|
|
244
|
+
class="button small primary"
|
|
245
|
+
disabled=${busy || Object.keys(draft).length === 0}
|
|
246
|
+
onClick=${save}
|
|
247
|
+
>
|
|
248
|
+
${busy ? "Saving…" : "Save settings"}
|
|
249
|
+
</button>
|
|
250
|
+
</div>
|
|
251
|
+
</div>`;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* What a module adds to the app: its routes, commands, public pages, and browser module with how it stands in this
|
|
256
|
+
* browser.
|
|
257
|
+
*/
|
|
258
|
+
function WebPart({ module }) {
|
|
259
|
+
const web = module.web;
|
|
260
|
+
|
|
261
|
+
if (!web || !module.enabled) {
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const here = browserModuleState(module.file.replace(/\.ts$/, ""));
|
|
266
|
+
const parts = [
|
|
267
|
+
web.routes.length > 0 && `routes: ${web.routes.join(", ")}`,
|
|
268
|
+
web.commands?.length > 0 && `commands: ${web.commands.join(", ")}`,
|
|
269
|
+
web.client && `browser module for ${ACCESS_WORDS[web.client] ?? web.client}`,
|
|
270
|
+
web.publicPage && "pages for anyone with a link, no sign-in",
|
|
271
|
+
web.service && "a service for other modules",
|
|
272
|
+
here?.status === "loading" && "loading here",
|
|
273
|
+
here?.status === "off" && "off in this tab",
|
|
274
|
+
].filter(Boolean);
|
|
275
|
+
|
|
276
|
+
return html`${parts.length > 0 && html`<div class="muted small mono">${parts.join(" · ")}</div>`}
|
|
277
|
+
${
|
|
278
|
+
here?.status === "failed" &&
|
|
279
|
+
html`<div class="error-box small">
|
|
280
|
+
In this browser: ${here.error}. An edit to it, or reloading the page, tries again.
|
|
281
|
+
</div>`
|
|
282
|
+
}`;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Safe mode (`?noext=1`): this tab loads no browser parts of extensions, so one that breaks the app can be turned off
|
|
287
|
+
* here. The button loads them again.
|
|
288
|
+
*/
|
|
289
|
+
function SafeMode() {
|
|
290
|
+
if (!safeMode()) {
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return html`<div class="setting wrap safe-mode">
|
|
295
|
+
<div class="grow small">Extensions' browser parts are off in this tab, and so is the theme.</div>
|
|
296
|
+
<button class="button" onClick=${leaveSafeMode}>Turn them back on</button>
|
|
297
|
+
</div>`;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* How a drop-in the gallery installed stands (`installed`: the gallery's word on it), or, for one of the owner's own, a
|
|
302
|
+
* way to share it. Nothing for the rest.
|
|
303
|
+
*/
|
|
304
|
+
function GalleryPart({ module, installed, busy, turnOff }) {
|
|
305
|
+
if (!galleryAvailable() || module.source !== "drop-in") {
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
if (!installed) {
|
|
310
|
+
return html`<div class="extension-gallery">
|
|
311
|
+
<button
|
|
312
|
+
class="link small"
|
|
313
|
+
onClick=${() => openSheet({ type: "gallery-share", id: module.file })}
|
|
314
|
+
>
|
|
315
|
+
Share…
|
|
316
|
+
</button>
|
|
317
|
+
</div>`;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return html`${
|
|
321
|
+
installed.revoked !== null &&
|
|
322
|
+
html`<div class="error-box small">
|
|
323
|
+
The gallery revoked this version: ${installed.revoked}
|
|
324
|
+
${
|
|
325
|
+
module.enabled &&
|
|
326
|
+
html`<div class="sheet-actions">
|
|
327
|
+
<button class="button small primary" disabled=${busy} onClick=${turnOff}>
|
|
328
|
+
Turn it off
|
|
329
|
+
</button>
|
|
330
|
+
</div>`
|
|
331
|
+
}
|
|
332
|
+
</div>`
|
|
333
|
+
}
|
|
334
|
+
<div class="extension-gallery">
|
|
335
|
+
<span class="pi-tag gallery-plain">from the gallery · ${installed.version}</span>
|
|
336
|
+
${installed.update && html`<span class="pi-tag behind">update available</span>`}
|
|
337
|
+
<button
|
|
338
|
+
class="link small"
|
|
339
|
+
onClick=${() =>
|
|
340
|
+
openSheet({
|
|
341
|
+
type: "gallery-entry",
|
|
342
|
+
id: installed.name,
|
|
343
|
+
tab: "installed",
|
|
344
|
+
origin: store.state.sheet?.origin ?? "extensions",
|
|
345
|
+
})}
|
|
346
|
+
>
|
|
347
|
+
Details
|
|
348
|
+
</button>
|
|
349
|
+
</div>`;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/** When PiP compacts its own context: once idle above so many tokens (`pip-compact.ts`), or only as sessions do. */
|
|
353
|
+
const PIP_COMPACT = [
|
|
354
|
+
[0, "As sessions do"],
|
|
355
|
+
[40000, "Above 40k tokens"],
|
|
356
|
+
[60000, "Above 60k tokens"],
|
|
357
|
+
[100000, "Above 100k tokens"],
|
|
358
|
+
];
|
|
359
|
+
|
|
360
|
+
function PipCompactAt({ owner }) {
|
|
361
|
+
const at = store.state.server?.pipCompactAt ?? 0;
|
|
362
|
+
const change = (value) => attempt(() => api("settings", { pipCompactAt: value }));
|
|
363
|
+
|
|
364
|
+
return html`<div class="setting wrap">
|
|
365
|
+
<div class="grow">
|
|
366
|
+
<div class="small">Compact PiP's context</div>
|
|
367
|
+
<div class="muted small">
|
|
368
|
+
When PiP's older messages become a short summary: as a session's do, or sooner,
|
|
369
|
+
once PiP is idle above a limit, which keeps each reply cheaper.
|
|
370
|
+
</div>
|
|
371
|
+
</div>
|
|
372
|
+
<div class="segmented" role="group" aria-label="Compact PiP's context">
|
|
373
|
+
${PIP_COMPACT.map(
|
|
374
|
+
([value, label]) => html`<button
|
|
375
|
+
class=${at === value ? "on" : ""}
|
|
376
|
+
aria-pressed=${at === value}
|
|
377
|
+
disabled=${!owner}
|
|
378
|
+
onClick=${() => change(value)}
|
|
379
|
+
>
|
|
380
|
+
${label}
|
|
381
|
+
</button>`,
|
|
382
|
+
)}
|
|
383
|
+
</div>
|
|
384
|
+
</div>`;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export function ExtensionsSheet() {
|
|
388
|
+
return html`<${Sheet} title="Extensions" onClose=${closeSheet} wide=${true}>
|
|
389
|
+
<${ExtensionsContent} />
|
|
390
|
+
<//>`;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/** Built-in modules' marks, by file; drop-ins show their first letter. */
|
|
394
|
+
const ICONS = {
|
|
395
|
+
"prompt.ts": "chat",
|
|
396
|
+
"artifacts.ts": "artifact",
|
|
397
|
+
"browser.ts": "globe",
|
|
398
|
+
"subagents.ts": "users",
|
|
399
|
+
"schedules.ts": "clock",
|
|
400
|
+
"goals.ts": "check",
|
|
401
|
+
"plan.ts": "eye",
|
|
402
|
+
"codemode.ts": "terminal",
|
|
403
|
+
"memory.ts": "pin",
|
|
404
|
+
"pip.ts": "pip",
|
|
405
|
+
"triggers.ts": "pulse",
|
|
406
|
+
"gallery.ts": "grid",
|
|
407
|
+
"agent-teams.ts": "fork",
|
|
408
|
+
"guard.ts": "shield",
|
|
409
|
+
"anthropic-subscription.ts": "key",
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
/** A module's summary without the name it starts with ("Browser: Pi opens…" → "Pi opens…"), as its row shows the name. */
|
|
413
|
+
function summaryOf(module) {
|
|
414
|
+
const name = module.title.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
415
|
+
const rest = (module.summary ?? "").replace(new RegExp(`^(the )?${name}: `, "i"), "");
|
|
416
|
+
|
|
417
|
+
return rest.charAt(0).toUpperCase() + rest.slice(1);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/** The same management controls standalone or in the hub's Installed tab. */
|
|
421
|
+
export function ExtensionsContent({
|
|
422
|
+
galleryInstalled,
|
|
423
|
+
query = "",
|
|
424
|
+
onChanged = () => {},
|
|
425
|
+
hub = false,
|
|
426
|
+
before = null,
|
|
427
|
+
beforeCount = 0,
|
|
428
|
+
between = null,
|
|
429
|
+
show = null,
|
|
430
|
+
}) {
|
|
431
|
+
const { me } = store.state;
|
|
432
|
+
const owner = me?.role === "owner";
|
|
433
|
+
const [data, setData] = useState(null);
|
|
434
|
+
const [problem, setProblem] = useState(null);
|
|
435
|
+
const [busy, setBusy] = useState(null);
|
|
436
|
+
const [confirmGuard, setConfirmGuard] = useState(false);
|
|
437
|
+
// The drop-in waiting for the owner's word before it turns on, by file.
|
|
438
|
+
const [confirmOn, setConfirmOn] = useState(null);
|
|
439
|
+
// The rows opened to show their settings and details, by file.
|
|
440
|
+
const [open, setOpen] = useState(new Set());
|
|
441
|
+
const [builtInOpen, setBuiltInOpen] = useState(show === "built-in");
|
|
442
|
+
const guardCancel = useRef(null);
|
|
443
|
+
const guardSwitch = useRef(null);
|
|
444
|
+
// What the gallery installed, by module file: read after the list, and never in the way of it.
|
|
445
|
+
const [fromGallery, setFromGallery] = useState(new Map());
|
|
446
|
+
const load = () =>
|
|
447
|
+
api("extensions").then(
|
|
448
|
+
(result) => {
|
|
449
|
+
setData(result);
|
|
450
|
+
setProblem(null);
|
|
451
|
+
|
|
452
|
+
if (
|
|
453
|
+
galleryInstalled === undefined &&
|
|
454
|
+
galleryAvailable() &&
|
|
455
|
+
result.modules.some((each) => each.source === "drop-in")
|
|
456
|
+
) {
|
|
457
|
+
galleryApi("installed").then(
|
|
458
|
+
({ items }) =>
|
|
459
|
+
setFromGallery(new Map(items.map((each) => [each.file, each]))),
|
|
460
|
+
() => {},
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
(error) =>
|
|
465
|
+
setProblem(
|
|
466
|
+
error.status === 404
|
|
467
|
+
? "Restart the server (menu → Restart server) to manage extensions from here."
|
|
468
|
+
: error.message,
|
|
469
|
+
),
|
|
470
|
+
);
|
|
471
|
+
|
|
472
|
+
useEffect(() => {
|
|
473
|
+
load();
|
|
474
|
+
}, [galleryInstalled]);
|
|
475
|
+
// The model download changes the guard's status in every tab (the server pushes it): read the list again.
|
|
476
|
+
const modelState = store.state.guard?.model?.state;
|
|
477
|
+
|
|
478
|
+
useEffect(() => {
|
|
479
|
+
if (data) {
|
|
480
|
+
load();
|
|
481
|
+
}
|
|
482
|
+
}, [modelState]);
|
|
483
|
+
useLayoutEffect(() => {
|
|
484
|
+
if (confirmGuard) {
|
|
485
|
+
guardCancel.current?.focus();
|
|
486
|
+
} else if (busy === null) {
|
|
487
|
+
// Accepting disables switches until the request ends; restore focus only once it can take it.
|
|
488
|
+
guardSwitch.current?.focus({ preventScroll: true });
|
|
489
|
+
guardSwitch.current = null;
|
|
490
|
+
}
|
|
491
|
+
}, [confirmGuard, busy]);
|
|
492
|
+
|
|
493
|
+
const change = (module, path, body) => {
|
|
494
|
+
setBusy(module.file);
|
|
495
|
+
attempt(async () =>
|
|
496
|
+
setData(await api(`extensions/${encodeURIComponent(module.file)}${path}`, body)),
|
|
497
|
+
).finally(() => {
|
|
498
|
+
setBusy(null);
|
|
499
|
+
load();
|
|
500
|
+
onChanged();
|
|
501
|
+
});
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
const toggle = (module, button) => {
|
|
505
|
+
if (module.file === "guard.ts" && module.enabled) {
|
|
506
|
+
guardSwitch.current = button;
|
|
507
|
+
guardCancel.current?.focus();
|
|
508
|
+
setConfirmGuard(true);
|
|
509
|
+
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// A drop-in runs with the owner's rights: it asks first, in its own row, not in a dialog over the app.
|
|
514
|
+
if (module.source === "drop-in" && !module.enabled) {
|
|
515
|
+
setConfirmOn(confirmOn === module.file ? null : module.file);
|
|
516
|
+
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
setConfirmGuard(false);
|
|
521
|
+
change(module, "", { enabled: !module.enabled });
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
const flip = (file) => {
|
|
525
|
+
const next = new Set(open);
|
|
526
|
+
|
|
527
|
+
if (next.has(file)) {
|
|
528
|
+
next.delete(file);
|
|
529
|
+
} else {
|
|
530
|
+
next.add(file);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
setOpen(next);
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
const installedByFile =
|
|
537
|
+
galleryInstalled === undefined
|
|
538
|
+
? fromGallery
|
|
539
|
+
: new Map(galleryInstalled.map((item) => [item.file, item]));
|
|
540
|
+
const needle = query.trim().toLowerCase();
|
|
541
|
+
const managed = (data?.modules ?? []).filter(
|
|
542
|
+
(module) =>
|
|
543
|
+
(galleryInstalled === undefined ||
|
|
544
|
+
!installedByFile.has(module.file) ||
|
|
545
|
+
// Failed gallery modules stay here: the hub's own rows show their errors.
|
|
546
|
+
(!hub &&
|
|
547
|
+
(module.error ||
|
|
548
|
+
browserModuleState(module.file.replace(/\.ts$/, ""))?.status ===
|
|
549
|
+
"failed"))) &&
|
|
550
|
+
(!needle ||
|
|
551
|
+
[
|
|
552
|
+
module.title,
|
|
553
|
+
module.file,
|
|
554
|
+
module.summary ?? "",
|
|
555
|
+
...module.extensions.flatMap((extension) => extension.tools),
|
|
556
|
+
].some((text) => text.toLowerCase().includes(needle))),
|
|
557
|
+
);
|
|
558
|
+
|
|
559
|
+
const row = (module) => {
|
|
560
|
+
const tools = module.extensions.flatMap((extension) => extension.tools);
|
|
561
|
+
const guard = module.file === "guard.ts";
|
|
562
|
+
const note = guard ? guardNote(module, data.guard) : null;
|
|
563
|
+
const installed = installedByFile.get(module.file);
|
|
564
|
+
const isOpen = open.has(module.file);
|
|
565
|
+
const id = `ext-more-${module.file.replace(/[^a-z0-9]/gi, "-")}`;
|
|
566
|
+
|
|
567
|
+
return html`<div
|
|
568
|
+
key=${module.file}
|
|
569
|
+
class=${`ext-row module ${module.enabled ? "" : "off"} ${isOpen ? "open" : ""}`}
|
|
570
|
+
>
|
|
571
|
+
<button
|
|
572
|
+
class="ext-row-open"
|
|
573
|
+
aria-expanded=${isOpen ? "true" : "false"}
|
|
574
|
+
aria-controls=${id}
|
|
575
|
+
onClick=${() => flip(module.file)}
|
|
576
|
+
>
|
|
577
|
+
<span class="ext-row-line">
|
|
578
|
+
<${Tile} name=${module.file} title=${module.title} icon=${ICONS[module.file] ?? null} />
|
|
579
|
+
<span class="ext-row-title">${module.title}</span>
|
|
580
|
+
${module.source === "drop-in" && html`<span class="ext-row-by mono">${module.file}</span>`}
|
|
581
|
+
<${Icon} name="down" size=${14} class="ext-row-chevron" />
|
|
582
|
+
</span>
|
|
583
|
+
${module.summary && html`<span class="ext-row-desc">${summaryOf(module)}</span>`}
|
|
584
|
+
${module.error && html`<span class="ext-row-meta warn">Did not load</span>`}
|
|
585
|
+
${installed?.revoked && html`<span class="ext-row-meta warn">The gallery revoked this version</span>`}
|
|
586
|
+
${installed?.update && html`<span class="ext-row-meta accent">An update is ready</span>`}
|
|
587
|
+
</button>
|
|
588
|
+
<div class="ext-row-end">
|
|
589
|
+
${
|
|
590
|
+
module.required
|
|
591
|
+
? html`<span class="ext-state">Always on</span>`
|
|
592
|
+
: html`<${Switch}
|
|
593
|
+
on=${module.enabled}
|
|
594
|
+
disabled=${!owner || busy !== null}
|
|
595
|
+
label=${`${module.title}: ${module.enabled ? "on" : "off"}`}
|
|
596
|
+
onChange=${(event) => toggle(module, event.currentTarget)}
|
|
597
|
+
/>`
|
|
598
|
+
}
|
|
599
|
+
</div>
|
|
600
|
+
${note?.warn && html`<div class="ext-row-under small warn">${note.text}</div>`}
|
|
601
|
+
${
|
|
602
|
+
guard &&
|
|
603
|
+
html`<div class="ext-row-under">
|
|
604
|
+
<${GuardModel}
|
|
605
|
+
owner=${owner}
|
|
606
|
+
model=${store.state.guard?.model ?? data.guard.model}
|
|
607
|
+
onStart=${() => attempt(async () => setData(await api("guard/model", {})))}
|
|
608
|
+
/>
|
|
609
|
+
</div>`
|
|
610
|
+
}
|
|
611
|
+
${
|
|
612
|
+
guard &&
|
|
613
|
+
module.enabled &&
|
|
614
|
+
confirmGuard &&
|
|
615
|
+
html`<div
|
|
616
|
+
class="guard-confirm ext-row-under"
|
|
617
|
+
role="alertdialog"
|
|
618
|
+
aria-label="Turn off Lancet Guard?"
|
|
619
|
+
aria-describedby="guard-confirm-warning"
|
|
620
|
+
onKeyDown=${(event) => {
|
|
621
|
+
if (event.key === "Escape" && !event.isComposing && event.keyCode !== 229) {
|
|
622
|
+
event.preventDefault();
|
|
623
|
+
event.stopPropagation();
|
|
624
|
+
setConfirmGuard(false);
|
|
625
|
+
}
|
|
626
|
+
}}
|
|
627
|
+
>
|
|
628
|
+
<span id="guard-confirm-warning">bash, background, write, and edit calls will run without checks in every session here. Pi's own setting stays as it is.</span>
|
|
629
|
+
<div class="sheet-actions">
|
|
630
|
+
<button
|
|
631
|
+
class="button small"
|
|
632
|
+
ref=${guardCancel}
|
|
633
|
+
onClick=${() => setConfirmGuard(false)}
|
|
634
|
+
>
|
|
635
|
+
Keep it on
|
|
636
|
+
</button>
|
|
637
|
+
<button
|
|
638
|
+
class="button small primary"
|
|
639
|
+
disabled=${busy !== null}
|
|
640
|
+
onClick=${() => {
|
|
641
|
+
setConfirmGuard(false);
|
|
642
|
+
change(module, "", { enabled: false });
|
|
643
|
+
}}
|
|
644
|
+
>
|
|
645
|
+
Turn off
|
|
646
|
+
</button>
|
|
647
|
+
</div>
|
|
648
|
+
</div>`
|
|
649
|
+
}
|
|
650
|
+
${
|
|
651
|
+
confirmOn === module.file &&
|
|
652
|
+
!module.enabled &&
|
|
653
|
+
html`<div class="ext-confirm ext-row-under" role="group" aria-label=${`Turn on ${module.title}?`}>
|
|
654
|
+
<span>It runs inside the server with your rights, in every session. Turn it on only if you trust its code.</span>
|
|
655
|
+
<div class="sheet-actions">
|
|
656
|
+
<button class="button small" onClick=${() => setConfirmOn(null)}>Not now</button>
|
|
657
|
+
<button
|
|
658
|
+
class="button small primary"
|
|
659
|
+
disabled=${busy !== null}
|
|
660
|
+
onClick=${() => {
|
|
661
|
+
setConfirmOn(null);
|
|
662
|
+
change(module, "", { enabled: true });
|
|
663
|
+
}}
|
|
664
|
+
>
|
|
665
|
+
Turn on
|
|
666
|
+
</button>
|
|
667
|
+
</div>
|
|
668
|
+
</div>`
|
|
669
|
+
}
|
|
670
|
+
${module.error && html`<div class="error-box small ext-row-under">${module.error}</div>`}
|
|
671
|
+
${
|
|
672
|
+
isOpen &&
|
|
673
|
+
html`<div class="ext-row-more ext-row-under" id=${id}>
|
|
674
|
+
${note && !note.warn && html`<div class="small ok">${note.text}</div>`}
|
|
675
|
+
${guard && module.enabled && html`<${ApprovalRule} owner=${owner} />`}
|
|
676
|
+
${module.file === "pip.ts" && module.enabled && html`<${PipCompactAt} owner=${owner} />`}
|
|
677
|
+
<${WebPart} module=${module} />
|
|
678
|
+
${
|
|
679
|
+
owner &&
|
|
680
|
+
module.enabled &&
|
|
681
|
+
module.web?.settings &&
|
|
682
|
+
html`<${ModuleSettings} module=${module.file.replace(/\.ts$/, "")} />`
|
|
683
|
+
}
|
|
684
|
+
<${GalleryPart}
|
|
685
|
+
module=${module}
|
|
686
|
+
installed=${installed}
|
|
687
|
+
busy=${busy !== null}
|
|
688
|
+
turnOff=${() => change(module, "", { enabled: false })}
|
|
689
|
+
/>
|
|
690
|
+
<div class="muted small mono">
|
|
691
|
+
${module.source === "drop-in" ? `drop-in${module.path ? ` · ${shortPath(module.path, store.state.server?.home)}` : ""}` : module.file}
|
|
692
|
+
${tools.length > 0 ? ` · tools: ${tools.join(", ")}` : ""}
|
|
693
|
+
</div>
|
|
694
|
+
${
|
|
695
|
+
owner &&
|
|
696
|
+
module.enabled &&
|
|
697
|
+
html`<div class="ext-step-actions">
|
|
698
|
+
<button
|
|
699
|
+
class="button small"
|
|
700
|
+
disabled=${busy !== null}
|
|
701
|
+
onClick=${() => change(module, "/reload", {})}
|
|
702
|
+
>
|
|
703
|
+
<${Icon} name="reload" size=${14} /> Reload
|
|
704
|
+
</button>
|
|
705
|
+
</div>`
|
|
706
|
+
}
|
|
707
|
+
</div>`
|
|
708
|
+
}
|
|
709
|
+
</div>`;
|
|
710
|
+
};
|
|
711
|
+
|
|
712
|
+
if (hub) {
|
|
713
|
+
const yours = managed.filter((module) => module.source === "drop-in");
|
|
714
|
+
const builtIn = managed.filter((module) => module.source !== "drop-in");
|
|
715
|
+
const on = builtIn.filter((module) => module.enabled).length;
|
|
716
|
+
|
|
717
|
+
return html`<div class="extension-management hub">
|
|
718
|
+
<${SafeMode} />
|
|
719
|
+
${problem && html`<div class="error-box">${problem}</div>`}
|
|
720
|
+
${
|
|
721
|
+
(beforeCount > 0 || yours.length > 0) &&
|
|
722
|
+
html`<section class="ext-section">
|
|
723
|
+
<h3 class="ext-section-title">Extensions <span>${beforeCount + yours.length}</span></h3>
|
|
724
|
+
${before}
|
|
725
|
+
${yours.length > 0 && html`<div class="ext-list">${yours.map(row)}</div>`}
|
|
726
|
+
</section>`
|
|
727
|
+
}
|
|
728
|
+
${between}
|
|
729
|
+
${!data && !problem && html`<${Loader} label="Loading extensions" />`}
|
|
730
|
+
${
|
|
731
|
+
builtIn.length > 0 &&
|
|
732
|
+
html`<details
|
|
733
|
+
class="ext-section ext-builtins"
|
|
734
|
+
open=${builtInOpen || needle !== "" || builtIn.some((module) => module.error)}
|
|
735
|
+
onToggle=${(event) => setBuiltInOpen(event.currentTarget.open)}
|
|
736
|
+
>
|
|
737
|
+
<summary>
|
|
738
|
+
<h3 class="ext-section-title">Built in <span>${builtIn.length}</span></h3>
|
|
739
|
+
<span class="muted small">${on} on, ${builtIn.length - on} off</span>
|
|
740
|
+
<${Icon} name="down" size=${14} />
|
|
741
|
+
</summary>
|
|
742
|
+
<div class="ext-list">${builtIn.map(row)}</div>
|
|
743
|
+
</details>`
|
|
744
|
+
}
|
|
745
|
+
${
|
|
746
|
+
data &&
|
|
747
|
+
needle &&
|
|
748
|
+
managed.length === 0 &&
|
|
749
|
+
beforeCount === 0 &&
|
|
750
|
+
html`<p class="muted small">Nothing installed matches.</p>`
|
|
751
|
+
}
|
|
752
|
+
${
|
|
753
|
+
owner &&
|
|
754
|
+
html`<footer class="ext-footer">
|
|
755
|
+
${
|
|
756
|
+
data?.dropIns &&
|
|
757
|
+
html`<span>
|
|
758
|
+
Make your own: a <span class="mono">.ts</span> module in <span class="mono">${shortPath(data.dropIns, store.state.server?.home)}</span> stays off until you turn it on.
|
|
759
|
+
</span>`
|
|
760
|
+
}
|
|
761
|
+
<a class="link small" href=${GUIDE} target="_blank" rel="noopener noreferrer">
|
|
762
|
+
How to write one <${Icon} name="external" size=${13} />
|
|
763
|
+
</a>
|
|
764
|
+
</footer>`
|
|
765
|
+
}
|
|
766
|
+
</div>`;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
return html`<div class="extension-management">
|
|
770
|
+
<p class="ext-intro">
|
|
771
|
+
Tools, checks, and app features. A change reaches every session at once and stays after restarts.${owner ? "" : " Only the owner can change them."}
|
|
772
|
+
</p>
|
|
773
|
+
<${SafeMode} />
|
|
774
|
+
${problem && html`<div class="error-box">${problem}</div>`}
|
|
775
|
+
${!data && !problem && html`<${Loader} label="Loading extensions" />`}
|
|
776
|
+
${
|
|
777
|
+
data &&
|
|
778
|
+
[
|
|
779
|
+
["Built in", managed.filter((module) => module.source !== "drop-in")],
|
|
780
|
+
["Yours", managed.filter((module) => module.source === "drop-in")],
|
|
781
|
+
]
|
|
782
|
+
.filter(([, modules]) => modules.length > 0)
|
|
783
|
+
.map(
|
|
784
|
+
([title, modules]) => html`<div class="group" key=${title}>
|
|
785
|
+
<div class="group-title">${title}</div>
|
|
786
|
+
<div class="ext-list">${modules.map(row)}</div>
|
|
787
|
+
</div>`,
|
|
788
|
+
)
|
|
789
|
+
}
|
|
790
|
+
${
|
|
791
|
+
data &&
|
|
792
|
+
needle &&
|
|
793
|
+
managed.length === 0 &&
|
|
794
|
+
html`<p class="muted small">No built-in extensions or drop-ins match.</p>`
|
|
795
|
+
}
|
|
796
|
+
${
|
|
797
|
+
owner &&
|
|
798
|
+
html`<footer class="ext-footer">
|
|
799
|
+
${
|
|
800
|
+
galleryInstalled === undefined &&
|
|
801
|
+
galleryAvailable() &&
|
|
802
|
+
html`<button class="link small" onClick=${() => openSheet({ type: "gallery" })}>
|
|
803
|
+
<${Icon} name="search" size=${14} /> Find extensions
|
|
804
|
+
</button>`
|
|
805
|
+
}
|
|
806
|
+
${
|
|
807
|
+
data?.dropIns &&
|
|
808
|
+
html`<span>
|
|
809
|
+
Make your own: put a <span class="mono">.ts</span> module in <span class="mono">${shortPath(data.dropIns, store.state.server?.home)}</span>. It stays off until you turn it on.
|
|
810
|
+
</span>`
|
|
811
|
+
}
|
|
812
|
+
<a class="link small" href=${GUIDE} target="_blank" rel="noopener noreferrer">
|
|
813
|
+
How to write one <${Icon} name="external" size=${13} />
|
|
814
|
+
</a>
|
|
815
|
+
</footer>`
|
|
816
|
+
}
|
|
817
|
+
</div>`;
|
|
818
|
+
}
|