@peers-app/peers-ui 0.32.2 → 0.33.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.
Files changed (93) 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.d.ts +1 -0
  8. package/dist/components/router.js +2 -41
  9. package/dist/globals.d.ts +2 -6
  10. package/dist/globals.js +0 -35
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.js +3 -1
  13. package/dist/mention-configs.d.ts +1 -5
  14. package/dist/mention-configs.js +4 -54
  15. package/dist/notifications/host-controls.d.ts +31 -0
  16. package/dist/notifications/host-controls.js +9 -0
  17. package/dist/notifications/index.d.ts +4 -0
  18. package/dist/notifications/index.js +20 -0
  19. package/dist/notifications/notification-bell.d.ts +6 -0
  20. package/dist/notifications/notification-bell.js +81 -0
  21. package/dist/notifications/notification-item.d.ts +7 -0
  22. package/dist/notifications/notification-item.js +43 -0
  23. package/dist/notifications/notifications-client.d.ts +47 -0
  24. package/dist/notifications/notifications-client.js +155 -0
  25. package/dist/notifications/notifications-screen.d.ts +2 -0
  26. package/dist/notifications/notifications-screen.js +209 -0
  27. package/dist/notifications/priority-alert.d.ts +5 -0
  28. package/dist/notifications/priority-alert.js +82 -0
  29. package/dist/root-layout/layouts/full-screen-layout.js +2 -1
  30. package/dist/root-layout/root-layout-host.js +2 -0
  31. package/dist/screens/account/account-screen.js +1 -1
  32. package/dist/screens/network-viewer/connection-troubleshooter.js +8 -9
  33. package/dist/screens/packages/package-details.js +1 -1
  34. package/dist/screens/search/global-search.js +2 -4
  35. package/dist/screens/tools/tool-catalog-ipc.d.ts +6 -6
  36. package/dist/screens/tools/tool-catalog-ipc.js +4 -5
  37. package/dist/screens/tools/tool-info.js +2 -2
  38. package/dist/screens/tools/tool-schema.d.ts +1 -1
  39. package/dist/screens/tools/tool-schema.js +2 -2
  40. package/dist/system-apps/index.d.ts +3 -3
  41. package/dist/system-apps/index.js +7 -15
  42. package/dist/system-apps/notifications.app.d.ts +3 -0
  43. package/dist/system-apps/notifications.app.js +9 -0
  44. package/dist/tabs-layout/network-status-indicator.js +2 -1
  45. package/dist/tabs-layout/tabs-state.d.ts +1 -0
  46. package/dist/tabs-layout/tabs-state.js +9 -2
  47. package/dist/utils.d.ts +0 -2
  48. package/dist/utils.js +0 -9
  49. package/package.json +3 -3
  50. package/dist/components/access-level-field.d.ts +0 -10
  51. package/dist/components/access-level-field.js +0 -28
  52. package/dist/components/message-logs/message-logs.d.ts +0 -6
  53. package/dist/components/message-logs/message-logs.js +0 -324
  54. package/dist/components/message-logs/tool-access-approval-card.d.ts +0 -13
  55. package/dist/components/message-logs/tool-access-approval-card.js +0 -82
  56. package/dist/components/messages/avatar.d.ts +0 -9
  57. package/dist/components/messages/avatar.js +0 -101
  58. package/dist/components/messages/channel-message-list.d.ts +0 -13
  59. package/dist/components/messages/channel-message-list.js +0 -158
  60. package/dist/components/messages/channel-view.d.ts +0 -5
  61. package/dist/components/messages/channel-view.js +0 -62
  62. package/dist/components/messages/message-compose.d.ts +0 -11
  63. package/dist/components/messages/message-compose.js +0 -152
  64. package/dist/components/messages/message-display.d.ts +0 -9
  65. package/dist/components/messages/message-display.js +0 -99
  66. package/dist/components/messages/thread-message-list.d.ts +0 -10
  67. package/dist/components/messages/thread-message-list.js +0 -122
  68. package/dist/screens/assistants/assistant-config.d.ts +0 -5
  69. package/dist/screens/assistants/assistant-config.js +0 -56
  70. package/dist/screens/assistants/assistant-details.d.ts +0 -3
  71. package/dist/screens/assistants/assistant-details.js +0 -41
  72. package/dist/screens/assistants/assistant-info.d.ts +0 -11
  73. package/dist/screens/assistants/assistant-info.js +0 -13
  74. package/dist/screens/assistants/assistant-list.d.ts +0 -2
  75. package/dist/screens/assistants/assistant-list.js +0 -80
  76. package/dist/screens/assistants/assistant-tools.d.ts +0 -4
  77. package/dist/screens/assistants/assistant-tools.js +0 -24
  78. package/dist/screens/tools/tool-access-ipc.d.ts +0 -7
  79. package/dist/screens/tools/tool-access-ipc.js +0 -18
  80. package/dist/screens/workflows/workflow-details.d.ts +0 -5
  81. package/dist/screens/workflows/workflow-details.js +0 -57
  82. package/dist/screens/workflows/workflow-info.d.ts +0 -4
  83. package/dist/screens/workflows/workflow-info.js +0 -11
  84. package/dist/screens/workflows/workflow-instructions.d.ts +0 -4
  85. package/dist/screens/workflows/workflow-instructions.js +0 -86
  86. package/dist/screens/workflows/workflow-list.d.ts +0 -1
  87. package/dist/screens/workflows/workflow-list.js +0 -70
  88. package/dist/system-apps/assistants.app.d.ts +0 -2
  89. package/dist/system-apps/assistants.app.js +0 -8
  90. package/dist/system-apps/threads.app.d.ts +0 -2
  91. package/dist/system-apps/threads.app.js +0 -8
  92. package/dist/system-apps/workflows.app.d.ts +0 -2
  93. package/dist/system-apps/workflows.app.js +0 -8
