@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,56 +2,86 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { type CSSProperties, forwardRef, useMemo } from 'react';
|
|
5
|
+
import React, { type CSSProperties, forwardRef, useCallback, useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { PublicKey } from '@dxos/keys';
|
|
8
8
|
import { type Identity } from '@dxos/react-client/halo';
|
|
9
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
9
|
+
import { type ThemedClassName, useForwardedRef } from '@dxos/react-ui';
|
|
10
|
+
import { MarkdownStream, type MarkdownStreamController, type MarkdownStreamProps } from '@dxos/react-ui-components';
|
|
11
|
+
import { type Message } from '@dxos/types';
|
|
12
|
+
import { mx } from '@dxos/ui-theme';
|
|
13
13
|
import { keyToFallback } from '@dxos/util';
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
|
|
15
|
+
import { type ChatEvent } from '../Chat';
|
|
16
|
+
|
|
17
|
+
import { blockToMarkdown, componentRegistry } from './registry';
|
|
18
|
+
import { MessageSyncer } from './sync';
|
|
17
19
|
|
|
18
20
|
export type ChatThreadProps = ThemedClassName<
|
|
19
21
|
{
|
|
20
22
|
identity?: Identity;
|
|
21
|
-
messages?:
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
messages?: Message.Message[];
|
|
24
|
+
error?: Error;
|
|
25
|
+
onEvent?: (event: ChatEvent) => void;
|
|
26
|
+
} & Pick<MarkdownStreamProps, 'cursor' | 'fadeIn' | 'debug'>
|
|
24
27
|
>;
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
// TODO(burdon): Memo thread position.
|
|
30
|
+
export const ChatThread = forwardRef<MarkdownStreamController, ChatThreadProps>(
|
|
31
|
+
(
|
|
32
|
+
{ classNames, identity, messages = [], error, cursor = false, fadeIn = true, debug = false, onEvent },
|
|
33
|
+
forwardedRef,
|
|
34
|
+
) => {
|
|
35
|
+
const controllerRef = useForwardedRef(forwardedRef);
|
|
36
|
+
const controller = controllerRef.current;
|
|
37
|
+
|
|
38
|
+
const userHue = useMemo(
|
|
39
|
+
() => identity?.profile?.data?.hue || keyToFallback(identity?.identityKey ?? PublicKey.random()).hue,
|
|
40
|
+
[identity],
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
// Show error.
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
controller?.scrollToBottom();
|
|
46
|
+
}, [controller, error]);
|
|
47
|
+
|
|
48
|
+
// Update document.
|
|
49
|
+
const syncer = useMemo(() => controller && new MessageSyncer(controller, blockToMarkdown), [controller]);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
const reset = syncer?.append(messages, true);
|
|
52
|
+
if (reset) {
|
|
53
|
+
controller?.scrollToBottom('instant');
|
|
40
54
|
}
|
|
41
|
-
}, [
|
|
55
|
+
}, [syncer, messages]);
|
|
56
|
+
|
|
57
|
+
// Event adapter.
|
|
58
|
+
const handleEvent = useCallback<NonNullable<MarkdownStreamProps['onEvent']>>(
|
|
59
|
+
({ type, value }) => {
|
|
60
|
+
switch (type) {
|
|
61
|
+
case 'submit': {
|
|
62
|
+
value && onEvent?.({ type, text: value });
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
[onEvent],
|
|
68
|
+
);
|
|
42
69
|
|
|
43
70
|
return (
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
71
|
+
<div
|
|
72
|
+
role='none'
|
|
73
|
+
className={mx('flex bs-full is-full justify-center overflow-hidden', classNames)}
|
|
74
|
+
style={{ '--user-fill': `var(--dx-${userHue}Fill)` } as CSSProperties}
|
|
75
|
+
>
|
|
76
|
+
<MarkdownStream
|
|
77
|
+
ref={controllerRef}
|
|
78
|
+
registry={componentRegistry}
|
|
79
|
+
cursor={cursor}
|
|
80
|
+
fadeIn={fadeIn}
|
|
81
|
+
debug={debug}
|
|
82
|
+
onEvent={handleEvent}
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
55
85
|
);
|
|
56
86
|
},
|
|
57
87
|
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Space } from '@dxos/client/echo';
|
|
8
|
+
import { Entity } from '@dxos/echo';
|
|
9
|
+
import { type DXN } from '@dxos/keys';
|
|
10
|
+
import { DxAnchor } from '@dxos/lit-ui/react';
|
|
11
|
+
|
|
12
|
+
export type ObjectLinkProps = {
|
|
13
|
+
space: Space;
|
|
14
|
+
dxn: DXN;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const ObjectLink = ({ space, dxn }: ObjectLinkProps) => {
|
|
18
|
+
const ref = useMemo(() => space.db.makeRef(dxn), [space, dxn.toString()]);
|
|
19
|
+
|
|
20
|
+
const title = (ref.target && Entity.getLabel(ref.target)) ?? ref.target?.id ?? ref.dxn.toString();
|
|
21
|
+
return (
|
|
22
|
+
<DxAnchor rootclassname='dx-tag--anchor' refid={dxn.toString()}>
|
|
23
|
+
{title}
|
|
24
|
+
</DxAnchor>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { log } from '@dxos/log';
|
|
8
|
+
import { ToggleContainer } from '@dxos/react-ui-components';
|
|
9
|
+
import {
|
|
10
|
+
PromptWidget,
|
|
11
|
+
ReferenceWidget,
|
|
12
|
+
SelectWidget,
|
|
13
|
+
SuggestionWidget,
|
|
14
|
+
SummaryWidget,
|
|
15
|
+
} from '@dxos/react-ui-components';
|
|
16
|
+
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
17
|
+
import { ContentBlock, type Message } from '@dxos/types';
|
|
18
|
+
import { type XmlWidgetProps, type XmlWidgetRegistry, getXmlTextChild } from '@dxos/ui-editor';
|
|
19
|
+
|
|
20
|
+
import { ToolBlock } from '../ToolBlock';
|
|
21
|
+
|
|
22
|
+
import { type BlockRenderer, type MessageThreadContext } from './sync';
|
|
23
|
+
|
|
24
|
+
const Fallback = ({ _tag, ...props }: XmlWidgetProps<MessageThreadContext>) => {
|
|
25
|
+
return (
|
|
26
|
+
<ToggleContainer.Root classNames='rounded-sm'>
|
|
27
|
+
<ToggleContainer.Header classNames='bg-groupSurface'>{_tag}</ToggleContainer.Header>
|
|
28
|
+
<ToggleContainer.Content classNames='bg-modalSurface'>
|
|
29
|
+
<Json classNames='!p-2 text-sm' data={props} />
|
|
30
|
+
</ToggleContainer.Content>
|
|
31
|
+
</ToggleContainer.Root>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Custom XML tags registry.
|
|
37
|
+
*/
|
|
38
|
+
export const componentRegistry: XmlWidgetRegistry = {
|
|
39
|
+
//
|
|
40
|
+
// Widgets
|
|
41
|
+
//
|
|
42
|
+
|
|
43
|
+
['prompt' as const]: {
|
|
44
|
+
block: true,
|
|
45
|
+
factory: ({ children }) => {
|
|
46
|
+
const text = getXmlTextChild(children);
|
|
47
|
+
return text ? new PromptWidget(text) : null;
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
['reference' as const]: {
|
|
51
|
+
block: false,
|
|
52
|
+
factory: ({ children, ref }) => {
|
|
53
|
+
const text = getXmlTextChild(children);
|
|
54
|
+
return text && ref ? new ReferenceWidget(text, ref) : null;
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
['select' as const]: {
|
|
58
|
+
block: true,
|
|
59
|
+
factory: ({ children }) => {
|
|
60
|
+
const options = children
|
|
61
|
+
?.map((option: any) => option._tag === 'option' && getXmlTextChild(option.children))
|
|
62
|
+
.filter(Boolean);
|
|
63
|
+
return options?.length ? new SelectWidget(options) : null;
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
['suggestion' as const]: {
|
|
67
|
+
block: true,
|
|
68
|
+
factory: ({ children }) => {
|
|
69
|
+
const text = getXmlTextChild(children);
|
|
70
|
+
return text ? new SuggestionWidget(text) : null;
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
['summary' as const]: {
|
|
74
|
+
block: true,
|
|
75
|
+
factory: ({ children }) => {
|
|
76
|
+
const text = getXmlTextChild(children);
|
|
77
|
+
return text ? new SummaryWidget(text) : null;
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
//
|
|
82
|
+
// React
|
|
83
|
+
//
|
|
84
|
+
|
|
85
|
+
['toolCall' as const]: {
|
|
86
|
+
block: true,
|
|
87
|
+
Component: ToolBlock,
|
|
88
|
+
},
|
|
89
|
+
['toolResult' as const]: {
|
|
90
|
+
block: true,
|
|
91
|
+
Component: Fallback,
|
|
92
|
+
},
|
|
93
|
+
['toolkit' as const]: {
|
|
94
|
+
block: true,
|
|
95
|
+
Component: Fallback,
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
//
|
|
99
|
+
// Fallback
|
|
100
|
+
//
|
|
101
|
+
|
|
102
|
+
['json' as const]: {
|
|
103
|
+
block: true,
|
|
104
|
+
Component: Fallback,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Convert block to markdown.
|
|
110
|
+
*/
|
|
111
|
+
export const blockToMarkdown: BlockRenderer = (
|
|
112
|
+
context: MessageThreadContext,
|
|
113
|
+
message: Message.Message,
|
|
114
|
+
block: ContentBlock.Any,
|
|
115
|
+
) => {
|
|
116
|
+
let str = blockToMarkdownImpl(context, message, block);
|
|
117
|
+
if (str && !block.pending) {
|
|
118
|
+
return (str += '\n');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return str;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const blockToMarkdownImpl = (context: MessageThreadContext, message: Message.Message, block: ContentBlock.Any) => {
|
|
125
|
+
log('blockToMarkdown', { block: JSON.stringify(block) });
|
|
126
|
+
switch (block._tag) {
|
|
127
|
+
case 'text': {
|
|
128
|
+
if (message.sender.role === 'user') {
|
|
129
|
+
return `<prompt>${block.text}</prompt>`;
|
|
130
|
+
} else {
|
|
131
|
+
const text = block.text.trim();
|
|
132
|
+
if (text.length > 0) {
|
|
133
|
+
return text;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
case 'reference': {
|
|
139
|
+
const dxn = block.reference.dxn;
|
|
140
|
+
return `<reference ref="${dxn.toString()}">${context.getObjectLabel(dxn)}</reference>`;
|
|
141
|
+
}
|
|
142
|
+
case 'suggestion': {
|
|
143
|
+
if (block.pending) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
return `<suggestion>${block.text}</suggestion>`;
|
|
147
|
+
}
|
|
148
|
+
case 'select': {
|
|
149
|
+
if (block.pending || block.options.length === 0) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
return `<select>${block.options.map((option) => `<option>${option}</option>`).join('')}</select>`;
|
|
153
|
+
}
|
|
154
|
+
case 'toolCall': {
|
|
155
|
+
context.updateWidget<{ blocks: ContentBlock.Any[] }>(block.toolCallId, {
|
|
156
|
+
blocks: [block],
|
|
157
|
+
});
|
|
158
|
+
return `<toolCall id="${block.toolCallId}" />`;
|
|
159
|
+
}
|
|
160
|
+
case 'toolResult': {
|
|
161
|
+
context.updateWidget<{ blocks: ContentBlock.Any[] }>(block.toolCallId, ({ blocks = [] }) => ({
|
|
162
|
+
blocks: [...blocks, block],
|
|
163
|
+
}));
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
case 'summary': {
|
|
167
|
+
return `<summary>${ContentBlock.createSummaryMessage(block)}</summary>`;
|
|
168
|
+
}
|
|
169
|
+
default: {
|
|
170
|
+
// TODO(burdon): Needs stable ID.
|
|
171
|
+
return `<json id="${message.id}">\n${JSON.stringify(block)}\n</json>`;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { EditorView } from '@codemirror/view';
|
|
6
|
+
import { describe, it } from '@effect/vitest';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
import { type Mutable } from '@dxos/echo/internal';
|
|
11
|
+
import { type ContentBlock } from '@dxos/types';
|
|
12
|
+
|
|
13
|
+
import { createMessage } from '../../testing';
|
|
14
|
+
|
|
15
|
+
import { blockToMarkdown } from './registry';
|
|
16
|
+
import { MessageSyncer, type TextModel } from './sync';
|
|
17
|
+
|
|
18
|
+
class TestDocument implements TextModel {
|
|
19
|
+
private readonly _view = new EditorView({ extensions: [] });
|
|
20
|
+
|
|
21
|
+
get view() {
|
|
22
|
+
return this._view;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get content() {
|
|
26
|
+
return this._view.state.doc.toString();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async reset(text: string) {
|
|
30
|
+
this._view.dispatch({
|
|
31
|
+
changes: { from: 0, to: this._view.state.doc.length, insert: text },
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async append(text: string) {
|
|
36
|
+
this._view.dispatch({
|
|
37
|
+
changes: { from: this._view.state.doc.length, insert: text },
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
updateWidget(_id: string, _value: any) {}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
describe('reducers', () => {
|
|
45
|
+
it.effect(
|
|
46
|
+
'basic sync',
|
|
47
|
+
Effect.fn(function* ({ expect }) {
|
|
48
|
+
const doc = new TestDocument();
|
|
49
|
+
const syncer = new MessageSyncer(doc, blockToMarkdown);
|
|
50
|
+
|
|
51
|
+
const messages = [
|
|
52
|
+
createMessage('user', [{ _tag: 'text', text: 'Hello' }]),
|
|
53
|
+
createMessage('assistant', [{ _tag: 'text', text: 'Hi there!' }]),
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
syncer.append(messages);
|
|
57
|
+
expect(doc.content).toEqual(['<prompt>Hello</prompt>', 'Hi there!', ''].join('\n'));
|
|
58
|
+
|
|
59
|
+
Obj.change(messages[1], (m) => {
|
|
60
|
+
m.blocks.push({ _tag: 'text', text: 'How can I help?' });
|
|
61
|
+
});
|
|
62
|
+
syncer.append(messages);
|
|
63
|
+
expect(doc.content).toEqual(['<prompt>Hello</prompt>', 'Hi there!', 'How can I help?', ''].join('\n'));
|
|
64
|
+
}),
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
it.effect(
|
|
68
|
+
'sync with partial updates',
|
|
69
|
+
Effect.fn(function* ({ expect }) {
|
|
70
|
+
const doc = new TestDocument();
|
|
71
|
+
const syncer = new MessageSyncer(doc, blockToMarkdown);
|
|
72
|
+
|
|
73
|
+
const messages = [
|
|
74
|
+
createMessage('user', [{ _tag: 'text', text: 'Hello' }]),
|
|
75
|
+
createMessage('assistant', [{ _tag: 'text', text: 'Hi there!', pending: true }]),
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
syncer.append(messages);
|
|
79
|
+
expect(doc.content).toEqual(['<prompt>Hello</prompt>', 'Hi there!'].join('\n'));
|
|
80
|
+
|
|
81
|
+
Obj.change(messages[1], (m) => {
|
|
82
|
+
const block = m.blocks[0] as Mutable<ContentBlock.Text>;
|
|
83
|
+
block.text = 'Hi there! How are you?';
|
|
84
|
+
block.pending = false;
|
|
85
|
+
});
|
|
86
|
+
syncer.append(messages);
|
|
87
|
+
|
|
88
|
+
Obj.change(messages[1], (m) => {
|
|
89
|
+
m.blocks.push({ _tag: 'text', text: 'How can I help?' });
|
|
90
|
+
});
|
|
91
|
+
syncer.append(messages);
|
|
92
|
+
expect(doc.content).toEqual(
|
|
93
|
+
['<prompt>Hello</prompt>', 'Hi there! How are you?', 'How can I help?', ''].join('\n'),
|
|
94
|
+
);
|
|
95
|
+
}),
|
|
96
|
+
);
|
|
97
|
+
});
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type DXN } from '@dxos/echo';
|
|
6
|
+
import { log } from '@dxos/log';
|
|
7
|
+
import { type MarkdownStreamController } from '@dxos/react-ui-components';
|
|
8
|
+
import { type ContentBlock, type Message } from '@dxos/types';
|
|
9
|
+
import { type StateDispatch, type XmlWidgetStateManager } from '@dxos/ui-editor';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Update document.
|
|
13
|
+
*/
|
|
14
|
+
export type TextModel = Pick<MarkdownStreamController, 'view' | 'reset' | 'append' | 'updateWidget'>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Thread context passed to renderer.
|
|
18
|
+
*/
|
|
19
|
+
export class MessageThreadContext implements Pick<MarkdownStreamController, 'updateWidget'> {
|
|
20
|
+
constructor(private readonly _widgetState?: XmlWidgetStateManager) {}
|
|
21
|
+
|
|
22
|
+
updateWidget<T>(id: string, value: StateDispatch<T>) {
|
|
23
|
+
this._widgetState?.updateWidget(id, value);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// TODO(burdon): Resolve from hypergraph.
|
|
27
|
+
getObjectLabel(_id: DXN) {
|
|
28
|
+
return 'Object';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Renders a block to markdown.
|
|
34
|
+
*/
|
|
35
|
+
export type BlockRenderer = (
|
|
36
|
+
context: MessageThreadContext,
|
|
37
|
+
message: Message.Message,
|
|
38
|
+
block: ContentBlock.Any,
|
|
39
|
+
) => string | undefined;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Syncs messages with the editor.
|
|
43
|
+
*/
|
|
44
|
+
export class MessageSyncer {
|
|
45
|
+
private _initialMessageId?: string;
|
|
46
|
+
private _currentMessageIndex = 0;
|
|
47
|
+
private _currentBlockIndex = 0;
|
|
48
|
+
private _currentBlockContent?: string;
|
|
49
|
+
|
|
50
|
+
private readonly _context: MessageThreadContext;
|
|
51
|
+
|
|
52
|
+
constructor(
|
|
53
|
+
private readonly _model: TextModel,
|
|
54
|
+
private readonly _blockRenderer: BlockRenderer,
|
|
55
|
+
) {
|
|
56
|
+
this._context = new MessageThreadContext(this._model);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get context() {
|
|
60
|
+
return this._context;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
reset() {
|
|
64
|
+
log('reset');
|
|
65
|
+
this._initialMessageId = undefined;
|
|
66
|
+
this._currentMessageIndex = 0;
|
|
67
|
+
this._currentBlockIndex = 0;
|
|
68
|
+
this._currentBlockContent = undefined;
|
|
69
|
+
void this._model.reset('');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Syncs messages with the editor.
|
|
74
|
+
*/
|
|
75
|
+
append(messages: Message.Message[], flush = false): boolean {
|
|
76
|
+
// Check if new set of messages.
|
|
77
|
+
if (this._initialMessageId !== messages[0]?.id) {
|
|
78
|
+
this.reset();
|
|
79
|
+
this._initialMessageId = messages[0]?.id;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (flush && this._model.view?.state.doc.length === 0) {
|
|
83
|
+
const buffer: string[] = [];
|
|
84
|
+
this.process(messages, (content) => {
|
|
85
|
+
buffer.push(content);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const content = buffer.join('');
|
|
89
|
+
this._model.view?.dispatch({
|
|
90
|
+
changes: [
|
|
91
|
+
{
|
|
92
|
+
from: 0,
|
|
93
|
+
to: this._model.view?.state.doc.length ?? 0,
|
|
94
|
+
insert: content,
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
selection: { anchor: content.length },
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
return true;
|
|
101
|
+
} else {
|
|
102
|
+
this.process(messages, (content) => {
|
|
103
|
+
void this._model.append(content);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private process(messages: Message.Message[], append: (content: string) => void) {
|
|
111
|
+
log('sync', {
|
|
112
|
+
doc: this._model.view?.state.doc.length,
|
|
113
|
+
messages: messages.map((message) => message.blocks.length),
|
|
114
|
+
currentMessageIndex: this._currentMessageIndex,
|
|
115
|
+
currentBlockIndex: this._currentBlockIndex,
|
|
116
|
+
currentBlockContent: this._currentBlockContent,
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
let i = this._currentMessageIndex;
|
|
120
|
+
for (const message of messages.slice(this._currentMessageIndex)) {
|
|
121
|
+
if (i > this._currentMessageIndex) {
|
|
122
|
+
this._currentBlockIndex = 0;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
this._currentMessageIndex = i;
|
|
126
|
+
let j = this._currentBlockIndex;
|
|
127
|
+
for (const block of message.blocks.slice(this._currentBlockIndex)) {
|
|
128
|
+
this._currentBlockIndex = j;
|
|
129
|
+
const currentBlockContent = this._blockRenderer(this._context, message, block);
|
|
130
|
+
if (currentBlockContent) {
|
|
131
|
+
let content: string = '';
|
|
132
|
+
if (this._currentBlockContent && currentBlockContent.startsWith(this._currentBlockContent)) {
|
|
133
|
+
content = currentBlockContent.slice(this._currentBlockContent.length);
|
|
134
|
+
} else {
|
|
135
|
+
content = currentBlockContent;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
log('append', { message: i, block: j, content });
|
|
139
|
+
this._currentBlockContent = currentBlockContent;
|
|
140
|
+
append(content);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (block.pending) {
|
|
144
|
+
return;
|
|
145
|
+
} else {
|
|
146
|
+
this._currentBlockContent = undefined;
|
|
147
|
+
this._currentBlockIndex++;
|
|
148
|
+
}
|
|
149
|
+
j++;
|
|
150
|
+
}
|
|
151
|
+
i++;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<prompt>hi</prompt>
|
|
2
|
+
Hi! I'm Kai, your AI assistant powered by DXOS. I see you have a document in your context. Let me take a look at it to see how I can help you.
|
|
3
|
+
<toolCall id="toolu_012MB5XWrQhsyjUBoBCr7jXB" />
|
|
4
|
+
|
|
5
|
+
<summary>OK (1 tool uses · 2.62k tokens · 4.8s)</summary>
|
|
6
|
+
I can see you have a comprehensive welcome document for Composer by DXOS. This document explains what Composer is - an extensible collaborative application with features like documents, diagrams, tables, and sheets.
|
|
7
|
+
|
|
8
|
+
Here are some suggestions based on what's available:
|
|
9
|
+
<suggestion>Create a new document</suggestion>
|
|
10
|
+
<suggestion>Edit the welcome document</suggestion>
|
|
11
|
+
<suggestion>Create a table to organize information</suggestion>
|
|
12
|
+
<suggestion>Create a sketch for diagrams</suggestion>
|
|
13
|
+
<suggestion>Learn about collaboration features</suggestion>
|
|
14
|
+
|
|
15
|
+
Is there something specific you'd like to do with this document or would you like to explore other features of Composer?
|
|
16
|
+
|
|
17
|
+
<summary>OK (3.91k tokens · 7.0s)</summary>
|
|
18
|
+
<prompt>Create a table to organize information</prompt>
|
|
19
|
+
I'll help you create a table to organize information. Let me check what table creation tools are available.
|
|
20
|
+
<toolCall id="toolu_01Gk8ZNGYQEczAjGkbDZ9n1D" />
|
|
21
|
+
<summary>OK (1 tool uses · 3.99k tokens · 3.4s)</summary>
|
|
22
|
+
I need to check what artifact definitions are available for creating tables. Based on the blueprint instructions, I should first query for available artifact definitions to see what table-related tools I can use.
|
|
23
|
+
|
|
24
|
+
However, I notice that the function definitions provided don't include the artifact-related tools mentioned in the blueprint (like `require_artifact_definitions` or table creation tools). The available functions are focused on document operations (open, diff, add-to-context, open-item) and analysis mode.
|
|
25
|
+
|
|
26
|
+
Let me work with what's available. Since I can't directly create a table artifact with the current tools, I can help you create a table structure within a markdown document instead.
|
|
27
|
+
|
|
28
|
+
Would you like me to:
|
|
29
|
+
|
|
30
|
+
1. Create a simple markdown table structure in a new document that you can use to organize your information?
|
|
31
|
+
2. Or would you prefer to use Composer's built-in Tables plugin (as mentioned in the welcome document) by creating one through the Composer interface?
|
|
32
|
+
|
|
33
|
+
What kind of information are you looking to organize? This will help me suggest the best table structure for your needs.
|
|
34
|
+
<toolCall id="toolu_01CQXUsyLw2uoV3k1mPLqFee" />
|
|
35
|
+
|
|
36
|
+
<summary>OK (1 tool uses · 4.28k tokens · 11.1s)</summary>
|
|
37
|
+
<summary>OK (4.30k tokens · 1.6s)</summary>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type SurfaceComponentProps } from '@dxos/app-framework/react';
|
|
8
|
+
import { Agent } from '@dxos/assistant-toolkit';
|
|
9
|
+
import { type Prompt } from '@dxos/blueprints';
|
|
10
|
+
import { Obj } from '@dxos/echo';
|
|
11
|
+
import { invokeFunctionWithTracing, useComputeRuntimeCallback } from '@dxos/plugin-automation';
|
|
12
|
+
import { Toolbar, useTranslation } from '@dxos/react-ui';
|
|
13
|
+
import { useAttention } from '@dxos/react-ui-attention';
|
|
14
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
15
|
+
|
|
16
|
+
import { meta } from '../meta';
|
|
17
|
+
|
|
18
|
+
import { TemplateEditor } from './TemplateEditor';
|
|
19
|
+
|
|
20
|
+
export type PromptArticleProps = SurfaceComponentProps<Prompt.Prompt>;
|
|
21
|
+
|
|
22
|
+
export const PromptArticle = ({ role, subject }: PromptArticleProps) => {
|
|
23
|
+
const { t } = useTranslation(meta.id);
|
|
24
|
+
const db = Obj.getDatabase(subject);
|
|
25
|
+
const { hasAttention } = useAttention(Obj.getDXN(subject).toString());
|
|
26
|
+
|
|
27
|
+
const inputData = useMemo(
|
|
28
|
+
() =>
|
|
29
|
+
subject && {
|
|
30
|
+
prompt: db?.makeRef(Obj.getDXN(subject)),
|
|
31
|
+
input: {},
|
|
32
|
+
},
|
|
33
|
+
[subject, db],
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const handleRun = useComputeRuntimeCallback(db?.spaceId, () => invokeFunctionWithTracing(Agent.prompt, inputData), [
|
|
37
|
+
inputData,
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Layout.Main role={role} toolbar>
|
|
42
|
+
<Toolbar.Root disabled={!hasAttention} onClick={handleRun}>
|
|
43
|
+
<Toolbar.IconButton iconOnly icon='ph--play--regular' label={t('run prompt label')} onClick={handleRun} />
|
|
44
|
+
</Toolbar.Root>
|
|
45
|
+
<TemplateEditor id={subject.id} template={subject.instructions} classNames='container-max-width' />
|
|
46
|
+
</Layout.Main>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default PromptArticle;
|