@peers-app/peers-ui 0.27.3 → 0.27.4

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 (309) hide show
  1. package/dist/screens/network-viewer/network-viewer-ipc.d.ts +3 -1
  2. package/dist/screens/network-viewer/network-viewer-ipc.js +6 -0
  3. package/dist/screens/network-viewer/sync-recovery.js +103 -1
  4. package/dist/screens/variables/variable-details.js +2 -1
  5. package/dist/tabs-layout/network-status-indicator.js +26 -12
  6. package/dist/tabs-layout/use-network-status.d.ts +6 -1
  7. package/dist/tabs-layout/use-network-status.js +27 -4
  8. package/package.json +9 -3
  9. package/.claude/settings.local.json +0 -34
  10. package/.github/README.md +0 -52
  11. package/.github/workflows/delete-all-artifacts.yml +0 -49
  12. package/.github/workflows/publish.yml +0 -51
  13. package/babel.config.js +0 -7
  14. package/biome.json +0 -198
  15. package/dist/app-updates/app-updates-consumer.test.d.ts +0 -1
  16. package/dist/app-updates/app-updates-consumer.test.js +0 -56
  17. package/dist/app-updates/app-updates-settings.test.d.ts +0 -1
  18. package/dist/app-updates/app-updates-settings.test.js +0 -93
  19. package/dist/app-updates/remote-app-update-panel.test.d.ts +0 -1
  20. package/dist/app-updates/remote-app-update-panel.test.js +0 -165
  21. package/dist/components/access-level-field.test.d.ts +0 -1
  22. package/dist/components/access-level-field.test.js +0 -28
  23. package/dist/components/message-logs/tool-access-approval-card.test.d.ts +0 -1
  24. package/dist/components/message-logs/tool-access-approval-card.test.js +0 -102
  25. package/dist/components/responsive-section-nav.test.d.ts +0 -1
  26. package/dist/components/responsive-section-nav.test.js +0 -45
  27. package/dist/globals-hash.test.d.ts +0 -1
  28. package/dist/globals-hash.test.js +0 -16
  29. package/dist/hooks/use-observable-state.test.d.ts +0 -1
  30. package/dist/hooks/use-observable-state.test.js +0 -64
  31. package/dist/hooks/use-observable.test.d.ts +0 -1
  32. package/dist/hooks/use-observable.test.js +0 -191
  33. package/dist/hooks/use-rows.test.d.ts +0 -1
  34. package/dist/hooks/use-rows.test.js +0 -175
  35. package/dist/hooks/use-tool.test.d.ts +0 -1
  36. package/dist/hooks/use-tool.test.js +0 -190
  37. package/dist/host-shell/host-shell-consumer.test.d.ts +0 -1
  38. package/dist/host-shell/host-shell-consumer.test.js +0 -28
  39. package/dist/root-layout/root-layout-host.test.d.ts +0 -1
  40. package/dist/root-layout/root-layout-host.test.js +0 -86
  41. package/dist/screens/account/account-screen.test.d.ts +0 -1
  42. package/dist/screens/account/account-screen.test.js +0 -51
  43. package/dist/screens/assistants/assistant-config.test.d.ts +0 -1
  44. package/dist/screens/assistants/assistant-config.test.js +0 -57
  45. package/dist/screens/contacts/contact-list.test.d.ts +0 -1
  46. package/dist/screens/contacts/contact-list.test.js +0 -48
  47. package/dist/screens/device-pairing/device-pairing.test.d.ts +0 -1
  48. package/dist/screens/device-pairing/device-pairing.test.js +0 -119
  49. package/dist/screens/devices/devices-list.test.d.ts +0 -1
  50. package/dist/screens/devices/devices-list.test.js +0 -53
  51. package/dist/screens/groups/group-list.test.d.ts +0 -1
  52. package/dist/screens/groups/group-list.test.js +0 -38
  53. package/dist/screens/identity/identity-routes.test.d.ts +0 -1
  54. package/dist/screens/identity/identity-routes.test.js +0 -51
  55. package/dist/screens/identity/identity-screen.test.d.ts +0 -1
  56. package/dist/screens/identity/identity-screen.test.js +0 -103
  57. package/dist/screens/invites/accept-invite.test.d.ts +0 -1
  58. package/dist/screens/invites/accept-invite.test.js +0 -103
  59. package/dist/screens/invites/activity-view.test.d.ts +0 -1
  60. package/dist/screens/invites/activity-view.test.js +0 -108
  61. package/dist/screens/invites/invite-classify.test.d.ts +0 -1
  62. package/dist/screens/invites/invite-classify.test.js +0 -115
  63. package/dist/screens/network-viewer/network-viewer-ipc.test.d.ts +0 -1
  64. package/dist/screens/network-viewer/network-viewer-ipc.test.js +0 -61
  65. package/dist/screens/network-viewer/network-viewer.section.test.d.ts +0 -1
  66. package/dist/screens/network-viewer/network-viewer.section.test.js +0 -63
  67. package/dist/screens/network-viewer/sync-recovery.test.d.ts +0 -1
  68. package/dist/screens/network-viewer/sync-recovery.test.js +0 -104
  69. package/dist/screens/packages/package-helpers.test.d.ts +0 -1
  70. package/dist/screens/packages/package-helpers.test.js +0 -53
  71. package/dist/screens/packages/package-runtime-status.test.d.ts +0 -1
  72. package/dist/screens/packages/package-runtime-status.test.js +0 -50
  73. package/dist/screens/packages/packages-ipc.test.d.ts +0 -1
  74. package/dist/screens/packages/packages-ipc.test.js +0 -43
  75. package/dist/screens/settings/settings-page.test.d.ts +0 -1
  76. package/dist/screens/settings/settings-page.test.js +0 -19
  77. package/dist/screens/tools/tool-access-ipc.test.d.ts +0 -1
  78. package/dist/screens/tools/tool-access-ipc.test.js +0 -40
  79. package/dist/screens/tools/tool-catalog-ipc.test.d.ts +0 -1
  80. package/dist/screens/tools/tool-catalog-ipc.test.js +0 -52
  81. package/dist/tabs-layout/network-status-indicator.test.d.ts +0 -1
  82. package/dist/tabs-layout/network-status-indicator.test.js +0 -665
  83. package/dist/tabs-layout/tabs-state.test.d.ts +0 -1
  84. package/dist/tabs-layout/tabs-state.test.js +0 -110
  85. package/dist/tabs-layout/use-network-status.test.d.ts +0 -1
  86. package/dist/tabs-layout/use-network-status.test.js +0 -45
  87. package/dist/ui-router/ui-loader.test.d.ts +0 -1
  88. package/dist/ui-router/ui-loader.test.js +0 -91
  89. package/jest.config.js +0 -25
  90. package/release-guard.js +0 -10
  91. package/src/app-updates/app-update-controls.tsx +0 -73
  92. package/src/app-updates/app-updates-consumer.test.ts +0 -83
  93. package/src/app-updates/app-updates-consumer.ts +0 -121
  94. package/src/app-updates/app-updates-settings.test.tsx +0 -109
  95. package/src/app-updates/app-updates-settings.tsx +0 -136
  96. package/src/app-updates/remote-app-update-panel.test.tsx +0 -205
  97. package/src/app-updates/remote-app-update-panel.tsx +0 -210
  98. package/src/app-updates/use-app-update-status.ts +0 -16
  99. package/src/command-palette/command-palette-ui.tsx +0 -564
  100. package/src/command-palette/command-palette.ts +0 -242
  101. package/src/components/access-level-field.test.tsx +0 -32
  102. package/src/components/access-level-field.tsx +0 -68
  103. package/src/components/checkbox.tsx +0 -25
  104. package/src/components/group-switcher.tsx +0 -526
  105. package/src/components/input-date.tsx +0 -29
  106. package/src/components/input-number.tsx +0 -83
  107. package/src/components/input.tsx +0 -25
  108. package/src/components/inverse-lazy-list.tsx +0 -107
  109. package/src/components/io-schema-values.tsx +0 -103
  110. package/src/components/io-schema.tsx +0 -259
  111. package/src/components/lazy-list.tsx +0 -115
  112. package/src/components/list-screen.tsx +0 -126
  113. package/src/components/loading-indicator.tsx +0 -7
  114. package/src/components/markdown-editor/autolink-plugin.tsx +0 -29
  115. package/src/components/markdown-editor/editor-inline.tsx +0 -9
  116. package/src/components/markdown-editor/editor.tsx +0 -158
  117. package/src/components/markdown-editor/markdown-plugin.tsx +0 -202
  118. package/src/components/markdown-editor/mention-node.ts +0 -204
  119. package/src/components/markdown-editor/mentions-plugin.tsx +0 -354
  120. package/src/components/markdown-editor/move-line-plugin.tsx +0 -186
  121. package/src/components/markdown-editor/select-line-boundary-plugin.tsx +0 -95
  122. package/src/components/markdown-editor/theme.ts +0 -46
  123. package/src/components/markdown-editor/toolbar.tsx +0 -269
  124. package/src/components/markdown-with-mentions.tsx +0 -198
  125. package/src/components/message-logs/message-logs.tsx +0 -523
  126. package/src/components/message-logs/tool-access-approval-card.test.tsx +0 -127
  127. package/src/components/message-logs/tool-access-approval-card.tsx +0 -178
  128. package/src/components/messages/avatar.tsx +0 -171
  129. package/src/components/messages/channel-message-list.tsx +0 -189
  130. package/src/components/messages/channel-view.tsx +0 -92
  131. package/src/components/messages/message-compose.tsx +0 -192
  132. package/src/components/messages/message-display.tsx +0 -231
  133. package/src/components/messages/thread-message-list.tsx +0 -135
  134. package/src/components/qr-scanner.tsx +0 -180
  135. package/src/components/responsive-section-nav.test.tsx +0 -88
  136. package/src/components/responsive-section-nav.tsx +0 -92
  137. package/src/components/router.tsx +0 -175
  138. package/src/components/save-button.tsx +0 -134
  139. package/src/components/sortable-list.tsx +0 -130
  140. package/src/components/tabs.tsx +0 -76
  141. package/src/components/tooltip.tsx +0 -43
  142. package/src/components/trust-level-badge.tsx +0 -44
  143. package/src/components/trust-level-dropdown.tsx +0 -136
  144. package/src/components/typeahead.tsx +0 -357
  145. package/src/globals-hash.test.ts +0 -19
  146. package/src/globals.tsx +0 -226
  147. package/src/hooks/index.ts +0 -8
  148. package/src/hooks/use-host-contract.ts +0 -75
  149. package/src/hooks/use-observable-state.test.tsx +0 -101
  150. package/src/hooks/use-observable-state.ts +0 -29
  151. package/src/hooks/use-observable.test.tsx +0 -258
  152. package/src/hooks/use-observable.ts +0 -67
  153. package/src/hooks/use-on-screen.ts +0 -24
  154. package/src/hooks/use-promise.ts +0 -34
  155. package/src/hooks/use-rows.test.tsx +0 -196
  156. package/src/hooks/use-rows.ts +0 -120
  157. package/src/hooks/use-subscription.ts +0 -24
  158. package/src/hooks/use-tool.test.tsx +0 -225
  159. package/src/hooks/use-tool.ts +0 -116
  160. package/src/host-shell/host-shell-consumer.test.ts +0 -32
  161. package/src/host-shell/host-shell-consumer.ts +0 -53
  162. package/src/index.tsx +0 -42
  163. package/src/mention-configs.ts +0 -185
  164. package/src/operator-console/operator-console-state.ts +0 -119
  165. package/src/operator-console/operator-console.tsx +0 -233
  166. package/src/peers-services-registration.ts +0 -6
  167. package/src/root-layout/global-overlays.ts +0 -50
  168. package/src/root-layout/layout-picker.tsx +0 -47
  169. package/src/root-layout/layouts/full-screen-layout.tsx +0 -144
  170. package/src/root-layout/layouts/tabs-with-console-layout.tsx +0 -260
  171. package/src/root-layout/root-layout-host.test.tsx +0 -108
  172. package/src/root-layout/root-layout-host.tsx +0 -147
  173. package/src/root-layout/root-layout-registry.ts +0 -51
  174. package/src/root-layout/root-layout-state.ts +0 -55
  175. package/src/root-layout/root-layout.ts +0 -32
  176. package/src/screens/account/account-screen.test.tsx +0 -65
  177. package/src/screens/account/account-screen.tsx +0 -942
  178. package/src/screens/assistants/assistant-config.test.tsx +0 -54
  179. package/src/screens/assistants/assistant-config.tsx +0 -121
  180. package/src/screens/assistants/assistant-details.tsx +0 -89
  181. package/src/screens/assistants/assistant-info.tsx +0 -66
  182. package/src/screens/assistants/assistant-list.tsx +0 -145
  183. package/src/screens/assistants/assistant-tools.tsx +0 -82
  184. package/src/screens/console-logs/console-logs-list.tsx +0 -374
  185. package/src/screens/console-logs/log-display.tsx +0 -137
  186. package/src/screens/console-logs/log-filters.tsx +0 -64
  187. package/src/screens/console-logs/mobile-log-card.tsx +0 -161
  188. package/src/screens/console-logs/resizable-table-header.tsx +0 -110
  189. package/src/screens/contacts/contact-details.tsx +0 -123
  190. package/src/screens/contacts/contact-list.test.tsx +0 -59
  191. package/src/screens/contacts/contact-list.tsx +0 -286
  192. package/src/screens/contacts/index.ts +0 -2
  193. package/src/screens/data-explorer/data-explorer.tsx +0 -633
  194. package/src/screens/data-explorer/index.ts +0 -6
  195. package/src/screens/data-explorer/query-executor.tsx +0 -520
  196. package/src/screens/device-pairing/device-pairing.test.tsx +0 -143
  197. package/src/screens/device-pairing/device-pairing.tsx +0 -461
  198. package/src/screens/device-pairing/identity-ipc.ts +0 -25
  199. package/src/screens/device-pairing/index.ts +0 -2
  200. package/src/screens/device-pairing/use-device-pairing-state.ts +0 -15
  201. package/src/screens/devices/devices-list.test.tsx +0 -68
  202. package/src/screens/devices/devices-list.tsx +0 -365
  203. package/src/screens/devices/index.ts +0 -1
  204. package/src/screens/groups/group-details.tsx +0 -160
  205. package/src/screens/groups/group-invite-panel.tsx +0 -311
  206. package/src/screens/groups/group-list.test.tsx +0 -44
  207. package/src/screens/groups/group-list.tsx +0 -317
  208. package/src/screens/groups/group-members.tsx +0 -343
  209. package/src/screens/groups/index.ts +0 -3
  210. package/src/screens/identity/identity-routes.test.ts +0 -70
  211. package/src/screens/identity/identity-routes.ts +0 -301
  212. package/src/screens/identity/identity-screen.test.tsx +0 -138
  213. package/src/screens/identity/identity-screen.tsx +0 -282
  214. package/src/screens/identity/index.ts +0 -2
  215. package/src/screens/identity/invite-contact-panel.tsx +0 -45
  216. package/src/screens/identity/profile-invite.tsx +0 -93
  217. package/src/screens/invites/accept-invite.test.tsx +0 -115
  218. package/src/screens/invites/accept-invite.tsx +0 -318
  219. package/src/screens/invites/activity-view.test.tsx +0 -127
  220. package/src/screens/invites/activity-view.tsx +0 -162
  221. package/src/screens/invites/index.ts +0 -6
  222. package/src/screens/invites/invite-capture.ts +0 -104
  223. package/src/screens/invites/invite-classify.test.ts +0 -129
  224. package/src/screens/invites/invite-share.tsx +0 -104
  225. package/src/screens/invites/invites-ipc.ts +0 -25
  226. package/src/screens/invites/pending-invites-list.tsx +0 -256
  227. package/src/screens/network-viewer/connection-troubleshooter.tsx +0 -395
  228. package/src/screens/network-viewer/cpu-usage-graph.tsx +0 -294
  229. package/src/screens/network-viewer/device-details-modal.tsx +0 -339
  230. package/src/screens/network-viewer/group-details-modal.tsx +0 -421
  231. package/src/screens/network-viewer/index.ts +0 -8
  232. package/src/screens/network-viewer/network-viewer-ipc.test.ts +0 -72
  233. package/src/screens/network-viewer/network-viewer-ipc.ts +0 -39
  234. package/src/screens/network-viewer/network-viewer-section.ts +0 -12
  235. package/src/screens/network-viewer/network-viewer.section.test.tsx +0 -68
  236. package/src/screens/network-viewer/network-viewer.tsx +0 -708
  237. package/src/screens/network-viewer/remote-logs-panel.tsx +0 -190
  238. package/src/screens/network-viewer/sync-recovery.test.tsx +0 -114
  239. package/src/screens/network-viewer/sync-recovery.tsx +0 -461
  240. package/src/screens/network-viewer/usage-graph.tsx +0 -455
  241. package/src/screens/packages/local-folder-grants-panel.tsx +0 -290
  242. package/src/screens/packages/local-folders-ipc.ts +0 -28
  243. package/src/screens/packages/package-details.tsx +0 -166
  244. package/src/screens/packages/package-helpers.test.ts +0 -57
  245. package/src/screens/packages/package-helpers.ts +0 -137
  246. package/src/screens/packages/package-info.tsx +0 -354
  247. package/src/screens/packages/package-list.tsx +0 -519
  248. package/src/screens/packages/package-network-panel.tsx +0 -82
  249. package/src/screens/packages/package-new-local.tsx +0 -100
  250. package/src/screens/packages/package-runtime-status.test.tsx +0 -58
  251. package/src/screens/packages/package-runtime-status.tsx +0 -68
  252. package/src/screens/packages/package-versions.tsx +0 -298
  253. package/src/screens/packages/packages-ipc.test.ts +0 -47
  254. package/src/screens/packages/packages-ipc.ts +0 -125
  255. package/src/screens/peer-types/peer-type-details.tsx +0 -172
  256. package/src/screens/peer-types/peer-type-list.tsx +0 -64
  257. package/src/screens/search/global-search.tsx +0 -406
  258. package/src/screens/settings/color-mode-dropdown.tsx +0 -82
  259. package/src/screens/settings/settings-page.test.tsx +0 -24
  260. package/src/screens/settings/settings-page.tsx +0 -426
  261. package/src/screens/setup-user.tsx +0 -355
  262. package/src/screens/tools/tool-access-ipc.test.ts +0 -55
  263. package/src/screens/tools/tool-access-ipc.ts +0 -27
  264. package/src/screens/tools/tool-catalog-ipc.test.ts +0 -52
  265. package/src/screens/tools/tool-catalog-ipc.ts +0 -51
  266. package/src/screens/tools/tool-details.tsx +0 -52
  267. package/src/screens/tools/tool-info.tsx +0 -45
  268. package/src/screens/tools/tool-list.tsx +0 -106
  269. package/src/screens/tools/tool-schema.tsx +0 -44
  270. package/src/screens/tools/tool-test-details.tsx +0 -89
  271. package/src/screens/tools/tool-test-list.tsx +0 -73
  272. package/src/screens/variables/variable-details.tsx +0 -289
  273. package/src/screens/variables/variable-list.tsx +0 -110
  274. package/src/screens/welcome-modal.tsx +0 -294
  275. package/src/screens/workflows/workflow-details.tsx +0 -115
  276. package/src/screens/workflows/workflow-info.tsx +0 -22
  277. package/src/screens/workflows/workflow-instructions.tsx +0 -134
  278. package/src/screens/workflows/workflow-list.tsx +0 -117
  279. package/src/setupTests.ts +0 -38
  280. package/src/system-apps/assistants.app.ts +0 -7
  281. package/src/system-apps/console-logs.app.ts +0 -7
  282. package/src/system-apps/data-explorer.app.ts +0 -8
  283. package/src/system-apps/identity.app.ts +0 -9
  284. package/src/system-apps/index.ts +0 -77
  285. package/src/system-apps/mobile-settings.app.ts +0 -7
  286. package/src/system-apps/network-viewer.app.ts +0 -8
  287. package/src/system-apps/packages.app.ts +0 -7
  288. package/src/system-apps/search.app.ts +0 -8
  289. package/src/system-apps/settings.app.ts +0 -7
  290. package/src/system-apps/threads.app.ts +0 -7
  291. package/src/system-apps/tools.app.ts +0 -7
  292. package/src/system-apps/types.app.ts +0 -7
  293. package/src/system-apps/variables.app.ts +0 -7
  294. package/src/system-apps/workflows.app.ts +0 -7
  295. package/src/tabs-layout/network-status-indicator.test.tsx +0 -799
  296. package/src/tabs-layout/network-status-indicator.tsx +0 -756
  297. package/src/tabs-layout/tabs-layout.tsx +0 -857
  298. package/src/tabs-layout/tabs-state.test.ts +0 -152
  299. package/src/tabs-layout/tabs-state.ts +0 -587
  300. package/src/tabs-layout/use-network-status.test.tsx +0 -58
  301. package/src/tabs-layout/use-network-status.ts +0 -68
  302. package/src/ui-defaults/index.ts +0 -2
  303. package/src/ui-defaults/list-screen.tsx +0 -94
  304. package/src/ui-defaults/markdown-field.tsx +0 -87
  305. package/src/ui-router/routes-loader.ts +0 -193
  306. package/src/ui-router/ui-loader.test.tsx +0 -108
  307. package/src/ui-router/ui-loader.tsx +0 -606
  308. package/src/utils.ts +0 -95
  309. package/tsconfig.json +0 -18
