@peers-app/peers-ui 0.32.3 → 0.33.1

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.
Files changed (83) hide show
  1. package/dist/command-palette/command-palette-ui.d.ts +1 -1
  2. package/dist/command-palette/command-palette-ui.js +10 -74
  3. package/dist/command-palette/command-palette.js +4 -4
  4. package/dist/components/markdown-editor/mention-node.js +16 -12
  5. package/dist/components/markdown-editor/mentions-plugin.js +2 -5
  6. package/dist/components/markdown-with-mentions.js +10 -5
  7. package/dist/components/router.js +1 -41
  8. package/dist/globals.d.ts +2 -6
  9. package/dist/globals.js +0 -35
  10. package/dist/mention-configs.d.ts +1 -5
  11. package/dist/mention-configs.js +4 -54
  12. package/dist/notifications/group-names.d.ts +2 -0
  13. package/dist/notifications/group-names.js +23 -0
  14. package/dist/notifications/notification-bell.d.ts +5 -3
  15. package/dist/notifications/notification-bell.js +23 -49
  16. package/dist/notifications/notifications-client.d.ts +12 -1
  17. package/dist/notifications/notifications-client.js +20 -7
  18. package/dist/notifications/notifications-panel.d.ts +41 -0
  19. package/dist/notifications/notifications-panel.js +108 -0
  20. package/dist/notifications/notifications-screen.js +14 -4
  21. package/dist/screens/account/account-screen.js +1 -1
  22. package/dist/screens/network-viewer/connection-troubleshooter.js +8 -9
  23. package/dist/screens/packages/package-details.js +1 -1
  24. package/dist/screens/search/global-search.js +2 -4
  25. package/dist/screens/tools/tool-catalog-ipc.d.ts +6 -6
  26. package/dist/screens/tools/tool-catalog-ipc.js +4 -5
  27. package/dist/screens/tools/tool-info.js +2 -2
  28. package/dist/screens/tools/tool-schema.d.ts +1 -1
  29. package/dist/screens/tools/tool-schema.js +2 -2
  30. package/dist/system-apps/index.d.ts +0 -3
  31. package/dist/system-apps/index.js +1 -13
  32. package/dist/tabs-layout/network-status-indicator.d.ts +8 -2
  33. package/dist/tabs-layout/network-status-indicator.js +8 -3
  34. package/dist/tabs-layout/tabs-layout.js +21 -4
  35. package/dist/tabs-layout/tabs-state.d.ts +1 -0
  36. package/dist/tabs-layout/tabs-state.js +9 -2
  37. package/dist/utils.d.ts +0 -2
  38. package/dist/utils.js +0 -9
  39. package/package.json +3 -3
  40. package/dist/components/access-level-field.d.ts +0 -10
  41. package/dist/components/access-level-field.js +0 -28
  42. package/dist/components/message-logs/message-logs.d.ts +0 -6
  43. package/dist/components/message-logs/message-logs.js +0 -324
  44. package/dist/components/message-logs/tool-access-approval-card.d.ts +0 -13
  45. package/dist/components/message-logs/tool-access-approval-card.js +0 -82
  46. package/dist/components/messages/avatar.d.ts +0 -9
  47. package/dist/components/messages/avatar.js +0 -101
  48. package/dist/components/messages/channel-message-list.d.ts +0 -13
  49. package/dist/components/messages/channel-message-list.js +0 -158
  50. package/dist/components/messages/channel-view.d.ts +0 -5
  51. package/dist/components/messages/channel-view.js +0 -62
  52. package/dist/components/messages/message-compose.d.ts +0 -11
  53. package/dist/components/messages/message-compose.js +0 -152
  54. package/dist/components/messages/message-display.d.ts +0 -9
  55. package/dist/components/messages/message-display.js +0 -99
  56. package/dist/components/messages/thread-message-list.d.ts +0 -10
  57. package/dist/components/messages/thread-message-list.js +0 -122
  58. package/dist/screens/assistants/assistant-config.d.ts +0 -5
  59. package/dist/screens/assistants/assistant-config.js +0 -56
  60. package/dist/screens/assistants/assistant-details.d.ts +0 -3
  61. package/dist/screens/assistants/assistant-details.js +0 -41
  62. package/dist/screens/assistants/assistant-info.d.ts +0 -11
  63. package/dist/screens/assistants/assistant-info.js +0 -13
  64. package/dist/screens/assistants/assistant-list.d.ts +0 -2
  65. package/dist/screens/assistants/assistant-list.js +0 -80
  66. package/dist/screens/assistants/assistant-tools.d.ts +0 -4
  67. package/dist/screens/assistants/assistant-tools.js +0 -24
  68. package/dist/screens/tools/tool-access-ipc.d.ts +0 -7
  69. package/dist/screens/tools/tool-access-ipc.js +0 -18
  70. package/dist/screens/workflows/workflow-details.d.ts +0 -5
  71. package/dist/screens/workflows/workflow-details.js +0 -57
  72. package/dist/screens/workflows/workflow-info.d.ts +0 -4
  73. package/dist/screens/workflows/workflow-info.js +0 -11
  74. package/dist/screens/workflows/workflow-instructions.d.ts +0 -4
  75. package/dist/screens/workflows/workflow-instructions.js +0 -86
  76. package/dist/screens/workflows/workflow-list.d.ts +0 -1
  77. package/dist/screens/workflows/workflow-list.js +0 -70
  78. package/dist/system-apps/assistants.app.d.ts +0 -2
  79. package/dist/system-apps/assistants.app.js +0 -8
  80. package/dist/system-apps/threads.app.d.ts +0 -2
  81. package/dist/system-apps/threads.app.js +0 -8
  82. package/dist/system-apps/workflows.app.d.ts +0 -2
  83. package/dist/system-apps/workflows.app.js +0 -8
@@ -1,41 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useGroupNames = useGroupNames;
3
+ exports.useGroupNames = void 0;
4
4
  exports.NotificationBell = NotificationBell;
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
- const peers_sdk_1 = require("@peers-app/peers-sdk");
7
6
  const react_1 = require("react");
8
- const tabs_state_1 = require("../tabs-layout/tabs-state");
9
- const notification_item_1 = require("./notification-item");
7
+ const globals_1 = require("../globals");
8
+ const hooks_1 = require("../hooks");
10
9
  const notifications_client_1 = require("./notifications-client");
