@dxos/plugin-assistant 0.8.4-main.ae835ea → 0.8.4-main.bc674ce
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/blueprints/index.mjs +12 -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-WBG5PTSX.mjs → chunk-EXVT7D4B.mjs} +1 -1
- package/dist/lib/browser/chunk-EXVT7D4B.mjs.map +7 -0
- package/dist/lib/browser/{chunk-L5OA5OGS.mjs → chunk-ML3QCFKA.mjs} +40 -37
- 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 +201 -214
- 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 +8 -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-CFCUD2VC.mjs → blueprint-definition-SEMDEIYG.mjs} +6 -5
- 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-MSBPC4RJ.mjs +42 -0
- package/dist/lib/node-esm/chunk-MSBPC4RJ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-WE6KTH72.mjs → chunk-POWB2BPC.mjs} +1 -1
- 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-7ZYOYW7F.mjs → chunk-ZRIPP7YF.mjs} +40 -37
- package/dist/lib/node-esm/chunk-ZRIPP7YF.mjs.map +7 -0
- package/dist/lib/node-esm/{edge-model-resolver-2ARXDOYS.mjs → edge-model-resolver-G5KMODPO.mjs} +9 -7
- package/dist/lib/node-esm/edge-model-resolver-G5KMODPO.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +201 -214
- 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 +8 -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 +10 -11
- 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 +21 -12
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +5 -1
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts +2 -2
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer.d.ts +13 -5
- 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.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +3 -3
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +3 -3
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +7 -10
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +128 -73
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts +12 -6
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +112 -60
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +11 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +113 -61
- 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 -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 +10 -8
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +4 -5
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +112 -60
- 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 -5
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/functions/index.d.ts +1 -1
- package/dist/types/src/functions/index.d.ts.map +1 -1
- package/dist/types/src/functions/object-list.d.ts +2 -2
- package/dist/types/src/functions/object-list.d.ts.map +1 -1
- package/dist/types/src/functions/object-load.d.ts +1 -1
- package/dist/types/src/functions/object-load.d.ts.map +1 -1
- 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 +2 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +5 -5
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +3 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +3 -3
- 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 +2 -2
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextObjects.d.ts +7 -7
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -1
- 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/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +17 -16
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/processor/update-name.d.ts.map +1 -1
- package/dist/types/src/queue-logger.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +5 -4
- package/dist/types/src/testing/test-generator.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +243 -26
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +16 -22
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantAction.d.ts +88 -112
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
- 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/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +10 -212
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +113 -90
- package/src/AssistantPlugin.tsx +70 -105
- 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 +10 -14
- 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 +13 -5
- package/src/components/BlueprintArticle.tsx +29 -0
- package/src/components/Chat/Chat.tsx +160 -125
- package/src/components/Chat/events.ts +7 -1
- package/src/components/ChatCompanion.tsx +132 -105
- package/src/components/ChatContainer.tsx +40 -30
- package/src/components/ChatDialog.tsx +13 -7
- package/src/components/ChatProgress/ChatProgress.tsx +4 -17
- package/src/components/ChatPrompt/ChatActions.tsx +3 -5
- package/src/components/ChatPrompt/ChatOptions.tsx +93 -80
- package/src/components/ChatPrompt/ChatReferences.tsx +7 -8
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +1 -1
- package/src/components/ChatThread/ChatThread.stories.tsx +57 -36
- package/src/components/ChatThread/ChatThread.tsx +26 -36
- package/src/components/ChatThread/Link.tsx +3 -3
- package/src/components/ChatThread/registry.tsx +25 -35
- package/src/components/ChatThread/sync.test.ts +33 -17
- package/src/components/ChatThread/sync.ts +53 -12
- package/src/components/ChatThread/testing/thread.md +37 -0
- package/src/components/PromptArticle.tsx +50 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +12 -4
- package/src/components/TemplateEditor/TemplateEditor.tsx +14 -10
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +15 -7
- package/src/components/TemplateEditor/TemplateForm.tsx +76 -29
- 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 +36 -45
- package/src/components/Toolbox/Toolbox.stories.tsx +9 -10
- package/src/components/Toolbox/Toolbox.tsx +16 -17
- 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 +2 -3
- package/src/functions/index.ts +1 -1
- package/src/functions/object-list.ts +4 -3
- package/src/functions/object-load.ts +7 -5
- package/src/functions/object-search.ts +46 -0
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useBlueprintRegistry.ts +31 -20
- package/src/hooks/useChatProcessor.ts +15 -12
- package/src/hooks/useChatServices.ts +13 -14
- package/src/hooks/useChatToolbarActions.ts +121 -0
- package/src/hooks/useContextBinder.ts +9 -7
- package/src/hooks/useContextObjects.ts +13 -25
- package/src/hooks/useFilteredTypes.ts +37 -0
- package/src/hooks/useReferencesProvider.ts +7 -6
- package/src/index.ts +0 -1
- package/src/meta.ts +2 -2
- package/src/processor/presets.ts +1 -1
- package/src/processor/processor.test.ts +8 -17
- package/src/processor/processor.ts +41 -43
- package/src/processor/update-name.ts +4 -2
- package/src/queue-logger.ts +8 -9
- package/src/testing/test-generator.ts +14 -13
- package/src/testing/test-services.ts +8 -6
- package/src/translations.ts +27 -16
- package/src/types/Assistant.ts +9 -10
- package/src/types/AssistantAction.ts +59 -54
- package/src/types/capabilities.ts +27 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +3 -1
- package/src/types/service.ts +10 -7
- package/dist/lib/browser/BlueprintContainer-GMSYKGSO.mjs +0 -36
- package/dist/lib/browser/BlueprintContainer-GMSYKGSO.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-M3FDKTQM.mjs +0 -151
- package/dist/lib/browser/ChatCompanion-M3FDKTQM.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-KAH7XITI.mjs +0 -74
- package/dist/lib/browser/ChatContainer-KAH7XITI.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-ZWRGABW6.mjs +0 -87
- package/dist/lib/browser/ChatDialog-ZWRGABW6.mjs.map +0 -7
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs +0 -19
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-R5T7BJPC.mjs +0 -183
- package/dist/lib/browser/app-graph-builder-R5T7BJPC.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-AGTDXTXO.mjs +0 -13
- package/dist/lib/browser/chunk-357IHWQL.mjs +0 -1519
- package/dist/lib/browser/chunk-357IHWQL.mjs.map +0 -7
- package/dist/lib/browser/chunk-A2NVNXPL.mjs +0 -170
- package/dist/lib/browser/chunk-A2NVNXPL.mjs.map +0 -7
- package/dist/lib/browser/chunk-CQW6UPJM.mjs +0 -199
- package/dist/lib/browser/chunk-CQW6UPJM.mjs.map +0 -7
- package/dist/lib/browser/chunk-GNI6HL6G.mjs +0 -219
- package/dist/lib/browser/chunk-GNI6HL6G.mjs.map +0 -7
- package/dist/lib/browser/chunk-GXHZTOWJ.mjs +0 -378
- package/dist/lib/browser/chunk-GXHZTOWJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-L5OA5OGS.mjs.map +0 -7
- package/dist/lib/browser/chunk-MEN5WTLA.mjs +0 -182
- package/dist/lib/browser/chunk-MEN5WTLA.mjs.map +0 -7
- package/dist/lib/browser/chunk-PUG24BEC.mjs +0 -277
- package/dist/lib/browser/chunk-PUG24BEC.mjs.map +0 -7
- package/dist/lib/browser/chunk-SJJV3HEX.mjs +0 -16
- package/dist/lib/browser/chunk-SJJV3HEX.mjs.map +0 -7
- package/dist/lib/browser/chunk-WBG5PTSX.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs +0 -18
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-3C5TABOX.mjs +0 -136
- package/dist/lib/browser/intent-resolver-3C5TABOX.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs +0 -17
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs.map +0 -7
- package/dist/lib/browser/react-surface-EYKA5IFU.mjs +0 -90
- package/dist/lib/browser/react-surface-EYKA5IFU.mjs.map +0 -7
- package/dist/lib/browser/settings-VMVBYZLN.mjs +0 -23
- package/dist/lib/browser/settings-VMVBYZLN.mjs.map +0 -7
- package/dist/lib/browser/state-CFREPBB6.mjs +0 -21
- package/dist/lib/browser/state-CFREPBB6.mjs.map +0 -7
- package/dist/lib/browser/toolkit-F3NQ7TSI.mjs +0 -21
- package/dist/lib/browser/toolkit-F3NQ7TSI.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-6GBLMK4Z.mjs +0 -37
- package/dist/lib/node-esm/BlueprintContainer-6GBLMK4Z.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-OV426GCP.mjs +0 -152
- package/dist/lib/node-esm/ChatCompanion-OV426GCP.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-UKY7NHFY.mjs +0 -75
- package/dist/lib/node-esm/ChatContainer-UKY7NHFY.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-2BDQIEXH.mjs +0 -88
- package/dist/lib/node-esm/ChatDialog-2BDQIEXH.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs +0 -20
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-I52RYVWH.mjs +0 -184
- package/dist/lib/node-esm/app-graph-builder-I52RYVWH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2CAETDW2.mjs +0 -183
- package/dist/lib/node-esm/chunk-2CAETDW2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4J5FYNNM.mjs +0 -171
- package/dist/lib/node-esm/chunk-4J5FYNNM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5ARE4R2I.mjs +0 -220
- package/dist/lib/node-esm/chunk-5ARE4R2I.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7ZYOYW7F.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HJPIYMWD.mjs +0 -1520
- package/dist/lib/node-esm/chunk-HJPIYMWD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-O36P4LN5.mjs +0 -200
- package/dist/lib/node-esm/chunk-O36P4LN5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WE6KTH72.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XM4BVQQR.mjs +0 -278
- package/dist/lib/node-esm/chunk-XM4BVQQR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XQBL2SBL.mjs +0 -17
- package/dist/lib/node-esm/chunk-XQBL2SBL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YIO5MEPR.mjs +0 -380
- package/dist/lib/node-esm/chunk-YIO5MEPR.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-HQ27YALS.mjs +0 -137
- package/dist/lib/node-esm/intent-resolver-HQ27YALS.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs +0 -18
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-UOC3CBPH.mjs +0 -91
- package/dist/lib/node-esm/react-surface-UOC3CBPH.mjs.map +0 -7
- package/dist/lib/node-esm/settings-7AUVNDM2.mjs +0 -24
- package/dist/lib/node-esm/settings-7AUVNDM2.mjs.map +0 -7
- package/dist/lib/node-esm/state-XXND44OW.mjs +0 -22
- package/dist/lib/node-esm/state-XXND44OW.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-7CH5UNSQ.mjs +0 -22
- package/dist/lib/node-esm/toolkit-7CH5UNSQ.mjs.map +0 -7
- package/dist/types/src/capabilities/ai-service.d.ts +0 -4
- package/dist/types/src/capabilities/ai-service.d.ts.map +0 -1
- 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/blueprint-definition.d.ts +0 -7
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -11
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/edge-model-resolver.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/local-model-resolver.d.ts +0 -10
- package/dist/types/src/capabilities/local-model-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/capabilities/state.d.ts +0 -4
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/toolkit.d.ts +0 -4
- package/dist/types/src/capabilities/toolkit.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/ChatThread/reducers.d.ts +0 -40
- package/dist/types/src/components/ChatThread/reducers.d.ts.map +0 -1
- package/dist/types/src/components/ChatToolbar/ChatToolbar.d.ts +0 -6
- package/dist/types/src/components/ChatToolbar/ChatToolbar.d.ts.map +0 -1
- package/dist/types/src/components/ChatToolbar/index.d.ts +0 -2
- package/dist/types/src/components/ChatToolbar/index.d.ts.map +0 -1
- package/dist/types/src/components/ChatToolbar/useChatToolbarActions.d.ts +0 -9
- package/dist/types/src/components/ChatToolbar/useChatToolbarActions.d.ts.map +0 -1
- package/dist/types/src/components/TemplateEditor/handlebars-extension.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/functions/analysis.d.ts +0 -5
- package/dist/types/src/functions/analysis.d.ts.map +0 -1
- package/dist/types/src/hooks/useItemTypes.d.ts +0 -4
- package/dist/types/src/hooks/useItemTypes.d.ts.map +0 -1
- package/dist/types/src/toolkits/AssistantToolkit.d.ts +0 -21
- package/dist/types/src/toolkits/AssistantToolkit.d.ts.map +0 -1
- package/dist/types/src/toolkits/SystemToolkit.d.ts +0 -69
- package/dist/types/src/toolkits/SystemToolkit.d.ts.map +0 -1
- package/dist/types/src/toolkits/index.d.ts +0 -3
- package/dist/types/src/toolkits/index.d.ts.map +0 -1
- package/src/capabilities/ai-service.ts +0 -27
- package/src/capabilities/app-graph-builder.ts +0 -194
- package/src/capabilities/blueprint-definition.ts +0 -66
- package/src/capabilities/capabilities.ts +0 -18
- package/src/capabilities/edge-model-resolver.ts +0 -25
- package/src/capabilities/intent-resolver.ts +0 -121
- package/src/capabilities/local-model-resolver.ts +0 -30
- package/src/capabilities/react-surface.tsx +0 -71
- package/src/capabilities/settings.ts +0 -19
- package/src/capabilities/state.ts +0 -20
- package/src/capabilities/toolkit.ts +0 -19
- package/src/components/BlueprintContainer.tsx +0 -30
- package/src/components/ChatThread/reducers.ts +0 -151
- package/src/components/ChatToolbar/ChatToolbar.tsx +0 -23
- package/src/components/ChatToolbar/index.ts +0 -5
- package/src/components/ChatToolbar/useChatToolbarActions.ts +0 -126
- package/src/components/TemplateEditor/handlebars-extension.ts +0 -166
- package/src/events.ts +0 -11
- package/src/functions/analysis.ts +0 -22
- package/src/hooks/useItemTypes.ts +0 -37
- package/src/toolkits/AssistantToolkit.ts +0 -55
- package/src/toolkits/SystemToolkit.ts +0 -292
- package/src/toolkits/index.ts +0 -6
- /package/dist/lib/browser/{blueprint-definition-AGTDXTXO.mjs.map → blueprint-definition-DGHH7MUU.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprint-definition-CFCUD2VC.mjs.map → browser/blueprints/index.mjs.map} +0 -0
- /package/dist/types/src/components/TemplateEditor/{handlebars-extension.d.ts → extensions/handlebars-extension.d.ts} +0 -0
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
6
7
|
import React from 'react';
|
|
7
8
|
|
|
8
|
-
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
-
import { capabilities } from '@dxos/assistant-toolkit';
|
|
10
|
+
import { capabilities } from '@dxos/assistant-toolkit/testing';
|
|
11
11
|
import { ChessPlugin } from '@dxos/plugin-chess';
|
|
12
12
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
13
13
|
import { MapPlugin } from '@dxos/plugin-map';
|
|
14
|
-
import { SpacePlugin } from '@dxos/plugin-space';
|
|
15
14
|
import { TablePlugin } from '@dxos/plugin-table';
|
|
15
|
+
import { corePlugins } from '@dxos/plugin-testing';
|
|
16
16
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
17
17
|
|
|
18
18
|
import { translations } from '../../translations';
|
|
@@ -20,7 +20,7 @@ import { translations } from '../../translations';
|
|
|
20
20
|
import { Toolbox, type ToolboxProps } from './Toolbox';
|
|
21
21
|
|
|
22
22
|
const DefaultStory = (props: ToolboxProps) => {
|
|
23
|
-
return <Toolbox {...props} classNames='
|
|
23
|
+
return <Toolbox {...props} classNames='is-[30rem] bs-[15rem] rounded-sm border border-separator plb-1' />;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const meta = {
|
|
@@ -31,14 +31,13 @@ const meta = {
|
|
|
31
31
|
withTheme,
|
|
32
32
|
withPluginManager({
|
|
33
33
|
plugins: [
|
|
34
|
+
...corePlugins(),
|
|
34
35
|
ClientPlugin({
|
|
35
|
-
onClientInitialized:
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
onClientInitialized: ({ client }) =>
|
|
37
|
+
Effect.gen(function* () {
|
|
38
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
39
|
+
}),
|
|
38
40
|
}),
|
|
39
|
-
SpacePlugin({}),
|
|
40
|
-
SettingsPlugin(),
|
|
41
|
-
IntentPlugin(),
|
|
42
41
|
ChessPlugin(),
|
|
43
42
|
MapPlugin(),
|
|
44
43
|
TablePlugin(),
|
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
import React, { type FC, Fragment, useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { type Blueprint } from '@dxos/blueprints';
|
|
8
|
-
import { type Ref } from '@dxos/echo';
|
|
8
|
+
import { type Database, type Ref } from '@dxos/echo';
|
|
9
9
|
import { Function } from '@dxos/functions';
|
|
10
10
|
import { log } from '@dxos/log';
|
|
11
|
-
import { Filter,
|
|
12
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
13
|
-
import {
|
|
14
|
-
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';
|
|
15
14
|
|
|
16
15
|
import { meta } from '../../meta';
|
|
17
16
|
import { type AiChatProcessor } from '../../processor';
|
|
@@ -21,7 +20,7 @@ export type ToolboxProps = ThemedClassName<{
|
|
|
21
20
|
services?: { service: ServiceType }[];
|
|
22
21
|
functions?: Function.Function[];
|
|
23
22
|
// TODO(burdon): Combine into single array.
|
|
24
|
-
blueprints?: readonly
|
|
23
|
+
blueprints?: readonly Blueprint.Blueprint[];
|
|
25
24
|
activeBlueprints?: readonly Ref.Ref<Blueprint.Blueprint>[];
|
|
26
25
|
}>;
|
|
27
26
|
|
|
@@ -33,10 +32,10 @@ export const Toolbox = ({ classNames, functions, services, blueprints, activeBlu
|
|
|
33
32
|
{blueprints && blueprints.length > 0 && (
|
|
34
33
|
<Section
|
|
35
34
|
title='Blueprints'
|
|
36
|
-
items={blueprints.map(({
|
|
37
|
-
name
|
|
38
|
-
description
|
|
39
|
-
subitems:
|
|
35
|
+
items={blueprints.map(({ name, description, tools }) => ({
|
|
36
|
+
name,
|
|
37
|
+
description,
|
|
38
|
+
subitems: tools.map((toolId) => ({ name: `∙ ${safeToolId(toolId)}` })),
|
|
40
39
|
}))}
|
|
41
40
|
/>
|
|
42
41
|
)}
|
|
@@ -77,11 +76,11 @@ const Section: FC<{
|
|
|
77
76
|
}> = ({ title, items, striped }) => {
|
|
78
77
|
const stripeClassNames = 'odd:bg-neutral-50 dark:odd:bg-neutral-800';
|
|
79
78
|
const gridClassNames = 'grid grid-cols-[8rem_1fr]';
|
|
80
|
-
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);
|
|
81
80
|
|
|
82
81
|
return (
|
|
83
82
|
<div>
|
|
84
|
-
<h1 className='
|
|
83
|
+
<h1 className='pli-2 text-sm'>{title}</h1>
|
|
85
84
|
<div className={gridClassNames}>
|
|
86
85
|
{items.map(({ name, description, subitems }, i) => (
|
|
87
86
|
<Fragment key={i}>
|
|
@@ -105,13 +104,13 @@ const Section: FC<{
|
|
|
105
104
|
};
|
|
106
105
|
|
|
107
106
|
export type ToolboxContainerProps = ThemedClassName<{
|
|
108
|
-
|
|
107
|
+
db?: Database.Database;
|
|
109
108
|
processor?: AiChatProcessor;
|
|
110
109
|
}>;
|
|
111
110
|
|
|
112
|
-
export const ToolboxContainer = ({ classNames,
|
|
111
|
+
export const ToolboxContainer = ({ classNames, db, processor }: ToolboxContainerProps) => {
|
|
113
112
|
// Registered services.
|
|
114
|
-
const services = useQuery(
|
|
113
|
+
const services = useQuery(db, Filter.type(ServiceType));
|
|
115
114
|
const [serviceTools, setServiceTools] = useState<{ service: ServiceType }[]>([]);
|
|
116
115
|
useEffect(() => {
|
|
117
116
|
log('creating service tools...', { services: services.length });
|
|
@@ -125,12 +124,12 @@ export const ToolboxContainer = ({ classNames, space, processor }: ToolboxContai
|
|
|
125
124
|
}, [services]);
|
|
126
125
|
|
|
127
126
|
// Deployed functions.
|
|
128
|
-
const functions = useQuery(
|
|
127
|
+
const functions = useQuery(db, Filter.type(Function.Function));
|
|
129
128
|
|
|
130
129
|
return (
|
|
131
130
|
<Toolbox
|
|
132
131
|
classNames={classNames}
|
|
133
|
-
blueprints={processor?.context.
|
|
132
|
+
blueprints={processor?.context.getBlueprints()}
|
|
134
133
|
services={serviceTools}
|
|
135
134
|
functions={functions}
|
|
136
135
|
/>
|
|
@@ -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,12 +6,11 @@ import { lazy } from 'react';
|
|
|
6
6
|
|
|
7
7
|
export * from './AssistantSettings';
|
|
8
8
|
export * from './Chat';
|
|
9
|
-
export * from './ChatProgress';
|
|
10
|
-
export * from './ChatToolbar';
|
|
11
9
|
export * from './TemplateEditor';
|
|
12
10
|
export * from './Toolbox';
|
|
13
11
|
|
|
14
|
-
export const
|
|
12
|
+
export const BlueprintArticle = lazy(() => import('./BlueprintArticle'));
|
|
15
13
|
export const ChatCompanion = lazy(() => import('./ChatCompanion'));
|
|
16
14
|
export const ChatContainer = lazy(() => import('./ChatContainer'));
|
|
17
15
|
export const ChatDialog = lazy(() => import('./ChatDialog'));
|
|
16
|
+
export const PromptArticle = lazy(() => import('./PromptArticle'));
|
package/src/functions/index.ts
CHANGED
|
@@ -6,7 +6,8 @@ import * as Effect from 'effect/Effect';
|
|
|
6
6
|
import * as Schema from 'effect/Schema';
|
|
7
7
|
|
|
8
8
|
import { Filter, Obj, Query } from '@dxos/echo';
|
|
9
|
-
import {
|
|
9
|
+
import { Database } from '@dxos/echo';
|
|
10
|
+
import { defineFunction } from '@dxos/functions';
|
|
10
11
|
import { trim } from '@dxos/util';
|
|
11
12
|
|
|
12
13
|
// TODO(burdon): Move to toolkit (i.e., tool not function).
|
|
@@ -34,10 +35,10 @@ export default defineFunction({
|
|
|
34
35
|
}),
|
|
35
36
|
handler: Effect.fn(function* ({ data: { typename } }) {
|
|
36
37
|
// TODO(wittjosiah): Typename query is not working for dynamic schemas.
|
|
37
|
-
const [schema] = yield*
|
|
38
|
+
const [schema] = yield* Database.Service.runSchemaQuery({ typename });
|
|
38
39
|
const filter = schema ? Filter.type(schema) : Filter.typename(typename);
|
|
39
40
|
|
|
40
|
-
const
|
|
41
|
+
const objects = yield* Database.Service.runQuery(Query.select(filter));
|
|
41
42
|
const results = objects.map((object) => ({
|
|
42
43
|
dxn: Obj.getDXN(object).toString(),
|
|
43
44
|
label: Obj.getLabel(object),
|
|
@@ -8,8 +8,9 @@ import * as Option from 'effect/Option';
|
|
|
8
8
|
import * as Schema from 'effect/Schema';
|
|
9
9
|
|
|
10
10
|
import { ArtifactId } from '@dxos/assistant';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { Entity } from '@dxos/echo';
|
|
12
|
+
import { Database } from '@dxos/echo';
|
|
13
|
+
import { defineFunction } from '@dxos/functions';
|
|
13
14
|
|
|
14
15
|
// TODO(burdon): Move to toolkit (i.e., tool not function).
|
|
15
16
|
export default defineFunction({
|
|
@@ -17,6 +18,7 @@ export default defineFunction({
|
|
|
17
18
|
name: 'Load object',
|
|
18
19
|
description: 'Loads the object.',
|
|
19
20
|
inputSchema: Schema.Struct({
|
|
21
|
+
// TODO(dmaretskyi): Use Ref.
|
|
20
22
|
id: ArtifactId.annotations({
|
|
21
23
|
description: 'The ID of the object.',
|
|
22
24
|
}),
|
|
@@ -25,14 +27,14 @@ export default defineFunction({
|
|
|
25
27
|
}),
|
|
26
28
|
}),
|
|
27
29
|
outputSchema: Schema.Struct({
|
|
28
|
-
// TODO(wittjosiah): Type.
|
|
30
|
+
// TODO(wittjosiah): Type.Entity.Any
|
|
29
31
|
object: Schema.Any,
|
|
30
32
|
}),
|
|
31
33
|
handler: Effect.fn(function* ({ data: { id, typename } }) {
|
|
32
|
-
const object = yield*
|
|
34
|
+
const object = yield* Database.Service.resolve(ArtifactId.toDXN(id));
|
|
33
35
|
return yield* Function.pipe(
|
|
34
36
|
Option.fromNullable(object),
|
|
35
|
-
Option.flatMap((object) => (
|
|
37
|
+
Option.flatMap((object) => (Entity.getTypename(object) === typename ? Option.some(object) : Option.none())),
|
|
36
38
|
Option.match({
|
|
37
39
|
onNone: () => Effect.fail('Object not found.'),
|
|
38
40
|
onSome: (object) => {
|