@dxos/plugin-assistant 0.8.4-main.69d29f4 → 0.8.4-main.6fa680abb7
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/AssistantSettings-PP6JSHWB.mjs +93 -0
- package/dist/lib/browser/AssistantSettings-PP6JSHWB.mjs.map +7 -0
- package/dist/lib/browser/BlueprintArticle-H6R33TZZ.mjs +35 -0
- package/dist/lib/browser/BlueprintArticle-H6R33TZZ.mjs.map +7 -0
- package/dist/lib/browser/{ChatCompanion-ECQYUQ2B.mjs → ChatCompanion-GXS6DK4X.mjs} +75 -26
- package/dist/lib/browser/ChatCompanion-GXS6DK4X.mjs.map +7 -0
- package/dist/lib/browser/ChatContainer-SMSZXEF5.mjs +12 -0
- package/dist/lib/browser/{ChatDialog-SMK4RSZU.mjs → ChatDialog-ZCVPPONM.mjs} +9 -9
- package/dist/lib/browser/ChatDialog-ZCVPPONM.mjs.map +7 -0
- package/dist/lib/browser/ProjectArticle-QDBTIFNE.mjs +91 -0
- package/dist/lib/browser/ProjectArticle-QDBTIFNE.mjs.map +7 -0
- package/dist/lib/browser/ProjectSettings-L5MCDUXK.mjs +232 -0
- package/dist/lib/browser/ProjectSettings-L5MCDUXK.mjs.map +7 -0
- package/dist/lib/browser/PromptArticle-G5YSAEGK.mjs +71 -0
- package/dist/lib/browser/PromptArticle-G5YSAEGK.mjs.map +7 -0
- package/dist/lib/browser/TriggerStatus-X35WDCK5.mjs +112 -0
- package/dist/lib/browser/TriggerStatus-X35WDCK5.mjs.map +7 -0
- package/dist/lib/browser/{ai-service-5GUDOEWF.mjs → ai-service-CY2BYPH6.mjs} +5 -4
- package/dist/lib/browser/ai-service-CY2BYPH6.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-DSNH2OMY.mjs → app-graph-builder-ECQCWGCN.mjs} +54 -42
- package/dist/lib/browser/app-graph-builder-ECQCWGCN.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-CKG4TQ2J.mjs +35 -0
- package/dist/lib/browser/blueprint-definition-CKG4TQ2J.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +3 -7
- package/dist/lib/browser/{chunk-EXVT7D4B.mjs → chunk-2VIEX4RA.mjs} +3 -3
- package/dist/lib/browser/{chunk-EXVT7D4B.mjs.map → chunk-2VIEX4RA.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-V772AMZM.mjs → chunk-734CB3XG.mjs} +28 -48
- package/dist/lib/browser/chunk-734CB3XG.mjs.map +7 -0
- package/dist/lib/browser/{chunk-3JYPE2MM.mjs → chunk-A346P45I.mjs} +623 -330
- package/dist/lib/browser/chunk-A346P45I.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ML3QCFKA.mjs → chunk-JYY5AD65.mjs} +50 -29
- package/dist/lib/browser/chunk-JYY5AD65.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-QCCOFBUX.mjs → chunk-WP4WY2Y6.mjs} +18 -22
- package/dist/lib/browser/chunk-WP4WY2Y6.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZZRRSIQQ.mjs +26 -0
- package/dist/lib/browser/chunk-ZZRRSIQQ.mjs.map +7 -0
- package/dist/lib/browser/{edge-model-resolver-26BOY6HY.mjs → edge-model-resolver-YTMFQEN5.mjs} +4 -3
- package/dist/lib/browser/edge-model-resolver-YTMFQEN5.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +109 -85
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{local-model-resolver-ZFIM6GGV.mjs → local-model-resolver-CGRQH37T.mjs} +4 -3
- package/dist/lib/browser/local-model-resolver-CGRQH37T.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{operation-resolver-7XJLBRQY.mjs → operation-resolver-DYSWWNVG.mjs} +34 -43
- package/dist/lib/browser/operation-resolver-DYSWWNVG.mjs.map +7 -0
- package/dist/lib/browser/react-surface-M3GSSFPC.mjs +142 -0
- package/dist/lib/browser/react-surface-M3GSSFPC.mjs.map +7 -0
- package/dist/lib/browser/{settings-4ZDLUMYE.mjs → settings-NC5DQWES.mjs} +6 -5
- package/dist/lib/browser/settings-NC5DQWES.mjs.map +7 -0
- package/dist/lib/browser/{state-AN6336ZX.mjs → state-EMIKHGYZ.mjs} +3 -3
- package/dist/lib/browser/toolkit-XRSBBB3L.mjs +16 -0
- package/dist/lib/browser/toolkit-XRSBBB3L.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/AssistantSettings-3MNGBQB2.mjs +94 -0
- package/dist/lib/node-esm/AssistantSettings-3MNGBQB2.mjs.map +7 -0
- package/dist/lib/node-esm/BlueprintArticle-2KYFUQKY.mjs +36 -0
- package/dist/lib/node-esm/BlueprintArticle-2KYFUQKY.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatCompanion-Q4FUZ2MW.mjs → ChatCompanion-MPQGSWZB.mjs} +75 -26
- package/dist/lib/node-esm/ChatCompanion-MPQGSWZB.mjs.map +7 -0
- package/dist/lib/node-esm/ChatContainer-DMOAYUUM.mjs +13 -0
- package/dist/lib/node-esm/{ChatDialog-AP45PVZR.mjs → ChatDialog-PV2EU2XM.mjs} +9 -9
- package/dist/lib/node-esm/ChatDialog-PV2EU2XM.mjs.map +7 -0
- package/dist/lib/node-esm/ProjectArticle-BCIBESJN.mjs +92 -0
- package/dist/lib/node-esm/ProjectArticle-BCIBESJN.mjs.map +7 -0
- package/dist/lib/node-esm/ProjectSettings-K3YBQWDD.mjs +233 -0
- package/dist/lib/node-esm/ProjectSettings-K3YBQWDD.mjs.map +7 -0
- package/dist/lib/node-esm/PromptArticle-HAGZPZWV.mjs +72 -0
- package/dist/lib/node-esm/PromptArticle-HAGZPZWV.mjs.map +7 -0
- package/dist/lib/node-esm/TriggerStatus-V3QMIE7T.mjs +113 -0
- package/dist/lib/node-esm/TriggerStatus-V3QMIE7T.mjs.map +7 -0
- package/dist/lib/node-esm/{ai-service-PXKKCFIF.mjs → ai-service-ZI3A6RVG.mjs} +5 -4
- package/dist/lib/node-esm/ai-service-ZI3A6RVG.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-TJCUEXW5.mjs → app-graph-builder-YPHP6X6W.mjs} +54 -42
- package/dist/lib/node-esm/app-graph-builder-YPHP6X6W.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-UZWGSFBI.mjs +36 -0
- package/dist/lib/node-esm/blueprint-definition-UZWGSFBI.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +3 -7
- package/dist/lib/node-esm/{chunk-XI5T3MJC.mjs → chunk-5DLYAEBK.mjs} +623 -330
- package/dist/lib/node-esm/chunk-5DLYAEBK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-AK3JJ76X.mjs +28 -0
- package/dist/lib/node-esm/chunk-AK3JJ76X.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ZRIPP7YF.mjs → chunk-JMBYVUD6.mjs} +50 -29
- package/dist/lib/node-esm/chunk-JMBYVUD6.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-355W5B27.mjs → chunk-JQAXFBBU.mjs} +28 -48
- package/dist/lib/node-esm/chunk-JQAXFBBU.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-POWB2BPC.mjs → chunk-TEYTGR67.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-POWB2BPC.mjs.map → chunk-TEYTGR67.mjs.map} +1 -1
- package/dist/lib/node-esm/{ChatContainer-AKI33HIB.mjs → chunk-ZTL6HRDB.mjs} +18 -22
- package/dist/lib/node-esm/chunk-ZTL6HRDB.mjs.map +7 -0
- package/dist/lib/node-esm/{edge-model-resolver-G5KMODPO.mjs → edge-model-resolver-CMJ3KNLQ.mjs} +4 -3
- package/dist/lib/node-esm/edge-model-resolver-CMJ3KNLQ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +109 -85
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{local-model-resolver-KDZLYI7Y.mjs → local-model-resolver-FFDAKOXN.mjs} +4 -3
- package/dist/lib/node-esm/local-model-resolver-FFDAKOXN.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{operation-resolver-SX4WMNA7.mjs → operation-resolver-EE4EBO2Y.mjs} +34 -43
- package/dist/lib/node-esm/operation-resolver-EE4EBO2Y.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-U3PGFTKA.mjs +143 -0
- package/dist/lib/node-esm/react-surface-U3PGFTKA.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-CQEOHR3R.mjs → settings-OOAN5LAO.mjs} +6 -5
- package/dist/lib/node-esm/settings-OOAN5LAO.mjs.map +7 -0
- package/dist/lib/node-esm/{state-HDON4REW.mjs → state-7A7QPQKK.mjs} +3 -3
- package/dist/lib/node-esm/toolkit-5IWGLUF4.mjs +17 -0
- package/dist/lib/node-esm/toolkit-5IWGLUF4.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/assistant/blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/assistant/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/blueprint.test.d.ts +2 -0
- package/dist/types/src/blueprints/assistant/blueprint.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/index.d.ts +2 -0
- package/dist/types/src/blueprints/assistant/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +1 -6
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts +3 -2
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service/index.d.ts +1 -1
- package/dist/types/src/capabilities/ai-service/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +4 -19
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +1 -2
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts +4 -3
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +0 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts +4 -3
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings/index.d.ts +1 -1
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings/settings.d.ts +4 -3
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/state/state.d.ts +1 -1
- package/dist/types/src/capabilities/toolkit/index.d.ts +1 -1
- package/dist/types/src/capabilities/toolkit/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts +3 -2
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +11 -7
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +2 -2
- 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.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +2 -2
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +128 -8
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +125 -5
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +125 -5
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +4 -4
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +2 -2
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +125 -5
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts +2 -2
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts.map +1 -1
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -12
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/{components → containers}/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/containers/AssistantSettings/index.d.ts +3 -0
- package/dist/types/src/containers/AssistantSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts +6 -0
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts.map +1 -0
- package/dist/types/src/containers/BlueprintArticle/index.d.ts +3 -0
- package/dist/types/src/containers/BlueprintArticle/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/ChatCompanion}/ChatCompanion.d.ts +2 -3
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/containers/ChatCompanion/index.d.ts +3 -0
- package/dist/types/src/containers/ChatCompanion/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/ChatContainer}/ChatContainer.d.ts +6 -6
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts.map +1 -0
- package/dist/types/src/containers/ChatContainer/index.d.ts +3 -0
- package/dist/types/src/containers/ChatContainer/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/ChatDialog}/ChatDialog.d.ts +2 -3
- package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts.map +1 -0
- package/dist/types/src/containers/ChatDialog/index.d.ts +3 -0
- package/dist/types/src/containers/ChatDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/Project/ProjectArticle.d.ts +7 -0
- package/dist/types/src/containers/Project/ProjectArticle.d.ts.map +1 -0
- package/dist/types/src/containers/Project/ProjectSettings.d.ts +6 -0
- package/dist/types/src/containers/Project/ProjectSettings.d.ts.map +1 -0
- package/dist/types/src/containers/Project/index.d.ts +7 -0
- package/dist/types/src/containers/Project/index.d.ts.map +1 -0
- package/dist/types/src/containers/Project/triggers.d.ts +6 -0
- package/dist/types/src/containers/Project/triggers.d.ts.map +1 -0
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts +6 -0
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PromptArticle/index.d.ts +3 -0
- package/dist/types/src/containers/PromptArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts +4 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/index.d.ts +3 -0
- package/dist/types/src/containers/TriggerStatus/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +10 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +2 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +2 -2
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts +2 -2
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -1
- package/dist/types/src/hooks/useFilteredTypes.d.ts +1 -1
- package/dist/types/src/hooks/useFilteredTypes.d.ts.map +1 -1
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +7 -3
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/processor/update-name.d.ts +2 -2
- package/dist/types/src/processor/update-name.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +125 -5
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +5 -27
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantAction.d.ts +13 -15
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +95 -92
- package/src/AssistantPlugin.tsx +64 -36
- package/src/blueprints/assistant/blueprint.conversations.json +1 -0
- package/src/blueprints/assistant/blueprint.test.ts +48 -0
- package/src/blueprints/assistant/blueprint.ts +27 -0
- package/src/blueprints/assistant/index.ts +5 -0
- package/src/blueprints/index.ts +1 -8
- package/src/capabilities/ai-service/ai-service.ts +4 -3
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +48 -31
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +32 -42
- package/src/capabilities/blueprint-definition/index.ts +0 -1
- package/src/capabilities/edge-model-resolver/edge-model-resolver.ts +4 -3
- package/src/capabilities/index.ts +0 -1
- package/src/capabilities/local-model-resolver/local-model-resolver.ts +4 -3
- package/src/capabilities/operation-resolver/operation-resolver.ts +29 -26
- package/src/capabilities/react-surface/react-surface.tsx +53 -29
- package/src/capabilities/settings/settings.ts +3 -2
- package/src/capabilities/toolkit/toolkit.ts +5 -16
- package/src/components/Chat/Chat.tsx +67 -30
- package/src/components/ChatProgress/ChatProgress.tsx +4 -5
- package/src/components/ChatPrompt/ChatActions.tsx +9 -1
- package/src/components/ChatPrompt/ChatOptions.tsx +29 -9
- package/src/components/ChatPrompt/ChatReferences.tsx +14 -4
- package/src/components/ChatThread/ChatThread.stories.tsx +11 -11
- package/src/components/ChatThread/ChatThread.tsx +15 -6
- package/src/components/ChatThread/Link.tsx +1 -1
- package/src/components/ChatThread/registry.tsx +51 -18
- package/src/components/ChatThread/sync.test.ts +2 -0
- package/src/components/ChatThread/sync.ts +14 -8
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +3 -3
- package/src/components/TemplateEditor/TemplateEditor.tsx +2 -2
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +3 -3
- package/src/components/TemplateEditor/TemplateForm.tsx +6 -7
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +4 -4
- package/src/components/ToolBlock/ToolBlock.tsx +15 -15
- package/src/components/Toolbox/Toolbox.stories.tsx +3 -3
- package/src/components/Toolbox/Toolbox.tsx +49 -48
- package/src/components/Typewriter/AssistantToolbar.tsx +3 -3
- package/src/components/Typewriter/Typewriter.stories.tsx +18 -15
- package/src/components/Typewriter/Typewriter.tsx +1 -1
- package/src/components/Typewriter/assistant-extension.tsx +3 -5
- package/src/components/index.ts +0 -9
- package/src/{components → containers}/AssistantSettings/AssistantSettings.tsx +15 -15
- package/src/containers/AssistantSettings/index.ts +7 -0
- package/src/containers/BlueprintArticle/BlueprintArticle.tsx +29 -0
- package/src/containers/BlueprintArticle/index.ts +7 -0
- package/src/{components → containers/ChatCompanion}/ChatCompanion.tsx +84 -22
- package/src/containers/ChatCompanion/index.ts +7 -0
- package/src/containers/ChatContainer/ChatContainer.tsx +69 -0
- package/src/containers/ChatContainer/index.ts +7 -0
- package/src/{components → containers/ChatDialog}/ChatDialog.tsx +7 -9
- package/src/containers/ChatDialog/index.ts +7 -0
- package/src/containers/Project/ProjectArticle.tsx +117 -0
- package/src/containers/Project/ProjectSettings.tsx +134 -0
- package/src/containers/Project/index.ts +16 -0
- package/src/containers/Project/triggers.ts +149 -0
- package/src/containers/PromptArticle/PromptArticle.tsx +59 -0
- package/src/containers/PromptArticle/index.ts +7 -0
- package/src/containers/TriggerStatus/TriggerStatus.tsx +140 -0
- package/src/containers/TriggerStatus/index.ts +7 -0
- package/src/containers/index.ts +15 -0
- package/src/hooks/useBlueprintRegistry.ts +7 -4
- package/src/hooks/useChatProcessor.ts +2 -1
- package/src/hooks/useChatServices.ts +3 -3
- package/src/hooks/useChatToolbarActions.ts +6 -5
- package/src/hooks/useFilteredTypes.ts +2 -2
- package/src/hooks/useReferencesProvider.ts +1 -5
- package/src/index.ts +1 -0
- package/src/meta.ts +2 -2
- package/src/processor/processor.test.ts +8 -7
- package/src/processor/processor.ts +47 -26
- package/src/processor/update-name.ts +2 -3
- package/src/testing/test-sequence.ts +3 -3
- package/src/testing/test-services.ts +1 -1
- package/src/translations.ts +29 -3
- package/src/types/Assistant.ts +4 -38
- package/src/types/AssistantAction.ts +14 -13
- package/src/types/capabilities.ts +2 -2
- package/src/types/events.ts +1 -1
- package/src/types/index.ts +3 -0
- package/src/types/service.ts +4 -4
- package/dist/lib/browser/BlueprintArticle-WP3G5GLG.mjs +0 -31
- package/dist/lib/browser/BlueprintArticle-WP3G5GLG.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-ECQYUQ2B.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-QCCOFBUX.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-SMK4RSZU.mjs.map +0 -7
- package/dist/lib/browser/PromptArticle-K362ZPAE.mjs +0 -53
- package/dist/lib/browser/PromptArticle-K362ZPAE.mjs.map +0 -7
- package/dist/lib/browser/ai-service-5GUDOEWF.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-DSNH2OMY.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-DGHH7MUU.mjs +0 -14
- package/dist/lib/browser/chunk-3JYPE2MM.mjs.map +0 -7
- package/dist/lib/browser/chunk-DKQMSMBN.mjs +0 -326
- package/dist/lib/browser/chunk-DKQMSMBN.mjs.map +0 -7
- package/dist/lib/browser/chunk-ML3QCFKA.mjs.map +0 -7
- package/dist/lib/browser/chunk-MRJVYGLU.mjs +0 -208
- package/dist/lib/browser/chunk-MRJVYGLU.mjs.map +0 -7
- package/dist/lib/browser/chunk-V772AMZM.mjs.map +0 -7
- package/dist/lib/browser/chunk-WGQTU6UJ.mjs +0 -41
- package/dist/lib/browser/chunk-WGQTU6UJ.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-26BOY6HY.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-ZFIM6GGV.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-7XJLBRQY.mjs.map +0 -7
- package/dist/lib/browser/react-surface-NCITRSJJ.mjs +0 -109
- package/dist/lib/browser/react-surface-NCITRSJJ.mjs.map +0 -7
- package/dist/lib/browser/repair-6QGAKOVM.mjs +0 -54
- package/dist/lib/browser/repair-6QGAKOVM.mjs.map +0 -7
- package/dist/lib/browser/settings-4ZDLUMYE.mjs.map +0 -7
- package/dist/lib/browser/toolkit-7AVTEPMA.mjs +0 -18
- package/dist/lib/browser/toolkit-7AVTEPMA.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintArticle-WZ76E2C4.mjs +0 -32
- package/dist/lib/node-esm/BlueprintArticle-WZ76E2C4.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-Q4FUZ2MW.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-AKI33HIB.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-AP45PVZR.mjs.map +0 -7
- package/dist/lib/node-esm/PromptArticle-D4HAIIC6.mjs +0 -54
- package/dist/lib/node-esm/PromptArticle-D4HAIIC6.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-PXKKCFIF.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-TJCUEXW5.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-SEMDEIYG.mjs +0 -15
- package/dist/lib/node-esm/chunk-355W5B27.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-75PHXBN3.mjs +0 -327
- package/dist/lib/node-esm/chunk-75PHXBN3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DCA5QWQT.mjs +0 -209
- package/dist/lib/node-esm/chunk-DCA5QWQT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MSBPC4RJ.mjs +0 -42
- package/dist/lib/node-esm/chunk-MSBPC4RJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XI5T3MJC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZRIPP7YF.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-G5KMODPO.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-KDZLYI7Y.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-SX4WMNA7.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-ST6V7LPE.mjs +0 -110
- package/dist/lib/node-esm/react-surface-ST6V7LPE.mjs.map +0 -7
- package/dist/lib/node-esm/repair-QJ7CQDKU.mjs +0 -55
- package/dist/lib/node-esm/repair-QJ7CQDKU.mjs.map +0 -7
- package/dist/lib/node-esm/settings-CQEOHR3R.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-OWGCEKOO.mjs +0 -19
- package/dist/lib/node-esm/toolkit-OWGCEKOO.mjs.map +0 -7
- package/dist/types/src/blueprints/assistant-blueprint.d.ts +0 -209
- package/dist/types/src/blueprints/assistant-blueprint.d.ts.map +0 -1
- package/dist/types/src/capabilities/repair/index.d.ts +0 -3
- package/dist/types/src/capabilities/repair/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/repair/repair.d.ts +0 -6
- package/dist/types/src/capabilities/repair/repair.d.ts.map +0 -1
- package/dist/types/src/components/AssistantSettings/index.d.ts +0 -2
- package/dist/types/src/components/AssistantSettings/index.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintArticle.d.ts +0 -7
- package/dist/types/src/components/BlueprintArticle.d.ts.map +0 -1
- package/dist/types/src/components/ChatCompanion.d.ts.map +0 -1
- package/dist/types/src/components/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/components/ChatDialog.d.ts.map +0 -1
- package/dist/types/src/components/PromptArticle.d.ts +0 -7
- package/dist/types/src/components/PromptArticle.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -4
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/object-list.d.ts +0 -10
- package/dist/types/src/functions/object-list.d.ts.map +0 -1
- package/dist/types/src/functions/object-load.d.ts +0 -8
- package/dist/types/src/functions/object-load.d.ts.map +0 -1
- package/dist/types/src/functions/object-search.d.ts +0 -10
- package/dist/types/src/functions/object-search.d.ts.map +0 -1
- package/src/blueprints/assistant-blueprint.ts +0 -62
- package/src/capabilities/repair/index.ts +0 -7
- package/src/capabilities/repair/repair.ts +0 -63
- package/src/components/AssistantSettings/index.ts +0 -5
- package/src/components/BlueprintArticle.tsx +0 -29
- package/src/components/ChatContainer.tsx +0 -61
- package/src/components/PromptArticle.tsx +0 -50
- package/src/functions/index.ts +0 -7
- package/src/functions/object-list.ts +0 -49
- package/src/functions/object-load.ts +0 -47
- package/src/functions/object-search.ts +0 -46
- /package/dist/lib/browser/{blueprint-definition-DGHH7MUU.mjs.map → ChatContainer-SMSZXEF5.mjs.map} +0 -0
- /package/dist/lib/browser/{state-AN6336ZX.mjs.map → state-EMIKHGYZ.mjs.map} +0 -0
- /package/dist/lib/node-esm/{blueprint-definition-SEMDEIYG.mjs.map → ChatContainer-DMOAYUUM.mjs.map} +0 -0
- /package/dist/lib/node-esm/{state-HDON4REW.mjs.map → state-7A7QPQKK.mjs.map} +0 -0
- /package/dist/types/src/{components → containers}/AssistantSettings/AssistantSettings.d.ts +0 -0
|
@@ -9,10 +9,9 @@ import { type Database, type Ref } from '@dxos/echo';
|
|
|
9
9
|
import { Function } from '@dxos/functions';
|
|
10
10
|
import { log } from '@dxos/log';
|
|
11
11
|
import { Filter, useQuery } from '@dxos/react-client/echo';
|
|
12
|
-
import { type ThemedClassName
|
|
12
|
+
import { ScrollArea, type ThemedClassName } from '@dxos/react-ui';
|
|
13
13
|
import { mx } from '@dxos/ui-theme';
|
|
14
14
|
|
|
15
|
-
import { meta } from '../../meta';
|
|
16
15
|
import { type AiChatProcessor } from '../../processor';
|
|
17
16
|
import { ServiceType } from '../../types';
|
|
18
17
|
|
|
@@ -25,62 +24,64 @@ export type ToolboxProps = ThemedClassName<{
|
|
|
25
24
|
}>;
|
|
26
25
|
|
|
27
26
|
export const Toolbox = ({ classNames, functions, services, blueprints, activeBlueprints }: ToolboxProps) => {
|
|
28
|
-
const { t } = useTranslation(meta.id);
|
|
29
|
-
|
|
30
27
|
return (
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
name,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
28
|
+
<ScrollArea.Root thin orientation='vertical'>
|
|
29
|
+
<ScrollArea.Viewport classNames={classNames}>
|
|
30
|
+
{blueprints && blueprints.length > 0 && (
|
|
31
|
+
<Section
|
|
32
|
+
title='Blueprints'
|
|
33
|
+
items={blueprints.map(({ name, description, tools }) => ({
|
|
34
|
+
name,
|
|
35
|
+
description,
|
|
36
|
+
subitems: tools.map((toolId) => ({ name: `∙ ${safeToolId(toolId)}` })),
|
|
37
|
+
}))}
|
|
38
|
+
/>
|
|
39
|
+
)}
|
|
40
|
+
|
|
41
|
+
{activeBlueprints && activeBlueprints.length > 0 && (
|
|
42
|
+
<Section
|
|
43
|
+
title='Blueprints'
|
|
44
|
+
items={activeBlueprints.map(({ target }) => ({
|
|
45
|
+
name: target?.name ?? '',
|
|
46
|
+
description: target?.description ?? '',
|
|
47
|
+
subitems: target?.tools.map((toolId) => ({ name: `∙ ${safeToolId(toolId)}` })),
|
|
48
|
+
}))}
|
|
49
|
+
/>
|
|
50
|
+
)}
|
|
51
|
+
|
|
52
|
+
{services && services.length > 0 && (
|
|
53
|
+
<Section
|
|
54
|
+
title='Services'
|
|
55
|
+
items={services.map(({ service: { serviceId, name, description } }) => ({
|
|
56
|
+
name: name ?? serviceId,
|
|
57
|
+
description,
|
|
58
|
+
// subitems: tools.map(({ name, description }) => ({ name: `∙ ${name}`, description })),
|
|
59
|
+
}))}
|
|
60
|
+
/>
|
|
61
|
+
)}
|
|
62
|
+
|
|
63
|
+
{functions && functions.length > 0 && (
|
|
64
|
+
<Section title='Functions' items={functions.map(({ name, description }) => ({ name, description }))} />
|
|
65
|
+
)}
|
|
66
|
+
</ScrollArea.Viewport>
|
|
67
|
+
</ScrollArea.Root>
|
|
69
68
|
);
|
|
70
69
|
};
|
|
71
70
|
|
|
72
|
-
|
|
71
|
+
type SectionProps = {
|
|
73
72
|
title: string;
|
|
74
73
|
items: { name: string; description?: string; subitems?: { name: string; description?: string }[] }[];
|
|
75
74
|
striped?: boolean;
|
|
76
|
-
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const Section = ({ title, items, striped }: SectionProps) => {
|
|
77
78
|
const stripeClassNames = 'odd:bg-neutral-50 dark:odd:bg-neutral-800';
|
|
78
79
|
const gridClassNames = 'grid grid-cols-[8rem_1fr]';
|
|
79
|
-
const subGridClassNames = mx('col-span-full grid grid-cols-subgrid text-xs
|
|
80
|
+
const subGridClassNames = mx('col-span-full grid grid-cols-subgrid text-xs px-2', striped && stripeClassNames);
|
|
80
81
|
|
|
81
82
|
return (
|
|
82
83
|
<div>
|
|
83
|
-
<h1 className='
|
|
84
|
+
<h1 className='px-2 text-sm'>{title}</h1>
|
|
84
85
|
<div className={gridClassNames}>
|
|
85
86
|
{items.map(({ name, description, subitems }, i) => (
|
|
86
87
|
<Fragment key={i}>
|
|
@@ -103,12 +104,12 @@ const Section: FC<{
|
|
|
103
104
|
);
|
|
104
105
|
};
|
|
105
106
|
|
|
106
|
-
export type
|
|
107
|
+
export type ToolboxPanelProps = ThemedClassName<{
|
|
107
108
|
db?: Database.Database;
|
|
108
109
|
processor?: AiChatProcessor;
|
|
109
110
|
}>;
|
|
110
111
|
|
|
111
|
-
export const
|
|
112
|
+
export const ToolboxPanel = ({ classNames, db, processor }: ToolboxPanelProps) => {
|
|
112
113
|
// Registered services.
|
|
113
114
|
const services = useQuery(db, Filter.type(ServiceType));
|
|
114
115
|
const [serviceTools, setServiceTools] = useState<{ service: ServiceType }[]>([]);
|
|
@@ -12,12 +12,12 @@ import { runInRuntime } from '@dxos/effect';
|
|
|
12
12
|
import { log } from '@dxos/log';
|
|
13
13
|
import { Button, Icon, Input, ThemeProvider } from '@dxos/react-ui';
|
|
14
14
|
|
|
15
|
-
export
|
|
15
|
+
export type AssistantToolbarProps = {
|
|
16
16
|
view: EditorView;
|
|
17
17
|
from: number;
|
|
18
18
|
to: number;
|
|
19
19
|
runtime: Runtime.Runtime<LanguageModel.LanguageModel>;
|
|
20
|
-
}
|
|
20
|
+
};
|
|
21
21
|
|
|
22
22
|
export const AssistantToolbar = ({ view, from, to, runtime }: AssistantToolbarProps) => {
|
|
23
23
|
const [isProcessing, setIsProcessing] = useState(false);
|
|
@@ -99,7 +99,7 @@ export const AssistantToolbar = ({ view, from, to, runtime }: AssistantToolbarPr
|
|
|
99
99
|
</Input.Root>
|
|
100
100
|
<Button
|
|
101
101
|
variant='ghost'
|
|
102
|
-
classNames='p-1 min-
|
|
102
|
+
classNames='p-1 min-h-0 h-6 w-6 rounded-full'
|
|
103
103
|
onClick={handleEditWithPrompt}
|
|
104
104
|
disabled={!customPrompt || isProcessing}
|
|
105
105
|
>
|
|
@@ -11,15 +11,14 @@ import React, { useEffect, useState } from 'react';
|
|
|
11
11
|
|
|
12
12
|
import { AiService } from '@dxos/ai';
|
|
13
13
|
import { AiServiceTestingPreset } from '@dxos/ai/testing';
|
|
14
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
14
15
|
|
|
15
16
|
import { Typewriter } from './Typewriter';
|
|
16
17
|
|
|
17
18
|
const meta: Meta<typeof Typewriter> = {
|
|
18
|
-
title: 'plugins/plugin-assistant/Typewriter',
|
|
19
|
+
title: 'plugins/plugin-assistant/components/Typewriter',
|
|
19
20
|
component: Typewriter,
|
|
20
|
-
|
|
21
|
-
layout: 'centered',
|
|
22
|
-
},
|
|
21
|
+
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
export default meta;
|
|
@@ -49,7 +48,7 @@ The quick brown fox jumps over teh lazy dog. i think this is cool.
|
|
|
49
48
|
|
|
50
49
|
export const Default: Story = {
|
|
51
50
|
render: () => {
|
|
52
|
-
const [
|
|
51
|
+
const [runtime, setRuntime] = useState<Runtime.Runtime<LanguageModel.LanguageModel>>();
|
|
53
52
|
useEffect(() => {
|
|
54
53
|
let disposed = false;
|
|
55
54
|
const rt = ManagedRuntime.make(
|
|
@@ -59,10 +58,18 @@ export const Default: Story = {
|
|
|
59
58
|
),
|
|
60
59
|
);
|
|
61
60
|
queueMicrotask(async () => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
try {
|
|
62
|
+
if (disposed) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const runtime = await rt.runtime();
|
|
66
|
+
if (disposed) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
setRuntime(runtime);
|
|
70
|
+
} catch (error) {
|
|
71
|
+
console.error('Failed to initialize runtime:', error);
|
|
72
|
+
}
|
|
66
73
|
});
|
|
67
74
|
return () => {
|
|
68
75
|
disposed = true;
|
|
@@ -70,14 +77,10 @@ export const Default: Story = {
|
|
|
70
77
|
};
|
|
71
78
|
}, []);
|
|
72
79
|
|
|
73
|
-
if (!
|
|
80
|
+
if (!runtime) {
|
|
74
81
|
return <div>...Loading</div>;
|
|
75
82
|
}
|
|
76
83
|
|
|
77
|
-
return
|
|
78
|
-
<div className='w-[800px] p-4'>
|
|
79
|
-
<Typewriter initialContent={sampleText} runtime={rtEffect} />
|
|
80
|
-
</div>
|
|
81
|
-
);
|
|
84
|
+
return <Typewriter initialContent={sampleText} runtime={runtime} />;
|
|
82
85
|
},
|
|
83
86
|
};
|
|
@@ -41,7 +41,7 @@ export const Typewriter = ({ initialContent = '', extensions = [], runtime }: Ty
|
|
|
41
41
|
return (
|
|
42
42
|
<ThemeProvider>
|
|
43
43
|
<DensityProvider density='fine'>
|
|
44
|
-
<div className='
|
|
44
|
+
<div className='w-full h-full grid overflow-hidden'>
|
|
45
45
|
<Editor.Root ref={editorRef}>
|
|
46
46
|
<Editor.Viewport>
|
|
47
47
|
<Editor.Content initialValue={initialContent} extensions={extension} />
|
|
@@ -111,9 +111,7 @@ const assistantLinter = (runtime: Runtime.Runtime<LanguageModel.LanguageModel>)
|
|
|
111
111
|
if (match) {
|
|
112
112
|
suggestions = JSON.parse(match[0]);
|
|
113
113
|
}
|
|
114
|
-
} catch
|
|
115
|
-
// failed to parse
|
|
116
|
-
}
|
|
114
|
+
} catch {}
|
|
117
115
|
|
|
118
116
|
const diagnostics: Diagnostic[] = [];
|
|
119
117
|
for (const s of suggestions) {
|
|
@@ -137,8 +135,8 @@ const assistantLinter = (runtime: Runtime.Runtime<LanguageModel.LanguageModel>)
|
|
|
137
135
|
}
|
|
138
136
|
}
|
|
139
137
|
return diagnostics;
|
|
140
|
-
} catch (
|
|
141
|
-
log.
|
|
138
|
+
} catch (error) {
|
|
139
|
+
log.catch(error);
|
|
142
140
|
return [];
|
|
143
141
|
}
|
|
144
142
|
});
|
package/src/components/index.ts
CHANGED
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { lazy } from 'react';
|
|
6
|
-
|
|
7
|
-
export * from './AssistantSettings';
|
|
8
5
|
export * from './Chat';
|
|
9
6
|
export * from './TemplateEditor';
|
|
10
7
|
export * from './Toolbox';
|
|
11
|
-
|
|
12
|
-
export const BlueprintArticle = lazy(() => import('./BlueprintArticle'));
|
|
13
|
-
export const ChatCompanion = lazy(() => import('./ChatCompanion'));
|
|
14
|
-
export const ChatContainer = lazy(() => import('./ChatContainer'));
|
|
15
|
-
export const ChatDialog = lazy(() => import('./ChatDialog'));
|
|
16
|
-
export const PromptArticle = lazy(() => import('./PromptArticle'));
|
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { DEFAULT_EDGE_MODELS, DEFAULT_OLLAMA_MODELS } from '@dxos/ai';
|
|
8
8
|
import { Input, Select, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import {
|
|
9
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
10
10
|
|
|
11
11
|
import { meta } from '../../meta';
|
|
12
12
|
import { type Assistant, LLM_PROVIDERS } from '../../types';
|
|
@@ -29,17 +29,17 @@ export const AssistantSettings = ({ settings, onSettingsChange }: AssistantSetti
|
|
|
29
29
|
const { t } = useTranslation(meta.id);
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
|
-
<
|
|
33
|
-
<
|
|
34
|
-
<
|
|
35
|
-
<
|
|
32
|
+
<Settings.Root>
|
|
33
|
+
<Settings.Section title={t('settings title', { ns: meta.id })}>
|
|
34
|
+
<Settings.Group>
|
|
35
|
+
<Settings.ItemInput title={t('settings custom prompts label')}>
|
|
36
36
|
<Input.Switch
|
|
37
37
|
checked={!!settings.customPrompts}
|
|
38
38
|
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, customPrompts: checked }))}
|
|
39
39
|
/>
|
|
40
|
-
</
|
|
40
|
+
</Settings.ItemInput>
|
|
41
41
|
|
|
42
|
-
<
|
|
42
|
+
<Settings.ItemInput title={t('settings llm provider label')}>
|
|
43
43
|
<Select.Root
|
|
44
44
|
value={settings.llmProvider ?? 'edge'}
|
|
45
45
|
onValueChange={(value) => {
|
|
@@ -64,9 +64,9 @@ export const AssistantSettings = ({ settings, onSettingsChange }: AssistantSetti
|
|
|
64
64
|
</Select.Content>
|
|
65
65
|
</Select.Portal>
|
|
66
66
|
</Select.Root>
|
|
67
|
-
</
|
|
67
|
+
</Settings.ItemInput>
|
|
68
68
|
|
|
69
|
-
<
|
|
69
|
+
<Settings.ItemInput title={t('settings edge llm model label')}>
|
|
70
70
|
<Select.Root
|
|
71
71
|
value={settings.edgeModel ?? DEFAULT_VALUE}
|
|
72
72
|
onValueChange={(value) => {
|
|
@@ -88,9 +88,9 @@ export const AssistantSettings = ({ settings, onSettingsChange }: AssistantSetti
|
|
|
88
88
|
</Select.Content>
|
|
89
89
|
</Select.Portal>
|
|
90
90
|
</Select.Root>
|
|
91
|
-
</
|
|
91
|
+
</Settings.ItemInput>
|
|
92
92
|
|
|
93
|
-
<
|
|
93
|
+
<Settings.ItemInput title={t('settings ollama llm model label')}>
|
|
94
94
|
<Select.Root
|
|
95
95
|
value={settings.ollamaModel ?? DEFAULT_VALUE}
|
|
96
96
|
onValueChange={(value) => {
|
|
@@ -112,9 +112,9 @@ export const AssistantSettings = ({ settings, onSettingsChange }: AssistantSetti
|
|
|
112
112
|
</Select.Content>
|
|
113
113
|
</Select.Portal>
|
|
114
114
|
</Select.Root>
|
|
115
|
-
</
|
|
116
|
-
</
|
|
117
|
-
</
|
|
118
|
-
</
|
|
115
|
+
</Settings.ItemInput>
|
|
116
|
+
</Settings.Group>
|
|
117
|
+
</Settings.Section>
|
|
118
|
+
</Settings.Root>
|
|
119
119
|
);
|
|
120
120
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
9
|
+
import { Panel, Toolbar } from '@dxos/react-ui';
|
|
10
|
+
import { useAttention } from '@dxos/react-ui-attention';
|
|
11
|
+
|
|
12
|
+
import { TemplateEditor } from '../../components';
|
|
13
|
+
|
|
14
|
+
export type BlueprintArticleProps = SurfaceComponentProps<Blueprint.Blueprint>;
|
|
15
|
+
|
|
16
|
+
export const BlueprintArticle = ({ role, attendableId, subject }: BlueprintArticleProps) => {
|
|
17
|
+
const { hasAttention } = useAttention(attendableId);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Panel.Root role={role} classNames='dx-article'>
|
|
21
|
+
<Panel.Toolbar asChild>
|
|
22
|
+
<Toolbar.Root disabled={!hasAttention} />
|
|
23
|
+
</Panel.Toolbar>
|
|
24
|
+
<Panel.Content asChild>
|
|
25
|
+
<TemplateEditor id={subject.id} template={subject.instructions} />
|
|
26
|
+
</Panel.Content>
|
|
27
|
+
</Panel.Root>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
@@ -5,25 +5,27 @@
|
|
|
5
5
|
import * as Array from 'effect/Array';
|
|
6
6
|
import * as Function from 'effect/Function';
|
|
7
7
|
import * as Option from 'effect/Option';
|
|
8
|
-
import React, { forwardRef, useCallback, useEffect, useMemo, useState } from 'react';
|
|
8
|
+
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { useAtomCapability, useCapabilities, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
11
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
12
|
+
import { Chat } from '@dxos/assistant-toolkit';
|
|
12
13
|
import { Blueprint } from '@dxos/blueprints';
|
|
13
14
|
import { getSpace } from '@dxos/client/echo';
|
|
14
|
-
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
15
|
+
import { DXN, Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
15
16
|
import { SpaceOperation } from '@dxos/plugin-space/types';
|
|
16
17
|
import { useQuery } from '@dxos/react-client/echo';
|
|
17
18
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
18
19
|
|
|
19
|
-
import {
|
|
20
|
-
import { useBlueprintRegistry, useContextBinder } from '
|
|
21
|
-
import { Assistant, AssistantOperation } from '
|
|
20
|
+
import { type ChatEvent } from '../../components';
|
|
21
|
+
import { useBlueprintRegistry, useContextBinder } from '../../hooks';
|
|
22
|
+
import { Assistant, AssistantCapabilities, AssistantOperation } from '../../types';
|
|
23
|
+
import ChatContainer from '../ChatContainer';
|
|
22
24
|
|
|
23
25
|
export type ChatCompanionProps = {
|
|
24
26
|
role?: string;
|
|
25
27
|
data: {
|
|
26
|
-
subject:
|
|
28
|
+
subject: Chat.Chat | 'assistant-chat';
|
|
27
29
|
companionTo: Obj.Unknown;
|
|
28
30
|
};
|
|
29
31
|
};
|
|
@@ -36,9 +38,49 @@ export const ChatCompanion = forwardRef<HTMLDivElement, ChatCompanionProps>(
|
|
|
36
38
|
|
|
37
39
|
const space = getSpace(companionTo);
|
|
38
40
|
const [chat, setChat] = useState(data.subject === 'assistant-chat' ? undefined : data.subject);
|
|
41
|
+
|
|
42
|
+
// Watch the state atom directly to detect when plus button clears the chat selection.
|
|
43
|
+
const state = useAtomCapability(AssistantCapabilities.State);
|
|
44
|
+
const companionToId = Obj.getDXN(companionTo).toString();
|
|
45
|
+
const currentChatState = state?.currentChat[companionToId];
|
|
46
|
+
|
|
47
|
+
// Track if initial setup has been done (to distinguish initial mount from plus button click).
|
|
48
|
+
// Reset when companionTo changes.
|
|
49
|
+
const initialSetupDoneRef = useRef(false);
|
|
50
|
+
const prevCompanionToIdRef = useRef(companionToId);
|
|
51
|
+
if (prevCompanionToIdRef.current !== companionToId) {
|
|
52
|
+
initialSetupDoneRef.current = false;
|
|
53
|
+
prevCompanionToIdRef.current = companionToId;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Sync local chat state with the state atom.
|
|
57
|
+
// When currentChatState is undefined (plus button clicked), reset local chat.
|
|
58
|
+
// When data.subject is a Chat object, use it directly.
|
|
59
|
+
// When currentChatState is a different chat, fetch and set it.
|
|
39
60
|
useEffect(() => {
|
|
40
|
-
|
|
41
|
-
|
|
61
|
+
// If state says no chat selected AND current chat is persisted, reset local state (handles plus button click).
|
|
62
|
+
// Don't reset in-memory chats - they're expected to have currentChatState === undefined.
|
|
63
|
+
if (!currentChatState && chat && getSpace(chat)) {
|
|
64
|
+
setChat(undefined);
|
|
65
|
+
} else if (data.subject !== 'assistant-chat') {
|
|
66
|
+
// If data.subject is a Chat object (resolved from graph), use it.
|
|
67
|
+
setChat(data.subject);
|
|
68
|
+
} else if (currentChatState && space) {
|
|
69
|
+
// currentChatState is set but graph couldn't resolve it - fetch manually.
|
|
70
|
+
const currentChatDxnStr = chat ? Obj.getDXN(chat).toString() : undefined;
|
|
71
|
+
if (currentChatState !== currentChatDxnStr) {
|
|
72
|
+
// Parse DXN and fetch the chat object from the database.
|
|
73
|
+
const parsedDxn = DXN.tryParse(currentChatState);
|
|
74
|
+
if (parsedDxn) {
|
|
75
|
+
const chatRef = space.db.makeRef(parsedDxn);
|
|
76
|
+
const resolvedChat = chatRef?.target;
|
|
77
|
+
if (Obj.instanceOf(Assistant.Chat, resolvedChat)) {
|
|
78
|
+
setChat(resolvedChat);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, [currentChatState, data.subject, space, chat]);
|
|
42
84
|
|
|
43
85
|
const chatQueue = space && chat ? space.queues.get(chat.queue.dxn) : undefined;
|
|
44
86
|
const binder = useContextBinder(chatQueue);
|
|
@@ -49,19 +91,41 @@ export const ChatCompanion = forwardRef<HTMLDivElement, ChatCompanionProps>(
|
|
|
49
91
|
return;
|
|
50
92
|
}
|
|
51
93
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
94
|
+
// Only query for existing chats on initial mount, not when plus button is clicked.
|
|
95
|
+
if (!initialSetupDoneRef.current) {
|
|
96
|
+
// Query for existing companion chats linked to this object.
|
|
97
|
+
const existingChats = await space.db
|
|
98
|
+
.query(Query.select(Filter.id(companionTo.id)).targetOf(Chat.CompanionTo).source())
|
|
99
|
+
.run();
|
|
100
|
+
|
|
101
|
+
initialSetupDoneRef.current = true;
|
|
102
|
+
|
|
103
|
+
// Use existing chat if found on initial mount.
|
|
104
|
+
if (existingChats.length > 0) {
|
|
105
|
+
const existingChat = existingChats.at(-1) as Assistant.Chat;
|
|
106
|
+
setChat(existingChat);
|
|
107
|
+
await invokePromise(AssistantOperation.SetCurrentChat, { companionTo, chat: existingChat });
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Create chat in-memory only - it will be added to space on first message.
|
|
113
|
+
const { data: createResult } = await invokePromise(AssistantOperation.CreateChat, {
|
|
114
|
+
db: space.db,
|
|
115
|
+
addToSpace: false,
|
|
116
|
+
});
|
|
117
|
+
setChat(createResult?.object);
|
|
118
|
+
}, [chat, space, companionTo, invokePromise]);
|
|
55
119
|
|
|
56
|
-
// Add chat to space when user submits the first message.
|
|
120
|
+
// Add chat to space and create relation when user submits the first message.
|
|
57
121
|
const handleEvent = useCallback(
|
|
58
122
|
async (event: ChatEvent) => {
|
|
59
|
-
|
|
60
|
-
if (chatInSpace || !chat || !space) {
|
|
123
|
+
if (!chat || !space) {
|
|
61
124
|
return;
|
|
62
125
|
}
|
|
63
126
|
|
|
64
|
-
|
|
127
|
+
// If chat is not in space yet, persist it on first submit.
|
|
128
|
+
if (event.type === 'submit' && !getSpace(chat)) {
|
|
65
129
|
await invokePromise(SpaceOperation.AddObject, {
|
|
66
130
|
object: chat,
|
|
67
131
|
target: space.db,
|
|
@@ -69,7 +133,7 @@ export const ChatCompanion = forwardRef<HTMLDivElement, ChatCompanionProps>(
|
|
|
69
133
|
});
|
|
70
134
|
await invokePromise(SpaceOperation.AddRelation, {
|
|
71
135
|
db: space.db,
|
|
72
|
-
schema:
|
|
136
|
+
schema: Chat.CompanionTo,
|
|
73
137
|
source: chat,
|
|
74
138
|
target: companionTo,
|
|
75
139
|
});
|
|
@@ -82,7 +146,7 @@ export const ChatCompanion = forwardRef<HTMLDivElement, ChatCompanionProps>(
|
|
|
82
146
|
[chat, space, companionTo, invokePromise],
|
|
83
147
|
);
|
|
84
148
|
|
|
85
|
-
const metadata = useCapabilities(
|
|
149
|
+
const metadata = useCapabilities(AppCapabilities.Metadata);
|
|
86
150
|
const blueprintKeys = useMemo(
|
|
87
151
|
() =>
|
|
88
152
|
Function.pipe(
|
|
@@ -125,7 +189,7 @@ export const ChatCompanion = forwardRef<HTMLDivElement, ChatCompanionProps>(
|
|
|
125
189
|
continue;
|
|
126
190
|
}
|
|
127
191
|
|
|
128
|
-
space.db.add(Obj.clone(blueprint));
|
|
192
|
+
space.db.add(Obj.clone(blueprint, { deep: true }));
|
|
129
193
|
}
|
|
130
194
|
}, [space, blueprintRegistry, blueprintKeys]);
|
|
131
195
|
|
|
@@ -159,5 +223,3 @@ export const ChatCompanion = forwardRef<HTMLDivElement, ChatCompanionProps>(
|
|
|
159
223
|
);
|
|
160
224
|
},
|
|
161
225
|
);
|
|
162
|
-
|
|
163
|
-
export default ChatCompanion;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { forwardRef } from 'react';
|
|
6
|
+
|
|
7
|
+
import { useAtomCapability } from '@dxos/app-framework/ui';
|
|
8
|
+
import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
9
|
+
import { type Space, getSpace } from '@dxos/client/echo';
|
|
10
|
+
import { type Obj } from '@dxos/echo';
|
|
11
|
+
import { Panel } from '@dxos/react-ui';
|
|
12
|
+
|
|
13
|
+
import { Chat as ChatComponent, type ChatRootProps } from '../../components';
|
|
14
|
+
import { useBlueprintRegistry, useChatProcessor, useChatServices, useOnline, usePresets } from '../../hooks';
|
|
15
|
+
import { AssistantCapabilities, type ChatType } from '../../types';
|
|
16
|
+
|
|
17
|
+
export type ChatContainerProps = SurfaceComponentProps<
|
|
18
|
+
ChatType.Chat | undefined,
|
|
19
|
+
{
|
|
20
|
+
space?: Space;
|
|
21
|
+
companionTo?: Obj.Unknown;
|
|
22
|
+
} & Pick<ChatRootProps, 'onEvent'>
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
export const ChatContainer = forwardRef<HTMLDivElement, ChatContainerProps>((props, forwardedRef) => {
|
|
26
|
+
const { role, subject: chat, space: spaceProp, companionTo, onEvent } = props;
|
|
27
|
+
const space = spaceProp ?? getSpace(chat);
|
|
28
|
+
const settings = useAtomCapability(AssistantCapabilities.Settings);
|
|
29
|
+
const services = useChatServices({ id: space?.id, chat });
|
|
30
|
+
const [online, setOnline] = useOnline();
|
|
31
|
+
const { preset, ...chatProps } = usePresets(online);
|
|
32
|
+
const blueprintRegistry = useBlueprintRegistry();
|
|
33
|
+
const processor = useChatProcessor({
|
|
34
|
+
space,
|
|
35
|
+
chat,
|
|
36
|
+
preset,
|
|
37
|
+
services,
|
|
38
|
+
blueprintRegistry,
|
|
39
|
+
settings,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (!processor) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<ChatComponent.Root db={space?.db} chat={chat} processor={processor} onEvent={onEvent}>
|
|
48
|
+
<Panel.Root role={role} classNames='dx-article' ref={forwardedRef}>
|
|
49
|
+
<Panel.Toolbar>
|
|
50
|
+
<ChatComponent.Toolbar companionTo={companionTo} />
|
|
51
|
+
</Panel.Toolbar>
|
|
52
|
+
<Panel.Content>
|
|
53
|
+
<ChatComponent.Viewport>
|
|
54
|
+
<ChatComponent.Thread />
|
|
55
|
+
<div role='none' className='p-4'>
|
|
56
|
+
<ChatComponent.Prompt
|
|
57
|
+
{...chatProps}
|
|
58
|
+
outline
|
|
59
|
+
preset={preset?.id}
|
|
60
|
+
online={online}
|
|
61
|
+
onOnlineChange={setOnline}
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
</ChatComponent.Viewport>
|
|
65
|
+
</Panel.Content>
|
|
66
|
+
</Panel.Root>
|
|
67
|
+
</ChatComponent.Root>
|
|
68
|
+
);
|
|
69
|
+
});
|