11
- /** Group names by id, with "Personal" for the user's own context. */
12
- function useGroupNames() {
13
- const [names, setNames] = (0, react_1.useState)(new Map());
14
- (0, react_1.useEffect)(() => {
15
- let cancelled = false;
16
- void (0, peers_sdk_1.getUserContext)().then(async (userContext) => {
17
- const groups = await (0, peers_sdk_1.Groups)(userContext.userDataContext).list({});
18
- const next = new Map(groups.map((group) => [group.groupId, group.name]));
19
- next.set(userContext.userId, "Personal");
20
- if (!cancelled)
21
- setNames(next);
22
- });
23
- return () => {
24
- cancelled = true;
25
- };
26
- }, []);
27
- return names;
28
- }
29
- /** Bell with the notification badge, and a popover of active notifications. */
10
+ const notifications_panel_1 = require("./notifications-panel");
11
+ var group_names_1 = require("./group-names");
12
+ Object.defineProperty(exports, "useGroupNames", { enumerable: true, get: function () { return group_names_1.useGroupNames; } });
13
+ /**
14
+ * Bell with the notification badge, and a popover of active notifications. On a narrow screen
15
+ * the popover is a sheet across the screen instead, so it can't run off the edge.
16
+ */
30
17
  function NotificationBell({ compact = false }) {
18
+ (0, hooks_1.useObservable)(globals_1.isDesktop);
31
19
  const summary = (0, notifications_client_1.useNotificationSummary)();
32
20
  const [open, setOpen] = (0, react_1.useState)(false);
21
+ const [sheetTop, setSheetTop] = (0, react_1.useState)(0);
33
22
  const containerRef = (0, react_1.useRef)(null);
34
23
  const popoverId = (0, react_1.useId)();
35
- const { notifications, error } = (0, notifications_client_1.useNotifications)({ activeOnly: true, limit: 20 }, open);
36
- const groupNames = useGroupNames();
24
+ const narrow = !(0, globals_1.isDesktop)();
37
25
  (0, react_1.useEffect)(() => {
38
- if (!open)
26
+ if (!open || narrow)
39
27
  return;
40
28
  const closeOutside = (event) => {
41
29
  if (!containerRef.current?.contains(event.target))
@@ -51,31 +39,17 @@ function NotificationBell({ compact = false }) {
51
39
  document.removeEventListener("mousedown", closeOutside);
52
40
  document.removeEventListener("keydown", closeOnEscape);
53
41
  };
54
- }, [open]);
55
- // Opening the list counts as seeing what's in it.
56
- (0, react_1.useEffect)(() => {
57
- if (!open || !notifications)
58
- return;
59
- const unseen = notifications.filter((n) => !n.seenAt).map((n) => n.notificationId);
60
- if (unseen.length)
61
- void (0, notifications_client_1.actOnNotifications)({ action: "seen", notificationIds: unseen });
62
- }, [open, notifications]);
63
- const label = summary.count
64
- ? `${summary.count} notification${summary.count === 1 ? "" : "s"}`
65
- : summary.dot
66
- ? "New notifications"
67
- : "Notifications";
42
+ }, [open, narrow]);
43
+ const label = (0, notifications_panel_1.notificationBadgeLabel)(summary);
44
+ const toggle = () => {
45
+ if (!open)
46
+ setSheetTop((containerRef.current?.getBoundingClientRect().bottom ?? 0) + 4);
47
+ setOpen((current) => !current);
48
+ };
68
49
  return ((0, jsx_runtime_1.jsxs)("div", { ref: containerRef, className: "position-relative d-flex align-items-center", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm d-flex align-items-center px-2 text-body-secondary", style: {
69
50
  border: "none",
70
51
  background: "transparent",
71
52
  minWidth: compact ? "30px" : undefined,
72
- }, "aria-label": label, title: summary.paused ? `${label} (paused)` : label, "aria-expanded": open, "aria-controls": popoverId, "data-testid": "notification-bell", onClick: () => setOpen((current) => !current), children: (0, jsx_runtime_1.jsxs)("span", { className: "position-relative d-inline-flex", children: [(0, jsx_runtime_1.jsx)("i", { className: `bi ${summary.paused ? "bi-bell-slash" : summary.count || summary.dot ? "bi-bell-fill" : "bi-bell"}`, "aria-hidden": "true" }), summary.count > 0 ? ((0, jsx_runtime_1.jsx)("span", { className: "position-absolute badge rounded-pill bg-danger", style: {
73
- fontSize: "0.55rem",
74
- top: "-0.45rem",
75
- right: "-0.7rem",
76
- padding: "0.2em 0.4em",
77
- }, "aria-hidden": "true", "data-testid": "notification-count", children: summary.count > 99 ? "99+" : summary.count })) : (summary.dot && ((0, jsx_runtime_1.jsx)("span", { className: "position-absolute rounded-circle bg-danger", style: { width: "0.45rem", height: "0.45rem", top: "-0.1rem", right: "-0.2rem" }, "aria-hidden": "true", "data-testid": "notification-dot" })))] }) }), open && ((0, jsx_runtime_1.jsxs)("div", { id: popoverId, role: "dialog", "aria-label": "Notifications", className: "position-absolute end-0 top-100 mt-1 bg-body border rounded shadow", style: { width: "min(22rem, calc(100vw - 2rem))", zIndex: 1080 }, children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex align-items-center justify-content-between px-2 py-1 border-bottom", children: [(0, jsx_runtime_1.jsx)("strong", { className: "small", children: "Notifications" }), notifications && notifications.length > 0 && ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm btn-link p-0", onClick: () => void (0, notifications_client_1.actOnNotifications)({ action: "dismiss", all: true }), children: "Clear all" }))] }), (0, jsx_runtime_1.jsx)("div", { style: { maxHeight: "24rem", overflowY: "auto" }, children: error ? ((0, jsx_runtime_1.jsx)("output", { className: "small text-danger p-3", children: error })) : notifications === undefined ? ((0, jsx_runtime_1.jsx)("div", { className: "small text-body-secondary p-3", children: "Loading\u2026" })) : notifications.length === 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "small text-body-secondary p-3", children: "You're all caught up." })) : (notifications.map((notification) => ((0, jsx_runtime_1.jsx)(notification_item_1.NotificationItem, { notification: notification, groupName: groupNames.get(notification.groupId), onOpened: () => setOpen(false) }, notification.notificationId)))) }), (0, jsx_runtime_1.jsx)("div", { className: "border-top px-2 py-1 text-end", children: (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm btn-link p-0", onClick: () => {
78
- setOpen(false);
79
- (0, tabs_state_1.goToTabPath)(notifications_client_1.NOTIFICATIONS_PATH);
80
- }, children: "History and settings" }) })] }))] }));
53
+ }, "aria-label": label, title: summary.paused ? `${label} (paused)` : label, "aria-expanded": open, "aria-controls": popoverId, "data-testid": "notification-bell", onClick: toggle, children: (0, jsx_runtime_1.jsxs)("span", { className: "position-relative d-inline-flex", children: [(0, jsx_runtime_1.jsx)("i", { className: `bi ${summary.paused ? "bi-bell-slash" : (0, notifications_panel_1.hasNotificationBadge)(summary) ? "bi-bell-fill" : "bi-bell"}`, "aria-hidden": "true" }), (0, jsx_runtime_1.jsx)(notifications_panel_1.NotificationBadge, { summary: summary })] }) }), open &&
54
+ (narrow ? ((0, jsx_runtime_1.jsx)(notifications_panel_1.NotificationsSheet, { id: popoverId, top: sheetTop, onClose: () => setOpen(false) })) : ((0, jsx_runtime_1.jsx)("div", { id: popoverId, role: "dialog", "aria-label": "Notifications", className: "position-absolute end-0 top-100 mt-1 bg-body border rounded shadow", style: { width: "min(22rem, calc(100vw - 2rem))", zIndex: 1080 }, children: (0, jsx_runtime_1.jsx)(notifications_panel_1.NotificationsPanel, { onClose: () => setOpen(false) }) })))] }));
81
55
  }
@@ -41,7 +41,18 @@ export declare function actOnNotifications(input: IActOnNotificationsInput): Pro
41
41
  export declare function openNotification(notification: INotification): Promise<void>;
42
42
  /** Finish a notification's group switch after the new group's routes and tabs have loaded. */
43
43
  export declare function resumeNotificationNavigation(): Promise<void>;
44
- /** Open a notification by id, as the desktop app does when its OS notification is clicked. */
44
+ /** How long {@link openNotificationById} waits for a notification to sync in, and how often it looks. */
45
+ export declare const OPEN_NOTIFICATION_WAIT: {
46
+ totalMs: number;
47
+ everyMs: number;
48
+ };
49
+ /**
50
+ * Open a notification by id, as the desktop app does when its OS notification is clicked.
51
+ *
52
+ * A notification pushed to a closed PWA reaches its table only once the app has started and
53
+ * synced, so a missing one is looked for again for a few seconds before the notifications
54
+ * screen opens instead.
55
+ */
45
56
  export declare function openNotificationById(notificationId: string): Promise<void>;
