@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,140 @@
|
|
|
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.MarkdownWithMentions = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
// import { FileListDisplay } from './file-list-display';
|
|
9
|
+
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
10
|
+
const react_markdown_1 = __importDefault(require("react-markdown"));
|
|
11
|
+
const remark_gfm_1 = __importDefault(require("remark-gfm"));
|
|
12
|
+
const mention_configs_1 = require("../mention-configs");
|
|
13
|
+
// Custom Link Renderer
|
|
14
|
+
const LinkRenderer = (props) => {
|
|
15
|
+
const { href } = props;
|
|
16
|
+
return (react_1.default.createElement("a", { href: href, onClick: (e) => {
|
|
17
|
+
if (href?.startsWith('http')) {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
peers_sdk_1.rpcServerCalls.openLinkInBrowser(href);
|
|
20
|
+
}
|
|
21
|
+
} }, props.children));
|
|
22
|
+
};
|
|
23
|
+
const processTextWithMentions = (text) => {
|
|
24
|
+
const parts = [];
|
|
25
|
+
let lastIndex = 0;
|
|
26
|
+
let match;
|
|
27
|
+
let cnt = 0;
|
|
28
|
+
const regex = (0, peers_sdk_1.mentionRegex)();
|
|
29
|
+
while ((match = regex.exec(text)) !== null) {
|
|
30
|
+
cnt++;
|
|
31
|
+
if (match.index > lastIndex) {
|
|
32
|
+
parts.push(text.slice(lastIndex, match.index));
|
|
33
|
+
}
|
|
34
|
+
text = text.slice(match.index + match[0].length);
|
|
35
|
+
const kind = match[2];
|
|
36
|
+
const name = match[3].replace(/_/g, ' ');
|
|
37
|
+
const id = match[4];
|
|
38
|
+
const data = {
|
|
39
|
+
kind,
|
|
40
|
+
name,
|
|
41
|
+
id,
|
|
42
|
+
};
|
|
43
|
+
const style = { cursor: 'pointer' };
|
|
44
|
+
if (name.length < 20) {
|
|
45
|
+
style.whiteSpace = 'nowrap';
|
|
46
|
+
}
|
|
47
|
+
const mentionConfig = mention_configs_1.mentionConfigs.find(c => c.kind === kind);
|
|
48
|
+
const mentionClass = mentionConfig ? mentionConfig.styleClass || 'mention-default-default' : `mention-${kind}`;
|
|
49
|
+
const onClick = mentionConfig?.onClick;
|
|
50
|
+
const href = !onClick && `#${kind}s/${id}` || undefined;
|
|
51
|
+
const icon = (kind === 'user' && '@') ||
|
|
52
|
+
mentionConfig?.iconClass && react_1.default.createElement("i", { className: `pe-1 ${mentionConfig.iconClass}` }) ||
|
|
53
|
+
react_1.default.createElement("i", { className: `pe-1 bi bi-question` });
|
|
54
|
+
parts.push(react_1.default.createElement("a", { key: cnt, className: mentionClass, "data-kind": kind, "data-id": id, style: style, href: href, onClick: onClick && (() => onClick(data)) },
|
|
55
|
+
icon,
|
|
56
|
+
data.name));
|
|
57
|
+
lastIndex = regex.lastIndex;
|
|
58
|
+
}
|
|
59
|
+
if (lastIndex < text.length) {
|
|
60
|
+
parts.push(text.slice(lastIndex));
|
|
61
|
+
}
|
|
62
|
+
return parts;
|
|
63
|
+
};
|
|
64
|
+
// const TaskCheckbox = (props: { taskId: string }) => {
|
|
65
|
+
// const [task, setTask] = useState<ITask | null>(null);
|
|
66
|
+
// const [checked, setChecked] = useState(false);
|
|
67
|
+
// useEffect(() => {
|
|
68
|
+
// Tasks().get(props.taskId).then(task => {
|
|
69
|
+
// if (!task) return;
|
|
70
|
+
// setTask(task)
|
|
71
|
+
// });
|
|
72
|
+
// const sub = Tasks().dataChanged.subscribe(evt => {
|
|
73
|
+
// if (evt.dataObject.taskId === props.taskId) {
|
|
74
|
+
// setChecked(!!evt.dataObject.completeDT);
|
|
75
|
+
// setTask(evt.dataObject);
|
|
76
|
+
// }
|
|
77
|
+
// });
|
|
78
|
+
// Tasks().get(props.taskId).then(task => {
|
|
79
|
+
// if (task) {
|
|
80
|
+
// setChecked(!!task.completeDT);
|
|
81
|
+
// }
|
|
82
|
+
// });
|
|
83
|
+
// return () => {
|
|
84
|
+
// sub.unsubscribe();
|
|
85
|
+
// };
|
|
86
|
+
// }, [props.taskId])
|
|
87
|
+
// return (
|
|
88
|
+
// <input
|
|
89
|
+
// type="checkbox"
|
|
90
|
+
// disabled={!task}
|
|
91
|
+
// checked={checked}
|
|
92
|
+
// onChange={(e) => {
|
|
93
|
+
// if (!task) return;
|
|
94
|
+
// if (checked) {
|
|
95
|
+
// task.completeDT = undefined;
|
|
96
|
+
// } else {
|
|
97
|
+
// task.completeDT = new Date();
|
|
98
|
+
// }
|
|
99
|
+
// Tasks().update(task);
|
|
100
|
+
// setChecked(!checked);
|
|
101
|
+
// }}
|
|
102
|
+
// />
|
|
103
|
+
// );
|
|
104
|
+
// };
|
|
105
|
+
const createElementWithMentions = (Element) => {
|
|
106
|
+
// @ts-ignore
|
|
107
|
+
return ({ node, ...props }) => {
|
|
108
|
+
return (react_1.default.createElement(Element, { ...props }, react_1.default.Children.map(props.children, child => {
|
|
109
|
+
if (typeof child === 'string') {
|
|
110
|
+
return processTextWithMentions(child);
|
|
111
|
+
}
|
|
112
|
+
return child;
|
|
113
|
+
})));
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
const MarkdownWithMentions = ({ content }) => {
|
|
117
|
+
const components = {
|
|
118
|
+
p: createElementWithMentions('p'),
|
|
119
|
+
h1: createElementWithMentions('h1'),
|
|
120
|
+
h2: createElementWithMentions('h2'),
|
|
121
|
+
h3: createElementWithMentions('h3'),
|
|
122
|
+
h4: createElementWithMentions('h4'),
|
|
123
|
+
h5: createElementWithMentions('h5'),
|
|
124
|
+
h6: createElementWithMentions('h6'),
|
|
125
|
+
li: createElementWithMentions('li'),
|
|
126
|
+
// a: createElementWithMentions('a'),
|
|
127
|
+
a: LinkRenderer,
|
|
128
|
+
strong: createElementWithMentions('strong'),
|
|
129
|
+
em: createElementWithMentions('em'),
|
|
130
|
+
blockquote: createElementWithMentions('blockquote'),
|
|
131
|
+
code: createElementWithMentions('code'),
|
|
132
|
+
td: createElementWithMentions('td'),
|
|
133
|
+
th: createElementWithMentions('th'),
|
|
134
|
+
};
|
|
135
|
+
return (react_1.default.createElement("div", { className: 'markdown' },
|
|
136
|
+
react_1.default.createElement(react_markdown_1.default, { remarkPlugins: [remark_gfm_1.default],
|
|
137
|
+
// @ts-ignore
|
|
138
|
+
components: components }, content)));
|
|
139
|
+
};
|
|
140
|
+
exports.MarkdownWithMentions = MarkdownWithMentions;
|
|
@@ -0,0 +1,307 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.MessageLogs = void 0;
|
|
40
|
+
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
41
|
+
const lodash_1 = require("lodash");
|
|
42
|
+
const moment_1 = __importDefault(require("moment"));
|
|
43
|
+
const react_1 = __importStar(require("react"));
|
|
44
|
+
const hooks_1 = require("../../hooks");
|
|
45
|
+
const markdown_with_mentions_1 = require("../markdown-with-mentions");
|
|
46
|
+
const MessageLogs = ({ messageId }) => {
|
|
47
|
+
const workflowRunIds = (0, hooks_1.useObservableState)([]);
|
|
48
|
+
const showLogs = (0, hooks_1.useObservableState)(false);
|
|
49
|
+
const [runs] = (0, react_1.useState)(() => (0, peers_sdk_1.observable)([]));
|
|
50
|
+
const [logIds] = (0, react_1.useState)(() => (0, peers_sdk_1.observable)([]));
|
|
51
|
+
async function refreshLogCount() {
|
|
52
|
+
const workflowRuns = await (0, peers_sdk_1.WorkflowRuns)().list({ parentMessageId: messageId });
|
|
53
|
+
const workflowLogs = await (0, peers_sdk_1.WorkflowLogs)().list({ workflowRunId: { $in: workflowRuns.map((r) => r.workflowRunId) } });
|
|
54
|
+
logIds(workflowLogs.map((l) => l.workflowLogId));
|
|
55
|
+
}
|
|
56
|
+
(0, react_1.useEffect)(() => {
|
|
57
|
+
(0, peers_sdk_1.WorkflowRuns)().list({ parentMessageId: messageId }).then(async (_runs) => {
|
|
58
|
+
if (!_runs.length && !runs().length) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
runs(_runs);
|
|
62
|
+
refreshLogCount();
|
|
63
|
+
});
|
|
64
|
+
const subRuns = (0, peers_sdk_1.WorkflowRuns)().dataChanged.subscribe(async (evt) => {
|
|
65
|
+
const workflowRun = evt.dataObject;
|
|
66
|
+
if (workflowRun.parentMessageId === messageId) {
|
|
67
|
+
let _runs = runs().filter((r) => r.workflowRunId !== workflowRun.workflowRunId);
|
|
68
|
+
if (evt.op !== 'delete') {
|
|
69
|
+
_runs.push(workflowRun);
|
|
70
|
+
}
|
|
71
|
+
runs(_runs);
|
|
72
|
+
refreshLogCount();
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
const subLogs = (0, peers_sdk_1.WorkflowLogs)().dataChanged.subscribe(async (evt) => {
|
|
76
|
+
const workflowLog = evt.dataObject;
|
|
77
|
+
if (runs().map((r) => r.workflowRunId).includes(workflowLog.workflowRunId)) {
|
|
78
|
+
refreshLogCount();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
return () => {
|
|
82
|
+
subRuns.unsubscribe();
|
|
83
|
+
subLogs.unsubscribe();
|
|
84
|
+
};
|
|
85
|
+
}, []);
|
|
86
|
+
(0, react_1.useEffect)(() => {
|
|
87
|
+
let disposed = false;
|
|
88
|
+
function upsertRunIds(ids) {
|
|
89
|
+
let runIds = [...workflowRunIds(), ...ids];
|
|
90
|
+
runIds = (0, lodash_1.uniq)(runIds);
|
|
91
|
+
runIds = runIds.sort();
|
|
92
|
+
workflowRunIds(runIds);
|
|
93
|
+
}
|
|
94
|
+
(0, peers_sdk_1.WorkflowRuns)().list({ parentMessageId: messageId }).then(async (runs) => {
|
|
95
|
+
if (disposed) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
upsertRunIds(runs.map((r) => r.workflowRunId));
|
|
99
|
+
});
|
|
100
|
+
const sub = (0, peers_sdk_1.WorkflowRuns)().dataChanged.subscribe(async (evt) => {
|
|
101
|
+
const workflowRun = evt.dataObject;
|
|
102
|
+
if (disposed || workflowRun.parentMessageId !== messageId) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
let runIds = workflowRunIds().filter((id) => id !== workflowRun.workflowRunId);
|
|
106
|
+
if (evt.op !== 'delete') {
|
|
107
|
+
runIds.push(workflowRun.workflowRunId);
|
|
108
|
+
}
|
|
109
|
+
runIds = (0, lodash_1.uniq)(runIds);
|
|
110
|
+
runIds = (0, lodash_1.sortBy)(runIds);
|
|
111
|
+
workflowRunIds(runIds);
|
|
112
|
+
});
|
|
113
|
+
return () => {
|
|
114
|
+
disposed = true;
|
|
115
|
+
sub.unsubscribe();
|
|
116
|
+
};
|
|
117
|
+
}, [messageId]);
|
|
118
|
+
if (!workflowRunIds().length) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
122
|
+
"\u00A0",
|
|
123
|
+
react_1.default.createElement(ShowLogsLink, { logIds: logIds, showLogs: showLogs, runs: runs }),
|
|
124
|
+
showLogs() && (react_1.default.createElement("div", null,
|
|
125
|
+
react_1.default.createElement(AllMessageLogs, { logIds: logIds, runs: runs })))));
|
|
126
|
+
};
|
|
127
|
+
exports.MessageLogs = MessageLogs;
|
|
128
|
+
const ShowLogsLink = (props) => {
|
|
129
|
+
const { showLogs, logIds, runs } = props;
|
|
130
|
+
(0, hooks_1.useObservable)(logIds);
|
|
131
|
+
(0, hooks_1.useObservable)(runs);
|
|
132
|
+
(0, hooks_1.useObservable)(showLogs);
|
|
133
|
+
const runsInProgress = runs().filter((r) => !r.completedAt && !r.inErrorState && (r.startedAt || !r.scheduleDT));
|
|
134
|
+
const runsInError = runs().filter((r) => r.inErrorState);
|
|
135
|
+
const runsScheduled = runs().filter((r) => !r.startedAt && !r.inErrorState && r.scheduleDT && r.scheduleDT > new Date());
|
|
136
|
+
return (react_1.default.createElement("div", { className: "d-inline small" },
|
|
137
|
+
(runsInProgress.length > 0) && (react_1.default.createElement("div", { className: `spinner-grow spinner-grow-sm text-secondary`, role: "status", style: {
|
|
138
|
+
width: '0.7rem',
|
|
139
|
+
height: '0.7rem',
|
|
140
|
+
} },
|
|
141
|
+
react_1.default.createElement("span", { className: "visually-hidden" }, "Loading..."))),
|
|
142
|
+
((runsInProgress.length + runsInError.length + runsScheduled.length) < 1) && (react_1.default.createElement("i", { className: "bi bi-check-circle text-success" })),
|
|
143
|
+
runsInError.length > 0 && (react_1.default.createElement("i", { className: "bi bi-x-circle text-danger" })),
|
|
144
|
+
runsScheduled.length > 0 && (react_1.default.createElement("i", { className: "bi bi-clock text-warning", title: `Scheduled for ${(0, moment_1.default)(runsScheduled[0].scheduleDT).calendar()}` })),
|
|
145
|
+
react_1.default.createElement("button", { className: "btn btn-sm btn-link m-1 fw-lighter pt-0", onClick: () => showLogs(!showLogs()), tabIndex: -1 },
|
|
146
|
+
react_1.default.createElement("span", null,
|
|
147
|
+
!showLogs() && (logIds().length === 1 ? '1 log' : logIds().length + ' logs'),
|
|
148
|
+
showLogs() && (logIds().length === 1 ? 'hide 1 log' : `hide ${logIds().length} logs`))),
|
|
149
|
+
(runsInProgress.length + runsScheduled.length) > 0 && (react_1.default.createElement("i", { className: "bi bi-stop-circle", style: { cursor: 'pointer' }, onClick: () => {
|
|
150
|
+
runs().forEach((r) => {
|
|
151
|
+
if (!r.completedAt && !r.inErrorState) {
|
|
152
|
+
(0, peers_sdk_1.WorkflowRuns)().haltRun(r.workflowRunId);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
} }))));
|
|
156
|
+
};
|
|
157
|
+
const AllMessageLogs = (props) => {
|
|
158
|
+
const { logIds, runs } = props;
|
|
159
|
+
const runLogs = (0, hooks_1.useObservableState)([]);
|
|
160
|
+
(0, hooks_1.useObservable)(runLogs);
|
|
161
|
+
(0, react_1.useEffect)(() => {
|
|
162
|
+
let disposed = false;
|
|
163
|
+
function setLogs(logs) {
|
|
164
|
+
logs = (0, lodash_1.uniqBy)(logs, l => l.workflowLogId);
|
|
165
|
+
logs = (0, lodash_1.sortBy)(logs, l => l.logDT);
|
|
166
|
+
runLogs(logs);
|
|
167
|
+
logIds((0, lodash_1.uniq)([...logIds(), ...logs.map((l) => l.workflowLogId)]));
|
|
168
|
+
}
|
|
169
|
+
;
|
|
170
|
+
(0, peers_sdk_1.WorkflowLogs)().list({ workflowLogId: { $in: logIds() } }).then(async (logs) => {
|
|
171
|
+
if (disposed) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
setLogs([...logs, ...runLogs()]);
|
|
175
|
+
});
|
|
176
|
+
const sub = (0, peers_sdk_1.WorkflowLogs)().dataChanged.subscribe(async (evt) => {
|
|
177
|
+
const workflowLog = evt.dataObject;
|
|
178
|
+
if (disposed || !logIds().includes(workflowLog.workflowLogId)) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
let logs = runLogs().filter((log) => log.workflowLogId !== workflowLog.workflowLogId);
|
|
182
|
+
if (evt.op !== 'delete') {
|
|
183
|
+
logs.push(workflowLog);
|
|
184
|
+
}
|
|
185
|
+
setLogs(logs);
|
|
186
|
+
});
|
|
187
|
+
return () => {
|
|
188
|
+
disposed = true;
|
|
189
|
+
sub.unsubscribe();
|
|
190
|
+
};
|
|
191
|
+
}, []);
|
|
192
|
+
if (!runLogs().length) {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
return (react_1.default.createElement(RenderNextLog, { logs: runLogs(), runs: runs }));
|
|
196
|
+
};
|
|
197
|
+
const RenderNextLog = (props) => {
|
|
198
|
+
let { logs, runs } = props;
|
|
199
|
+
if (!logs.length) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
logs = (0, lodash_1.orderBy)(logs, (l) => l.logDT);
|
|
203
|
+
logs = (0, lodash_1.orderBy)(logs, (l) => l.workflowRunId);
|
|
204
|
+
const nextLog = logs.shift();
|
|
205
|
+
const runsIdsInside = [nextLog.workflowRunId];
|
|
206
|
+
while (true) {
|
|
207
|
+
let subRunIds = runs().filter((r) => runsIdsInside.includes(r.parentWorkflowRunId ?? '')
|
|
208
|
+
&& !runsIdsInside.includes(r.workflowRunId)).map((r) => r.workflowRunId);
|
|
209
|
+
if (!subRunIds.length) {
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
runsIdsInside.push(...subRunIds);
|
|
213
|
+
}
|
|
214
|
+
const logEndDT = new Date(nextLog.logDT.getTime() + (nextLog?.toolRunTimeMs || 0));
|
|
215
|
+
const logsInside = logs.filter((l) => l.logDT < logEndDT && runsIdsInside.includes(l.workflowRunId));
|
|
216
|
+
const logsAfter = logs.filter((l) => l.logDT >= logEndDT || !runsIdsInside.includes(l.workflowRunId));
|
|
217
|
+
const result = nextLog.resultObject ? JSON.stringify(nextLog.resultObject, null, 2) : nextLog.result;
|
|
218
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
219
|
+
react_1.default.createElement("div", { className: 'border-start rounded' },
|
|
220
|
+
react_1.default.createElement(LogDisplay, { log: nextLog }),
|
|
221
|
+
react_1.default.createElement("div", { className: 'ms-3' },
|
|
222
|
+
react_1.default.createElement(RenderNextLog, { logs: logsInside, runs: runs })),
|
|
223
|
+
result && (react_1.default.createElement(markdown_with_mentions_1.MarkdownWithMentions, { content: [
|
|
224
|
+
"```",
|
|
225
|
+
`Result: ${result}`,
|
|
226
|
+
"```",
|
|
227
|
+
].filter(s => s).join('\n') }))),
|
|
228
|
+
logsAfter.length > 0 && (react_1.default.createElement(RenderNextLog, { logs: logsAfter, runs: runs }))));
|
|
229
|
+
};
|
|
230
|
+
const LogDisplay = (props) => {
|
|
231
|
+
const { log } = props;
|
|
232
|
+
const [showMenu] = (0, react_1.useState)(() => (0, peers_sdk_1.observable)(false));
|
|
233
|
+
const showRawJson = (0, hooks_1.useObservableState)(false);
|
|
234
|
+
const tool = (0, hooks_1.usePromise)(async () => {
|
|
235
|
+
if (log.toolId) {
|
|
236
|
+
const tool = await (0, peers_sdk_1.Tools)().get(log.toolId);
|
|
237
|
+
return tool;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
const subWorkflow = (0, hooks_1.usePromise)(async () => {
|
|
241
|
+
if (log.toolId === peers_sdk_1.runWorkflowToolId) {
|
|
242
|
+
return (0, peers_sdk_1.Workflows)().get(log.toolArgs?.workflowId);
|
|
243
|
+
}
|
|
244
|
+
}, undefined, [log.toolId, log.toolArgs?.workflowId]);
|
|
245
|
+
const assistant = (0, hooks_1.usePromise)(async () => {
|
|
246
|
+
if (log.toolArgs?.assistantId) {
|
|
247
|
+
return (0, peers_sdk_1.Assistants)().get(log.toolArgs.assistantId);
|
|
248
|
+
}
|
|
249
|
+
}, undefined, [log.toolArgs?.assistantId]);
|
|
250
|
+
const rawJson = (react_1.default.createElement("pre", null, JSON.stringify(log, null, 2)));
|
|
251
|
+
let displayElement = rawJson;
|
|
252
|
+
if (log.logText) {
|
|
253
|
+
displayElement = (react_1.default.createElement(markdown_with_mentions_1.MarkdownWithMentions, { content: [
|
|
254
|
+
"```",
|
|
255
|
+
log.logText,
|
|
256
|
+
log.instruction ? `Instruction: ${JSON.stringify(log.instruction, null, 2)}` : '',
|
|
257
|
+
"```",
|
|
258
|
+
].filter(s => s).join('\n') }));
|
|
259
|
+
}
|
|
260
|
+
else if (tool && subWorkflow) {
|
|
261
|
+
const toolMention = (0, peers_sdk_1.formatMention)({ kind: 'tool', id: tool.toolId, name: tool.name });
|
|
262
|
+
const workflowMention = (0, peers_sdk_1.formatMention)({ kind: 'workflow', id: subWorkflow.workflowId, name: subWorkflow.name });
|
|
263
|
+
const args = { ...log.toolArgs };
|
|
264
|
+
delete args.workflowId;
|
|
265
|
+
displayElement = (react_1.default.createElement(markdown_with_mentions_1.MarkdownWithMentions, { content: [
|
|
266
|
+
"```",
|
|
267
|
+
`${workflowMention} via ${toolMention} (${log.toolRunTimeMs ?? ''}ms)`,
|
|
268
|
+
`Args: ${JSON.stringify(args, null, 2)}`,
|
|
269
|
+
"```",
|
|
270
|
+
].filter(s => s).join('\n') }));
|
|
271
|
+
}
|
|
272
|
+
else if (tool && tool.isAssistantRunner) {
|
|
273
|
+
const assistantId = log.toolArgs?.assistantId;
|
|
274
|
+
const assistantMention = (0, peers_sdk_1.formatMention)({ kind: 'assistant', id: assistantId, name: assistant?.name || assistantId || '' });
|
|
275
|
+
const toolMention = (0, peers_sdk_1.formatMention)({ kind: 'tool', id: tool.toolId, name: tool.name ?? '' });
|
|
276
|
+
const args = { ...log.toolArgs };
|
|
277
|
+
delete args.assistantId;
|
|
278
|
+
displayElement = (react_1.default.createElement(markdown_with_mentions_1.MarkdownWithMentions, { content: [
|
|
279
|
+
"```",
|
|
280
|
+
`${assistantMention} via ${toolMention} (${log.toolRunTimeMs}ms)`,
|
|
281
|
+
`Args: ${JSON.stringify(args, null, 2)}`,
|
|
282
|
+
"```",
|
|
283
|
+
].filter(s => s).join('\n') }));
|
|
284
|
+
}
|
|
285
|
+
else if (log.toolId) {
|
|
286
|
+
const toolMention = (0, peers_sdk_1.formatMention)({ kind: 'tool', id: log.toolId, name: tool?.name || log.toolId });
|
|
287
|
+
displayElement = (react_1.default.createElement(markdown_with_mentions_1.MarkdownWithMentions, { content: [
|
|
288
|
+
"```",
|
|
289
|
+
log.logText && `Log Text: ${log.logText}`,
|
|
290
|
+
`${toolMention} (${log.toolRunTimeMs}ms)`,
|
|
291
|
+
`Args: ${JSON.stringify(log.toolArgs, null, 2)}`,
|
|
292
|
+
"```",
|
|
293
|
+
].filter(s => s).join('\n') }));
|
|
294
|
+
}
|
|
295
|
+
const isRawView = displayElement === rawJson;
|
|
296
|
+
return (react_1.default.createElement("div", { style: { position: 'relative' }, onMouseEnter: () => showMenu(true), onMouseLeave: () => showMenu(false) },
|
|
297
|
+
!isRawView && (react_1.default.createElement(LogMenu, { showMenu: showMenu, showRawJson: showRawJson })),
|
|
298
|
+
showRawJson() ? rawJson : displayElement));
|
|
299
|
+
};
|
|
300
|
+
const LogMenu = (props) => {
|
|
301
|
+
const { showMenu, showRawJson } = props;
|
|
302
|
+
(0, hooks_1.useObservable)(showMenu);
|
|
303
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, showMenu() && (react_1.default.createElement("div", { className: "message-hover-menu" },
|
|
304
|
+
react_1.default.createElement("button", { className: "btn btn-lg m-1 p-1", onClick: () => showRawJson(!showRawJson()) }, showRawJson()
|
|
305
|
+
? react_1.default.createElement("i", { className: "bi bi-filetype-md" })
|
|
306
|
+
: react_1.default.createElement("i", { className: "bi bi-filetype-json" }))))));
|
|
307
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IUser } from "@peers-app/peers-sdk";
|
|
3
|
+
interface IProps {
|
|
4
|
+
userId: string;
|
|
5
|
+
assistantId?: string;
|
|
6
|
+
setUser?: (user: IUser) => any;
|
|
7
|
+
}
|
|
8
|
+
export declare const Avatar: (props: IProps) => React.JSX.Element;
|
|
9
|
+
export declare function stringToHslColor(str?: string, saturation?: number, lightness?: number): string;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
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.Avatar = void 0;
|
|
7
|
+
exports.stringToHslColor = stringToHslColor;
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const hooks_1 = require("../../hooks");
|
|
10
|
+
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
11
|
+
const Avatar = (props) => {
|
|
12
|
+
const { userId, setUser: parentSetUser, assistantId } = props;
|
|
13
|
+
const user = (0, hooks_1.usePromise)(async () => {
|
|
14
|
+
const user = await (0, peers_sdk_1.Users)().get(userId, { useCache: true });
|
|
15
|
+
if (user && parentSetUser) {
|
|
16
|
+
parentSetUser(user);
|
|
17
|
+
}
|
|
18
|
+
return user;
|
|
19
|
+
});
|
|
20
|
+
const assistant = (0, hooks_1.usePromise)(async () => {
|
|
21
|
+
if (assistantId) {
|
|
22
|
+
return (0, peers_sdk_1.Assistants)().get(assistantId, { useCache: true });
|
|
23
|
+
}
|
|
24
|
+
}, undefined, [assistantId]);
|
|
25
|
+
let initials = "?";
|
|
26
|
+
let name = assistant?.name || user?.name;
|
|
27
|
+
if (user) {
|
|
28
|
+
if (!name) {
|
|
29
|
+
initials = "!";
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const words = name.split(' ');
|
|
33
|
+
const first = words[0];
|
|
34
|
+
const last = words.length > 1 ? words[words.length - 1] : words[0][1];
|
|
35
|
+
initials = first[0] + last[0];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// TODO if user.avatarImage then get and show that
|
|
39
|
+
let backgroundColor = name ? stringToHslColor(name) : stringToHslColor('', 100, 100);
|
|
40
|
+
if (assistant) {
|
|
41
|
+
// backgroundColor = stringToHslColor(name || '', 100, 100);
|
|
42
|
+
backgroundColor = stringToHslColor('', 0, 70);
|
|
43
|
+
}
|
|
44
|
+
return (react_1.default.createElement("div", { className: "position-relative" },
|
|
45
|
+
react_1.default.createElement("div", { className: "rounded-circle d-flex justify-content-center align-items-center fs-4 border", style: {
|
|
46
|
+
width: '40px',
|
|
47
|
+
height: '40px',
|
|
48
|
+
color: 'white',
|
|
49
|
+
backgroundColor,
|
|
50
|
+
} },
|
|
51
|
+
react_1.default.createElement("span", { style: { fontSize: '15pt' } },
|
|
52
|
+
assistant && react_1.default.createElement("i", { className: "bi bi-person-fill-gear" }),
|
|
53
|
+
!assistant && initials.toUpperCase()))));
|
|
54
|
+
};
|
|
55
|
+
exports.Avatar = Avatar;
|
|
56
|
+
function stringToHslColor(str = '', saturation = 50, lightness = 40) {
|
|
57
|
+
saturation = saturation % 100;
|
|
58
|
+
lightness = lightness % 100;
|
|
59
|
+
var hash = 0;
|
|
60
|
+
for (var i = 0; i < str.length; i++) {
|
|
61
|
+
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
|
62
|
+
}
|
|
63
|
+
var h = hash % 360;
|
|
64
|
+
return 'hsl(' + h + ', ' + saturation + '%, ' + lightness + '%)';
|
|
65
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IMessage } from "@peers-app/peers-sdk";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface IProps {
|
|
4
|
+
height: any;
|
|
5
|
+
channelId: string;
|
|
6
|
+
batchSize: number;
|
|
7
|
+
effects?: {
|
|
8
|
+
pushMessage: (message: IMessage) => any;
|
|
9
|
+
};
|
|
10
|
+
scrollChanged?: (isBottomInView: boolean) => any;
|
|
11
|
+
}
|
|
12
|
+
export declare const ChannelMessageList: (props: IProps) => React.JSX.Element;
|
|
13
|
+
export declare function getMessages(batchSize: number, channelId: string, lastMessage: IMessage | undefined): Promise<IMessage[]>;
|
|
14
|
+
export {};
|