@dxos/plugin-assistant 0.8.4-main.c85a9c8dae → 0.8.4-main.dfabb4ec29
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/dist/lib/neutral/AgentArticle-LDV6UTSH.mjs +168 -0
- package/dist/lib/neutral/AgentArticle-LDV6UTSH.mjs.map +7 -0
- package/dist/lib/neutral/AgentProperties-H535EM5S.mjs +100 -0
- package/dist/lib/neutral/AgentProperties-H535EM5S.mjs.map +7 -0
- package/dist/lib/neutral/AssistantPlugin.mjs +99 -0
- package/dist/lib/neutral/AssistantPlugin.mjs.map +7 -0
- package/dist/lib/neutral/AssistantPlugin.node.mjs +46 -0
- package/dist/lib/neutral/AssistantPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/AssistantSettings-GG52BLKS.mjs +40 -0
- package/dist/lib/neutral/AssistantSettings-GG52BLKS.mjs.map +7 -0
- package/dist/lib/{browser/BlueprintArticle-CCS25MNW.mjs → neutral/BlueprintArticle-U7LUBFOS.mjs} +6 -15
- package/dist/lib/neutral/BlueprintArticle-U7LUBFOS.mjs.map +7 -0
- package/dist/lib/neutral/ChatCompanion-6LC7YCV6.mjs +130 -0
- package/dist/lib/neutral/ChatCompanion-6LC7YCV6.mjs.map +7 -0
- package/dist/lib/neutral/ChatContainer-X3R4ALHT.mjs +8 -0
- package/dist/lib/{browser/ChatDialog-AET7GVIB.mjs → neutral/ChatDialog-QKZLG7SQ.mjs} +13 -26
- package/dist/lib/neutral/ChatDialog-QKZLG7SQ.mjs.map +7 -0
- package/dist/lib/{browser/PromptArticle-USQO4WX6.mjs → neutral/RoutineArticle-6LC3P7OB.mjs} +15 -31
- package/dist/lib/neutral/RoutineArticle-6LC3P7OB.mjs.map +7 -0
- package/dist/lib/neutral/RoutineList-CLDXGQUD.mjs +48 -0
- package/dist/lib/neutral/RoutineList-CLDXGQUD.mjs.map +7 -0
- package/dist/lib/neutral/TracePanel-HYVPDIAA.mjs +565 -0
- package/dist/lib/neutral/TracePanel-HYVPDIAA.mjs.map +7 -0
- package/dist/lib/neutral/TriggerStatus-WTFYUIG5.mjs +92 -0
- package/dist/lib/neutral/TriggerStatus-WTFYUIG5.mjs.map +7 -0
- package/dist/lib/{browser/ai-service-CY2BYPH6.mjs → neutral/ai-service-GJXMI5OI.mjs} +2 -2
- package/dist/lib/{browser/ai-service-CY2BYPH6.mjs.map → neutral/ai-service-GJXMI5OI.mjs.map} +3 -3
- package/dist/lib/neutral/app-graph-builder-XZJDJ3LJ.mjs +189 -0
- package/dist/lib/neutral/app-graph-builder-XZJDJ3LJ.mjs.map +7 -0
- package/dist/lib/neutral/blueprint-definition-VXJYQ5AE.mjs +32 -0
- package/dist/lib/neutral/blueprint-definition-VXJYQ5AE.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/blueprints/index.mjs +1 -1
- package/dist/lib/neutral/capabilities/index.mjs +35 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/{browser/chunk-EXVT7D4B.mjs → neutral/chunk-4CQZCMRP.mjs} +7 -5
- package/dist/lib/neutral/chunk-4CQZCMRP.mjs.map +7 -0
- package/dist/lib/neutral/chunk-5H6UJHLF.mjs +30 -0
- package/dist/lib/neutral/chunk-5H6UJHLF.mjs.map +7 -0
- package/dist/lib/neutral/chunk-CM3XQU2M.mjs +8 -0
- package/dist/lib/neutral/chunk-CM3XQU2M.mjs.map +7 -0
- package/dist/lib/neutral/chunk-F7VUML5H.mjs +104 -0
- package/dist/lib/neutral/chunk-F7VUML5H.mjs.map +7 -0
- package/dist/lib/neutral/chunk-VHPTYKYD.mjs +361 -0
- package/dist/lib/neutral/chunk-VHPTYKYD.mjs.map +7 -0
- package/dist/lib/neutral/companion-chat-provisioner-5N4HWNVJ.mjs +116 -0
- package/dist/lib/neutral/companion-chat-provisioner-5N4HWNVJ.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +2240 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +27 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-chat-AEFFQYHT.mjs +71 -0
- package/dist/lib/neutral/create-chat-AEFFQYHT.mjs.map +7 -0
- package/dist/lib/neutral/create-object-VV5AO6D2.mjs +93 -0
- package/dist/lib/neutral/create-object-VV5AO6D2.mjs.map +7 -0
- package/dist/lib/{browser/edge-model-resolver-YTMFQEN5.mjs → neutral/edge-model-resolver-XDNBZ3US.mjs} +2 -2
- package/dist/lib/{browser/edge-model-resolver-YTMFQEN5.mjs.map → neutral/edge-model-resolver-XDNBZ3US.mjs.map} +3 -3
- package/dist/lib/neutral/ensure-companion-chat-EWF5GEZI.mjs +58 -0
- package/dist/lib/neutral/ensure-companion-chat-EWF5GEZI.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +930 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +32 -0
- package/dist/lib/{browser/local-model-resolver-CGRQH37T.mjs → neutral/local-model-resolver-I2BENFFS.mjs} +8 -4
- package/dist/lib/neutral/local-model-resolver-I2BENFFS.mjs.map +7 -0
- package/dist/lib/neutral/markdown-KTBFOMFM.mjs +110 -0
- package/dist/lib/neutral/markdown-KTBFOMFM.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +12 -0
- package/dist/lib/neutral/migrations-LOYUJDNX.mjs +28 -0
- package/dist/lib/neutral/migrations-LOYUJDNX.mjs.map +7 -0
- package/dist/lib/neutral/on-create-space-Q2R7OSP6.mjs +19 -0
- package/dist/lib/neutral/on-create-space-Q2R7OSP6.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-SF36MOB5.mjs +13 -0
- package/dist/lib/neutral/operation-handler-SF36MOB5.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-JWFECJJ5.mjs +165 -0
- package/dist/lib/neutral/react-surface-JWFECJJ5.mjs.map +7 -0
- package/dist/lib/neutral/resolve-navigation-targets-VXBSWV5L.mjs +20 -0
- package/dist/lib/neutral/resolve-navigation-targets-VXBSWV5L.mjs.map +7 -0
- package/dist/lib/neutral/run-prompt-in-new-chat-ZMWSWGXL.mjs +100 -0
- package/dist/lib/neutral/run-prompt-in-new-chat-ZMWSWGXL.mjs.map +7 -0
- package/dist/lib/neutral/set-current-chat-ZFDCYK5I.mjs +48 -0
- package/dist/lib/neutral/set-current-chat-ZFDCYK5I.mjs.map +7 -0
- package/dist/lib/{browser/settings-YREVQAZ5.mjs → neutral/settings-W4BLWQ53.mjs} +6 -11
- package/dist/lib/neutral/settings-W4BLWQ53.mjs.map +7 -0
- package/dist/lib/neutral/state-H3G7QCU6.mjs +28 -0
- package/dist/lib/neutral/state-H3G7QCU6.mjs.map +7 -0
- package/dist/lib/neutral/toolkit-GVWXPDLJ.mjs +14 -0
- package/dist/lib/neutral/toolkit-GVWXPDLJ.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +173 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +20 -0
- package/dist/lib/neutral/update-chat-name-ENXRUMDJ.mjs +54 -0
- package/dist/lib/neutral/update-chat-name-ENXRUMDJ.mjs.map +7 -0
- package/dist/types/src/AssistantPlugin.d.ts +1 -0
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/AssistantPlugin.node.d.ts +4 -0
- package/dist/types/src/AssistantPlugin.node.d.ts.map +1 -0
- package/dist/types/src/AssistantPlugin.test.d.ts +2 -0
- package/dist/types/src/AssistantPlugin.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/blueprint.d.ts +2 -2
- package/dist/types/src/blueprints/assistant/blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts +9 -0
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.d.ts +31 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +55 -11
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +16 -0
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/{repair/repair.d.ts → markdown.d.ts} +2 -3
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
- package/dist/types/src/capabilities/migrations.d.ts +5 -0
- package/dist/types/src/capabilities/migrations.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +6 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +21 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +6 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.stories.d.ts +15 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/index.d.ts +2 -0
- package/dist/types/src/components/AssistantSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/Chat/Chat.d.ts +37 -47
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/context.d.ts +29 -0
- package/dist/types/src/components/Chat/context.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts +2 -1
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatMcpErrors.d.ts +12 -0
- package/dist/types/src/components/ChatPrompt/ChatMcpErrors.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +6 -2
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts +19 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatPrompt.d.ts +28 -0
- package/dist/types/src/components/ChatPrompt/ChatPrompt.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatus.d.ts +20 -0
- package/dist/types/src/components/ChatPrompt/ChatStatus.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +3 -0
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Anchor.stories.d.ts +14 -0
- package/dist/types/src/components/ChatThread/Anchor.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +6 -3
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +8 -427
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts +42 -0
- package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/registry.d.ts +18 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts +44 -17
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/tool-widget-state.d.ts +18 -0
- package/dist/types/src/components/ChatThread/tool-widget-state.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/tool-widget-state.test.d.ts +2 -0
- package/dist/types/src/components/ChatThread/tool-widget-state.test.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/FallbackWidget.d.ts +8 -0
- package/dist/types/src/components/ChatThread/widgets/FallbackWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.d.ts +25 -0
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.stories.d.ts +18 -0
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/ReferenceWidget.d.ts +9 -0
- package/dist/types/src/components/ChatThread/widgets/ReferenceWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/SelectWidget.d.ts +14 -0
- package/dist/types/src/components/ChatThread/widgets/SelectWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/StatsWidget.d.ts +12 -0
- package/dist/types/src/components/ChatThread/widgets/StatsWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/StatusWidget.d.ts +12 -0
- package/dist/types/src/components/ChatThread/widgets/StatusWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/SuggestionWidget.d.ts +11 -0
- package/dist/types/src/components/ChatThread/widgets/SuggestionWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/SummaryWidget.d.ts +5 -0
- package/dist/types/src/components/ChatThread/widgets/SummaryWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.d.ts +9 -0
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.stories.d.ts +15 -0
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/defaults.d.ts +5 -0
- package/dist/types/src/components/ChatThread/widgets/defaults.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/index.d.ts +10 -0
- package/dist/types/src/components/ChatThread/widgets/index.d.ts.map +1 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts +11 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts.map +1 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts +7 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts.map +1 -0
- package/dist/types/src/components/ProcessTree/index.d.ts +2 -0
- package/dist/types/src/components/ProcessTree/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +6 -5
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +1 -419
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +4 -5
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +2 -420
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -1
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +4 -13
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +11 -9
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +1 -419
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/AgentArticle/AgentArticle.d.ts +6 -0
- package/dist/types/src/containers/AgentArticle/AgentArticle.d.ts.map +1 -0
- package/dist/types/src/containers/AgentArticle/AgentArticle.stories.d.ts +21 -0
- package/dist/types/src/containers/AgentArticle/AgentArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/AgentArticle/index.d.ts +2 -0
- package/dist/types/src/containers/AgentArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/AgentProperties/AgentProperties.d.ts +6 -0
- package/dist/types/src/containers/AgentProperties/AgentProperties.d.ts.map +1 -0
- package/dist/types/src/containers/AgentProperties/AgentProperties.stories.d.ts +16 -0
- package/dist/types/src/containers/AgentProperties/AgentProperties.stories.d.ts.map +1 -0
- package/dist/types/src/containers/AgentProperties/index.d.ts +2 -0
- package/dist/types/src/containers/AgentProperties/index.d.ts.map +1 -0
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts +4 -4
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts.map +1 -1
- package/dist/types/src/containers/BlueprintArticle/index.d.ts +1 -2
- package/dist/types/src/containers/BlueprintArticle/index.d.ts.map +1 -1
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts +14 -8
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts.map +1 -1
- package/dist/types/src/containers/ChatCompanion/index.d.ts +1 -2
- package/dist/types/src/containers/ChatCompanion/index.d.ts.map +1 -1
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts +6 -12
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/containers/ChatContainer/index.d.ts +1 -2
- package/dist/types/src/containers/ChatContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/containers/ChatDialog/index.d.ts +1 -2
- package/dist/types/src/containers/ChatDialog/index.d.ts.map +1 -1
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts +6 -0
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts.map +1 -0
- package/dist/types/src/containers/RoutineArticle/index.d.ts +2 -0
- package/dist/types/src/containers/RoutineArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/RoutineList/RoutineList.d.ts +6 -0
- package/dist/types/src/containers/RoutineList/RoutineList.d.ts.map +1 -0
- package/dist/types/src/containers/RoutineList/RoutineList.stories.d.ts +21 -0
- package/dist/types/src/containers/RoutineList/RoutineList.stories.d.ts.map +1 -0
- package/dist/types/src/containers/RoutineList/index.d.ts +2 -0
- package/dist/types/src/containers/RoutineList/index.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts +8 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts +13 -0
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts +19 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.test.d.ts +2 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.test.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/execution-graph.d.ts +97 -0
- package/dist/types/src/containers/TracePanel/execution-graph.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/execution-graph.test.d.ts +2 -0
- package/dist/types/src/containers/TracePanel/execution-graph.test.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/index.d.ts +4 -0
- package/dist/types/src/containers/TracePanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/testing/index.d.ts +3 -0
- package/dist/types/src/containers/TracePanel/testing/index.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/testing/simulated-agent.d.ts +14 -0
- package/dist/types/src/containers/TracePanel/testing/simulated-agent.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/testing/snapshot-playback.d.ts +12 -0
- package/dist/types/src/containers/TracePanel/testing/snapshot-playback.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts +3 -2
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts.map +1 -1
- package/dist/types/src/containers/TriggerStatus/index.d.ts +1 -2
- package/dist/types/src/containers/TriggerStatus/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +5 -3
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/extensions/index.d.ts +2 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -0
- package/dist/types/src/extensions/prompt-extension.d.ts +10 -0
- package/dist/types/src/extensions/prompt-extension.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +2 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatKeymap.d.ts +12 -0
- package/dist/types/src/hooks/useChatKeymap.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +6 -6
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +3 -6
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextBinder.d.ts +3 -2
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -1
- package/dist/types/src/hooks/useDebug.d.ts +10 -0
- package/dist/types/src/hooks/useDebug.d.ts.map +1 -0
- package/dist/types/src/hooks/useFilteredTypes.d.ts.map +1 -1
- package/dist/types/src/hooks/useFlush.d.ts +1 -1
- package/dist/types/src/hooks/useFlush.d.ts.map +1 -1
- package/dist/types/src/hooks/usePresets.d.ts +1 -1
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -1
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create-chat.d.ts +5 -0
- package/dist/types/src/operations/create-chat.d.ts.map +1 -0
- package/dist/types/src/operations/ensure-companion-chat.d.ts +5 -0
- package/dist/types/src/operations/ensure-companion-chat.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/on-create-space.d.ts +5 -0
- package/dist/types/src/operations/on-create-space.d.ts.map +1 -0
- package/dist/types/src/operations/prompt.test.d.ts +2 -0
- package/dist/types/src/operations/prompt.test.d.ts.map +1 -0
- package/dist/types/src/operations/resolve-navigation-targets.d.ts +15 -0
- package/dist/types/src/operations/resolve-navigation-targets.d.ts.map +1 -0
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts +5 -0
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts.map +1 -0
- package/dist/types/src/operations/set-current-chat.d.ts +5 -0
- package/dist/types/src/operations/set-current-chat.d.ts.map +1 -0
- package/dist/types/src/operations/update-chat-name.d.ts +5 -0
- package/dist/types/src/operations/update-chat-name.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/processor/index.d.ts +0 -1
- package/dist/types/src/processor/index.d.ts.map +1 -1
- package/dist/types/src/processor/presets.d.ts +1 -1
- package/dist/types/src/processor/presets.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +49 -30
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/queue-logger.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.test.d.ts +2 -0
- package/dist/types/src/testing/test-generator.test.d.ts.map +1 -0
- package/dist/types/src/testing/test-services.d.ts +1 -1
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/testing/test-trace.d.ts +5 -0
- package/dist/types/src/testing/test-trace.d.ts.map +1 -0
- package/dist/types/src/testing/trace-timeline.test.d.ts +2 -0
- package/dist/types/src/testing/trace-timeline.test.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +2 -419
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +30 -14
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantCapabilities.d.ts +30 -0
- package/dist/types/src/types/AssistantCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/AssistantEvents.d.ts +3 -0
- package/dist/types/src/types/AssistantEvents.d.ts.map +1 -0
- package/dist/types/src/types/AssistantOperation.d.ts +142 -0
- package/dist/types/src/types/AssistantOperation.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +26 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -4
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +1 -1
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +165 -109
- package/src/AssistantPlugin.node.ts +44 -0
- package/src/AssistantPlugin.test.ts +35 -0
- package/src/AssistantPlugin.ts +126 -0
- package/src/blueprints/assistant/blueprint.test.ts +15 -17
- package/src/blueprints/assistant/blueprint.ts +11 -7
- package/src/capabilities/app-graph-builder.ts +192 -0
- package/src/capabilities/blueprint-definition.ts +56 -0
- package/src/capabilities/companion-chat-provisioner.ts +163 -0
- package/src/capabilities/create-object.ts +107 -0
- package/src/capabilities/index.ts +24 -11
- package/src/capabilities/{local-model-resolver/local-model-resolver.ts → local-model-resolver.ts} +14 -4
- package/src/capabilities/markdown.ts +40 -0
- package/src/capabilities/migrations.ts +28 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +167 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +2 -2
- package/src/capabilities/{state/state.ts → state.ts} +11 -3
- package/src/capabilities/{toolkit/toolkit.ts → toolkit.ts} +2 -4
- package/src/components/AssistantSettings/AssistantSettings.stories.tsx +35 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +43 -0
- package/src/components/AssistantSettings/index.ts +5 -0
- package/src/components/Chat/Chat.tsx +96 -294
- package/src/components/Chat/context.ts +39 -0
- package/src/components/ChatPrompt/ChatActions.tsx +28 -16
- package/src/components/ChatPrompt/ChatMcpErrors.tsx +50 -0
- package/src/components/ChatPrompt/ChatOptions.stories.tsx +136 -0
- package/src/components/ChatPrompt/ChatOptions.tsx +239 -53
- package/src/components/ChatPrompt/ChatPrompt.tsx +182 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +4 -4
- package/src/components/ChatPrompt/ChatStatus.tsx +123 -0
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +1 -1
- package/src/components/ChatPrompt/index.ts +3 -0
- package/src/components/ChatThread/Anchor.stories.tsx +95 -0
- package/src/components/ChatThread/ChatThread.stories.tsx +60 -67
- package/src/components/ChatThread/ChatThread.tsx +46 -29
- package/src/components/ChatThread/DEBUG.md +41 -0
- package/src/components/ChatThread/MarkdownStream.stories.tsx +281 -0
- package/src/components/ChatThread/registry.tsx +148 -65
- package/src/components/ChatThread/sync.test.ts +186 -28
- package/src/components/ChatThread/sync.ts +93 -103
- package/src/components/ChatThread/testing/reasoning.md +25 -0
- package/src/components/ChatThread/testing/thinking.md +21 -0
- package/src/components/ChatThread/testing/thread-1.md +30 -0
- package/src/components/ChatThread/testing/{thread.md → thread-2.md} +19 -0
- package/src/components/ChatThread/testing/thread-widgets.md +79 -0
- package/src/components/ChatThread/tool-widget-state.test.ts +34 -0
- package/src/components/ChatThread/tool-widget-state.ts +48 -0
- package/src/components/ChatThread/widgets/FallbackWidget.tsx +26 -0
- package/src/components/ChatThread/widgets/ReasoningWidget.stories.tsx +68 -0
- package/src/components/ChatThread/widgets/ReasoningWidget.ts +133 -0
- package/src/components/ChatThread/widgets/ReferenceWidget.ts +33 -0
- package/src/components/ChatThread/widgets/SelectWidget.ts +39 -0
- package/src/components/ChatThread/widgets/StatsWidget.ts +31 -0
- package/src/components/ChatThread/widgets/StatusWidget.ts +53 -0
- package/src/components/ChatThread/widgets/SuggestionWidget.ts +41 -0
- package/src/components/ChatThread/widgets/SummaryWidget.tsx +27 -0
- package/src/components/ChatThread/widgets/ToolWidget.stories.tsx +55 -0
- package/src/components/ChatThread/widgets/ToolWidget.tsx +156 -0
- package/src/components/ChatThread/widgets/defaults.ts +8 -0
- package/src/components/ChatThread/widgets/index.ts +13 -0
- package/src/components/ProcessTree/ProcessTree.stories.tsx +83 -0
- package/src/components/ProcessTree/ProcessTree.tsx +119 -0
- package/src/components/ProcessTree/index.ts +5 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +5 -9
- package/src/components/TemplateEditor/TemplateEditor.tsx +51 -43
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +8 -10
- package/src/components/TemplateEditor/TemplateForm.tsx +52 -73
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +1 -1
- package/src/components/ToolBlock/ToolBlock.tsx +20 -19
- package/src/components/Toolbox/Toolbox.stories.tsx +7 -8
- package/src/components/Toolbox/Toolbox.tsx +64 -57
- package/src/components/index.ts +5 -0
- package/src/containers/AgentArticle/AgentArticle.stories.tsx +120 -0
- package/src/containers/AgentArticle/AgentArticle.tsx +200 -0
- package/src/containers/AgentArticle/index.ts +5 -0
- package/src/containers/AgentProperties/AgentProperties.stories.tsx +101 -0
- package/src/containers/AgentProperties/AgentProperties.tsx +127 -0
- package/src/containers/AgentProperties/index.ts +5 -0
- package/src/containers/BlueprintArticle/BlueprintArticle.tsx +7 -8
- package/src/containers/BlueprintArticle/index.ts +1 -3
- package/src/containers/ChatCompanion/ChatCompanion.tsx +26 -122
- package/src/containers/ChatCompanion/index.ts +1 -3
- package/src/containers/ChatContainer/ChatContainer.tsx +61 -25
- package/src/containers/ChatContainer/index.ts +1 -3
- package/src/containers/ChatDialog/ChatDialog.tsx +8 -14
- package/src/containers/ChatDialog/index.ts +1 -3
- package/src/containers/{PromptArticle/PromptArticle.tsx → RoutineArticle/RoutineArticle.tsx} +14 -14
- package/src/containers/RoutineArticle/index.ts +5 -0
- package/src/containers/RoutineList/RoutineList.stories.tsx +130 -0
- package/src/containers/RoutineList/RoutineList.tsx +50 -0
- package/src/containers/RoutineList/index.ts +5 -0
- package/src/containers/TracePanel/TracePanel.stories.tsx +285 -0
- package/src/containers/TracePanel/TracePanel.tsx +167 -0
- package/src/containers/TracePanel/dxn-extractor.test.ts +153 -0
- package/src/containers/TracePanel/dxn-extractor.ts +178 -0
- package/src/containers/TracePanel/execution-graph.test.ts +382 -0
- package/src/containers/TracePanel/execution-graph.ts +621 -0
- package/src/containers/TracePanel/index.ts +9 -0
- package/src/containers/TracePanel/testing/index.ts +6 -0
- package/src/containers/TracePanel/testing/simulated-agent.ts +114 -0
- package/src/containers/TracePanel/testing/snapshot-playback.ts +45 -0
- package/src/containers/TriggerStatus/TriggerStatus.tsx +41 -62
- package/src/containers/TriggerStatus/index.ts +1 -3
- package/src/containers/index.ts +5 -4
- package/src/extensions/index.ts +5 -0
- package/src/extensions/prompt-extension.ts +111 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useBlueprintRegistry.ts +2 -1
- package/src/hooks/useChatKeymap.ts +52 -0
- package/src/hooks/useChatProcessor.ts +36 -24
- package/src/hooks/useChatServices.ts +5 -26
- package/src/hooks/useChatToolbarActions.ts +9 -9
- package/src/hooks/useContextBinder.ts +17 -6
- package/src/hooks/useContextObjects.ts +8 -4
- package/src/hooks/useDebug.ts +38 -0
- package/src/hooks/useFilteredTypes.ts +1 -1
- package/src/hooks/usePresets.ts +2 -1
- package/src/index.ts +0 -6
- package/src/meta.ts +6 -3
- package/src/operations/create-chat.ts +78 -0
- package/src/operations/ensure-companion-chat.ts +63 -0
- package/src/operations/index.ts +15 -0
- package/src/operations/on-create-space.ts +24 -0
- package/src/operations/prompt.test.ts +77 -0
- package/src/operations/resolve-navigation-targets.ts +26 -0
- package/src/operations/run-prompt-in-new-chat.ts +112 -0
- package/src/operations/set-current-chat.ts +49 -0
- package/src/operations/update-chat-name.ts +61 -0
- package/src/plugin.ts +11 -0
- package/src/processor/index.ts +0 -1
- package/src/processor/presets.ts +11 -3
- package/src/processor/processor.test.ts +18 -51
- package/src/processor/processor.ts +214 -158
- package/src/queue-logger.ts +19 -8
- package/src/testing/data/trace-timeline.dx.json +4657 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/test-generator.test.ts +81 -0
- package/src/testing/test-generator.ts +79 -42
- package/src/testing/test-services.ts +1 -1
- package/src/testing/test-trace.ts +20 -0
- package/src/testing/trace-timeline.conversations.json +1 -0
- package/src/testing/trace-timeline.test.ts +250 -0
- package/src/translations.ts +152 -106
- package/src/types/Assistant.ts +16 -18
- package/src/types/AssistantCapabilities.ts +35 -0
- package/src/types/AssistantEvents.ts +11 -0
- package/src/types/AssistantOperation.ts +128 -0
- package/src/types/Settings.ts +76 -0
- package/src/types/index.ts +5 -4
- package/src/types/service.ts +3 -3
- package/dist/lib/browser/AssistantSettings-2LFAG5OQ.mjs +0 -93
- package/dist/lib/browser/AssistantSettings-2LFAG5OQ.mjs.map +0 -7
- package/dist/lib/browser/BlueprintArticle-CCS25MNW.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-UGD4V34A.mjs +0 -202
- package/dist/lib/browser/ChatCompanion-UGD4V34A.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-ZGRSZ5EU.mjs +0 -12
- package/dist/lib/browser/ChatDialog-AET7GVIB.mjs.map +0 -7
- package/dist/lib/browser/ProjectArticle-QDBTIFNE.mjs +0 -91
- package/dist/lib/browser/ProjectArticle-QDBTIFNE.mjs.map +0 -7
- package/dist/lib/browser/ProjectSettings-R6RRARLO.mjs +0 -194
- package/dist/lib/browser/ProjectSettings-R6RRARLO.mjs.map +0 -7
- package/dist/lib/browser/PromptArticle-USQO4WX6.mjs.map +0 -7
- package/dist/lib/browser/TriggerStatus-65X3EUSN.mjs +0 -122
- package/dist/lib/browser/TriggerStatus-65X3EUSN.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-SFYYUKTT.mjs +0 -234
- package/dist/lib/browser/app-graph-builder-SFYYUKTT.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-RB5RHZZM.mjs +0 -34
- package/dist/lib/browser/blueprint-definition-RB5RHZZM.mjs.map +0 -7
- package/dist/lib/browser/chunk-7DXYAXLZ.mjs +0 -230
- package/dist/lib/browser/chunk-7DXYAXLZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-EXVT7D4B.mjs.map +0 -7
- package/dist/lib/browser/chunk-JYY5AD65.mjs +0 -286
- package/dist/lib/browser/chunk-JYY5AD65.mjs.map +0 -7
- package/dist/lib/browser/chunk-LEXIQDXZ.mjs +0 -26
- package/dist/lib/browser/chunk-LEXIQDXZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-RU4G5NY4.mjs +0 -69
- package/dist/lib/browser/chunk-RU4G5NY4.mjs.map +0 -7
- package/dist/lib/browser/chunk-UUA6GNGG.mjs +0 -2125
- package/dist/lib/browser/chunk-UUA6GNGG.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -386
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-CGRQH37T.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-resolver-ELXDQZEG.mjs +0 -136
- package/dist/lib/browser/operation-resolver-ELXDQZEG.mjs.map +0 -7
- package/dist/lib/browser/react-surface-KYQSZO2I.mjs +0 -144
- package/dist/lib/browser/react-surface-KYQSZO2I.mjs.map +0 -7
- package/dist/lib/browser/repair-ZFZWZALX.mjs +0 -52
- package/dist/lib/browser/repair-ZFZWZALX.mjs.map +0 -7
- package/dist/lib/browser/settings-YREVQAZ5.mjs.map +0 -7
- package/dist/lib/browser/state-MPG42ZO4.mjs +0 -26
- package/dist/lib/browser/state-MPG42ZO4.mjs.map +0 -7
- package/dist/lib/browser/toolkit-XRSBBB3L.mjs +0 -16
- package/dist/lib/browser/toolkit-XRSBBB3L.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -23
- package/dist/lib/node-esm/AssistantSettings-QWFEMJG7.mjs +0 -94
- package/dist/lib/node-esm/AssistantSettings-QWFEMJG7.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintArticle-SNEN6LOY.mjs +0 -37
- package/dist/lib/node-esm/BlueprintArticle-SNEN6LOY.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-NP4R5BFE.mjs +0 -203
- package/dist/lib/node-esm/ChatCompanion-NP4R5BFE.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-IFHDIFJH.mjs +0 -13
- package/dist/lib/node-esm/ChatDialog-UZNQBTKZ.mjs +0 -86
- package/dist/lib/node-esm/ChatDialog-UZNQBTKZ.mjs.map +0 -7
- package/dist/lib/node-esm/ProjectArticle-BCIBESJN.mjs +0 -92
- package/dist/lib/node-esm/ProjectArticle-BCIBESJN.mjs.map +0 -7
- package/dist/lib/node-esm/ProjectSettings-Q5QY6BYS.mjs +0 -195
- package/dist/lib/node-esm/ProjectSettings-Q5QY6BYS.mjs.map +0 -7
- package/dist/lib/node-esm/PromptArticle-PGMJMQK7.mjs +0 -72
- package/dist/lib/node-esm/PromptArticle-PGMJMQK7.mjs.map +0 -7
- package/dist/lib/node-esm/TriggerStatus-UR5S7PXJ.mjs +0 -123
- package/dist/lib/node-esm/TriggerStatus-UR5S7PXJ.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-ZI3A6RVG.mjs +0 -23
- package/dist/lib/node-esm/ai-service-ZI3A6RVG.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-E25JXI34.mjs +0 -235
- package/dist/lib/node-esm/app-graph-builder-E25JXI34.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-L7XKRYIW.mjs +0 -35
- package/dist/lib/node-esm/blueprint-definition-L7XKRYIW.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -9
- package/dist/lib/node-esm/chunk-3QBVFAYO.mjs +0 -28
- package/dist/lib/node-esm/chunk-3QBVFAYO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6NCLKQCL.mjs +0 -70
- package/dist/lib/node-esm/chunk-6NCLKQCL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GZ4ERNT2.mjs +0 -2126
- package/dist/lib/node-esm/chunk-GZ4ERNT2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JMBYVUD6.mjs +0 -288
- package/dist/lib/node-esm/chunk-JMBYVUD6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MWYYLALM.mjs +0 -231
- package/dist/lib/node-esm/chunk-MWYYLALM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs +0 -25
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-CMJ3KNLQ.mjs +0 -22
- package/dist/lib/node-esm/edge-model-resolver-CMJ3KNLQ.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -387
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-FFDAKOXN.mjs +0 -21
- package/dist/lib/node-esm/local-model-resolver-FFDAKOXN.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/operation-resolver-Q5GNP2GH.mjs +0 -137
- package/dist/lib/node-esm/operation-resolver-Q5GNP2GH.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-JJRGVGKD.mjs +0 -145
- package/dist/lib/node-esm/react-surface-JJRGVGKD.mjs.map +0 -7
- package/dist/lib/node-esm/repair-LXFVOK4B.mjs +0 -53
- package/dist/lib/node-esm/repair-LXFVOK4B.mjs.map +0 -7
- package/dist/lib/node-esm/settings-N452OW6Y.mjs +0 -34
- package/dist/lib/node-esm/settings-N452OW6Y.mjs.map +0 -7
- package/dist/lib/node-esm/state-WHZFKIEL.mjs +0 -27
- package/dist/lib/node-esm/state-WHZFKIEL.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-5IWGLUF4.mjs +0 -17
- package/dist/lib/node-esm/toolkit-5IWGLUF4.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -24
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts.map +0 -1
- package/dist/types/src/capabilities/ai-service/index.d.ts +0 -3
- package/dist/types/src/capabilities/ai-service/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -6
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/edge-model-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/edge-model-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/local-model-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/local-model-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts +0 -13
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/repair/index.d.ts +0 -3
- package/dist/types/src/capabilities/repair/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/repair/repair.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -15
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.d.ts +0 -18
- package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/index.d.ts +0 -11
- package/dist/types/src/capabilities/state/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/state.d.ts +0 -13
- package/dist/types/src/capabilities/state/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/toolkit/index.d.ts +0 -3
- package/dist/types/src/capabilities/toolkit/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +0 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +0 -7
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +0 -1
- package/dist/types/src/components/ChatProgress/index.d.ts +0 -2
- package/dist/types/src/components/ChatProgress/index.d.ts.map +0 -1
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts +0 -12
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts.map +0 -1
- package/dist/types/src/components/Typewriter/Typewriter.d.ts +0 -11
- package/dist/types/src/components/Typewriter/Typewriter.d.ts.map +0 -1
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts +0 -7
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts.map +0 -1
- package/dist/types/src/components/Typewriter/assistant-extension.d.ts +0 -5
- package/dist/types/src/components/Typewriter/assistant-extension.d.ts.map +0 -1
- package/dist/types/src/components/Typewriter/index.d.ts +0 -2
- package/dist/types/src/components/Typewriter/index.d.ts.map +0 -1
- package/dist/types/src/containers/AssistantSettings/AssistantSettings.d.ts +0 -8
- package/dist/types/src/containers/AssistantSettings/AssistantSettings.d.ts.map +0 -1
- package/dist/types/src/containers/AssistantSettings/index.d.ts +0 -3
- package/dist/types/src/containers/AssistantSettings/index.d.ts.map +0 -1
- package/dist/types/src/containers/Project/ProjectArticle.d.ts +0 -7
- package/dist/types/src/containers/Project/ProjectArticle.d.ts.map +0 -1
- package/dist/types/src/containers/Project/ProjectSettings.d.ts +0 -6
- package/dist/types/src/containers/Project/ProjectSettings.d.ts.map +0 -1
- package/dist/types/src/containers/Project/index.d.ts +0 -7
- package/dist/types/src/containers/Project/index.d.ts.map +0 -1
- package/dist/types/src/containers/Project/triggers.d.ts +0 -6
- package/dist/types/src/containers/Project/triggers.d.ts.map +0 -1
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts +0 -6
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts.map +0 -1
- package/dist/types/src/containers/PromptArticle/index.d.ts +0 -3
- package/dist/types/src/containers/PromptArticle/index.d.ts.map +0 -1
- package/dist/types/src/processor/update-name.d.ts +0 -10
- package/dist/types/src/processor/update-name.d.ts.map +0 -1
- package/dist/types/src/types/AssistantAction.d.ts +0 -93
- package/dist/types/src/types/AssistantAction.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -33
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/dist/types/src/types/defs.d.ts +0 -2
- package/dist/types/src/types/defs.d.ts.map +0 -1
- package/dist/types/src/types/events.d.ts +0 -5
- package/dist/types/src/types/events.d.ts.map +0 -1
- package/src/AssistantPlugin.tsx +0 -172
- package/src/blueprints/assistant/blueprint.conversations.json +0 -1
- package/src/capabilities/ai-service/index.ts +0 -7
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -198
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +0 -48
- package/src/capabilities/blueprint-definition/index.ts +0 -7
- package/src/capabilities/edge-model-resolver/index.ts +0 -7
- package/src/capabilities/local-model-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -121
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -121
- package/src/capabilities/repair/index.ts +0 -7
- package/src/capabilities/repair/repair.ts +0 -69
- package/src/capabilities/settings/index.ts +0 -7
- package/src/capabilities/state/index.ts +0 -7
- package/src/capabilities/toolkit/index.ts +0 -7
- package/src/components/ChatProgress/ChatProgress.tsx +0 -53
- package/src/components/ChatProgress/index.ts +0 -5
- package/src/components/Typewriter/AssistantToolbar.tsx +0 -161
- package/src/components/Typewriter/Typewriter.stories.tsx +0 -86
- package/src/components/Typewriter/Typewriter.tsx +0 -54
- package/src/components/Typewriter/assistant-extension.tsx +0 -142
- package/src/components/Typewriter/index.ts +0 -5
- package/src/containers/AssistantSettings/AssistantSettings.tsx +0 -120
- package/src/containers/AssistantSettings/index.ts +0 -7
- package/src/containers/Project/ProjectArticle.tsx +0 -117
- package/src/containers/Project/ProjectSettings.tsx +0 -118
- package/src/containers/Project/index.ts +0 -16
- package/src/containers/Project/triggers.ts +0 -131
- package/src/containers/PromptArticle/index.ts +0 -7
- package/src/processor/update-name.ts +0 -58
- package/src/types/AssistantAction.ts +0 -76
- package/src/types/capabilities.ts +0 -27
- package/src/types/defs.ts +0 -5
- package/src/types/events.ts +0 -11
- /package/dist/lib/{browser/ChatContainer-ZGRSZ5EU.mjs.map → neutral/ChatContainer-X3R4ALHT.mjs.map} +0 -0
- /package/dist/lib/{browser → neutral}/blueprints/index.mjs.map +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
- /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/ChatContainer-IFHDIFJH.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprints → neutral/operations}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm → neutral}/types/index.mjs.map +0 -0
- /package/dist/types/src/capabilities/{ai-service/ai-service.d.ts → ai-service.d.ts} +0 -0
- /package/dist/types/src/capabilities/{app-graph-builder/app-graph-builder.d.ts → app-graph-builder.d.ts} +0 -0
- /package/dist/types/src/capabilities/{edge-model-resolver/edge-model-resolver.d.ts → edge-model-resolver.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
- /package/dist/types/src/capabilities/{toolkit/toolkit.d.ts → toolkit.d.ts} +0 -0
- /package/src/capabilities/{ai-service/ai-service.ts → ai-service.ts} +0 -0
- /package/src/capabilities/{edge-model-resolver/edge-model-resolver.ts → edge-model-resolver.ts} +0 -0
|
@@ -1,2125 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AiChatProcessor,
|
|
3
|
-
AiServicePresets
|
|
4
|
-
} from "./chunk-JYY5AD65.mjs";
|
|
5
|
-
import {
|
|
6
|
-
AssistantOperation,
|
|
7
|
-
ServiceType
|
|
8
|
-
} from "./chunk-7DXYAXLZ.mjs";
|
|
9
|
-
import {
|
|
10
|
-
meta
|
|
11
|
-
} from "./chunk-EXVT7D4B.mjs";
|
|
12
|
-
|
|
13
|
-
// src/hooks/useBlueprintRegistry.ts
|
|
14
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
15
|
-
import { useCapabilities } from "@dxos/app-framework/ui";
|
|
16
|
-
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
17
|
-
import { Blueprint } from "@dxos/blueprints";
|
|
18
|
-
import { Filter, Obj, Ref } from "@dxos/echo";
|
|
19
|
-
import { useQuery } from "@dxos/react-client/echo";
|
|
20
|
-
import { distinctBy } from "@dxos/util";
|
|
21
|
-
var useBlueprintRegistry = () => {
|
|
22
|
-
const blueprintDefinitions = useCapabilities(AppCapabilities.BlueprintDefinition);
|
|
23
|
-
return useMemo(() => new Blueprint.Registry(blueprintDefinitions.map((blueprint) => blueprint.make())), [
|
|
24
|
-
blueprintDefinitions
|
|
25
|
-
]);
|
|
26
|
-
};
|
|
27
|
-
var useBlueprints = ({ blueprintRegistry, db }) => {
|
|
28
|
-
const staticBlueprints = useMemo(() => blueprintRegistry?.query() ?? [], [
|
|
29
|
-
blueprintRegistry
|
|
30
|
-
]);
|
|
31
|
-
const spaceBlueprints = useQuery(db, Filter.type(Blueprint.Blueprint));
|
|
32
|
-
return useMemo(() => {
|
|
33
|
-
const blueprints = distinctBy([
|
|
34
|
-
...staticBlueprints,
|
|
35
|
-
...spaceBlueprints
|
|
36
|
-
], (b) => b.key);
|
|
37
|
-
blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
|
|
38
|
-
return blueprints;
|
|
39
|
-
}, [
|
|
40
|
-
staticBlueprints,
|
|
41
|
-
spaceBlueprints
|
|
42
|
-
]);
|
|
43
|
-
};
|
|
44
|
-
var useActiveBlueprints = ({ context }) => {
|
|
45
|
-
const [active, setActive] = useState(/* @__PURE__ */ new Map());
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (!context) {
|
|
48
|
-
setActive(/* @__PURE__ */ new Map());
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const updateActive = () => {
|
|
52
|
-
const blueprints = context.getBlueprints();
|
|
53
|
-
setActive(new Map(blueprints.map((blueprint) => [
|
|
54
|
-
blueprint.key,
|
|
55
|
-
blueprint
|
|
56
|
-
])));
|
|
57
|
-
};
|
|
58
|
-
updateActive();
|
|
59
|
-
return context.subscribeBlueprints(updateActive);
|
|
60
|
-
}, [
|
|
61
|
-
context
|
|
62
|
-
]);
|
|
63
|
-
return active;
|
|
64
|
-
};
|
|
65
|
-
var useBlueprintHandlers = ({ db, context, blueprintRegistry }) => {
|
|
66
|
-
const onUpdateBlueprint = useCallback(async (key, checked) => {
|
|
67
|
-
if (!context || !blueprintRegistry) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
const objects = await db.query(Filter.type(Blueprint.Blueprint)).run();
|
|
71
|
-
let storedBlueprint = objects.find((blueprint) => blueprint.key === key);
|
|
72
|
-
if (checked) {
|
|
73
|
-
if (!storedBlueprint) {
|
|
74
|
-
const blueprint = blueprintRegistry.getByKey(key);
|
|
75
|
-
if (!blueprint) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
storedBlueprint = db.add(Obj.clone(blueprint));
|
|
79
|
-
}
|
|
80
|
-
await context.bind({
|
|
81
|
-
blueprints: [
|
|
82
|
-
Ref.make(storedBlueprint)
|
|
83
|
-
]
|
|
84
|
-
});
|
|
85
|
-
} else if (storedBlueprint) {
|
|
86
|
-
await context.unbind({
|
|
87
|
-
blueprints: [
|
|
88
|
-
Ref.make(storedBlueprint)
|
|
89
|
-
]
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
}, [
|
|
93
|
-
db,
|
|
94
|
-
context,
|
|
95
|
-
blueprintRegistry
|
|
96
|
-
]);
|
|
97
|
-
return {
|
|
98
|
-
onUpdateBlueprint
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
// src/hooks/useChatProcessor.ts
|
|
103
|
-
import { RegistryContext } from "@effect-atom/atom-react";
|
|
104
|
-
import { useContext, useMemo as useMemo2, useState as useState2 } from "react";
|
|
105
|
-
import { AiConversation } from "@dxos/assistant";
|
|
106
|
-
import { log } from "@dxos/log";
|
|
107
|
-
import { useAsyncEffect } from "@dxos/react-ui";
|
|
108
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/hooks/useChatProcessor.ts";
|
|
109
|
-
var useChatProcessor = ({ space, chat, preset, services, blueprintRegistry, settings }) => {
|
|
110
|
-
const observableRegistry = useContext(RegistryContext);
|
|
111
|
-
const [conversation, setConversation] = useState2();
|
|
112
|
-
useAsyncEffect(async () => {
|
|
113
|
-
if (!space || !chat) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
const queue = space.queues.get(chat.queue.dxn);
|
|
117
|
-
const conversation2 = new AiConversation({
|
|
118
|
-
queue,
|
|
119
|
-
registry: observableRegistry
|
|
120
|
-
});
|
|
121
|
-
await conversation2.open();
|
|
122
|
-
setConversation(conversation2);
|
|
123
|
-
return () => {
|
|
124
|
-
void conversation2.close();
|
|
125
|
-
setConversation(void 0);
|
|
126
|
-
};
|
|
127
|
-
}, [
|
|
128
|
-
space,
|
|
129
|
-
chat?.queue.dxn.toString()
|
|
130
|
-
]);
|
|
131
|
-
const processor = useMemo2(() => {
|
|
132
|
-
if (!services || !conversation) {
|
|
133
|
-
return void 0;
|
|
134
|
-
}
|
|
135
|
-
log("creating processor", {
|
|
136
|
-
preset,
|
|
137
|
-
model: preset?.model,
|
|
138
|
-
settings
|
|
139
|
-
}, {
|
|
140
|
-
F: __dxlog_file,
|
|
141
|
-
L: 69,
|
|
142
|
-
S: void 0,
|
|
143
|
-
C: (f, a) => f(...a)
|
|
144
|
-
});
|
|
145
|
-
return new AiChatProcessor(conversation, services, {
|
|
146
|
-
observableRegistry,
|
|
147
|
-
blueprintRegistry,
|
|
148
|
-
model: preset?.model
|
|
149
|
-
});
|
|
150
|
-
}, [
|
|
151
|
-
services,
|
|
152
|
-
conversation,
|
|
153
|
-
blueprintRegistry,
|
|
154
|
-
preset
|
|
155
|
-
]);
|
|
156
|
-
return processor;
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
// src/hooks/useChatServices.ts
|
|
160
|
-
import * as Effect from "effect/Effect";
|
|
161
|
-
import { useMemo as useMemo3 } from "react";
|
|
162
|
-
import { useCapability } from "@dxos/app-framework/ui";
|
|
163
|
-
import { TracingService } from "@dxos/functions";
|
|
164
|
-
import { TracingServiceExt } from "@dxos/functions-runtime";
|
|
165
|
-
import { AutomationCapabilities } from "@dxos/plugin-automation";
|
|
166
|
-
import { useClient } from "@dxos/react-client";
|
|
167
|
-
var useChatServices = ({ id, chat }) => {
|
|
168
|
-
const client = useClient();
|
|
169
|
-
id ??= client.spaces.default.id;
|
|
170
|
-
const runtimeResolver = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
171
|
-
return useMemo3(() => {
|
|
172
|
-
const runtime2 = runtimeResolver.getRuntime(id);
|
|
173
|
-
return () => runtime2.runPromise(Effect.runtime().pipe(Effect.provide(chat?.traceQueue?.target ? TracingServiceExt.layerQueue(chat.traceQueue?.target) : TracingService.layerNoop)));
|
|
174
|
-
}, [
|
|
175
|
-
id,
|
|
176
|
-
chat?.traceQueue?.target
|
|
177
|
-
]);
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
// src/hooks/useChatToolbarActions.ts
|
|
181
|
-
import { Atom } from "@effect-atom/atom-react";
|
|
182
|
-
import * as Effect2 from "effect/Effect";
|
|
183
|
-
import { useMemo as useMemo10 } from "react";
|
|
184
|
-
import { useOperationInvoker } from "@dxos/app-framework/ui";
|
|
185
|
-
import { Chat as Chat2 } from "@dxos/assistant-toolkit";
|
|
186
|
-
import { Filter as Filter6, Obj as Obj6, Query } from "@dxos/echo";
|
|
187
|
-
import { runAndForwardErrors } from "@dxos/effect";
|
|
188
|
-
import { invariant } from "@dxos/invariant";
|
|
189
|
-
import { useQuery as useQuery5 } from "@dxos/react-client/echo";
|
|
190
|
-
import { MenuBuilder, useMenuActions } from "@dxos/react-ui-menu";
|
|
191
|
-
|
|
192
|
-
// src/components/Chat/Chat.tsx
|
|
193
|
-
import { Prec } from "@codemirror/state";
|
|
194
|
-
import { keymap } from "@codemirror/view";
|
|
195
|
-
import { useAtomValue } from "@effect-atom/atom-react";
|
|
196
|
-
import { createContext } from "@radix-ui/react-context";
|
|
197
|
-
import * as Array2 from "effect/Array";
|
|
198
|
-
import * as Option4 from "effect/Option";
|
|
199
|
-
import React9, { useCallback as useCallback7, useEffect as useEffect7, useMemo as useMemo9, useRef as useRef3, useState as useState12 } from "react";
|
|
200
|
-
import { Event } from "@dxos/async";
|
|
201
|
-
import { Filter as Filter4, Obj as Obj5 } from "@dxos/echo";
|
|
202
|
-
import { useVoiceInput } from "@dxos/plugin-transcription";
|
|
203
|
-
import { useQuery as useQuery3 } from "@dxos/react-client/echo";
|
|
204
|
-
import { useIdentity } from "@dxos/react-client/halo";
|
|
205
|
-
import { Input, useDynamicRef, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
206
|
-
import { ChatEditor } from "@dxos/react-ui-chat";
|
|
207
|
-
import { Menu } from "@dxos/react-ui-menu";
|
|
208
|
-
import { Message } from "@dxos/types";
|
|
209
|
-
import { mx as mx6 } from "@dxos/ui-theme";
|
|
210
|
-
import { isTruthy } from "@dxos/util";
|
|
211
|
-
|
|
212
|
-
// src/hooks/useContextBinder.ts
|
|
213
|
-
import { RegistryContext as RegistryContext2 } from "@effect-atom/atom-react";
|
|
214
|
-
import { useContext as useContext2, useState as useState3 } from "react";
|
|
215
|
-
import { AiContextBinder } from "@dxos/assistant";
|
|
216
|
-
import { useAsyncEffect as useAsyncEffect2 } from "@dxos/react-ui";
|
|
217
|
-
var useContextBinder = (queue) => {
|
|
218
|
-
const registry = useContext2(RegistryContext2);
|
|
219
|
-
const [binder, setBinder] = useState3();
|
|
220
|
-
useAsyncEffect2(async () => {
|
|
221
|
-
if (!queue) {
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
const binder2 = new AiContextBinder({
|
|
225
|
-
queue,
|
|
226
|
-
registry
|
|
227
|
-
});
|
|
228
|
-
await binder2.open();
|
|
229
|
-
setBinder(binder2);
|
|
230
|
-
return () => {
|
|
231
|
-
void binder2.close();
|
|
232
|
-
};
|
|
233
|
-
}, [
|
|
234
|
-
queue
|
|
235
|
-
]);
|
|
236
|
-
return binder;
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
// src/hooks/useContextObjects.ts
|
|
240
|
-
import { useCallback as useCallback2 } from "react";
|
|
241
|
-
import { Ref as Ref2 } from "@dxos/echo";
|
|
242
|
-
var useContextObjects = ({ db, context }) => {
|
|
243
|
-
const handleUpdateObject = useCallback2(async (dxn, checked) => {
|
|
244
|
-
if (!db || !context) {
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
const ref = Ref2.fromDXN(dxn);
|
|
248
|
-
await ref.load();
|
|
249
|
-
if (checked) {
|
|
250
|
-
await context.bind({
|
|
251
|
-
objects: [
|
|
252
|
-
ref
|
|
253
|
-
]
|
|
254
|
-
});
|
|
255
|
-
} else {
|
|
256
|
-
await context.unbind({
|
|
257
|
-
objects: [
|
|
258
|
-
ref
|
|
259
|
-
]
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
}, [
|
|
263
|
-
db,
|
|
264
|
-
context
|
|
265
|
-
]);
|
|
266
|
-
return {
|
|
267
|
-
objects: context?.getObjects() ?? [],
|
|
268
|
-
onUpdateObject: handleUpdateObject
|
|
269
|
-
};
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
// src/hooks/useFilteredTypes.ts
|
|
273
|
-
import * as Option from "effect/Option";
|
|
274
|
-
import { useEffect as useEffect2, useState as useState4 } from "react";
|
|
275
|
-
import { EntityKind, SystemTypeAnnotation, getTypeAnnotation } from "@dxos/echo/internal";
|
|
276
|
-
var useFilteredTypes = (db) => {
|
|
277
|
-
const [types, setTypes] = useState4([]);
|
|
278
|
-
useEffect2(() => {
|
|
279
|
-
if (!db) {
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
return db.schemaRegistry.query({
|
|
283
|
-
location: [
|
|
284
|
-
"database",
|
|
285
|
-
"runtime"
|
|
286
|
-
]
|
|
287
|
-
}).subscribe((query) => {
|
|
288
|
-
const types2 = Array.from(new Set(query.results.filter((schema) => getTypeAnnotation(schema)?.kind !== EntityKind.Relation).filter((schema) => SystemTypeAnnotation.get(schema).pipe(Option.getOrElse(() => false)))));
|
|
289
|
-
setTypes(types2);
|
|
290
|
-
}, {
|
|
291
|
-
fire: true
|
|
292
|
-
});
|
|
293
|
-
}, [
|
|
294
|
-
db
|
|
295
|
-
]);
|
|
296
|
-
return types;
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
// src/hooks/useFlush.ts
|
|
300
|
-
import { useCallback as useCallback3, useRef, useState as useState5 } from "react";
|
|
301
|
-
var useFlush = (space) => {
|
|
302
|
-
const [state, setState] = useState5("idle");
|
|
303
|
-
const resetTimer = useRef(null);
|
|
304
|
-
const handleFlush = useCallback3(() => {
|
|
305
|
-
if (!space) {
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
queueMicrotask(async () => {
|
|
309
|
-
if (resetTimer.current) {
|
|
310
|
-
clearTimeout(resetTimer.current);
|
|
311
|
-
}
|
|
312
|
-
setState("flushing");
|
|
313
|
-
await space.db.flush();
|
|
314
|
-
setState("flushed");
|
|
315
|
-
resetTimer.current = setTimeout(() => {
|
|
316
|
-
setState("idle");
|
|
317
|
-
resetTimer.current = null;
|
|
318
|
-
}, 1e3);
|
|
319
|
-
});
|
|
320
|
-
}, [
|
|
321
|
-
space
|
|
322
|
-
]);
|
|
323
|
-
return {
|
|
324
|
-
state,
|
|
325
|
-
handleFlush
|
|
326
|
-
};
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
// src/hooks/useOnline.ts
|
|
330
|
-
import { useState as useState6 } from "react";
|
|
331
|
-
var useOnline = () => {
|
|
332
|
-
const [online, setOnline] = useState6(true);
|
|
333
|
-
return [
|
|
334
|
-
online,
|
|
335
|
-
setOnline
|
|
336
|
-
];
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
// src/hooks/usePresets.ts
|
|
340
|
-
import { useCallback as useCallback4, useEffect as useEffect3, useMemo as useMemo4, useState as useState7 } from "react";
|
|
341
|
-
var usePresets = (online) => {
|
|
342
|
-
const [preset, setPreset] = useState7();
|
|
343
|
-
const presets = useMemo4(() => AiServicePresets.filter((preset2) => online === (preset2.provider === "dxos-remote")), [
|
|
344
|
-
online
|
|
345
|
-
]);
|
|
346
|
-
const presetOptions = useMemo4(() => presets.map(({ id, model, label }) => ({
|
|
347
|
-
id,
|
|
348
|
-
label: label ?? model
|
|
349
|
-
})), [
|
|
350
|
-
presets
|
|
351
|
-
]);
|
|
352
|
-
useEffect3(() => {
|
|
353
|
-
setPreset(presets[0]);
|
|
354
|
-
}, [
|
|
355
|
-
presets
|
|
356
|
-
]);
|
|
357
|
-
const handlePresetChange = useCallback4((id) => {
|
|
358
|
-
const preset2 = presets.find((preset3) => preset3.id === id);
|
|
359
|
-
if (preset2) {
|
|
360
|
-
setPreset(preset2);
|
|
361
|
-
}
|
|
362
|
-
}, [
|
|
363
|
-
presets
|
|
364
|
-
]);
|
|
365
|
-
return {
|
|
366
|
-
preset,
|
|
367
|
-
presets: presetOptions,
|
|
368
|
-
onPresetChange: handlePresetChange
|
|
369
|
-
};
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
// src/hooks/useReferencesProvider.ts
|
|
373
|
-
import { useMemo as useMemo5 } from "react";
|
|
374
|
-
import { Filter as Filter2, Obj as Obj2 } from "@dxos/echo";
|
|
375
|
-
var useReferencesProvider = (space) => {
|
|
376
|
-
return useMemo5(() => {
|
|
377
|
-
if (!space) {
|
|
378
|
-
return void 0;
|
|
379
|
-
}
|
|
380
|
-
return {
|
|
381
|
-
getReferences: async ({ query }) => {
|
|
382
|
-
const objects = await space.db.query(Filter2.everything()).run();
|
|
383
|
-
return objects.filter((object) => stringMatch(query, Obj2.getLabel(object) ?? "")).filter((object) => !!Obj2.getDXN(object)).map((object) => ({
|
|
384
|
-
uri: Obj2.getDXN(object).toString(),
|
|
385
|
-
label: Obj2.getLabel(object) ?? ""
|
|
386
|
-
}));
|
|
387
|
-
},
|
|
388
|
-
resolveReference: async ({ uri }) => {
|
|
389
|
-
const object = await space.db.query(Filter2.id(uri)).first();
|
|
390
|
-
return {
|
|
391
|
-
uri,
|
|
392
|
-
label: Obj2.getLabel(object) ?? ""
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
};
|
|
396
|
-
}, [
|
|
397
|
-
space
|
|
398
|
-
]);
|
|
399
|
-
};
|
|
400
|
-
var stringMatch = (query, label) => label.toLowerCase().startsWith(query.toLowerCase());
|
|
401
|
-
|
|
402
|
-
// src/components/ChatPrompt/ChatActions.tsx
|
|
403
|
-
import React from "react";
|
|
404
|
-
import { IconButton, useTranslation } from "@dxos/react-ui";
|
|
405
|
-
import { mx } from "@dxos/ui-theme";
|
|
406
|
-
var ChatActions = ({ classNames, children, microphone, recording, processing, onEvent }) => {
|
|
407
|
-
const { t } = useTranslation(meta.id);
|
|
408
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
409
|
-
className: mx("flex items-center me-1", classNames)
|
|
410
|
-
}, children, /* @__PURE__ */ React.createElement(IconButton, {
|
|
411
|
-
disabled: !processing,
|
|
412
|
-
variant: "ghost",
|
|
413
|
-
icon: "ph--x--regular",
|
|
414
|
-
iconOnly: true,
|
|
415
|
-
label: t("cancel processing button"),
|
|
416
|
-
onClick: () => onEvent?.({
|
|
417
|
-
type: "cancel"
|
|
418
|
-
})
|
|
419
|
-
}), microphone && /* @__PURE__ */ React.createElement(IconButton, {
|
|
420
|
-
disabled: !processing,
|
|
421
|
-
classNames: mx(recording && "bg-primary-500"),
|
|
422
|
-
variant: "ghost",
|
|
423
|
-
icon: "ph--microphone--regular",
|
|
424
|
-
iconOnly: true,
|
|
425
|
-
noTooltip: true,
|
|
426
|
-
label: t("microphone button"),
|
|
427
|
-
onMouseDown: () => onEvent?.({
|
|
428
|
-
type: "record-start"
|
|
429
|
-
}),
|
|
430
|
-
onMouseUp: () => onEvent?.({
|
|
431
|
-
type: "record-stop"
|
|
432
|
-
}),
|
|
433
|
-
onTouchStart: () => onEvent?.({
|
|
434
|
-
type: "record-start"
|
|
435
|
-
}),
|
|
436
|
-
onTouchEnd: () => onEvent?.({
|
|
437
|
-
type: "record-stop"
|
|
438
|
-
})
|
|
439
|
-
}), /* @__PURE__ */ React.createElement(IconButton, {
|
|
440
|
-
variant: "ghost",
|
|
441
|
-
icon: "ph--wrench--regular",
|
|
442
|
-
iconOnly: true,
|
|
443
|
-
label: t("debug button"),
|
|
444
|
-
onClick: () => onEvent?.({
|
|
445
|
-
type: "toggle-debug"
|
|
446
|
-
})
|
|
447
|
-
}));
|
|
448
|
-
};
|
|
449
|
-
|
|
450
|
-
// src/components/ChatPrompt/ChatOptions.tsx
|
|
451
|
-
import * as Option2 from "effect/Option";
|
|
452
|
-
import React2, { useMemo as useMemo6, useState as useState8 } from "react";
|
|
453
|
-
import { Filter as Filter3, Obj as Obj3, Type } from "@dxos/echo";
|
|
454
|
-
import { Annotation } from "@dxos/echo";
|
|
455
|
-
import { useQuery as useQuery2 } from "@dxos/react-client/echo";
|
|
456
|
-
import { IconButton as IconButton2, Popover, Select, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
457
|
-
import { Listbox, SearchList, useSearchListResults } from "@dxos/react-ui-searchlist";
|
|
458
|
-
import { Tabs } from "@dxos/react-ui-tabs";
|
|
459
|
-
import { getStyles, mx as mx2 } from "@dxos/ui-theme";
|
|
460
|
-
var panelClassNames = "w-[calc(100dvw-.5rem)] sm:w-max md:w-72 max-w-text-content";
|
|
461
|
-
var ChatOptions = ({ db, context, blueprintRegistry, presets, preset, onPresetChange }) => {
|
|
462
|
-
const { t } = useTranslation2(meta.id);
|
|
463
|
-
return /* @__PURE__ */ React2.createElement("div", {
|
|
464
|
-
role: "none",
|
|
465
|
-
className: "flex p-2"
|
|
466
|
-
}, /* @__PURE__ */ React2.createElement(Popover.Root, null, /* @__PURE__ */ React2.createElement(Popover.Trigger, {
|
|
467
|
-
asChild: true
|
|
468
|
-
}, /* @__PURE__ */ React2.createElement(IconButton2, {
|
|
469
|
-
variant: "ghost",
|
|
470
|
-
icon: "ph--plus--regular",
|
|
471
|
-
iconOnly: true,
|
|
472
|
-
label: t("context objects button")
|
|
473
|
-
})), /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, {
|
|
474
|
-
side: "top",
|
|
475
|
-
classNames: panelClassNames
|
|
476
|
-
}, /* @__PURE__ */ React2.createElement(Popover.Viewport, null, /* @__PURE__ */ React2.createElement(ObjectsPanel, {
|
|
477
|
-
db,
|
|
478
|
-
context
|
|
479
|
-
})), /* @__PURE__ */ React2.createElement(Popover.Arrow, null)))), /* @__PURE__ */ React2.createElement(Popover.Root, null, /* @__PURE__ */ React2.createElement(Popover.Trigger, {
|
|
480
|
-
asChild: true
|
|
481
|
-
}, /* @__PURE__ */ React2.createElement(IconButton2, {
|
|
482
|
-
variant: "ghost",
|
|
483
|
-
icon: "ph--sliders-horizontal--regular",
|
|
484
|
-
iconOnly: true,
|
|
485
|
-
label: t("context settings button")
|
|
486
|
-
})), /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, {
|
|
487
|
-
side: "top",
|
|
488
|
-
classNames: panelClassNames
|
|
489
|
-
}, /* @__PURE__ */ React2.createElement(Popover.Viewport, null, /* @__PURE__ */ React2.createElement(Tabs.Root, {
|
|
490
|
-
orientation: "horizontal",
|
|
491
|
-
defaultValue: "blueprints",
|
|
492
|
-
defaultActivePart: "list",
|
|
493
|
-
tabIndex: -1
|
|
494
|
-
}, /* @__PURE__ */ React2.createElement(Tabs.Viewport, {
|
|
495
|
-
classNames: mx2("max-h-(--radix-popover-content-available-height) grid grid-rows-[1fr_min-content]", '[&_[cmdk-root]]:contents [&_[role="tabpanel"]]:grid [&_[role="tabpanel"]]:grid-rows-[1fr_min-content]', '[&_[role="listbox"]]:min-h-0 [&_[role="listbox"]]:overflow-y-auto', '[&_[role="tabpanel"]]:min-h-0 [&_[role="tabpanel"]]:px-form-chrome [&_[role="tabpanel"][data-state="active"]]:order-first [&_[role="tabpanel"][data-state="inactive"]]:hidden')
|
|
496
|
-
}, /* @__PURE__ */ React2.createElement(Tabs.Tabpanel, {
|
|
497
|
-
value: "blueprints",
|
|
498
|
-
tabIndex: -1,
|
|
499
|
-
classNames: "dx-focus-ring-inset"
|
|
500
|
-
}, /* @__PURE__ */ React2.createElement(BlueprintsPanel, {
|
|
501
|
-
blueprintRegistry,
|
|
502
|
-
db,
|
|
503
|
-
context
|
|
504
|
-
})), /* @__PURE__ */ React2.createElement(Tabs.Tabpanel, {
|
|
505
|
-
value: "model",
|
|
506
|
-
tabIndex: -1,
|
|
507
|
-
classNames: "dx-focus-ring-inset px-0!"
|
|
508
|
-
}, /* @__PURE__ */ React2.createElement(ModelsPanel, {
|
|
509
|
-
presets,
|
|
510
|
-
preset,
|
|
511
|
-
onPresetChange
|
|
512
|
-
})), /* @__PURE__ */ React2.createElement(Tabs.Tablist, {
|
|
513
|
-
classNames: "sm:overflow-x-hidden justify-center p-form-chrome border-y border-subdued-separator order-last"
|
|
514
|
-
}, /* @__PURE__ */ React2.createElement(Tabs.IconTab, {
|
|
515
|
-
value: "blueprints",
|
|
516
|
-
icon: "ph--blueprint--regular",
|
|
517
|
-
label: t("blueprints in context title")
|
|
518
|
-
}), /* @__PURE__ */ React2.createElement(Tabs.IconTab, {
|
|
519
|
-
value: "model",
|
|
520
|
-
label: t("chat model title"),
|
|
521
|
-
icon: "ph--cpu--regular"
|
|
522
|
-
}))))), /* @__PURE__ */ React2.createElement(Popover.Arrow, null)))));
|
|
523
|
-
};
|
|
524
|
-
var BlueprintsPanel = ({ blueprintRegistry, db, context }) => {
|
|
525
|
-
const { t } = useTranslation2(meta.id);
|
|
526
|
-
const blueprints = useBlueprints({
|
|
527
|
-
blueprintRegistry,
|
|
528
|
-
db
|
|
529
|
-
});
|
|
530
|
-
const activeBlueprints = useActiveBlueprints({
|
|
531
|
-
context
|
|
532
|
-
});
|
|
533
|
-
const { onUpdateBlueprint } = useBlueprintHandlers({
|
|
534
|
-
db,
|
|
535
|
-
context,
|
|
536
|
-
blueprintRegistry
|
|
537
|
-
});
|
|
538
|
-
const { results, handleSearch } = useSearchListResults({
|
|
539
|
-
items: blueprints,
|
|
540
|
-
extract: (blueprint) => blueprint.name
|
|
541
|
-
});
|
|
542
|
-
return /* @__PURE__ */ React2.createElement(SearchList.Root, {
|
|
543
|
-
onSearch: handleSearch
|
|
544
|
-
}, /* @__PURE__ */ React2.createElement(SearchList.Content, {
|
|
545
|
-
classNames: "py-form-chrome"
|
|
546
|
-
}, /* @__PURE__ */ React2.createElement(SearchList.Viewport, null, results.map((blueprint) => {
|
|
547
|
-
const isActive = activeBlueprints.has(blueprint.key);
|
|
548
|
-
return /* @__PURE__ */ React2.createElement(SearchList.Item, {
|
|
549
|
-
classNames: "flex items-center overflow-hidden",
|
|
550
|
-
key: blueprint.key,
|
|
551
|
-
value: blueprint.key,
|
|
552
|
-
label: blueprint.name,
|
|
553
|
-
checked: isActive,
|
|
554
|
-
onSelect: () => onUpdateBlueprint?.(blueprint.key, !isActive)
|
|
555
|
-
});
|
|
556
|
-
}))), /* @__PURE__ */ React2.createElement(SearchList.Input, {
|
|
557
|
-
placeholder: t("search placeholder"),
|
|
558
|
-
classNames: "mb-form-chrome",
|
|
559
|
-
autoFocus: true
|
|
560
|
-
}));
|
|
561
|
-
};
|
|
562
|
-
var ModelsPanel = ({ presets, preset, onPresetChange }) => {
|
|
563
|
-
return /* @__PURE__ */ React2.createElement(Listbox.Root, {
|
|
564
|
-
value: preset,
|
|
565
|
-
onValueChange: onPresetChange,
|
|
566
|
-
autoFocus: true
|
|
567
|
-
}, presets?.map(({ id, label }) => {
|
|
568
|
-
return /* @__PURE__ */ React2.createElement(Listbox.Option, {
|
|
569
|
-
key: id,
|
|
570
|
-
value: id
|
|
571
|
-
}, /* @__PURE__ */ React2.createElement(Listbox.OptionLabel, null, label), /* @__PURE__ */ React2.createElement(Listbox.OptionIndicator, null));
|
|
572
|
-
}));
|
|
573
|
-
};
|
|
574
|
-
var ANY = "__any__";
|
|
575
|
-
var ObjectsPanel = ({ db, context }) => {
|
|
576
|
-
const { t } = useTranslation2(meta.id);
|
|
577
|
-
const types = useFilteredTypes(db);
|
|
578
|
-
const typenames = useMemo6(() => {
|
|
579
|
-
const typenames2 = types.map((type) => {
|
|
580
|
-
const typename2 = Type.getTypename(type);
|
|
581
|
-
return {
|
|
582
|
-
typename: typename2,
|
|
583
|
-
label: t("typename label", {
|
|
584
|
-
ns: typename2,
|
|
585
|
-
defaultValue: typename2
|
|
586
|
-
})
|
|
587
|
-
};
|
|
588
|
-
});
|
|
589
|
-
typenames2.sort((a, b) => a.label.localeCompare(b.label));
|
|
590
|
-
return typenames2;
|
|
591
|
-
}, [
|
|
592
|
-
types
|
|
593
|
-
]);
|
|
594
|
-
const [typename, setTypename] = useState8(ANY);
|
|
595
|
-
const anyFilter = useMemo6(() => Filter3.or(...typenames.map(({ typename: typename2 }) => Filter3.typename(typename2))), [
|
|
596
|
-
typenames
|
|
597
|
-
]);
|
|
598
|
-
const objects = useQuery2(db, typename === ANY ? anyFilter : Filter3.typename(typename));
|
|
599
|
-
const { objects: contextObjects, onUpdateObject } = useContextObjects({
|
|
600
|
-
db,
|
|
601
|
-
context
|
|
602
|
-
});
|
|
603
|
-
const { results, handleSearch } = useSearchListResults({
|
|
604
|
-
items: objects,
|
|
605
|
-
extract: (object) => Obj3.getLabel(object) ?? Obj3.getTypename(object) ?? object.id
|
|
606
|
-
});
|
|
607
|
-
return /* @__PURE__ */ React2.createElement(SearchList.Root, {
|
|
608
|
-
onSearch: handleSearch
|
|
609
|
-
}, /* @__PURE__ */ React2.createElement(SearchList.Content, {
|
|
610
|
-
classNames: "p-form-chrome [&:has([cmdk-list-sizer]:empty)]:py-0"
|
|
611
|
-
}, /* @__PURE__ */ React2.createElement(SearchList.Viewport, null, results.length ? results.map((object) => {
|
|
612
|
-
const isActive = contextObjects.findIndex((obj) => obj.id === object.id) !== -1;
|
|
613
|
-
const { icon, hue } = Option2.fromNullable(Obj3.getSchema(object)).pipe(Option2.flatMap(Annotation.IconAnnotation.get), Option2.getOrElse(() => ({
|
|
614
|
-
icon: DEFAULT_OBJECT_ICON,
|
|
615
|
-
hue: void 0
|
|
616
|
-
})));
|
|
617
|
-
const styles = hue ? getStyles(hue) : void 0;
|
|
618
|
-
return /* @__PURE__ */ React2.createElement(SearchList.Item, {
|
|
619
|
-
classNames: "flex items-center overflow-hidden",
|
|
620
|
-
key: object.id,
|
|
621
|
-
value: object.id,
|
|
622
|
-
icon,
|
|
623
|
-
iconClassNames: styles?.surfaceText,
|
|
624
|
-
label: Obj3.getLabel(object) ?? Obj3.getTypename(object) ?? object.id,
|
|
625
|
-
checked: isActive,
|
|
626
|
-
onSelect: () => onUpdateObject?.(Obj3.getDXN(object), !isActive)
|
|
627
|
-
});
|
|
628
|
-
}) : /* @__PURE__ */ React2.createElement(SearchList.Item, {
|
|
629
|
-
value: "__empty__",
|
|
630
|
-
label: t("no results")
|
|
631
|
-
}))), /* @__PURE__ */ React2.createElement("div", {
|
|
632
|
-
role: "none",
|
|
633
|
-
className: "grid grid-cols-[min-content_1fr] gap-2 px-form-chrome mb-form-chrome"
|
|
634
|
-
}, /* @__PURE__ */ React2.createElement(Select.Root, {
|
|
635
|
-
value: typename === ANY ? void 0 : typename,
|
|
636
|
-
onValueChange: setTypename
|
|
637
|
-
}, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
|
|
638
|
-
density: "fine",
|
|
639
|
-
placeholder: t("type filter placeholder")
|
|
640
|
-
}), /* @__PURE__ */ React2.createElement(Select.Portal, null, /* @__PURE__ */ React2.createElement(Select.Content, null, /* @__PURE__ */ React2.createElement(Select.ScrollUpButton, null), /* @__PURE__ */ React2.createElement(Select.Viewport, null, /* @__PURE__ */ React2.createElement(Select.Option, {
|
|
641
|
-
value: ANY
|
|
642
|
-
}, t("any type filter label")), typenames.map(({ typename: typename2, label }) => /* @__PURE__ */ React2.createElement(Select.Option, {
|
|
643
|
-
key: typename2,
|
|
644
|
-
value: typename2
|
|
645
|
-
}, label))), /* @__PURE__ */ React2.createElement(Select.ScrollDownButton, null), /* @__PURE__ */ React2.createElement(Select.Arrow, null)))), /* @__PURE__ */ React2.createElement(SearchList.Input, {
|
|
646
|
-
placeholder: t("search placeholder"),
|
|
647
|
-
classNames: "mb-0",
|
|
648
|
-
autoFocus: true
|
|
649
|
-
})));
|
|
650
|
-
};
|
|
651
|
-
var DEFAULT_OBJECT_ICON = "ph--cube--regular";
|
|
652
|
-
|
|
653
|
-
// src/components/ChatPrompt/ChatPresets.tsx
|
|
654
|
-
import React3 from "react";
|
|
655
|
-
import { Select as Select2 } from "@dxos/react-ui";
|
|
656
|
-
|
|
657
|
-
// src/components/ChatPrompt/ChatReferences.tsx
|
|
658
|
-
import * as Option3 from "effect/Option";
|
|
659
|
-
import React4 from "react";
|
|
660
|
-
import { Annotation as Annotation2, Obj as Obj4 } from "@dxos/echo";
|
|
661
|
-
import { Icon, IconButton as IconButton3, toLocalizedString, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
662
|
-
import { getStyles as getStyles2, mx as mx3 } from "@dxos/ui-theme";
|
|
663
|
-
var ChatReferences = ({ classNames, context, db }) => {
|
|
664
|
-
const { t } = useTranslation3(meta.id);
|
|
665
|
-
const { objects, onUpdateObject } = useContextObjects({
|
|
666
|
-
db,
|
|
667
|
-
context
|
|
668
|
-
});
|
|
669
|
-
return /* @__PURE__ */ React4.createElement("ul", {
|
|
670
|
-
className: mx3("flex", classNames)
|
|
671
|
-
}, objects.map((obj) => {
|
|
672
|
-
const dxn = Obj4.getDXN(obj);
|
|
673
|
-
const typename = Obj4.getTypename(obj);
|
|
674
|
-
const label = Obj4.getLabel(obj) ?? (typename ? [
|
|
675
|
-
"object name placeholder",
|
|
676
|
-
{
|
|
677
|
-
ns: typename
|
|
678
|
-
}
|
|
679
|
-
] : obj.id);
|
|
680
|
-
const { icon, hue } = Option3.fromNullable(Obj4.getSchema(obj)).pipe(Option3.flatMap(Annotation2.IconAnnotation.get), Option3.getOrElse(() => ({
|
|
681
|
-
icon: DEFAULT_OBJECT_ICON2,
|
|
682
|
-
hue: void 0
|
|
683
|
-
})));
|
|
684
|
-
const styles = hue ? getStyles2(hue) : void 0;
|
|
685
|
-
return /* @__PURE__ */ React4.createElement("li", {
|
|
686
|
-
key: dxn.toString(),
|
|
687
|
-
className: "dx-tag py-0 ps-2 flex items-center gap-1",
|
|
688
|
-
"data-hue": "neutral"
|
|
689
|
-
}, /* @__PURE__ */ React4.createElement(Icon, {
|
|
690
|
-
icon,
|
|
691
|
-
size: 4,
|
|
692
|
-
classNames: styles?.surfaceText
|
|
693
|
-
}), toLocalizedString(label, t), /* @__PURE__ */ React4.createElement(IconButton3, {
|
|
694
|
-
icon: "ph--x--bold",
|
|
695
|
-
iconOnly: true,
|
|
696
|
-
variant: "ghost",
|
|
697
|
-
label: t("remove object in context label"),
|
|
698
|
-
classNames: "p-0 hover:bg-transparent",
|
|
699
|
-
size: 3,
|
|
700
|
-
onClick: () => onUpdateObject?.(dxn, false)
|
|
701
|
-
}));
|
|
702
|
-
}));
|
|
703
|
-
};
|
|
704
|
-
var DEFAULT_OBJECT_ICON2 = "ph--cube--regular";
|
|
705
|
-
|
|
706
|
-
// src/components/ChatPrompt/ChatStatusIndicator.tsx
|
|
707
|
-
import React5, { useEffect as useEffect4, useState as useState9 } from "react";
|
|
708
|
-
import { Tooltip, useTimeout } from "@dxos/react-ui";
|
|
709
|
-
import { Spinner } from "@dxos/react-ui-sfx";
|
|
710
|
-
import { mx as mx4 } from "@dxos/ui-theme";
|
|
711
|
-
var period = 3e3;
|
|
712
|
-
var ChatStatusIndicator = ({ classNames, preset, processing, error, ...props }) => {
|
|
713
|
-
const [init, setInit] = useState9(false);
|
|
714
|
-
useEffect4(() => setInit(false), [
|
|
715
|
-
preset
|
|
716
|
-
]);
|
|
717
|
-
useTimeout(async () => {
|
|
718
|
-
setInit(true);
|
|
719
|
-
}, period / 2, [
|
|
720
|
-
preset
|
|
721
|
-
]);
|
|
722
|
-
return /* @__PURE__ */ React5.createElement("div", {
|
|
723
|
-
role: "none",
|
|
724
|
-
className: mx4("relative flex", classNames)
|
|
725
|
-
}, /* @__PURE__ */ React5.createElement(Spinner, {
|
|
726
|
-
duration: period,
|
|
727
|
-
state: !init ? "flash" : error ? "error" : processing ? "spin" : "pulse",
|
|
728
|
-
...props
|
|
729
|
-
}), error && /* @__PURE__ */ React5.createElement(Tooltip.Trigger, {
|
|
730
|
-
asChild: true,
|
|
731
|
-
content: error.message
|
|
732
|
-
}, /* @__PURE__ */ React5.createElement("div", {
|
|
733
|
-
className: "absolute inset-0"
|
|
734
|
-
})));
|
|
735
|
-
};
|
|
736
|
-
|
|
737
|
-
// src/components/ChatThread/ChatThread.tsx
|
|
738
|
-
import React8, { forwardRef, useCallback as useCallback6, useEffect as useEffect6, useMemo as useMemo8, useState as useState11 } from "react";
|
|
739
|
-
import { PublicKey } from "@dxos/keys";
|
|
740
|
-
import { useForwardedRef } from "@dxos/react-ui";
|
|
741
|
-
import { MarkdownStream } from "@dxos/react-ui-components";
|
|
742
|
-
import { mx as mx5 } from "@dxos/ui-theme";
|
|
743
|
-
import { keyToFallback } from "@dxos/util";
|
|
744
|
-
|
|
745
|
-
// src/components/ChatThread/registry.tsx
|
|
746
|
-
import React7 from "react";
|
|
747
|
-
import { log as log2 } from "@dxos/log";
|
|
748
|
-
import { ToggleContainer as ToggleContainer2 } from "@dxos/react-ui-components";
|
|
749
|
-
import { PromptWidget, ReasoningWidget, ReferenceWidget, SelectWidget, SuggestionWidget, SummaryWidget } from "@dxos/react-ui-components";
|
|
750
|
-
import { Json as Json2 } from "@dxos/react-ui-syntax-highlighter";
|
|
751
|
-
import { ContentBlock } from "@dxos/types";
|
|
752
|
-
import { getXmlTextChild } from "@dxos/ui-editor";
|
|
753
|
-
|
|
754
|
-
// src/components/ToolBlock/ToolBlock.tsx
|
|
755
|
-
import React6, { useCallback as useCallback5, useEffect as useEffect5, useMemo as useMemo7, useRef as useRef2, useState as useState10 } from "react";
|
|
756
|
-
import { useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
757
|
-
import { NumericTabs, TextCrawl, ToggleContainer } from "@dxos/react-ui-components";
|
|
758
|
-
import { Json } from "@dxos/react-ui-syntax-highlighter";
|
|
759
|
-
import { isNonNullable, safeParseJson } from "@dxos/util";
|
|
760
|
-
var ToolBlock = ({ view, blocks = [] }) => {
|
|
761
|
-
const { t } = useTranslation4(meta.id);
|
|
762
|
-
const items = useMemo7(() => {
|
|
763
|
-
let lastToolCall;
|
|
764
|
-
const tools = [];
|
|
765
|
-
return blocks.filter((block) => block._tag === "toolCall" || block._tag === "toolResult" || block._tag === "stats").map((block) => {
|
|
766
|
-
switch (block._tag) {
|
|
767
|
-
case "toolCall": {
|
|
768
|
-
if (block.pending && lastToolCall?.block.toolCallId === block.toolCallId) {
|
|
769
|
-
return null;
|
|
770
|
-
}
|
|
771
|
-
const tool = tools.find((tool2) => tool2.name === block.name);
|
|
772
|
-
lastToolCall = {
|
|
773
|
-
tool,
|
|
774
|
-
block
|
|
775
|
-
};
|
|
776
|
-
return {
|
|
777
|
-
title: tool?.description ?? [
|
|
778
|
-
t("tool call label"),
|
|
779
|
-
tool?.name
|
|
780
|
-
].join(" "),
|
|
781
|
-
content: {
|
|
782
|
-
...block,
|
|
783
|
-
input: safeParseJson(block.input)
|
|
784
|
-
}
|
|
785
|
-
};
|
|
786
|
-
}
|
|
787
|
-
case "toolResult": {
|
|
788
|
-
if (block.error) {
|
|
789
|
-
return {
|
|
790
|
-
title: t("tool error label"),
|
|
791
|
-
content: block
|
|
792
|
-
};
|
|
793
|
-
}
|
|
794
|
-
const title = lastToolCall?.tool?.description ?? [
|
|
795
|
-
t("tool result label"),
|
|
796
|
-
lastToolCall?.tool?.name
|
|
797
|
-
].join(" ");
|
|
798
|
-
lastToolCall = void 0;
|
|
799
|
-
return {
|
|
800
|
-
title,
|
|
801
|
-
content: {
|
|
802
|
-
...block,
|
|
803
|
-
result: safeParseJson(block.result)
|
|
804
|
-
}
|
|
805
|
-
};
|
|
806
|
-
}
|
|
807
|
-
case "stats": {
|
|
808
|
-
if (!lastToolCall) {
|
|
809
|
-
return null;
|
|
810
|
-
}
|
|
811
|
-
return {
|
|
812
|
-
title: t("stats label"),
|
|
813
|
-
content: block
|
|
814
|
-
};
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
}).filter(isNonNullable);
|
|
818
|
-
}, [
|
|
819
|
-
blocks
|
|
820
|
-
]);
|
|
821
|
-
const handleChangeOpen = useCallback5(() => {
|
|
822
|
-
setTimeout(() => {
|
|
823
|
-
view?.requestMeasure();
|
|
824
|
-
}, 1e3);
|
|
825
|
-
}, [
|
|
826
|
-
view
|
|
827
|
-
]);
|
|
828
|
-
if (!items.length) {
|
|
829
|
-
return null;
|
|
830
|
-
}
|
|
831
|
-
return /* @__PURE__ */ React6.createElement(ToolContainer, {
|
|
832
|
-
items,
|
|
833
|
-
onChangeOpen: handleChangeOpen
|
|
834
|
-
});
|
|
835
|
-
};
|
|
836
|
-
ToolBlock.displayName = "ToolBlock";
|
|
837
|
-
var ToolContainer = ({ items, onChangeOpen }) => {
|
|
838
|
-
const tabsRef = useRef2(null);
|
|
839
|
-
const [selected, setSelected] = useState10(0);
|
|
840
|
-
const [open, setOpen] = useState10(false);
|
|
841
|
-
useEffect5(() => {
|
|
842
|
-
onChangeOpen?.(open);
|
|
843
|
-
if (open) {
|
|
844
|
-
tabsRef.current?.focus();
|
|
845
|
-
}
|
|
846
|
-
}, [
|
|
847
|
-
open,
|
|
848
|
-
onChangeOpen
|
|
849
|
-
]);
|
|
850
|
-
const handleSelect = useCallback5((index) => {
|
|
851
|
-
setSelected(index);
|
|
852
|
-
}, []);
|
|
853
|
-
return /* @__PURE__ */ React6.createElement(ToggleContainer.Root, {
|
|
854
|
-
classNames: "mt-2 w-full rounded-xs",
|
|
855
|
-
open,
|
|
856
|
-
onChangeOpen: setOpen
|
|
857
|
-
}, /* @__PURE__ */ React6.createElement(ToggleContainer.Header, {
|
|
858
|
-
classNames: "text-sm text-placeholder"
|
|
859
|
-
}, /* @__PURE__ */ React6.createElement(TextCrawl, {
|
|
860
|
-
key: "status-roll",
|
|
861
|
-
lines: items.map((item) => item.title),
|
|
862
|
-
autoAdvance: true,
|
|
863
|
-
greedy: true
|
|
864
|
-
})), /* @__PURE__ */ React6.createElement(ToggleContainer.Content, {
|
|
865
|
-
classNames: "grid grid-cols-[32px_1fr]"
|
|
866
|
-
}, /* @__PURE__ */ React6.createElement(NumericTabs, {
|
|
867
|
-
ref: tabsRef,
|
|
868
|
-
classNames: "p-1",
|
|
869
|
-
length: items.length,
|
|
870
|
-
selected,
|
|
871
|
-
onSelect: handleSelect
|
|
872
|
-
}), /* @__PURE__ */ React6.createElement(Json, {
|
|
873
|
-
data: items[selected]?.content,
|
|
874
|
-
classNames: "p-1 text-xs bg-transparent",
|
|
875
|
-
replacer: {
|
|
876
|
-
maxDepth: 3,
|
|
877
|
-
maxArrayLen: 10,
|
|
878
|
-
maxStringLen: 128
|
|
879
|
-
}
|
|
880
|
-
})));
|
|
881
|
-
};
|
|
882
|
-
|
|
883
|
-
// src/components/ChatThread/registry.tsx
|
|
884
|
-
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/ChatThread/registry.tsx";
|
|
885
|
-
var Fallback = ({ _tag, ...props }) => {
|
|
886
|
-
return /* @__PURE__ */ React7.createElement(ToggleContainer2.Root, {
|
|
887
|
-
classNames: "rounded-xs"
|
|
888
|
-
}, /* @__PURE__ */ React7.createElement(ToggleContainer2.Header, {
|
|
889
|
-
classNames: "bg-group-surface"
|
|
890
|
-
}, _tag), /* @__PURE__ */ React7.createElement(ToggleContainer2.Content, {
|
|
891
|
-
classNames: "bg-modal-surface"
|
|
892
|
-
}, /* @__PURE__ */ React7.createElement(Json2, {
|
|
893
|
-
classNames: "p-2! text-sm",
|
|
894
|
-
data: props
|
|
895
|
-
})));
|
|
896
|
-
};
|
|
897
|
-
var Summary = ({ text }) => {
|
|
898
|
-
return /* @__PURE__ */ React7.createElement(ToggleContainer2.Root, {
|
|
899
|
-
classNames: "rounded-sm"
|
|
900
|
-
}, /* @__PURE__ */ React7.createElement(ToggleContainer2.Header, {
|
|
901
|
-
classNames: "bg-group-surface"
|
|
902
|
-
}, "Conversation summarized"), /* @__PURE__ */ React7.createElement(ToggleContainer2.Content, {
|
|
903
|
-
classNames: "bg-modal-surface"
|
|
904
|
-
}, text));
|
|
905
|
-
};
|
|
906
|
-
var componentRegistry = {
|
|
907
|
-
//
|
|
908
|
-
// Widgets
|
|
909
|
-
//
|
|
910
|
-
prompt: {
|
|
911
|
-
block: true,
|
|
912
|
-
factory: ({ children }) => {
|
|
913
|
-
const text = getXmlTextChild(children);
|
|
914
|
-
return text ? new PromptWidget(text) : null;
|
|
915
|
-
}
|
|
916
|
-
},
|
|
917
|
-
reasoning: {
|
|
918
|
-
block: true,
|
|
919
|
-
factory: ({ children }) => {
|
|
920
|
-
const text = getXmlTextChild(children);
|
|
921
|
-
return text ? new ReasoningWidget(text) : null;
|
|
922
|
-
}
|
|
923
|
-
},
|
|
924
|
-
reference: {
|
|
925
|
-
block: false,
|
|
926
|
-
factory: ({ children, ref }) => {
|
|
927
|
-
const text = getXmlTextChild(children);
|
|
928
|
-
return text && ref ? new ReferenceWidget(text, ref) : null;
|
|
929
|
-
}
|
|
930
|
-
},
|
|
931
|
-
select: {
|
|
932
|
-
block: true,
|
|
933
|
-
factory: ({ children }) => {
|
|
934
|
-
const options = children?.map((option) => option._tag === "option" && getXmlTextChild(option.children)).filter(Boolean);
|
|
935
|
-
return options?.length ? new SelectWidget(options) : null;
|
|
936
|
-
}
|
|
937
|
-
},
|
|
938
|
-
suggestion: {
|
|
939
|
-
block: true,
|
|
940
|
-
factory: ({ children }) => {
|
|
941
|
-
const text = getXmlTextChild(children);
|
|
942
|
-
return text ? new SuggestionWidget(text) : null;
|
|
943
|
-
}
|
|
944
|
-
},
|
|
945
|
-
stats: {
|
|
946
|
-
block: true,
|
|
947
|
-
factory: ({ children }) => {
|
|
948
|
-
const text = getXmlTextChild(children);
|
|
949
|
-
return text ? new SummaryWidget(text) : null;
|
|
950
|
-
}
|
|
951
|
-
},
|
|
952
|
-
//
|
|
953
|
-
// React
|
|
954
|
-
//
|
|
955
|
-
toolCall: {
|
|
956
|
-
block: true,
|
|
957
|
-
Component: ToolBlock
|
|
958
|
-
},
|
|
959
|
-
toolResult: {
|
|
960
|
-
block: true,
|
|
961
|
-
Component: Fallback
|
|
962
|
-
},
|
|
963
|
-
toolkit: {
|
|
964
|
-
block: true,
|
|
965
|
-
Component: Fallback
|
|
966
|
-
},
|
|
967
|
-
summary: {
|
|
968
|
-
block: true,
|
|
969
|
-
Component: Summary
|
|
970
|
-
},
|
|
971
|
-
//
|
|
972
|
-
// Fallback
|
|
973
|
-
//
|
|
974
|
-
json: {
|
|
975
|
-
block: true,
|
|
976
|
-
Component: Fallback
|
|
977
|
-
}
|
|
978
|
-
};
|
|
979
|
-
var blockToMarkdown = (context, message, block) => {
|
|
980
|
-
let str = blockToMarkdownImpl(context, message, block);
|
|
981
|
-
if (str && !block.pending) {
|
|
982
|
-
return str += "\n";
|
|
983
|
-
}
|
|
984
|
-
return str;
|
|
985
|
-
};
|
|
986
|
-
var blockToMarkdownImpl = (context, message, block) => {
|
|
987
|
-
log2("blockToMarkdown", {
|
|
988
|
-
block: JSON.stringify(block)
|
|
989
|
-
}, {
|
|
990
|
-
F: __dxlog_file2,
|
|
991
|
-
L: 146,
|
|
992
|
-
S: void 0,
|
|
993
|
-
C: (f, a) => f(...a)
|
|
994
|
-
});
|
|
995
|
-
switch (block._tag) {
|
|
996
|
-
case "text": {
|
|
997
|
-
if (message.sender.role === "user") {
|
|
998
|
-
return `<prompt>${block.text}</prompt>`;
|
|
999
|
-
} else {
|
|
1000
|
-
const text = block.text.trim();
|
|
1001
|
-
if (text.length > 0) {
|
|
1002
|
-
return text;
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
break;
|
|
1006
|
-
}
|
|
1007
|
-
case "reference": {
|
|
1008
|
-
const dxn = block.reference.dxn;
|
|
1009
|
-
return `<reference ref="${dxn.toString()}">${context.getObjectLabel(dxn)}</reference>`;
|
|
1010
|
-
}
|
|
1011
|
-
case "suggestion": {
|
|
1012
|
-
if (block.pending) {
|
|
1013
|
-
return;
|
|
1014
|
-
}
|
|
1015
|
-
return `<suggestion>${block.text}</suggestion>`;
|
|
1016
|
-
}
|
|
1017
|
-
case "select": {
|
|
1018
|
-
if (block.pending || block.options.length === 0) {
|
|
1019
|
-
return;
|
|
1020
|
-
}
|
|
1021
|
-
return `<select>${block.options.map((option) => `<option>${option}</option>`).join("")}</select>`;
|
|
1022
|
-
}
|
|
1023
|
-
case "toolCall": {
|
|
1024
|
-
context.updateWidget(block.toolCallId, {
|
|
1025
|
-
blocks: [
|
|
1026
|
-
block
|
|
1027
|
-
]
|
|
1028
|
-
});
|
|
1029
|
-
return `<toolCall id="${block.toolCallId}" />`;
|
|
1030
|
-
}
|
|
1031
|
-
case "toolResult": {
|
|
1032
|
-
context.updateWidget(block.toolCallId, ({ blocks = [] } = {
|
|
1033
|
-
blocks: []
|
|
1034
|
-
}) => ({
|
|
1035
|
-
blocks: [
|
|
1036
|
-
...blocks,
|
|
1037
|
-
block
|
|
1038
|
-
]
|
|
1039
|
-
}));
|
|
1040
|
-
break;
|
|
1041
|
-
}
|
|
1042
|
-
case "stats": {
|
|
1043
|
-
return `<stats>${ContentBlock.createStatsMessage(block)}</stats>`;
|
|
1044
|
-
}
|
|
1045
|
-
case "reasoning": {
|
|
1046
|
-
const text = block.reasoningText ?? block.redactedText;
|
|
1047
|
-
if (!text) {
|
|
1048
|
-
return;
|
|
1049
|
-
}
|
|
1050
|
-
return `<reasoning>${text.replace(/\n/g, " ").trim()}</reasoning>`;
|
|
1051
|
-
}
|
|
1052
|
-
case "summary": {
|
|
1053
|
-
return `<summary>${block.content}</summary>`;
|
|
1054
|
-
}
|
|
1055
|
-
default: {
|
|
1056
|
-
return `<json id="${message.id}">
|
|
1057
|
-
${JSON.stringify(block)}
|
|
1058
|
-
</json>`;
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
};
|
|
1062
|
-
|
|
1063
|
-
// src/components/ChatThread/sync.ts
|
|
1064
|
-
import { log as log3 } from "@dxos/log";
|
|
1065
|
-
var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/ChatThread/sync.ts";
|
|
1066
|
-
var MessageThreadContext = class {
|
|
1067
|
-
_widgetState;
|
|
1068
|
-
constructor(_widgetState) {
|
|
1069
|
-
this._widgetState = _widgetState;
|
|
1070
|
-
}
|
|
1071
|
-
updateWidget(id, value) {
|
|
1072
|
-
this._widgetState?.updateWidget(id, value);
|
|
1073
|
-
}
|
|
1074
|
-
// TODO(burdon): Resolve from hypergraph.
|
|
1075
|
-
getObjectLabel(_id) {
|
|
1076
|
-
return "Object";
|
|
1077
|
-
}
|
|
1078
|
-
};
|
|
1079
|
-
var MessageSyncer = class {
|
|
1080
|
-
_model;
|
|
1081
|
-
_blockRenderer;
|
|
1082
|
-
_initialMessageId;
|
|
1083
|
-
_currentMessageIndex = 0;
|
|
1084
|
-
_currentBlockIndex = 0;
|
|
1085
|
-
_currentBlockContent;
|
|
1086
|
-
_context;
|
|
1087
|
-
constructor(_model, _blockRenderer) {
|
|
1088
|
-
this._model = _model;
|
|
1089
|
-
this._blockRenderer = _blockRenderer;
|
|
1090
|
-
this._context = new MessageThreadContext(this._model);
|
|
1091
|
-
}
|
|
1092
|
-
get context() {
|
|
1093
|
-
return this._context;
|
|
1094
|
-
}
|
|
1095
|
-
reset() {
|
|
1096
|
-
log3("reset", void 0, {
|
|
1097
|
-
F: __dxlog_file3,
|
|
1098
|
-
L: 64,
|
|
1099
|
-
S: this,
|
|
1100
|
-
C: (f, a) => f(...a)
|
|
1101
|
-
});
|
|
1102
|
-
this._initialMessageId = void 0;
|
|
1103
|
-
this._currentMessageIndex = 0;
|
|
1104
|
-
this._currentBlockIndex = 0;
|
|
1105
|
-
this._currentBlockContent = void 0;
|
|
1106
|
-
void this._model.reset("");
|
|
1107
|
-
}
|
|
1108
|
-
/**
|
|
1109
|
-
* Syncs messages with the editor.
|
|
1110
|
-
*/
|
|
1111
|
-
append(messages, flush = false) {
|
|
1112
|
-
messages = messages.map((message) => ({
|
|
1113
|
-
...message,
|
|
1114
|
-
blocks: message.blocks.filter((block) => !block.pending || block._tag === "text")
|
|
1115
|
-
}));
|
|
1116
|
-
if (this._initialMessageId !== messages[0]?.id) {
|
|
1117
|
-
this.reset();
|
|
1118
|
-
this._initialMessageId = messages[0]?.id;
|
|
1119
|
-
}
|
|
1120
|
-
if (flush && this._model.view?.state.doc.length === 0) {
|
|
1121
|
-
const buffer = [];
|
|
1122
|
-
this.process(messages, (content2) => {
|
|
1123
|
-
buffer.push(content2);
|
|
1124
|
-
});
|
|
1125
|
-
const content = buffer.join("");
|
|
1126
|
-
this._model.view?.dispatch({
|
|
1127
|
-
changes: [
|
|
1128
|
-
{
|
|
1129
|
-
from: 0,
|
|
1130
|
-
to: this._model.view?.state.doc.length ?? 0,
|
|
1131
|
-
insert: content
|
|
1132
|
-
}
|
|
1133
|
-
],
|
|
1134
|
-
selection: {
|
|
1135
|
-
anchor: content.length
|
|
1136
|
-
}
|
|
1137
|
-
});
|
|
1138
|
-
return true;
|
|
1139
|
-
} else {
|
|
1140
|
-
this.process(messages, (content) => {
|
|
1141
|
-
void this._model.append(content);
|
|
1142
|
-
});
|
|
1143
|
-
return false;
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
process(messages, append) {
|
|
1147
|
-
let i = this._currentMessageIndex;
|
|
1148
|
-
for (const message of messages.slice(this._currentMessageIndex)) {
|
|
1149
|
-
if (i > this._currentMessageIndex) {
|
|
1150
|
-
this._currentBlockIndex = 0;
|
|
1151
|
-
}
|
|
1152
|
-
this._currentMessageIndex = i;
|
|
1153
|
-
let j = this._currentBlockIndex;
|
|
1154
|
-
for (const block of message.blocks.slice(this._currentBlockIndex)) {
|
|
1155
|
-
this._currentBlockIndex = j;
|
|
1156
|
-
const currentBlockContent = this._blockRenderer(this._context, message, block);
|
|
1157
|
-
if (currentBlockContent) {
|
|
1158
|
-
let content = "";
|
|
1159
|
-
if (this._currentBlockContent && currentBlockContent.startsWith(this._currentBlockContent)) {
|
|
1160
|
-
content = currentBlockContent.slice(this._currentBlockContent.length);
|
|
1161
|
-
} else {
|
|
1162
|
-
content = currentBlockContent;
|
|
1163
|
-
}
|
|
1164
|
-
this._currentBlockContent = currentBlockContent;
|
|
1165
|
-
append(content);
|
|
1166
|
-
}
|
|
1167
|
-
if (block.pending) {
|
|
1168
|
-
return;
|
|
1169
|
-
} else {
|
|
1170
|
-
this._currentBlockContent = void 0;
|
|
1171
|
-
this._currentBlockIndex++;
|
|
1172
|
-
}
|
|
1173
|
-
j++;
|
|
1174
|
-
}
|
|
1175
|
-
i++;
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
};
|
|
1179
|
-
|
|
1180
|
-
// src/components/ChatThread/ChatThread.tsx
|
|
1181
|
-
var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages = [], error, cursor = false, fadeIn = true, debug = false, onEvent }, forwardedRef) => {
|
|
1182
|
-
const controllerRef = useForwardedRef(forwardedRef);
|
|
1183
|
-
const [controller, setController] = useState11(null);
|
|
1184
|
-
const refCallback = useCallback6((node) => {
|
|
1185
|
-
controllerRef.current = node;
|
|
1186
|
-
setController(node);
|
|
1187
|
-
}, [
|
|
1188
|
-
controllerRef
|
|
1189
|
-
]);
|
|
1190
|
-
const userHue = useMemo8(() => identity?.profile?.data?.hue || keyToFallback(identity?.identityKey ?? PublicKey.random()).hue, [
|
|
1191
|
-
identity
|
|
1192
|
-
]);
|
|
1193
|
-
useEffect6(() => {
|
|
1194
|
-
controller?.scrollToBottom();
|
|
1195
|
-
}, [
|
|
1196
|
-
controller,
|
|
1197
|
-
error
|
|
1198
|
-
]);
|
|
1199
|
-
const syncer = useMemo8(() => controller && new MessageSyncer(controller, blockToMarkdown), [
|
|
1200
|
-
controller
|
|
1201
|
-
]);
|
|
1202
|
-
useEffect6(() => {
|
|
1203
|
-
const reset = syncer?.append(messages, true);
|
|
1204
|
-
if (reset) {
|
|
1205
|
-
controller?.scrollToBottom("instant");
|
|
1206
|
-
}
|
|
1207
|
-
}, [
|
|
1208
|
-
syncer,
|
|
1209
|
-
messages
|
|
1210
|
-
]);
|
|
1211
|
-
const handleEvent = useCallback6(({ type, value }) => {
|
|
1212
|
-
switch (type) {
|
|
1213
|
-
case "submit": {
|
|
1214
|
-
value && onEvent?.({
|
|
1215
|
-
type,
|
|
1216
|
-
text: value
|
|
1217
|
-
});
|
|
1218
|
-
break;
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
}, [
|
|
1222
|
-
onEvent
|
|
1223
|
-
]);
|
|
1224
|
-
return /* @__PURE__ */ React8.createElement("div", {
|
|
1225
|
-
role: "none",
|
|
1226
|
-
className: mx5("flex h-full w-full justify-center overflow-hidden", classNames),
|
|
1227
|
-
style: {
|
|
1228
|
-
"--user-fill": `var(--color-${userHue}-fill)`
|
|
1229
|
-
}
|
|
1230
|
-
}, /* @__PURE__ */ React8.createElement(MarkdownStream, {
|
|
1231
|
-
ref: refCallback,
|
|
1232
|
-
registry: componentRegistry,
|
|
1233
|
-
cursor,
|
|
1234
|
-
fadeIn,
|
|
1235
|
-
debug,
|
|
1236
|
-
onEvent: handleEvent
|
|
1237
|
-
}));
|
|
1238
|
-
});
|
|
1239
|
-
|
|
1240
|
-
// src/components/Chat/Chat.tsx
|
|
1241
|
-
var [ChatContextProvider, useChatContext] = createContext("Chat");
|
|
1242
|
-
var ChatRoot = ({ children, chat, processor, onEvent, ...props }) => {
|
|
1243
|
-
const [debug, setDebug] = useState12(false);
|
|
1244
|
-
const pending = useAtomValue(processor.messages);
|
|
1245
|
-
const streaming = useAtomValue(processor.streaming);
|
|
1246
|
-
const lastPrompt = useRef3(void 0);
|
|
1247
|
-
const storedMessages = useQuery3(chat?.queue?.target, Filter4.type(Message.Message));
|
|
1248
|
-
const messages = useMemo9(() => {
|
|
1249
|
-
return Array2.dedupeWith([
|
|
1250
|
-
...storedMessages,
|
|
1251
|
-
...pending
|
|
1252
|
-
], ({ id: a }, { id: b }) => a === b);
|
|
1253
|
-
}, [
|
|
1254
|
-
storedMessages,
|
|
1255
|
-
pending
|
|
1256
|
-
]);
|
|
1257
|
-
const event = useMemo9(() => new Event(), []);
|
|
1258
|
-
useEffect7(() => {
|
|
1259
|
-
return event.on((ev) => {
|
|
1260
|
-
switch (ev.type) {
|
|
1261
|
-
case "toggle-debug": {
|
|
1262
|
-
setDebug((debug2) => !debug2);
|
|
1263
|
-
queueMicrotask(async () => {
|
|
1264
|
-
const objects = processor.context.getObjects();
|
|
1265
|
-
const blueprints = processor.context.getBlueprints();
|
|
1266
|
-
const tools = await processor.getTools();
|
|
1267
|
-
const system = await processor.getSystemPrompt();
|
|
1268
|
-
console.log("Chat processor state:", {
|
|
1269
|
-
objects,
|
|
1270
|
-
blueprints
|
|
1271
|
-
});
|
|
1272
|
-
console.log(`
|
|
1273
|
-
==== System Prompt ====
|
|
1274
|
-
${system}
|
|
1275
|
-
==== Tools ====
|
|
1276
|
-
${Object.values(tools).map((tool) => JSON.stringify(tool, null, 2)).join("\n")}
|
|
1277
|
-
`);
|
|
1278
|
-
});
|
|
1279
|
-
break;
|
|
1280
|
-
}
|
|
1281
|
-
case "submit": {
|
|
1282
|
-
const text = ev.text.trim();
|
|
1283
|
-
if (!streaming && text.length) {
|
|
1284
|
-
lastPrompt.current = ev.text;
|
|
1285
|
-
void processor.request({
|
|
1286
|
-
message: text
|
|
1287
|
-
});
|
|
1288
|
-
}
|
|
1289
|
-
break;
|
|
1290
|
-
}
|
|
1291
|
-
case "retry": {
|
|
1292
|
-
if (!streaming) {
|
|
1293
|
-
void processor.retry();
|
|
1294
|
-
}
|
|
1295
|
-
break;
|
|
1296
|
-
}
|
|
1297
|
-
case "cancel": {
|
|
1298
|
-
if (streaming) {
|
|
1299
|
-
void processor.cancel();
|
|
1300
|
-
if (lastPrompt.current) {
|
|
1301
|
-
event.emit({
|
|
1302
|
-
type: "update-prompt",
|
|
1303
|
-
text: lastPrompt.current
|
|
1304
|
-
});
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
break;
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
onEvent?.(ev);
|
|
1311
|
-
});
|
|
1312
|
-
}, [
|
|
1313
|
-
event,
|
|
1314
|
-
processor,
|
|
1315
|
-
streaming,
|
|
1316
|
-
onEvent
|
|
1317
|
-
]);
|
|
1318
|
-
const db = props.db ?? (chat && Obj5.getDatabase(chat));
|
|
1319
|
-
return /* @__PURE__ */ React9.createElement(ChatContextProvider, {
|
|
1320
|
-
debug,
|
|
1321
|
-
event,
|
|
1322
|
-
db,
|
|
1323
|
-
chat,
|
|
1324
|
-
messages,
|
|
1325
|
-
processor,
|
|
1326
|
-
...props
|
|
1327
|
-
}, children);
|
|
1328
|
-
};
|
|
1329
|
-
ChatRoot.displayName = "Chat.Root";
|
|
1330
|
-
var CHAT_VIEWPORT_NAME = "Chat.Viewport";
|
|
1331
|
-
var ChatViewport = ({ classNames, children, ...props }) => {
|
|
1332
|
-
return /* @__PURE__ */ React9.createElement("div", {
|
|
1333
|
-
role: "none",
|
|
1334
|
-
...props,
|
|
1335
|
-
className: mx6("flex flex-col h-full w-full", classNames)
|
|
1336
|
-
}, children);
|
|
1337
|
-
};
|
|
1338
|
-
ChatViewport.displayName = CHAT_VIEWPORT_NAME;
|
|
1339
|
-
var CHAT_THREAD_NAME = "Chat.Thread";
|
|
1340
|
-
var ChatThread2 = (props) => {
|
|
1341
|
-
const { debug, event, messages, processor } = useChatContext(CHAT_THREAD_NAME);
|
|
1342
|
-
const identity = useIdentity();
|
|
1343
|
-
const error = useAtomValue(processor.error).pipe(Option4.getOrUndefined);
|
|
1344
|
-
const controllerRef = useRef3(null);
|
|
1345
|
-
useEffect7(() => {
|
|
1346
|
-
return event.on((event2) => {
|
|
1347
|
-
switch (event2.type) {
|
|
1348
|
-
case "submit":
|
|
1349
|
-
case "scroll-to-bottom":
|
|
1350
|
-
controllerRef.current?.scrollToBottom();
|
|
1351
|
-
break;
|
|
1352
|
-
case "nav-previous":
|
|
1353
|
-
controllerRef.current?.navigatePrevious();
|
|
1354
|
-
break;
|
|
1355
|
-
case "nav-next":
|
|
1356
|
-
controllerRef.current?.navigateNext();
|
|
1357
|
-
break;
|
|
1358
|
-
}
|
|
1359
|
-
});
|
|
1360
|
-
}, [
|
|
1361
|
-
event
|
|
1362
|
-
]);
|
|
1363
|
-
const handleEvent = useCallback7((ev) => {
|
|
1364
|
-
event.emit(ev);
|
|
1365
|
-
}, [
|
|
1366
|
-
event
|
|
1367
|
-
]);
|
|
1368
|
-
if (!identity) {
|
|
1369
|
-
return null;
|
|
1370
|
-
}
|
|
1371
|
-
return /* @__PURE__ */ React9.createElement(ChatThread, {
|
|
1372
|
-
...props,
|
|
1373
|
-
identity,
|
|
1374
|
-
messages,
|
|
1375
|
-
error,
|
|
1376
|
-
debug,
|
|
1377
|
-
onEvent: handleEvent,
|
|
1378
|
-
ref: controllerRef
|
|
1379
|
-
});
|
|
1380
|
-
};
|
|
1381
|
-
ChatThread2.displayName = CHAT_THREAD_NAME;
|
|
1382
|
-
var CHAT_PROMPT_NAME = "Chat.Prompt";
|
|
1383
|
-
var ChatPrompt = ({ classNames, outline, settings = true, placeholder, expandable, online, presets, preset, onPresetChange, onOnlineChange }) => {
|
|
1384
|
-
const { t } = useTranslation5(meta.id);
|
|
1385
|
-
const { db, processor, event } = useChatContext(CHAT_PROMPT_NAME);
|
|
1386
|
-
const error = useAtomValue(processor.error).pipe(Option4.getOrUndefined);
|
|
1387
|
-
const streaming = useAtomValue(processor.streaming);
|
|
1388
|
-
const active = useAtomValue(processor.active);
|
|
1389
|
-
const activeRef = useDynamicRef(active);
|
|
1390
|
-
const editorRef = useRef3(null);
|
|
1391
|
-
const [recordingState, setRecordingState] = useState12(false);
|
|
1392
|
-
useEffect7(() => {
|
|
1393
|
-
return event.on((event2) => {
|
|
1394
|
-
switch (event2.type) {
|
|
1395
|
-
case "update-prompt":
|
|
1396
|
-
if (!editorRef.current?.getText()?.length) {
|
|
1397
|
-
editorRef.current?.setText(event2.text);
|
|
1398
|
-
editorRef.current?.focus();
|
|
1399
|
-
}
|
|
1400
|
-
break;
|
|
1401
|
-
case "record-start":
|
|
1402
|
-
setRecordingState(true);
|
|
1403
|
-
break;
|
|
1404
|
-
case "record-stop":
|
|
1405
|
-
setRecordingState(false);
|
|
1406
|
-
break;
|
|
1407
|
-
}
|
|
1408
|
-
});
|
|
1409
|
-
}, [
|
|
1410
|
-
event
|
|
1411
|
-
]);
|
|
1412
|
-
const { recording } = useVoiceInput({
|
|
1413
|
-
active: recordingState,
|
|
1414
|
-
onUpdate: (text) => {
|
|
1415
|
-
editorRef.current?.setText(text);
|
|
1416
|
-
editorRef.current?.focus();
|
|
1417
|
-
}
|
|
1418
|
-
});
|
|
1419
|
-
const extensions = useMemo9(() => {
|
|
1420
|
-
return [
|
|
1421
|
-
Prec.highest(keymap.of([
|
|
1422
|
-
{
|
|
1423
|
-
key: "Mod-d",
|
|
1424
|
-
preventDefault: true,
|
|
1425
|
-
run: () => {
|
|
1426
|
-
event.emit({
|
|
1427
|
-
type: "toggle-debug"
|
|
1428
|
-
});
|
|
1429
|
-
return true;
|
|
1430
|
-
}
|
|
1431
|
-
},
|
|
1432
|
-
{
|
|
1433
|
-
key: "Mod-ArrowUp",
|
|
1434
|
-
preventDefault: true,
|
|
1435
|
-
run: () => {
|
|
1436
|
-
event.emit({
|
|
1437
|
-
type: "nav-previous"
|
|
1438
|
-
});
|
|
1439
|
-
return true;
|
|
1440
|
-
},
|
|
1441
|
-
shift: () => {
|
|
1442
|
-
event.emit({
|
|
1443
|
-
type: "thread-open"
|
|
1444
|
-
});
|
|
1445
|
-
return true;
|
|
1446
|
-
}
|
|
1447
|
-
},
|
|
1448
|
-
{
|
|
1449
|
-
key: "Mod-ArrowDown",
|
|
1450
|
-
preventDefault: true,
|
|
1451
|
-
run: () => {
|
|
1452
|
-
event.emit({
|
|
1453
|
-
type: "nav-next"
|
|
1454
|
-
});
|
|
1455
|
-
return true;
|
|
1456
|
-
},
|
|
1457
|
-
shift: () => {
|
|
1458
|
-
event.emit({
|
|
1459
|
-
type: "thread-close"
|
|
1460
|
-
});
|
|
1461
|
-
return true;
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
]))
|
|
1465
|
-
].filter(isTruthy);
|
|
1466
|
-
}, [
|
|
1467
|
-
event,
|
|
1468
|
-
expandable
|
|
1469
|
-
]);
|
|
1470
|
-
const handleSubmit = useCallback7((text) => {
|
|
1471
|
-
if (!activeRef.current) {
|
|
1472
|
-
event.emit({
|
|
1473
|
-
type: "submit",
|
|
1474
|
-
text
|
|
1475
|
-
});
|
|
1476
|
-
return true;
|
|
1477
|
-
}
|
|
1478
|
-
}, [
|
|
1479
|
-
event
|
|
1480
|
-
]);
|
|
1481
|
-
const handleEvent = useCallback7((ev) => {
|
|
1482
|
-
event.emit(ev);
|
|
1483
|
-
}, [
|
|
1484
|
-
event
|
|
1485
|
-
]);
|
|
1486
|
-
return /* @__PURE__ */ React9.createElement("div", {
|
|
1487
|
-
role: "group",
|
|
1488
|
-
className: mx6("flex flex-col w-full dx-density-fine", outline && "bg-group-surface border border-subdued-separator transition transition-border [&:has(.cm-content:focus)]:border-separator rounded-sm", classNames)
|
|
1489
|
-
}, /* @__PURE__ */ React9.createElement("div", {
|
|
1490
|
-
role: "none",
|
|
1491
|
-
className: "flex p-2 gap-2"
|
|
1492
|
-
}, /* @__PURE__ */ React9.createElement(ChatStatusIndicator, {
|
|
1493
|
-
classNames: "p-1",
|
|
1494
|
-
preset,
|
|
1495
|
-
error,
|
|
1496
|
-
processing: streaming
|
|
1497
|
-
}), /* @__PURE__ */ React9.createElement(ChatEditor, {
|
|
1498
|
-
ref: editorRef,
|
|
1499
|
-
autoFocus: true,
|
|
1500
|
-
lineWrapping: true,
|
|
1501
|
-
classNames: "col-span-2 pt-0.5",
|
|
1502
|
-
placeholder: placeholder ?? t("prompt placeholder"),
|
|
1503
|
-
extensions,
|
|
1504
|
-
onSubmit: handleSubmit
|
|
1505
|
-
})), db && settings && /* @__PURE__ */ React9.createElement("div", {
|
|
1506
|
-
role: "none",
|
|
1507
|
-
className: "flex items-center overflow-hidden"
|
|
1508
|
-
}, /* @__PURE__ */ React9.createElement(ChatOptions, {
|
|
1509
|
-
db,
|
|
1510
|
-
blueprintRegistry: processor.blueprintRegistry,
|
|
1511
|
-
context: processor.context,
|
|
1512
|
-
preset,
|
|
1513
|
-
presets,
|
|
1514
|
-
onPresetChange
|
|
1515
|
-
}), /* @__PURE__ */ React9.createElement("div", {
|
|
1516
|
-
role: "none",
|
|
1517
|
-
className: "flex grow overflow-x-auto scrollbar-none"
|
|
1518
|
-
}, /* @__PURE__ */ React9.createElement(ChatReferences, {
|
|
1519
|
-
db,
|
|
1520
|
-
context: processor.context
|
|
1521
|
-
})), /* @__PURE__ */ React9.createElement(ChatActions, {
|
|
1522
|
-
classNames: "col-span-2",
|
|
1523
|
-
microphone: true,
|
|
1524
|
-
recording,
|
|
1525
|
-
processing: streaming,
|
|
1526
|
-
onEvent: handleEvent
|
|
1527
|
-
}, online !== void 0 && /* @__PURE__ */ React9.createElement(Input.Root, null, /* @__PURE__ */ React9.createElement(Input.Label, {
|
|
1528
|
-
srOnly: true
|
|
1529
|
-
}, t("online switch label")), /* @__PURE__ */ React9.createElement(Input.Switch, {
|
|
1530
|
-
classNames: "mx-2",
|
|
1531
|
-
checked: online,
|
|
1532
|
-
onCheckedChange: onOnlineChange
|
|
1533
|
-
})))));
|
|
1534
|
-
};
|
|
1535
|
-
ChatPrompt.displayName = CHAT_PROMPT_NAME;
|
|
1536
|
-
var CHAT_TOOLBAR_NAME = "Chat.Toolbar";
|
|
1537
|
-
var ChatToolbar = ({ classNames, companionTo, ...props }) => {
|
|
1538
|
-
const { chat } = useChatContext(CHAT_TOOLBAR_NAME);
|
|
1539
|
-
const menu = useChatToolbarActions({
|
|
1540
|
-
chat,
|
|
1541
|
-
companionTo
|
|
1542
|
-
});
|
|
1543
|
-
return /* @__PURE__ */ React9.createElement(Menu.Root, {
|
|
1544
|
-
...props,
|
|
1545
|
-
...menu,
|
|
1546
|
-
attendableId: companionTo ? Obj5.getDXN(companionTo).toString() : chat ? Obj5.getDXN(chat).toString() : ""
|
|
1547
|
-
}, /* @__PURE__ */ React9.createElement(Menu.Toolbar, {
|
|
1548
|
-
classNames,
|
|
1549
|
-
textBlockWidth: true
|
|
1550
|
-
}));
|
|
1551
|
-
};
|
|
1552
|
-
ChatToolbar.displayName = CHAT_TOOLBAR_NAME;
|
|
1553
|
-
var Chat = {
|
|
1554
|
-
Root: ChatRoot,
|
|
1555
|
-
Viewport: ChatViewport,
|
|
1556
|
-
Thread: ChatThread2,
|
|
1557
|
-
Prompt: ChatPrompt,
|
|
1558
|
-
Toolbar: ChatToolbar
|
|
1559
|
-
};
|
|
1560
|
-
|
|
1561
|
-
// src/components/TemplateEditor/TemplateEditor.tsx
|
|
1562
|
-
import { defaultHighlightStyle, syntaxHighlighting } from "@codemirror/language";
|
|
1563
|
-
import React10 from "react";
|
|
1564
|
-
import { createDocAccessor } from "@dxos/echo-db";
|
|
1565
|
-
import { useThemeContext, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
1566
|
-
import { useTextEditor } from "@dxos/react-ui-editor";
|
|
1567
|
-
import { createBasicExtensions, createDataExtensions, createMarkdownExtensions, createThemeExtensions, decorateMarkdown } from "@dxos/ui-editor";
|
|
1568
|
-
import { mx as mx8 } from "@dxos/ui-theme";
|
|
1569
|
-
import { isNonNullable as isNonNullable2 } from "@dxos/util";
|
|
1570
|
-
|
|
1571
|
-
// src/components/TemplateEditor/extensions/handlebars-extension.ts
|
|
1572
|
-
import { autocompletion, completionKeymap } from "@codemirror/autocomplete";
|
|
1573
|
-
import { RangeSetBuilder } from "@codemirror/state";
|
|
1574
|
-
import { Decoration, ViewPlugin, WidgetType, keymap as keymap2 } from "@codemirror/view";
|
|
1575
|
-
import { Domino, mx as mx7 } from "@dxos/ui";
|
|
1576
|
-
var handlebars = (_ = {}) => {
|
|
1577
|
-
return [
|
|
1578
|
-
handlebarsHighlightPlugin,
|
|
1579
|
-
autocompletion({
|
|
1580
|
-
activateOnTyping: true,
|
|
1581
|
-
aboveCursor: true,
|
|
1582
|
-
closeOnBlur: true,
|
|
1583
|
-
override: [
|
|
1584
|
-
handlebarsCompletions
|
|
1585
|
-
]
|
|
1586
|
-
}),
|
|
1587
|
-
keymap2.of(completionKeymap)
|
|
1588
|
-
];
|
|
1589
|
-
};
|
|
1590
|
-
var regex = {
|
|
1591
|
-
// {{! comment }}
|
|
1592
|
-
comment: /\{\{!\s*[^}]*\}\}/g,
|
|
1593
|
-
// {{var}}
|
|
1594
|
-
brackets: /\{\{[^}]*\}\}/g,
|
|
1595
|
-
// {{#command}} {{/command}}
|
|
1596
|
-
command: /\{\{[#/]([^}]+)\}\}/g,
|
|
1597
|
-
// {{var}}
|
|
1598
|
-
var: /\{\{(?!\s*!)(\w[^}]*)\}\}/g,
|
|
1599
|
-
// @dxn:queue:data:xxx
|
|
1600
|
-
dxn: /@?dxn:[\w@:]+/g,
|
|
1601
|
-
// dxos.org/type/xxx
|
|
1602
|
-
url: /[\w.-]+\.[\w.-]+\/[\w/]+/g
|
|
1603
|
-
};
|
|
1604
|
-
var tagPadding = "mx-0.5 px-1 rounded-xs";
|
|
1605
|
-
var handlebarsHighlightPlugin = ViewPlugin.fromClass(class {
|
|
1606
|
-
decorations;
|
|
1607
|
-
constructor(view) {
|
|
1608
|
-
this.decorations = this.buildDecorations(view);
|
|
1609
|
-
}
|
|
1610
|
-
update(update) {
|
|
1611
|
-
if (update.docChanged || update.viewportChanged || update.selectionSet) {
|
|
1612
|
-
this.decorations = this.buildDecorations(update.view);
|
|
1613
|
-
}
|
|
1614
|
-
}
|
|
1615
|
-
// NOTE: Decorations may clash with other extensions (e.g., markdown).
|
|
1616
|
-
buildDecorations(view) {
|
|
1617
|
-
const selection = view.state.selection.main;
|
|
1618
|
-
const decorations = [];
|
|
1619
|
-
for (const { from, to } of view.visibleRanges) {
|
|
1620
|
-
const text = view.state.doc.sliceString(from, to);
|
|
1621
|
-
{
|
|
1622
|
-
let match;
|
|
1623
|
-
while ((match = regex.dxn.exec(text)) !== null) {
|
|
1624
|
-
const start = from + match.index;
|
|
1625
|
-
const end = start + match[0].length;
|
|
1626
|
-
const overlaps = selection.to > start && selection.from <= end;
|
|
1627
|
-
if (!overlaps) {
|
|
1628
|
-
decorations.push({
|
|
1629
|
-
from: start,
|
|
1630
|
-
to: end,
|
|
1631
|
-
decoration: Decoration.widget({
|
|
1632
|
-
widget: new DXNWidget(match[0])
|
|
1633
|
-
})
|
|
1634
|
-
});
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1637
|
-
}
|
|
1638
|
-
{
|
|
1639
|
-
let match;
|
|
1640
|
-
while ((match = regex.url.exec(text)) !== null) {
|
|
1641
|
-
const start = from + match.index;
|
|
1642
|
-
const end = start + match[0].length;
|
|
1643
|
-
decorations.push({
|
|
1644
|
-
from: start,
|
|
1645
|
-
to: end,
|
|
1646
|
-
decoration: Decoration.mark({
|
|
1647
|
-
class: mx7("dx-tag--blue", tagPadding)
|
|
1648
|
-
})
|
|
1649
|
-
});
|
|
1650
|
-
}
|
|
1651
|
-
}
|
|
1652
|
-
{
|
|
1653
|
-
let match;
|
|
1654
|
-
while ((match = regex.brackets.exec(text)) !== null) {
|
|
1655
|
-
const start = from + match.index;
|
|
1656
|
-
const end = start + match[0].length;
|
|
1657
|
-
decorations.push({
|
|
1658
|
-
from: start,
|
|
1659
|
-
to: end,
|
|
1660
|
-
decoration: Decoration.mark({
|
|
1661
|
-
class: "text-subdued"
|
|
1662
|
-
})
|
|
1663
|
-
});
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
{
|
|
1667
|
-
let match;
|
|
1668
|
-
while ((match = regex.command.exec(text)) !== null) {
|
|
1669
|
-
const start = from + match.index + 2;
|
|
1670
|
-
let end = start + match[0].length - 4;
|
|
1671
|
-
const text2 = view.state.doc.sliceString(start, end);
|
|
1672
|
-
const parts = text2.split(/\s+/);
|
|
1673
|
-
if (parts.length > 1) {
|
|
1674
|
-
const idx = start + parts[0].length;
|
|
1675
|
-
decorations.push({
|
|
1676
|
-
from: idx,
|
|
1677
|
-
to: end,
|
|
1678
|
-
decoration: Decoration.mark({
|
|
1679
|
-
class: "text-green-text"
|
|
1680
|
-
})
|
|
1681
|
-
});
|
|
1682
|
-
end = idx;
|
|
1683
|
-
}
|
|
1684
|
-
decorations.push({
|
|
1685
|
-
from: start,
|
|
1686
|
-
to: end,
|
|
1687
|
-
decoration: Decoration.mark({
|
|
1688
|
-
class: "text-blue-text"
|
|
1689
|
-
})
|
|
1690
|
-
});
|
|
1691
|
-
}
|
|
1692
|
-
}
|
|
1693
|
-
{
|
|
1694
|
-
let match;
|
|
1695
|
-
while ((match = regex.var.exec(text)) !== null) {
|
|
1696
|
-
const start = from + match.index + 2;
|
|
1697
|
-
const end = start + match[0].length - 4;
|
|
1698
|
-
decorations.push({
|
|
1699
|
-
from: start,
|
|
1700
|
-
to: end,
|
|
1701
|
-
decoration: Decoration.mark({
|
|
1702
|
-
class: "text-green-text"
|
|
1703
|
-
})
|
|
1704
|
-
});
|
|
1705
|
-
}
|
|
1706
|
-
}
|
|
1707
|
-
}
|
|
1708
|
-
decorations.sort((a, b) => a.from - b.from || a.to - b.to);
|
|
1709
|
-
const builder = new RangeSetBuilder();
|
|
1710
|
-
for (const { from, to, decoration } of decorations) {
|
|
1711
|
-
builder.add(from, to, decoration);
|
|
1712
|
-
}
|
|
1713
|
-
return builder.finish();
|
|
1714
|
-
}
|
|
1715
|
-
}, {
|
|
1716
|
-
decorations: (v) => v.decorations
|
|
1717
|
-
});
|
|
1718
|
-
var DXNWidget = class extends WidgetType {
|
|
1719
|
-
_identifier;
|
|
1720
|
-
constructor(_identifier) {
|
|
1721
|
-
super(), this._identifier = _identifier;
|
|
1722
|
-
}
|
|
1723
|
-
ignoreEvent() {
|
|
1724
|
-
return false;
|
|
1725
|
-
}
|
|
1726
|
-
eq(other) {
|
|
1727
|
-
return this._identifier === other._identifier;
|
|
1728
|
-
}
|
|
1729
|
-
toDOM() {
|
|
1730
|
-
const text = this._identifier.split(":").map((part) => {
|
|
1731
|
-
const len = 16;
|
|
1732
|
-
const plen = 4;
|
|
1733
|
-
if (part.length > len) {
|
|
1734
|
-
return `[${part.slice(0, plen)}\u2026${part.slice(-plen)}]`;
|
|
1735
|
-
}
|
|
1736
|
-
return part;
|
|
1737
|
-
}).join(":");
|
|
1738
|
-
return Domino.of("span").classNames(mx7("font-mono dx-tag--blue", tagPadding)).text(text).root;
|
|
1739
|
-
}
|
|
1740
|
-
};
|
|
1741
|
-
var variables = [
|
|
1742
|
-
"this"
|
|
1743
|
-
];
|
|
1744
|
-
var commands = [
|
|
1745
|
-
"this",
|
|
1746
|
-
"each",
|
|
1747
|
-
"if",
|
|
1748
|
-
"unless",
|
|
1749
|
-
"with"
|
|
1750
|
-
];
|
|
1751
|
-
function handlebarsCompletions(context) {
|
|
1752
|
-
const match = context.matchBefore(/\{\{[^}]*/);
|
|
1753
|
-
if (!match || match.from === match.to) {
|
|
1754
|
-
return null;
|
|
1755
|
-
}
|
|
1756
|
-
let type = "variable";
|
|
1757
|
-
let text = match.text.slice(2);
|
|
1758
|
-
let from = match.from + 2;
|
|
1759
|
-
let matches = [];
|
|
1760
|
-
if (text.startsWith("#") || text.startsWith("/")) {
|
|
1761
|
-
const idx = text.lastIndexOf(" ");
|
|
1762
|
-
if (idx !== -1) {
|
|
1763
|
-
type = "variable";
|
|
1764
|
-
matches = variables;
|
|
1765
|
-
text = text.slice(idx + 1);
|
|
1766
|
-
from += idx + 1;
|
|
1767
|
-
} else {
|
|
1768
|
-
type = "command";
|
|
1769
|
-
text = text.slice(1);
|
|
1770
|
-
matches = commands;
|
|
1771
|
-
from += 1;
|
|
1772
|
-
}
|
|
1773
|
-
} else {
|
|
1774
|
-
type = "variable";
|
|
1775
|
-
matches = variables;
|
|
1776
|
-
}
|
|
1777
|
-
const options = matches.filter((name) => name.startsWith(text)).map((name) => ({
|
|
1778
|
-
type,
|
|
1779
|
-
label: name
|
|
1780
|
-
}));
|
|
1781
|
-
return {
|
|
1782
|
-
from,
|
|
1783
|
-
options
|
|
1784
|
-
};
|
|
1785
|
-
}
|
|
1786
|
-
|
|
1787
|
-
// src/components/TemplateEditor/extensions/xml-extension.ts
|
|
1788
|
-
import { syntaxTree } from "@codemirror/language";
|
|
1789
|
-
import { RangeSetBuilder as RangeSetBuilder2 } from "@codemirror/state";
|
|
1790
|
-
import { Decoration as Decoration2, ViewPlugin as ViewPlugin2 } from "@codemirror/view";
|
|
1791
|
-
var xmlDecorator = (_ = {}) => {
|
|
1792
|
-
return [
|
|
1793
|
-
xmlDecoratorPlugin
|
|
1794
|
-
];
|
|
1795
|
-
};
|
|
1796
|
-
var xmlDecoratorPlugin = ViewPlugin2.fromClass(class {
|
|
1797
|
-
decorations;
|
|
1798
|
-
constructor(view) {
|
|
1799
|
-
this.decorations = this.buildDecorations(view);
|
|
1800
|
-
}
|
|
1801
|
-
update(update) {
|
|
1802
|
-
if (update.docChanged || update.viewportChanged) {
|
|
1803
|
-
this.decorations = this.buildDecorations(update.view);
|
|
1804
|
-
}
|
|
1805
|
-
}
|
|
1806
|
-
buildDecorations(view) {
|
|
1807
|
-
const builder = new RangeSetBuilder2();
|
|
1808
|
-
for (const { from, to } of view.visibleRanges) {
|
|
1809
|
-
syntaxTree(view.state).iterate({
|
|
1810
|
-
from,
|
|
1811
|
-
to,
|
|
1812
|
-
enter: (node) => {
|
|
1813
|
-
if (node.name === "HTMLTag" || node.name === "OpenTag" || node.name === "CloseTag" || node.name === "SelfClosingTag" || node.name === "Element") {
|
|
1814
|
-
builder.add(node.from, node.to, Decoration2.mark({
|
|
1815
|
-
class: "font-mono text-subdued"
|
|
1816
|
-
}));
|
|
1817
|
-
}
|
|
1818
|
-
}
|
|
1819
|
-
});
|
|
1820
|
-
}
|
|
1821
|
-
return builder.finish();
|
|
1822
|
-
}
|
|
1823
|
-
}, {
|
|
1824
|
-
decorations: (v) => v.decorations
|
|
1825
|
-
});
|
|
1826
|
-
|
|
1827
|
-
// src/components/TemplateEditor/TemplateEditor.tsx
|
|
1828
|
-
var TemplateEditor = ({ id, classNames, template, lineNumbers = true }) => {
|
|
1829
|
-
const { t } = useTranslation6(meta.id);
|
|
1830
|
-
const { themeMode } = useThemeContext();
|
|
1831
|
-
const { parentRef } = useTextEditor(() => {
|
|
1832
|
-
const text = template.source?.target;
|
|
1833
|
-
if (!text) {
|
|
1834
|
-
return {};
|
|
1835
|
-
}
|
|
1836
|
-
return {
|
|
1837
|
-
initialValue: text.content ?? "",
|
|
1838
|
-
extensions: [
|
|
1839
|
-
createDataExtensions({
|
|
1840
|
-
id,
|
|
1841
|
-
text: createDocAccessor(text, [
|
|
1842
|
-
"content"
|
|
1843
|
-
])
|
|
1844
|
-
}),
|
|
1845
|
-
createBasicExtensions({
|
|
1846
|
-
bracketMatching: false,
|
|
1847
|
-
lineNumbers,
|
|
1848
|
-
lineWrapping: true,
|
|
1849
|
-
placeholder: t("template placeholder")
|
|
1850
|
-
}),
|
|
1851
|
-
createThemeExtensions({
|
|
1852
|
-
themeMode,
|
|
1853
|
-
slots: {
|
|
1854
|
-
content: {
|
|
1855
|
-
className: "!pe-4"
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
}),
|
|
1859
|
-
createMarkdownExtensions(),
|
|
1860
|
-
decorateMarkdown(),
|
|
1861
|
-
handlebars(),
|
|
1862
|
-
// xml(),
|
|
1863
|
-
// NOTE: Since we're using markdown only HTML nodes are parsed.
|
|
1864
|
-
xmlDecorator(),
|
|
1865
|
-
syntaxHighlighting(defaultHighlightStyle)
|
|
1866
|
-
].filter(isNonNullable2)
|
|
1867
|
-
};
|
|
1868
|
-
}, [
|
|
1869
|
-
themeMode,
|
|
1870
|
-
template.source?.target,
|
|
1871
|
-
lineNumbers
|
|
1872
|
-
]);
|
|
1873
|
-
return /* @__PURE__ */ React10.createElement("div", {
|
|
1874
|
-
ref: parentRef,
|
|
1875
|
-
className: mx8("h-full overflow-hidden", classNames)
|
|
1876
|
-
});
|
|
1877
|
-
};
|
|
1878
|
-
|
|
1879
|
-
// src/components/Toolbox/Toolbox.tsx
|
|
1880
|
-
import React11, { Fragment, useEffect as useEffect8, useState as useState13 } from "react";
|
|
1881
|
-
import { Function } from "@dxos/functions";
|
|
1882
|
-
import { log as log4 } from "@dxos/log";
|
|
1883
|
-
import { Filter as Filter5, useQuery as useQuery4 } from "@dxos/react-client/echo";
|
|
1884
|
-
import { ScrollArea } from "@dxos/react-ui";
|
|
1885
|
-
import { mx as mx9 } from "@dxos/ui-theme";
|
|
1886
|
-
var __dxlog_file4 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/Toolbox/Toolbox.tsx";
|
|
1887
|
-
var Toolbox = ({ classNames, functions, services, blueprints, activeBlueprints }) => {
|
|
1888
|
-
return /* @__PURE__ */ React11.createElement(ScrollArea.Root, {
|
|
1889
|
-
thin: true,
|
|
1890
|
-
orientation: "vertical"
|
|
1891
|
-
}, /* @__PURE__ */ React11.createElement(ScrollArea.Viewport, {
|
|
1892
|
-
classNames
|
|
1893
|
-
}, blueprints && blueprints.length > 0 && /* @__PURE__ */ React11.createElement(Section, {
|
|
1894
|
-
title: "Blueprints",
|
|
1895
|
-
items: blueprints.map(({ name, description, tools }) => ({
|
|
1896
|
-
name,
|
|
1897
|
-
description,
|
|
1898
|
-
subitems: tools.map((toolId) => ({
|
|
1899
|
-
name: `\u2219 ${safeToolId(toolId)}`
|
|
1900
|
-
}))
|
|
1901
|
-
}))
|
|
1902
|
-
}), activeBlueprints && activeBlueprints.length > 0 && /* @__PURE__ */ React11.createElement(Section, {
|
|
1903
|
-
title: "Blueprints",
|
|
1904
|
-
items: activeBlueprints.map(({ target }) => ({
|
|
1905
|
-
name: target?.name ?? "",
|
|
1906
|
-
description: target?.description ?? "",
|
|
1907
|
-
subitems: target?.tools.map((toolId) => ({
|
|
1908
|
-
name: `\u2219 ${safeToolId(toolId)}`
|
|
1909
|
-
}))
|
|
1910
|
-
}))
|
|
1911
|
-
}), services && services.length > 0 && /* @__PURE__ */ React11.createElement(Section, {
|
|
1912
|
-
title: "Services",
|
|
1913
|
-
items: services.map(({ service: { serviceId, name, description } }) => ({
|
|
1914
|
-
name: name ?? serviceId,
|
|
1915
|
-
description
|
|
1916
|
-
}))
|
|
1917
|
-
}), functions && functions.length > 0 && /* @__PURE__ */ React11.createElement(Section, {
|
|
1918
|
-
title: "Functions",
|
|
1919
|
-
items: functions.map(({ name, description }) => ({
|
|
1920
|
-
name,
|
|
1921
|
-
description
|
|
1922
|
-
}))
|
|
1923
|
-
})));
|
|
1924
|
-
};
|
|
1925
|
-
var Section = ({ title, items, striped }) => {
|
|
1926
|
-
const stripeClassNames = "odd:bg-neutral-50 dark:odd:bg-neutral-800";
|
|
1927
|
-
const gridClassNames = "grid grid-cols-[8rem_1fr]";
|
|
1928
|
-
const subGridClassNames = mx9("col-span-full grid grid-cols-subgrid text-xs px-2", striped && stripeClassNames);
|
|
1929
|
-
return /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement("h1", {
|
|
1930
|
-
className: "px-2 text-sm"
|
|
1931
|
-
}, title), /* @__PURE__ */ React11.createElement("div", {
|
|
1932
|
-
className: gridClassNames
|
|
1933
|
-
}, items.map(({ name, description, subitems }, i) => /* @__PURE__ */ React11.createElement(Fragment, {
|
|
1934
|
-
key: i
|
|
1935
|
-
}, name && /* @__PURE__ */ React11.createElement("div", {
|
|
1936
|
-
className: subGridClassNames
|
|
1937
|
-
}, /* @__PURE__ */ React11.createElement("div", {
|
|
1938
|
-
className: "truncate text-primary-500"
|
|
1939
|
-
}, name), /* @__PURE__ */ React11.createElement("div", {
|
|
1940
|
-
className: "line-clamp-2"
|
|
1941
|
-
}, description)), subitems?.map(({ name: name2, description: description2 }, i2) => /* @__PURE__ */ React11.createElement("div", {
|
|
1942
|
-
key: i2,
|
|
1943
|
-
className: mx9(subGridClassNames, striped && stripeClassNames)
|
|
1944
|
-
}, /* @__PURE__ */ React11.createElement("div", {
|
|
1945
|
-
className: "truncate"
|
|
1946
|
-
}, name2), /* @__PURE__ */ React11.createElement("div", {
|
|
1947
|
-
className: "line-clamp-3 text-subdued"
|
|
1948
|
-
}, description2)))))));
|
|
1949
|
-
};
|
|
1950
|
-
var ToolboxContainer = ({ classNames, db, processor }) => {
|
|
1951
|
-
const services = useQuery4(db, Filter5.type(ServiceType));
|
|
1952
|
-
const [serviceTools, setServiceTools] = useState13([]);
|
|
1953
|
-
useEffect8(() => {
|
|
1954
|
-
log4("creating service tools...", {
|
|
1955
|
-
services: services.length
|
|
1956
|
-
}, {
|
|
1957
|
-
F: __dxlog_file4,
|
|
1958
|
-
L: 115,
|
|
1959
|
-
S: void 0,
|
|
1960
|
-
C: (f, a) => f(...a)
|
|
1961
|
-
});
|
|
1962
|
-
queueMicrotask(async () => {
|
|
1963
|
-
});
|
|
1964
|
-
}, [
|
|
1965
|
-
services
|
|
1966
|
-
]);
|
|
1967
|
-
const functions = useQuery4(db, Filter5.type(Function.Function));
|
|
1968
|
-
return /* @__PURE__ */ React11.createElement(Toolbox, {
|
|
1969
|
-
classNames,
|
|
1970
|
-
blueprints: processor?.context.getBlueprints(),
|
|
1971
|
-
services: serviceTools,
|
|
1972
|
-
functions
|
|
1973
|
-
});
|
|
1974
|
-
};
|
|
1975
|
-
var safeToolId = (name) => {
|
|
1976
|
-
return name.split("_").pop();
|
|
1977
|
-
};
|
|
1978
|
-
|
|
1979
|
-
// src/hooks/useChatToolbarActions.ts
|
|
1980
|
-
var __dxlog_file5 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/hooks/useChatToolbarActions.ts";
|
|
1981
|
-
var useChatToolbarActions = ({ chat, companionTo }) => {
|
|
1982
|
-
const { invoke } = useOperationInvoker();
|
|
1983
|
-
const { db } = useChatContext("useChatToolbarActions");
|
|
1984
|
-
const query = companionTo ? Query.select(Filter6.id(companionTo.id)).targetOf(Chat2.CompanionTo).source() : Query.select(Filter6.nothing());
|
|
1985
|
-
const chats = useQuery5(db, query);
|
|
1986
|
-
return useMenuActions(useMemo10(() => {
|
|
1987
|
-
return Atom.make(() => {
|
|
1988
|
-
const builder = MenuBuilder.make().root({
|
|
1989
|
-
label: [
|
|
1990
|
-
"chat toolbar title",
|
|
1991
|
-
{
|
|
1992
|
-
ns: meta.id
|
|
1993
|
-
}
|
|
1994
|
-
]
|
|
1995
|
-
}).action("new", {
|
|
1996
|
-
label: [
|
|
1997
|
-
"new thread button",
|
|
1998
|
-
{
|
|
1999
|
-
ns: meta.id
|
|
2000
|
-
}
|
|
2001
|
-
],
|
|
2002
|
-
icon: "ph--plus--regular",
|
|
2003
|
-
type: "new",
|
|
2004
|
-
disabled: !companionTo
|
|
2005
|
-
}, () => {
|
|
2006
|
-
invariant(companionTo, void 0, {
|
|
2007
|
-
F: __dxlog_file5,
|
|
2008
|
-
L: 53,
|
|
2009
|
-
S: void 0,
|
|
2010
|
-
A: [
|
|
2011
|
-
"companionTo",
|
|
2012
|
-
""
|
|
2013
|
-
]
|
|
2014
|
-
});
|
|
2015
|
-
return invoke(AssistantOperation.SetCurrentChat, {
|
|
2016
|
-
companionTo,
|
|
2017
|
-
chat: void 0
|
|
2018
|
-
}).pipe(runAndForwardErrors);
|
|
2019
|
-
}).action("rename", {
|
|
2020
|
-
label: [
|
|
2021
|
-
"rename thread button",
|
|
2022
|
-
{
|
|
2023
|
-
ns: meta.id
|
|
2024
|
-
}
|
|
2025
|
-
],
|
|
2026
|
-
icon: "ph--magic-wand--regular",
|
|
2027
|
-
type: "rename",
|
|
2028
|
-
disabled: !chat
|
|
2029
|
-
}, () => Effect2.gen(function* () {
|
|
2030
|
-
invariant(chat, void 0, {
|
|
2031
|
-
F: __dxlog_file5,
|
|
2032
|
-
L: 70,
|
|
2033
|
-
S: this,
|
|
2034
|
-
A: [
|
|
2035
|
-
"chat",
|
|
2036
|
-
""
|
|
2037
|
-
]
|
|
2038
|
-
});
|
|
2039
|
-
yield* invoke(AssistantOperation.UpdateChatName, {
|
|
2040
|
-
chat
|
|
2041
|
-
});
|
|
2042
|
-
}).pipe(runAndForwardErrors)).action("branch", {
|
|
2043
|
-
label: [
|
|
2044
|
-
"button branch thread",
|
|
2045
|
-
{
|
|
2046
|
-
ns: meta.id
|
|
2047
|
-
}
|
|
2048
|
-
],
|
|
2049
|
-
icon: "ph--git-branch--regular",
|
|
2050
|
-
type: "branch",
|
|
2051
|
-
disabled: true
|
|
2052
|
-
}, () => {
|
|
2053
|
-
});
|
|
2054
|
-
if (chats.length > 0) {
|
|
2055
|
-
builder.group("chats", {
|
|
2056
|
-
label: [
|
|
2057
|
-
"chat history label",
|
|
2058
|
-
{
|
|
2059
|
-
ns: meta.id
|
|
2060
|
-
}
|
|
2061
|
-
],
|
|
2062
|
-
icon: "ph--clock-counter-clockwise--regular",
|
|
2063
|
-
selectCardinality: "single",
|
|
2064
|
-
variant: "dropdownMenu"
|
|
2065
|
-
}, (builder2) => {
|
|
2066
|
-
chats.toSorted((a, b) => a.id.localeCompare(b.id)).forEach((chat2) => {
|
|
2067
|
-
builder2.action(chat2.id, {
|
|
2068
|
-
label: Obj6.getLabel(chat2) ?? [
|
|
2069
|
-
"object name placeholder",
|
|
2070
|
-
{
|
|
2071
|
-
ns: Chat2.Chat.typename
|
|
2072
|
-
}
|
|
2073
|
-
]
|
|
2074
|
-
}, () => Effect2.gen(function* () {
|
|
2075
|
-
invariant(companionTo, void 0, {
|
|
2076
|
-
F: __dxlog_file5,
|
|
2077
|
-
L: 106,
|
|
2078
|
-
S: this,
|
|
2079
|
-
A: [
|
|
2080
|
-
"companionTo",
|
|
2081
|
-
""
|
|
2082
|
-
]
|
|
2083
|
-
});
|
|
2084
|
-
yield* invoke(AssistantOperation.SetCurrentChat, {
|
|
2085
|
-
companionTo,
|
|
2086
|
-
chat: chat2
|
|
2087
|
-
});
|
|
2088
|
-
}).pipe(runAndForwardErrors));
|
|
2089
|
-
});
|
|
2090
|
-
});
|
|
2091
|
-
}
|
|
2092
|
-
return builder.build();
|
|
2093
|
-
});
|
|
2094
|
-
}, [
|
|
2095
|
-
chats.length,
|
|
2096
|
-
db?.spaceId,
|
|
2097
|
-
companionTo?.id,
|
|
2098
|
-
chat?.id,
|
|
2099
|
-
invoke
|
|
2100
|
-
]));
|
|
2101
|
-
};
|
|
2102
|
-
|
|
2103
|
-
export {
|
|
2104
|
-
useBlueprintRegistry,
|
|
2105
|
-
useBlueprints,
|
|
2106
|
-
useActiveBlueprints,
|
|
2107
|
-
useBlueprintHandlers,
|
|
2108
|
-
useChatProcessor,
|
|
2109
|
-
useChatServices,
|
|
2110
|
-
useChatToolbarActions,
|
|
2111
|
-
useContextBinder,
|
|
2112
|
-
useContextObjects,
|
|
2113
|
-
useFilteredTypes,
|
|
2114
|
-
useFlush,
|
|
2115
|
-
useOnline,
|
|
2116
|
-
usePresets,
|
|
2117
|
-
useReferencesProvider,
|
|
2118
|
-
ChatContextProvider,
|
|
2119
|
-
useChatContext,
|
|
2120
|
-
Chat,
|
|
2121
|
-
TemplateEditor,
|
|
2122
|
-
Toolbox,
|
|
2123
|
-
ToolboxContainer
|
|
2124
|
-
};
|
|
2125
|
-
//# sourceMappingURL=chunk-UUA6GNGG.mjs.map
|