46
57
  /** Short relative time, such as "3m" or "2d". */
47
58
  export declare function timeAgo(date: Date, now?: number): string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NOTIFICATIONS_PATH = exports.notificationsContract = void 0;
3
+ exports.OPEN_NOTIFICATION_WAIT = exports.NOTIFICATIONS_PATH = exports.notificationsContract = void 0;
4
4
  exports.useNotificationSummary = useNotificationSummary;
5
5
  exports.useNotifications = useNotifications;
6
6
  exports.listNotifications = listNotifications;
@@ -132,13 +132,26 @@ async function resumeNotificationNavigation() {
132
132
  // A stale or malformed session value must not prevent the shell from starting.
133
133
  }
134
134
  }
135
- /** Open a notification by id, as the desktop app does when its OS notification is clicked. */
135
+ /** How long {@link openNotificationById} waits for a notification to sync in, and how often it looks. */
136
+ exports.OPEN_NOTIFICATION_WAIT = { totalMs: 10_000, everyMs: 500 };
137
+ /**
138
+ * Open a notification by id, as the desktop app does when its OS notification is clicked.
139
+ *
140
+ * A notification pushed to a closed PWA reaches its table only once the app has started and
141
+ * synced, so a missing one is looked for again for a few seconds before the notifications
142
+ * screen opens instead.
143
+ */
136
144
  async function openNotificationById(notificationId) {
137
- const [notification] = await listNotifications({ notificationIds: [notificationId], limit: 1 });
138
- if (notification)
139
- await openNotification(notification);
140
- else
141
- (0, tabs_state_1.goToTabPath)(exports.NOTIFICATIONS_PATH);
145
+ const deadline = Date.now() + exports.OPEN_NOTIFICATION_WAIT.totalMs;
146
+ do {
147
+ const [notification] = await listNotifications({ notificationIds: [notificationId], limit: 1 });
148
+ if (notification)
149
+ return openNotification(notification);
150
+ if (Date.now() >= deadline)
151
+ break;
152
+ await new Promise((resolve) => setTimeout(resolve, Math.min(exports.OPEN_NOTIFICATION_WAIT.everyMs, deadline - Date.now())));
153
+ } while (Date.now() < deadline);
154
+ (0, tabs_state_1.goToTabPath)(exports.NOTIFICATIONS_PATH);
142
155
  }
143
156
  /** Short relative time, such as "3m" or "2d". */
144
157
  function timeAgo(date, now = Date.now()) {
@@ -0,0 +1,41 @@
1
+ import type { INotificationSummary } from "@peers-app/peers-sdk";
2
+ /** Whether the badge shows anything: a count of loud and priority, or a dot for unseen quiet. */
3
+ export declare function hasNotificationBadge(summary: INotificationSummary): boolean;
4
+ /** A short label for the badge, for `aria-label` and `title`. */
5
+ export declare function notificationBadgeLabel(summary: INotificationSummary): string;
6
+ /**
7
+ * The notification badge: the red count of active loud and priority notifications, otherwise a
8
+ * red dot while quiet ones are unseen, otherwise nothing.
9
+ *
10
+ * `corner` places it on the top-right corner of a `position-relative` parent that wraps a
11
+ * button's content inside its padding (the bell's icon, the mobile menu button's icon and tab
12
+ * count); `inline` sits in a row of text (a menu item).
13
+ */
14
+ export declare function NotificationBadge({ summary, placement, testId, }: {
15
+ summary: INotificationSummary;
16
+ placement?: "corner" | "inline";
17
+ testId?: string;
18
+ }): import("react/jsx-runtime").JSX.Element | null;
19
+ /**
20
+ * The active notifications, with "Clear all" and a link to the notifications screen. Showing
21
+ * the list counts as seeing what's in it.
22
+ *
23
+ * @param onClose - Called when the panel should close: a notification was opened, or the
24
+ * "History and settings" link was used.
25
+ */
26
+ export declare function NotificationsPanel({ onClose }: {
27
+ onClose: () => void;
28
+ }): import("react/jsx-runtime").JSX.Element;
29
+ /**
30
+ * {@link NotificationsPanel} as a sheet across the screen, for narrow screens: fixed below
31
+ * `top`, 0.5 rem from each edge, so it can't run off the screen. Tapping outside it or pressing
32
+ * Escape closes it. Like a dialog, it takes keyboard focus when it opens, and gives it back to
33
+ * what had it when it closes, if that's still on the page.
34
+ *
35
+ * @param top - Where the sheet starts, in px from the top of the viewport (below the header).
36
+ */
37
+ export declare function NotificationsSheet({ top, onClose, id, }: {
38
+ top: number;
39
+ onClose: () => void;
40
+ id?: string;
41
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasNotificationBadge = hasNotificationBadge;
4
+ exports.notificationBadgeLabel = notificationBadgeLabel;
5
+ exports.NotificationBadge = NotificationBadge;
6
+ exports.NotificationsPanel = NotificationsPanel;
7
+ exports.NotificationsSheet = NotificationsSheet;
8
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const react_1 = require("react");
10
+ const tabs_state_1 = require("../tabs-layout/tabs-state");
11
+ const group_names_1 = require("./group-names");
12
+ const notification_item_1 = require("./notification-item");
13
+ const notifications_client_1 = require("./notifications-client");
14
+ /** Whether the badge shows anything: a count of loud and priority, or a dot for unseen quiet. */
15
+ function hasNotificationBadge(summary) {
16
+ return summary.count > 0 || summary.dot;
17
+ }
18
+ /** A short label for the badge, for `aria-label` and `title`. */
19
+ function notificationBadgeLabel(summary) {
20
+ return summary.count
21
+ ? `${summary.count} notification${summary.count === 1 ? "" : "s"}`
22
+ : summary.dot
23
+ ? "New notifications"
24
+ : "Notifications";
25
+ }
26
+ /**
27
+ * The notification badge: the red count of active loud and priority notifications, otherwise a
28
+ * red dot while quiet ones are unseen, otherwise nothing.
29
+ *
30
+ * `corner` places it on the top-right corner of a `position-relative` parent that wraps a
31
+ * button's content inside its padding (the bell's icon, the mobile menu button's icon and tab
32
+ * count); `inline` sits in a row of text (a menu item).
33
+ */
34
+ function NotificationBadge({ summary, placement = "corner", testId = "notification", }) {
35
+ const corner = placement === "corner";
36
+ if (summary.count > 0) {
37
+ return ((0, jsx_runtime_1.jsx)("span", { className: `badge rounded-pill bg-danger ${corner ? "position-absolute" : ""}`, style: corner
38
+ ? { fontSize: "0.55rem", top: "-0.45rem", right: "-0.7rem", padding: "0.2em 0.4em" }
39
+ : { fontSize: "0.75rem" }, "aria-hidden": "true", "data-testid": `${testId}-count`, children: summary.count > 99 ? "99+" : summary.count }));
40
+ }
41
+ if (!summary.dot)
42
+ return null;
43
+ const size = corner ? "0.45rem" : "0.6rem";
44
+ return ((0, jsx_runtime_1.jsx)("span", { className: `rounded-circle bg-danger d-inline-block ${corner ? "position-absolute" : ""}`, style: corner
45
+ ? { width: size, height: size, top: "-0.1rem", right: "-0.2rem" }
46
+ : { width: size, height: size }, "aria-hidden": "true", "data-testid": `${testId}-dot` }));
47
+ }
48
+ /**
49
+ * The active notifications, with "Clear all" and a link to the notifications screen. Showing
50
+ * the list counts as seeing what's in it.
51
+ *
52
+ * @param onClose - Called when the panel should close: a notification was opened, or the
53
+ * "History and settings" link was used.
54
+ */
55
+ function NotificationsPanel({ onClose }) {
56
+ const { notifications, error } = (0, notifications_client_1.useNotifications)({ activeOnly: true, limit: 20 }, true);
57
+ const groupNames = (0, group_names_1.useGroupNames)();
58
+ (0, react_1.useEffect)(() => {
59
+ if (!notifications)
60
+ return;
61
+ const unseen = notifications.filter((n) => !n.seenAt).map((n) => n.notificationId);
62
+ if (unseen.length)
63
+ void (0, notifications_client_1.actOnNotifications)({ action: "seen", notificationIds: unseen });
64
+ }, [notifications]);
65
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex align-items-center justify-content-between px-2 py-1 border-bottom", children: [(0, jsx_runtime_1.jsx)("strong", { className: "small", children: "Notifications" }), notifications && notifications.length > 0 && ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm btn-link p-0", onClick: () => void (0, notifications_client_1.actOnNotifications)({ action: "dismiss", all: true }), children: "Clear all" }))] }), (0, jsx_runtime_1.jsx)("div", { style: { maxHeight: "24rem", overflowY: "auto" }, children: error ? ((0, jsx_runtime_1.jsx)("output", { className: "small text-danger p-3", children: error })) : notifications === undefined ? ((0, jsx_runtime_1.jsx)("div", { className: "small text-body-secondary p-3", children: "Loading\u2026" })) : notifications.length === 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "small text-body-secondary p-3", children: "You're all caught up." })) : (notifications.map((notification) => ((0, jsx_runtime_1.jsx)(notification_item_1.NotificationItem, { notification: notification, groupName: groupNames.get(notification.groupId), onOpened: onClose }, notification.notificationId)))) }), (0, jsx_runtime_1.jsx)("div", { className: "border-top px-2 py-1 text-end", children: (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm btn-link p-0", onClick: () => {
66
+ onClose();
67
+ (0, tabs_state_1.goToTabPath)(notifications_client_1.NOTIFICATIONS_PATH);
68
+ }, children: "History and settings" }) })] }));
69
+ }
70
+ /** Gap between the screen edges and the sheet. */
71
+ const SHEET_GUTTER = "0.5rem";
72
+ /**
73
+ * {@link NotificationsPanel} as a sheet across the screen, for narrow screens: fixed below
74
+ * `top`, 0.5 rem from each edge, so it can't run off the screen. Tapping outside it or pressing
75
+ * Escape closes it. Like a dialog, it takes keyboard focus when it opens, and gives it back to
76
+ * what had it when it closes, if that's still on the page.
77
+ *
78
+ * @param top - Where the sheet starts, in px from the top of the viewport (below the header).
79
+ */
80
+ function NotificationsSheet({ top, onClose, id, }) {
81
+ const ownId = (0, react_1.useId)();
82
+ const dialogRef = (0, react_1.useRef)(null);
83
+ (0, react_1.useEffect)(() => {
84
+ const opener = document.activeElement instanceof HTMLElement ? document.activeElement : null;
85
+ dialogRef.current?.focus();
86
+ return () => {
87
+ if (opener?.isConnected)
88
+ opener.focus();
89
+ };
90
+ }, []);
91
+ (0, react_1.useEffect)(() => {
92
+ const closeOnEscape = (event) => {
93
+ if (event.key === "Escape")
94
+ onClose();
95
+ };
96
+ document.addEventListener("keydown", closeOnEscape);
97
+ return () => document.removeEventListener("keydown", closeOnEscape);
98
+ }, [onClose]);
99
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "position-fixed", style: { inset: 0, zIndex: 1079 }, onClick: onClose, "aria-hidden": "true", "data-testid": "notifications-sheet-backdrop" }), (0, jsx_runtime_1.jsx)("div", { ref: dialogRef, id: id ?? ownId, role: "dialog", "aria-label": "Notifications", tabIndex: -1, className: "position-fixed bg-body border rounded shadow", style: {
100
+ outline: "none",
101
+ top: `${top}px`,
102
+ left: SHEET_GUTTER,
103
+ right: SHEET_GUTTER,
104
+ maxHeight: `calc(100dvh - ${top}px - ${SHEET_GUTTER})`,
105
+ overflowY: "auto",
106
+ zIndex: 1080,
107
+ }, "data-testid": "notifications-sheet", children: (0, jsx_runtime_1.jsx)(NotificationsPanel, { onClose: onClose }) })] }));
108
+ }
@@ -6,8 +6,8 @@ const peers_sdk_1 = require("@peers-app/peers-sdk");
6
6
  const react_1 = require("react");