@@ -1,54 +0,0 @@
1
- import { type IAssistant, type IDoc, observable } from "@peers-app/peers-sdk";
2
- import { fireEvent, render, screen, waitFor } from "@testing-library/react";
3
- import { AssistantConfig } from "./assistant-config";
4
-
5
- const mockRunners = [
6
- { toolId: "selected", name: "Retired", catalogState: "quarantined" },
7
- { toolId: "hidden", name: "Other unavailable", catalogState: "quarantined" },
8
- { toolId: "available", name: "Available" },
9
- ];
10
- const mockCatalog = jest.fn();
11
- jest.mock("@peers-app/peers-sdk", () => ({
12
- ...jest.requireActual("@peers-app/peers-sdk"),
13
- Tools: () => ({
14
- get: async () => mockRunners[0],
15
- list: async () => mockRunners,
16
- }),
17
- }));
18
- jest.mock("../tools/tool-catalog-ipc", () => ({
19
- getToolCatalogConsumer: () => mockCatalog(),
20
- }));
21
- jest.mock("../../components/io-schema-values", () => ({ IOSchemaValues: () => null }));
22
-
23
- test.each([
24
- "catalog",
25
- "browser fallback",
26
- ])("runner selection retains a disabled current runner in %s", async (mode) => {
27
- mockCatalog.mockReset();
28
- if (mode === "catalog")
29
- mockCatalog.mockResolvedValue({
30
- tools: {
31
- getTool: async ({ toolIdOrName }: { toolIdOrName: string }) => ({
32
- tool: { workflowInvocable: toolIdOrName === "available" },
33
- }),
34
- },
35
- });
36
- else mockCatalog.mockRejectedValue(new Error("No host transport"));
37
- const selected = observable("selected");
38
- const assistant = {
39
- assistantRunnerToolId: "selected",
40
- qs: { assistantRunnerToolId: selected },
41
- } as unknown as IDoc<IAssistant>;
42
- const { container } = render(<AssistantConfig assistant={assistant} />);
43
- await screen.findByRole("button", { name: "Available" });
44
- const retired = container.querySelector<HTMLButtonElement>(".dropdown-menu button:disabled");
45
- expect(retired).toHaveTextContent("Retired (unavailable)");
46
- expect(container.querySelector(".dropdown-toggle")).toHaveTextContent("Retired (unavailable)");
47
- expect(screen.queryByText("Other unavailable")).not.toBeInTheDocument();
48
- if (!retired) throw new Error("Missing unavailable runner option");
49
- fireEvent.click(retired);
50
- expect(selected()).toBe("selected");
51
- fireEvent.click(screen.getByRole("button", { name: "Available" }));
52
- await waitFor(() => expect(selected()).toBe("available"));
53
- expect(screen.queryByText("Retired (unavailable)")).not.toBeInTheDocument();
54
- });
@@ -1,121 +0,0 @@
1
- import {
2
- type IAssistant,
3
- type IDoc,
4
- IOSchemaType,
5
- type Observable,
6
- Tools,
7
- } from "@peers-app/peers-sdk";
8
- import { IOSchemaValues } from "../../components/io-schema-values";
9
- import { LoadingIndicator } from "../../components/loading-indicator";
10
- import { useObservable, usePromise } from "../../hooks";
11
- import { getToolCatalogConsumer } from "../tools/tool-catalog-ipc";
12
-
13
- /** Edit assistant runner selection and its configuration. */
14
- export const AssistantConfig = (props: { assistant: IDoc<IAssistant> }) => {
15
- const { assistant } = props;
16
-
17
- const assistantRunnerTool = usePromise(async () => {
18
- return await Tools().get(assistant.assistantRunnerToolId);
19
- });
20
-
21
- if (assistantRunnerTool === undefined) {
22
- return <LoadingIndicator />;
23
- }
24
-
25
- if (assistantRunnerTool === null) {
26
- return (
27
- <div>
28
- <div className="mt-2">
29
- <small>Assistant Runner Tool:</small>
30
- <AssistantRunnersDropdown selectedToolId={assistant.qs.assistantRunnerToolId} />
31
- </div>
32
- </div>
33
- );
34
- }
35
-
36
- assistantRunnerTool.configSchema = assistantRunnerTool.configSchema ?? {
37
- type: IOSchemaType.complex,
38
- fields: [],
39
- };
40
-
41
- return (
42
- <div>
43
- <div className="mt-2">
44
- <small>Assistant Runner Tool:</small>
45
- <AssistantRunnersDropdown selectedToolId={assistant.qs.assistantRunnerToolId} />
46
- </div>
47
-
48
- <IOSchemaValues
49
- ioSchema={assistantRunnerTool.configSchema}
50
- values={assistant.assistantRunnerConfig}
51
- q={assistant.q}
52
- />
53
- </div>
54
- );
55
- };
56
-
57
- const AssistantRunnersDropdown = (props: { selectedToolId: Observable<string> }) => {
58
- const [selectedToolId] = useObservable(props.selectedToolId);
59
-
60
- const modelTools = usePromise(async () => {
61
- const modelTools = await Tools().list({ isAssistantRunner: true });
62
- let availableIds: Set<string>;
63
- try {
64
- const catalog = await getToolCatalogConsumer();
65
- const entries = await Promise.all(
66
- modelTools.map((tool) =>
67
- catalog.tools.getTool({ toolIdOrName: tool.toolId, runnableOnly: true }),
68
- ),
69
- );
70
- availableIds = new Set(
71
- modelTools
72
- .filter((_tool, index) => entries[index].tool?.workflowInvocable)
73
- .map((tool) => tool.toolId),
74
- );
75
- } catch {
76
- availableIds = new Set(
77
- modelTools.filter((tool) => tool.catalogState !== "quarantined").map((tool) => tool.toolId),
78
- );
79
- }
80
- return modelTools.map((tool) => ({ tool, available: availableIds.has(tool.toolId) }));
81
- });
82
-
83
- if (!modelTools) {
84
- return <LoadingIndicator />;
85
- }
86
-
87
- return (
88
- <div className="dropdown">
89
- <button
90
- className="btn btn-secondary dropdown-toggle"
91
- type="button"
92
- data-bs-toggle="dropdown"
93
- aria-expanded="false"
94
- >
95
- {modelTools.find(({ tool }) => tool.toolId === selectedToolId)?.tool.name ?? "Select Tool"}
96
- {modelTools.some(({ tool, available }) => tool.toolId === selectedToolId && !available)
97
- ? " (unavailable)"
98
- : ""}
99
- </button>
100
- <ul className="dropdown-menu">
101
- {modelTools
102
- .filter(({ tool, available }) => available || tool.toolId === selectedToolId)
103
- .map(({ tool, available }) => {
104
- return (
105
- <li key={tool.toolId}>
106
- <button
107
- className="dropdown-item"
108
- type="button"
109
- disabled={!available}
110
- onClick={() => props.selectedToolId(tool.toolId)}
111
- >
112
- {tool.name}
113
- {available ? "" : " (unavailable)"}
114
- </button>
115
- </li>
116
- );
117
- })}
118
- </ul>
119
- </div>
120
- );
121
- };
@@ -1,89 +0,0 @@
1
- import {
2
- Assistants,
3
- groupPrimaryAssistantVar,
4
- userPrimaryAssistantVar,
5
- } from "@peers-app/peers-sdk";
6
- import { Input } from "../../components/input";
7
- import { LoadingIndicator } from "../../components/loading-indicator";
8
- import { SaveButton } from "../../components/save-button";
9
- import { Tabs } from "../../components/tabs";
10
- import { useObservable, usePromise } from "../../hooks";
11
- import { updateActiveTabTitle } from "../../tabs-layout/tabs-state";
12
- import { AssistantConfig } from "./assistant-config";
13
- import { AssistantInfo } from "./assistant-info";
14
- import { AssistantTools } from "./assistant-tools";
15
-
16
- export const AssistantDetails = (props: { assistantId: string }) => {
17
- const [userAssistantId] = useObservable(userPrimaryAssistantVar);
18
- const [groupAssistantId] = useObservable(groupPrimaryAssistantVar);
19
-
20
- const assistant = usePromise(
21
- async () => {
22
- const assistant = await Assistants().get(props.assistantId);
23
- if (!assistant) {
24
- return null;
25
- }
26
- updateActiveTabTitle(assistant.name || "Assistant");
27
- return Assistants().initDoc(assistant);
28
- },
29
- undefined,
30
- [props.assistantId],
31
- );
32
-
33
- if (assistant === null) {
34
- return <div>Assistant not found with id of {props.assistantId}</div>;
35
- }
36
-
37
- if (!assistant) {
38
- return <LoadingIndicator />;
39
- }
40
-
41
- return (
42
- <div className="container-fluid p-3">
43
- <div className="d-flex">
44
- <div>
45
- <h4>
46
- <i className="bi bi-person-fill-gear me-2"></i>
47
- </h4>
48
- </div>
49
- <div className="flex-grow-1">
50
- <h4>
51
- <Input
52
- key={assistant.assistantId}
53
- className="border border-0"
54
- style={{ width: "100%", outline: "none", backgroundColor: "transparent" }}
55
- value={assistant.qs.name}
56
- />
57
- </h4>
58
- </div>
59
- <div className="">
60
- <SaveButton key={assistant.assistantId} doc={assistant} />
61
- </div>
62
- </div>
63
-
64
- <Tabs
65
- key={assistant.assistantId}
66
- tabs={[
67
- {
68
- name: "Info",
69
- content: (
70
- <AssistantInfo
71
- assistant={assistant}
72
- isPrimaryAssistant={userAssistantId === assistant.assistantId}
73
- isGroupPrimaryAssistant={groupAssistantId === assistant.assistantId}
74
- onSetPrimary={(checked) =>
75
- userPrimaryAssistantVar(checked ? assistant.assistantId : undefined)
76
- }
77
- onSetGroupPrimary={(checked) =>
78
- groupPrimaryAssistantVar(checked ? assistant.assistantId : undefined)
79
- }
80
- />
81
- ),
82
- },
83
- { name: "Config", content: <AssistantConfig assistant={assistant} /> },
84
- { name: "Tools", content: <AssistantTools assistant={assistant} /> },
85
- ]}
86
- />
87
- </div>
88
- );
89
- };
@@ -1,66 +0,0 @@
1
- import type { IAssistant, IDoc, Observable } from "@peers-app/peers-sdk";
2
- import { AccessLevelField } from "../../components/access-level-field";
3
- import { Input } from "../../components/input";
4
- import { MarkdownEditorInline } from "../../components/markdown-editor/editor-inline";
5
-
6
- interface AssistantInfoProps {
7
- assistant: IDoc<IAssistant>;
8
- isPrimaryAssistant: boolean;
9
- isGroupPrimaryAssistant: boolean;
10
- onSetPrimary: (checked: boolean) => void;
11
- onSetGroupPrimary: (checked: boolean) => void;
12
- }
13
-
14
- /** Info tab for an Assistant, including its access-level policy. */
15
- export const AssistantInfo = (props: AssistantInfoProps) => {
16
- const {
17
- assistant,
18
- isPrimaryAssistant,
19
- isGroupPrimaryAssistant,
20
- onSetPrimary,
21
- onSetGroupPrimary,
22
- } = props;
23
-
24
- return (
25
- <div>
26
- <small>Name:</small>
27
- <Input
28
- value={assistant.qs.name}
29
- className="form-control mb-3 p-0 ps-2"
30
- placeholder="Tool name"
31
- title="Tool name"
32
- />
33
-
34
- <div>
35
- <label htmlFor="isPrimary" className="form-label small mt-2 me-2">
36
- My Default Assistant:
37
- </label>
38
- <input
39
- type="checkbox"
40
- id="isPrimary"
41
- checked={isPrimaryAssistant}
42
- onChange={(e) => onSetPrimary((e.target as HTMLInputElement).checked)}
43
- />
44
- </div>
45
-
46
- <div>
47
- <label htmlFor="isGroupPrimary" className="form-label small mt-2 me-2">
48
- Group Default Assistant:
49
- </label>
50
- <input
51
- type="checkbox"
52
- id="isGroupPrimary"
53
- checked={isGroupPrimaryAssistant}
54
- onChange={(e) => onSetGroupPrimary((e.target as HTMLInputElement).checked)}
55
- />
56
- </div>
57
-
58
- <AccessLevelField value={assistant.qs.accessLevel} />
59
-
60
- <div className="mt-2">
61
- <small>Description:</small>
62
- <MarkdownEditorInline value={assistant.qs.description as Observable<string>} />
63
- </div>
64
- </div>
65
- );
66
- };
@@ -1,145 +0,0 @@
1
- import {
2
- Assistants,
3
- canInvokeAssistant,
4
- getAccessLevelLabel,
5
- getCurrentUserAccessLevel,
6
- getUserContext,
7
- type IAssistant,
8
- type ICursorIterable,
9
- newid,
10
- observable,
11
- recordAccessLevel,
12
- } from "@peers-app/peers-sdk";
13
- import type React from "react";
14
- import { useEffect, useState } from "react";
15
- import { Input } from "../../components/input";
16
- import { LazyList } from "../../components/lazy-list";
17
- import { LoadingIndicator } from "../../components/loading-indicator";
18
- import { MarkdownWithMentions } from "../../components/markdown-with-mentions";
19
- import { isDesktop, mainContentPath } from "../../globals";
20
- import { useObservable, usePromise } from "../../hooks";
21
-
22
- /** Searchable Assistant list with access-level visibility. */
23
- export const AssistantList = () => {
24
- const [searchTextObs] = useState(() => observable(""));
25
- const [searchText] = useObservable(searchTextObs);
26
-
27
- const [cursorObs] = useState(() => observable<ICursorIterable<IAssistant> | undefined>());
28
- const [cursorId] = useState(() => observable(newid()));
29
- const userLevel = usePromise(async () => {
30
- const userContext = await getUserContext();
31
- return getCurrentUserAccessLevel(userContext.defaultDataContext());
32
- }, 100);
33
-
34
- async function newCursor() {
35
- let cursor: ICursorIterable<IAssistant>;
36
- const _searchText = searchText.trim();
37
- if (_searchText) {
38
- cursor = await Assistants().cursor(
39
- { name: { $matchWords: _searchText } },
40
- { sortBy: ["-updatedAt"] },
41
- );
42
- } else {
43
- cursor = await Assistants().cursor(undefined, { sortBy: ["-updatedAt"] });
44
- }
45
-
46
- cursorObs(cursor);
47
- cursorId(newid());
48
- return cursor;
49
- }
50
-
51
- useEffect(() => {
52
- const sub = searchTextObs.subscribe(() => {
53
- cursorObs(undefined);
54
- cursorId(newid());
55
- });
56
- return () => sub.dispose();
57
- }, [cursorId, cursorObs, searchTextObs.subscribe]);
58
-
59
- async function searchSubmit(evt: React.KeyboardEvent<HTMLInputElement>) {
60
- if (evt.key !== "Enter") return;
61
- if (!searchText.trim()) return;
62
- const assistantName = searchText.trim();
63
- const assistant = await Assistants().initRecord({
64
- name: assistantName,
65
- });
66
- await Assistants().insert(assistant);
67
- mainContentPath(`assistants/${assistant.assistantId}`);
68
- }
69
-
70
- async function loadMore(loadedRecords: IAssistant[]): Promise<IAssistant[]> {
71
- const moreMatches: IAssistant[] = [];
72
- const cursor = cursorObs() || (await newCursor());
73
- for await (const assistant of cursor) {
74
- if (loadedRecords.find((a) => a.assistantId === assistant.assistantId)) continue;
75
- moreMatches.push(assistant);
76
- if (searchText.length && moreMatches.length > 5) break;
77
- if (moreMatches.length >= 50) break;
78
- }
79
- if (moreMatches.length === 0) {
80
- cursorObs(undefined);
81
- }
82
- return moreMatches;
83
- }
84
-
85
- return (
86
- <div className="container-fluid">
87
- <Input
88
- value={searchTextObs}
89
- className="form-control"
90
- style={{ marginBottom: "10px" }}
91
- placeholder="Search or create new assistant"
92
- autoFocus={!!isDesktop()}
93
- onKeyUp={(evt) => searchSubmit(evt)}
94
- />
95
-
96
- <div className="peers-list-container">
97
- <LazyList
98
- key={cursorId()}
99
- loadMore={loadMore}
100
- scrollThreshold={0.6}
101
- renderItems={(assistants) => {
102
- return assistants.map((assistant) => {
103
- const required = recordAccessLevel(assistant);
104
- const allowed = canInvokeAssistant(userLevel ?? 100, required);
105
- return (
106
- <div
107
- key={assistant.assistantId}
108
- className="container-fluid pb-4"
109
- style={allowed ? undefined : { opacity: 0.65 }}
110
- >
111
- <i className="bi bi-person-fill-gear"></i>&nbsp;
112
- <a href={`#assistants/${assistant.assistantId}`}>{assistant.name}</a>
113
- {!allowed && (
114
- <span className="badge text-bg-secondary ms-2">
115
- Requires {getAccessLevelLabel(required)} ({required})
116
- </span>
117
- )}
118
- <div style={{ paddingLeft: "20px" }}>
119
- <MarkdownWithMentions content={assistant.description ?? ""} />
120
- {!allowed && (
121
- <div className="small text-muted">
122
- You cannot invoke this Assistant with your current access (
123
- {getAccessLevelLabel(userLevel ?? 100)}).
124
- </div>
125
- )}
126
- </div>
127
- </div>
128
- );
129
- });
130
- }}
131
- loadingIndicator={
132
- <div className="d-flex justify-content-center" style={{ height: 200 }}>
133
- <LoadingIndicator />
134
- </div>
135
- }
136
- endOfList={
137
- <div className="d-flex justify-content-center" style={{ height: 200 }}>
138
- {/* <span className="h3">End of List</span> */}
139
- </div>
140
- }
141
- />
142
- </div>
143
- </div>
144
- );
145
- };
@@ -1,82 +0,0 @@
1
- import {
2
- Assistants,
3
- camelCaseToSpaces,
4
- type IAssistant,
5
- type IDoc,
6
- type Observable,
7
- ToolInclusionStrategy,
8
- } from "@peers-app/peers-sdk";
9
- import { MarkdownEditorInline } from "../../components/markdown-editor/editor-inline";
10
- import { Tooltip } from "../../components/tooltip";
11
- import { useObservable } from "../../hooks";
12
-
13
- export const AssistantTools = (props: { assistant: IDoc<IAssistant> }) => {
14
- const { assistant } = props;
15
-
16
- return (
17
- <div>
18
- <div className="mt-2">
19
- <small>
20
- Tool Inclusion Strategy:
21
- <small>
22
- <Tooltip
23
- markdownContent={
24
- Assistants().metaData.fields.find((f) => f.name === "toolInclusionStrategy")
25
- ?.description ?? ""
26
- }
27
- />
28
- </small>
29
- </small>
30
- <ToolInclusionStrategyDropDown assistant={assistant} />
31
- </div>
32
-
33
- <div className="mt-2">
34
- <small>
35
- Tools to Include:
36
- <small>
37
- <Tooltip
38
- markdownContent={
39
- Assistants().metaData.fields.find((f) => f.name === "toolsToInclude")
40
- ?.description ?? ""
41
- }
42
- />
43
- </small>
44
- </small>
45
- <MarkdownEditorInline value={assistant.qs.toolsToInclude as Observable<string>} />
46
- </div>
47
- </div>
48
- );
49
- };
50
-
51
- const ToolInclusionStrategyDropDown = (props: { assistant: IDoc<IAssistant> }) => {
52
- const { assistant } = props;
53
-
54
- useObservable(assistant.qs.toolInclusionStrategy);
55
-
56
- return (
57
- <div className="dropdown">
58
- <button
59
- className="btn btn-secondary dropdown-toggle"
60
- type="button"
61
- data-bs-toggle="dropdown"
62
- aria-expanded="false"
63
- >
64
- {camelCaseToSpaces(assistant.toolInclusionStrategy)}
65
- </button>
66
- <ul className="dropdown-menu">
67
- {Object.values(ToolInclusionStrategy).map((strategy) => {
68
- return (
69
- <li
70
- key={strategy}
71
- onClick={() => {
72
- assistant.toolInclusionStrategy = strategy;
73
- }}
74
- >
75
- <span className="dropdown-item">{camelCaseToSpaces(strategy)}</span>
76
- </li>
77
- );
78
- })}
79
- </ul>
80
- </div>
81
- );
82
- };