@@ -1,2 +1,2 @@
1
- /** Searchable overlay for launching apps, running commands, and starting threads. */
1
+ /** Searchable overlay for launching apps and running commands. */
2
2
  export declare function CommandPaletteOverlay(): import("react/jsx-runtime").JSX.Element | null;
@@ -2,17 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CommandPaletteOverlay = CommandPaletteOverlay;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const peers_sdk_1 = require("@peers-app/peers-sdk");
6
5
  // biome-ignore lint/correctness/noUnusedImports: classic JSX (`jsx: react`) needs React in scope for emit
7
6
  const react_1 = require("react");
8
- const globals_1 = require("../globals");
9
7
  const hooks_1 = require("../hooks");
10
8
  const color_mode_dropdown_1 = require("../screens/settings/color-mode-dropdown");
11
9
  const system_apps_1 = require("../system-apps");
12
10
  const tabs_state_1 = require("../tabs-layout/tabs-state");
13
11
  const routes_loader_1 = require("../ui-router/routes-loader");
14
12
  const command_palette_1 = require("./command-palette");
15
- /** Searchable overlay for launching apps, running commands, and starting threads. */
13
+ /** Searchable overlay for launching apps and running commands. */
16
14
  function CommandPaletteOverlay() {
17
15
  const [isOpen] = (0, hooks_1.useObservable)(command_palette_1.isCommandPaletteOpen);
18
16
  const [_persistedQuery] = (0, hooks_1.useObservable)(command_palette_1.commandSearchQuery);
@@ -95,23 +93,6 @@ function CommandPaletteOverlay() {
95
93
  app.packageName.toLowerCase().includes(lowerQuery));
96
94
  };
97
95
  const filteredApps = searchApps(searchQuery);
98
- // Function to create a new thread from search query
99
- const createNewThreadFromQuery = (0, react_1.useCallback)(async (query) => {
100
- try {
101
- const currentUser = await (0, peers_sdk_1.getMe)();
102
- const threadMessage = await (0, peers_sdk_1.Messages)().insert({
103
- messageId: (0, peers_sdk_1.newid)(),
104
- userId: currentUser.userId,
105
- channelId: currentUser.userId,
106
- message: query.trim(),
107
- createdAt: new Date(),
108
- });
109
- await (0, globals_1.openThreadInTab)(threadMessage);
110
- }
111
- catch (error) {
112
- console.error("Failed to create new thread:", error);
113
- }
114
- }, []);
115
96
  // Create a flattened list that matches the visual rendering order
116
97
  // Apps first, then commands
117
98
  const allItems = [];
@@ -147,9 +128,7 @@ function CommandPaletteOverlay() {
147
128
  const handleKeyDown = (e) => {
148
129
  if (e.key === "ArrowDown") {
149
130
  e.preventDefault();
150
- // Allow selection to go one past the end if there's a search query (for new thread option)
151
- const maxIndex = searchQuery.trim() ? allItems.length : allItems.length - 1;
152
- setSelectedIndex((prev) => Math.min(prev + 1, maxIndex));
131
+ setSelectedIndex((prev) => Math.min(prev + 1, allItems.length - 1));
153
132
  }
154
133
  else if (e.key === "ArrowUp") {
155
134
  e.preventDefault();
@@ -157,34 +136,19 @@ function CommandPaletteOverlay() {
157
136
  }
158
137
  else if (e.key === "Enter") {
159
138
  e.preventDefault();
160
- // Check if the new thread option is selected (selectedIndex >= allItems.length)
161
- if (selectedIndex >= allItems.length && searchQuery.trim()) {
139
+ const selectedItem = allItems[selectedIndex];
140
+ if (selectedItem?.type === "app" && selectedItem.app) {
162
141
  (0, command_palette_1.closeCommandPalette)();
163
- createNewThreadFromQuery(searchQuery);
142
+ (0, tabs_state_1.goToTabPath)(selectedItem.app.path);
164
143
  }
165
- else {
166
- const selectedItem = allItems[selectedIndex];
167
- if (selectedItem) {
168
- if (selectedItem.type === "app" && selectedItem.app) {
169
- (0, command_palette_1.closeCommandPalette)();
170
- (0, tabs_state_1.goToTabPath)(selectedItem.app.path);
171
- }
172
- else if (selectedItem.type === "command" && selectedItem.command) {
173
- (0, command_palette_1.executeCommand)(selectedItem.command.id);
174
- }
175
- }
176
- else if (searchQuery.trim()) {
177
- // Fallback: Create a new thread with the search query as the message
178
- // This happens when no item is selected (selectedIndex is out of bounds or -1)
179
- (0, command_palette_1.closeCommandPalette)();
180
- createNewThreadFromQuery(searchQuery);
181
- }
144
+ else if (selectedItem?.type === "command" && selectedItem.command) {
145
+ (0, command_palette_1.executeCommand)(selectedItem.command.id);
182
146
  }
183
147
  }
184
148
  };
185
149
  document.addEventListener("keydown", handleKeyDown);
186
150
  return () => document.removeEventListener("keydown", handleKeyDown);
187
- }, [isOpen, selectedIndex, createNewThreadFromQuery, searchQuery]);
151
+ }, [isOpen, selectedIndex, allItems]);
188
152
  if (!isOpen)
