@fungi.computer/tourtois 0.24.1 → 0.26.0

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/dist/Keys.d.ts CHANGED
@@ -43,6 +43,8 @@ export type KeyGrantPreviewProps = Readonly<{
43
43
  export type KeysPort = Readonly<{
44
44
  scope: string;
45
45
  expiry: "required" | "optional";
46
+ /** The host stamps each key's last use, so a key with none has never been used. */
47
+ tracksUse?: true;
46
48
  options(apps: readonly KeyAppOption[], signal: AbortSignal): Promise<readonly KeyGrantOption[]>;
47
49
  list(): Promise<KeysView>;
48
50
  issue(draft: KeyIssueDraft): Promise<KeyIssueResult>;
package/dist/Keys.js CHANGED
@@ -79,7 +79,9 @@ function KeysContent({ port, apps, }) {
79
79
  .join(" · ") }), _jsxs("p", { children: [key.expiresAt === null
80
80
  ? "Never expires"
81
81
  : `${key.expiresAt <= Date.now() ? "Expired" : "Expires"} ${new Date(key.expiresAt).toLocaleString()}`, " ", "\u00B7", " ", key.lastUsedAt === null
82
- ? "Use not recorded"
82
+ ? port.tracksUse === true
83
+ ? "Never used"
84
+ : "Use not recorded"
83
85
  : `Last used ${new Date(key.lastUsedAt).toLocaleString()}`] })] }), actions: key.revokedAt === null ? (_jsxs(_Fragment, { children: [port.updateGrants !== undefined &&
84
86
  key.grants.length > 0 ? (_jsx(KeycapButton, { density: "compact", label: "Edit", icon: _jsx(Sigil, { name: "write" }), "aria-label": `Edit ${key.name}`, disabled: busy || command !== null, onClick: () => {
85
87
  setEditing(key);
@@ -6,7 +6,6 @@ import { MaosaicoRoot } from "@fungi.computer/maosaico";
6
6
  import { useEffect, useRef, useState } from "react";
7
7
  import { AppWorkbench } from "./AppWorkbench.js";
8
8
  import { tileGap } from "./tile-gap.js";
9
- import { WelcomeProvider } from "./desktop/welcome.js";
10
9
  function useWorkbenchBounds() {
11
10
  const ref = useRef(null);
12
11
  const [bounds, setBounds] = useState({ height: 0, width: 0 });
@@ -40,5 +39,5 @@ export function TeamTourtois({ children, teamId, teamName, extraLaunchers, setti
40
39
  mainSize: Math.max(0, Math.min(640, bounds.width)),
41
40
  gap: tileGap,
42
41
  }
43
- : undefined, children: _jsx(WelcomeProvider, { teamId: teamId, storage: desktopStorage, children: _jsx(AppWorkbench, { paneLayerRef: paneLayerRef, phone: phone, teamId: teamId, teamName: teamName ?? teamId, initialComputerId: data?.[0]?.computerId ?? null, computers: data ?? [], computersUnavailable: isLoading || isError, onLayoutChange: phone ? undefined : setTiled, platform: platform, desktopStorage: desktopStorage, desktopMethods: desktopMethods, gills: gills, ...(extraLaunchers ? { extraLaunchers } : {}), ...(settingsLaunchers ? { settingsLaunchers } : {}), settingsSections: settingsSections, ...(systemMenuItems ? { systemMenuItems } : {}), directoryReader: directoryReader, ...(takeAppOpenRequest ? { takeAppOpenRequest } : {}) }) }) }) }), children] }) }));
42
+ : undefined, children: _jsx(AppWorkbench, { paneLayerRef: paneLayerRef, phone: phone, teamId: teamId, teamName: teamName ?? teamId, initialComputerId: data?.[0]?.computerId ?? null, computers: data ?? [], computersUnavailable: isLoading || isError, onLayoutChange: phone ? undefined : setTiled, platform: platform, desktopStorage: desktopStorage, desktopMethods: desktopMethods, gills: gills, ...(extraLaunchers ? { extraLaunchers } : {}), ...(settingsLaunchers ? { settingsLaunchers } : {}), settingsSections: settingsSections, ...(systemMenuItems ? { systemMenuItems } : {}), directoryReader: directoryReader, ...(takeAppOpenRequest ? { takeAppOpenRequest } : {}) }) }) }), children] }) }));
44
43
  }
@@ -77,8 +77,6 @@ function refusalMessage(code) {
77
77
  return "The desktop changed elsewhere. Try your change again.";
78
78
  case "too_large":
79
79
  return "This desktop arrangement is too large to save. Remove some widgets or Launcher preferences and try again.";
80
- case "last_launcher":
81
- return "Your desktop needs one Launcher.";
82
80
  case "quota_exceeded":
83
81
  return "The App's storage quota is full. Free some storage before saving again.";
84
82
  default:
@@ -109,17 +107,41 @@ function ArrangedDesktop({ owner, ...props }) {
109
107
  };
110
108
  }, []);
111
109
  const columns = props.phone ? 1 : 4;
112
- const isLauncher = (item) => catalog.some((gill) => gill.kind === "launcher" &&
113
- gill.surfaceId === item.surfaceId &&
114
- gill.gillId === item.gillId);
115
- const onlyLauncher = visibleItems.filter(isLauncher).length <= 1;
116
- const launcherGill = catalog.find((gill) => gill.kind === "launcher");
117
110
  useEffect(() => {
118
111
  setContentHeights((previous) => {
119
112
  const current = new Map([...previous].filter(([id]) => snapshot.layout.items.some((item) => item.id === id)));
120
113
  return current.size === previous.size ? previous : current;
121
114
  });
122
115
  }, [snapshot.layout.items]);
