@peers-app/peers-ui 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/publish.yml +8 -5
- package/babel.config.js +4 -4
- package/biome.json +191 -0
- package/dist/command-palette/command-palette-ui.d.ts +1 -2
- package/dist/command-palette/command-palette-ui.js +175 -244
- package/dist/command-palette/command-palette.js +65 -64
- package/dist/components/chat-overlay.d.ts +2 -2
- package/dist/components/chat-overlay.js +160 -217
- package/dist/components/checkbox.d.ts +5 -4
- package/dist/components/checkbox.js +4 -7
- package/dist/components/group-switcher.d.ts +1 -2
- package/dist/components/group-switcher.js +119 -159
- package/dist/components/input-date.d.ts +3 -3
- package/dist/components/input-date.js +6 -6
- package/dist/components/input-number.d.ts +7 -6
- package/dist/components/input-number.js +25 -20
- package/dist/components/input.d.ts +5 -4
- package/dist/components/input.js +4 -7
- package/dist/components/inverse-lazy-list.d.ts +3 -3
- package/dist/components/inverse-lazy-list.js +13 -47
- package/dist/components/io-schema-values.d.ts +5 -6
- package/dist/components/io-schema-values.js +28 -65
- package/dist/components/io-schema.d.ts +4 -5
- package/dist/components/io-schema.js +42 -79
- package/dist/components/lazy-list.d.ts +3 -3
- package/dist/components/lazy-list.js +38 -58
- package/dist/components/list-screen.d.ts +3 -8
- package/dist/components/list-screen.js +28 -23
- package/dist/components/loading-indicator.d.ts +1 -2
- package/dist/components/loading-indicator.js +2 -6
- package/dist/components/markdown-editor/autolink-plugin.js +5 -8
- package/dist/components/markdown-editor/editor-inline.d.ts +2 -3
- package/dist/components/markdown-editor/editor-inline.js +2 -6
- package/dist/components/markdown-editor/editor.d.ts +6 -6
- package/dist/components/markdown-editor/editor.js +9 -19
- package/dist/components/markdown-editor/markdown-plugin.d.ts +1 -1
- package/dist/components/markdown-editor/markdown-plugin.js +20 -21
- package/dist/components/markdown-editor/mention-node.d.ts +2 -2
- package/dist/components/markdown-editor/mention-node.js +24 -24
- package/dist/components/markdown-editor/mentions-plugin.d.ts +2 -2
- package/dist/components/markdown-editor/mentions-plugin.js +61 -62
- package/dist/components/markdown-editor/theme.js +28 -28
- package/dist/components/markdown-editor/toolbar.d.ts +2 -3
- package/dist/components/markdown-editor/toolbar.js +32 -49
- package/dist/components/markdown-with-mentions.d.ts +1 -1
- package/dist/components/markdown-with-mentions.js +43 -43
- package/dist/components/message-logs/message-logs.d.ts +1 -2
- package/dist/components/message-logs/message-logs.js +91 -116
- package/dist/components/messages/avatar.d.ts +3 -4
- package/dist/components/messages/avatar.js +37 -46
- package/dist/components/messages/channel-message-list.d.ts +5 -6
- package/dist/components/messages/channel-message-list.js +34 -34
- package/dist/components/messages/channel-view.d.ts +1 -2
- package/dist/components/messages/channel-view.js +23 -57
- package/dist/components/messages/message-compose.d.ts +3 -4
- package/dist/components/messages/message-compose.js +27 -38
- package/dist/components/messages/message-display.d.ts +2 -3
- package/dist/components/messages/message-display.js +42 -95
- package/dist/components/messages/thread-message-list.d.ts +4 -5
- package/dist/components/messages/thread-message-list.js +29 -29
- package/dist/components/router.d.ts +1 -2
- package/dist/components/router.js +58 -66
- package/dist/components/save-button.d.ts +3 -3
- package/dist/components/save-button.js +23 -33
- package/dist/components/sortable-list.d.ts +11 -12
- package/dist/components/sortable-list.js +42 -22
- package/dist/components/tabs.d.ts +3 -3
- package/dist/components/tabs.js +16 -47
- package/dist/components/tooltip.d.ts +4 -4
- package/dist/components/tooltip.js +4 -9
- package/dist/components/trust-level-badge.d.ts +2 -3
- package/dist/components/trust-level-badge.js +16 -16
- package/dist/components/trust-level-dropdown.d.ts +3 -4
- package/dist/components/trust-level-dropdown.js +32 -55
- package/dist/components/typeahead.d.ts +3 -3
- package/dist/components/typeahead.js +48 -89
- package/dist/components/voice-indicator.d.ts +2 -2
- package/dist/components/voice-indicator.js +93 -106
- package/dist/components/voice-subscribe-events.d.ts +32 -0
- package/dist/components/voice-subscribe-events.js +2 -0
- package/dist/globals.d.ts +3 -5
- package/dist/globals.js +22 -33
- package/dist/hooks.d.ts +5 -5
- package/dist/hooks.js +22 -12
- package/dist/hooks.test.js +129 -145
- package/dist/index.d.ts +9 -8
- package/dist/index.js +13 -12
- package/dist/mention-configs.d.ts +2 -2
- package/dist/mention-configs.js +55 -42
- package/dist/screens/assistants/assistant-config.d.ts +2 -3
- package/dist/screens/assistants/assistant-config.js +9 -22
- package/dist/screens/assistants/assistant-details.d.ts +1 -2
- package/dist/screens/assistants/assistant-details.js +13 -28
- package/dist/screens/assistants/assistant-info.d.ts +2 -3
- package/dist/screens/assistants/assistant-info.js +3 -17
- package/dist/screens/assistants/assistant-list.d.ts +1 -2
- package/dist/screens/assistants/assistant-list.js +15 -56
- package/dist/screens/assistants/assistant-tools.d.ts +2 -3
- package/dist/screens/assistants/assistant-tools.js +10 -24
- package/dist/screens/console-logs/console-logs-list.d.ts +1 -2
- package/dist/screens/console-logs/console-logs-list.js +130 -134
- package/dist/screens/console-logs/log-display.d.ts +2 -3
- package/dist/screens/console-logs/log-display.js +40 -42
- package/dist/screens/console-logs/log-filters.d.ts +1 -2
- package/dist/screens/console-logs/log-filters.js +2 -24
- package/dist/screens/console-logs/mobile-log-card.d.ts +2 -3
- package/dist/screens/console-logs/mobile-log-card.js +64 -67
- package/dist/screens/console-logs/resizable-table-header.d.ts +1 -2
- package/dist/screens/console-logs/resizable-table-header.js +31 -67
- package/dist/screens/contacts/contact-details.d.ts +1 -2
- package/dist/screens/contacts/contact-details.js +16 -46
- package/dist/screens/contacts/contact-list.d.ts +1 -2
- package/dist/screens/contacts/contact-list.js +44 -103
- package/dist/screens/contacts/index.d.ts +4 -4
- package/dist/screens/contacts/index.js +1 -1
- package/dist/screens/contacts/user-connect.d.ts +1 -2
- package/dist/screens/contacts/user-connect.js +85 -186
- package/dist/screens/data-explorer/data-explorer.d.ts +1 -2
- package/dist/screens/data-explorer/data-explorer.js +61 -181
- package/dist/screens/data-explorer/index.d.ts +2 -2
- package/dist/screens/data-explorer/query-executor.d.ts +1 -2
- package/dist/screens/data-explorer/query-executor.js +56 -166
- package/dist/screens/groups/group-details.d.ts +1 -2
- package/dist/screens/groups/group-details.js +27 -122
- package/dist/screens/groups/group-invite-listener.d.ts +2 -3
- package/dist/screens/groups/group-invite-listener.js +8 -104
- package/dist/screens/groups/group-list.d.ts +1 -2
- package/dist/screens/groups/group-list.js +56 -133
- package/dist/screens/groups/group-members.d.ts +2 -3
- package/dist/screens/groups/group-members.js +62 -132
- package/dist/screens/groups/index.d.ts +4 -4
- package/dist/screens/groups/index.js +1 -1
- package/dist/screens/join-group/index.d.ts +2 -2
- package/dist/screens/join-group/join-group.d.ts +1 -2
- package/dist/screens/join-group/join-group.js +9 -109
- package/dist/screens/network-viewer/connection-troubleshooter.d.ts +2 -3
- package/dist/screens/network-viewer/connection-troubleshooter.js +89 -193
- package/dist/screens/network-viewer/cpu-usage-graph.d.ts +1 -2
- package/dist/screens/network-viewer/cpu-usage-graph.js +60 -99
- package/dist/screens/network-viewer/device-details-modal.d.ts +1 -2
- package/dist/screens/network-viewer/device-details-modal.js +25 -177
- package/dist/screens/network-viewer/group-details-modal.d.ts +1 -2
- package/dist/screens/network-viewer/group-details-modal.js +31 -142
- package/dist/screens/network-viewer/index.d.ts +4 -4
- package/dist/screens/network-viewer/index.js +3 -3
- package/dist/screens/network-viewer/network-viewer-ipc.d.ts +22 -0
- package/dist/screens/network-viewer/network-viewer-ipc.js +6 -0
- package/dist/screens/network-viewer/network-viewer.d.ts +1 -2
- package/dist/screens/network-viewer/network-viewer.js +91 -296
- package/dist/screens/network-viewer/usage-graph.d.ts +1 -2
- package/dist/screens/network-viewer/usage-graph.js +78 -110
- package/dist/screens/packages/package-details.d.ts +1 -2
- package/dist/screens/packages/package-details.js +35 -41
- package/dist/screens/packages/package-info.d.ts +2 -2
- package/dist/screens/packages/package-info.js +33 -86
- package/dist/screens/packages/package-list.d.ts +1 -2
- package/dist/screens/packages/package-list.js +42 -106
- package/dist/screens/packages/package-new-local.d.ts +1 -2
- package/dist/screens/packages/package-new-local.js +13 -19
- package/dist/screens/packages/package-versions.d.ts +2 -3
- package/dist/screens/packages/package-versions.js +29 -96
- package/dist/screens/peer-types/peer-type-details.d.ts +3 -4
- package/dist/screens/peer-types/peer-type-details.js +26 -78
- package/dist/screens/peer-types/peer-type-list.d.ts +1 -2
- package/dist/screens/peer-types/peer-type-list.js +13 -24
- package/dist/screens/search/global-search.d.ts +1 -2
- package/dist/screens/search/global-search.js +104 -182
- package/dist/screens/settings/color-mode-dropdown.d.ts +3 -4
- package/dist/screens/settings/color-mode-dropdown.js +18 -37
- package/dist/screens/settings/settings-page.d.ts +1 -1
- package/dist/screens/settings/settings-page.js +86 -213
- package/dist/screens/settings/voice-settings-agent.d.ts +1 -1
- package/dist/screens/settings/voice-settings-agent.js +7 -44
- package/dist/screens/settings/voice-settings-api-keys.d.ts +2 -2
- package/dist/screens/settings/voice-settings-api-keys.js +2 -29
- package/dist/screens/settings/voice-settings-output.d.ts +2 -2
- package/dist/screens/settings/voice-settings-output.js +2 -40
- package/dist/screens/settings/voice-settings-providers.d.ts +2 -2
- package/dist/screens/settings/voice-settings-providers.js +2 -19
- package/dist/screens/settings/voice-settings-types.d.ts +4 -4
- package/dist/screens/settings/voice-settings-types.js +31 -31
- package/dist/screens/settings/voice-settings-wake-word.d.ts +2 -2
- package/dist/screens/settings/voice-settings-wake-word.js +2 -33
- package/dist/screens/settings/voice-settings.d.ts +1 -1
- package/dist/screens/settings/voice-settings.js +35 -112
- package/dist/screens/setup-user.d.ts +1 -2
- package/dist/screens/setup-user.js +38 -116
- package/dist/screens/tools/tool-code.d.ts +2 -3
- package/dist/screens/tools/tool-code.js +9 -13
- package/dist/screens/tools/tool-details.d.ts +1 -2
- package/dist/screens/tools/tool-details.js +26 -39
- package/dist/screens/tools/tool-info.d.ts +2 -3
- package/dist/screens/tools/tool-info.js +9 -48
- package/dist/screens/tools/tool-list.d.ts +1 -2
- package/dist/screens/tools/tool-list.js +33 -65
- package/dist/screens/tools/tool-schema.d.ts +2 -3
- package/dist/screens/tools/tool-schema.js +2 -13
- package/dist/screens/tools/tool-test-details.d.ts +1 -2
- package/dist/screens/tools/tool-test-details.js +12 -28
- package/dist/screens/tools/tool-test-list.d.ts +1 -2
- package/dist/screens/tools/tool-test-list.js +17 -56
- package/dist/screens/variables/variable-details.d.ts +1 -2
- package/dist/screens/variables/variable-details.js +19 -86
- package/dist/screens/variables/variable-list.d.ts +1 -2
- package/dist/screens/variables/variable-list.js +16 -27
- package/dist/screens/welcome-modal.d.ts +1 -2
- package/dist/screens/welcome-modal.js +44 -111
- package/dist/screens/workflows/workflow-details.d.ts +1 -2
- package/dist/screens/workflows/workflow-details.js +17 -31
- package/dist/screens/workflows/workflow-info.d.ts +2 -3
- package/dist/screens/workflows/workflow-info.js +2 -9
- package/dist/screens/workflows/workflow-instructions.d.ts +2 -3
- package/dist/screens/workflows/workflow-instructions.js +23 -55
- package/dist/screens/workflows/workflow-list.d.ts +1 -2
- package/dist/screens/workflows/workflow-list.js +23 -62
- package/dist/setupTests.d.ts +1 -1
- package/dist/setupTests.js +10 -11
- package/dist/system-apps/assistants.app.d.ts +1 -1
- package/dist/system-apps/assistants.app.js +3 -3
- package/dist/system-apps/console-logs.app.d.ts +1 -1
- package/dist/system-apps/console-logs.app.js +3 -3
- package/dist/system-apps/contacts.app.d.ts +1 -1
- package/dist/system-apps/contacts.app.js +4 -4
- package/dist/system-apps/data-explorer.app.d.ts +1 -1
- package/dist/system-apps/data-explorer.app.js +4 -4
- package/dist/system-apps/groups.app.d.ts +1 -1
- package/dist/system-apps/groups.app.js +4 -4
- package/dist/system-apps/index.d.ts +17 -17
- package/dist/system-apps/index.js +52 -52
- package/dist/system-apps/join-group.app.d.ts +1 -1
- package/dist/system-apps/join-group.app.js +4 -4
- package/dist/system-apps/mobile-settings.app.d.ts +1 -1
- package/dist/system-apps/mobile-settings.app.js +3 -3
- package/dist/system-apps/network-viewer.app.d.ts +1 -1
- package/dist/system-apps/network-viewer.app.js +4 -4
- package/dist/system-apps/packages.app.d.ts +1 -1
- package/dist/system-apps/packages.app.js +3 -3
- package/dist/system-apps/search.app.d.ts +1 -1
- package/dist/system-apps/search.app.js +4 -4
- package/dist/system-apps/settings.app.d.ts +1 -1
- package/dist/system-apps/settings.app.js +3 -3
- package/dist/system-apps/threads.app.d.ts +1 -1
- package/dist/system-apps/threads.app.js +3 -3
- package/dist/system-apps/tools.app.d.ts +1 -1
- package/dist/system-apps/tools.app.js +3 -3
- package/dist/system-apps/types.app.d.ts +1 -1
- package/dist/system-apps/types.app.js +3 -3
- package/dist/system-apps/variables.app.d.ts +1 -1
- package/dist/system-apps/variables.app.js +3 -3
- package/dist/system-apps/workflows.app.d.ts +1 -1
- package/dist/system-apps/workflows.app.js +3 -3
- package/dist/tabs-layout/tabs-layout.d.ts +2 -3
- package/dist/tabs-layout/tabs-layout.js +215 -246
- package/dist/tabs-layout/tabs-state.d.ts +2 -2
- package/dist/tabs-layout/tabs-state.js +73 -61
- package/dist/ui-defaults/index.d.ts +2 -2
- package/dist/ui-defaults/list-screen.d.ts +2 -3
- package/dist/ui-defaults/list-screen.js +33 -37
- package/dist/ui-defaults/markdown-field.js +24 -56
- package/dist/ui-router/routes-loader.d.ts +1 -1
- package/dist/ui-router/routes-loader.js +17 -13
- package/dist/ui-router/ui-loader.d.ts +6 -6
- package/dist/ui-router/ui-loader.js +172 -268
- package/dist/utils.js +49 -39
- package/jest.config.js +16 -16
- package/package.json +16 -14
- package/src/command-palette/command-palette-ui.tsx +261 -237
- package/src/command-palette/command-palette.ts +81 -78
- package/src/components/chat-overlay.tsx +366 -261
- package/src/components/checkbox.tsx +15 -12
- package/src/components/group-switcher.tsx +150 -105
- package/src/components/input-date.tsx +17 -16
- package/src/components/input-number.tsx +47 -31
- package/src/components/input.tsx +15 -12
- package/src/components/inverse-lazy-list.tsx +14 -13
- package/src/components/io-schema-values.tsx +51 -69
- package/src/components/io-schema.tsx +94 -69
- package/src/components/lazy-list.tsx +51 -34
- package/src/components/list-screen.tsx +51 -35
- package/src/components/loading-indicator.tsx +2 -4
- package/src/components/markdown-editor/autolink-plugin.tsx +4 -11
- package/src/components/markdown-editor/editor-inline.tsx +3 -4
- package/src/components/markdown-editor/editor.tsx +53 -51
- package/src/components/markdown-editor/markdown-plugin.tsx +48 -40
- package/src/components/markdown-editor/mention-node.ts +39 -38
- package/src/components/markdown-editor/mentions-plugin.tsx +99 -101
- package/src/components/markdown-editor/theme.ts +28 -29
- package/src/components/markdown-editor/toolbar.tsx +53 -47
- package/src/components/markdown-with-mentions.tsx +56 -46
- package/src/components/message-logs/message-logs.tsx +225 -165
- package/src/components/messages/avatar.tsx +70 -52
- package/src/components/messages/channel-message-list.tsx +80 -68
- package/src/components/messages/channel-view.tsx +34 -33
- package/src/components/messages/message-compose.tsx +84 -67
- package/src/components/messages/message-display.tsx +103 -89
- package/src/components/messages/thread-message-list.tsx +53 -44
- package/src/components/router.tsx +42 -43
- package/src/components/save-button.tsx +43 -39
- package/src/components/sortable-list.tsx +77 -49
- package/src/components/tabs.tsx +31 -31
- package/src/components/tooltip.tsx +21 -28
- package/src/components/trust-level-badge.tsx +15 -11
- package/src/components/trust-level-dropdown.tsx +49 -19
- package/src/components/typeahead.tsx +57 -59
- package/src/components/voice-indicator.tsx +158 -141
- package/src/components/voice-subscribe-events.ts +20 -0
- package/src/globals.tsx +42 -40
- package/src/hooks.test.tsx +141 -134
- package/src/hooks.ts +80 -48
- package/src/index.tsx +17 -10
- package/src/mention-configs.ts +122 -68
- package/src/screens/assistants/assistant-config.tsx +28 -18
- package/src/screens/assistants/assistant-details.tsx +35 -36
- package/src/screens/assistants/assistant-info.tsx +16 -11
- package/src/screens/assistants/assistant-list.tsx +37 -34
- package/src/screens/assistants/assistant-tools.tsx +41 -20
- package/src/screens/console-logs/console-logs-list.tsx +173 -140
- package/src/screens/console-logs/log-display.tsx +65 -38
- package/src/screens/console-logs/log-filters.tsx +4 -3
- package/src/screens/console-logs/mobile-log-card.tsx +78 -71
- package/src/screens/console-logs/resizable-table-header.tsx +29 -21
- package/src/screens/contacts/contact-details.tsx +29 -30
- package/src/screens/contacts/contact-list.tsx +71 -60
- package/src/screens/contacts/index.ts +5 -5
- package/src/screens/contacts/user-connect.tsx +177 -171
- package/src/screens/data-explorer/data-explorer.tsx +134 -98
- package/src/screens/data-explorer/index.ts +2 -3
- package/src/screens/data-explorer/query-executor.tsx +90 -80
- package/src/screens/groups/group-details.tsx +120 -101
- package/src/screens/groups/group-invite-listener.tsx +34 -37
- package/src/screens/groups/group-list.tsx +119 -103
- package/src/screens/groups/group-members.tsx +225 -164
- package/src/screens/groups/index.ts +5 -6
- package/src/screens/join-group/index.ts +2 -2
- package/src/screens/join-group/join-group.tsx +41 -39
- package/src/screens/network-viewer/connection-troubleshooter.tsx +145 -104
- package/src/screens/network-viewer/cpu-usage-graph.tsx +39 -43
- package/src/screens/network-viewer/device-details-modal.tsx +46 -59
- package/src/screens/network-viewer/group-details-modal.tsx +68 -49
- package/src/screens/network-viewer/index.ts +4 -5
- package/src/screens/network-viewer/network-viewer-ipc.ts +23 -0
- package/src/screens/network-viewer/network-viewer.tsx +261 -236
- package/src/screens/network-viewer/usage-graph.tsx +57 -49
- package/src/screens/packages/package-details.tsx +43 -35
- package/src/screens/packages/package-info.tsx +107 -66
- package/src/screens/packages/package-list.tsx +175 -98
- package/src/screens/packages/package-new-local.tsx +28 -26
- package/src/screens/packages/package-versions.tsx +102 -77
- package/src/screens/peer-types/peer-type-details.tsx +60 -50
- package/src/screens/peer-types/peer-type-list.tsx +20 -30
- package/src/screens/search/global-search.tsx +153 -137
- package/src/screens/settings/color-mode-dropdown.tsx +52 -35
- package/src/screens/settings/settings-page.tsx +215 -141
- package/src/screens/settings/voice-settings-agent.tsx +13 -12
- package/src/screens/settings/voice-settings-api-keys.tsx +14 -12
- package/src/screens/settings/voice-settings-output.tsx +12 -11
- package/src/screens/settings/voice-settings-providers.tsx +7 -3
- package/src/screens/settings/voice-settings-types.ts +52 -49
- package/src/screens/settings/voice-settings-wake-word.tsx +25 -9
- package/src/screens/settings/voice-settings.tsx +66 -43
- package/src/screens/setup-user.tsx +88 -41
- package/src/screens/tools/tool-code.tsx +12 -17
- package/src/screens/tools/tool-details.tsx +28 -28
- package/src/screens/tools/tool-info.tsx +14 -19
- package/src/screens/tools/tool-list.tsx +58 -40
- package/src/screens/tools/tool-schema.tsx +16 -9
- package/src/screens/tools/tool-test-details.tsx +11 -22
- package/src/screens/tools/tool-test-list.tsx +29 -30
- package/src/screens/variables/variable-details.tsx +63 -51
- package/src/screens/variables/variable-list.tsx +29 -30
- package/src/screens/welcome-modal.tsx +68 -48
- package/src/screens/workflows/workflow-details.tsx +40 -30
- package/src/screens/workflows/workflow-info.tsx +4 -11
- package/src/screens/workflows/workflow-instructions.tsx +35 -28
- package/src/screens/workflows/workflow-list.tsx +50 -40
- package/src/setupTests.ts +14 -13
- package/src/system-apps/assistants.app.ts +5 -5
- package/src/system-apps/console-logs.app.ts +4 -4
- package/src/system-apps/contacts.app.ts +6 -6
- package/src/system-apps/data-explorer.app.ts +5 -5
- package/src/system-apps/groups.app.ts +6 -6
- package/src/system-apps/index.ts +49 -49
- package/src/system-apps/join-group.app.ts +5 -5
- package/src/system-apps/mobile-settings.app.ts +4 -5
- package/src/system-apps/network-viewer.app.ts +5 -5
- package/src/system-apps/packages.app.ts +5 -5
- package/src/system-apps/search.app.ts +6 -6
- package/src/system-apps/settings.app.ts +5 -5
- package/src/system-apps/threads.app.ts +5 -5
- package/src/system-apps/tools.app.ts +5 -5
- package/src/system-apps/types.app.ts +5 -5
- package/src/system-apps/variables.app.ts +5 -5
- package/src/system-apps/workflows.app.ts +5 -5
- package/src/tabs-layout/tabs-layout.tsx +345 -254
- package/src/tabs-layout/tabs-state.ts +100 -81
- package/src/ui-defaults/index.ts +2 -3
- package/src/ui-defaults/list-screen.tsx +45 -40
- package/src/ui-defaults/markdown-field.tsx +22 -26
- package/src/ui-router/routes-loader.ts +40 -24
- package/src/ui-router/ui-loader.tsx +312 -214
- package/src/utils.ts +68 -81
- package/tsconfig.json +5 -10
- package/dist/components/input-datetime.d.ts +0 -7
- package/dist/components/input-datetime.js +0 -35
- package/dist/components/lazy-sortable-list.d.ts +0 -29
- package/dist/components/lazy-sortable-list.js +0 -12
- package/dist/components/left-bar.d.ts +0 -5
- package/dist/components/left-bar.js +0 -207
- package/dist/components/main-content-container.d.ts +0 -2
- package/dist/components/main-content-container.js +0 -92
- package/dist/components/messages/thread-view.d.ts +0 -6
- package/dist/components/messages/thread-view.js +0 -174
- package/dist/components/off-canvas.d.ts +0 -13
- package/dist/components/off-canvas.js +0 -89
- package/dist/components/text-list-editor.tsx/text-list-editor.d.ts +0 -6
- package/dist/components/text-list-editor.tsx/text-list-editor.js +0 -13
- package/dist/components/top-bar.d.ts +0 -2
- package/dist/components/top-bar.js +0 -51
- package/dist/components/typeahead/mentions-plugin.d.ts +0 -7
- package/dist/components/typeahead/mentions-plugin.js +0 -203
- package/dist/components/typeahead/typeahead-editor.d.ts +0 -15
- package/dist/components/typeahead/typeahead-editor.js +0 -134
- package/dist/components/typeahead/typeahead.d.ts +0 -12
- package/dist/components/typeahead/typeahead.js +0 -94
- package/dist/screens/profile.d.ts +0 -2
- package/dist/screens/profile.js +0 -76
- package/src/components/input-datetime.tsx +0 -41
- package/src/components/lazy-sortable-list.tsx +0 -51
- package/src/components/left-bar.tsx +0 -322
- package/src/components/main-content-container.tsx +0 -79
- package/src/components/messages/thread-view.tsx +0 -214
- package/src/components/off-canvas.tsx +0 -83
- package/src/components/text-list-editor.tsx/text-list-editor.tsx +0 -13
- package/src/components/top-bar.tsx +0 -119
- package/src/components/typeahead/mentions-plugin.tsx +0 -265
- package/src/components/typeahead/typeahead-editor.tsx +0 -140
- package/src/components/typeahead/typeahead.tsx +0 -77
- package/src/screens/profile.tsx +0 -75
|
@@ -1,25 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
hydrateKeys,
|
|
3
|
+
isid,
|
|
4
|
+
newid,
|
|
5
|
+
newKeys,
|
|
6
|
+
openMessageWithPublicKey,
|
|
7
|
+
peersCorePackageId,
|
|
8
|
+
rpcServerCalls,
|
|
9
|
+
signMessageWithSecretKey,
|
|
10
|
+
} from "@peers-app/peers-sdk";
|
|
11
|
+
import { useState } from "react";
|
|
3
12
|
import { useObservable } from "../hooks";
|
|
4
13
|
import { colorMode } from "./settings/color-mode-dropdown";
|
|
5
14
|
|
|
6
|
-
type SetupStep =
|
|
15
|
+
type SetupStep = "select-user-type" | "complete";
|
|
7
16
|
|
|
8
17
|
export const SetupUser = () => {
|
|
9
18
|
const [_colorMode] = useObservable(colorMode);
|
|
10
|
-
const [step,
|
|
19
|
+
const [step, _setStep] = useState<SetupStep>("select-user-type");
|
|
11
20
|
const [isExistingUser, setIsExistingUser] = useState<boolean | null>(null);
|
|
12
|
-
const [userId, setUserId] = useState(
|
|
13
|
-
const [secretKey, setSecretKey] = useState(
|
|
14
|
-
const [error, setError] = useState(
|
|
21
|
+
const [userId, setUserId] = useState("");
|
|
22
|
+
const [secretKey, setSecretKey] = useState("");
|
|
23
|
+
const [error, setError] = useState("");
|
|
15
24
|
const [isValidating, setIsValidating] = useState(false);
|
|
16
25
|
|
|
17
|
-
document.getElementById(
|
|
26
|
+
document.getElementById("appLoadingDiv")?.remove();
|
|
18
27
|
|
|
19
|
-
const isDark = _colorMode ===
|
|
28
|
+
const isDark = _colorMode === "dark";
|
|
20
29
|
|
|
21
30
|
const handleNewUser = async () => {
|
|
22
|
-
setError(
|
|
31
|
+
setError("");
|
|
23
32
|
setIsValidating(true);
|
|
24
33
|
|
|
25
34
|
try {
|
|
@@ -31,29 +40,31 @@ export const SetupUser = () => {
|
|
|
31
40
|
await rpcServerCalls.setUserIdAndSecretKey(_userId, keys.secretKey);
|
|
32
41
|
|
|
33
42
|
// Auto-install peers-core for the new user
|
|
34
|
-
await rpcServerCalls
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
await rpcServerCalls
|
|
44
|
+
.addOrUpdatePackage(peersCorePackageId, { dataContextId: _userId })
|
|
45
|
+
.catch((err: unknown) => {
|
|
46
|
+
console.error("Error auto-installing peers-core:", err);
|
|
47
|
+
});
|
|
37
48
|
|
|
38
49
|
// Success - reload the app
|
|
39
50
|
window.location.reload();
|
|
40
51
|
} catch (err) {
|
|
41
|
-
setError(
|
|
52
|
+
setError(`Error creating new user: ${String(err).replaceAll("\n", " ")}`);
|
|
42
53
|
setIsValidating(false);
|
|
43
54
|
}
|
|
44
55
|
};
|
|
45
56
|
|
|
46
57
|
const handleExistingUser = async () => {
|
|
47
|
-
setError(
|
|
58
|
+
setError("");
|
|
48
59
|
|
|
49
60
|
// Validate inputs
|
|
50
61
|
if (!userId.trim() || !secretKey.trim()) {
|
|
51
|
-
setError(
|
|
62
|
+
setError("Please enter both User ID and Secret Key");
|
|
52
63
|
return;
|
|
53
64
|
}
|
|
54
65
|
|
|
55
66
|
if (isid(userId) !== true) {
|
|
56
|
-
setError(
|
|
67
|
+
setError("Invalid User ID format");
|
|
57
68
|
return;
|
|
58
69
|
}
|
|
59
70
|
|
|
@@ -67,7 +78,7 @@ export const SetupUser = () => {
|
|
|
67
78
|
const msgOpened = openMessageWithPublicKey(msgSigned, keys.publicKey);
|
|
68
79
|
|
|
69
80
|
if (msg !== msgOpened) {
|
|
70
|
-
throw new Error(
|
|
81
|
+
throw new Error("Secret key validation failed");
|
|
71
82
|
}
|
|
72
83
|
|
|
73
84
|
// Call setUserIdAndSecretKey
|
|
@@ -76,20 +87,32 @@ export const SetupUser = () => {
|
|
|
76
87
|
// Success - reload the app
|
|
77
88
|
window.location.reload();
|
|
78
89
|
} catch (err) {
|
|
79
|
-
setError(
|
|
90
|
+
setError(`Invalid credentials: ${String(err).replaceAll("\n", " ")}`);
|
|
80
91
|
setIsValidating(false);
|
|
81
92
|
}
|
|
82
93
|
};
|
|
83
94
|
|
|
84
95
|
// Step 1: Select User Type
|
|
85
|
-
if (step ===
|
|
96
|
+
if (step === "select-user-type" && isExistingUser === null) {
|
|
86
97
|
return (
|
|
87
|
-
<div
|
|
88
|
-
|
|
98
|
+
<div
|
|
99
|
+
className="container-fluid d-flex align-items-start justify-content-center"
|
|
100
|
+
style={{ paddingTop: "20px", backgroundColor: isDark ? "#212529" : "#f8f9fa" }}
|
|
101
|
+
>
|
|
102
|
+
<div
|
|
103
|
+
className="card shadow"
|
|
104
|
+
style={{
|
|
105
|
+
maxWidth: "500px",
|
|
106
|
+
width: "100%",
|
|
107
|
+
backgroundColor: isDark ? "#2d3238" : "#ffffff",
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
89
110
|
<div className="card-body p-4 p-md-5">
|
|
90
111
|
<div className="text-center mb-4">
|
|
91
|
-
<h2 className={`fw-bold mb-2 ${isDark ?
|
|
92
|
-
<p className={isDark ?
|
|
112
|
+
<h2 className={`fw-bold mb-2 ${isDark ? "text-light" : ""}`}>Welcome to Peers</h2>
|
|
113
|
+
<p className={isDark ? "text-light opacity-75" : "text-muted"}>
|
|
114
|
+
Let's get you set up
|
|
115
|
+
</p>
|
|
93
116
|
</div>
|
|
94
117
|
|
|
95
118
|
<div className="d-grid gap-3">
|
|
@@ -107,7 +130,7 @@ export const SetupUser = () => {
|
|
|
107
130
|
</button>
|
|
108
131
|
|
|
109
132
|
<button
|
|
110
|
-
className={`btn btn-lg py-3 ${isDark ?
|
|
133
|
+
className={`btn btn-lg py-3 ${isDark ? "btn-outline-light" : "btn-outline-primary"}`}
|
|
111
134
|
onClick={() => setIsExistingUser(true)}
|
|
112
135
|
>
|
|
113
136
|
<div className="d-flex align-items-center justify-content-center">
|
|
@@ -128,13 +151,25 @@ export const SetupUser = () => {
|
|
|
128
151
|
// Step 2: New User Confirmation
|
|
129
152
|
if (isExistingUser === false) {
|
|
130
153
|
return (
|
|
131
|
-
<div
|
|
132
|
-
|
|
154
|
+
<div
|
|
155
|
+
className="container-fluid d-flex align-items-start justify-content-center"
|
|
156
|
+
style={{ paddingTop: "20px", backgroundColor: isDark ? "#212529" : "#f8f9fa" }}
|
|
157
|
+
>
|
|
158
|
+
<div
|
|
159
|
+
className="card shadow"
|
|
160
|
+
style={{
|
|
161
|
+
maxWidth: "500px",
|
|
162
|
+
width: "100%",
|
|
163
|
+
backgroundColor: isDark ? "#2d3238" : "#ffffff",
|
|
164
|
+
}}
|
|
165
|
+
>
|
|
133
166
|
<div className="card-body p-4 p-md-5">
|
|
134
167
|
<div className="text-center mb-4">
|
|
135
168
|
<i className="bi bi-person-plus-fill text-primary fs-1 mb-3 d-block" />
|
|
136
|
-
<h3 className={`fw-bold mb-2 ${isDark ?
|
|
137
|
-
<p className={isDark ?
|
|
169
|
+
<h3 className={`fw-bold mb-2 ${isDark ? "text-light" : ""}`}>Create New Account</h3>
|
|
170
|
+
<p className={isDark ? "text-light opacity-75" : "text-muted"}>
|
|
171
|
+
We'll generate secure credentials for you
|
|
172
|
+
</p>
|
|
138
173
|
</div>
|
|
139
174
|
|
|
140
175
|
{error && (
|
|
@@ -181,16 +216,28 @@ export const SetupUser = () => {
|
|
|
181
216
|
// Step 3: Existing User Sign In
|
|
182
217
|
if (isExistingUser === true) {
|
|
183
218
|
return (
|
|
184
|
-
<div
|
|
185
|
-
|
|
219
|
+
<div
|
|
220
|
+
className="container-fluid d-flex align-items-start justify-content-center"
|
|
221
|
+
style={{ paddingTop: "20px", backgroundColor: isDark ? "#212529" : "#f8f9fa" }}
|
|
222
|
+
>
|
|
223
|
+
<div
|
|
224
|
+
className="card shadow"
|
|
225
|
+
style={{
|
|
226
|
+
maxWidth: "500px",
|
|
227
|
+
width: "100%",
|
|
228
|
+
backgroundColor: isDark ? "#2d3238" : "#ffffff",
|
|
229
|
+
}}
|
|
230
|
+
>
|
|
186
231
|
<div className="card-body p-4 p-md-5">
|
|
187
232
|
<div className="text-center mb-2">
|
|
188
|
-
<h3 className={`fw-bold mb-2 ${isDark ?
|
|
233
|
+
<h3 className={`fw-bold mb-2 ${isDark ? "text-light" : ""}`}>
|
|
189
234
|
<span>Sign In</span>
|
|
190
235
|
|
|
191
236
|
<i className="bi bi-box-arrow-in-right text-primary" />
|
|
192
237
|
</h3>
|
|
193
|
-
<p className={isDark ?
|
|
238
|
+
<p className={isDark ? "text-light opacity-75" : "text-muted"}>
|
|
239
|
+
Enter your existing credentials
|
|
240
|
+
</p>
|
|
194
241
|
</div>
|
|
195
242
|
|
|
196
243
|
{error && (
|
|
@@ -200,7 +247,12 @@ export const SetupUser = () => {
|
|
|
200
247
|
</div>
|
|
201
248
|
)}
|
|
202
249
|
|
|
203
|
-
<form
|
|
250
|
+
<form
|
|
251
|
+
onSubmit={(e) => {
|
|
252
|
+
e.preventDefault();
|
|
253
|
+
handleExistingUser();
|
|
254
|
+
}}
|
|
255
|
+
>
|
|
204
256
|
<div className="mb-3">
|
|
205
257
|
<label htmlFor="userId" className="form-label fw-semibold">
|
|
206
258
|
User ID
|
|
@@ -213,7 +265,6 @@ export const SetupUser = () => {
|
|
|
213
265
|
value={userId}
|
|
214
266
|
onChange={(e) => setUserId(e.target.value)}
|
|
215
267
|
disabled={isValidating}
|
|
216
|
-
autoFocus
|
|
217
268
|
/>
|
|
218
269
|
</div>
|
|
219
270
|
|
|
@@ -233,11 +284,7 @@ export const SetupUser = () => {
|
|
|
233
284
|
</div>
|
|
234
285
|
|
|
235
286
|
<div className="d-grid gap-2">
|
|
236
|
-
<button
|
|
237
|
-
type="submit"
|
|
238
|
-
className="btn btn-lg btn-primary"
|
|
239
|
-
disabled={isValidating}
|
|
240
|
-
>
|
|
287
|
+
<button type="submit" className="btn btn-lg btn-primary" disabled={isValidating}>
|
|
241
288
|
{isValidating ? (
|
|
242
289
|
<>
|
|
243
290
|
<span className="spinner-border spinner-border-sm me-2" />
|
|
@@ -269,4 +316,4 @@ export const SetupUser = () => {
|
|
|
269
316
|
}
|
|
270
317
|
|
|
271
318
|
return null;
|
|
272
|
-
}
|
|
319
|
+
};
|
|
@@ -1,35 +1,30 @@
|
|
|
1
|
-
import { computed, IDoc, ITool } from "@peers-app/peers-sdk";
|
|
2
|
-
import React from "react";
|
|
1
|
+
import { computed, type IDoc, type ITool, type Observable } from "@peers-app/peers-sdk";
|
|
3
2
|
import { MarkdownEditorInline } from "../../components/markdown-editor/editor-inline";
|
|
4
3
|
|
|
5
4
|
export const ToolCode = (props: { tool: IDoc<ITool> }) => {
|
|
6
5
|
const { tool } = props;
|
|
7
6
|
|
|
8
|
-
let code = tool.qs.code() ??
|
|
7
|
+
let code = tool.qs.code() ?? "";
|
|
9
8
|
const toolCodeObs = computed({
|
|
10
9
|
read: () => {
|
|
11
|
-
if (!code.startsWith(
|
|
12
|
-
code =
|
|
10
|
+
if (!code.startsWith("```")) {
|
|
11
|
+
code = `\`\`\`javascript\n${code}\n\`\`\``;
|
|
13
12
|
}
|
|
14
13
|
return code;
|
|
15
14
|
},
|
|
16
15
|
write: (newCode: string) => {
|
|
17
16
|
code = newCode;
|
|
18
|
-
if (code.startsWith(
|
|
19
|
-
code = code.replace(
|
|
20
|
-
code = code.replace(
|
|
17
|
+
if (code.startsWith("```javascript\n")) {
|
|
18
|
+
code = code.replace("```javascript\n", "");
|
|
19
|
+
code = code.replace("\n```", "");
|
|
21
20
|
}
|
|
22
21
|
tool.qs.code(code);
|
|
23
|
-
}
|
|
24
|
-
})
|
|
22
|
+
},
|
|
23
|
+
});
|
|
25
24
|
|
|
26
25
|
return (
|
|
27
26
|
<div>
|
|
28
|
-
<MarkdownEditorInline
|
|
29
|
-
value={toolCodeObs as any}
|
|
30
|
-
hideToolbar={true}
|
|
31
|
-
/>
|
|
27
|
+
<MarkdownEditorInline value={toolCodeObs as Observable<string>} hideToolbar={true} />
|
|
32
28
|
</div>
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
29
|
+
);
|
|
30
|
+
};
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { Tools } from "@peers-app/peers-sdk";
|
|
2
|
+
import { Input } from "../../components/input";
|
|
3
3
|
import { LoadingIndicator } from "../../components/loading-indicator";
|
|
4
4
|
import { SaveButton } from "../../components/save-button";
|
|
5
5
|
import { ScreenTabBody, Tabs } from "../../components/tabs";
|
|
6
|
+
import { usePromise } from "../../hooks";
|
|
7
|
+
import { updateActiveTabTitle } from "../../tabs-layout/tabs-state";
|
|
6
8
|
import { ToolCode } from "./tool-code";
|
|
7
9
|
import { ToolInfo } from "./tool-info";
|
|
8
10
|
import { ToolSchema } from "./tool-schema";
|
|
9
|
-
import { usePromise } from "../../hooks";
|
|
10
|
-
import { Input } from "../../components/input";
|
|
11
|
-
import { updateActiveTabTitle } from "../../tabs-layout/tabs-state";
|
|
12
|
-
|
|
13
11
|
|
|
14
12
|
interface IToolDetailsProps {
|
|
15
13
|
toolId: string;
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
export const ToolDetails = (props: IToolDetailsProps) => {
|
|
19
|
-
const tool = usePromise(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
const tool = usePromise(
|
|
18
|
+
async () => {
|
|
19
|
+
const toolData = await Tools().get(props.toolId);
|
|
20
|
+
if (!toolData) return null;
|
|
21
|
+
updateActiveTabTitle(toolData.name || "Tool");
|
|
22
|
+
return Tools().initDoc(toolData);
|
|
23
|
+
},
|
|
24
|
+
undefined,
|
|
25
|
+
[props.toolId],
|
|
26
|
+
);
|
|
25
27
|
|
|
26
28
|
if (tool === null) {
|
|
27
29
|
return <div>Tool not found</div>;
|
|
@@ -36,10 +38,8 @@ export const ToolDetails = (props: IToolDetailsProps) => {
|
|
|
36
38
|
tool.save();
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
|
|
40
41
|
return (
|
|
41
|
-
<div className="container-fluid p-3" style={{ overflowY:
|
|
42
|
-
|
|
42
|
+
<div className="container-fluid p-3" style={{ overflowY: "hidden" }}>
|
|
43
43
|
<div className="d-flex">
|
|
44
44
|
<div>
|
|
45
45
|
<h4>
|
|
@@ -50,42 +50,43 @@ export const ToolDetails = (props: IToolDetailsProps) => {
|
|
|
50
50
|
<h4>
|
|
51
51
|
<Input
|
|
52
52
|
key={tool.toolId}
|
|
53
|
-
className=
|
|
54
|
-
style={{ width:
|
|
53
|
+
className="border border-0"
|
|
54
|
+
style={{ width: "100%", outline: "none", backgroundColor: "transparent" }}
|
|
55
55
|
value={tool.qs.name}
|
|
56
56
|
/>
|
|
57
57
|
</h4>
|
|
58
58
|
</div>
|
|
59
59
|
<div>
|
|
60
|
-
<SaveButton
|
|
61
|
-
key={tool.toolId}
|
|
62
|
-
onClick={saveChanges}
|
|
63
|
-
doc={tool}
|
|
64
|
-
/>
|
|
60
|
+
<SaveButton key={tool.toolId} onClick={saveChanges} doc={tool} />
|
|
65
61
|
</div>
|
|
66
62
|
</div>
|
|
67
63
|
|
|
68
|
-
|
|
69
64
|
<Tabs
|
|
70
65
|
key={tool.toolId}
|
|
71
66
|
tabs={[
|
|
72
67
|
{
|
|
73
|
-
name:
|
|
68
|
+
name: "Info",
|
|
69
|
+
content: (
|
|
74
70
|
<ScreenTabBody>
|
|
75
71
|
<ToolInfo tool={tool} />
|
|
76
72
|
</ScreenTabBody>
|
|
73
|
+
),
|
|
77
74
|
},
|
|
78
75
|
{
|
|
79
|
-
name:
|
|
76
|
+
name: "Schema",
|
|
77
|
+
content: (
|
|
80
78
|
<ScreenTabBody>
|
|
81
79
|
<ToolSchema tool={tool} />
|
|
82
80
|
</ScreenTabBody>
|
|
81
|
+
),
|
|
83
82
|
},
|
|
84
83
|
{
|
|
85
|
-
name:
|
|
84
|
+
name: "Code",
|
|
85
|
+
content: (
|
|
86
86
|
<ScreenTabBody>
|
|
87
87
|
<ToolCode tool={tool} />
|
|
88
88
|
</ScreenTabBody>
|
|
89
|
+
),
|
|
89
90
|
},
|
|
90
91
|
// {
|
|
91
92
|
// name: 'Tests', content:
|
|
@@ -95,7 +96,6 @@ export const ToolDetails = (props: IToolDetailsProps) => {
|
|
|
95
96
|
// },
|
|
96
97
|
]}
|
|
97
98
|
/>
|
|
98
|
-
|
|
99
99
|
</div>
|
|
100
|
-
)
|
|
101
|
-
}
|
|
100
|
+
);
|
|
101
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IDoc, ITool, observable } from "@peers-app/peers-sdk";
|
|
2
|
-
import
|
|
1
|
+
import { type IDoc, type ITool, observable } from "@peers-app/peers-sdk";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
3
|
import { Checkbox } from "../../components/checkbox";
|
|
4
4
|
import { Input } from "../../components/input";
|
|
5
5
|
import { MarkdownEditorInline } from "../../components/markdown-editor/editor-inline";
|
|
@@ -8,14 +8,17 @@ export const ToolInfo = (props: { tool: IDoc<ITool> }) => {
|
|
|
8
8
|
const { tool } = props;
|
|
9
9
|
|
|
10
10
|
const [markdownUsageObs] = useState(() => observable(tool.usageDescription));
|
|
11
|
-
const [markdownDetailedObs] = useState(() => observable(tool.detailedDescription ||
|
|
11
|
+
const [markdownDetailedObs] = useState(() => observable(tool.detailedDescription || ""));
|
|
12
12
|
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
const sub = markdownUsageObs.subscribe(() => {
|
|
15
15
|
tool.usageDescription = markdownUsageObs();
|
|
16
16
|
});
|
|
17
17
|
const sub2 = tool.qs.name.subscribe(() => {
|
|
18
|
-
tool.name = tool.qs
|
|
18
|
+
tool.name = tool.qs
|
|
19
|
+
.name()
|
|
20
|
+
.replaceAll(/\s/g, "_")
|
|
21
|
+
.replaceAll(/[^a-zA-Z0-9_-]/g, "");
|
|
19
22
|
});
|
|
20
23
|
const sub3 = markdownDetailedObs.subscribe(() => {
|
|
21
24
|
tool.detailedDescription = markdownDetailedObs();
|
|
@@ -24,9 +27,8 @@ export const ToolInfo = (props: { tool: IDoc<ITool> }) => {
|
|
|
24
27
|
sub.dispose();
|
|
25
28
|
sub2.dispose();
|
|
26
29
|
sub3.dispose();
|
|
27
|
-
}
|
|
28
|
-
}, [tool]);
|
|
29
|
-
|
|
30
|
+
};
|
|
31
|
+
}, [tool, markdownDetailedObs, markdownUsageObs]);
|
|
30
32
|
|
|
31
33
|
return (
|
|
32
34
|
<div>
|
|
@@ -40,21 +42,14 @@ export const ToolInfo = (props: { tool: IDoc<ITool> }) => {
|
|
|
40
42
|
|
|
41
43
|
<div>
|
|
42
44
|
<label className="form-label small mt-2 me-2">Is Assistant Runner:</label>
|
|
43
|
-
<Checkbox
|
|
44
|
-
className="form-check-input mt-2"
|
|
45
|
-
checked={tool.qs.isAssistantRunner}
|
|
46
|
-
/>
|
|
45
|
+
<Checkbox className="form-check-input mt-2" checked={tool.qs.isAssistantRunner} />
|
|
47
46
|
</div>
|
|
48
47
|
|
|
49
48
|
<small>Usage Description:</small>
|
|
50
|
-
<MarkdownEditorInline
|
|
51
|
-
value={markdownUsageObs}
|
|
52
|
-
/>
|
|
49
|
+
<MarkdownEditorInline value={markdownUsageObs} />
|
|
53
50
|
<br />
|
|
54
51
|
<small>Detailed Description:</small>
|
|
55
|
-
<MarkdownEditorInline
|
|
56
|
-
value={markdownDetailedObs}
|
|
57
|
-
/>
|
|
52
|
+
<MarkdownEditorInline value={markdownDetailedObs} />
|
|
58
53
|
</div>
|
|
59
|
-
)
|
|
60
|
-
}
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import {
|
|
2
|
+
FieldType,
|
|
3
|
+
type ICursorIterable,
|
|
4
|
+
IOSchemaType,
|
|
5
|
+
type ITool,
|
|
6
|
+
newid,
|
|
7
|
+
observable,
|
|
8
|
+
Tools,
|
|
9
|
+
} from "@peers-app/peers-sdk";
|
|
10
|
+
import type React from "react";
|
|
11
|
+
import { useEffect, useState } from "react";
|
|
12
|
+
import { Input } from "../../components/input";
|
|
13
|
+
import { LazyList } from "../../components/lazy-list";
|
|
14
|
+
import { LoadingIndicator } from "../../components/loading-indicator";
|
|
15
|
+
import { MarkdownWithMentions } from "../../components/markdown-with-mentions";
|
|
16
|
+
import { isDesktop, mainContentPath } from "../../globals";
|
|
17
|
+
import { useObservable } from "../../hooks";
|
|
9
18
|
|
|
10
19
|
export function ToolList() {
|
|
11
|
-
|
|
12
|
-
const [searchTextObs] = useState(() => observable(''));
|
|
20
|
+
const [searchTextObs] = useState(() => observable(""));
|
|
13
21
|
const [searchText] = useObservable(searchTextObs);
|
|
14
22
|
|
|
15
23
|
const [cursorObs] = useState(() => observable<ICursorIterable<ITool> | undefined>());
|
|
@@ -19,9 +27,12 @@ export function ToolList() {
|
|
|
19
27
|
let cursor: ICursorIterable<ITool>;
|
|
20
28
|
const _searchText = searchText.trim();
|
|
21
29
|
if (_searchText) {
|
|
22
|
-
cursor = await Tools().cursor(
|
|
30
|
+
cursor = await Tools().cursor(
|
|
31
|
+
{ name: { $matchWords: _searchText } },
|
|
32
|
+
{ sortBy: ["-toolId"] },
|
|
33
|
+
);
|
|
23
34
|
} else {
|
|
24
|
-
cursor = await Tools().cursor(undefined, { sortBy: [
|
|
35
|
+
cursor = await Tools().cursor(undefined, { sortBy: ["-toolId"] });
|
|
25
36
|
}
|
|
26
37
|
|
|
27
38
|
cursorObs(cursor);
|
|
@@ -35,28 +46,37 @@ export function ToolList() {
|
|
|
35
46
|
cursorId(newid());
|
|
36
47
|
});
|
|
37
48
|
return () => sub.dispose();
|
|
38
|
-
}, [
|
|
49
|
+
}, [cursorId, cursorObs, searchTextObs.subscribe]);
|
|
39
50
|
|
|
40
51
|
async function searchSubmit(evt: React.KeyboardEvent<HTMLInputElement>) {
|
|
41
52
|
if (evt.key !== "Enter") return;
|
|
42
53
|
if (!searchText.trim()) return;
|
|
43
|
-
|
|
54
|
+
const toolName = searchText
|
|
55
|
+
.trim()
|
|
56
|
+
.replace(/\s+/g, "_")
|
|
57
|
+
.replaceAll(/[^a-zA-Z0-9_]/g, "");
|
|
44
58
|
const tool = await Tools().initRecord({
|
|
45
59
|
name: toolName,
|
|
46
60
|
usageDescription: searchText.trim(),
|
|
47
|
-
detailedDescription:
|
|
48
|
-
inputSchema: {
|
|
49
|
-
|
|
61
|
+
detailedDescription: "",
|
|
62
|
+
inputSchema: {
|
|
63
|
+
type: IOSchemaType.simple,
|
|
64
|
+
fields: [{ name: "input", type: FieldType.string, description: "" }],
|
|
65
|
+
},
|
|
66
|
+
outputSchema: {
|
|
67
|
+
type: IOSchemaType.simple,
|
|
68
|
+
fields: [{ name: "output", type: FieldType.string, description: "" }],
|
|
69
|
+
},
|
|
50
70
|
});
|
|
51
71
|
await Tools().insert(tool);
|
|
52
72
|
mainContentPath(`tools/${tool.toolId}`);
|
|
53
73
|
}
|
|
54
74
|
|
|
55
75
|
async function loadMore(existingTools: ITool[]): Promise<ITool[]> {
|
|
56
|
-
|
|
57
|
-
|
|
76
|
+
const moreMatches: ITool[] = [];
|
|
77
|
+
const cursor = cursorObs() || (await newCursor());
|
|
58
78
|
for await (const tool of cursor) {
|
|
59
|
-
if (existingTools.find(w => w.toolId === tool.toolId)) continue;
|
|
79
|
+
if (existingTools.find((w) => w.toolId === tool.toolId)) continue;
|
|
60
80
|
moreMatches.push(tool);
|
|
61
81
|
if (searchText.length && moreMatches.length > 5) break;
|
|
62
82
|
if (moreMatches.length >= 50) break;
|
|
@@ -68,41 +88,39 @@ export function ToolList() {
|
|
|
68
88
|
}
|
|
69
89
|
|
|
70
90
|
return (
|
|
71
|
-
<div className=
|
|
72
|
-
<Input
|
|
73
|
-
|
|
74
|
-
|
|
91
|
+
<div className="container-fluid">
|
|
92
|
+
<Input
|
|
93
|
+
value={searchTextObs}
|
|
94
|
+
className="form-control mt-3"
|
|
95
|
+
style={{ marginBottom: "10px" }}
|
|
96
|
+
placeholder="Search or create new tool"
|
|
97
|
+
autoFocus={!!isDesktop()}
|
|
98
|
+
onKeyUp={(evt) => searchSubmit(evt)}
|
|
75
99
|
/>
|
|
76
100
|
|
|
77
101
|
<div className="peers-list-container">
|
|
78
102
|
<LazyList
|
|
79
103
|
key={cursorId()}
|
|
80
104
|
loadMore={loadMore}
|
|
81
|
-
scrollThreshold={0.6}
|
|
105
|
+
scrollThreshold={0.6}
|
|
82
106
|
renderItems={(tools) => {
|
|
83
|
-
return tools.map(tool => {
|
|
84
|
-
let markdownContent =
|
|
107
|
+
return tools.map((tool) => {
|
|
108
|
+
let markdownContent = `${tool.usageDescription}\n\n---\n\n${tool.detailedDescription ?? ""}`;
|
|
85
109
|
const maxLen = 500;
|
|
86
110
|
if (markdownContent.length > maxLen) {
|
|
87
|
-
markdownContent = markdownContent.substring(0, maxLen)
|
|
111
|
+
markdownContent = `${markdownContent.substring(0, maxLen)}...`;
|
|
88
112
|
}
|
|
89
|
-
markdownContent = markdownContent.replace(/\n\n---\n\n$/,
|
|
113
|
+
markdownContent = markdownContent.replace(/\n\n---\n\n$/, "");
|
|
90
114
|
return (
|
|
91
|
-
<div
|
|
92
|
-
key={tool.toolId}
|
|
93
|
-
className='container-fluid pb-4'
|
|
94
|
-
>
|
|
115
|
+
<div key={tool.toolId} className="container-fluid pb-4">
|
|
95
116
|
<i className="bi bi-tools"></i>
|
|
96
|
-
<a href={`#tools/${tool.toolId}`}>
|
|
97
|
-
|
|
98
|
-
</a>
|
|
99
|
-
<div style={{ paddingLeft: '20px' }}>
|
|
117
|
+
<a href={`#tools/${tool.toolId}`}>{tool.name}</a>
|
|
118
|
+
<div style={{ paddingLeft: "20px" }}>
|
|
100
119
|
<MarkdownWithMentions content={markdownContent} />
|
|
101
120
|
</div>
|
|
102
|
-
|
|
103
121
|
</div>
|
|
104
|
-
)
|
|
105
|
-
})
|
|
122
|
+
);
|
|
123
|
+
});
|
|
106
124
|
}}
|
|
107
125
|
loadingIndicator={
|
|
108
126
|
<div className="d-flex justify-content-center" style={{ height: 200 }}>
|