7
7
  const use_observable_1 = require("../hooks/use-observable");
8
8
  const ui_loader_1 = require("../ui-router/ui-loader");
9
+ const group_names_1 = require("./group-names");
9
10
  const host_controls_1 = require("./host-controls");
10
- const notification_bell_1 = require("./notification-bell");
11
11
  const notification_item_1 = require("./notification-item");
12
12
  const notifications_client_1 = require("./notifications-client");
13
13
  const levelLabels = {
@@ -29,7 +29,7 @@ function NotificationList({ section }) {
29
29
  limit: 100,
30
30
  ...cursor,
31
31
  });
32
- const groupNames = (0, notification_bell_1.useGroupNames)();
32
+ const groupNames = (0, group_names_1.useGroupNames)();
33
33
  if (error)
34
34
  return (0, jsx_runtime_1.jsx)("div", { className: "alert alert-warning", children: error });
35
35
  if (!notifications)
@@ -41,7 +41,7 @@ function NotificationList({ section }) {
41
41
  }
42
42
  /** Sources the user has heard from, plus every group, so they can set a level for each. */
43
43
  function useSources(history, rules) {
44
- const groupNames = (0, notification_bell_1.useGroupNames)();
44
+ const groupNames = (0, group_names_1.useGroupNames)();
45
45
  const [packageNames, setPackageNames] = (0, react_1.useState)(new Map());
46
46
  const packageIds = (0, react_1.useMemo)(() => [
47
47
  ...new Set([
@@ -157,7 +157,7 @@ function NotificationSettings() {
157
157
  date.setHours(8, 0, 0, 0);
158
158
  return date.getTime() - Date.now();
159
159
  };
160
- return ((0, jsx_runtime_1.jsxs)("div", { className: "d-flex flex-column gap-4", children: [(0, jsx_runtime_1.jsx)(ThisDeviceSettings, {}), (0, jsx_runtime_1.jsxs)("section", { children: [(0, jsx_runtime_1.jsx)("h6", { children: "Do not disturb" }), (0, jsx_runtime_1.jsx)("p", { className: "small text-body-secondary mb-2", children: "While paused, loud notifications arrive without sound. Priority notifications still come through." }), (0, jsx_runtime_1.jsxs)("div", { className: "d-flex flex-wrap gap-2 align-items-center", children: [paused && ((0, jsx_runtime_1.jsxs)("span", { className: "small me-2", children: ["Paused until ", new Date(current.pausedUntil ?? 0).toLocaleString()] })), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm btn-outline-secondary", onClick: () => pauseFor(60 * 60_000), children: "1 hour" }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm btn-outline-secondary", onClick: () => pauseFor(tomorrowMorning()), children: "Until tomorrow morning" }), paused && ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm btn-primary", onClick: () => pauseFor(undefined), children: "Resume" }))] })] }), (0, jsx_runtime_1.jsxs)("section", { children: [(0, jsx_runtime_1.jsx)("h6", { children: "Levels by source" }), (0, jsx_runtime_1.jsx)("p", { className: "small text-body-secondary mb-2", children: "Each app asks for a level; you decide what you get. More specific choices win, and a person can only use priority if you allow it here." }), (0, jsx_runtime_1.jsxs)("div", { className: "border rounded", children: [sources.length === 0 && ((0, jsx_runtime_1.jsx)("div", { className: "p-3 small text-body-secondary", children: "Sources appear here once you've had a notification from them." })), sources.map((source) => {
160
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "d-flex flex-column gap-4", children: [(0, jsx_runtime_1.jsx)(ThisDeviceSettings, {}), (0, jsx_runtime_1.jsxs)("section", { children: [(0, jsx_runtime_1.jsx)("h6", { children: "Do not disturb" }), (0, jsx_runtime_1.jsx)("p", { className: "small text-body-secondary mb-2", children: "While paused, loud notifications arrive without sound. Priority notifications still come through." }), (0, jsx_runtime_1.jsxs)("div", { className: "d-flex flex-wrap gap-2 align-items-center", children: [paused && ((0, jsx_runtime_1.jsxs)("span", { className: "small me-2", children: ["Paused until ", new Date(current.pausedUntil ?? 0).toLocaleString()] })), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm btn-outline-secondary", onClick: () => pauseFor(60 * 60_000), children: "1 hour" }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm btn-outline-secondary", onClick: () => pauseFor(tomorrowMorning()), children: "Until tomorrow morning" }), paused && ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-sm btn-primary", onClick: () => pauseFor(undefined), children: "Resume" }))] })] }), (0, jsx_runtime_1.jsx)(AwaySetting, { current: current, save: save }), (0, jsx_runtime_1.jsxs)("section", { children: [(0, jsx_runtime_1.jsx)("h6", { children: "Levels by source" }), (0, jsx_runtime_1.jsx)("p", { className: "small text-body-secondary mb-2", children: "Each app asks for a level; you decide what you get. More specific choices win, and a person can only use priority if you allow it here." }), (0, jsx_runtime_1.jsxs)("div", { className: "border rounded", children: [sources.length === 0 && ((0, jsx_runtime_1.jsx)("div", { className: "p-3 small text-body-secondary", children: "Sources appear here once you've had a notification from them." })), sources.map((source) => {
161
161
  const rule = rules.find((r) => sameMatch(r, source.match));
162
162
  const key = `${source.match.groupId ?? ""}:${source.match.packageId ?? ""}:${source.match.fromUserId ?? ""}:${source.match.kind ?? ""}`;
163
163
  return ((0, jsx_runtime_1.jsxs)("div", { className: "d-flex flex-wrap align-items-center gap-2 px-2 py-2 border-bottom", children: [(0, jsx_runtime_1.jsx)("span", { className: "flex-grow-1 small", children: source.label }), (0, jsx_runtime_1.jsxs)("select", { className: "form-select form-select-sm", style: { width: "auto" }, "aria-label": `Level for ${source.label}`, value: rule?.level ?? "", onChange: (event) => setRule(source.match, {
@@ -167,6 +167,16 @@ function NotificationSettings() {
167
167
  }) }), "Allow priority"] }))] }, key));
168
168
  })] })] })] }));
169
169
  }
170
+ /** Choices for how long without input counts as away, in minutes. */
171
+ const AWAY_AFTER_CHOICES = [1, 2, 5, 10, 15, 30];
172
+ /** How long a computer waits without input before it counts the user as away. */
173
+ function AwaySetting({ current, save, }) {
174
+ const minutes = (0, peers_sdk_1.notificationAwayAfterMs)(current) / 60_000;
175
+ const choices = AWAY_AFTER_CHOICES.includes(minutes)
176
+ ? AWAY_AFTER_CHOICES
177
+ : [...AWAY_AFTER_CHOICES, minutes].sort((a, b) => a - b);
178
+ return ((0, jsx_runtime_1.jsxs)("section", { children: [(0, jsx_runtime_1.jsx)("h6", { children: "When you're away" }), (0, jsx_runtime_1.jsx)("p", { className: "small text-body-secondary mb-2", children: "While you aren't using any of your computers, loud and priority notifications also go to your phone, and to other browsers where you turned notifications on. Priority ones always do. A computer counts you as away when its screen locks, when it sleeps, or after this long without input:" }), (0, jsx_runtime_1.jsx)("select", { className: "form-select form-select-sm w-auto", "aria-label": "Away after", value: minutes, onChange: (event) => save({ ...current, awayAfterMinutes: Number(event.target.value) }), children: choices.map((choice) => ((0, jsx_runtime_1.jsxs)("option", { value: choice, children: [choice, " minute", choice === 1 ? "" : "s"] }, choice))) })] }));
179
+ }
170
180
  /** Per-device controls the host provides, such as the PWA's browser permission. */
171
181
  function ThisDeviceSettings() {
172
182
  const [controls] = (0, use_observable_1.useObservable)(host_controls_1.notificationHostControls);
@@ -56,7 +56,7 @@ function AccountScreen() {
56
56
  year: "numeric",
57
57
  month: "long",
58
58
  day: "numeric",
59
- })] }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-outline-secondary btn-sm", onClick: handleRegister, disabled: isRegistering, children: isRegistering ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "spinner-border spinner-border-sm me-2" }), "Refreshing..."] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-arrow-clockwise me-2" }), "Refresh Token"] })) })] })) : ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("p", { className: "text-muted mb-3", children: "Register your account to enable cloud-powered features like the AI assistant." }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-primary", onClick: handleRegister, disabled: isRegistering, children: isRegistering ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "spinner-border spinner-border-sm me-2" }), "Registering..."] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-cloud-upload me-2" }), "Register Account"] })) })] }))] }) })] }));
59
+ })] }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-outline-secondary btn-sm", onClick: handleRegister, disabled: isRegistering, children: isRegistering ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "spinner-border spinner-border-sm me-2" }), "Refreshing..."] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-arrow-clockwise me-2" }), "Refresh Token"] })) })] })) : ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("p", { className: "text-muted mb-3", children: "Register your account to use Peers Services, such as delivery to devices that are offline." }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-primary", onClick: handleRegister, disabled: isRegistering, children: isRegistering ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "spinner-border spinner-border-sm me-2" }), "Registering..."] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-cloud-upload me-2" }), "Register Account"] })) })] }))] }) })] }));
60
60
  }