116
+ // A lone surface widget, such as the first dashboard's chat, fills the
117
+ // height below the app bar. Presentation only: the stored size and cell stay
118
+ // the canonical four-column ones.
119
+ const [fill, setFill] = useState(0);
120
+ const loneSurface = visibleItems.length === 1 &&
121
+ catalog.some((gill) => gill.kind === "surface" &&
122
+ gill.surfaceId === visibleItems[0]?.surfaceId &&
123
+ gill.gillId === visibleItems[0].gillId);
124
+ useEffect(() => {
125
+ const node = stage.current;
126
+ const scroller = node?.closest(".tourtois-desktop");
127
+ if (!loneSurface || !node || !scroller) {
128
+ setFill(0);
129
+ return undefined;
130
+ }
131
+ const measure = () => {
132
+ const top = node.getBoundingClientRect().top -
133
+ scroller.getBoundingClientRect().top +
134
+ scroller.scrollTop;
135
+ const below = parseFloat(getComputedStyle(scroller).paddingBottom) || 0;
136
+ setFill(Math.max(0, Math.floor(scroller.clientHeight - top - below)));
137
+ };
138
+ measure();
139
+ const observer = new ResizeObserver(measure);
140
+ observer.observe(scroller);
141
+ return () => {
142
+ observer.disconnect();
143
+ };
144
+ }, [loneSurface]);
123
145
  const projected = desktopPlacements(snapshot.layout)
124
146
  .filter((cell) => visibleItems.some((item) => item.id === cell.id))
125
147
  .map((cell) => {
@@ -177,7 +199,11 @@ function ArrangedDesktop({ owner, ...props }) {
177
199
  gill.gillId === declaration.gillId);
178
200
  // Launchers grow to show their Apps; row Gills stay bounded and
179
201
  // scroll once populated. Both fit their content when it is short.
180
- const height = isLauncher ? natural : Math.min(natural, canonical);
202
+ const height = isLauncher
203
+ ? natural
204
+ : loneSurface
205
+ ? Math.max(canonical, fill)
206
+ : Math.min(natural, canonical);
181
207
  return Math.max(0, height - (item.h - 1) * gap) / item.h;
182
208
  })));
183
209
  const binding = useMaosaicoBento({
@@ -301,30 +327,16 @@ function ArrangedDesktop({ owner, ...props }) {
301
327
  })
302
328
  : Promise.resolve(false);
303
329
  } }, configuration.itemId ??
304
- `${configuration.gill.surfaceId}:${configuration.gill.gillId}`)) : null, snapshot.notice ? (_jsx(Alert, { tone: "info", description: snapshot.notice })) : null, visibleItems.length === 0 ? (_jsx("div", { className: "tourtois-desktop-empty", children: _jsx(EmptyState, { variant: "panel", title: "Your desktop is empty", description: "Restore the Launcher to get back to your Apps.", actions: _jsx(Button, { disabled: saving, onClick: () => {
305
- const size = launcherGill?.sizes.includes("M")
306
- ? "M"
307
- : launcherGill?.sizes[0];
308
- if (launcherGill && size)
309
- void save("layout.place", {
310
- surfaceId: launcherGill.surfaceId,
311
- gillId: launcherGill.gillId,
312
- size,
313
- });
314
- else
315
- void save("layout.reset", {});
316
- }, children: "Restore Launcher" }) }) })) : null, _jsx("div", { ref: stage, className: "tourtois-desktop-stage", style: { height }, "data-desktop-columns": columns, "data-preview": binding.preview, "data-arranging": editing ? "" : undefined, children: visibleItems.map((item) => {
330
+ `${configuration.gill.surfaceId}:${configuration.gill.gillId}`)) : null, snapshot.notice ? (_jsx(Alert, { tone: "info", description: snapshot.notice })) : null, visibleItems.length === 0 ? (_jsx("div", { className: "tourtois-desktop-empty", children: _jsx(EmptyState, { variant: "hint", title: "Your dashboard is empty", description: "Add a widget from Layout." }) })) : null, _jsx("div", { ref: stage, className: "tourtois-desktop-stage", style: { height }, "data-desktop-columns": columns, "data-preview": binding.preview, "data-arranging": editing ? "" : undefined, children: visibleItems.map((item) => {
317
331
  const frame = binding.frames.get(item.id);
318
332
  const gill = catalog.find((gill) => gill.surfaceId === item.surfaceId && gill.gillId === item.gillId);
319
333
  if (!frame || !gill)
320
334
  return null;
321
335
  const controls = editing ? (_jsxs("div", { className: "tourtois-arrange-controls", children: [_jsx(IconButton, { size: "responsive", "aria-label": `Move ${gill.title}`, title: `Move ${gill.title}`, icon: _jsx(GripVertical, {}), ...binding.bind(item.id, "move") }), _jsx("div", { className: "join tourtois-gill-sizes", role: "group", "aria-label": `Size of ${gill.title}`, children: gill.sizes.map((size) => (_jsx(IconButton, { className: "join-item", size: "sm", icon: size, "aria-label": `Size ${size === "S" ? "small" : size === "M" ? "medium" : "large"}`, title: `${gill.title}: ${size}`, variant: size === item.size ? "secondary" : "ghost", "aria-pressed": size === item.size, disabled: saving, onClick: () => {
322
336
  void save("layout.resize", { id: item.id, size });
323
- } }, size))) }), _jsx("span", { title: onlyLauncher && isLauncher(item)
324
- ? "Your desktop needs one Launcher"
325
- : undefined, children: _jsx(IconButton, { size: "responsive", "aria-label": `Remove ${gill.title}`, title: `Remove ${gill.title}`, icon: _jsx(Trash2, {}), disabled: saving || (onlyLauncher && isLauncher(item)), onClick: () => {
326
- void save("layout.remove", { id: item.id });
327
- } }) })] })) : undefined;
337
+ } }, size))) }), _jsx(IconButton, { size: "responsive", "aria-label": `Remove ${gill.title}`, title: `Remove ${gill.title}`, icon: _jsx(Trash2, {}), disabled: saving, onClick: () => {
338
+ void save("layout.remove", { id: item.id });
339
+ } })] })) : undefined;
328
340
  const onContentHeight = (height) => {
329
341
  setContentHeights((previous) => previous.get(item.id) === height
330
342
  ? previous
@@ -368,13 +380,10 @@ function ArrangedDesktop({ owner, ...props }) {
368
380
  });
369
381
  }, onConfigure: () => {
370
382
  setConfiguration({ gill, itemId: item.id });
371
- }, launch: props.launcherItems.find((app) => app.id === `app:${item.surfaceId}`), editHandle: editing ? _jsx("span", { "aria-hidden": "true" }) : undefined, onContentHeight: onContentHeight }, JSON.stringify(item.params ?? {}))) : declaration?.view === "surface" && app ? (_jsx(SurfaceGill, { title: declaration.title, appHeader: {
372
- name: app.displayName ?? "App",
373
- icon: _jsx(DeclaredAppIcon, { icon: app.icon }),
374
- }, size: item.size, target: {
383
+ }, launch: props.launcherItems.find((app) => app.id === `app:${item.surfaceId}`), editHandle: editing ? _jsx("span", { "aria-hidden": "true" }) : undefined, onContentHeight: onContentHeight }, JSON.stringify(item.params ?? {}))) : declaration?.view === "surface" && app ? (_jsx(SurfaceGill, { title: declaration.title, appName: app.displayName ?? "App", size: item.size, target: {
375
384
  itemId: item.id,
376
385
  surfaceId: item.surfaceId,
377
386
  gillId: item.gillId,
378
- }, mount: props.mountSurface, editing: editing, editHandle: editing ? _jsx("span", { "aria-hidden": "true" }) : undefined })) : null }), controls] }, item.id));
387
+ }, mount: props.mountSurface, editing: editing })) : null }), controls] }, item.id));
379
388
  }) })] }));