189
153
  return null;
190
154
  const isDark = _colorMode === "dark";
@@ -284,36 +248,8 @@ function CommandPaletteOverlay() {
284
248
  ? "1px solid #495057"
285
249
  : "1px solid var(--peers-surface-border)",
286
250
  }, children: command.shortcut }))] }, command.id));
287
- })] }, category))), searchQuery.trim() && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "px-3 py-1 small text-muted fw-bold text-uppercase", style: { fontSize: "11px", letterSpacing: "0.5px" }, children: "Actions" }), (0, jsx_runtime_1.jsx)("div", { className: `px-3 py-2 d-flex align-items-center ${(allItems.length === 0 || selectedIndex >= allItems.length) &&
288
- searchQuery.trim()
289
- ? isDark
290
- ? "bg-primary bg-opacity-25"
291
- : "bg-primary bg-opacity-10"
292
- : ""}`, style: {
293
- cursor: "pointer",
294
- transition: "background-color 0.1s ease",
295
- borderTop: allItems.length > 0
296
- ? `1px solid ${isDark ? "#495057" : "var(--peers-surface-border)"}`
297
- : "none",
298
- marginTop: allItems.length > 0 ? "8px" : "0",
299
- paddingTop: allItems.length > 0 ? "12px" : "8px",
300
- }, onClick: () => {
301
- (0, command_palette_1.closeCommandPalette)();
302
- createNewThreadFromQuery(searchQuery);
303
- }, onMouseEnter: () => {
304
- // Set selected index beyond the list to indicate this item is selected
305
- setSelectedIndex(allItems.length);
306
- }, children: (0, jsx_runtime_1.jsxs)("div", { className: "d-flex align-items-center", children: [(0, jsx_runtime_1.jsx)("i", { className: "bi-chat-dots me-3", style: {
307
- fontSize: "16px",
308
- color: (allItems.length === 0 || selectedIndex >= allItems.length) &&
309
- searchQuery.trim()
310
- ? isDark
311
- ? "#ffffff"
312
- : "#0d6efd"
313
- : "#6c757d",
314
- minWidth: "16px",
315
- } }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "fw-medium", children: ["Start new thread:", " ", (0, jsx_runtime_1.jsxs)("span", { className: "text-muted", children: [searchQuery.trim().slice(0, 50), searchQuery.trim().length > 50 ? "..." : ""] })] }), (0, jsx_runtime_1.jsx)("div", { className: "small text-muted", style: { fontSize: "12px" }, children: "Press Enter to create" })] })] }) })] }))] })) }), (0, jsx_runtime_1.jsxs)("div", { className: `px-3 py-2 small text-muted border-top d-flex align-items-center justify-content-between`, style: {
251
+ })] }, category)))] })) }), (0, jsx_runtime_1.jsxs)("div", { className: `px-3 py-2 small text-muted border-top d-flex align-items-center justify-content-between`, style: {
316
252
  borderTopColor: isDark ? "#495057" : "var(--peers-surface-border)",
317
253
  fontSize: "11px",
318
- }, children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex align-items-center gap-3", children: [(0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)("kbd", { className: "small", children: "\u21B5" }), " to select"] }), (0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)("kbd", { className: "small", children: "\u2191\u2193" }), " to navigate"] }), (0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)("kbd", { className: "small", children: "esc" }), " to close"] })] }), (0, jsx_runtime_1.jsxs)("div", { children: [allItems.length, " result", allItems.length !== 1 ? "s" : "", searchQuery.trim() && allItems.length === 0 && " • Start thread"] })] })] }) }));
254
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { className: "d-flex align-items-center gap-3", children: [(0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)("kbd", { className: "small", children: "\u21B5" }), " to select"] }), (0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)("kbd", { className: "small", children: "\u2191\u2193" }), " to navigate"] }), (0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)("kbd", { className: "small", children: "esc" }), " to close"] })] }), (0, jsx_runtime_1.jsxs)("div", { children: [allItems.length, " result", allItems.length !== 1 ? "s" : ""] })] })] }) }));
319
255
  }
@@ -114,14 +114,14 @@ const coreCommands = [
114
114
  },
115
115
  {
116
116
  id: "go-home",
117
- label: "Go to Threads",
118
- description: "Navigate to threads/home",
117
+ label: "Go Home",
118
+ description: "Show the app launcher",
119
119
  shortcut: `${modKey}+H`,
120
- iconClassName: "bi-cpu",
120
+ iconClassName: "bi-grid-3x3-gap",
121
121
  category: "Navigation",
122
122
  action: () => {
123
123
  closeCommandPalette();
124
- (0, tabs_state_1.goToTabPath)("threads");
124
+ (0, tabs_state_1.goToTabPath)("");
125
125
  },
126
126
  },
127
127
  ];
