@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,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.VariableList = VariableList;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
9
|
+
const markdown_with_mentions_1 = require("../../components/markdown-with-mentions");
|
|
10
|
+
const globals_1 = require("../../globals");
|
|
11
|
+
const list_screen_1 = require("../../components/list-screen");
|
|
12
|
+
const ui_loader_1 = require("../../ui-router/ui-loader");
|
|
13
|
+
function VariableList() {
|
|
14
|
+
async function newRecord(name) {
|
|
15
|
+
const userContext = await (0, peers_sdk_1.getUserContext)();
|
|
16
|
+
const isPersonal = userContext.currentlyActiveGroupId() === userContext.userId();
|
|
17
|
+
const varName = name.replace(/\s+/g, '_');
|
|
18
|
+
const pVar = await (0, peers_sdk_1.PersistentVars)().save({
|
|
19
|
+
persistentVarId: (0, peers_sdk_1.newid)(),
|
|
20
|
+
name: varName,
|
|
21
|
+
scope: isPersonal ? 'user' : 'group',
|
|
22
|
+
description: '',
|
|
23
|
+
value: { value: '' },
|
|
24
|
+
userCreated: true,
|
|
25
|
+
});
|
|
26
|
+
(0, globals_1.mainContentPath)(`variables/${pVar.persistentVarId}`);
|
|
27
|
+
return pVar;
|
|
28
|
+
}
|
|
29
|
+
function getFilter(searchText) {
|
|
30
|
+
return {
|
|
31
|
+
$or: [
|
|
32
|
+
{ name: { $matchWords: searchText } },
|
|
33
|
+
{ description: { $matchWords: searchText } },
|
|
34
|
+
],
|
|
35
|
+
userCreated: true
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function renderItem(persistentVar) {
|
|
39
|
+
return (react_1.default.createElement("div", { key: persistentVar.persistentVarId, className: 'container-fluid pb-4' },
|
|
40
|
+
react_1.default.createElement("i", { className: (0, peers_sdk_1.getIconClassName)((0, peers_sdk_1.PersistentVars)()) }),
|
|
41
|
+
"\u00A0",
|
|
42
|
+
react_1.default.createElement("a", { href: `#variables/${persistentVar.persistentVarId}` }, persistentVar.name || '<empty-name>'),
|
|
43
|
+
react_1.default.createElement("div", { style: { paddingLeft: '20px' } },
|
|
44
|
+
react_1.default.createElement(markdown_with_mentions_1.MarkdownWithMentions, { content: persistentVar.description || '' }))));
|
|
45
|
+
}
|
|
46
|
+
return (react_1.default.createElement(list_screen_1.ListScreen, { table: (0, peers_sdk_1.PersistentVars)(), newRecord: newRecord, getFilter: getFilter, sortBy: ['name'], renderItem: renderItem, placeholderName: "environment variable" }));
|
|
47
|
+
}
|
|
48
|
+
(0, ui_loader_1.registerInternalPeersUI)({
|
|
49
|
+
peersUIId: '00m5fshz2g6ea23v8z6y0a1ci',
|
|
50
|
+
component: VariableList,
|
|
51
|
+
routes: [
|
|
52
|
+
{
|
|
53
|
+
isMatch: (props, context) => context.path === 'variables',
|
|
54
|
+
uiCategory: 'screen',
|
|
55
|
+
priority: 2
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
});
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.WorkflowDetails = void 0;
|
|
37
|
+
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const input_1 = require("../../components/input");
|
|
40
|
+
const loading_indicator_1 = require("../../components/loading-indicator");
|
|
41
|
+
const save_button_1 = require("../../components/save-button");
|
|
42
|
+
const tabs_1 = require("../../components/tabs");
|
|
43
|
+
const globals_1 = require("../../globals");
|
|
44
|
+
const hooks_1 = require("../../hooks");
|
|
45
|
+
const tabs_state_1 = require("../../tabs-layout/tabs-state");
|
|
46
|
+
const workflow_info_1 = require("./workflow-info");
|
|
47
|
+
const workflow_instructions_1 = require("./workflow-instructions");
|
|
48
|
+
const workflow_subscriptions_1 = require("./workflow-subscriptions");
|
|
49
|
+
const WorkflowDetails = (props) => {
|
|
50
|
+
const workflow = (0, hooks_1.usePromise)(async () => {
|
|
51
|
+
const workflow = await (0, peers_sdk_1.Workflows)().get(props.workflowId);
|
|
52
|
+
if (!workflow) {
|
|
53
|
+
throw new Error('Workflow not found');
|
|
54
|
+
}
|
|
55
|
+
(0, tabs_state_1.updateActiveTabTitle)(workflow.name || "Workflow");
|
|
56
|
+
return (0, peers_sdk_1.Workflows)().initDoc(workflow);
|
|
57
|
+
}, undefined, [props.workflowId]);
|
|
58
|
+
const [handlers] = (0, react_1.useState)(() => (0, peers_sdk_1.observable)([]));
|
|
59
|
+
const handlersLoaded = (0, hooks_1.usePromise)(async () => {
|
|
60
|
+
if (!workflow)
|
|
61
|
+
return false;
|
|
62
|
+
const _handlers = await (0, peers_sdk_1.PeerEventHandlers)().list({ handlerWorkflowId: workflow.workflowId });
|
|
63
|
+
handlers(_handlers);
|
|
64
|
+
return true;
|
|
65
|
+
}, false, [workflow]);
|
|
66
|
+
const allLoaded = !!(workflow && handlersLoaded);
|
|
67
|
+
if (!allLoaded) {
|
|
68
|
+
return react_1.default.createElement(loading_indicator_1.LoadingIndicator, null);
|
|
69
|
+
}
|
|
70
|
+
async function saveChanges() {
|
|
71
|
+
if (!workflow)
|
|
72
|
+
return;
|
|
73
|
+
workflow.updatedAt = new Date();
|
|
74
|
+
const assistantsMentioned = await (0, peers_sdk_1.getAllAssistantIdsMentioned)(workflow.instructions[0].markdown ?? '');
|
|
75
|
+
workflow.defaultAssistantId = assistantsMentioned[0] || peers_sdk_1.defaultAssistantId;
|
|
76
|
+
workflow.save();
|
|
77
|
+
const oldHandlers = await (0, peers_sdk_1.PeerEventHandlers)().list({ handlerWorkflowId: workflow.workflowId });
|
|
78
|
+
for (const oldHandler of oldHandlers) {
|
|
79
|
+
await (0, peers_sdk_1.PeerEventHandlers)().delete(oldHandler.peerEventHandlerId);
|
|
80
|
+
}
|
|
81
|
+
for (const handler of handlers()) {
|
|
82
|
+
(0, peers_sdk_1.PeerEventHandlers)().save(handler, { restoreIfDeleted: true });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return (react_1.default.createElement("div", { className: "container-fluid p-3" },
|
|
86
|
+
react_1.default.createElement("div", { className: "d-flex" },
|
|
87
|
+
react_1.default.createElement("div", null,
|
|
88
|
+
react_1.default.createElement("h4", null,
|
|
89
|
+
react_1.default.createElement("i", { className: "bi bi-database-fill-gear me-2" }))),
|
|
90
|
+
react_1.default.createElement("div", { className: "flex-grow-1" },
|
|
91
|
+
react_1.default.createElement("h4", null,
|
|
92
|
+
react_1.default.createElement(input_1.Input, { key: workflow.workflowId, className: 'border border-0', style: { width: '100%', outline: 'none', backgroundColor: 'transparent' }, value: workflow.qs.name }))),
|
|
93
|
+
react_1.default.createElement("div", null,
|
|
94
|
+
react_1.default.createElement("button", { className: "btn btn-success me-2", onClick: () => {
|
|
95
|
+
saveChanges(); // TODO take this out, is just for testing
|
|
96
|
+
_runWorkflow(workflow.toJS());
|
|
97
|
+
} }, "Run All"),
|
|
98
|
+
react_1.default.createElement(save_button_1.SaveButton, { key: workflow.workflowId, onClick: saveChanges, doc: workflow }))),
|
|
99
|
+
react_1.default.createElement(tabs_1.Tabs, { key: workflow.workflowId, tabs: [
|
|
100
|
+
{
|
|
101
|
+
name: 'Info', content: react_1.default.createElement(tabs_1.ScreenTabBody, null,
|
|
102
|
+
react_1.default.createElement(workflow_info_1.WorkflowInfo, { workflow: workflow }))
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: 'Instructions', content: react_1.default.createElement(tabs_1.ScreenTabBody, null,
|
|
106
|
+
react_1.default.createElement(workflow_instructions_1.WorkflowInstructions, { workflow: workflow }))
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'Subscriptions', content: react_1.default.createElement(tabs_1.ScreenTabBody, null,
|
|
110
|
+
react_1.default.createElement(workflow_subscriptions_1.WorkflowEventSubscriptions, { workflow: workflow, eventSubscriptions: handlers }))
|
|
111
|
+
},
|
|
112
|
+
] })));
|
|
113
|
+
};
|
|
114
|
+
exports.WorkflowDetails = WorkflowDetails;
|
|
115
|
+
async function _runWorkflow(workflow) {
|
|
116
|
+
// TODO maybe warn if there are pending changes
|
|
117
|
+
const run = await (0, peers_sdk_1.runWorkflow)({
|
|
118
|
+
workflowId: workflow.workflowId,
|
|
119
|
+
vars: {},
|
|
120
|
+
});
|
|
121
|
+
(0, globals_1.openThread)(run.parentMessageId);
|
|
122
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.WorkflowInfo = void 0;
|
|
7
|
+
const input_1 = require("../../components/input");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const editor_inline_1 = require("../../components/markdown-editor/editor-inline");
|
|
10
|
+
const WorkflowInfo = (props) => {
|
|
11
|
+
const { workflow } = props;
|
|
12
|
+
return (react_1.default.createElement("div", null,
|
|
13
|
+
react_1.default.createElement("small", null, "Name:"),
|
|
14
|
+
react_1.default.createElement(input_1.Input, { value: workflow.qs.name, className: "form-control mb-3 p-0 ps-2", placeholder: "Workflow name", title: "Workflow name" }),
|
|
15
|
+
react_1.default.createElement("small", null, "Description:"),
|
|
16
|
+
react_1.default.createElement(editor_inline_1.MarkdownEditorInline, { value: workflow.qs.description })));
|
|
17
|
+
};
|
|
18
|
+
exports.WorkflowInfo = WorkflowInfo;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.WorkflowInstructions = void 0;
|
|
37
|
+
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const editor_inline_1 = require("../../components/markdown-editor/editor-inline");
|
|
40
|
+
const hooks_1 = require("../../hooks");
|
|
41
|
+
const WorkflowInstructions = (props) => {
|
|
42
|
+
const { workflow } = props;
|
|
43
|
+
const instructions = workflow.qs.instructions;
|
|
44
|
+
(0, hooks_1.useObservable)(instructions);
|
|
45
|
+
const [focusedInstructionIndex] = (0, react_1.useState)(() => (0, peers_sdk_1.observable)(0));
|
|
46
|
+
return (react_1.default.createElement("div", null, workflow.qs.instructions().map((instruction, i) => {
|
|
47
|
+
return (react_1.default.createElement("div", { key: i, className: "mb-2", style: {
|
|
48
|
+
// border: '1px solid #ccc',
|
|
49
|
+
// borderRadius: '5px',
|
|
50
|
+
} },
|
|
51
|
+
react_1.default.createElement(WorkflowInstruction, { workflow: workflow, instructions: instructions, thisInstructionIndex: i, focusedInstructionIndex: focusedInstructionIndex })));
|
|
52
|
+
})));
|
|
53
|
+
};
|
|
54
|
+
exports.WorkflowInstructions = WorkflowInstructions;
|
|
55
|
+
const WorkflowInstruction = (props) => {
|
|
56
|
+
const { instructions, thisInstructionIndex, focusedInstructionIndex } = props;
|
|
57
|
+
const [mdEffects] = (0, react_1.useState)(() => ({}));
|
|
58
|
+
const thisInstruction = instructions()[thisInstructionIndex];
|
|
59
|
+
const [markdownObs] = (0, react_1.useState)(() => (0, peers_sdk_1.observable)(thisInstruction.markdown ?? ''));
|
|
60
|
+
(0, react_1.useEffect)(() => {
|
|
61
|
+
const sub = focusedInstructionIndex.subscribe(focusedIndex => {
|
|
62
|
+
if (focusedIndex === thisInstructionIndex) {
|
|
63
|
+
mdEffects.focus?.();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return () => sub.dispose();
|
|
67
|
+
}, [thisInstructionIndex]);
|
|
68
|
+
(0, react_1.useEffect)(() => {
|
|
69
|
+
markdownObs(thisInstruction.markdown ?? '');
|
|
70
|
+
const sub = markdownObs.subscribe(value => {
|
|
71
|
+
thisInstruction.markdown = value;
|
|
72
|
+
props.workflow.q(props.workflow.q() + 1);
|
|
73
|
+
});
|
|
74
|
+
return () => sub.dispose();
|
|
75
|
+
}, [thisInstruction, instructions(), thisInstructionIndex]);
|
|
76
|
+
let backspacedOnEmpty = false;
|
|
77
|
+
mdEffects.onKeyDown = (evt) => {
|
|
78
|
+
if (evt.key === 'Enter') {
|
|
79
|
+
if (markdownObs().match(/\n\s*\n$/)) {
|
|
80
|
+
// if the markdown ends with a new line, zero or more whitespace and then another newline, insert a new instruction below
|
|
81
|
+
evt.preventDefault();
|
|
82
|
+
const _instructions = instructions();
|
|
83
|
+
_instructions.splice(thisInstructionIndex + 1, 0, { markdown: '' });
|
|
84
|
+
instructions([..._instructions]);
|
|
85
|
+
markdownObs(markdownObs().trim());
|
|
86
|
+
focusedInstructionIndex(thisInstructionIndex + 1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (evt.key === 'Backspace') {
|
|
90
|
+
if (markdownObs().trim() === '') {
|
|
91
|
+
if (backspacedOnEmpty) {
|
|
92
|
+
evt.preventDefault();
|
|
93
|
+
const _instructions = instructions();
|
|
94
|
+
if (_instructions.length > 1) {
|
|
95
|
+
_instructions.splice(thisInstructionIndex, 1);
|
|
96
|
+
instructions([..._instructions]);
|
|
97
|
+
focusedInstructionIndex(thisInstructionIndex - 1);
|
|
98
|
+
}
|
|
99
|
+
backspacedOnEmpty = false;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
backspacedOnEmpty = true;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
function runThisInstruction() {
|
|
108
|
+
// runInstructions([thisInstruction]);
|
|
109
|
+
confirm('TODO: run this instruction not implemented yet');
|
|
110
|
+
}
|
|
111
|
+
return (react_1.default.createElement(editor_inline_1.MarkdownEditorInline, { value: markdownObs, effects: mdEffects, autoFocus: props.thisInstructionIndex === focusedInstructionIndex(), topRightControls: [
|
|
112
|
+
{
|
|
113
|
+
iconClass: 'bi bi-play',
|
|
114
|
+
title: `Run this instruction.`,
|
|
115
|
+
onClick: runThisInstruction,
|
|
116
|
+
}
|
|
117
|
+
] }));
|
|
118
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.WorkflowList = WorkflowList;
|
|
37
|
+
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const input_1 = require("../../components/input");
|
|
40
|
+
const lazy_list_1 = require("../../components/lazy-list");
|
|
41
|
+
const loading_indicator_1 = require("../../components/loading-indicator");
|
|
42
|
+
const markdown_with_mentions_1 = require("../../components/markdown-with-mentions");
|
|
43
|
+
const globals_1 = require("../../globals");
|
|
44
|
+
const hooks_1 = require("../../hooks");
|
|
45
|
+
function WorkflowList() {
|
|
46
|
+
const [searchTextObs] = (0, react_1.useState)(() => (0, peers_sdk_1.observable)(''));
|
|
47
|
+
const [searchText] = (0, hooks_1.useObservable)(searchTextObs);
|
|
48
|
+
const [cursorObs] = (0, react_1.useState)(() => (0, peers_sdk_1.observable)());
|
|
49
|
+
const [cursorId] = (0, react_1.useState)(() => (0, peers_sdk_1.observable)((0, peers_sdk_1.newid)()));
|
|
50
|
+
async function newCursor() {
|
|
51
|
+
const cursor = await (0, peers_sdk_1.Workflows)().cursor({ name: { $matchWords: searchText } }, { sortBy: ['-updatedAt'] });
|
|
52
|
+
cursorObs(cursor);
|
|
53
|
+
cursorId((0, peers_sdk_1.newid)());
|
|
54
|
+
return cursor;
|
|
55
|
+
}
|
|
56
|
+
(0, react_1.useEffect)(() => {
|
|
57
|
+
newCursor();
|
|
58
|
+
}, [searchText]);
|
|
59
|
+
async function searchSubmit(evt) {
|
|
60
|
+
if (evt.key !== "Enter")
|
|
61
|
+
return;
|
|
62
|
+
if (!searchText.trim())
|
|
63
|
+
return;
|
|
64
|
+
const workflowName = searchText.trim();
|
|
65
|
+
const workflow = await (0, peers_sdk_1.Workflows)().initRecord({
|
|
66
|
+
name: workflowName,
|
|
67
|
+
description: '',
|
|
68
|
+
instructions: [{
|
|
69
|
+
markdown: '// TODO add a link to workflow documentation and examples',
|
|
70
|
+
}],
|
|
71
|
+
createdBy: globals_1.me.userId,
|
|
72
|
+
// defaultAssistantId: '',
|
|
73
|
+
});
|
|
74
|
+
await (0, peers_sdk_1.Workflows)().insert(workflow);
|
|
75
|
+
(0, globals_1.mainContentPath)(`workflows/${workflow.workflowId}`);
|
|
76
|
+
}
|
|
77
|
+
async function loadMore(existingWorkflows) {
|
|
78
|
+
let moreMatches = [];
|
|
79
|
+
let cursor = cursorObs() || await newCursor();
|
|
80
|
+
for await (const workflow of cursor) {
|
|
81
|
+
if (existingWorkflows.find(w => w.workflowId === workflow.workflowId))
|
|
82
|
+
continue;
|
|
83
|
+
moreMatches.push(workflow);
|
|
84
|
+
if (searchText.length && moreMatches.length > 5)
|
|
85
|
+
break;
|
|
86
|
+
if (moreMatches.length >= 50)
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
if (moreMatches.length === 0) {
|
|
90
|
+
cursorObs(undefined);
|
|
91
|
+
}
|
|
92
|
+
return moreMatches;
|
|
93
|
+
}
|
|
94
|
+
return (react_1.default.createElement("div", { className: 'container-fluid' },
|
|
95
|
+
react_1.default.createElement(input_1.Input, { value: searchTextObs, className: "form-control mt-3", style: { marginBottom: "10px" }, placeholder: "Search or create new workflow", autoFocus: (0, globals_1.isDesktop)() ? true : false, onKeyUp: evt => searchSubmit(evt) }),
|
|
96
|
+
react_1.default.createElement("div", { className: "peers-list-container" },
|
|
97
|
+
react_1.default.createElement(lazy_list_1.LazyList, { key: cursorId(), loadMore: loadMore, scrollThreshold: 0.6, renderItems: (workflows) => {
|
|
98
|
+
return workflows.map(workflow => {
|
|
99
|
+
const markdownContent = workflow.description || workflow.instructions[0].markdown || '';
|
|
100
|
+
return (react_1.default.createElement("div", { key: workflow.workflowId, className: 'container-fluid pb-4' },
|
|
101
|
+
react_1.default.createElement("i", { className: "bi bi-database-fill-gear" }),
|
|
102
|
+
"\u00A0",
|
|
103
|
+
react_1.default.createElement("a", { href: `#workflows/${workflow.workflowId}` }, workflow.name),
|
|
104
|
+
react_1.default.createElement("div", { style: { paddingLeft: '20px' } },
|
|
105
|
+
react_1.default.createElement(markdown_with_mentions_1.MarkdownWithMentions, { content: markdownContent }))));
|
|
106
|
+
});
|
|
107
|
+
}, loadingIndicator: react_1.default.createElement("div", { className: "d-flex justify-content-center", style: { height: 200 } },
|
|
108
|
+
react_1.default.createElement(loading_indicator_1.LoadingIndicator, null)), endOfList: react_1.default.createElement("div", { className: "d-flex justify-content-center", style: { height: 200 } }) }))));
|
|
109
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IDoc, IPeerEventHandler, IWorkflow, Observable } from "@peers-app/peers-sdk";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export declare const WorkflowEventSubscriptions: (props: {
|
|
4
|
+
workflow: IDoc<IWorkflow>;
|
|
5
|
+
eventSubscriptions: Observable<IPeerEventHandler[]>;
|
|
6
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.WorkflowEventSubscriptions = void 0;
|
|
37
|
+
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
38
|
+
const lodash_1 = require("lodash");
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const loading_indicator_1 = require("../../components/loading-indicator");
|
|
41
|
+
const editor_inline_1 = require("../../components/markdown-editor/editor-inline");
|
|
42
|
+
const tooltip_1 = require("../../components/tooltip");
|
|
43
|
+
const hooks_1 = require("../../hooks");
|
|
44
|
+
const WorkflowEventSubscriptions = (props) => {
|
|
45
|
+
const { workflow, eventSubscriptions } = props;
|
|
46
|
+
const [subscriptionsMarkdown] = (0, react_1.useState)(() => (0, peers_sdk_1.observable)(''));
|
|
47
|
+
const markdownInitialized = (0, hooks_1.usePromise)(async () => {
|
|
48
|
+
const eventTypeIds = eventSubscriptions().map(h => h.peerEventTypeId);
|
|
49
|
+
const subscribedEvents = await (0, peers_sdk_1.PeerEventTypes)().list({ peerEventTypeId: { $in: eventTypeIds } });
|
|
50
|
+
const peerEventTypeNames = subscribedEvents.reduce((acc, evt) => ({ ...acc, [evt.peerEventTypeId]: evt.name }), {});
|
|
51
|
+
const mentions = eventTypeIds.map(eventTypeId => '- ' + (0, peers_sdk_1.formatMention)({ kind: 'event', id: eventTypeId, name: peerEventTypeNames[eventTypeId] ?? eventTypeId }));
|
|
52
|
+
const markdown = `${mentions.join('\n') || '- '}`;
|
|
53
|
+
subscriptionsMarkdown(markdown);
|
|
54
|
+
return true;
|
|
55
|
+
});
|
|
56
|
+
(0, hooks_1.useSubscription)(subscriptionsMarkdown, () => {
|
|
57
|
+
if (!markdownInitialized)
|
|
58
|
+
return;
|
|
59
|
+
const startEventTypeIds = eventSubscriptions().map(h => h.peerEventTypeId);
|
|
60
|
+
const eventTypeIds = (0, peers_sdk_1.getAllMentions)(subscriptionsMarkdown()).filter(m => m.kind === 'event').map(m => m.id);
|
|
61
|
+
if ((0, lodash_1.isEqual)(startEventTypeIds, eventTypeIds))
|
|
62
|
+
return;
|
|
63
|
+
const newHandler = eventTypeIds.map(eventTypeId => ({
|
|
64
|
+
peerEventHandlerId: (0, peers_sdk_1.newid)(),
|
|
65
|
+
peerEventTypeId: eventTypeId,
|
|
66
|
+
handlerWorkflowId: workflow.workflowId,
|
|
67
|
+
}));
|
|
68
|
+
eventSubscriptions(newHandler);
|
|
69
|
+
workflow.q(workflow.q() + 1);
|
|
70
|
+
});
|
|
71
|
+
if (!markdownInitialized) {
|
|
72
|
+
return react_1.default.createElement(loading_indicator_1.LoadingIndicator, null);
|
|
73
|
+
}
|
|
74
|
+
return (react_1.default.createElement("div", null,
|
|
75
|
+
react_1.default.createElement("div", { className: 'mt-2' },
|
|
76
|
+
react_1.default.createElement("small", null, "Mention events that should trigger this workflow:"),
|
|
77
|
+
react_1.default.createElement("small", null,
|
|
78
|
+
react_1.default.createElement(tooltip_1.Tooltip, { markdownContent: `The mentions will be reformatted as a bulleted list regardless of how they are entered. All other content except for event mentions will be discarded.` })),
|
|
79
|
+
react_1.default.createElement(editor_inline_1.MarkdownEditorInline, { value: subscriptionsMarkdown }))));
|
|
80
|
+
};
|
|
81
|
+
exports.WorkflowEventSubscriptions = WorkflowEventSubscriptions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require("@testing-library/jest-dom");
|
|
4
|
+
// Mock IntersectionObserver
|
|
5
|
+
global.IntersectionObserver = class {
|
|
6
|
+
constructor() { }
|
|
7
|
+
disconnect() { }
|
|
8
|
+
observe() { }
|
|
9
|
+
unobserve() { }
|
|
10
|
+
};
|
|
11
|
+
// Mock window.matchMedia
|
|
12
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
13
|
+
writable: true,
|
|
14
|
+
value: jest.fn().mockImplementation(query => ({
|
|
15
|
+
matches: false,
|
|
16
|
+
media: query,
|
|
17
|
+
onchange: null,
|
|
18
|
+
addListener: jest.fn(), // deprecated
|
|
19
|
+
removeListener: jest.fn(), // deprecated
|
|
20
|
+
addEventListener: jest.fn(),
|
|
21
|
+
removeEventListener: jest.fn(),
|
|
22
|
+
dispatchEvent: jest.fn(),
|
|
23
|
+
})),
|
|
24
|
+
});
|
|
25
|
+
// Mock ResizeObserver
|
|
26
|
+
global.ResizeObserver = class {
|
|
27
|
+
constructor() { }
|
|
28
|
+
disconnect() { }
|
|
29
|
+
observe() { }
|
|
30
|
+
unobserve() { }
|
|
31
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IAppNav, IPackage } from "@peers-app/peers-sdk";
|
|
2
|
+
export { searchApp } from './search.app';
|
|
3
|
+
export { assistantsApp } from './assistants.app';
|
|
4
|
+
export { toolsApp } from './tools.app';
|
|
5
|
+
export { workflowsApp } from './workflows.app';
|
|
6
|
+
export { eventsApp } from './events.app';
|
|
7
|
+
export { variablesApp } from './variables.app';
|
|
8
|
+
export { typesApp } from './types.app';
|
|
9
|
+
export { packagesApp } from './packages.app';
|
|
10
|
+
export { threadsApp } from './threads.app';
|
|
11
|
+
export { knowledgeValuesApp } from './knowledge-values.app';
|
|
12
|
+
export { knowledgeFramesApp } from './knowledge-frames.app';
|
|
13
|
+
export { predicatesApp } from './predicates.app';
|
|
14
|
+
export { profileApp } from './profile.app';
|
|
15
|
+
export { settingsApp } from './settings.app';
|
|
16
|
+
export { groupsApp } from './groups.app';
|
|
17
|
+
export { contactsApp } from './contacts.app';
|
|
18
|
+
export declare const systemApps: IAppNav[];
|
|
19
|
+
export declare const systemPackage: IPackage;
|