61
61
  const ROTATE_INFO = `### Rotating your signing key
62
62
 
@@ -44,7 +44,7 @@ function getSummary(checks) {
44
44
  skips: checks.filter((c) => c.status === "skip").length,
45
45
  };
46
46
  }
47
- function formatReportForAI(checks) {
47
+ function formatReport(checks) {
48
48
  const lines = ["Connection Troubleshooter Report", "================================"];
49
49
  const groups = groupByLayer(checks);
50
50
  for (const layer of LAYER_ORDER) {
@@ -145,16 +145,15 @@ function ConnectionTroubleshooter({ onBack }) {
145
145
  return next;
146
146
  });
147
147
  };
148
- const handleAskAssistant = () => {
149
- const report = formatReportForAI(checks.filter((c) => c.status !== "running"));
150
- const message = `I ran the Peers connection troubleshooter and got the following results. Please help me understand what's wrong and how to fix it:\n\n${report}`;
148
+ const handleCopyDetails = () => {
149
+ const report = formatReport(checks.filter((c) => c.status !== "running"));
151
150
  navigator.clipboard
152
- .writeText(message)
151
+ .writeText(report)
153
152
  .then(() => {
154
- alert("Diagnostic report copied to clipboard. Paste it into the AI assistant chat.");
153
+ alert("Diagnostic report copied to the clipboard.");
155
154
  })
156
155
  .catch(() => {
157
- alert("Could not copy the diagnostic report. Please open the chat manually and describe the results.");
156
+ alert("Could not copy the diagnostic report.");
158
157
  });
159
158
  };
160
159
  const groups = groupByLayer(checks.filter((c) => !c.id.startsWith("placeholder-")));