@@ -74,18 +74,22 @@ class MentionNode extends lexical_1.TextNode {
74
74
  dom.setAttribute("data-clickable", this.data.clickable === undefined ? "" : String(this.data.clickable));
75
75
  // currently ignoring `clickable` attribute
76
76
  // if (this.data.clickable !== false) {...
77
- const onClick = mentionConfig?.onClick;
78
- dom.style.cursor = "pointer";
79
- dom.addEventListener("click", () => {
80
- if (onClick) {
81
- onClick(this.data);
82
- }
83
- else {
84
- const id = this.data.id;
85
- const href = kind === "user" ? `identity/people/${id}` : `${kind}s/${id}`;
86
- (0, globals_1.mainContentPath)(href);
87
- }
88
- });
77
+ // A kind with no config, such as a saved assistant or workflow mention, has no screen to
78
+ // open: it stays plain text, as MarkdownWithMentions renders it.
79
+ if (mentionConfig) {
80
+ const onClick = mentionConfig.onClick;
81
+ dom.style.cursor = "pointer";
82
+ dom.addEventListener("click", () => {
83
+ if (onClick) {
84
+ onClick(this.data);
85
+ }
86
+ else {
87
+ const id = this.data.id;
88
+ const href = kind === "user" ? `identity/people/${id}` : `${kind}s/${id}`;
89
+ (0, globals_1.mainContentPath)(href);
90
+ }
91
+ });
92
+ }
89
93
  if (mentionConfig && kind !== "user") {
90
94
  const iconSpan = document.createElement("i");
91
95
  iconSpan.className = `pe-1 ${mentionConfig.iconClass}`;
@@ -124,10 +124,10 @@ function useMentionLookupService(mentionString, mentionConfigs = []) {
124
124
  allResults = (0, lodash_1.uniqBy)(allResults, "id");
125
125
  let filteredResults = allResults;
126
126
  if (prefix === "@") {
127
- filteredResults = filteredResults.filter((result) => result.kind === "user" || result.kind === "assistant");
127
+ filteredResults = filteredResults.filter((result) => result.kind === "user");
128
128
  }
129
129
  else {
130
- filteredResults = filteredResults.filter((result) => result.kind !== "user" && result.kind !== "assistant");
130
+ filteredResults = filteredResults.filter((result) => result.kind !== "user");
131
131
  }
132
132
  if (kind) {
133
133
  filteredResults = allResults.filter((result) => result.kind.toLowerCase() === kind.toLowerCase());
@@ -179,9 +179,6 @@ class MentionTypeaheadOption extends LexicalTypeaheadMenuPlugin_1.MenuOption {
179
179
  this.name = data.name;
180
180
  this.picture = picture;
181
181
  this.id = data.id;
182
- // if (data.kind === 'assistant') {
183
- // this.userId = data.userId;
184
- // }
185
182
  }
186
183
  }
187
184
  function MentionsTypeaheadMenuItem({ index, isSelected, onClick, onMouseEnter, option, }) {
@@ -48,13 +48,18 @@ const processTextWithMentions = (text) => {
48
48
  style.whiteSpace = "nowrap";
49
49
  }
50
50
  const mentionConfig = mention_configs_1.mentionConfigs.find((c) => c.kind === kind);
51
- const mentionClass = mentionConfig
52
- ? mentionConfig.styleClass || "mention-default-default"
53
- : `mention-${kind}`;
54
- const onClick = mentionConfig?.onClick;
51
+ if (!mentionConfig) {
52
+ // A kind Peers no longer has, such as a saved assistant or workflow mention: its name only.
53
+ parts.push(name);
54
+ lastIndex = regex.lastIndex;
55
+ match = regex.exec(text);
56
+ continue;
57
+ }
58
+ const mentionClass = mentionConfig.styleClass || "mention-default-default";
59
+ const onClick = mentionConfig.onClick;
55
60
  const href = (!onClick && `#${kind}s/${id}`) || undefined;
56
61
  const icon = (kind === "user" && "@") ||
57
- (mentionConfig?.iconClass && (0, jsx_runtime_1.jsx)("i", { className: `pe-1 ${mentionConfig.iconClass}` })) || ((0, jsx_runtime_1.jsx)("i", { className: `pe-1 bi bi-question` }));
62
+ (mentionConfig.iconClass && (0, jsx_runtime_1.jsx)("i", { className: `pe-1 ${mentionConfig.iconClass}` })) || ((0, jsx_runtime_1.jsx)("i", { className: `pe-1 bi bi-question` }));
58
63
  parts.push((0, jsx_runtime_1.jsxs)("a", { className: mentionClass, "data-kind": kind, "data-id": id, style: style, href: href, onClick: onClick && (() => onClick(data)), children: [icon, data.name] }, cnt));
59
64
  lastIndex = regex.lastIndex;
60
65
  match = regex.exec(text);
@@ -2,6 +2,7 @@ import "../screens/console-logs/console-logs-list";
2
2
  import "../screens/identity";
3
3
  import "../screens/network-viewer";
4
4
  import "../screens/data-explorer";
5
+ import "../notifications";
5
6
  /** Render the built-in or registered UI that owns a canonicalized route. */
6
7
  export declare function Router({ path: providedPath }?: {
7
8
  path?: string;
@@ -37,8 +37,6 @@ exports.Router = Router;
37
37
  const jsx_runtime_1 = require("react/jsx-runtime");
38
38
  const globals = __importStar(require("../globals"));
39
39
  const hooks_1 = require("../hooks");
40
- const assistant_details_1 = require("../screens/assistants/assistant-details");
41
- const assistant_list_1 = require("../screens/assistants/assistant-list");
42
40
  const identity_routes_1 = require("../screens/identity/identity-routes");
43
41
  const package_details_1 = require("../screens/packages/package-details");
44
42
  const package_list_1 = require("../screens/packages/package-list");
@@ -53,15 +51,12 @@ const tool_details_1 = require("../screens/tools/tool-details");
53
51
  const tool_list_1 = require("../screens/tools/tool-list");
54
52
  const variable_details_1 = require("../screens/variables/variable-details");
55
53
  const variable_list_1 = require("../screens/variables/variable-list");
56
- const workflow_details_1 = require("../screens/workflows/workflow-details");
57
- const workflow_list_1 = require("../screens/workflows/workflow-list");
58
54
  const ui_loader_1 = require("../ui-router/ui-loader");
59
- const channel_view_1 = require("./messages/channel-view");
60
- const thread_message_list_1 = require("./messages/thread-message-list");
61
55
  require("../screens/console-logs/console-logs-list");
62
56
  require("../screens/identity");
63
57
  require("../screens/network-viewer");
64
58
  require("../screens/data-explorer");
59
+ require("../notifications");
65
60
  /** Render the built-in or registered UI that owns a canonicalized route. */
66
61
  function Router({ path: providedPath } = {}) {
67
62
  // Hooks must run unconditionally (same order every render)
@@ -87,29 +82,10 @@ function Router({ path: providedPath } = {}) {
87
82
  if (path === "settings" || path === "profile") {
88
83
  return (0, jsx_runtime_1.jsx)(settings_page_1.SettingsPage, {});
89
84
  }
90
- if (path === "threads" || path === "") {
91
- return (0, jsx_runtime_1.jsx)(channel_view_1.ChannelMessages, {});
92
- }
93
85
  const ui = (0, ui_loader_1.UIRouter)({ path, props: {}, uiCategory: "screen" });
94
86
  if (ui) {
95
87
  return ui;
96
88
  }
97
- if (path.match(/^channel\//)) {
98
- const parts = path.split("/");
99
- parts.shift();
100
- const channelId = parts[0];
101
- // todo add additional params as props if they exist
102
- return (0, jsx_runtime_1.jsx)(channel_view_1.ChannelMessages, { channelId: channelId });
103
- }
104
- if (path === "assistants") {
105
- return (0, jsx_runtime_1.jsx)(assistant_list_1.AssistantList, {});
106
- }
107
- if (path.match(/^assistants\//)) {
108
- const parts = path.split("/");
109
- parts.shift();
110
- const id = parts[0];
111
- return (0, jsx_runtime_1.jsx)(assistant_details_1.AssistantDetails, { assistantId: id });
112
- }
113
89
  // if (path === 'tasks') {
114
90
  // return <TaskList />;
115
91
  // }
@@ -119,15 +95,6 @@ function Router({ path: providedPath } = {}) {
119
95
  // const taskId = parts[0];
120
96
  // return <TaskDetails taskId={taskId} />;
121
97
  // }
122
- if (path === "workflows") {
123
- return (0, jsx_runtime_1.jsx)(workflow_list_1.WorkflowList, {});
124
- }
125
- if (path.match(/^workflows\//)) {
126
- const parts = path.split("/");
127
- parts.shift();
128
- const workflowId = parts[0];
129
- return (0, jsx_runtime_1.jsx)(workflow_details_1.WorkflowDetails, { workflowId: workflowId });
130
- }
131
98
  // Saved tabs from the removed tool-test screens fall back to the catalog.
132
99
  if (path === "tools" || /^tools\/tests(?:\/|$)/.test(path)) {
133
100
  return (0, jsx_runtime_1.jsx)(tool_list_1.ToolList, {});
@@ -168,15 +135,9 @@ function Router({ path: providedPath } = {}) {
168
135
  const id = parts[0];
169
136
  return (0, jsx_runtime_1.jsx)(peer_type_details_1.PeerTypeDetails, { peerTypeId: id });
170
137
  }
171
- if (path.match(/^threads\//)) {
172
- const parts = path.split("/");
173
- parts.shift();
174
- const threadId = parts[0];
175
- return (0, jsx_runtime_1.jsx)(thread_message_list_1.ThreadMessageList, { threadId: threadId });
176
- }
177
138
  throw new Error(`Unrecognized route: ${originalPath}`);
178
139
  }
179
140
  catch (err) {
180
- return ((0, jsx_runtime_1.jsxs)("div", { className: "p-3", children: [(0, jsx_runtime_1.jsx)("a", { href: "#threads", children: "Home" }), (0, jsx_runtime_1.jsx)("h3", { children: "Error loading route" }), (0, jsx_runtime_1.jsxs)("pre", { children: ["route: ", `${globals.mainContentPath()}\n`, String(err)] })] }));
141
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "p-3", children: [(0, jsx_runtime_1.jsx)("a", { href: "#", children: "Home" }), (0, jsx_runtime_1.jsx)("h3", { children: "Error loading route" }), (0, jsx_runtime_1.jsxs)("pre", { children: ["route: ", `${globals.mainContentPath()}\n`, String(err)] })] }));
181
142
  }
182
143
  }
package/dist/globals.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type IMessage, type IUser } from "@peers-app/peers-sdk";
1
+ import { type IUser } from "@peers-app/peers-sdk";
2
2
  /** Counter incremented when installed package UI should reload. */
3
3
  export declare const packageReloaded: import("@peers-app/peers-sdk").Observable<number>;
4
4
  /** Persisted route for the active data context. Prefer {@link mainContentPath}. */
@@ -7,10 +7,6 @@ export declare const _mainContentPath: import("@peers-app/peers-sdk").Persistent
7
7
  export declare const mainContentPath: import("@peers-app/peers-sdk").Observable<string>;
8
8
  /** Read or update one query parameter on {@link mainContentPath}. */
9
9
  export declare function queryParam(name: string, value?: string): string;
10
- /** Open a message thread in its owning app tab. */
11
- export declare function openThread(thread: string | IMessage): Promise<void>;
12
- /** Resolve a message and open its root thread in a new tab. */
13
- export declare function openThreadInTab(thread: string | IMessage): Promise<void>;
14
10
  /** Signed profile for the active user after {@link loadGlobals}. */
15
11
  export declare let me: IUser;
16
12
  /** Current browser viewport width. */
@@ -29,8 +25,8 @@ export declare const groups: import("@peers-app/peers-sdk").Observable<{
29
25
  groupId: string;
30
26
  founderUserId: string;
31
27
  disabled?: boolean | undefined;
32
- iconClassName?: string | undefined;
33
28
  signedAt?: number | undefined;
29
+ iconClassName?: string | undefined;
34
30
  publicRole?: import("@peers-app/peers-sdk").GroupMemberRole | undefined;
35
31
  fileRetention?: {
36
32
  days: number | "never";
package/dist/globals.js CHANGED
@@ -2,15 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.groups = exports.isDesktop = exports.windowHeight = exports.windowWidth = exports.me = exports.mainContentPath = exports._mainContentPath = exports.packageReloaded = void 0;
4
4
  exports.queryParam = queryParam;
5
- exports.openThread = openThread;
6
- exports.openThreadInTab = openThreadInTab;
7
5
  exports.initializeHashNavigation = initializeHashNavigation;
8
6
  exports.loadGlobals = loadGlobals;
9
7
  const peers_sdk_1 = require("@peers-app/peers-sdk");
10
8
  const identity_routes_1 = require("./screens/identity/identity-routes");
11
9
  const packages_ipc_1 = require("./screens/packages/packages-ipc");
12
10
  const tabs_state_1 = require("./tabs-layout/tabs-state");
13
- const utils_1 = require("./utils");
14
11
  /** Counter incremented when installed package UI should reload. */
15
12
  exports.packageReloaded = (0, peers_sdk_1.observable)(0);
16
13
  /** Persisted route for the active data context. Prefer {@link mainContentPath}. */
@@ -64,38 +61,6 @@ function queryParam(name, value) {
64
61
  }
65
62
  return params[name];
66
63
  }
67
- /** Open a message thread in its owning app tab. */
68
- async function openThread(thread) {
69
- openThreadInTab(thread);
70
- }
71
- /** Resolve a message and open its root thread in a new tab. */
72
- async function openThreadInTab(thread) {
73
- const threadId = typeof thread === "string" ? thread : thread.messageId;
74
- const message = await (0, peers_sdk_1.Messages)().get(threadId);
75
- if (!message) {
76
- console.warn("Thread message not found:", threadId);
77
- return;
78
- }
79
- // Use parent message ID if this is a reply, otherwise use the message itself
80
- const actualThreadId = message.messageParentId || message.messageId;
81
- // Generate thread title from message content (strip mentions and clean formatting)
82
- const cleanMessage = (0, utils_1.stripMentions)(message.message);
83
- const messagePreview = cleanMessage.slice(0, 30);
84
- const threadTitle = `${messagePreview}${cleanMessage.length > 30 ? "..." : ""}` || `Thread`;
85
- // // Import openNewTab dynamically to avoid circular dependency
86
- // const { openNewTab } = await import('./tabs-layout/tabs-layout');
87
- (0, tabs_state_1.openNewTab)({
88
- packageId: "system-apps",
89
- path: `threads/${actualThreadId}`,
90
- title: threadTitle,
91
- iconClassName: "bi-chat-dots",
92
- });
93
- }
94
- // A notification clicked in the desktop app's main process opens its thread here.
95
- (0, peers_sdk_1.subscribe)("ui:openThread", (event) => {
96
- if (event.data?.threadId)
97
- void openThread(event.data.threadId);
98
- });
99
64
  /** Signed profile for the active user after {@link loadGlobals}. */
100
65
  exports.me = null;
101
66
  /** Current browser viewport width. */
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export * from "./hooks";
13
13
  export { openLink } from "./host-shell/host-shell-consumer";
14
14
  export * from "./local-network/local-network-access";
15
15
  export * from "./local-network/local-network-offer";
16
+ export { type INotificationHostControls, type NotificationHostState, notificationHostControls, } from "./notifications/host-controls";
16
17
  export * from "./operator-console/operator-console";
17
18
  export * from "./operator-console/operator-console-state";
18
19
  export { type GlobalOverlay, globalOverlays, registerGlobalOverlay, unregisterGlobalOverlay, } from "./root-layout/global-overlays";
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.updateActiveTabTitle = exports.goToTabPath = exports.closeCurrentTab = exports.activeTabs = exports.activeTabId = exports.setRootLayout = exports.selectedRootLayoutId = exports.getRootLayouts = exports.getRootLayout = exports.DEFAULT_ROOT_LAYOUT_ID = exports.TabsLayoutApp = exports.RootLayoutHost = exports.LayoutPicker = exports.unregisterGlobalOverlay = exports.registerGlobalOverlay = exports.globalOverlays = exports.openLink = exports.mainContentPath = exports.isDesktop = exports.Typeahead = exports.MarkdownEditor = void 0;
17
+ exports.updateActiveTabTitle = exports.goToTabPath = exports.closeCurrentTab = exports.activeTabs = exports.activeTabId = exports.setRootLayout = exports.selectedRootLayoutId = exports.getRootLayouts = exports.getRootLayout = exports.DEFAULT_ROOT_LAYOUT_ID = exports.TabsLayoutApp = exports.RootLayoutHost = exports.LayoutPicker = exports.unregisterGlobalOverlay = exports.registerGlobalOverlay = exports.globalOverlays = exports.notificationHostControls = exports.openLink = exports.mainContentPath = exports.isDesktop = exports.Typeahead = exports.MarkdownEditor = void 0;
18
18
  __exportStar(require("./components/data-grid"), exports);
19
19
  __exportStar(require("./components/inverse-lazy-list"), exports);
20
20
  var editor_1 = require("./components/markdown-editor/editor");
@@ -34,6 +34,8 @@ var host_shell_consumer_1 = require("./host-shell/host-shell-consumer");
34
34
  Object.defineProperty(exports, "openLink", { enumerable: true, get: function () { return host_shell_consumer_1.openLink; } });
35
35
  __exportStar(require("./local-network/local-network-access"), exports);
36
36
  __exportStar(require("./local-network/local-network-offer"), exports);
37
+ var host_controls_1 = require("./notifications/host-controls");
38
+ Object.defineProperty(exports, "notificationHostControls", { enumerable: true, get: function () { return host_controls_1.notificationHostControls; } });
37
39
  __exportStar(require("./operator-console/operator-console"), exports);
38
40
  __exportStar(require("./operator-console/operator-console-state"), exports);
39
41
  var global_overlays_1 = require("./root-layout/global-overlays");
@@ -9,14 +9,10 @@ export interface IMentionConfig {
9
9
  picture?: (data: IMentionData) => JSX.Element;
10
10
  onClick?: (data: IMentionData) => void;
11
11
  }
12
- /** Discover workflow-invocable tools while keeping historical mention IDs readable. */
12
+ /** Discover catalog tools while keeping historical mention IDs readable. */
13
13
  export declare const toolMentionConfig: IMentionConfig;
14
14
  /** Discover users and resolve persisted user mentions. */
15
15
  export declare const userMentionConfig: IMentionConfig;
16
- /** Discover assistants and resolve persisted assistant mentions. */
17
- export declare const assistantMentionConfig: IMentionConfig;
18
- /** Discover workflows and resolve persisted workflow mentions. */
19
- export declare const workflowMentionConfig: IMentionConfig;
20
16
  /** Discover data types and navigate to their definitions. */
21
17
  export declare const valueTypeMentionConfig: IMentionConfig;
22
18
  /** Shared mention definitions used by editors and rendered messages. */
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mentionConfigs = exports.valueTypeMentionConfig = exports.workflowMentionConfig = exports.assistantMentionConfig = exports.userMentionConfig = exports.toolMentionConfig = void 0;
3
+ exports.mentionConfigs = exports.valueTypeMentionConfig = exports.userMentionConfig = exports.toolMentionConfig = void 0;
4
4
  const peers_sdk_1 = require("@peers-app/peers-sdk");
5
5
  const globals_1 = require("./globals");
6
6
  const tool_catalog_ipc_1 = require("./screens/tools/tool-catalog-ipc");
7
7
  const MENTIONS_MAX_RESULTS = 10;
8
- /** Discover workflow-invocable tools while keeping historical mention IDs readable. */
8
+ /** Discover catalog tools while keeping historical mention IDs readable. */
9
9
  exports.toolMentionConfig = {
10
10
  kind: "tool",
11
11
  iconClass: "bi bi-tools",
12
12
  styleClass: "mention-tool",
13
13
  query: async (search) => {
14
- const results = await (0, tool_catalog_ipc_1.listWorkflowMentionTools)(search, MENTIONS_MAX_RESULTS);
14
+ const results = await (0, tool_catalog_ipc_1.listMentionTools)(search, MENTIONS_MAX_RESULTS);
15
15
  return results.map((p) => ({
16
16
  kind: "tool",
17
17
  id: p.toolId,
@@ -48,50 +48,6 @@ exports.userMentionConfig = {
48
48
  name: item.name,
49
49
  }),
50
50
  };
51
- /** Discover assistants and resolve persisted assistant mentions. */
52
- exports.assistantMentionConfig = {
53
- kind: "assistant",
54
- iconClass: "bi bi-person-fill-gear",
55
- styleClass: "mention-assistant",
56
- query: async (search) => {
57
- return (0, peers_sdk_1.Assistants)()
58
- .list({ name: { $matchWords: search } }, { pageSize: MENTIONS_MAX_RESULTS })
59
- .then((assistants) => assistants.map((assistant) => ({
60
- kind: "assistant",
61
- id: assistant.assistantId,
62
- name: assistant.name,
63
- })));
64
- },
65
- getById: (id) => (0, peers_sdk_1.Assistants)()
66
- .get(id)
67
- .then((item) => item && {
68
- kind: "assistant",
69
- id: item.assistantId,
70
- name: item.name,
71
- }),
72
- };
73
- /** Discover workflows and resolve persisted workflow mentions. */
74
- exports.workflowMentionConfig = {
75
- kind: "workflow",
76
- iconClass: "bi bi-database-fill-gear",
77
- styleClass: "mention-workflow",
78
- query: async (search) => {
79
- return (0, peers_sdk_1.Workflows)()
80
- .list({ name: { $matchWords: search } }, { pageSize: MENTIONS_MAX_RESULTS })
81
- .then((workflows) => workflows.map((workflow) => ({
82
- kind: "workflow",
83
- id: workflow.workflowId,
84
- name: workflow.name,
85
- })));
86
- },
87
- getById: (id) => (0, peers_sdk_1.Workflows)()
88
- .get(id)
89
- .then((item) => item && {
90
- kind: "workflow",
91
- id: item.workflowId,
92
- name: item.name,
93
- }),
94
- };
95
51
  /** Discover data types and navigate to their definitions. */
96
52
  exports.valueTypeMentionConfig = {
97
53
  kind: "type",
@@ -123,10 +79,4 @@ exports.valueTypeMentionConfig = {
123
79
  // }))),
124
80
  // picture = <i className="bi bi-list-task pe-1" />;
125
81
  /** Shared mention definitions used by editors and rendered messages. */
126
- exports.mentionConfigs = [
127
- exports.toolMentionConfig,
128
- exports.userMentionConfig,
129
- exports.assistantMentionConfig,
130
- exports.workflowMentionConfig,
131
- exports.valueTypeMentionConfig,
132
- ];
82
+ exports.mentionConfigs = [exports.toolMentionConfig, exports.userMentionConfig, exports.valueTypeMentionConfig];
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Whether this device can show the user's notifications outside the Peers window.
3
+ *
4
+ * - `unsupported`: the browser or host has no notification API.
5
+ * - `blocked`: the user denied permission; only the browser's site settings can undo that.
6
+ * - `off`: not enabled yet; `enable` asks for permission.
7
+ * - `on`: notifications show on this device; `disable` turns them off again.
8
+ */
9
+ export type NotificationHostState = "unsupported" | "blocked" | "off" | "on";
10
+ /**
11
+ * What a host offers the Notifications settings screen for this device.
12
+ *
13
+ * The desktop app needs nothing here: its OS notifications need no permission. The PWA sets
14
+ * this so Settings can ask the browser for notification permission and subscribe to push.
15
+ */
16
+ export interface INotificationHostControls {
17
+ state: NotificationHostState;
18
+ /** One line under the heading, for example what happens when the app is closed. */
19
+ description: string;
20
+ /** Something the user should know about the current state, such as how to unblock. */
21
+ detail?: string;
22
+ /** Turn notifications on for this device. Called from a click, so it may ask for permission. */
23
+ enable?: () => Promise<void>;
24
+ /** Turn them off again. */
25
+ disable?: () => Promise<void>;
26
+ }
27
+ /**
28
+ * The host's per-device notification controls, shown in Notifications → Settings under "This
29
+ * device" when set. A host that has none leaves it `undefined`.
30
+ */
31
+ export declare const notificationHostControls: import("@peers-app/peers-sdk").Observable<INotificationHostControls | undefined>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.notificationHostControls = void 0;
4
+ const peers_sdk_1 = require("@peers-app/peers-sdk");
5
+ /**
6
+ * The host's per-device notification controls, shown in Notifications → Settings under "This
7
+ * device" when set. A host that has none leaves it `undefined`.
8
+ */
9
+ exports.notificationHostControls = (0, peers_sdk_1.observable)(undefined);
@@ -0,0 +1,4 @@
1
+ import "./notifications-screen";
2
+ import "./priority-alert";
3
+ export { NotificationBell } from "./notification-bell";
4
+ export { NOTIFICATIONS_PATH, notificationsContract, openNotification, openNotificationById, useNotificationSummary, } from "./notifications-client";
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useNotificationSummary = exports.openNotificationById = exports.openNotification = exports.notificationsContract = exports.NOTIFICATIONS_PATH = exports.NotificationBell = void 0;
4
+ const peers_sdk_1 = require("@peers-app/peers-sdk");
5
+ const notifications_client_1 = require("./notifications-client");
6
+ require("./notifications-screen");
7
+ require("./priority-alert");
8
+ var notification_bell_1 = require("./notification-bell");
9
+ Object.defineProperty(exports, "NotificationBell", { enumerable: true, get: function () { return notification_bell_1.NotificationBell; } });
10
+ var notifications_client_2 = require("./notifications-client");
11
+ Object.defineProperty(exports, "NOTIFICATIONS_PATH", { enumerable: true, get: function () { return notifications_client_2.NOTIFICATIONS_PATH; } });
12
+ Object.defineProperty(exports, "notificationsContract", { enumerable: true, get: function () { return notifications_client_2.notificationsContract; } });
13
+ Object.defineProperty(exports, "openNotification", { enumerable: true, get: function () { return notifications_client_2.openNotification; } });
14
+ Object.defineProperty(exports, "openNotificationById", { enumerable: true, get: function () { return notifications_client_2.openNotificationById; } });
15
+ Object.defineProperty(exports, "useNotificationSummary", { enumerable: true, get: function () { return notifications_client_2.useNotificationSummary; } });
16
+ // A notification clicked in the desktop app's main process opens what it's about here.
17
+ (0, peers_sdk_1.subscribe)("ui:openNotification", (event) => {
18
+ if (event.data?.notificationId)
19
+ void (0, notifications_client_1.openNotificationById)(event.data.notificationId);
20
+ });