380
389
  }
@@ -13,13 +13,11 @@ import { Badge } from "@fungi.computer/caps/components/badge";
13
13
  import { Loader } from "@fungi.computer/caps/components/loader";
14
14
  import { starterItem } from "./starter-item.js";
15
15
  import { GillFrame } from "./gill-frame.js";
16
- import { FirstRunWelcome, useWelcome } from "./welcome.js";
17
16
  import { LoadingState } from "@fungi.computer/caps/blocks/loading-state";
18
17
  const installDocs = "https://docs.fungi.computer/oyster-quickstart/";
19
18
  /** Trusted shell Gill. Defaults to the same complete launchable set/order as the AppBar. */
20
19
  export function LauncherGill({ items, size = "M", onAllApps, loading = false, unavailable = false, onRetry, warnings = [], preferences, onPreference, editHandle, onContentHeight, installing = [], onRetryInstall, }) {
21
20
  const [editing, setEditing] = useState(false);
22
- const welcome = useWelcome();
23
21
  const stateFor = (id) => preferences.hidden.includes(id)
24
22
  ? "Hidden"
25
23
  : preferences.pinned.includes(id)
@@ -65,7 +63,7 @@ export function LauncherGill({ items, size = "M", onAllApps, loading = false, un
65
63
  const ready = !loading && !unavailable;
66
64
  return (_jsxs(GillFrame, { title: "Launcher", size: size, onContentHeight: onContentHeight, editHandle: editHandle ?? (_jsx(Button, { size: "xs", variant: "outline", "aria-expanded": editing, onClick: () => {
67
65
  setEditing(!editing);
68
- }, children: editing ? "Done" : "Edit launcher" })), children: [loading ? _jsx(LoadingState, { message: "Loading Apps\u2026" }) : null, unavailable ? (_jsx(FailureLine, { role: "alert", message: "App directory unavailable.", ...(onRetry ? { onRetry } : {}) })) : null, ready ? (_jsxs(_Fragment, { children: [welcome.visible && shown.length > 0 ? (_jsx(FirstRunWelcome, { items: items, onDismiss: welcome.dismiss })) : null, items.length === 0 ? (_jsx(EmptyState, { variant: "hint", title: "No Apps available", description: "Open All Apps to find what you can use.", primaryAction: { label: "Open All Apps", onSelect: onAllApps } })) : null, items.length > 0 && shown.length === 0 && !editing ? (_jsx(EmptyState, { variant: "quiet", title: "Choose the Apps you want here", description: "Your Apps are hidden from the launcher.", primaryAction: {
66
+ }, children: editing ? "Done" : "Edit launcher" })), children: [loading ? _jsx(LoadingState, { message: "Loading Apps\u2026" }) : null, unavailable ? (_jsx(FailureLine, { role: "alert", message: "App directory unavailable.", ...(onRetry ? { onRetry } : {}) })) : null, ready ? (_jsxs(_Fragment, { children: [items.length === 0 ? (_jsx(EmptyState, { variant: "hint", title: "No Apps available", description: "Open All Apps to find what you can use.", primaryAction: { label: "Open All Apps", onSelect: onAllApps } })) : null, items.length > 0 && shown.length === 0 && !editing ? (_jsx(EmptyState, { variant: "quiet", title: "Choose the Apps you want here", description: "Your Apps are hidden from the launcher.", primaryAction: {
69
67
  label: "Show Apps",
70
68
  onSelect: () => {
71
69
  setEditing(true);
@@ -1,4 +1,3 @@
1
- import { type ReactNode } from "react";
2
1
  import type { AppGillDesktopSize } from "@fungi.computer/gills";
3
2
  /** The placed surface tile whose App frame the host mounts. */
4
3
  export type SurfaceTarget = Readonly<{
@@ -16,18 +15,15 @@ export type SurfaceHandle = Readonly<{
16
15
  */
17
16
  export type SurfaceMount = (container: HTMLElement, target: SurfaceTarget, signal: AbortSignal) => Promise<SurfaceHandle>;
18
17
  /**
19
- * A surface Gill: the App renders itself in its tile. While arranging, a shield
20
- * covers the frame so a drag over it never reaches the App's document.
18
+ * A surface Gill: the App renders itself, its own header included, in a plain
19
+ * card, so the host adds no second title bar. While arranging, a shield covers
20
+ * the frame so a drag over it never reaches the App's document.
21
21
  */
22
- export declare function SurfaceGill({ title, appHeader, size, target, mount, editing, editHandle, }: {
22
+ export declare function SurfaceGill({ title, appName, size, target, mount, editing, }: {
23
23
  title: string;
24
- appHeader: Readonly<{
25
- name: string;
26
- icon: ReactNode;
27
- }>;
24
+ appName: string;
28
25
  size: AppGillDesktopSize;
29
26
  target: SurfaceTarget;
30
27
  mount: SurfaceMount;
31
28
  editing: boolean;
32
- editHandle?: ReactNode;
33
29
  }): import("react/jsx-runtime").JSX.Element;
@@ -2,12 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useRef, useState } from "react";
3
3
  import { ResultState } from "@fungi.computer/caps/blocks/result-state";
4
4
  import { Button } from "@fungi.computer/caps/components/button";
5
- import { GillFrame } from "./gill-frame.js";
5
+ import { Card } from "@fungi.computer/caps/components/card";
6
6
  /**
7
- * A surface Gill: the App renders itself in its tile. While arranging, a shield
8
- * covers the frame so a drag over it never reaches the App's document.
7
+ * A surface Gill: the App renders itself, its own header included, in a plain
8
+ * card, so the host adds no second title bar. While arranging, a shield covers
9
+ * the frame so a drag over it never reaches the App's document.
9
10
  */
10
- export function SurfaceGill({ title, appHeader, size, target, mount, editing, editHandle, }) {
11
+ export function SurfaceGill({ title, appName, size, target, mount, editing, }) {
11
12
  const slot = useRef(null);
12
13
  const latest = useRef(mount);
13
14
  latest.current = mount;
@@ -39,7 +40,7 @@ export function SurfaceGill({ title, appHeader, size, target, mount, editing, ed
39
40
  handle = undefined;
40
41
  };
41
42
  }, [itemId, surfaceId, gillId, attempt]);
42
- return (_jsx(GillFrame, { title: title, appHeader: appHeader, size: size, editHandle: editHandle, children: _jsxs("div", { className: "tourtois-surface-body", children: [_jsx("div", { ref: slot, className: "tourtois-surface-frame" }), failed ? (_jsx("div", { className: "tourtois-surface-failure", children: _jsx(ResultState, { tone: "failed", headingLevel: 3, title: "This widget could not open", description: `${appHeader.name} didn't start in its tile.`, actions: _jsx(Button, { size: "sm", variant: "outline", onClick: () => {
43
+ return (_jsx(Card, { "aria-label": `${title}, ${appName}`, className: "tourtois-surface-card", "data-gill-size": size, role: "region", children: _jsxs("div", { className: "tourtois-surface-body", children: [_jsx("div", { ref: slot, className: "tourtois-surface-frame" }), failed ? (_jsx("div", { className: "tourtois-surface-failure", children: _jsx(ResultState, { tone: "failed", headingLevel: 3, title: "This widget could not open", description: `${appName} didn't start in its tile.`, actions: _jsx(Button, { size: "sm", variant: "outline", onClick: () => {
43
44
  setAttempt((count) => count + 1);
44
45
  }, children: "Try again" }) }) })) : null, editing ? (_jsx("div", { "data-surface-shield": "", className: "tourtois-surface-shield" })) : null] }) }));
45
46
  }
@@ -95,7 +95,6 @@ export declare const desktopArrangeResultSchema: z.ZodDiscriminatedUnion<[z.ZodO
95
95
  unknown_app: "unknown_app";
96
96
  size_not_allowed: "size_not_allowed";
97
97
  unknown_item: "unknown_item";
98
- last_launcher: "last_launcher";
99
98
  too_many: "too_many";
100
99
  params_invalid: "params_invalid";
101
100
  }>;
@@ -106,6 +105,11 @@ export declare function validDesktopGillParams(params: Readonly<Record<string, s
106
105
  export declare function desktopPlacements(layout: DesktopLayout): readonly BentoPlacement[];
107
106
  export declare function compactDesktopLayout(layout: DesktopLayout): DesktopLayout;
108
107
  export declare function availableDesktopLayout(layout: DesktopLayout, catalog: readonly DesktopGill[]): DesktopLayout;
108
+ /**
109
+ * The default desktop for anyone without a saved or Team layout: one centred
110
+ * chat from the surface that holds the inbox role. Without that chat, the
111
+ * Launcher and a compact Inbox.
112
+ */
109
113
  export declare function initialDesktopLayout(catalog: readonly DesktopGill[], inboxSurfaceId: string | null): DesktopLayout;
110
114
  /** Apply one atomic operation batch without reading or writing storage. */
111
115
  export declare function applyDesktopOps(current: DesktopLayout, ops: DesktopArrange["ops"], catalog: readonly DesktopGill[], launchableAppIds: readonly string[], createId: () => string): {
@@ -78,7 +78,6 @@ export const desktopArrangeResultSchema = z.discriminatedUnion("kind", [
78
78
  "unknown_app",
79
79
  "size_not_allowed",
80
80
  "unknown_item",
81
- "last_launcher",
82
81
  "too_many",
83
82
  "conflict",
84
83
  "too_large",
@@ -125,7 +124,31 @@ export function availableDesktopLayout(layout, catalog) {
125
124
  gill.sizes.includes(item.size))),
126
125
  };
127
126
  }
127
+ /**
128
+ * The default desktop for anyone without a saved or Team layout: one centred
129
+ * chat from the surface that holds the inbox role. Without that chat, the
130
+ * Launcher and a compact Inbox.
131
+ */
128
132
  export function initialDesktopLayout(catalog, inboxSurfaceId) {
133
+ const chat = catalog.find((gill) => gill.kind === "surface" &&
134
+ gill.surfaceId === inboxSurfaceId &&
135
+ gill.gillId === "chat" &&
136
+ gill.sizes.includes("L"));
137
+ if (chat)
138
+ return {
139
+ version: 1,
140
+ items: [
141
+ {
142
+ id: "chat",
143
+ surfaceId: chat.surfaceId,
144
+ gillId: chat.gillId,
145
+ size: "L",
146
+ col: 1,
147
+ row: 0,
148
+ },
149
+ ],
150
+ launcher: { pinned: [], hidden: [] },
151
+ };
129
152
  const inbox = catalog.find((gill) => gill.kind === "app" &&
130
153
  gill.surfaceId === inboxSurfaceId &&
131
154
  (gill.sizes.includes("M") || gill.sizes.includes("L")));
@@ -213,13 +236,6 @@ export function applyDesktopOps(current, ops, catalog, launchableAppIds, createI
213
236
  if (!item)
214
237
  return { kind: "rejected", code: "unknown_item" };
215
238
  if (op.kind === "remove") {
216
- // The Launcher is the desktop's one route to every App.
217
- const isLauncher = (entry) => catalog.some((gill) => gill.kind === "launcher" &&
218
- gill.surfaceId === entry.surfaceId &&
219
- gill.gillId === entry.gillId);
220
- if (isLauncher(item) &&
221
- !layout.items.some((entry) => entry.id !== item.id && isLauncher(entry)))
222
- return { kind: "rejected", code: "last_launcher" };
223
239
  layout = compactDesktopLayout({
224
240
  ...layout,
225
241
  items: layout.items.filter((entry) => entry.id !== op.id),
@@ -184,6 +184,7 @@ function createOysterKeysPort(oysterKeysWire) {
184
184
  return {
185
185
  scope: "oyster",
186
186
  expiry: "optional",
187
+ tracksUse: true,
187
188
  options: async (apps) => {
188
189
  const targets = apps.map((app) => ({
189
190
  id: app.installationId,
package/dist/shell.css CHANGED
@@ -2,7 +2,6 @@
2
2
  @import "./spa.css";
3
3
  @import "./settings-navigation.css";
4
4
  @import "./desktop/arrange.css";
5
- @import "./desktop/welcome.css";
6
5
 
7
6
  /* SH-1: a 32px desktop menu bar on desktop widths, matching the window
8
7
  title bar and footer so the three chrome bars read as one system.
@@ -864,13 +863,11 @@
864
863
  padding: 8px;
865
864
  }
866
865
 
867
- /* A surface Gill's App fills its tile; the App scrolls itself. */
868
- .tourtois-gill-body:has(> .tourtois-gill-content > .tourtois-surface-body) {
869
- overflow: hidden;
870
- }
871
- .tourtois-gill-body:has(> .tourtois-gill-content > .tourtois-surface-body)
872
- > .tourtois-gill-content {
866
+ /* A surface Gill's App fills its card and draws its own header and scrolling. */
867
+ .tourtois-surface-card {
873
868
  height: 100%;
869
+ overflow: hidden;
870
+ padding: 0;
874
871
  }
875
872
  .tourtois-surface-body {
876
873
  position: relative;
@@ -1016,6 +1013,38 @@
1016
1013
  }
1017
1014
 
1018
1015
  /* Keep the launcher keys' existing material at a compact widget scale. */
1016
+ /* The install guide is a quiet footer row under the grid, not an App tile. */
1017
+ .tourtois-launcher-more {
1018
+ display: flex;
1019
+ justify-content: flex-end;
1020
+ /* Keep the keyboard outline inside the Gill body's scroll boundary: the
1021
+ button below pulls 0.75rem outward, so reserve that plus the outline. */
1022
+ padding: var(--spacing-sm);
1023
+ padding-inline-end: calc(0.75rem + var(--spacing-sm));
1024
+ margin-block-start: var(--spacing-sm);
1025
+ }
1026
+ /* The ghost button's text, not its padding, lines up with Edit launcher. */
1027
+ .tourtois-launcher-more > .btn {
1028
+ margin-inline-end: -0.75rem;
1029
+ }
1030
+
1031
+ /* Trial starter Apps that failed or need a runtime stack under the grid. */
1032
+ .tourtois-install-notes {
1033
+ display: grid;
1034
+ gap: var(--spacing-sm);
1035
+ margin-block-start: var(--spacing-md);
1036
+ }
1037
+ .tourtois-install-notes:empty {
1038
+ display: none;
1039
+ }
1040
+ /* One-line failures centre the Retry button on the text. */
1041
+ .tourtois-install-notes .caps-failure-line {
1042
+ align-items: center;
1043
+ }
1044
+ .tourtois-install-notes .caps-failure-line > .caps-status {
1045
+ margin-block-start: 0;
1046
+ }
1047
+
1019
1048
  .tourtois-launcher-grid[data-size="lg"] {
1020
1049
  grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
1021
1050
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/tourtois",
3
- "version": "0.24.1",
3
+ "version": "0.26.0",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Tourtois: the trusted desktop shell for Oyster and Fungi, with host-supplied Settings sections",
6
6
  "type": "module",
@@ -79,9 +79,9 @@
79
79
  "@fungi.computer/ear-tag": "0.1.0",
80
80
  "@fungi.computer/gills": "0.4.0",
81
81
  "@fungi.computer/maosaico": "0.1.2",
82
- "@fungi.computer/parakeet": "0.13.3",
82
+ "@fungi.computer/parakeet": "0.14.1",
83
83
  "@fungi.computer/puffball": "0.12.0",
84
- "@fungi.computer/shiitake": "0.20.4",
84
+ "@fungi.computer/shiitake": "0.21.1",
85
85
  "@fungi.computer/sigils": "0.3.2",
86
86
  "@fungi.computer/sprite": "0.2.2",
87
87
  "@fungi.computer/sprite-zdog": "0.3.2",
@@ -102,10 +102,10 @@
102
102
  "react": "^18.3.1 || ^19.2.0"
103
103
  },
104
104
  "devDependencies": {
105
- "@fungi.computer/oyster": "0.38.1",
105
+ "@fungi.computer/oyster": "0.40.0",
106
106
  "@cloudflare/workers-types": "5.20260828.1",
107
107
  "@fungi.computer/forage": "0.3.13",
108
- "@fungi.computer/mycelium": "0.4.6",
108
+ "@fungi.computer/mycelium": "0.4.7",
109
109
  "@ladle/react": "5.1.1",
110
110
  "@types/react": "18.3.3",
111
111
  "@vitejs/plugin-react": "6.1.1",
@@ -243,14 +243,14 @@
243
243
  "clean": "node --input-type=module --eval \"import { rm } from 'node:fs/promises'; await rm('dist', { recursive: true, force: true });\"",
244
244
  "lint": "eslint src backend test workbench .ladle --max-warnings=0 && oxlint --config ../../oxlint.config.ts --deny-warnings src backend test workbench .ladle",
245
245
  "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.workbench.json && tsc -p backend/tsconfig.json && tsc -p test/workerd/tsconfig.json",
246
- "build": "pnpm run clean && tsc -p tsconfig.build.json && cp src/shell.css src/chrome.css src/spa.css src/settings-navigation.css dist/ && mkdir -p dist/desktop && cp src/desktop/arrange.css src/desktop/welcome.css dist/desktop/",
246
+ "build": "pnpm run clean && tsc -p tsconfig.build.json && cp src/shell.css src/chrome.css src/spa.css src/settings-navigation.css dist/ && mkdir -p dist/desktop && cp src/desktop/arrange.css dist/desktop/",
247
247
  "build:spa": "vite build",
248
248
  "dev": "vite",
249
249
  "workbench": "ladle serve --host 127.0.0.1 --port 61001",
250
250
  "workbench:build": "ladle build --outDir ../../.botanical/tourtois-ladle",
251
251
  "test:overlay-layering": "node test/overlay-layering.browser.mjs",
252
252
  "test:window-new-version": "node test/window-new-version.browser.mjs",
253
- "test:workbench": "node test/workbench.browser.mjs && node test/desktop-gills.browser.mjs && node test/app-directory-isolation.browser.mjs && node test/workflows-launcher-icon.browser.mjs && node test/landing-bugs.browser.mjs && node test/show-desktop.browser.mjs && node test/window-stack.browser.mjs && node test/window-chrome-back.browser.mjs && node test/tile-backdrop.browser.mjs && node test/app-bar-menu.browser.mjs && node test/launcher-gill.browser.mjs && node test/desktop-storage.browser.mjs && node test/desktop-method-editing.browser.mjs && node test/arrange-layout-shift.browser.mjs && node test/surface-gill.browser.mjs && node test/phone-layout.browser.mjs && node test/phone-app-switcher.browser.mjs && node test/computer-choice.browser.mjs && node test/window-resize.browser.mjs && node test/window-session.browser.mjs",
253
+ "test:workbench": "node test/workbench.browser.mjs && node test/desktop-gills.browser.mjs && node test/app-directory-isolation.browser.mjs && node test/workflows-launcher-icon.browser.mjs && node test/landing-bugs.browser.mjs && node test/show-desktop.browser.mjs && node test/window-stack.browser.mjs && node test/window-chrome-back.browser.mjs && node test/tile-backdrop.browser.mjs && node test/app-bar-menu.browser.mjs && node test/launcher-gill.browser.mjs && node test/desktop-storage.browser.mjs && node test/desktop-method-editing.browser.mjs && node test/arrange-layout-shift.browser.mjs && node test/surface-gill.browser.mjs && node test/fresh-dashboard.browser.mjs && node test/phone-layout.browser.mjs && node test/phone-app-switcher.browser.mjs && node test/computer-choice.browser.mjs && node test/window-resize.browser.mjs && node test/window-session.browser.mjs",
254
254
  "test": "pnpm run test:unit && pnpm run test:merge",
255
255
  "test:settings-icons": "node --import tsx ../../tooling/repository/scripts/workbench-proofs.mjs --output ../../.botanical/tourtois-ladle --origin-env TOURTOIS_WORKBENCH_URL test/settings-icons.browser.mjs",
256
256
  "format:check": "node ../../tooling/repository/scripts/format-package-check.mjs",
@@ -1,129 +0,0 @@
1
- /* The first-run welcome shares the Launcher surface. */
2
- .tourtois-welcome {
3
- display: flex;
4
- align-items: center;
5
- gap: var(--spacing-lg);
6
- padding: var(--spacing-sm) 0;
7
- margin-block-end: var(--spacing-md);
8
- /* Align the invitation with the App tiles inside the Launcher. */
9
- margin-inline: calc(var(--spacing-sm) + 1px);
10
- }
11
- .tourtois-welcome-mascot {
12
- display: block;
13
- flex: none;
14
- inline-size: 3rem;
15
- block-size: 3rem;
16
- }
17
- .tourtois-welcome-text {
18
- flex: 1;
19
- min-inline-size: 0;
20
- }
21
- .tourtois-welcome-text h3 {
22
- margin: 0;
23
- font-size: var(--text-base);
24
- font-weight: 600;
25
- line-height: 1.3;
26
- }
27
- .tourtois-welcome-text p {
28
- margin: 0;
29
- color: var(--stipe-fg-muted);
30
- font-size: var(--text-sm);
31
- line-height: 1.5;
32
- }
33
- .tourtois-welcome-text .tourtois-welcome-hint {
34
- margin-block-start: var(--spacing-2xs);
35
- font-size: var(--text-xs);
36
- }
37
- .tourtois-welcome-actions {
38
- display: flex;
39
- flex: none;
40
- align-items: center;
41
- gap: var(--spacing-sm);
42
- }
43
- @media (hover: none) and (pointer: coarse) {
44
- .tourtois-welcome-hint {
45
- display: none;
46
- }
47
- }
48
- @media (max-width: 640px) {
49
- .tourtois-welcome {
50
- flex-wrap: wrap;
51
- gap: var(--spacing-sm) var(--spacing-md);
52
- padding-block: 0;
53
- margin-block-end: var(--spacing-sm);
54
- }
55
- .tourtois-welcome-mascot {
56
- inline-size: 2.5rem;
57
- block-size: 2.5rem;
58
- }
59
- .tourtois-welcome-text {
60
- flex-basis: calc(100% - 4rem);
61
- }
62
- /* The keyboard shortcut means nothing on a phone; the App grid is the way in. */
63
- .tourtois-welcome-hint {
64
- display: none;
65
- }
66
- .tourtois-welcome-actions {
67
- flex: 1 1 100%;
68
- }
69
- .tourtois-welcome-actions > * {
70
- flex: 1;
71
- }
72
- }
73
-
74
- /* The install guide is a quiet footer row under the grid, not an App tile. */
75
- .tourtois-launcher-more {
76
- display: flex;
77
- justify-content: flex-end;
78
- /* Keep the keyboard outline inside the Gill body's scroll boundary: the
79
- button below pulls 0.75rem outward, so reserve that plus the outline. */
80
- padding: var(--spacing-sm);
81
- padding-inline-end: calc(0.75rem + var(--spacing-sm));
82
- margin-block-start: var(--spacing-sm);
83
- }
84
- /* The ghost button's text, not its padding, lines up with Edit launcher. */
85
- .tourtois-launcher-more > .btn {
86
- margin-inline-end: -0.75rem;
87
- }
88
-
89
- /* Trial starter Apps that failed or need a runtime stack under the grid. */
90
- .tourtois-install-notes {
91
- display: grid;
92
- gap: var(--spacing-sm);
93
- margin-block-start: var(--spacing-md);
94
- }
95
- .tourtois-install-notes:empty {
96
- display: none;
97
- }
98
- /* One-line failures centre the Retry button on the text. */
99
- .tourtois-install-notes .caps-failure-line {
100
- align-items: center;
101
- }
102
- .tourtois-install-notes .caps-failure-line > .caps-status {
103
- margin-block-start: 0;
104
- }
105
-
106
- /* On a wide desktop the welcome is the Launcher's hero, not a thin banner. */
107
- @media (min-width: 1100px) {
108
- .tourtois-welcome {
109
- flex-direction: column;
110
- gap: var(--spacing-md);
111
- padding-block: var(--spacing-lg);
112
- margin-block-end: var(--spacing-lg);
113
- text-align: center;
114
- }
115
- .tourtois-welcome-mascot {
116
- inline-size: 5rem;
117
- block-size: 5rem;
118
- }
119
- .tourtois-welcome-text h3 {
120
- font-size: var(--text-xl);
121
- }
122
- .tourtois-welcome-text p {
123
- font-size: var(--text-base);
124
- }
125
- .tourtois-welcome-text .tourtois-welcome-hint {
126
- margin-block-start: var(--spacing-sm);
127
- font-size: var(--text-sm);
128
- }
129
- }
@@ -1,20 +0,0 @@
1
- import { type ReactNode } from "react";
2
- import type { AppStorage } from "@fungi.computer/agar/storage";
3
- import type { AppBarItem } from "@fungi.computer/caps/blocks/app-bar";
4
- export type WelcomeState = Readonly<{
5
- /** True only once storage has answered that this member has not dismissed it. */
6
- visible: boolean;
7
- dismiss: () => void;
8
- }>;
9
- /** The per-member first-run welcome, remembered in the member's own storage layer. */
10
- export declare function WelcomeProvider({ teamId, storage, children, }: {
11
- teamId: string;
12
- storage: AppStorage;
13
- children: ReactNode;
14
- }): import("react/jsx-runtime").JSX.Element;
15
- export declare const useWelcome: () => WelcomeState;
16
- /** Says what this place is and points at the one thing to do next. */
17
- export declare function FirstRunWelcome({ items, onDismiss, }: {
18
- items: readonly AppBarItem[];
19
- onDismiss: () => void;
20
- }): import("react/jsx-runtime").JSX.Element | null;
@@ -1,59 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { createContext, useCallback, useContext, useMemo, } from "react";
3
- import { useQuery, useQueryClient } from "@tanstack/react-query";
4
- import { z } from "zod";
5
- import { Button } from "@fungi.computer/caps/components/button";
6
- import { Keycap } from "@fungi.computer/caps/components/keycap";
7
- import { starterItem } from "./starter-item.js";
8
- import { ShiitakeAvatar } from "@fungi.computer/parakeet/agent-head";
9
- const welcomeKey = "welcome";
10
- const dismissedSchema = z.object({ dismissed: z.literal(true) });
11
- const hidden = { visible: false, dismiss: () => undefined };
12
- const WelcomeContext = createContext(hidden);
13
- /** The per-member first-run welcome, remembered in the member's own storage layer. */
14
- export function WelcomeProvider({ teamId, storage, children, }) {
15
- const client = useQueryClient();
16
- const queryKey = useMemo(() => ["tourtois", "welcome", teamId], [teamId]);
17
- const { data } = useQuery({
18
- queryKey,
19
- queryFn: async () => {
20
- const resolved = await storage.read(welcomeKey);
21
- return {
22
- revision: resolved.member?.revision ?? null,
23
- dismissed: dismissedSchema.safeParse(resolved.member?.value).success,
24
- };
25
- },
26
- });
27
- const dismiss = useCallback(() => {
28
- client.setQueryData(queryKey, {
29
- revision: data?.revision ?? null,
30
- dismissed: true,
31
- });
32
- void storage
33
- .write({
34
- key: welcomeKey,
35
- scope: "member",
36
- basedOn: data?.revision ?? null,
37
- value: { dismissed: true },
38
- })
39
- .catch((cause) => {
40
- console.error("Welcome dismissal was not saved", cause);
41
- });
42
- }, [client, data?.revision, queryKey, storage]);
43
- const value = useMemo(() => ({ visible: data !== undefined && !data.dismissed, dismiss }), [data, dismiss]);
44
- return (_jsx(WelcomeContext.Provider, { value: value, children: children }));
45
- }
46
- export const useWelcome = () => useContext(WelcomeContext);
47
- const isMac = () => /Mac|iPhone|iPad/u.test(navigator.userAgent);
48
- /** Says what this place is and points at the one thing to do next. */
49
- export function FirstRunWelcome({ items, onDismiss, }) {
50
- const hello = starterItem(items, "hello");
51
- // Grove is the first thing to try; until it is installed, Hello is. Never
52
- // whichever App sorts first among the rest.
53
- const lead = starterItem(items, "grove") ?? hello;
54
- if (!lead)
55
- return null;
56
- return (_jsxs("section", { className: "tourtois-welcome", "aria-labelledby": "tourtois-welcome-title", children: [_jsx("span", { className: "tourtois-welcome-mascot", "aria-hidden": "true", children: _jsx(ShiitakeAvatar, { className: "h-full w-full", state: { activity: "idle", expression: "normal" } }) }), _jsxs("div", { className: "tourtois-welcome-text", children: [_jsx("h3", { id: "tourtois-welcome-title", children: "This is your Oyster" }), _jsx("p", { children: "Open an App to chat with AI helpers, write, or make something." }), _jsxs("p", { className: "tourtois-welcome-hint", children: [_jsx(Keycap, { size: "hint", children: isMac() ? "⌘" : "Ctrl" }), " ", _jsx(Keycap, { size: "hint", children: "K" }), " then ", _jsx(Keycap, { size: "hint", children: "O" }), " ", "opens any App"] })] }), _jsxs("div", { className: "tourtois-welcome-actions", children: [_jsxs(Button, { size: "sm", variant: "primary", onClick: () => {
57
- lead.onSelect();
58
- }, children: ["Open ", lead.label] }), _jsx(Button, { size: "sm", variant: "ghost", onClick: onDismiss, children: "Not now" })] })] }));
59
- }