@@ -172,7 +171,7 @@ function ConnectionTroubleshooter({ onBack }) {
172
171
  : "pass";
173
172
  return ((0, jsx_runtime_1.jsxs)("div", { className: "container-fluid p-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex justify-content-between align-items-center mb-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex align-items-center gap-3", children: [(0, jsx_runtime_1.jsxs)("button", { className: "btn btn-sm btn-outline-secondary", onClick: onBack, children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-arrow-left me-1" }), "Back"] }), (0, jsx_runtime_1.jsxs)("h4", { className: "mb-0", children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-stethoscope me-2 text-primary" }), "Connection Troubleshooter"] })] }), (0, jsx_runtime_1.jsx)("button", { className: "btn btn-sm btn-primary", onClick: runDiagnostics, disabled: running, children: running ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "spinner-border spinner-border-sm me-1", role: "status", "aria-hidden": "true" }), "Running\u2026"] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-arrow-clockwise me-1" }), "Re-run"] })) })] }), running && ((0, jsx_runtime_1.jsxs)("div", { className: "mb-4", children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex justify-content-between mb-1", children: [(0, jsx_runtime_1.jsx)("small", { className: "text-muted", children: "Running diagnostics\u2026" }), (0, jsx_runtime_1.jsxs)("small", { className: "text-muted", children: [completedCount, " / ", totalCount] })] }), (0, jsx_runtime_1.jsx)("div", { className: "progress", style: { height: "6px" }, children: (0, jsx_runtime_1.jsx)("div", { className: "progress-bar progress-bar-striped progress-bar-animated", style: { width: `${progressPct}%` } }) })] })), done && checks.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: `alert ${overallStatus === "pass" ? "alert-success" : overallStatus === "warn" ? "alert-warning" : "alert-danger"} d-flex justify-content-between align-items-center mb-4`, children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex align-items-center gap-2", children: [overallStatus === "pass" && (0, jsx_runtime_1.jsx)("i", { className: "bi bi-check-circle-fill fs-5" }), overallStatus === "warn" && (0, jsx_runtime_1.jsx)("i", { className: "bi bi-exclamation-triangle-fill fs-5" }), overallStatus === "fail" && (0, jsx_runtime_1.jsx)("i", { className: "bi bi-x-circle-fill fs-5" }), (0, jsx_runtime_1.jsxs)("div", { children: [overallStatus === "pass" && (0, jsx_runtime_1.jsx)("strong", { children: "All checks passed." }), overallStatus === "warn" && ((0, jsx_runtime_1.jsxs)("strong", { children: [summary.warnings, " warning", summary.warnings > 1 ? "s" : "", " found."] })), overallStatus === "fail" && ((0, jsx_runtime_1.jsxs)("strong", { children: [summary.issues, " issue", summary.issues > 1 ? "s" : "", " found", summary.warnings > 0
174
173
  ? `, ${summary.warnings} warning${summary.warnings > 1 ? "s" : ""}`
