@peers-app/peers-ui 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/README.md +52 -0
- package/.github/workflows/publish.yml +45 -0
- package/babel.config.js +7 -0
- package/dist/app.d.ts +9 -0
- package/dist/app.js +54 -0
- package/dist/command-palette/command-palette-ui.d.ts +2 -0
- package/dist/command-palette/command-palette-ui.js +192 -0
- package/dist/command-palette/command-palette.d.ts +23 -0
- package/dist/command-palette/command-palette.js +371 -0
- package/dist/components/checkbox.d.ts +7 -0
- package/dist/components/checkbox.js +20 -0
- package/dist/components/group-switcher.d.ts +6 -0
- package/dist/components/group-switcher.js +301 -0
- package/dist/components/input-date.d.ts +7 -0
- package/dist/components/input-date.js +19 -0
- package/dist/components/input-datetime.d.ts +7 -0
- package/dist/components/input-datetime.js +35 -0
- package/dist/components/input-number.d.ts +9 -0
- package/dist/components/input-number.js +87 -0
- package/dist/components/input.d.ts +7 -0
- package/dist/components/input.js +20 -0
- package/dist/components/io-schema-values.d.ts +15 -0
- package/dist/components/io-schema-values.js +105 -0
- package/dist/components/io-schema.d.ts +13 -0
- package/dist/components/io-schema.js +163 -0
- package/dist/components/lazy-list.d.ts +13 -0
- package/dist/components/lazy-list.js +91 -0
- package/dist/components/lazy-sortable-list.d.ts +29 -0
- package/dist/components/lazy-sortable-list.js +12 -0
- package/dist/components/left-bar.d.ts +3 -0
- package/dist/components/left-bar.js +130 -0
- package/dist/components/list-screen.d.ts +16 -0
- package/dist/components/list-screen.js +100 -0
- package/dist/components/loading-indicator.d.ts +2 -0
- package/dist/components/loading-indicator.js +12 -0
- package/dist/components/main-content-container.d.ts +2 -0
- package/dist/components/main-content-container.js +90 -0
- package/dist/components/markdown-editor/autolink-plugin.d.ts +2 -0
- package/dist/components/markdown-editor/autolink-plugin.js +29 -0
- package/dist/components/markdown-editor/editor-inline.d.ts +3 -0
- package/dist/components/markdown-editor/editor-inline.js +13 -0
- package/dist/components/markdown-editor/editor.d.ts +18 -0
- package/dist/components/markdown-editor/editor.js +143 -0
- package/dist/components/markdown-editor/markdown-plugin.d.ts +9 -0
- package/dist/components/markdown-editor/markdown-plugin.js +194 -0
- package/dist/components/markdown-editor/mention-node.d.ts +21 -0
- package/dist/components/markdown-editor/mention-node.js +160 -0
- package/dist/components/markdown-editor/mentions-plugin.d.ts +7 -0
- package/dist/components/markdown-editor/mentions-plugin.js +268 -0
- package/dist/components/markdown-editor/theme.d.ts +46 -0
- package/dist/components/markdown-editor/theme.js +48 -0
- package/dist/components/markdown-editor/toolbar.d.ts +10 -0
- package/dist/components/markdown-editor/toolbar.js +112 -0
- package/dist/components/markdown-with-mentions.d.ts +4 -0
- package/dist/components/markdown-with-mentions.js +140 -0
- package/dist/components/message-logs/message-logs.d.ts +6 -0
- package/dist/components/message-logs/message-logs.js +307 -0
- package/dist/components/messages/avatar.d.ts +10 -0
- package/dist/components/messages/avatar.js +65 -0
- package/dist/components/messages/channel-message-list.d.ts +14 -0
- package/dist/components/messages/channel-message-list.js +158 -0
- package/dist/components/messages/channel-view.d.ts +6 -0
- package/dist/components/messages/channel-view.js +82 -0
- package/dist/components/messages/message-compose.d.ts +11 -0
- package/dist/components/messages/message-compose.js +152 -0
- package/dist/components/messages/message-display.d.ts +10 -0
- package/dist/components/messages/message-display.js +152 -0
- package/dist/components/messages/thread-message-list.d.ts +11 -0
- package/dist/components/messages/thread-message-list.js +122 -0
- package/dist/components/messages/thread-view.d.ts +6 -0
- package/dist/components/messages/thread-view.js +174 -0
- package/dist/components/off-canvas.d.ts +13 -0
- package/dist/components/off-canvas.js +89 -0
- package/dist/components/router.d.ts +6 -0
- package/dist/components/router.js +240 -0
- package/dist/components/save-button.d.ts +13 -0
- package/dist/components/save-button.js +75 -0
- package/dist/components/sortable-list.d.ts +36 -0
- package/dist/components/sortable-list.js +77 -0
- package/dist/components/tabs.d.ts +11 -0
- package/dist/components/tabs.js +69 -0
- package/dist/components/text-list-editor.tsx/text-list-editor.d.ts +6 -0
- package/dist/components/text-list-editor.tsx/text-list-editor.js +13 -0
- package/dist/components/tooltip.d.ts +11 -0
- package/dist/components/tooltip.js +20 -0
- package/dist/components/top-bar.d.ts +2 -0
- package/dist/components/top-bar.js +51 -0
- package/dist/components/typeahead/mentions-plugin.d.ts +7 -0
- package/dist/components/typeahead/mentions-plugin.js +203 -0
- package/dist/components/typeahead/typeahead-editor.d.ts +15 -0
- package/dist/components/typeahead/typeahead-editor.js +134 -0
- package/dist/components/typeahead/typeahead.d.ts +12 -0
- package/dist/components/typeahead/typeahead.js +94 -0
- package/dist/components/typeahead.d.ts +22 -0
- package/dist/components/typeahead.js +270 -0
- package/dist/globals.d.ts +29 -0
- package/dist/globals.js +148 -0
- package/dist/hooks.d.ts +34 -0
- package/dist/hooks.js +137 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +20 -0
- package/dist/layout-vars.d.ts +6 -0
- package/dist/layout-vars.js +10 -0
- package/dist/mention-configs.d.ts +18 -0
- package/dist/mention-configs.js +149 -0
- package/dist/screens/assistants/assistant-config.d.ts +5 -0
- package/dist/screens/assistants/assistant-config.js +52 -0
- package/dist/screens/assistants/assistant-details.d.ts +4 -0
- package/dist/screens/assistants/assistant-details.js +85 -0
- package/dist/screens/assistants/assistant-info.d.ts +6 -0
- package/dist/screens/assistants/assistant-info.js +28 -0
- package/dist/screens/assistants/assistant-list.d.ts +2 -0
- package/dist/screens/assistants/assistant-list.js +114 -0
- package/dist/screens/assistants/assistant-tools.d.ts +5 -0
- package/dist/screens/assistants/assistant-tools.js +38 -0
- package/dist/screens/contacts/contact-details.d.ts +6 -0
- package/dist/screens/contacts/contact-details.js +100 -0
- package/dist/screens/contacts/contact-list.d.ts +2 -0
- package/dist/screens/contacts/contact-list.js +213 -0
- package/dist/screens/contacts/index.d.ts +4 -0
- package/dist/screens/contacts/index.js +21 -0
- package/dist/screens/events/cron.d.ts +3 -0
- package/dist/screens/events/cron.js +77 -0
- package/dist/screens/events/event-details.d.ts +6 -0
- package/dist/screens/events/event-details.js +112 -0
- package/dist/screens/events/event-handlers.d.ts +7 -0
- package/dist/screens/events/event-handlers.js +84 -0
- package/dist/screens/events/event-info.d.ts +5 -0
- package/dist/screens/events/event-info.js +19 -0
- package/dist/screens/events/event-list.d.ts +2 -0
- package/dist/screens/events/event-list.js +107 -0
- package/dist/screens/events/event-schedule.d.ts +5 -0
- package/dist/screens/events/event-schedule.js +124 -0
- package/dist/screens/groups/group-details.d.ts +6 -0
- package/dist/screens/groups/group-details.js +218 -0
- package/dist/screens/groups/group-list.d.ts +2 -0
- package/dist/screens/groups/group-list.js +275 -0
- package/dist/screens/groups/group-members.d.ts +8 -0
- package/dist/screens/groups/group-members.js +315 -0
- package/dist/screens/groups/index.d.ts +6 -0
- package/dist/screens/groups/index.js +23 -0
- package/dist/screens/knowledge/knowledge-frame-details.bk.d.ts +6 -0
- package/dist/screens/knowledge/knowledge-frame-details.bk.js +84 -0
- package/dist/screens/knowledge/knowledge-frame-details.d.ts +8 -0
- package/dist/screens/knowledge/knowledge-frame-details.js +143 -0
- package/dist/screens/knowledge/knowledge-frame-list.d.ts +2 -0
- package/dist/screens/knowledge/knowledge-frame-list.js +45 -0
- package/dist/screens/knowledge/knowledge-value-details.d.ts +6 -0
- package/dist/screens/knowledge/knowledge-value-details.js +150 -0
- package/dist/screens/knowledge/knowledge-value-list-item.d.ts +5 -0
- package/dist/screens/knowledge/knowledge-value-list-item.js +39 -0
- package/dist/screens/knowledge/knowledge-value-list.d.ts +3 -0
- package/dist/screens/knowledge/knowledge-value-list.js +123 -0
- package/dist/screens/packages/package-details.d.ts +6 -0
- package/dist/screens/packages/package-details.js +82 -0
- package/dist/screens/packages/package-info.d.ts +5 -0
- package/dist/screens/packages/package-info.js +42 -0
- package/dist/screens/packages/package-list.d.ts +2 -0
- package/dist/screens/packages/package-list.js +182 -0
- package/dist/screens/packages/package-new-local.d.ts +2 -0
- package/dist/screens/packages/package-new-local.js +82 -0
- package/dist/screens/peer-types/peer-type-details.d.ts +10 -0
- package/dist/screens/peer-types/peer-type-details.js +126 -0
- package/dist/screens/peer-types/peer-type-list.d.ts +2 -0
- package/dist/screens/peer-types/peer-type-list.js +57 -0
- package/dist/screens/predicates/predicate-details.d.ts +6 -0
- package/dist/screens/predicates/predicate-details.js +103 -0
- package/dist/screens/predicates/predicate-list.d.ts +2 -0
- package/dist/screens/predicates/predicate-list.js +46 -0
- package/dist/screens/profile.d.ts +2 -0
- package/dist/screens/profile.js +66 -0
- package/dist/screens/search/global-search.d.ts +2 -0
- package/dist/screens/search/global-search.js +186 -0
- package/dist/screens/settings/color-mode-dropdown.d.ts +6 -0
- package/dist/screens/settings/color-mode-dropdown.js +63 -0
- package/dist/screens/settings/settings-page.d.ts +2 -0
- package/dist/screens/settings/settings-page.js +49 -0
- package/dist/screens/setup-user.d.ts +2 -0
- package/dist/screens/setup-user.js +270 -0
- package/dist/screens/tools/tool-code.d.ts +5 -0
- package/dist/screens/tools/tool-code.js +32 -0
- package/dist/screens/tools/tool-details.d.ts +6 -0
- package/dist/screens/tools/tool-details.js +68 -0
- package/dist/screens/tools/tool-info.d.ts +5 -0
- package/dist/screens/tools/tool-info.js +74 -0
- package/dist/screens/tools/tool-list.d.ts +2 -0
- package/dist/screens/tools/tool-list.js +123 -0
- package/dist/screens/tools/tool-schema.d.ts +5 -0
- package/dist/screens/tools/tool-schema.js +30 -0
- package/dist/screens/tools/tool-test-details.d.ts +4 -0
- package/dist/screens/tools/tool-test-details.js +54 -0
- package/dist/screens/tools/tool-test-list.d.ts +4 -0
- package/dist/screens/tools/tool-test-list.js +82 -0
- package/dist/screens/variables/variable-details.d.ts +6 -0
- package/dist/screens/variables/variable-details.js +140 -0
- package/dist/screens/variables/variable-list.d.ts +2 -0
- package/dist/screens/variables/variable-list.js +58 -0
- package/dist/screens/workflows/workflow-details.d.ts +6 -0
- package/dist/screens/workflows/workflow-details.js +122 -0
- package/dist/screens/workflows/workflow-info.d.ts +5 -0
- package/dist/screens/workflows/workflow-info.js +18 -0
- package/dist/screens/workflows/workflow-instructions.d.ts +5 -0
- package/dist/screens/workflows/workflow-instructions.js +118 -0
- package/dist/screens/workflows/workflow-list.d.ts +2 -0
- package/dist/screens/workflows/workflow-list.js +109 -0
- package/dist/screens/workflows/workflow-subscriptions.d.ts +6 -0
- package/dist/screens/workflows/workflow-subscriptions.js +81 -0
- package/dist/setupTests.d.ts +1 -0
- package/dist/setupTests.js +31 -0
- package/dist/system-apps/assistants.app.d.ts +2 -0
- package/dist/system-apps/assistants.app.js +8 -0
- package/dist/system-apps/contacts.app.d.ts +2 -0
- package/dist/system-apps/contacts.app.js +9 -0
- package/dist/system-apps/events.app.d.ts +2 -0
- package/dist/system-apps/events.app.js +8 -0
- package/dist/system-apps/groups.app.d.ts +2 -0
- package/dist/system-apps/groups.app.js +9 -0
- package/dist/system-apps/index.d.ts +19 -0
- package/dist/system-apps/index.js +90 -0
- package/dist/system-apps/knowledge-frames.app.d.ts +2 -0
- package/dist/system-apps/knowledge-frames.app.js +9 -0
- package/dist/system-apps/knowledge-values.app.d.ts +2 -0
- package/dist/system-apps/knowledge-values.app.js +9 -0
- package/dist/system-apps/packages.app.d.ts +2 -0
- package/dist/system-apps/packages.app.js +8 -0
- package/dist/system-apps/predicates.app.d.ts +2 -0
- package/dist/system-apps/predicates.app.js +8 -0
- package/dist/system-apps/profile.app.d.ts +2 -0
- package/dist/system-apps/profile.app.js +8 -0
- package/dist/system-apps/search.app.d.ts +2 -0
- package/dist/system-apps/search.app.js +9 -0
- package/dist/system-apps/settings.app.d.ts +2 -0
- package/dist/system-apps/settings.app.js +8 -0
- package/dist/system-apps/threads.app.d.ts +2 -0
- package/dist/system-apps/threads.app.js +8 -0
- package/dist/system-apps/tools.app.d.ts +2 -0
- package/dist/system-apps/tools.app.js +8 -0
- package/dist/system-apps/types.app.d.ts +2 -0
- package/dist/system-apps/types.app.js +8 -0
- package/dist/system-apps/variables.app.d.ts +2 -0
- package/dist/system-apps/variables.app.js +8 -0
- package/dist/system-apps/workflows.app.d.ts +2 -0
- package/dist/system-apps/workflows.app.js +8 -0
- package/dist/tabs-layout/tabs-layout.d.ts +5 -0
- package/dist/tabs-layout/tabs-layout.js +374 -0
- package/dist/tabs-layout/tabs-state.d.ts +26 -0
- package/dist/tabs-layout/tabs-state.js +239 -0
- package/dist/three-bar-layout/left-bar-content.d.ts +7 -0
- package/dist/three-bar-layout/left-bar-content.js +151 -0
- package/dist/three-bar-layout/right-bar-content.d.ts +2 -0
- package/dist/three-bar-layout/right-bar-content.js +64 -0
- package/dist/three-bar-layout/three-bar-layout.d.ts +5 -0
- package/dist/three-bar-layout/three-bar-layout.js +218 -0
- package/dist/ui-defaults/index.d.ts +2 -0
- package/dist/ui-defaults/index.js +4 -0
- package/dist/ui-defaults/list-screen.d.ts +6 -0
- package/dist/ui-defaults/list-screen.js +74 -0
- package/dist/ui-defaults/notes-editor.d.ts +7 -0
- package/dist/ui-defaults/notes-editor.js +41 -0
- package/dist/ui-router/routes-loader.d.ts +25 -0
- package/dist/ui-router/routes-loader.js +97 -0
- package/dist/ui-router/ui-loader.d.ts +18 -0
- package/dist/ui-router/ui-loader.js +481 -0
- package/dist/utils.d.ts +9 -0
- package/dist/utils.js +250 -0
- package/docs/conversation-tab.md +201 -0
- package/docs/getting-started.md +284 -0
- package/docs/knowledge.md +187 -0
- package/docs/tabs-ui.md +696 -0
- package/docs/user-contacts-ui.md +384 -0
- package/jest.config.js +25 -0
- package/package.json +109 -0
- package/src/app.tsx +59 -0
- package/src/command-palette/command-palette-ui.tsx +264 -0
- package/src/command-palette/command-palette.ts +364 -0
- package/src/components/checkbox.tsx +22 -0
- package/src/components/group-switcher.tsx +469 -0
- package/src/components/input-date.tsx +28 -0
- package/src/components/input-datetime.tsx +41 -0
- package/src/components/input-number.tsx +67 -0
- package/src/components/input.tsx +22 -0
- package/src/components/io-schema-values.tsx +122 -0
- package/src/components/io-schema.tsx +234 -0
- package/src/components/lazy-list.tsx +98 -0
- package/src/components/lazy-sortable-list.tsx +51 -0
- package/src/components/left-bar.tsx +264 -0
- package/src/components/list-screen.tsx +105 -0
- package/src/components/loading-indicator.tsx +9 -0
- package/src/components/main-content-container.tsx +76 -0
- package/src/components/markdown-editor/autolink-plugin.tsx +36 -0
- package/src/components/markdown-editor/editor-inline.tsx +10 -0
- package/src/components/markdown-editor/editor.tsx +152 -0
- package/src/components/markdown-editor/markdown-plugin.tsx +224 -0
- package/src/components/markdown-editor/mention-node.ts +199 -0
- package/src/components/markdown-editor/mentions-plugin.tsx +356 -0
- package/src/components/markdown-editor/theme.ts +47 -0
- package/src/components/markdown-editor/toolbar.tsx +263 -0
- package/src/components/markdown-with-mentions.tsx +183 -0
- package/src/components/message-logs/message-logs.tsx +406 -0
- package/src/components/messages/avatar.tsx +95 -0
- package/src/components/messages/channel-message-list.tsx +177 -0
- package/src/components/messages/channel-view.tsx +74 -0
- package/src/components/messages/message-compose.tsx +162 -0
- package/src/components/messages/message-display.tsx +217 -0
- package/src/components/messages/thread-message-list.tsx +126 -0
- package/src/components/messages/thread-view.tsx +214 -0
- package/src/components/off-canvas.tsx +83 -0
- package/src/components/router.tsx +224 -0
- package/src/components/save-button.tsx +109 -0
- package/src/components/sortable-list.tsx +102 -0
- package/src/components/tabs.tsx +70 -0
- package/src/components/text-list-editor.tsx/text-list-editor.tsx +13 -0
- package/src/components/tooltip.tsx +50 -0
- package/src/components/top-bar.tsx +119 -0
- package/src/components/typeahead/mentions-plugin.tsx +265 -0
- package/src/components/typeahead/typeahead-editor.tsx +140 -0
- package/src/components/typeahead/typeahead.tsx +77 -0
- package/src/components/typeahead.tsx +359 -0
- package/src/globals.tsx +162 -0
- package/src/hooks.ts +144 -0
- package/src/index.tsx +8 -0
- package/src/layout-vars.ts +8 -0
- package/src/mention-configs.ts +166 -0
- package/src/screens/assistants/assistant-config.tsx +80 -0
- package/src/screens/assistants/assistant-details.tsx +77 -0
- package/src/screens/assistants/assistant-info.tsx +45 -0
- package/src/screens/assistants/assistant-list.tsx +115 -0
- package/src/screens/assistants/assistant-tools.tsx +61 -0
- package/src/screens/contacts/contact-details.tsx +175 -0
- package/src/screens/contacts/contact-list.tsx +251 -0
- package/src/screens/contacts/index.ts +6 -0
- package/src/screens/events/cron.ts +74 -0
- package/src/screens/events/event-details.tsx +117 -0
- package/src/screens/events/event-handlers.tsx +61 -0
- package/src/screens/events/event-info.tsx +29 -0
- package/src/screens/events/event-list.tsx +104 -0
- package/src/screens/events/event-schedule.tsx +130 -0
- package/src/screens/groups/group-details.tsx +306 -0
- package/src/screens/groups/group-list.tsx +366 -0
- package/src/screens/groups/group-members.tsx +455 -0
- package/src/screens/groups/index.ts +9 -0
- package/src/screens/knowledge/knowledge-frame-details.bk.tsx +160 -0
- package/src/screens/knowledge/knowledge-frame-details.tsx +176 -0
- package/src/screens/knowledge/knowledge-frame-list.tsx +49 -0
- package/src/screens/knowledge/knowledge-value-details.tsx +181 -0
- package/src/screens/knowledge/knowledge-value-list-item.tsx +48 -0
- package/src/screens/knowledge/knowledge-value-list.tsx +131 -0
- package/src/screens/packages/package-details.tsx +117 -0
- package/src/screens/packages/package-info.tsx +83 -0
- package/src/screens/packages/package-list.tsx +191 -0
- package/src/screens/packages/package-new-local.tsx +93 -0
- package/src/screens/peer-types/peer-type-details.tsx +162 -0
- package/src/screens/peer-types/peer-type-list.tsx +74 -0
- package/src/screens/predicates/predicate-details.tsx +125 -0
- package/src/screens/predicates/predicate-list.tsx +50 -0
- package/src/screens/profile.tsx +68 -0
- package/src/screens/search/global-search.tsx +274 -0
- package/src/screens/settings/color-mode-dropdown.tsx +57 -0
- package/src/screens/settings/settings-page.tsx +76 -0
- package/src/screens/setup-user.tsx +367 -0
- package/src/screens/tools/tool-code.tsx +35 -0
- package/src/screens/tools/tool-details.tsx +101 -0
- package/src/screens/tools/tool-info.tsx +60 -0
- package/src/screens/tools/tool-list.tsx +121 -0
- package/src/screens/tools/tool-schema.tsx +42 -0
- package/src/screens/tools/tool-test-details.tsx +100 -0
- package/src/screens/tools/tool-test-list.tsx +74 -0
- package/src/screens/variables/variable-details.tsx +183 -0
- package/src/screens/variables/variable-list.tsx +74 -0
- package/src/screens/workflows/workflow-details.tsx +130 -0
- package/src/screens/workflows/workflow-info.tsx +29 -0
- package/src/screens/workflows/workflow-instructions.tsx +127 -0
- package/src/screens/workflows/workflow-list.tsx +107 -0
- package/src/screens/workflows/workflow-subscriptions.tsx +58 -0
- package/src/setupTests.ts +32 -0
- package/src/system-apps/assistants.app.ts +7 -0
- package/src/system-apps/contacts.app.ts +8 -0
- package/src/system-apps/events.app.ts +7 -0
- package/src/system-apps/groups.app.ts +8 -0
- package/src/system-apps/index.ts +79 -0
- package/src/system-apps/knowledge-frames.app.ts +8 -0
- package/src/system-apps/knowledge-values.app.ts +8 -0
- package/src/system-apps/packages.app.ts +7 -0
- package/src/system-apps/predicates.app.ts +7 -0
- package/src/system-apps/profile.app.ts +7 -0
- package/src/system-apps/search.app.ts +8 -0
- package/src/system-apps/settings.app.ts +7 -0
- package/src/system-apps/threads.app.ts +7 -0
- package/src/system-apps/tools.app.ts +7 -0
- package/src/system-apps/types.app.ts +7 -0
- package/src/system-apps/variables.app.ts +7 -0
- package/src/system-apps/workflows.app.ts +7 -0
- package/src/tabs-layout/tabs-layout.tsx +672 -0
- package/src/tabs-layout/tabs-state.ts +269 -0
- package/src/three-bar-layout/left-bar-content.tsx +202 -0
- package/src/three-bar-layout/right-bar-content.tsx +67 -0
- package/src/three-bar-layout/three-bar-layout.tsx +297 -0
- package/src/ui-defaults/index.ts +3 -0
- package/src/ui-defaults/list-screen.tsx +92 -0
- package/src/ui-defaults/notes-editor.tsx +51 -0
- package/src/ui-router/routes-loader.ts +98 -0
- package/src/ui-router/ui-loader.tsx +497 -0
- package/src/utils.ts +266 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { IDoc, IOSchema, IOSchemaType, ITool, Observable } from "@peers-app/peers-sdk";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { IOSchemaEditor } from "../../components/io-schema";
|
|
4
|
+
import { useObservable } from "../../hooks";
|
|
5
|
+
|
|
6
|
+
export const ToolSchema = (props: { tool: IDoc<ITool> }) => {
|
|
7
|
+
const { tool } = props;
|
|
8
|
+
|
|
9
|
+
useObservable(tool.qs.isAssistantRunner);
|
|
10
|
+
|
|
11
|
+
if (tool.isAssistantRunner && !tool.configSchema) {
|
|
12
|
+
tool.configSchema = {
|
|
13
|
+
type: IOSchemaType.complex,
|
|
14
|
+
fields: [],
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div>
|
|
20
|
+
{tool.isAssistantRunner && (
|
|
21
|
+
<>
|
|
22
|
+
<span style={{ width: '130px', display: 'inline-block' }} className="fw-bold">
|
|
23
|
+
Config Schema:
|
|
24
|
+
</span>
|
|
25
|
+
<IOSchemaEditor ioSchema={tool.qs.configSchema as Observable<IOSchema>} simpleValueName="input" />
|
|
26
|
+
<br />
|
|
27
|
+
</>
|
|
28
|
+
)}
|
|
29
|
+
|
|
30
|
+
<span style={{ width: '130px', display: 'inline-block' }} className="fw-bold">
|
|
31
|
+
Input Schema:
|
|
32
|
+
</span>
|
|
33
|
+
<IOSchemaEditor ioSchema={tool.qs.inputSchema} simpleValueName="input" />
|
|
34
|
+
|
|
35
|
+
<span style={{ width: '130px', display: 'inline-block' }} className="mt-4 fw-bold">
|
|
36
|
+
Output Schema:
|
|
37
|
+
|
|
38
|
+
</span>
|
|
39
|
+
<IOSchemaEditor ioSchema={tool.qs.outputSchema} simpleValueName="output" />
|
|
40
|
+
</div>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { useObservableState, usePromise } from "../../hooks";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { ToolTests, ITool, Tools } from "@peers-app/peers-sdk";
|
|
4
|
+
import { MarkdownEditor } from "../../components/markdown-editor/editor";
|
|
5
|
+
import { SaveButton } from "../../components/save-button";
|
|
6
|
+
import { LoadingIndicator } from "../../components/loading-indicator";
|
|
7
|
+
import { updateActiveTabTitle } from "../../tabs-layout/tabs-state";
|
|
8
|
+
|
|
9
|
+
export const ToolTestDetails = (props: { toolTestId: string }) => {
|
|
10
|
+
const { toolTestId } = props;
|
|
11
|
+
|
|
12
|
+
const tool = useObservableState<ITool | undefined>(undefined);
|
|
13
|
+
|
|
14
|
+
const toolTest = usePromise(async () => {
|
|
15
|
+
const toolTestData = await ToolTests().get(toolTestId);
|
|
16
|
+
if (!toolTestData) return null;
|
|
17
|
+
const _tool = await Tools().get(toolTestData.toolId);
|
|
18
|
+
tool(_tool);
|
|
19
|
+
const doc = ToolTests().initDoc(toolTestData);
|
|
20
|
+
updateActiveTabTitle(_tool?.name ? `${_tool.name} Test` : "Tool Test");
|
|
21
|
+
return doc;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
if (toolTest === null) {
|
|
25
|
+
return <div>ToolTest not found</div>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!toolTest) {
|
|
29
|
+
return <LoadingIndicator />;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div className="container-fluid mt-2">
|
|
34
|
+
<div>
|
|
35
|
+
<a href={`#tools/${toolTest.toolId}`}>Tool: {tool()?.name}</a>
|
|
36
|
+
<div className="float-end">
|
|
37
|
+
<SaveButton doc={toolTest} />
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div
|
|
42
|
+
style={{ height: 'calc(100vh - 55px)', overflowY: 'auto', width: '100%' }}
|
|
43
|
+
>
|
|
44
|
+
<small>Test description:</small>
|
|
45
|
+
<div
|
|
46
|
+
style={{
|
|
47
|
+
border: '1px solid #ccc',
|
|
48
|
+
borderRadius: '5px',
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
<MarkdownEditor
|
|
52
|
+
value={toolTest.qs.description}
|
|
53
|
+
hideToolbar={true}
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
{/* <small>Input:</small>
|
|
58
|
+
<div
|
|
59
|
+
style={{
|
|
60
|
+
border: '1px solid #ccc',
|
|
61
|
+
borderRadius: '5px',
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
<MarkdownEditor
|
|
65
|
+
value={toolTest.qs.input}
|
|
66
|
+
hideToolbar={true}
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
<small>Output:</small>
|
|
71
|
+
<div
|
|
72
|
+
style={{
|
|
73
|
+
border: '1px solid #ccc',
|
|
74
|
+
borderRadius: '5px',
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
<MarkdownEditor
|
|
78
|
+
value={toolTest.qs.output}
|
|
79
|
+
hideToolbar={true}
|
|
80
|
+
/>
|
|
81
|
+
</div> */}
|
|
82
|
+
|
|
83
|
+
<small>Code:</small>
|
|
84
|
+
<div
|
|
85
|
+
style={{
|
|
86
|
+
border: '1px solid #ccc',
|
|
87
|
+
borderRadius: '5px',
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
<MarkdownEditor
|
|
91
|
+
value={toolTest.qs.code}
|
|
92
|
+
hideToolbar={true}
|
|
93
|
+
/>
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { useObservableState } from '../../hooks';
|
|
3
|
+
import { newid, ToolTests, IToolTest } from "@peers-app/peers-sdk";
|
|
4
|
+
import { mainContentPath } from '../../globals';
|
|
5
|
+
import { Input } from '../../components/input';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export const ToolTestList = (props: { toolId: string }) => {
|
|
9
|
+
const { toolId } = props;
|
|
10
|
+
|
|
11
|
+
const testsObs = useObservableState<IToolTest[]>([]);
|
|
12
|
+
const searchText = useObservableState<string>('');
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
ToolTests().list({ toolId, }).then(tests => {
|
|
16
|
+
testsObs(tests);
|
|
17
|
+
});
|
|
18
|
+
}, [toolId]);
|
|
19
|
+
|
|
20
|
+
const tests = testsObs().filter(test => test.description.toLowerCase().includes(searchText().toLowerCase()));
|
|
21
|
+
|
|
22
|
+
async function createTest(evt: React.KeyboardEvent<HTMLInputElement>) {
|
|
23
|
+
if (evt.key !== "Enter") return;
|
|
24
|
+
evt.preventDefault();
|
|
25
|
+
// TODO maybe use LLM call to do this?
|
|
26
|
+
const test = await ToolTests().insert({
|
|
27
|
+
toolTestId: newid(),
|
|
28
|
+
toolId,
|
|
29
|
+
description: searchText(),
|
|
30
|
+
code: '',
|
|
31
|
+
input: {},
|
|
32
|
+
output: {},
|
|
33
|
+
});
|
|
34
|
+
testsObs([
|
|
35
|
+
...tests,
|
|
36
|
+
test
|
|
37
|
+
]);
|
|
38
|
+
searchText('');
|
|
39
|
+
mainContentPath(`tools/tests/${test.toolTestId}`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div>
|
|
44
|
+
|
|
45
|
+
<Input
|
|
46
|
+
className='form-control mb-2'
|
|
47
|
+
value={searchText}
|
|
48
|
+
onKeyDown={createTest}
|
|
49
|
+
placeholder='Search or create new test'
|
|
50
|
+
/>
|
|
51
|
+
|
|
52
|
+
{testsObs().length === 0 && (
|
|
53
|
+
<div className='text-center'>
|
|
54
|
+
<p>No test for this tool yet</p>
|
|
55
|
+
</div>
|
|
56
|
+
)}
|
|
57
|
+
|
|
58
|
+
{testsObs().length !== 0 && tests.length === 0 && (
|
|
59
|
+
<div className='text-center'>
|
|
60
|
+
<p>No matching tests found</p>
|
|
61
|
+
</div>
|
|
62
|
+
)}
|
|
63
|
+
|
|
64
|
+
{tests.map((test, iTest) => {
|
|
65
|
+
return (
|
|
66
|
+
<p key={iTest} onDoubleClick={e => mainContentPath(`tools/tests/${test.toolTestId}`)}>
|
|
67
|
+
{test.description.split('\n')[0]}
|
|
68
|
+
</p>
|
|
69
|
+
)
|
|
70
|
+
})}
|
|
71
|
+
|
|
72
|
+
</div>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { camelCaseToSpaces, getIconClassName, IDoc, IPersistentVar, observable, Observable, PersistentVars } from "@peers-app/peers-sdk";
|
|
2
|
+
import React, { useEffect } from "react";
|
|
3
|
+
import { Checkbox } from "../../components/checkbox";
|
|
4
|
+
import { Input } from "../../components/input";
|
|
5
|
+
import { LoadingIndicator } from "../../components/loading-indicator";
|
|
6
|
+
import { MarkdownEditorInline } from "../../components/markdown-editor/editor-inline";
|
|
7
|
+
import { SaveButton } from "../../components/save-button";
|
|
8
|
+
import { ScreenTabBody, Tabs } from "../../components/tabs";
|
|
9
|
+
import { useObservable, usePromise, useSubscription } from "../../hooks";
|
|
10
|
+
import { updateActiveTabTitle } from "../../tabs-layout/tabs-state";
|
|
11
|
+
|
|
12
|
+
interface IProps {
|
|
13
|
+
persistentVarId: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const VariableDetails = (props: IProps) => {
|
|
17
|
+
|
|
18
|
+
const persistentVariable = usePromise(async () => {
|
|
19
|
+
const persistentVariable = await PersistentVars().get(props.persistentVarId);
|
|
20
|
+
if (!persistentVariable) {
|
|
21
|
+
throw new Error('Variable not found');
|
|
22
|
+
}
|
|
23
|
+
updateActiveTabTitle(persistentVariable.name || "Variable");
|
|
24
|
+
return PersistentVars().initDoc(persistentVariable);
|
|
25
|
+
}, undefined, [props.persistentVarId]);
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!persistentVariable) return;
|
|
30
|
+
const sub = persistentVariable.qs.name.subscribe(() => {
|
|
31
|
+
persistentVariable.name = persistentVariable.qs.name().replaceAll(/\s/g, '_').replaceAll(/[^a-zA-Z0-9_-]/g, '');
|
|
32
|
+
});
|
|
33
|
+
return () => {
|
|
34
|
+
sub.dispose();
|
|
35
|
+
}
|
|
36
|
+
}, [persistentVariable]);
|
|
37
|
+
|
|
38
|
+
if (!persistentVariable) {
|
|
39
|
+
return <LoadingIndicator />;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div className="container-fluid p-3">
|
|
44
|
+
|
|
45
|
+
<div className="d-flex">
|
|
46
|
+
<div>
|
|
47
|
+
<h4>
|
|
48
|
+
<i className={`${getIconClassName(PersistentVars())} me-2"`}></i>
|
|
49
|
+
</h4>
|
|
50
|
+
</div>
|
|
51
|
+
<div className="flex-grow-1">
|
|
52
|
+
<h4>
|
|
53
|
+
<Input
|
|
54
|
+
key={persistentVariable.persistentVarId}
|
|
55
|
+
className='border border-0'
|
|
56
|
+
style={{ width: '100%', outline: 'none', backgroundColor: 'transparent' }}
|
|
57
|
+
value={persistentVariable.qs.name}
|
|
58
|
+
/>
|
|
59
|
+
</h4>
|
|
60
|
+
</div>
|
|
61
|
+
<div>
|
|
62
|
+
<SaveButton
|
|
63
|
+
key={persistentVariable.persistentVarId}
|
|
64
|
+
doc={persistentVariable}
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<Tabs
|
|
70
|
+
key={persistentVariable.persistentVarId}
|
|
71
|
+
tabs={[
|
|
72
|
+
{
|
|
73
|
+
name: 'Info', content:
|
|
74
|
+
<ScreenTabBody>
|
|
75
|
+
<VariableInfo persistentVariable={persistentVariable} />
|
|
76
|
+
</ScreenTabBody>
|
|
77
|
+
},
|
|
78
|
+
]}
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
const VariableInfo = (props: { persistentVariable: IDoc<IPersistentVar> }) => {
|
|
86
|
+
const { persistentVariable: pvar } = props
|
|
87
|
+
|
|
88
|
+
pvar.description = pvar.description || '';
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<div>
|
|
92
|
+
|
|
93
|
+
<small>Name:</small>
|
|
94
|
+
<Input
|
|
95
|
+
value={pvar.qs.name}
|
|
96
|
+
className="form-control mb-3 p-0 ps-2"
|
|
97
|
+
placeholder="Variable name"
|
|
98
|
+
title="Variable name"
|
|
99
|
+
/>
|
|
100
|
+
|
|
101
|
+
<div className="d-flex flex-row">
|
|
102
|
+
<VariableScope pvar={pvar} />
|
|
103
|
+
<div className="ms-2">
|
|
104
|
+
<label className="form-label small mt-2 me-2">Is Secret:</label>
|
|
105
|
+
<Checkbox
|
|
106
|
+
className="form-check-input mt-2"
|
|
107
|
+
checked={pvar.qs.isSecret}
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<br />
|
|
113
|
+
<VariableValue pvar={pvar} />
|
|
114
|
+
|
|
115
|
+
<small className="mt-2">Description:</small>
|
|
116
|
+
<MarkdownEditorInline
|
|
117
|
+
value={pvar.qs.description as Observable<string>}
|
|
118
|
+
/>
|
|
119
|
+
|
|
120
|
+
</div>
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
const VariableScope = (props: { pvar: IDoc<IPersistentVar> }) => {
|
|
126
|
+
|
|
127
|
+
const { pvar } = props;
|
|
128
|
+
|
|
129
|
+
const [scope, setScope] = useObservable(pvar.qs.scope);
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<div className="dropdown">
|
|
133
|
+
<button className="btn btn-secondary dropdown-toggle" type="button" id="colorModeDropdown" data-bs-toggle="dropdown" aria-expanded="false">
|
|
134
|
+
Scope: {camelCaseToSpaces(scope)}
|
|
135
|
+
</button>
|
|
136
|
+
<ul className="dropdown-menu" aria-labelledby="colorModeDropdown">
|
|
137
|
+
<li><button className="dropdown-item" onClick={() => setScope('device')}>Device {scope === 'device' && '✓'}</button></li>
|
|
138
|
+
<li><button className="dropdown-item" onClick={() => setScope('user')}>User {scope === 'user' && '✓'}</button></li>
|
|
139
|
+
{/* <li><button className="dropdown-item" onClick={() => setScope('group')}>Group {scope === 'group' && '✓'}</button></li> */}
|
|
140
|
+
</ul>
|
|
141
|
+
</div>
|
|
142
|
+
);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const VariableValue = (props: { pvar: IDoc<IPersistentVar> }) => {
|
|
146
|
+
const { pvar } = props;
|
|
147
|
+
|
|
148
|
+
const [isSecret] = useObservable(pvar.qs.isSecret);
|
|
149
|
+
const scalarValue = observable(pvar.value.value);
|
|
150
|
+
// WARNING: we're assuming this is a string
|
|
151
|
+
useSubscription(pvar.qs.value, (value) => {
|
|
152
|
+
scalarValue(value?.value);
|
|
153
|
+
});
|
|
154
|
+
useSubscription(scalarValue, (value) => {
|
|
155
|
+
pvar.value = { value };
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
if (isSecret) {
|
|
159
|
+
return (
|
|
160
|
+
<>
|
|
161
|
+
<small>Value:</small>
|
|
162
|
+
<Input
|
|
163
|
+
value={scalarValue}
|
|
164
|
+
type="password"
|
|
165
|
+
className="form-control mb-3 p-0 ps-2"
|
|
166
|
+
placeholder="Variable value"
|
|
167
|
+
title="Variable value"
|
|
168
|
+
/>
|
|
169
|
+
</>
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return (
|
|
174
|
+
<>
|
|
175
|
+
<small>Value:</small>
|
|
176
|
+
<MarkdownEditorInline
|
|
177
|
+
value={scalarValue}
|
|
178
|
+
hideToolbar
|
|
179
|
+
/>
|
|
180
|
+
<br />
|
|
181
|
+
</>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getIconClassName, getUserContext, IPersistentVar, newid, PersistentVars } from "@peers-app/peers-sdk";
|
|
3
|
+
import { MarkdownWithMentions } from '../../components/markdown-with-mentions';
|
|
4
|
+
import { mainContentPath } from '../../globals';
|
|
5
|
+
import { ListScreen } from '../../components/list-screen';
|
|
6
|
+
import { registerInternalPeersUI } from '../../ui-router/ui-loader';
|
|
7
|
+
|
|
8
|
+
export function VariableList() {
|
|
9
|
+
async function newRecord(name: string) {
|
|
10
|
+
const userContext = await getUserContext();
|
|
11
|
+
const isPersonal = userContext.currentlyActiveGroupId() === userContext.userId();
|
|
12
|
+
const varName = name.replace(/\s+/g, '_');
|
|
13
|
+
const pVar = await PersistentVars().save({
|
|
14
|
+
persistentVarId: newid(),
|
|
15
|
+
name: varName,
|
|
16
|
+
scope: isPersonal ? 'user' : 'group',
|
|
17
|
+
description: '',
|
|
18
|
+
value: { value: '' },
|
|
19
|
+
userCreated: true,
|
|
20
|
+
});
|
|
21
|
+
mainContentPath(`variables/${pVar.persistentVarId}`);
|
|
22
|
+
return pVar;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getFilter(searchText: string) {
|
|
26
|
+
return {
|
|
27
|
+
$or: [
|
|
28
|
+
{ name: { $matchWords: searchText } },
|
|
29
|
+
{ description: { $matchWords: searchText } },
|
|
30
|
+
],
|
|
31
|
+
userCreated: true
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function renderItem(persistentVar: IPersistentVar) {
|
|
36
|
+
return (
|
|
37
|
+
<div
|
|
38
|
+
key={persistentVar.persistentVarId}
|
|
39
|
+
className='container-fluid pb-4'
|
|
40
|
+
>
|
|
41
|
+
<i className={getIconClassName(PersistentVars())}></i>
|
|
42
|
+
<a href={`#variables/${persistentVar.persistentVarId}`}>
|
|
43
|
+
{persistentVar.name || '<empty-name>'}
|
|
44
|
+
</a>
|
|
45
|
+
<div style={{ paddingLeft: '20px' }}>
|
|
46
|
+
<MarkdownWithMentions content={persistentVar.description || ''} />
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<ListScreen
|
|
54
|
+
table={PersistentVars()}
|
|
55
|
+
newRecord={newRecord}
|
|
56
|
+
getFilter={getFilter}
|
|
57
|
+
sortBy={['name']}
|
|
58
|
+
renderItem={renderItem}
|
|
59
|
+
placeholderName="environment variable"
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
registerInternalPeersUI({
|
|
65
|
+
peersUIId: '00m5fshz2g6ea23v8z6y0a1ci',
|
|
66
|
+
component: VariableList,
|
|
67
|
+
routes: [
|
|
68
|
+
{
|
|
69
|
+
isMatch: (props, context) => context.path === 'variables',
|
|
70
|
+
uiCategory: 'screen',
|
|
71
|
+
priority: 2
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
})
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { defaultAssistantId, getAllAssistantIdsMentioned, IPeerEventHandler, IWorkflow, observable, PeerEventHandlers, runWorkflow, Workflows } from "@peers-app/peers-sdk";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import { Input } from "../../components/input";
|
|
4
|
+
import { LoadingIndicator } from "../../components/loading-indicator";
|
|
5
|
+
import { SaveButton } from "../../components/save-button";
|
|
6
|
+
import { ScreenTabBody, Tabs } from "../../components/tabs";
|
|
7
|
+
import { openThread } from "../../globals";
|
|
8
|
+
import { usePromise } from "../../hooks";
|
|
9
|
+
import { updateActiveTabTitle } from "../../tabs-layout/tabs-state";
|
|
10
|
+
import { WorkflowInfo } from "./workflow-info";
|
|
11
|
+
import { WorkflowInstructions } from "./workflow-instructions";
|
|
12
|
+
import { WorkflowEventSubscriptions } from "./workflow-subscriptions";
|
|
13
|
+
|
|
14
|
+
interface IProps {
|
|
15
|
+
workflowId: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const WorkflowDetails = (props: IProps) => {
|
|
19
|
+
|
|
20
|
+
const workflow = usePromise(async () => {
|
|
21
|
+
const workflow = await Workflows().get(props.workflowId);
|
|
22
|
+
if (!workflow) {
|
|
23
|
+
throw new Error('Workflow not found');
|
|
24
|
+
}
|
|
25
|
+
updateActiveTabTitle(workflow.name || "Workflow");
|
|
26
|
+
return Workflows().initDoc(workflow);
|
|
27
|
+
}, undefined, [props.workflowId]);
|
|
28
|
+
|
|
29
|
+
const [handlers] = useState(() => observable([] as IPeerEventHandler[]));
|
|
30
|
+
|
|
31
|
+
const handlersLoaded = usePromise(async () => {
|
|
32
|
+
if (!workflow) return false;
|
|
33
|
+
const _handlers = await PeerEventHandlers().list({ handlerWorkflowId: workflow.workflowId });
|
|
34
|
+
handlers(_handlers);
|
|
35
|
+
return true;
|
|
36
|
+
}, false, [workflow]);
|
|
37
|
+
|
|
38
|
+
const allLoaded = !!(workflow && handlersLoaded);
|
|
39
|
+
|
|
40
|
+
if (!allLoaded) {
|
|
41
|
+
return <LoadingIndicator />;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function saveChanges() {
|
|
45
|
+
if (!workflow) return;
|
|
46
|
+
workflow.updatedAt = new Date();
|
|
47
|
+
const assistantsMentioned = await getAllAssistantIdsMentioned(workflow.instructions[0].markdown ?? '');
|
|
48
|
+
workflow.defaultAssistantId = assistantsMentioned[0] || defaultAssistantId;
|
|
49
|
+
workflow.save();
|
|
50
|
+
const oldHandlers = await PeerEventHandlers().list({ handlerWorkflowId: workflow.workflowId });
|
|
51
|
+
for (const oldHandler of oldHandlers) {
|
|
52
|
+
await PeerEventHandlers().delete(oldHandler.peerEventHandlerId);
|
|
53
|
+
}
|
|
54
|
+
for (const handler of handlers()) {
|
|
55
|
+
PeerEventHandlers().save(handler, { restoreIfDeleted: true });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<div className="container-fluid p-3">
|
|
61
|
+
|
|
62
|
+
<div className="d-flex">
|
|
63
|
+
<div>
|
|
64
|
+
<h4>
|
|
65
|
+
<i className="bi bi-database-fill-gear me-2"></i>
|
|
66
|
+
</h4>
|
|
67
|
+
</div>
|
|
68
|
+
<div className="flex-grow-1">
|
|
69
|
+
<h4>
|
|
70
|
+
<Input
|
|
71
|
+
key={workflow.workflowId}
|
|
72
|
+
className='border border-0'
|
|
73
|
+
style={{ width: '100%', outline: 'none', backgroundColor: 'transparent' }}
|
|
74
|
+
value={workflow.qs.name}
|
|
75
|
+
/>
|
|
76
|
+
</h4>
|
|
77
|
+
</div>
|
|
78
|
+
<div>
|
|
79
|
+
<button className="btn btn-success me-2" onClick={() => {
|
|
80
|
+
saveChanges(); // TODO take this out, is just for testing
|
|
81
|
+
_runWorkflow(workflow.toJS());
|
|
82
|
+
}}>
|
|
83
|
+
Run All
|
|
84
|
+
</button>
|
|
85
|
+
|
|
86
|
+
<SaveButton
|
|
87
|
+
key={workflow.workflowId}
|
|
88
|
+
onClick={saveChanges}
|
|
89
|
+
doc={workflow}
|
|
90
|
+
/>
|
|
91
|
+
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<Tabs
|
|
96
|
+
key={workflow.workflowId}
|
|
97
|
+
tabs={[
|
|
98
|
+
{
|
|
99
|
+
name: 'Info', content:
|
|
100
|
+
<ScreenTabBody>
|
|
101
|
+
<WorkflowInfo workflow={workflow} />
|
|
102
|
+
</ScreenTabBody>
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: 'Instructions', content:
|
|
106
|
+
<ScreenTabBody>
|
|
107
|
+
<WorkflowInstructions workflow={workflow} />
|
|
108
|
+
</ScreenTabBody>
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'Subscriptions', content:
|
|
112
|
+
<ScreenTabBody>
|
|
113
|
+
<WorkflowEventSubscriptions workflow={workflow} eventSubscriptions={handlers} />
|
|
114
|
+
</ScreenTabBody>
|
|
115
|
+
},
|
|
116
|
+
]}
|
|
117
|
+
/>
|
|
118
|
+
</div>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
async function _runWorkflow(workflow: IWorkflow) {
|
|
124
|
+
// TODO maybe warn if there are pending changes
|
|
125
|
+
const run = await runWorkflow({
|
|
126
|
+
workflowId: workflow.workflowId,
|
|
127
|
+
vars: {},
|
|
128
|
+
});
|
|
129
|
+
openThread(run.parentMessageId);
|
|
130
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
import { Input } from "../../components/input";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { IDoc, IWorkflow } from "@peers-app/peers-sdk";
|
|
5
|
+
import { MarkdownEditorInline } from "../../components/markdown-editor/editor-inline";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export const WorkflowInfo = (props: { workflow: IDoc<IWorkflow> }) => {
|
|
9
|
+
const { workflow } = props;
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<div>
|
|
13
|
+
<small>Name:</small>
|
|
14
|
+
<Input
|
|
15
|
+
value={workflow.qs.name}
|
|
16
|
+
className="form-control mb-3 p-0 ps-2"
|
|
17
|
+
placeholder="Workflow name"
|
|
18
|
+
title="Workflow name"
|
|
19
|
+
/>
|
|
20
|
+
|
|
21
|
+
<small>Description:</small>
|
|
22
|
+
<MarkdownEditorInline
|
|
23
|
+
value={workflow.qs.description}
|
|
24
|
+
/>
|
|
25
|
+
|
|
26
|
+
</div>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|