@dxos/plugin-assistant 0.8.4-main.67995b8 → 0.8.4-main.69d29f4
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/browser/BlueprintArticle-WP3G5GLG.mjs +31 -0
- package/dist/lib/browser/BlueprintArticle-WP3G5GLG.mjs.map +7 -0
- package/dist/lib/browser/ChatCompanion-ECQYUQ2B.mjs +153 -0
- package/dist/lib/browser/ChatCompanion-ECQYUQ2B.mjs.map +7 -0
- package/dist/lib/browser/ChatContainer-QCCOFBUX.mjs +73 -0
- package/dist/lib/browser/ChatContainer-QCCOFBUX.mjs.map +7 -0
- package/dist/lib/browser/ChatDialog-SMK4RSZU.mjs +85 -0
- package/dist/lib/browser/ChatDialog-SMK4RSZU.mjs.map +7 -0
- package/dist/lib/browser/PromptArticle-K362ZPAE.mjs +53 -0
- package/dist/lib/browser/PromptArticle-K362ZPAE.mjs.map +7 -0
- package/dist/lib/browser/ai-service-5GUDOEWF.mjs +21 -0
- package/dist/lib/browser/ai-service-5GUDOEWF.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-DSNH2OMY.mjs +212 -0
- package/dist/lib/browser/app-graph-builder-DSNH2OMY.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-DGHH7MUU.mjs +14 -0
- package/dist/lib/browser/blueprint-definition-DGHH7MUU.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +12 -0
- package/dist/lib/browser/blueprints/index.mjs.map +7 -0
- package/dist/lib/browser/chunk-3JYPE2MM.mjs +1832 -0
- package/dist/lib/browser/chunk-3JYPE2MM.mjs.map +7 -0
- package/dist/lib/browser/chunk-DKQMSMBN.mjs +326 -0
- package/dist/lib/browser/chunk-DKQMSMBN.mjs.map +7 -0
- package/dist/lib/browser/chunk-EXVT7D4B.mjs +23 -0
- package/dist/lib/browser/chunk-EXVT7D4B.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-ML3QCFKA.mjs +265 -0
- package/dist/lib/browser/chunk-ML3QCFKA.mjs.map +7 -0
- package/dist/lib/browser/chunk-MRJVYGLU.mjs +208 -0
- package/dist/lib/browser/chunk-MRJVYGLU.mjs.map +7 -0
- package/dist/lib/browser/chunk-V772AMZM.mjs +250 -0
- package/dist/lib/browser/chunk-V772AMZM.mjs.map +7 -0
- package/dist/lib/browser/chunk-WGQTU6UJ.mjs +41 -0
- package/dist/lib/browser/chunk-WGQTU6UJ.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-26BOY6HY.mjs +20 -0
- package/dist/lib/browser/edge-model-resolver-26BOY6HY.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +264 -168
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/local-model-resolver-ZFIM6GGV.mjs +19 -0
- package/dist/lib/browser/local-model-resolver-ZFIM6GGV.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-7XJLBRQY.mjs +132 -0
- package/dist/lib/browser/operation-resolver-7XJLBRQY.mjs.map +7 -0
- package/dist/lib/browser/react-surface-NCITRSJJ.mjs +109 -0
- package/dist/lib/browser/react-surface-NCITRSJJ.mjs.map +7 -0
- package/dist/lib/browser/repair-6QGAKOVM.mjs +54 -0
- package/dist/lib/browser/repair-6QGAKOVM.mjs.map +7 -0
- package/dist/lib/browser/settings-4ZDLUMYE.mjs +32 -0
- package/dist/lib/browser/settings-4ZDLUMYE.mjs.map +7 -0
- package/dist/lib/browser/state-AN6336ZX.mjs +26 -0
- package/dist/lib/browser/state-AN6336ZX.mjs.map +7 -0
- package/dist/lib/browser/toolkit-7AVTEPMA.mjs +18 -0
- package/dist/lib/browser/toolkit-7AVTEPMA.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +11 -4
- package/dist/lib/node-esm/BlueprintArticle-WZ76E2C4.mjs +32 -0
- package/dist/lib/node-esm/BlueprintArticle-WZ76E2C4.mjs.map +7 -0
- package/dist/lib/node-esm/ChatCompanion-Q4FUZ2MW.mjs +154 -0
- package/dist/lib/node-esm/ChatCompanion-Q4FUZ2MW.mjs.map +7 -0
- package/dist/lib/node-esm/ChatContainer-AKI33HIB.mjs +74 -0
- package/dist/lib/node-esm/ChatContainer-AKI33HIB.mjs.map +7 -0
- package/dist/lib/node-esm/ChatDialog-AP45PVZR.mjs +86 -0
- package/dist/lib/node-esm/ChatDialog-AP45PVZR.mjs.map +7 -0
- package/dist/lib/node-esm/PromptArticle-D4HAIIC6.mjs +54 -0
- package/dist/lib/node-esm/PromptArticle-D4HAIIC6.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-PXKKCFIF.mjs +22 -0
- package/dist/lib/node-esm/ai-service-PXKKCFIF.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-TJCUEXW5.mjs +213 -0
- package/dist/lib/node-esm/app-graph-builder-TJCUEXW5.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-SEMDEIYG.mjs +15 -0
- package/dist/lib/node-esm/blueprint-definition-SEMDEIYG.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +13 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-355W5B27.mjs +251 -0
- package/dist/lib/node-esm/chunk-355W5B27.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-75PHXBN3.mjs +327 -0
- package/dist/lib/node-esm/chunk-75PHXBN3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DCA5QWQT.mjs +209 -0
- package/dist/lib/node-esm/chunk-DCA5QWQT.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MSBPC4RJ.mjs +42 -0
- package/dist/lib/node-esm/chunk-MSBPC4RJ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs +25 -0
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XI5T3MJC.mjs +1833 -0
- package/dist/lib/node-esm/chunk-XI5T3MJC.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZRIPP7YF.mjs +267 -0
- package/dist/lib/node-esm/chunk-ZRIPP7YF.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-G5KMODPO.mjs +21 -0
- package/dist/lib/node-esm/edge-model-resolver-G5KMODPO.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +264 -168
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/local-model-resolver-KDZLYI7Y.mjs +20 -0
- package/dist/lib/node-esm/local-model-resolver-KDZLYI7Y.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-SX4WMNA7.mjs +133 -0
- package/dist/lib/node-esm/operation-resolver-SX4WMNA7.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-ST6V7LPE.mjs +110 -0
- package/dist/lib/node-esm/react-surface-ST6V7LPE.mjs.map +7 -0
- package/dist/lib/node-esm/repair-QJ7CQDKU.mjs +55 -0
- package/dist/lib/node-esm/repair-QJ7CQDKU.mjs.map +7 -0
- package/dist/lib/node-esm/settings-CQEOHR3R.mjs +33 -0
- package/dist/lib/node-esm/settings-CQEOHR3R.mjs.map +7 -0
- package/dist/lib/node-esm/state-HDON4REW.mjs +27 -0
- package/dist/lib/node-esm/state-HDON4REW.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-OWGCEKOO.mjs +19 -0
- package/dist/lib/node-esm/toolkit-OWGCEKOO.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +11 -4
- package/dist/types/src/AssistantPlugin.d.ts +2 -1
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/assistant-blueprint.d.ts +209 -0
- package/dist/types/src/blueprints/assistant-blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +7 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts +5 -0
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts.map +1 -0
- package/dist/types/src/capabilities/ai-service/index.d.ts +3 -0
- package/dist/types/src/capabilities/ai-service/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +21 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +4 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts +6 -0
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/edge-model-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +11 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/local-model-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts +12 -0
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/repair/index.d.ts +3 -0
- package/dist/types/src/capabilities/repair/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/repair/repair.d.ts +6 -0
- package/dist/types/src/capabilities/repair/repair.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +15 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +17 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +11 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +13 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit/index.d.ts +3 -0
- package/dist/types/src/capabilities/toolkit/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts +5 -0
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +4 -2
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/BlueprintArticle.d.ts +7 -0
- package/dist/types/src/components/BlueprintArticle.d.ts.map +1 -0
- package/dist/types/src/components/Chat/Chat.d.ts +33 -20
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +10 -1
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts +13 -0
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +15 -7
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +7 -0
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
- package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
- package/dist/types/src/components/ChatProgress/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +20 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +5 -6
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +13 -11
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +198 -56
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/registry.d.ts +11 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.d.ts +42 -0
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts +2 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts.map +1 -0
- package/dist/types/src/components/PromptArticle.d.ts +7 -0
- package/dist/types/src/components/PromptArticle.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -6
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +317 -7
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +12 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +314 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts +12 -0
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts +3 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts +8 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +21 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts +2 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/index.d.ts +3 -0
- package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +9 -15
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +318 -5
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts +12 -0
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/Typewriter.d.ts +11 -0
- package/dist/types/src/components/Typewriter/Typewriter.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts +7 -0
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/assistant-extension.d.ts +5 -0
- package/dist/types/src/components/Typewriter/assistant-extension.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/index.d.ts +2 -0
- package/dist/types/src/components/Typewriter/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +10 -6
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/functions/index.d.ts +4 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/object-list.d.ts +10 -0
- package/dist/types/src/functions/object-list.d.ts.map +1 -0
- package/dist/types/src/functions/object-load.d.ts +8 -0
- package/dist/types/src/functions/object-load.d.ts.map +1 -0
- package/dist/types/src/functions/object-search.d.ts +10 -0
- package/dist/types/src/functions/object-search.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +8 -3
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +25 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +8 -19
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +7 -8
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts +8 -0
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextBinder.d.ts +4 -0
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
- package/dist/types/src/hooks/useFilteredTypes.d.ts +3 -0
- package/dist/types/src/hooks/useFilteredTypes.d.ts.map +1 -0
- package/dist/types/src/hooks/useFlush.d.ts +6 -0
- package/dist/types/src/hooks/useFlush.d.ts.map +1 -0
- package/dist/types/src/hooks/useOnline.d.ts +3 -0
- package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
- package/dist/types/src/hooks/usePresets.d.ts +7 -0
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +3 -4
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +4 -0
- package/dist/types/src/processor/index.d.ts.map +1 -0
- package/dist/types/src/{hooks → processor}/presets.d.ts +3 -3
- package/dist/types/src/processor/presets.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +75 -0
- package/dist/types/src/processor/processor.d.ts.map +1 -0
- package/dist/types/src/processor/processor.test.d.ts +2 -0
- package/dist/types/src/processor/processor.test.d.ts.map +1 -0
- package/dist/types/src/processor/update-name.d.ts +10 -0
- package/dist/types/src/processor/update-name.d.ts.map +1 -0
- package/dist/types/src/queue-logger.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +8 -0
- package/dist/types/src/testing/test-generator.d.ts.map +1 -0
- package/dist/types/src/testing/test-sequence.d.ts +0 -4
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts +2 -2
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +262 -28
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +42 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -0
- package/dist/types/src/types/AssistantAction.d.ts +95 -0
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +33 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/defs.d.ts +2 -0
- package/dist/types/src/types/defs.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +5 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +14 -213
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +124 -100
- package/src/AssistantPlugin.tsx +125 -113
- package/src/blueprints/assistant-blueprint.ts +62 -0
- package/src/blueprints/index.ts +12 -0
- package/src/capabilities/ai-service/ai-service.ts +29 -0
- package/src/capabilities/ai-service/index.ts +7 -0
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +180 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +60 -0
- package/src/capabilities/blueprint-definition/index.ts +8 -0
- package/src/capabilities/edge-model-resolver/edge-model-resolver.ts +32 -0
- package/src/capabilities/edge-model-resolver/index.ts +7 -0
- package/src/capabilities/index.ts +11 -6
- package/src/capabilities/local-model-resolver/index.ts +7 -0
- package/src/capabilities/local-model-resolver/local-model-resolver.ts +37 -0
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +110 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +95 -0
- package/src/capabilities/repair/index.ts +7 -0
- package/src/capabilities/repair/repair.ts +63 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +30 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +27 -0
- package/src/capabilities/toolkit/index.ts +7 -0
- package/src/capabilities/toolkit/toolkit.ts +26 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +92 -77
- package/src/components/BlueprintArticle.tsx +29 -0
- package/src/components/Chat/Chat.tsx +237 -194
- package/src/components/Chat/events.ts +14 -1
- package/src/components/ChatCompanion.tsx +163 -0
- package/src/components/ChatContainer.tsx +48 -32
- package/src/components/ChatDialog.tsx +28 -18
- package/src/components/ChatProgress/ChatProgress.tsx +54 -0
- package/src/components/{SequenceEditor → ChatProgress}/index.ts +1 -1
- package/src/components/ChatPrompt/ChatActions.tsx +11 -27
- package/src/components/ChatPrompt/ChatOptions.tsx +238 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +32 -38
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
- package/src/components/ChatPrompt/index.ts +1 -1
- package/src/components/ChatThread/ChatThread.stories.tsx +123 -116
- package/src/components/ChatThread/ChatThread.tsx +66 -36
- package/src/components/ChatThread/Link.tsx +26 -0
- package/src/components/ChatThread/registry.tsx +174 -0
- package/src/components/ChatThread/sync.test.ts +97 -0
- package/src/components/ChatThread/sync.ts +154 -0
- package/src/components/ChatThread/testing/thread.md +37 -0
- package/src/components/PromptArticle.tsx +50 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +38 -17
- package/src/components/TemplateEditor/TemplateEditor.tsx +33 -54
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +28 -15
- package/src/components/TemplateEditor/TemplateForm.tsx +80 -31
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +274 -0
- package/src/components/TemplateEditor/extensions/index.ts +6 -0
- package/src/components/TemplateEditor/extensions/xml-extension.ts +64 -0
- package/src/components/ToolBlock/ToolBlock.tsx +143 -0
- package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
- package/src/components/ToolBlock/index.ts +6 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +18 -28
- package/src/components/Toolbox/Toolbox.tsx +37 -68
- package/src/components/Typewriter/AssistantToolbar.tsx +161 -0
- package/src/components/Typewriter/Typewriter.stories.tsx +83 -0
- package/src/components/Typewriter/Typewriter.tsx +54 -0
- package/src/components/Typewriter/assistant-extension.tsx +144 -0
- package/src/components/Typewriter/index.ts +5 -0
- package/src/components/index.ts +3 -7
- package/src/functions/index.ts +7 -0
- package/src/functions/object-list.ts +49 -0
- package/src/functions/object-load.ts +47 -0
- package/src/functions/object-search.ts +46 -0
- package/src/hooks/index.ts +8 -4
- package/src/hooks/useBlueprintRegistry.ts +105 -0
- package/src/hooks/useChatProcessor.ts +38 -104
- package/src/hooks/useChatServices.ts +31 -51
- package/src/hooks/useChatToolbarActions.ts +121 -0
- package/src/hooks/useContextBinder.ts +32 -0
- package/src/hooks/useContextObjects.ts +46 -0
- package/src/hooks/useFilteredTypes.ts +37 -0
- package/src/hooks/useFlush.ts +35 -0
- package/src/hooks/useOnline.ts +10 -0
- package/src/hooks/usePresets.ts +44 -0
- package/src/hooks/useReferencesProvider.ts +15 -12
- package/src/index.ts +2 -1
- package/src/meta.ts +11 -8
- package/src/processor/index.ts +7 -0
- package/src/{hooks → processor}/presets.ts +16 -8
- package/src/processor/processor.test.ts +72 -0
- package/src/processor/processor.ts +275 -0
- package/src/processor/update-name.ts +59 -0
- package/src/queue-logger.ts +17 -18
- package/src/testing/index.ts +1 -1
- package/src/testing/test-generator.ts +262 -0
- package/src/testing/test-sequence.ts +2 -27
- package/src/testing/test-services.ts +10 -14
- package/src/translations.ts +49 -18
- package/src/types/Assistant.ts +62 -0
- package/src/types/AssistantAction.ts +75 -0
- package/src/types/capabilities.ts +27 -0
- package/src/types/defs.ts +5 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +6 -1
- package/src/types/service.ts +25 -14
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/BlueprintContainer-IZ4AK5EO.mjs +0 -28
- package/dist/lib/browser/BlueprintContainer-IZ4AK5EO.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-RP3QEXYX.mjs +0 -54
- package/dist/lib/browser/ChatContainer-RP3QEXYX.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-ZVLXFHEY.mjs +0 -72
- package/dist/lib/browser/ChatDialog-ZVLXFHEY.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs +0 -162
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-XSEOKJLG.mjs +0 -164
- package/dist/lib/browser/app-graph-builder-XSEOKJLG.mjs.map +0 -7
- package/dist/lib/browser/chunk-63GG6U6D.mjs +0 -2226
- package/dist/lib/browser/chunk-63GG6U6D.mjs.map +0 -7
- package/dist/lib/browser/chunk-7W7LHTRH.mjs +0 -171
- package/dist/lib/browser/chunk-7W7LHTRH.mjs.map +0 -7
- package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
- package/dist/lib/browser/chunk-FDCJSQYF.mjs.map +0 -7
- package/dist/lib/browser/chunk-KFXSBNZR.mjs +0 -89
- package/dist/lib/browser/chunk-KFXSBNZR.mjs.map +0 -7
- package/dist/lib/browser/chunk-LERGF5YG.mjs +0 -108
- package/dist/lib/browser/chunk-LERGF5YG.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs +0 -75
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3GYEHQRP.mjs +0 -150
- package/dist/lib/browser/react-surface-3GYEHQRP.mjs.map +0 -7
- package/dist/lib/browser/settings-5GTTCVGD.mjs +0 -22
- package/dist/lib/browser/settings-5GTTCVGD.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-RGTMNLNX.mjs +0 -29
- package/dist/lib/node-esm/BlueprintContainer-RGTMNLNX.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-W3W6FWV3.mjs +0 -55
- package/dist/lib/node-esm/ChatContainer-W3W6FWV3.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-QW4JRKVO.mjs +0 -73
- package/dist/lib/node-esm/ChatDialog-QW4JRKVO.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs +0 -163
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-PANCJUHV.mjs +0 -165
- package/dist/lib/node-esm/app-graph-builder-PANCJUHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs +0 -2227
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MS3PJARN.mjs +0 -109
- package/dist/lib/node-esm/chunk-MS3PJARN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs +0 -90
- package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs +0 -172
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs +0 -76
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs +0 -151
- package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs.map +0 -7
- package/dist/lib/node-esm/settings-J2EXEM5H.mjs +0 -23
- package/dist/lib/node-esm/settings-J2EXEM5H.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/capability-definitions.d.ts +0 -7
- package/dist/types/src/capability-definitions.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintContainer.d.ts +0 -8
- package/dist/types/src/components/BlueprintContainer.d.ts.map +0 -1
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -17
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +0 -19
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
- package/dist/types/src/components/PromptSettings.d.ts +0 -6
- package/dist/types/src/components/PromptSettings.d.ts.map +0 -1
- package/dist/types/src/components/SequenceContainer.d.ts +0 -8
- package/dist/types/src/components/SequenceContainer.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +0 -13
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +0 -8
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/index.d.ts +0 -2
- package/dist/types/src/components/SequenceEditor/index.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.d.ts +0 -86
- package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
- package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/presets.d.ts.map +0 -1
- package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
- package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.d.ts +0 -4
- package/dist/types/src/parser/filter-generator.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.test.d.ts +0 -2
- package/dist/types/src/parser/filter-generator.test.d.ts.map +0 -1
- package/dist/types/src/parser/index.d.ts +0 -4
- package/dist/types/src/parser/index.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.d.ts +0 -15
- package/dist/types/src/parser/query-parser.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.test.d.ts +0 -2
- package/dist/types/src/parser/query-parser.test.d.ts.map +0 -1
- package/dist/types/src/parser/types.d.ts +0 -24
- package/dist/types/src/parser/types.d.ts.map +0 -1
- package/dist/types/src/stories/Chat.stories.d.ts +0 -207
- package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -3
- package/dist/types/src/testing/test-functions.d.ts.map +0 -1
- package/dist/types/src/tools/function.d.ts +0 -5
- package/dist/types/src/tools/function.d.ts.map +0 -1
- package/dist/types/src/tools/index.d.ts +0 -3
- package/dist/types/src/tools/index.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.d.ts +0 -10
- package/dist/types/src/tools/openapi.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.test.d.ts +0 -2
- package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -120
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -169
- package/src/capabilities/intent-resolver.ts +0 -72
- package/src/capabilities/react-surface.tsx +0 -138
- package/src/capabilities/settings.ts +0 -19
- package/src/capability-definitions.ts +0 -15
- package/src/components/BlueprintContainer.tsx +0 -24
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
- package/src/components/ChatThread/ChatMessage.tsx +0 -268
- package/src/components/ChatThread/ToolBlock.tsx +0 -121
- package/src/components/ChatThread/reducer.ts +0 -52
- package/src/components/PromptSettings.tsx +0 -89
- package/src/components/SequenceContainer.tsx +0 -132
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -32
- package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
- package/src/events.ts +0 -11
- package/src/hooks/chat-processor.test.ts +0 -16
- package/src/hooks/chat-processor.ts +0 -314
- package/src/hooks/useBlueprints.ts +0 -57
- package/src/parser/filter-generator.test.ts +0 -32
- package/src/parser/filter-generator.ts +0 -81
- package/src/parser/index.ts +0 -7
- package/src/parser/query-parser.test.ts +0 -139
- package/src/parser/query-parser.ts +0 -199
- package/src/parser/types.ts +0 -34
- package/src/shims.d.ts +0 -8
- package/src/stories/Chat.stories.tsx +0 -371
- package/src/testing/test-functions.ts +0 -11
- package/src/tools/function.ts +0 -46
- package/src/tools/index.ts +0 -6
- package/src/tools/openapi.test.ts +0 -217
- package/src/tools/openapi.ts +0 -338
- package/src/types/schema.ts +0 -108
- package/src/typings.d.ts +0 -9
|
@@ -2,43 +2,29 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { type FC, Fragment, useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { parseToolName, type Tool } from '@dxos/ai';
|
|
8
|
-
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
9
|
-
import { type ArtifactDefinition } from '@dxos/blueprints';
|
|
10
7
|
import { type Blueprint } from '@dxos/blueprints';
|
|
11
|
-
import { type Ref } from '@dxos/echo';
|
|
12
|
-
import {
|
|
8
|
+
import { type Database, type Ref } from '@dxos/echo';
|
|
9
|
+
import { Function } from '@dxos/functions';
|
|
13
10
|
import { log } from '@dxos/log';
|
|
14
|
-
import { Filter,
|
|
15
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
16
|
-
import {
|
|
17
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
11
|
+
import { Filter, useQuery } from '@dxos/react-client/echo';
|
|
12
|
+
import { type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
13
|
+
import { mx } from '@dxos/ui-theme';
|
|
18
14
|
|
|
19
|
-
import { type ChatProcessor } from '../../hooks';
|
|
20
15
|
import { meta } from '../../meta';
|
|
21
|
-
import {
|
|
16
|
+
import { type AiChatProcessor } from '../../processor';
|
|
22
17
|
import { ServiceType } from '../../types';
|
|
23
18
|
|
|
24
19
|
export type ToolboxProps = ThemedClassName<{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
services?: { service: ServiceType }[];
|
|
21
|
+
functions?: Function.Function[];
|
|
22
|
+
// TODO(burdon): Combine into single array.
|
|
23
|
+
blueprints?: readonly Blueprint.Blueprint[];
|
|
29
24
|
activeBlueprints?: readonly Ref.Ref<Blueprint.Blueprint>[];
|
|
30
|
-
striped?: boolean;
|
|
31
25
|
}>;
|
|
32
26
|
|
|
33
|
-
export const Toolbox = ({
|
|
34
|
-
classNames,
|
|
35
|
-
artifacts,
|
|
36
|
-
functions,
|
|
37
|
-
services,
|
|
38
|
-
blueprints,
|
|
39
|
-
activeBlueprints,
|
|
40
|
-
striped,
|
|
41
|
-
}: ToolboxProps) => {
|
|
27
|
+
export const Toolbox = ({ classNames, functions, services, blueprints, activeBlueprints }: ToolboxProps) => {
|
|
42
28
|
const { t } = useTranslation(meta.id);
|
|
43
29
|
|
|
44
30
|
return (
|
|
@@ -46,10 +32,10 @@ export const Toolbox = ({
|
|
|
46
32
|
{blueprints && blueprints.length > 0 && (
|
|
47
33
|
<Section
|
|
48
34
|
title='Blueprints'
|
|
49
|
-
items={blueprints.map(({
|
|
50
|
-
name
|
|
51
|
-
description
|
|
52
|
-
subitems:
|
|
35
|
+
items={blueprints.map(({ name, description, tools }) => ({
|
|
36
|
+
name,
|
|
37
|
+
description,
|
|
38
|
+
subitems: tools.map((toolId) => ({ name: `∙ ${safeToolId(toolId)}` })),
|
|
53
39
|
}))}
|
|
54
40
|
/>
|
|
55
41
|
)}
|
|
@@ -60,18 +46,7 @@ export const Toolbox = ({
|
|
|
60
46
|
items={activeBlueprints.map(({ target }) => ({
|
|
61
47
|
name: target?.name ?? '',
|
|
62
48
|
description: target?.description ?? '',
|
|
63
|
-
subitems: target?.tools.map((toolId) => ({ name: `∙ ${
|
|
64
|
-
}))}
|
|
65
|
-
/>
|
|
66
|
-
)}
|
|
67
|
-
|
|
68
|
-
{artifacts && artifacts.length > 0 && (
|
|
69
|
-
<Section
|
|
70
|
-
title='Artifacts'
|
|
71
|
-
items={artifacts.map(({ name, description, tools }) => ({
|
|
72
|
-
name,
|
|
73
|
-
description,
|
|
74
|
-
subitems: tools.map(({ name, description }) => ({ name: `∙ ${parseToolName(name)}`, description })),
|
|
49
|
+
subitems: target?.tools.map((toolId) => ({ name: `∙ ${safeToolId(toolId)}` })),
|
|
75
50
|
}))}
|
|
76
51
|
/>
|
|
77
52
|
)}
|
|
@@ -79,10 +54,10 @@ export const Toolbox = ({
|
|
|
79
54
|
{services && services.length > 0 && (
|
|
80
55
|
<Section
|
|
81
56
|
title='Services'
|
|
82
|
-
items={services.map(({ service: { serviceId, name, description }
|
|
57
|
+
items={services.map(({ service: { serviceId, name, description } }) => ({
|
|
83
58
|
name: name ?? serviceId,
|
|
84
59
|
description,
|
|
85
|
-
subitems: tools.map(({ name, description }) => ({ name: `∙ ${name}`, description })),
|
|
60
|
+
// subitems: tools.map(({ name, description }) => ({ name: `∙ ${name}`, description })),
|
|
86
61
|
}))}
|
|
87
62
|
/>
|
|
88
63
|
)}
|
|
@@ -90,12 +65,6 @@ export const Toolbox = ({
|
|
|
90
65
|
{functions && functions.length > 0 && (
|
|
91
66
|
<Section title='Functions' items={functions.map(({ name, description }) => ({ name, description }))} />
|
|
92
67
|
)}
|
|
93
|
-
|
|
94
|
-
{!blueprints?.length &&
|
|
95
|
-
!activeBlueprints?.length &&
|
|
96
|
-
!artifacts?.length &&
|
|
97
|
-
!services?.length &&
|
|
98
|
-
!functions?.length && <div>{t('no tools')}</div>}
|
|
99
68
|
</div>
|
|
100
69
|
);
|
|
101
70
|
};
|
|
@@ -107,11 +76,11 @@ const Section: FC<{
|
|
|
107
76
|
}> = ({ title, items, striped }) => {
|
|
108
77
|
const stripeClassNames = 'odd:bg-neutral-50 dark:odd:bg-neutral-800';
|
|
109
78
|
const gridClassNames = 'grid grid-cols-[8rem_1fr]';
|
|
110
|
-
const subGridClassNames = mx('col-span-full grid grid-cols-subgrid text-xs
|
|
79
|
+
const subGridClassNames = mx('col-span-full grid grid-cols-subgrid text-xs pli-2', striped && stripeClassNames);
|
|
111
80
|
|
|
112
81
|
return (
|
|
113
82
|
<div>
|
|
114
|
-
<h1 className='
|
|
83
|
+
<h1 className='pli-2 text-sm'>{title}</h1>
|
|
115
84
|
<div className={gridClassNames}>
|
|
116
85
|
{items.map(({ name, description, subitems }, i) => (
|
|
117
86
|
<Fragment key={i}>
|
|
@@ -135,38 +104,38 @@ const Section: FC<{
|
|
|
135
104
|
};
|
|
136
105
|
|
|
137
106
|
export type ToolboxContainerProps = ThemedClassName<{
|
|
138
|
-
|
|
139
|
-
processor?:
|
|
107
|
+
db?: Database.Database;
|
|
108
|
+
processor?: AiChatProcessor;
|
|
140
109
|
}>;
|
|
141
110
|
|
|
142
|
-
export const ToolboxContainer = ({ classNames,
|
|
143
|
-
// Plugin artifacts.
|
|
144
|
-
const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
|
|
145
|
-
|
|
111
|
+
export const ToolboxContainer = ({ classNames, db, processor }: ToolboxContainerProps) => {
|
|
146
112
|
// Registered services.
|
|
147
|
-
const services = useQuery(
|
|
148
|
-
const [serviceTools, setServiceTools] = useState<{ service: ServiceType
|
|
113
|
+
const services = useQuery(db, Filter.type(ServiceType));
|
|
114
|
+
const [serviceTools, setServiceTools] = useState<{ service: ServiceType }[]>([]);
|
|
149
115
|
useEffect(() => {
|
|
150
116
|
log('creating service tools...', { services: services.length });
|
|
151
117
|
queueMicrotask(async () => {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
)
|
|
155
|
-
|
|
156
|
-
setServiceTools(tools);
|
|
118
|
+
// TODO(burdon): Fix.
|
|
119
|
+
// const tools = await Promise.all(
|
|
120
|
+
// services.map(async (service) => ({ service, tools: await createToolsFromService(service) })),
|
|
121
|
+
// );
|
|
122
|
+
// setServiceTools(tools);
|
|
157
123
|
});
|
|
158
124
|
}, [services]);
|
|
159
125
|
|
|
160
126
|
// Deployed functions.
|
|
161
|
-
const functions = useQuery(
|
|
127
|
+
const functions = useQuery(db, Filter.type(Function.Function));
|
|
162
128
|
|
|
163
129
|
return (
|
|
164
130
|
<Toolbox
|
|
165
131
|
classNames={classNames}
|
|
166
|
-
blueprints={processor?.context.
|
|
167
|
-
artifacts={artifactDefinitions}
|
|
132
|
+
blueprints={processor?.context.getBlueprints()}
|
|
168
133
|
services={serviceTools}
|
|
169
134
|
functions={functions}
|
|
170
135
|
/>
|
|
171
136
|
);
|
|
172
137
|
};
|
|
138
|
+
|
|
139
|
+
const safeToolId = (name: string) => {
|
|
140
|
+
return name.split('_').pop();
|
|
141
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type EditorView } from '@codemirror/view';
|
|
6
|
+
import * as LanguageModel from '@effect/ai/LanguageModel';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
import type * as Runtime from 'effect/Runtime';
|
|
9
|
+
import React, { useState } from 'react';
|
|
10
|
+
|
|
11
|
+
import { runInRuntime } from '@dxos/effect';
|
|
12
|
+
import { log } from '@dxos/log';
|
|
13
|
+
import { Button, Icon, Input, ThemeProvider } from '@dxos/react-ui';
|
|
14
|
+
|
|
15
|
+
export interface AssistantToolbarProps {
|
|
16
|
+
view: EditorView;
|
|
17
|
+
from: number;
|
|
18
|
+
to: number;
|
|
19
|
+
runtime: Runtime.Runtime<LanguageModel.LanguageModel>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const AssistantToolbar = ({ view, from, to, runtime }: AssistantToolbarProps) => {
|
|
23
|
+
const [isProcessing, setIsProcessing] = useState(false);
|
|
24
|
+
const [showPromptInput, setShowPromptInput] = useState(false);
|
|
25
|
+
const [customPrompt, setCustomPrompt] = useState('');
|
|
26
|
+
|
|
27
|
+
const runEffect = async (text: string, prompt: string) => {
|
|
28
|
+
setIsProcessing(true);
|
|
29
|
+
try {
|
|
30
|
+
const newText = await runInRuntime(
|
|
31
|
+
runtime,
|
|
32
|
+
Effect.gen(function* () {
|
|
33
|
+
// Construct meaningful system prompt context
|
|
34
|
+
const response = yield* LanguageModel.generateText({
|
|
35
|
+
prompt: `${prompt}:\n"${text}"`,
|
|
36
|
+
});
|
|
37
|
+
return response.text;
|
|
38
|
+
}),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
// Apply change - check if selection is still valid/same?
|
|
42
|
+
// For simple demo, we just apply to the passed from/to, but ideally we check current selection.
|
|
43
|
+
// We can just rely on from/to passed as props, assuming the toolbar unmounts if selection changes.
|
|
44
|
+
view.dispatch({
|
|
45
|
+
changes: { from, to, insert: newText },
|
|
46
|
+
});
|
|
47
|
+
} catch (e) {
|
|
48
|
+
log.error('Assistant action failed', { error: e });
|
|
49
|
+
} finally {
|
|
50
|
+
setIsProcessing(false);
|
|
51
|
+
setShowPromptInput(false);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const currentText = view.state.sliceDoc(from, to);
|
|
56
|
+
|
|
57
|
+
const handleRegenerate = () => {
|
|
58
|
+
void runEffect(
|
|
59
|
+
currentText,
|
|
60
|
+
'You are a typewriting agent. Agent only outputs the result; one version; no explanation or formatting. Re-write the following text to be more clear and concise, keep the same meaning.',
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const handleCasual = () => handleChangeTone('casual');
|
|
65
|
+
const handleFormal = () => handleChangeTone('formal');
|
|
66
|
+
|
|
67
|
+
const handleChangeTone = (tone: 'formal' | 'casual') => {
|
|
68
|
+
void runEffect(
|
|
69
|
+
currentText,
|
|
70
|
+
`You are a typewriting agent. Agent only outputs the result; one version; no explanation or formatting. Rewrite the following text to be more ${tone}`,
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const handleEditWithPrompt = () => {
|
|
75
|
+
if (!customPrompt) return;
|
|
76
|
+
void runEffect(currentText, customPrompt);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<ThemeProvider>
|
|
81
|
+
{showPromptInput ? (
|
|
82
|
+
<div
|
|
83
|
+
className='flex items-center gap-2 p-1 bg-white/90 dark:bg-neutral-800/90 backdrop-blur-md rounded-full shadow-xl border border-neutral-200 dark:border-neutral-700 animate-in fade-in zoom-in-95 duration-150 mt-2'
|
|
84
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
85
|
+
>
|
|
86
|
+
<Input.Root>
|
|
87
|
+
<Input.TextInput
|
|
88
|
+
placeholder='Instruction...'
|
|
89
|
+
value={customPrompt}
|
|
90
|
+
onChange={(e) => setCustomPrompt(e.target.value)}
|
|
91
|
+
onKeyDown={(e) => {
|
|
92
|
+
if (e.key === 'Enter') handleEditWithPrompt();
|
|
93
|
+
if (e.key === 'Escape') setShowPromptInput(false);
|
|
94
|
+
e.stopPropagation();
|
|
95
|
+
}}
|
|
96
|
+
autoFocus
|
|
97
|
+
classNames='border-none bg-transparent focus-visible:ring-0 p-1 text-sm min-w-[200px]'
|
|
98
|
+
/>
|
|
99
|
+
</Input.Root>
|
|
100
|
+
<Button
|
|
101
|
+
variant='ghost'
|
|
102
|
+
classNames='p-1 min-bs-0 bs-6 is-6 rounded-full'
|
|
103
|
+
onClick={handleEditWithPrompt}
|
|
104
|
+
disabled={!customPrompt || isProcessing}
|
|
105
|
+
>
|
|
106
|
+
<Icon icon='ph--arrows-clockwise--regular' classNames={isProcessing ? 'animate-spin' : ''} />
|
|
107
|
+
</Button>
|
|
108
|
+
</div>
|
|
109
|
+
) : (
|
|
110
|
+
<div
|
|
111
|
+
className='flex items-center gap-1 p-1 bg-white/50 dark:bg-neutral-800/50 backdrop-blur-md rounded-xl shadow-xl border border-neutral-200 dark:border-neutral-700 animate-in fade-in zoom-in-95 duration-150 mt-2'
|
|
112
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
113
|
+
>
|
|
114
|
+
<div className='flex items-center gap-1'>
|
|
115
|
+
<Button
|
|
116
|
+
variant='ghost'
|
|
117
|
+
classNames='flex flex-col items-center gap-1 p-1 h-auto w-auto rounded-lg hover:bg-neutral-100 dark:hover:bg-neutral-700'
|
|
118
|
+
onClick={handleCasual}
|
|
119
|
+
disabled={isProcessing}
|
|
120
|
+
>
|
|
121
|
+
<Icon icon='ph--caret-left--regular' size={4} />
|
|
122
|
+
<span className='text-[10px] leading-none text-neutral-500 font-medium'>Casual</span>
|
|
123
|
+
</Button>
|
|
124
|
+
|
|
125
|
+
<Button
|
|
126
|
+
variant='ghost'
|
|
127
|
+
classNames='flex flex-col items-center gap-1 p-1 h-auto w-auto rounded-lg hover:bg-neutral-100 dark:hover:bg-neutral-700'
|
|
128
|
+
onClick={handleRegenerate}
|
|
129
|
+
disabled={isProcessing}
|
|
130
|
+
>
|
|
131
|
+
<Icon icon='ph--arrows-clockwise--regular' size={4} classNames={isProcessing ? 'animate-spin' : ''} />
|
|
132
|
+
<span className='text-[10px] leading-none text-neutral-500 font-medium'>Different</span>
|
|
133
|
+
</Button>
|
|
134
|
+
|
|
135
|
+
<Button
|
|
136
|
+
variant='ghost'
|
|
137
|
+
classNames='flex flex-col gap-1 p-1 h-auto w-auto rounded-lg hover:bg-neutral-100 dark:hover:bg-neutral-700'
|
|
138
|
+
onClick={handleFormal}
|
|
139
|
+
disabled={isProcessing}
|
|
140
|
+
>
|
|
141
|
+
<Icon icon='ph--caret-right--regular' size={4} />
|
|
142
|
+
<span className='text-[10px] leading-none text-neutral-500 font-medium'>Formal</span>
|
|
143
|
+
</Button>
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
<div className='w-px h-8 bg-neutral-200 dark:bg-neutral-700 mx-1' />
|
|
147
|
+
|
|
148
|
+
<Button
|
|
149
|
+
variant='ghost'
|
|
150
|
+
classNames='flex flex-col gap-1 p-1 h-auto w-auto rounded-lg hover:bg-neutral-100 dark:hover:bg-neutral-700'
|
|
151
|
+
onClick={() => setShowPromptInput(true)}
|
|
152
|
+
disabled={isProcessing}
|
|
153
|
+
>
|
|
154
|
+
<Icon icon='ph--keyboard--regular' size={4} />
|
|
155
|
+
<span className='text-[10px] leading-none text-neutral-500 font-medium'>Instruct</span>
|
|
156
|
+
</Button>
|
|
157
|
+
</div>
|
|
158
|
+
)}
|
|
159
|
+
</ThemeProvider>
|
|
160
|
+
);
|
|
161
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import type * as LanguageModel from '@effect/ai/LanguageModel';
|
|
6
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
7
|
+
import * as Layer from 'effect/Layer';
|
|
8
|
+
import * as ManagedRuntime from 'effect/ManagedRuntime';
|
|
9
|
+
import type * as Runtime from 'effect/Runtime';
|
|
10
|
+
import React, { useEffect, useState } from 'react';
|
|
11
|
+
|
|
12
|
+
import { AiService } from '@dxos/ai';
|
|
13
|
+
import { AiServiceTestingPreset } from '@dxos/ai/testing';
|
|
14
|
+
|
|
15
|
+
import { Typewriter } from './Typewriter';
|
|
16
|
+
|
|
17
|
+
const meta: Meta<typeof Typewriter> = {
|
|
18
|
+
title: 'plugins/plugin-assistant/Typewriter',
|
|
19
|
+
component: Typewriter,
|
|
20
|
+
parameters: {
|
|
21
|
+
layout: 'centered',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
|
|
27
|
+
type Story = StoryObj<typeof Typewriter>;
|
|
28
|
+
|
|
29
|
+
const sampleText = `# The Future of Artificial Intelligence
|
|
30
|
+
|
|
31
|
+
Artificial Intelligence (AI) has rapidly evolved from a theoretical concept to a transformative force reshaping industries, economies, and daily life. At its core, AI refers to the development of computer systems capable of performing tasks that typically require human intelligence, such as visual perception, speech recognition, decision-making, and language translation.
|
|
32
|
+
|
|
33
|
+
## Machine Learning and Neural Networks
|
|
34
|
+
|
|
35
|
+
The resurgence of AI in recent years is largely driven by advancements in machine learning (ML) and deep learning. Neural networks, inspired by the human brain's architecture, enable computers to learn from vast amounts of data. This has led to breakthroughs in areas like natural language processing (NLP), allowing models like GPT-4 to generate human-like text and code.
|
|
36
|
+
|
|
37
|
+
## Ethical Considerations
|
|
38
|
+
|
|
39
|
+
As AI becomes more autonomous, ethical concerns have moved to the forefront. Issues such as algorithmic bias, data privacy, and the potential displacement of jobs are critical topics of debate. Ensuring that AI systems are fair, transparent, and aligned with human values is essential for their sustainable development.
|
|
40
|
+
|
|
41
|
+
## Conclusion
|
|
42
|
+
|
|
43
|
+
The journey of AI is just beginning. With responsible innovation and global collaboration, AI has the potential to solve some of humanity's most pressing challenges, from climate change to personalized medicine.
|
|
44
|
+
|
|
45
|
+
(try selecting some text to see the AI assistant, or wait for the proofreader to find the typo below)
|
|
46
|
+
|
|
47
|
+
The quick brown fox jumps over teh lazy dog. i think this is cool.
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
export const Default: Story = {
|
|
51
|
+
render: () => {
|
|
52
|
+
const [rtEffect, setRtEffect] = useState<Runtime.Runtime<LanguageModel.LanguageModel>>();
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
let disposed = false;
|
|
55
|
+
const rt = ManagedRuntime.make(
|
|
56
|
+
AiService.model('@anthropic/claude-haiku-4-5').pipe(
|
|
57
|
+
Layer.provide(AiServiceTestingPreset('edge-remote')),
|
|
58
|
+
Layer.orDie,
|
|
59
|
+
),
|
|
60
|
+
);
|
|
61
|
+
queueMicrotask(async () => {
|
|
62
|
+
if (disposed) return;
|
|
63
|
+
const x = await rt.runtime();
|
|
64
|
+
if (disposed) return;
|
|
65
|
+
setRtEffect(x);
|
|
66
|
+
});
|
|
67
|
+
return () => {
|
|
68
|
+
disposed = true;
|
|
69
|
+
void rt.dispose();
|
|
70
|
+
};
|
|
71
|
+
}, []);
|
|
72
|
+
|
|
73
|
+
if (!rtEffect) {
|
|
74
|
+
return <div>...Loading</div>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<div className='w-[800px] p-4'>
|
|
79
|
+
<Typewriter initialContent={sampleText} runtime={rtEffect} />
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Extension } from '@codemirror/state';
|
|
6
|
+
import type * as LanguageModel from '@effect/ai/LanguageModel';
|
|
7
|
+
import type * as Runtime from 'effect/Runtime';
|
|
8
|
+
import React, { useMemo, useRef } from 'react';
|
|
9
|
+
|
|
10
|
+
import { DensityProvider, ThemeProvider } from '@dxos/react-ui';
|
|
11
|
+
import { Editor, type EditorController } from '@dxos/react-ui-editor';
|
|
12
|
+
import {
|
|
13
|
+
createBasicExtensions,
|
|
14
|
+
createMarkdownExtensions,
|
|
15
|
+
createThemeExtensions,
|
|
16
|
+
decorateMarkdown,
|
|
17
|
+
} from '@dxos/ui-editor';
|
|
18
|
+
|
|
19
|
+
import { assistant } from './assistant-extension';
|
|
20
|
+
|
|
21
|
+
export type TypewriterProps = {
|
|
22
|
+
initialContent?: string;
|
|
23
|
+
extensions?: Extension[];
|
|
24
|
+
runtime: Runtime.Runtime<LanguageModel.LanguageModel>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Typewriter = ({ initialContent = '', extensions = [], runtime }: TypewriterProps) => {
|
|
28
|
+
const editorRef = useRef<EditorController>(null);
|
|
29
|
+
const extension = useMemo(
|
|
30
|
+
() => [
|
|
31
|
+
createBasicExtensions({ scrollPastEnd: true, search: true }),
|
|
32
|
+
createThemeExtensions({ syntaxHighlighting: true }),
|
|
33
|
+
createMarkdownExtensions(),
|
|
34
|
+
decorateMarkdown(),
|
|
35
|
+
assistant(runtime),
|
|
36
|
+
...extensions,
|
|
37
|
+
],
|
|
38
|
+
[runtime, extensions],
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<ThemeProvider>
|
|
43
|
+
<DensityProvider density='fine'>
|
|
44
|
+
<div className='is-full bs-full grid overflow-hidden'>
|
|
45
|
+
<Editor.Root ref={editorRef}>
|
|
46
|
+
<Editor.Viewport>
|
|
47
|
+
<Editor.Content initialValue={initialContent} extensions={extension} />
|
|
48
|
+
</Editor.Viewport>
|
|
49
|
+
</Editor.Root>
|
|
50
|
+
</div>
|
|
51
|
+
</DensityProvider>
|
|
52
|
+
</ThemeProvider>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Diagnostic, linter } from '@codemirror/lint';
|
|
6
|
+
import { type Extension, StateField } from '@codemirror/state';
|
|
7
|
+
import { EditorView, type Tooltip, showTooltip } from '@codemirror/view';
|
|
8
|
+
import * as LanguageModel from '@effect/ai/LanguageModel';
|
|
9
|
+
import * as Effect from 'effect/Effect';
|
|
10
|
+
import * as Runtime from 'effect/Runtime';
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { createRoot } from 'react-dom/client';
|
|
13
|
+
|
|
14
|
+
import { unwrapExit } from '@dxos/effect';
|
|
15
|
+
import { log } from '@dxos/log';
|
|
16
|
+
|
|
17
|
+
import { AssistantToolbar } from './AssistantToolbar';
|
|
18
|
+
|
|
19
|
+
export const assistant = (runtime: Runtime.Runtime<LanguageModel.LanguageModel>): Extension[] => {
|
|
20
|
+
return [
|
|
21
|
+
assistantState(runtime),
|
|
22
|
+
assistantLinter(runtime),
|
|
23
|
+
EditorView.baseTheme({
|
|
24
|
+
'.cm-tooltip-assistant': {
|
|
25
|
+
backgroundColor: 'transparent !important',
|
|
26
|
+
border: 'none !important',
|
|
27
|
+
padding: '0 !important',
|
|
28
|
+
},
|
|
29
|
+
}),
|
|
30
|
+
];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//
|
|
34
|
+
// Toolbar State & Tooltip
|
|
35
|
+
//
|
|
36
|
+
|
|
37
|
+
const assistantState = (runtime: Runtime.Runtime<LanguageModel.LanguageModel>) =>
|
|
38
|
+
StateField.define<Tooltip | null>({
|
|
39
|
+
create: () => null,
|
|
40
|
+
update: (tooltip, tr): Tooltip | null => {
|
|
41
|
+
if (tr.selection || tr.docChanged) {
|
|
42
|
+
const { from, to } = tr.state.selection.main;
|
|
43
|
+
if (from === to) {
|
|
44
|
+
return null;
|
|
45
|
+
} // No selection
|
|
46
|
+
|
|
47
|
+
// Check if we should show tooltip
|
|
48
|
+
// We return a tooltip object
|
|
49
|
+
return {
|
|
50
|
+
pos: from,
|
|
51
|
+
above: false,
|
|
52
|
+
strictSide: true,
|
|
53
|
+
create: (view) => {
|
|
54
|
+
const dom = document.createElement('div');
|
|
55
|
+
dom.classList.add('cm-tooltip-assistant');
|
|
56
|
+
const root = createRoot(dom);
|
|
57
|
+
|
|
58
|
+
root.render(React.createElement(AssistantToolbar, { view, runtime, from, to }));
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
dom,
|
|
62
|
+
destroy: () => {
|
|
63
|
+
// Delay unmount to allow animations if needed, but for now just cleanup
|
|
64
|
+
setTimeout(() => root.unmount(), 0);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return tooltip;
|
|
71
|
+
},
|
|
72
|
+
provide: (f) => showTooltip.from(f),
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
//
|
|
76
|
+
// Linter
|
|
77
|
+
//
|
|
78
|
+
|
|
79
|
+
const assistantLinter = (runtime: Runtime.Runtime<LanguageModel.LanguageModel>) =>
|
|
80
|
+
linter(async (view) => {
|
|
81
|
+
const text = view.state.doc.toString();
|
|
82
|
+
if (text.length < 10) {
|
|
83
|
+
return [];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Run proofreading effect
|
|
87
|
+
const prompt = `Proofread the following text. Identify typos and simple grammar mistakes. Return ONLY a valid JSON array of objects with fields: "original" (string), "replacement" (string), "context" (string, 3-5 words around match). Text: \n\n${text}`;
|
|
88
|
+
|
|
89
|
+
// We mocked the model behavior in the story, but here we assume the model returns a string.
|
|
90
|
+
// In a real implementation we would parse the JSON.
|
|
91
|
+
// For this refactor, we just wire it up.
|
|
92
|
+
|
|
93
|
+
// NOTE: This runs on every doc view update that triggers linter. Linter is debounced by default (750ms).
|
|
94
|
+
|
|
95
|
+
try {
|
|
96
|
+
const result = unwrapExit(
|
|
97
|
+
await Effect.gen(function* () {
|
|
98
|
+
const generated = yield* LanguageModel.generateText({ prompt });
|
|
99
|
+
return generated.text;
|
|
100
|
+
}).pipe(Runtime.runPromiseExit(runtime)),
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
// Parse result - assuming simpler mock response format for now or we build a robust parser
|
|
104
|
+
// For the purpose of this task (UX demo), we can assume the mock returns a specific format or we parse it.
|
|
105
|
+
// Let's assume the mock returns a JSON string.
|
|
106
|
+
|
|
107
|
+
let suggestions: any[] = [];
|
|
108
|
+
try {
|
|
109
|
+
// Find JSON in response
|
|
110
|
+
const match = result.match(/\[.*\]/s);
|
|
111
|
+
if (match) {
|
|
112
|
+
suggestions = JSON.parse(match[0]);
|
|
113
|
+
}
|
|
114
|
+
} catch (e) {
|
|
115
|
+
// failed to parse
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const diagnostics: Diagnostic[] = [];
|
|
119
|
+
for (const s of suggestions) {
|
|
120
|
+
// Naive finding of position
|
|
121
|
+
const idx = text.indexOf(s.original);
|
|
122
|
+
if (idx !== -1) {
|
|
123
|
+
diagnostics.push({
|
|
124
|
+
from: idx,
|
|
125
|
+
to: idx + s.original.length,
|
|
126
|
+
severity: 'info',
|
|
127
|
+
message: `Suggestion: ${s.replacement}`,
|
|
128
|
+
actions: [
|
|
129
|
+
{
|
|
130
|
+
name: 'Apply',
|
|
131
|
+
apply: (view, from, to) => {
|
|
132
|
+
view.dispatch({ changes: { from, to, insert: s.replacement } });
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return diagnostics;
|
|
140
|
+
} catch (e) {
|
|
141
|
+
log.error('Proofreading failed', { error: e });
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
144
|
+
});
|
package/src/components/index.ts
CHANGED
|
@@ -6,15 +6,11 @@ import { lazy } from 'react';
|
|
|
6
6
|
|
|
7
7
|
export * from './AssistantSettings';
|
|
8
8
|
export * from './Chat';
|
|
9
|
-
export * from './PromptSettings';
|
|
10
9
|
export * from './TemplateEditor';
|
|
11
10
|
export * from './Toolbox';
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// https://github.com/microsoft/fluentui/issues/34020
|
|
16
|
-
|
|
17
|
-
export const BlueprintContainer = lazy(() => import('./BlueprintContainer'));
|
|
12
|
+
export const BlueprintArticle = lazy(() => import('./BlueprintArticle'));
|
|
13
|
+
export const ChatCompanion = lazy(() => import('./ChatCompanion'));
|
|
18
14
|
export const ChatContainer = lazy(() => import('./ChatContainer'));
|
|
19
15
|
export const ChatDialog = lazy(() => import('./ChatDialog'));
|
|
20
|
-
export const
|
|
16
|
+
export const PromptArticle = lazy(() => import('./PromptArticle'));
|