175
- : "", "."] })), " ", (0, jsx_runtime_1.jsxs)("span", { className: "opacity-75", children: [summary.passes, " passed \u00B7 ", summary.issues, " failed \u00B7 ", summary.warnings, " warnings \u00B7", " ", summary.skips, " skipped"] })] })] }), (0, jsx_runtime_1.jsxs)("button", { className: "btn btn-sm btn-dark d-flex align-items-center gap-1", onClick: handleAskAssistant, children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-chat-dots-fill" }), "Ask AI Assistant"] })] })), running && placeholders.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "card mb-3", children: (0, jsx_runtime_1.jsx)("div", { className: "card-body p-2", children: placeholders.map((p) => ((0, jsx_runtime_1.jsxs)("div", { className: "d-flex align-items-center gap-2 p-2 border-bottom", children: [STATUS_ICON[p.status], (0, jsx_runtime_1.jsx)("span", { className: "text-muted small", children: p.label })] }, p.id))) }) })), LAYER_ORDER.map((layer) => {
174
+ : "", "."] })), " ", (0, jsx_runtime_1.jsxs)("span", { className: "opacity-75", children: [summary.passes, " passed \u00B7 ", summary.issues, " failed \u00B7 ", summary.warnings, " warnings \u00B7", " ", summary.skips, " skipped"] })] })] }), (0, jsx_runtime_1.jsxs)("button", { className: "btn btn-sm btn-dark d-flex align-items-center gap-1", onClick: handleCopyDetails, children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-clipboard" }), "Copy details"] })] })), running && placeholders.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "card mb-3", children: (0, jsx_runtime_1.jsx)("div", { className: "card-body p-2", children: placeholders.map((p) => ((0, jsx_runtime_1.jsxs)("div", { className: "d-flex align-items-center gap-2 p-2 border-bottom", children: [STATUS_ICON[p.status], (0, jsx_runtime_1.jsx)("span", { className: "text-muted small", children: p.label })] }, p.id))) }) })), LAYER_ORDER.map((layer) => {
176
175
  const layerChecks = groups[layer];
177
176
  if (!layerChecks || layerChecks.length === 0)
178
177
  return null;
@@ -186,5 +185,5 @@ function ConnectionTroubleshooter({ onBack }) {
186
185
  ? "skip"
187
186
  : "pass";
188
187
  return ((0, jsx_runtime_1.jsxs)("div", { className: "card mb-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "card-header d-flex align-items-center justify-content-between py-2", children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex align-items-center gap-2", children: [STATUS_ICON[layerStatus], (0, jsx_runtime_1.jsx)("strong", { className: "small", children: layer })] }), (0, jsx_runtime_1.jsx)("span", { className: `badge ${STATUS_BADGE_CLASS[layerStatus]}`, children: layerStatus === "running" ? "running" : layerStatus })] }), (0, jsx_runtime_1.jsx)("div", { className: "list-group list-group-flush", children: layerChecks.map((check) => ((0, jsx_runtime_1.jsxs)("div", { className: "list-group-item p-0", children: [(0, jsx_runtime_1.jsxs)("div", { className: `d-flex align-items-start gap-2 px-3 py-2 ${check.suggestion ? "cursor-pointer" : ""}`, style: { cursor: check.suggestion ? "pointer" : "default" }, onClick: () => check.suggestion && toggleExpand(check.id), role: check.suggestion ? "button" : undefined, children: [(0, jsx_runtime_1.jsx)("div", { className: "pt-1 flex-shrink-0", children: STATUS_ICON[check.status] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-grow-1 min-width-0", children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex justify-content-between align-items-start", children: [(0, jsx_runtime_1.jsx)("span", { className: "small fw-medium", children: check.label }), check.suggestion && ((0, jsx_runtime_1.jsx)("i", { className: `bi bi-chevron-${expanded.has(check.id) ? "up" : "down"} text-muted ms-2 flex-shrink-0 small` }))] }), (0, jsx_runtime_1.jsx)("div", { className: "small text-muted mt-1", children: check.detail })] })] }), check.suggestion && expanded.has(check.id) && ((0, jsx_runtime_1.jsx)("div", { className: "px-3 pb-2 pt-0 ms-4", children: (0, jsx_runtime_1.jsxs)("div", { className: "alert alert-info py-2 px-3 mb-0 small d-flex gap-2", children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-lightbulb-fill text-info flex-shrink-0 mt-1" }), (0, jsx_runtime_1.jsx)("span", { children: check.suggestion })] }) }))] }, check.id))) })] }, layer));
189
- }), done && checks.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "text-center py-3", children: [(0, jsx_runtime_1.jsxs)("button", { className: "btn btn-outline-primary", onClick: handleAskAssistant, children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-chat-dots-fill me-2" }), "Ask AI Assistant for Help"] }), (0, jsx_runtime_1.jsx)("p", { className: "text-muted small mt-2 mb-0", children: "Sends the full diagnostic report to the AI assistant for guided troubleshooting." })] }))] }));
188
+ }), done && checks.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "text-center py-3", children: [(0, jsx_runtime_1.jsxs)("button", { className: "btn btn-outline-primary", onClick: handleCopyDetails, children: [(0, jsx_runtime_1.jsx)("i", { className: "bi bi-clipboard me-2" }), "Copy details"] }), (0, jsx_runtime_1.jsx)("p", { className: "text-muted small mt-2 mb-0", children: "Copies the full diagnostic report, to paste wherever you're getting help." })] }))] }));
190
189
  }
@@ -20,7 +20,7 @@ const PackageDetails = (props) => {
20
20
  const pkg = (0, hooks_1.usePromise)(async () => {
21
21
  const pkg = await (0, peers_sdk_1.Packages)().get(props.packageId);
22
22
  if (!pkg) {
23
- throw new Error("Workflow not found");
23
+ throw new Error("Package not found");
24
24
  }
25
25
  (0, tabs_state_1.updateActiveTabTitle)(pkg.name || "Package");
26
26
  return (0, peers_sdk_1.Packages)().initDoc(pkg);
@@ -11,8 +11,6 @@ const routes_loader_1 = require("../../ui-router/routes-loader");
11
11
  const color_mode_dropdown_1 = require("../settings/color-mode-dropdown");
12
12
  const searchConfigs = [
13
13
  { config: mention_configs_1.toolMentionConfig, category: "Tools", navigationPath: "tools" },
14
- { config: mention_configs_1.assistantMentionConfig, category: "Assistants", navigationPath: "assistants" },
15
- { config: mention_configs_1.workflowMentionConfig, category: "Workflows", navigationPath: "workflows" },
16
14
  { config: mention_configs_1.valueTypeMentionConfig, category: "Types", navigationPath: "peer-types" },
17
15
  { config: mention_configs_1.userMentionConfig, category: "People", navigationPath: "identity/people" },
18
16
  ];
@@ -129,7 +127,7 @@ function GlobalSearch() {
129
127
  color: "#6c757d",
130
128
  zIndex: 1,
131
129
  fontSize: "18px",
132
- } }), (0, jsx_runtime_1.jsx)("input", { ref: inputRef, type: "text", className: `form-control form-control-lg ${isDark ? "bg-dark text-light border-secondary" : ""}`, placeholder: "Search across apps, tools, assistants, workflows, and more...", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), style: {
130
+ } }), (0, jsx_runtime_1.jsx)("input", { ref: inputRef, type: "text", className: `form-control form-control-lg ${isDark ? "bg-dark text-light border-secondary" : ""}`, placeholder: "Search across apps, tools, types, and people...", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), style: {
133
131
  paddingLeft: "50px",
134
132
  fontSize: "18px",
135
133
  borderRadius: "12px",
@@ -177,5 +175,5 @@ function GlobalSearch() {
177
175
  fontSize: "16px",
178
176
  color: isDark ? "#0d6efd" : "#0d6efd",
179
177
  minWidth: "16px",
180
- } }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-grow-1", children: [(0, jsx_runtime_1.jsx)("h6", { className: "card-title mb-1 fw-medium", children: item.name }), (0, jsx_runtime_1.jsx)("small", { className: "text-muted text-uppercase", style: { fontSize: "11px", letterSpacing: "0.5px" }, children: result.category.slice(0, -1) })] }), (0, jsx_runtime_1.jsx)("i", { className: "bi-arrow-right text-muted", style: { fontSize: "12px" } })] }) }) }) }, item.id))) })] }, result.category)))] })) })), !searchQuery && ((0, jsx_runtime_1.jsxs)("div", { className: "text-center py-5", children: [(0, jsx_runtime_1.jsx)("i", { className: "bi-search mb-3 d-block text-muted", style: { fontSize: "64px" } }), (0, jsx_runtime_1.jsx)("h3", { className: "text-muted mb-3", children: "Search across everything" }), (0, jsx_runtime_1.jsx)("p", { className: "text-muted mb-4", style: { maxWidth: "400px", margin: "0 auto" }, children: "Find apps, tools, assistants, workflows, types, and users all in one place." }), (0, jsx_runtime_1.jsx)("div", { className: "d-flex flex-wrap justify-content-center gap-2", children: searchConfigs.map(({ config, category }) => ((0, jsx_runtime_1.jsxs)("span", { className: `badge ${isDark ? "bg-secondary" : "peers-surface text-body"} px-3 py-2 d-flex align-items-center`, style: { fontSize: "12px" }, children: [(0, jsx_runtime_1.jsx)("i", { className: `${config.iconClass} me-2` }), category] }, category))) })] }))] }));
178
+ } }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-grow-1", children: [(0, jsx_runtime_1.jsx)("h6", { className: "card-title mb-1 fw-medium", children: item.name }), (0, jsx_runtime_1.jsx)("small", { className: "text-muted text-uppercase", style: { fontSize: "11px", letterSpacing: "0.5px" }, children: result.category.slice(0, -1) })] }), (0, jsx_runtime_1.jsx)("i", { className: "bi-arrow-right text-muted", style: { fontSize: "12px" } })] }) }) }) }, item.id))) })] }, result.category)))] })) })), !searchQuery && ((0, jsx_runtime_1.jsxs)("div", { className: "text-center py-5", children: [(0, jsx_runtime_1.jsx)("i", { className: "bi-search mb-3 d-block text-muted", style: { fontSize: "64px" } }), (0, jsx_runtime_1.jsx)("h3", { className: "text-muted mb-3", children: "Search across everything" }), (0, jsx_runtime_1.jsx)("p", { className: "text-muted mb-4", style: { maxWidth: "400px", margin: "0 auto" }, children: "Find apps, tools, types, and people all in one place." }), (0, jsx_runtime_1.jsx)("div", { className: "d-flex flex-wrap justify-content-center gap-2", children: searchConfigs.map(({ config, category }) => ((0, jsx_runtime_1.jsxs)("span", { className: `badge ${isDark ? "bg-secondary" : "peers-surface text-body"} px-3 py-2 d-flex align-items-center`, style: { fontSize: "12px" }, children: [(0, jsx_runtime_1.jsx)("i", { className: `${config.iconClass} me-2` }), category] }, category))) })] }))] }));
181
179
  }
@@ -22,13 +22,13 @@ export declare function getToolDetails(toolId: string): Promise<{
22
22
  catalogIdentity?: "deterministic" | "legacy-alias" | undefined;
23
23
  catalogState?: "resolved" | "unresolved" | "quarantined" | undefined;
24
24
  catalogReason?: string | undefined;
25
+ detailedDescription?: string | undefined;
25
26
  configSchema?: {
26
27
  type: import("@peers-app/peers-sdk").IOSchemaType;
27
28
  fields: import("@peers-app/peers-sdk").IField[];
28
29
  } | undefined;
29
- isAssistantRunner?: boolean | undefined;
30
- detailedDescription?: string | undefined;
31
30
  codeRepository?: string | undefined;
31
+ isAssistantRunner?: boolean | undefined;
32
32
  packageId?: string | undefined;
33
33
  authorityPropagation?: "preserve" | "cap" | undefined;
34
34
  accessLevel?: number | undefined;
@@ -36,8 +36,8 @@ export declare function getToolDetails(toolId: string): Promise<{
36
36
  };
37
37
  entry: IToolCatalogEntry | undefined;
38
38
  } | undefined>;
