@fungi.computer/tourtois 0.20.12 → 0.20.14

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/AppPane.js CHANGED
@@ -88,7 +88,7 @@ function WindowFailure({ projection, onReopen, }) {
88
88
  const lost = projection.error instanceof AppError &&
89
89
  projection.error.code === "DISCONNECTED";
90
90
  const described = describeAppError(projection.error);
91
- return (_jsx(ResultState, { className: "tourtois-window-failure", tone: "failed", headingLevel: 3, title: lost ? "This App lost its connection" : described.title, description: _jsxs(_Fragment, { children: [lost ? `${appTitle} stopped answering.` : described.message, _jsx("span", { className: "tourtois-window-failure-note", children: "A request may have finished even if its reply did not arrive, so check before repeating it." })] }), actions: _jsxs(_Fragment, { children: [_jsxs(Button, { type: "button", variant: "primary", onClick: onReopen, children: ["Reopen ", appTitle] }), _jsx(Button, { type: "button", variant: "outline", onClick: () => {
91
+ return (_jsx(ResultState, { className: "tourtois-window-failure", role: "alert", tone: "failed", headingLevel: 3, title: lost ? "This App lost its connection" : described.title, description: _jsxs(_Fragment, { children: [lost ? `${appTitle} stopped answering.` : described.message, _jsx("span", { className: "tourtois-window-failure-note", children: "A request may have finished even if its reply did not arrive, so check before repeating it." })] }), actions: _jsxs(_Fragment, { children: [_jsxs(Button, { type: "button", variant: "primary", onClick: onReopen, children: ["Reopen ", appTitle] }), _jsx(Button, { type: "button", variant: "outline", onClick: () => {
92
92
  window.location.reload();
93
93
  }, children: "Reload workspace" })] }) }));
94
94
  }
@@ -90,7 +90,6 @@ function ArrangedDesktop({ owner, ...props }) {
90
90
  const visibleItems = availableDesktopLayout(snapshot.layout, catalog).items;
91
91
  const { editing, onEditingChange } = props;
92
92
  const [configuration, setConfiguration] = useState(null);
93
- const [error, setError] = useState(null);
94
93
  const [saving, setSaving] = useState(false);
95
94
  const [saved, setSaved] = useState(false);
96
95
  const stage = useRef(null);
@@ -132,6 +131,11 @@ function ArrangedDesktop({ owner, ...props }) {
132
131
  : cell;
133
132
  });
134
133
  const placements = arrangeBento(projected, columns);
134
+ // Each failure is reported once, as a toast; nothing renders above the stage.
135
+ const reportFailure = (message) => {
136
+ setSaved(false);
137
+ toast.error(message, { toasterId: WORKBENCH_NOTICES });
138
+ };
135
139
  const save = async (method, input, scope = "member") => {
136
140
  setSaving(true);
137
141
  try {
@@ -142,14 +146,16 @@ function ArrangedDesktop({ owner, ...props }) {
142
146
  });
143
147
  if (result.kind !== "accepted")
144
148
  console.error("Desktop change refused", result.code);
145
- setError(result.kind === "accepted" ? null : refusalMessage(result.code));
146
- if (result.kind === "accepted")
149
+ if (result.kind === "accepted") {
147
150
  setSaved(true);
148
- return result.kind === "accepted";
151
+ return true;
152
+ }
153
+ reportFailure(refusalMessage(result.code));
154
+ return false;
149
155
  }
150
156
  catch (cause) {
151
157
  console.error("Desktop arrangement update failed", cause);
152
- setError("Your desktop change could not be confirmed.");
158
+ reportFailure("Your desktop change could not be confirmed.");
153
159
  return false;
154
160
  }
155
161
  finally {
@@ -267,7 +273,7 @@ function ArrangedDesktop({ owner, ...props }) {
267
273
  onEditingChange(false);
268
274
  };
269
275
  const longPress = useRef(undefined);
270
- return (_jsxs(_Fragment, { children: [snapshot.refreshFailure ? (_jsx(Alert, { tone: "warning", description: snapshot.refreshFailure.message })) : null, editing ? (_jsx(ArrangeToolbar, { phone: props.phone, status: saving ? "saving" : saved ? "saved" : "idle", error: error, canWriteTeam: snapshot.canWriteTeam, choices: choices, saving: saving, onChoose: addWidget, onReset: async () => {
276
+ return (_jsxs(_Fragment, { children: [snapshot.refreshFailure ? (_jsx(Alert, { tone: "warning", description: snapshot.refreshFailure.message })) : null, editing ? (_jsx(ArrangeToolbar, { phone: props.phone, status: saving ? "saving" : saved ? "saved" : "idle", canWriteTeam: snapshot.canWriteTeam, choices: choices, saving: saving, onChoose: addWidget, onReset: async () => {
271
277
  if (!(await save("layout.reset", {})))
272
278
  throw new Error("The layout was not reset");
273
279
  }, onSaveTeam: () => {
@@ -306,7 +312,7 @@ function ArrangedDesktop({ owner, ...props }) {
306
312
  });
307
313
  else
308
314
  void save("layout.reset", {});
309
- }, children: "Restore Launcher" }) }) })) : null, error && !editing ? _jsx(Alert, { tone: "error", description: error }) : 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) => {
315
+ }, 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) => {
310
316
  const frame = binding.frames.get(item.id);
311
317
  const gill = catalog.find((gill) => gill.surfaceId === item.surfaceId && gill.gillId === item.gillId);
312
318
  if (!frame || !gill)
@@ -5,10 +5,9 @@ export type ArrangeStatus = "idle" | "saving" | "saved";
5
5
  * Arrange's floating controls. They live in the chrome layer, take no flow
6
6
  * space, and stay above every window.
7
7
  */
8
- export declare function ArrangeToolbar({ phone, status, error, canWriteTeam, choices, saving, onChoose, onReset, onSaveTeam, onDone, }: {
8
+ export declare function ArrangeToolbar({ phone, status, canWriteTeam, choices, saving, onChoose, onReset, onSaveTeam, onDone, }: {
9
9
  phone: boolean;
10
10
  status: ArrangeStatus;
11
- error: string | null;
12
11
  canWriteTeam: boolean;
13
12
  choices: readonly WidgetChoice[];
14
13
  saving: boolean;
@@ -25,7 +25,7 @@ function restoreFocus(origin) {
25
25
  * Arrange's floating controls. They live in the chrome layer, take no flow
26
26
  * space, and stay above every window.
27
27
  */
28
- export function ArrangeToolbar({ phone, status, error, canWriteTeam, choices, saving, onChoose, onReset, onSaveTeam, onDone, }) {
28
+ export function ArrangeToolbar({ phone, status, canWriteTeam, choices, saving, onChoose, onReset, onSaveTeam, onDone, }) {
29
29
  const chrome = useLayer("chrome");
30
30
  const [pickerOpen, setPickerOpen] = useState(false);
31
31
  const [resetOpen, setResetOpen] = useState(false);
@@ -56,7 +56,7 @@ export function ArrangeToolbar({ phone, status, error, canWriteTeam, choices, sa
56
56
  setPickerOpen(!pickerOpen);
57
57
  }, children: [_jsx(Plus, { "aria-hidden": "true", size: 16 }), phone ? "Add" : "Add widget"] })] }), _jsxs(DropdownMenu, { modal: false, children: [_jsx(DropdownMenuTrigger, { render: _jsx(IconButton, { size: "sm", variant: "ghost", icon: _jsx(MoreHorizontal, {}), "aria-label": "More layout actions", title: "More layout actions" }) }), _jsxs(DropdownMenuContent, { container: chrome, align: "end", side: "top", children: [_jsx(DropdownMenuItem, { onSelect: () => {
58
58
  setResetOpen(true);
59
- }, children: "Reset layout\u2026" }), canWriteTeam ? (_jsx(DropdownMenuItem, { onSelect: onSaveTeam, children: "Save as Team default" })) : null] })] }), _jsx("span", { className: "tourtois-arrange-state", role: "status", "data-empty": error || status !== "idle" ? undefined : "", children: error ? (_jsx(Status, { glyph: "cross", tone: "error", label: error })) : status === "saving" ? (_jsx(Status, { glyph: "arc", tone: "info", label: "Saving\u2026" })) : status === "saved" ? (_jsx(Status, { glyph: "check", tone: "success", label: "Saved" })) : null }), _jsx(Button, { size: "sm", variant: "primary", "aria-label": "Done arranging", onClick: onDone, children: "Done" }), _jsx(Dialog, { open: resetOpen, onOpenChange: setResetOpen, children: _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Reset layout" }), _jsx(DialogDescription, { children: "Your widgets go back to the default desktop." })] }), _jsx(ConfirmAction, { mode: "hold", label: "Reset layout", confirmLabel: "Hold to reset the layout", onConfirm: async () => {
59
+ }, children: "Reset layout\u2026" }), canWriteTeam ? (_jsx(DropdownMenuItem, { onSelect: onSaveTeam, children: "Save as Team default" })) : null] })] }), _jsx("span", { className: "tourtois-arrange-state", role: "status", "data-empty": status !== "idle" ? undefined : "", children: status === "saving" ? (_jsx(Status, { glyph: "arc", tone: "info", label: "Saving\u2026" })) : status === "saved" ? (_jsx(Status, { glyph: "check", tone: "success", label: "Saved" })) : null }), _jsx(Button, { size: "sm", variant: "primary", "aria-label": "Done arranging", onClick: onDone, children: "Done" }), _jsx(Dialog, { open: resetOpen, onOpenChange: setResetOpen, children: _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Reset layout" }), _jsx(DialogDescription, { children: "Your widgets go back to the default desktop." })] }), _jsx(ConfirmAction, { mode: "hold", label: "Reset layout", confirmLabel: "Hold to reset the layout", onConfirm: async () => {
60
60
  await onReset();
61
61
  setResetOpen(false);
62
62
  } })] }) })] }), chrome);
@@ -1,6 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { SectionHeading } from "@fungi.computer/caps/blocks/section-heading";
3
3
  import { memberAvatarSchema, defaultMemberAvatar, } from "@fungi.computer/sprite-zdog/avatar";
4
+ import { toast } from "@fungi.computer/caps/components/toaster";
5
+ import { WORKBENCH_NOTICES } from "./app-toast.js";
4
6
  import { AvatarPreview } from "./AvatarPreview.js";
5
7
  import { AvatarPicker } from "./AvatarPicker.js";
6
8
  import { skipToken, useMutation, useQuery, useQueryClient, } from "@tanstack/react-query";
@@ -60,6 +62,9 @@ function useSaveMemberAvatar(save) {
60
62
  },
61
63
  mutationFn: save,
62
64
  onError: (_cause, _next, snapshot) => {
65
+ toast.error("Your avatar could not be saved. Try again.", {
66
+ toasterId: WORKBENCH_NOTICES,
67
+ });
63
68
  if (snapshot &&
64
69
  client.getQueryData(accountAvatarQuery) === snapshot.optimistic) {
65
70
  client.setQueryData(accountAvatarQuery, snapshot.previous ?? null);
@@ -82,7 +87,7 @@ export function OwnSprite(props) {
82
87
  export function AvatarSettings({ save: write }) {
83
88
  const saved = useMemberAvatar();
84
89
  const save = useSaveMemberAvatar(write);
85
- return (_jsxs("section", { className: "tourtois-avatar-settings", "aria-labelledby": "tourtois-avatar-heading", children: [_jsx(SectionHeading, { id: "tourtois-avatar-heading", children: "Avatar" }), _jsx("p", { className: "tourtois-settings-lede", children: "Choose your character, colours and drawing style. Changes save automatically." }), save.isError ? (_jsx("p", { role: "alert", children: "Your account did not save this avatar. Your previous avatar was restored. Choose it again to retry." })) : null, _jsx(AvatarPicker, { value: saved, disabled: save.isPending, onChange: (next) => {
90
+ return (_jsxs("section", { className: "tourtois-avatar-settings", "aria-labelledby": "tourtois-avatar-heading", children: [_jsx(SectionHeading, { id: "tourtois-avatar-heading", children: "Avatar" }), _jsx("p", { className: "tourtois-settings-lede", children: "Choose your character, colours and drawing style. Changes save automatically." }), _jsx(AvatarPicker, { value: saved, disabled: save.isPending, onChange: (next) => {
86
91
  save.mutate(next);
87
92
  } })] }));
88
93
  }
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  // Standalone Oyster Settings chrome, loaded from the chosen shell Release.
3
3
  // App Permissions frame Oyster's own grants page, never its implementation.
4
4
  // Connections, Keys and Computers retain their existing host-backed ports.
@@ -8,6 +8,7 @@ import "./shell.css";
8
8
  import { AppError } from "@fungi.computer/agar";
9
9
  import { createQueryClient } from "@fungi.computer/agar/query";
10
10
  import { workbenchDirectorySchema } from "@fungi.computer/nacre/workbench-directory";
11
+ import { toast } from "@fungi.computer/caps/components/toaster";
11
12
  import { QueryClientProvider } from "@tanstack/react-query";
12
13
  import * as S from "effect/Schema";
13
14
  import { z } from "zod";
@@ -16,6 +17,7 @@ import { createRoot } from "react-dom/client";
16
17
  import { connectionAddedSchema, connectionsViewSchema, connectionToolsSchema, createPlatformControls, PlatformControlsView, } from "./platform-controls.js";
17
18
  import { createOysterSetupPort, oysterSetupSchema } from "./oyster-setup.js";
18
19
  import { modelKeysViewSchema } from "./ModelKeys.js";
20
+ import { WORKBENCH_NOTICES } from "./app-toast.js";
19
21
  import { settingsLocationSchema } from "./settings-routes.js";
20
22
  import { OysterComputers, createOysterComputersPort, } from "./OysterComputers.js";
21
23
  import { DiscordChannels, createOysterDiscordChannelsPort, } from "./DiscordChannels.js";
@@ -217,7 +219,6 @@ function OysterPermissionsFrame({ installationId, onAccepted, }) {
217
219
  const sizeObserver = useRef(null);
218
220
  const [height, setHeight] = useState(0);
219
221
  const leave = useRef("clean");
220
- const [refreshFailed, setRefreshFailed] = useState(false);
221
222
  useSettingsLeaveGuard(() => leave.current);
222
223
  useEffect(() => () => {
223
224
  sizeObserver.current?.disconnect();
@@ -234,10 +235,11 @@ function OysterPermissionsFrame({ installationId, onAccepted, }) {
234
235
  return;
235
236
  leave.current = parsed.data.state;
236
237
  if (parsed.data.event === "accepted") {
237
- setRefreshFailed(false);
238
238
  void onAccepted().catch((cause) => {
239
239
  console.error("App permissions Settings refresh failed", cause);
240
- setRefreshFailed(true);
240
+ toast.error("Settings could not be refreshed. Reopen Settings to try again.", {
241
+ toasterId: WORKBENCH_NOTICES,
242
+ });
241
243
  });
242
244
  }
243
245
  };
@@ -246,20 +248,20 @@ function OysterPermissionsFrame({ installationId, onAccepted, }) {
246
248
  window.removeEventListener("message", receive);
247
249
  };
248
250
  }, [onAccepted]);
249
- return (_jsxs(_Fragment, { children: [refreshFailed ? (_jsx("p", { role: "alert", children: "Permissions saved. Settings could not refresh. Close and reopen Settings to retry." })) : null, _jsx("iframe", { ref: frame, title: "App permissions", src: `/api/installations/${encodeURIComponent(installationId)}/grants`, className: "w-full shrink-0 border-0", style: { height }, onLoad: () => {
250
- sizeObserver.current?.disconnect();
251
- const body = frame.current?.contentDocument?.body;
252
- if (!body)
253
- return;
254
- // The same-origin host page owns its markup. Observe its body rather
255
- // than its editor internals; Settings remains the only scroll owner.
256
- const resize = () => {
257
- setHeight(Math.ceil(body.getBoundingClientRect().height));
258
- };
259
- sizeObserver.current = new ResizeObserver(resize);
260
- sizeObserver.current.observe(body);
261
- resize();
262
- } })] }));
251
+ return (_jsx(_Fragment, { children: _jsx("iframe", { ref: frame, title: "App permissions", src: `/api/installations/${encodeURIComponent(installationId)}/grants`, className: "w-full shrink-0 border-0", style: { height }, onLoad: () => {
252
+ sizeObserver.current?.disconnect();
253
+ const body = frame.current?.contentDocument?.body;
254
+ if (!body)
255
+ return;
256
+ // The same-origin host page owns its markup. Observe its body rather
257
+ // than its editor internals; Settings remains the only scroll owner.
258
+ const resize = () => {
259
+ setHeight(Math.ceil(body.getBoundingClientRect().height));
260
+ };
261
+ sizeObserver.current = new ResizeObserver(resize);
262
+ sizeObserver.current.observe(body);
263
+ resize();
264
+ } }) }));
263
265
  }
264
266
  function OysterAppPermissions({ selectedKey, onAccepted, }) {
265
267
  if (!selectedKey?.startsWith("installation:"))
@@ -21,7 +21,8 @@ function shellOverlays() {
21
21
  const find = (name) => document.querySelector(`[data-maosaico-layer="${name}"]`) ??
22
22
  document.body;
23
23
  return {
24
- popover: find("popover"),
24
+ // Settings are dialogs: their menus and pickers must paint above them.
25
+ popover: find("dialog"),
25
26
  dialog: find("dialog"),
26
27
  toast: find("toast"),
27
28
  tooltip: find("tooltip"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/tourtois",
3
- "version": "0.20.12",
3
+ "version": "0.20.14",
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",
@@ -83,7 +83,7 @@
83
83
  "@fungi.computer/ear-tag": "0.1.0",
84
84
  "@fungi.computer/gills": "0.3.0",
85
85
  "@fungi.computer/maosaico": "0.1.2",
86
- "@fungi.computer/parakeet": "0.11.38",
86
+ "@fungi.computer/parakeet": "0.12.0",
87
87
  "@fungi.computer/puffball": "0.9.0",
88
88
  "@fungi.computer/shiitake": "0.18.2",
89
89
  "@fungi.computer/sigils": "0.3.2",
@@ -106,7 +106,7 @@
106
106
  "react": "^18.3.1 || ^19.2.0"
107
107
  },
108
108
  "devDependencies": {
109
- "@fungi.computer/oyster": "0.31.1",
109
+ "@fungi.computer/oyster": "0.32.0",
110
110
  "@cloudflare/workers-types": "5.20260828.1",
111
111
  "@fungi.computer/forage": "0.3.9",
112
112
  "@fungi.computer/mycelium": "0.4.0",