39
- /** Query workflow mention candidates; unavailable browser hosts retain non-quarantined rows. */
40
- export declare function listWorkflowMentionTools(query: string, limit: number): Promise<IToolCatalogEntry[] | {
39
+ /** Query tool mention candidates; unavailable browser hosts retain non-quarantined rows. */
40
+ export declare function listMentionTools(query: string, limit: number): Promise<IToolCatalogEntry[] | {
41
41
  code: string;
42
42
  name: string;
43
43
  usageDescription: string;
@@ -56,13 +56,13 @@ export declare function listWorkflowMentionTools(query: string, limit: number):
56
56
  catalogIdentity?: "deterministic" | "legacy-alias" | undefined;
57
57
  catalogState?: "resolved" | "unresolved" | "quarantined" | undefined;
58
58
  catalogReason?: string | undefined;
59
+ detailedDescription?: string | undefined;
59
60
  configSchema?: {
60
61
  type: import("@peers-app/peers-sdk").IOSchemaType;
61
62
  fields: import("@peers-app/peers-sdk").IField[];
62
63
  } | undefined;
63
- isAssistantRunner?: boolean | undefined;
64
- detailedDescription?: string | undefined;
65
64
  codeRepository?: string | undefined;
65
+ isAssistantRunner?: boolean | undefined;
66
66
  packageId?: string | undefined;
67
67
  authorityPropagation?: "preserve" | "cap" | undefined;
68
68
  accessLevel?: number | undefined;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getToolCatalogConsumer = getToolCatalogConsumer;
4
4
  exports.getToolDetails = getToolDetails;
5
- exports.listWorkflowMentionTools = listWorkflowMentionTools;
5
+ exports.listMentionTools = listMentionTools;
6
6
  const peers_sdk_1 = require("@peers-app/peers-sdk");
7
7
  const consumers = new Map();
8
8
  /** Obtain a catalog consumer for the selected host context; PWA callers can fall back to rows. */
@@ -34,11 +34,10 @@ async function getToolDetails(toolId) {
34
34
  }
35
35
  return { row, entry };
36
36
  }
37
- /** Query workflow mention candidates; unavailable browser hosts retain non-quarantined rows. */
38
- async function listWorkflowMentionTools(query, limit) {
37
+ /** Query tool mention candidates; unavailable browser hosts retain non-quarantined rows. */
38
+ async function listMentionTools(query, limit) {
39
39
  try {
40
- const { tools } = await (await getToolCatalogConsumer()).tools.listTools({ query, limit: 500 });
41
- return tools.filter((entry) => entry.workflowInvocable).slice(0, limit);
40
+ return (await (await getToolCatalogConsumer()).tools.listTools({ query, limit })).tools;
42
41
  }
43
42
  catch {
44
43
  return (await (0, peers_sdk_1.Tools)().list({ name: { $matchWords: query } }, { pageSize: 500 }))
@@ -8,10 +8,10 @@ const markdown_with_mentions_1 = require("../../components/markdown-with-mention
8
8
  const ToolInfo = ({ tool, entry }) => {
9
9
  const target = entry?.target;
10
10
  const level = entry?.access?.accessLevel;
11
- return ((0, jsx_runtime_1.jsxs)("div", { children: [tool.isAssistantRunner && (0, jsx_runtime_1.jsx)("span", { className: "badge bg-secondary", children: "Assistant runner" }), (0, jsx_runtime_1.jsxs)("dl", { children: [(0, jsx_runtime_1.jsx)("dt", { children: "ID" }), (0, jsx_runtime_1.jsx)("dd", { children: tool.toolId }), (0, jsx_runtime_1.jsx)("dt", { children: "Aliases" }), (0, jsx_runtime_1.jsx)("dd", { children: entry?.aliases.join(", ") ?? tool.toolId }), (0, jsx_runtime_1.jsx)("dt", { children: "Contract" }), (0, jsx_runtime_1.jsx)("dd", { children: target
11
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("dl", { children: [(0, jsx_runtime_1.jsx)("dt", { children: "ID" }), (0, jsx_runtime_1.jsx)("dd", { children: tool.toolId }), (0, jsx_runtime_1.jsx)("dt", { children: "Aliases" }), (0, jsx_runtime_1.jsx)("dd", { children: entry?.aliases.join(", ") ?? tool.toolId }), (0, jsx_runtime_1.jsx)("dt", { children: "Contract" }), (0, jsx_runtime_1.jsx)("dd", { children: target
12
12
  ? `${target.contractId}@${target.version}`
13
13
  : tool.contractId
14
14
  ? `${tool.contractId}@${tool.contractVersion}`
15
- : "Unresolved" }), (0, jsx_runtime_1.jsx)("dt", { children: "Member" }), (0, jsx_runtime_1.jsx)("dd", { children: target?.toolName ?? tool.toolName ?? tool.name }), (0, jsx_runtime_1.jsx)("dt", { children: "Provider" }), (0, jsx_runtime_1.jsx)("dd", { children: entry?.provider?.activePackageId ?? "Unavailable" }), (0, jsx_runtime_1.jsx)("dt", { children: "Dispatch" }), (0, jsx_runtime_1.jsxs)("dd", { children: [entry?.availability.dispatch ?? "Host catalog unavailable", entry?.availability.message && `: ${entry.availability.message}`] }), (0, jsx_runtime_1.jsx)("dt", { children: "Live access" }), (0, jsx_runtime_1.jsx)("dd", { children: level === undefined ? "Unavailable" : `${(0, peers_sdk_1.getAccessLevelLabel)(level)} (${level})` }), (0, jsx_runtime_1.jsx)("dt", { children: "Workflow" }), (0, jsx_runtime_1.jsxs)("dd", { children: [entry ? (entry.workflowInvocable ? "Available" : "Excluded or unavailable") : "Unknown", entry?.availability.requiresWorkflowRun && "; workflow run required"] })] }), (0, jsx_runtime_1.jsx)(markdown_with_mentions_1.MarkdownWithMentions, { content: entry?.usageDescription ?? tool.usageDescription }), tool.detailedDescription && (0, jsx_runtime_1.jsx)(markdown_with_mentions_1.MarkdownWithMentions, { content: tool.detailedDescription })] }));
15
+ : "Unresolved" }), (0, jsx_runtime_1.jsx)("dt", { children: "Member" }), (0, jsx_runtime_1.jsx)("dd", { children: target?.toolName ?? tool.toolName ?? tool.name }), (0, jsx_runtime_1.jsx)("dt", { children: "Provider" }), (0, jsx_runtime_1.jsx)("dd", { children: entry?.provider?.activePackageId ?? "Unavailable" }), (0, jsx_runtime_1.jsx)("dt", { children: "Dispatch" }), (0, jsx_runtime_1.jsxs)("dd", { children: [entry?.availability.dispatch ?? "Host catalog unavailable", entry?.availability.message && `: ${entry.availability.message}`] }), (0, jsx_runtime_1.jsx)("dt", { children: "Live access" }), (0, jsx_runtime_1.jsx)("dd", { children: level === undefined ? "Unavailable" : `${(0, peers_sdk_1.getAccessLevelLabel)(level)} (${level})` })] }), (0, jsx_runtime_1.jsx)(markdown_with_mentions_1.MarkdownWithMentions, { content: entry?.usageDescription ?? tool.usageDescription }), tool.detailedDescription && (0, jsx_runtime_1.jsx)(markdown_with_mentions_1.MarkdownWithMentions, { content: tool.detailedDescription })] }));
16
16
  };
17
17
  exports.ToolInfo = ToolInfo;
@@ -1,5 +1,5 @@
1
1
  import type { ITool, IToolCatalogEntry } from "@peers-app/peers-sdk";
2
- /** Read-only contract field tables, plus persisted assistant runner configuration. */
2
+ /** Read-only contract field tables. */
3
3
  export declare const ToolSchema: ({ tool, entry }: {
4
4
  tool: ITool;
5
5
  entry?: IToolCatalogEntry;