@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
|
@@ -1,108 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AiChatProcessor,
|
|
3
3
|
AiServicePresets
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JYY5AD65.mjs";
|
|
5
5
|
import {
|
|
6
6
|
AssistantOperation,
|
|
7
|
-
Assistant_exports,
|
|
8
|
-
LLM_PROVIDERS,
|
|
9
7
|
ServiceType
|
|
10
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-734CB3XG.mjs";
|
|
11
9
|
import {
|
|
12
10
|
meta
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
|
|
15
|
-
// src/components/AssistantSettings/AssistantSettings.tsx
|
|
16
|
-
import React from "react";
|
|
17
|
-
import { DEFAULT_EDGE_MODELS, DEFAULT_OLLAMA_MODELS } from "@dxos/ai";
|
|
18
|
-
import { Input, Select, useTranslation } from "@dxos/react-ui";
|
|
19
|
-
import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from "@dxos/react-ui-form";
|
|
20
|
-
var DEFAULT_VALUE = "__default";
|
|
21
|
-
var LLM_PROVIDER_LABELS = {
|
|
22
|
-
edge: "DXOS",
|
|
23
|
-
ollama: "Ollama",
|
|
24
|
-
lmstudio: "LM Studio"
|
|
25
|
-
};
|
|
26
|
-
var AssistantSettings = ({ settings, onSettingsChange }) => {
|
|
27
|
-
const { t } = useTranslation(meta.id);
|
|
28
|
-
return /* @__PURE__ */ React.createElement(ControlPage, null, /* @__PURE__ */ React.createElement(ControlSection, {
|
|
29
|
-
title: t("settings title", {
|
|
30
|
-
ns: meta.id
|
|
31
|
-
})
|
|
32
|
-
}, /* @__PURE__ */ React.createElement(ControlGroup, null, /* @__PURE__ */ React.createElement(ControlItemInput, {
|
|
33
|
-
title: t("settings custom prompts label")
|
|
34
|
-
}, /* @__PURE__ */ React.createElement(Input.Switch, {
|
|
35
|
-
checked: !!settings.customPrompts,
|
|
36
|
-
onCheckedChange: (checked) => onSettingsChange((s) => ({
|
|
37
|
-
...s,
|
|
38
|
-
customPrompts: checked
|
|
39
|
-
}))
|
|
40
|
-
})), /* @__PURE__ */ React.createElement(ControlItemInput, {
|
|
41
|
-
title: t("settings llm provider label")
|
|
42
|
-
}, /* @__PURE__ */ React.createElement(Select.Root, {
|
|
43
|
-
value: settings.llmProvider ?? "edge",
|
|
44
|
-
onValueChange: (value) => {
|
|
45
|
-
onSettingsChange((s) => ({
|
|
46
|
-
...s,
|
|
47
|
-
llmProvider: value === DEFAULT_VALUE ? void 0 : value
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
|
-
}, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
|
|
51
|
-
placeholder: t("settings llm provider label")
|
|
52
|
-
}), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, /* @__PURE__ */ React.createElement(Select.Option, {
|
|
53
|
-
value: DEFAULT_VALUE
|
|
54
|
-
}, t("settings default label")), LLM_PROVIDERS.map((model) => /* @__PURE__ */ React.createElement(Select.Option, {
|
|
55
|
-
key: model,
|
|
56
|
-
value: model
|
|
57
|
-
}, LLM_PROVIDER_LABELS[model]))), /* @__PURE__ */ React.createElement(Select.Arrow, null))))), /* @__PURE__ */ React.createElement(ControlItemInput, {
|
|
58
|
-
title: t("settings edge llm model label")
|
|
59
|
-
}, /* @__PURE__ */ React.createElement(Select.Root, {
|
|
60
|
-
value: settings.edgeModel ?? DEFAULT_VALUE,
|
|
61
|
-
onValueChange: (value) => {
|
|
62
|
-
onSettingsChange((s) => ({
|
|
63
|
-
...s,
|
|
64
|
-
edgeModel: value === DEFAULT_VALUE ? void 0 : value
|
|
65
|
-
}));
|
|
66
|
-
}
|
|
67
|
-
}, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
|
|
68
|
-
placeholder: t("settings default llm model label")
|
|
69
|
-
}), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, /* @__PURE__ */ React.createElement(Select.Option, {
|
|
70
|
-
value: DEFAULT_VALUE
|
|
71
|
-
}, t("settings default label")), DEFAULT_EDGE_MODELS.map((model) => /* @__PURE__ */ React.createElement(Select.Option, {
|
|
72
|
-
key: model,
|
|
73
|
-
value: model
|
|
74
|
-
}, model))), /* @__PURE__ */ React.createElement(Select.Arrow, null))))), /* @__PURE__ */ React.createElement(ControlItemInput, {
|
|
75
|
-
title: t("settings ollama llm model label")
|
|
76
|
-
}, /* @__PURE__ */ React.createElement(Select.Root, {
|
|
77
|
-
value: settings.ollamaModel ?? DEFAULT_VALUE,
|
|
78
|
-
onValueChange: (value) => {
|
|
79
|
-
onSettingsChange((s) => ({
|
|
80
|
-
...s,
|
|
81
|
-
ollamaModel: value === DEFAULT_VALUE ? void 0 : value
|
|
82
|
-
}));
|
|
83
|
-
}
|
|
84
|
-
}, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
|
|
85
|
-
placeholder: t("settings default llm model label")
|
|
86
|
-
}), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, /* @__PURE__ */ React.createElement(Select.Option, {
|
|
87
|
-
value: DEFAULT_VALUE
|
|
88
|
-
}, t("settings default label")), DEFAULT_OLLAMA_MODELS.map((model) => /* @__PURE__ */ React.createElement(Select.Option, {
|
|
89
|
-
key: model,
|
|
90
|
-
value: model
|
|
91
|
-
}, model))), /* @__PURE__ */ React.createElement(Select.Arrow, null))))))));
|
|
92
|
-
};
|
|
11
|
+
} from "./chunk-2VIEX4RA.mjs";
|
|
93
12
|
|
|
94
13
|
// src/hooks/useBlueprintRegistry.ts
|
|
95
14
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
15
|
+
import { useCapabilities } from "@dxos/app-framework/ui";
|
|
16
|
+
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
98
17
|
import { Blueprint } from "@dxos/blueprints";
|
|
99
18
|
import { Filter, Obj, Ref } from "@dxos/echo";
|
|
100
19
|
import { useQuery } from "@dxos/react-client/echo";
|
|
101
20
|
import { distinctBy } from "@dxos/util";
|
|
102
21
|
var useBlueprintRegistry = () => {
|
|
103
|
-
const
|
|
104
|
-
return useMemo(() => new Blueprint.Registry(
|
|
105
|
-
|
|
22
|
+
const blueprintDefinitions = useCapabilities(AppCapabilities.BlueprintDefinition);
|
|
23
|
+
return useMemo(() => new Blueprint.Registry(blueprintDefinitions.map((blueprint) => blueprint.make())), [
|
|
24
|
+
blueprintDefinitions
|
|
106
25
|
]);
|
|
107
26
|
};
|
|
108
27
|
var useBlueprints = ({ blueprintRegistry, db }) => {
|
|
@@ -219,7 +138,7 @@ var useChatProcessor = ({ space, chat, preset, services, blueprintRegistry, sett
|
|
|
219
138
|
settings
|
|
220
139
|
}, {
|
|
221
140
|
F: __dxlog_file,
|
|
222
|
-
L:
|
|
141
|
+
L: 69,
|
|
223
142
|
S: void 0,
|
|
224
143
|
C: (f, a) => f(...a)
|
|
225
144
|
});
|
|
@@ -240,7 +159,7 @@ var useChatProcessor = ({ space, chat, preset, services, blueprintRegistry, sett
|
|
|
240
159
|
// src/hooks/useChatServices.ts
|
|
241
160
|
import * as Effect from "effect/Effect";
|
|
242
161
|
import { useMemo as useMemo3 } from "react";
|
|
243
|
-
import { useCapability } from "@dxos/app-framework/
|
|
162
|
+
import { useCapability } from "@dxos/app-framework/ui";
|
|
244
163
|
import { TracingService } from "@dxos/functions";
|
|
245
164
|
import { TracingServiceExt } from "@dxos/functions-runtime";
|
|
246
165
|
import { AutomationCapabilities } from "@dxos/plugin-automation";
|
|
@@ -262,34 +181,32 @@ var useChatServices = ({ id, chat }) => {
|
|
|
262
181
|
import { Atom } from "@effect-atom/atom-react";
|
|
263
182
|
import * as Effect2 from "effect/Effect";
|
|
264
183
|
import { useMemo as useMemo10 } from "react";
|
|
265
|
-
import { useOperationInvoker } from "@dxos/app-framework/
|
|
266
|
-
import {
|
|
184
|
+
import { useOperationInvoker } from "@dxos/app-framework/ui";
|
|
185
|
+
import { Chat as Chat2 } from "@dxos/assistant-toolkit";
|
|
186
|
+
import { Filter as Filter6, Obj as Obj6, Query } from "@dxos/echo";
|
|
267
187
|
import { runAndForwardErrors } from "@dxos/effect";
|
|
268
188
|
import { invariant } from "@dxos/invariant";
|
|
269
|
-
import { useQuery as
|
|
189
|
+
import { useQuery as useQuery5 } from "@dxos/react-client/echo";
|
|
270
190
|
import { MenuBuilder, useMenuActions } from "@dxos/react-ui-menu";
|
|
271
191
|
|
|
272
|
-
// src/components/index.ts
|
|
273
|
-
import { lazy } from "react";
|
|
274
|
-
|
|
275
192
|
// src/components/Chat/Chat.tsx
|
|
276
193
|
import { Prec } from "@codemirror/state";
|
|
277
194
|
import { keymap } from "@codemirror/view";
|
|
278
195
|
import { useAtomValue } from "@effect-atom/atom-react";
|
|
279
196
|
import { createContext } from "@radix-ui/react-context";
|
|
280
197
|
import * as Array2 from "effect/Array";
|
|
281
|
-
import * as
|
|
282
|
-
import
|
|
198
|
+
import * as Option4 from "effect/Option";
|
|
199
|
+
import React9, { useCallback as useCallback7, useEffect as useEffect7, useMemo as useMemo9, useRef as useRef3, useState as useState12 } from "react";
|
|
283
200
|
import { Event } from "@dxos/async";
|
|
284
|
-
import { Obj as Obj5 } from "@dxos/echo";
|
|
201
|
+
import { Filter as Filter4, Obj as Obj5 } from "@dxos/echo";
|
|
285
202
|
import { useVoiceInput } from "@dxos/plugin-transcription";
|
|
286
|
-
import {
|
|
203
|
+
import { useQuery as useQuery3 } from "@dxos/react-client/echo";
|
|
287
204
|
import { useIdentity } from "@dxos/react-client/halo";
|
|
288
|
-
import { Input
|
|
205
|
+
import { Input, useDynamicRef, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
289
206
|
import { ChatEditor } from "@dxos/react-ui-chat";
|
|
290
|
-
import {
|
|
207
|
+
import { Menu } from "@dxos/react-ui-menu";
|
|
291
208
|
import { Message } from "@dxos/types";
|
|
292
|
-
import { mx as
|
|
209
|
+
import { mx as mx6 } from "@dxos/ui-theme";
|
|
293
210
|
import { isTruthy } from "@dxos/util";
|
|
294
211
|
|
|
295
212
|
// src/hooks/useContextBinder.ts
|
|
@@ -454,11 +371,8 @@ var usePresets = (online) => {
|
|
|
454
371
|
|
|
455
372
|
// src/hooks/useReferencesProvider.ts
|
|
456
373
|
import { useMemo as useMemo5 } from "react";
|
|
457
|
-
import { Common as Common2 } from "@dxos/app-framework";
|
|
458
|
-
import { useCapabilities as useCapabilities2 } from "@dxos/app-framework/react";
|
|
459
374
|
import { Filter as Filter2, Obj as Obj2 } from "@dxos/echo";
|
|
460
375
|
var useReferencesProvider = (space) => {
|
|
461
|
-
const blueprints = useCapabilities2(Common2.Capability.BlueprintDefinition);
|
|
462
376
|
return useMemo5(() => {
|
|
463
377
|
if (!space) {
|
|
464
378
|
return void 0;
|
|
@@ -480,21 +394,20 @@ var useReferencesProvider = (space) => {
|
|
|
480
394
|
}
|
|
481
395
|
};
|
|
482
396
|
}, [
|
|
483
|
-
space
|
|
484
|
-
blueprints
|
|
397
|
+
space
|
|
485
398
|
]);
|
|
486
399
|
};
|
|
487
400
|
var stringMatch = (query, label) => label.toLowerCase().startsWith(query.toLowerCase());
|
|
488
401
|
|
|
489
402
|
// src/components/ChatPrompt/ChatActions.tsx
|
|
490
|
-
import
|
|
491
|
-
import { IconButton, useTranslation
|
|
403
|
+
import React from "react";
|
|
404
|
+
import { IconButton, useTranslation } from "@dxos/react-ui";
|
|
492
405
|
import { mx } from "@dxos/ui-theme";
|
|
493
406
|
var ChatActions = ({ classNames, children, microphone, recording, processing, onEvent }) => {
|
|
494
|
-
const { t } =
|
|
495
|
-
return /* @__PURE__ */
|
|
496
|
-
className: mx("flex items-center
|
|
497
|
-
}, children, /* @__PURE__ */
|
|
407
|
+
const { t } = useTranslation(meta.id);
|
|
408
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
409
|
+
className: mx("flex items-center me-1", classNames)
|
|
410
|
+
}, children, /* @__PURE__ */ React.createElement(IconButton, {
|
|
498
411
|
disabled: !processing,
|
|
499
412
|
variant: "ghost",
|
|
500
413
|
icon: "ph--x--regular",
|
|
@@ -503,7 +416,7 @@ var ChatActions = ({ classNames, children, microphone, recording, processing, on
|
|
|
503
416
|
onClick: () => onEvent?.({
|
|
504
417
|
type: "cancel"
|
|
505
418
|
})
|
|
506
|
-
}), microphone && /* @__PURE__ */
|
|
419
|
+
}), microphone && /* @__PURE__ */ React.createElement(IconButton, {
|
|
507
420
|
disabled: !processing,
|
|
508
421
|
classNames: mx(recording && "bg-primary-500"),
|
|
509
422
|
variant: "ghost",
|
|
@@ -523,82 +436,93 @@ var ChatActions = ({ classNames, children, microphone, recording, processing, on
|
|
|
523
436
|
onTouchEnd: () => onEvent?.({
|
|
524
437
|
type: "record-stop"
|
|
525
438
|
})
|
|
439
|
+
}), /* @__PURE__ */ React.createElement(IconButton, {
|
|
440
|
+
variant: "ghost",
|
|
441
|
+
icon: "ph--wrench--regular",
|
|
442
|
+
iconOnly: true,
|
|
443
|
+
label: t("debug button"),
|
|
444
|
+
onClick: () => onEvent?.({
|
|
445
|
+
type: "toggle-debug"
|
|
446
|
+
})
|
|
526
447
|
}));
|
|
527
448
|
};
|
|
528
449
|
|
|
529
450
|
// src/components/ChatPrompt/ChatOptions.tsx
|
|
530
|
-
import
|
|
451
|
+
import * as Option2 from "effect/Option";
|
|
452
|
+
import React2, { useMemo as useMemo6, useState as useState8 } from "react";
|
|
531
453
|
import { Filter as Filter3, Obj as Obj3, Type } from "@dxos/echo";
|
|
454
|
+
import { Annotation } from "@dxos/echo";
|
|
532
455
|
import { useQuery as useQuery2 } from "@dxos/react-client/echo";
|
|
533
|
-
import { IconButton as IconButton2, Popover, Select
|
|
456
|
+
import { IconButton as IconButton2, Popover, Select, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
534
457
|
import { Listbox, SearchList, useSearchListResults } from "@dxos/react-ui-searchlist";
|
|
535
458
|
import { Tabs } from "@dxos/react-ui-tabs";
|
|
536
|
-
|
|
459
|
+
import { getStyles, mx as mx2 } from "@dxos/ui-theme";
|
|
460
|
+
var panelClassNames = "w-[calc(100dvw-.5rem)] sm:w-max md:w-72 max-w-text-content";
|
|
537
461
|
var ChatOptions = ({ db, context, blueprintRegistry, presets, preset, onPresetChange }) => {
|
|
538
|
-
const { t } =
|
|
539
|
-
return /* @__PURE__ */
|
|
462
|
+
const { t } = useTranslation2(meta.id);
|
|
463
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
540
464
|
role: "none",
|
|
541
465
|
className: "flex p-2"
|
|
542
|
-
}, /* @__PURE__ */
|
|
466
|
+
}, /* @__PURE__ */ React2.createElement(Popover.Root, null, /* @__PURE__ */ React2.createElement(Popover.Trigger, {
|
|
543
467
|
asChild: true
|
|
544
|
-
}, /* @__PURE__ */
|
|
468
|
+
}, /* @__PURE__ */ React2.createElement(IconButton2, {
|
|
545
469
|
variant: "ghost",
|
|
546
470
|
icon: "ph--plus--regular",
|
|
547
471
|
iconOnly: true,
|
|
548
472
|
label: t("context objects button")
|
|
549
|
-
})), /* @__PURE__ */
|
|
473
|
+
})), /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, {
|
|
550
474
|
side: "top",
|
|
551
475
|
classNames: panelClassNames
|
|
552
|
-
}, /* @__PURE__ */
|
|
476
|
+
}, /* @__PURE__ */ React2.createElement(Popover.Viewport, null, /* @__PURE__ */ React2.createElement(ObjectsPanel, {
|
|
553
477
|
db,
|
|
554
478
|
context
|
|
555
|
-
})), /* @__PURE__ */
|
|
479
|
+
})), /* @__PURE__ */ React2.createElement(Popover.Arrow, null)))), /* @__PURE__ */ React2.createElement(Popover.Root, null, /* @__PURE__ */ React2.createElement(Popover.Trigger, {
|
|
556
480
|
asChild: true
|
|
557
|
-
}, /* @__PURE__ */
|
|
481
|
+
}, /* @__PURE__ */ React2.createElement(IconButton2, {
|
|
558
482
|
variant: "ghost",
|
|
559
483
|
icon: "ph--sliders-horizontal--regular",
|
|
560
484
|
iconOnly: true,
|
|
561
485
|
label: t("context settings button")
|
|
562
|
-
})), /* @__PURE__ */
|
|
486
|
+
})), /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, {
|
|
563
487
|
side: "top",
|
|
564
488
|
classNames: panelClassNames
|
|
565
|
-
}, /* @__PURE__ */
|
|
489
|
+
}, /* @__PURE__ */ React2.createElement(Popover.Viewport, null, /* @__PURE__ */ React2.createElement(Tabs.Root, {
|
|
566
490
|
orientation: "horizontal",
|
|
567
491
|
defaultValue: "blueprints",
|
|
568
492
|
defaultActivePart: "list",
|
|
569
493
|
tabIndex: -1
|
|
570
|
-
}, /* @__PURE__ */
|
|
571
|
-
classNames:
|
|
572
|
-
}, /* @__PURE__ */
|
|
494
|
+
}, /* @__PURE__ */ React2.createElement(Tabs.Viewport, {
|
|
495
|
+
classNames: mx2("max-h-(--radix-popover-content-available-height) grid grid-rows-[1fr_min-content]", '[&_[cmdk-root]]:contents [&_[role="tabpanel"]]:grid [&_[role="tabpanel"]]:grid-rows-[1fr_min-content]', '[&_[role="listbox"]]:min-h-0 [&_[role="listbox"]]:overflow-y-auto', '[&_[role="tabpanel"]]:min-h-0 [&_[role="tabpanel"]]:px-form-chrome [&_[role="tabpanel"][data-state="active"]]:order-first [&_[role="tabpanel"][data-state="inactive"]]:hidden')
|
|
496
|
+
}, /* @__PURE__ */ React2.createElement(Tabs.Tabpanel, {
|
|
573
497
|
value: "blueprints",
|
|
574
498
|
tabIndex: -1,
|
|
575
499
|
classNames: "dx-focus-ring-inset"
|
|
576
|
-
}, /* @__PURE__ */
|
|
500
|
+
}, /* @__PURE__ */ React2.createElement(BlueprintsPanel, {
|
|
577
501
|
blueprintRegistry,
|
|
578
502
|
db,
|
|
579
503
|
context
|
|
580
|
-
})), /* @__PURE__ */
|
|
504
|
+
})), /* @__PURE__ */ React2.createElement(Tabs.Tabpanel, {
|
|
581
505
|
value: "model",
|
|
582
506
|
tabIndex: -1,
|
|
583
|
-
classNames: "dx-focus-ring-inset
|
|
584
|
-
}, /* @__PURE__ */
|
|
507
|
+
classNames: "dx-focus-ring-inset px-0!"
|
|
508
|
+
}, /* @__PURE__ */ React2.createElement(ModelsPanel, {
|
|
585
509
|
presets,
|
|
586
510
|
preset,
|
|
587
511
|
onPresetChange
|
|
588
|
-
})), /* @__PURE__ */
|
|
589
|
-
classNames: "sm:overflow-x-hidden justify-center p-
|
|
590
|
-
}, /* @__PURE__ */
|
|
512
|
+
})), /* @__PURE__ */ React2.createElement(Tabs.Tablist, {
|
|
513
|
+
classNames: "sm:overflow-x-hidden justify-center p-form-chrome border-y border-subdued-separator order-last"
|
|
514
|
+
}, /* @__PURE__ */ React2.createElement(Tabs.IconTab, {
|
|
591
515
|
value: "blueprints",
|
|
592
516
|
icon: "ph--blueprint--regular",
|
|
593
517
|
label: t("blueprints in context title")
|
|
594
|
-
}), /* @__PURE__ */
|
|
518
|
+
}), /* @__PURE__ */ React2.createElement(Tabs.IconTab, {
|
|
595
519
|
value: "model",
|
|
596
520
|
label: t("chat model title"),
|
|
597
521
|
icon: "ph--cpu--regular"
|
|
598
|
-
}))))), /* @__PURE__ */
|
|
522
|
+
}))))), /* @__PURE__ */ React2.createElement(Popover.Arrow, null)))));
|
|
599
523
|
};
|
|
600
524
|
var BlueprintsPanel = ({ blueprintRegistry, db, context }) => {
|
|
601
|
-
const { t } =
|
|
525
|
+
const { t } = useTranslation2(meta.id);
|
|
602
526
|
const blueprints = useBlueprints({
|
|
603
527
|
blueprintRegistry,
|
|
604
528
|
db
|
|
@@ -615,13 +539,13 @@ var BlueprintsPanel = ({ blueprintRegistry, db, context }) => {
|
|
|
615
539
|
items: blueprints,
|
|
616
540
|
extract: (blueprint) => blueprint.name
|
|
617
541
|
});
|
|
618
|
-
return /* @__PURE__ */
|
|
542
|
+
return /* @__PURE__ */ React2.createElement(SearchList.Root, {
|
|
619
543
|
onSearch: handleSearch
|
|
620
|
-
}, /* @__PURE__ */
|
|
621
|
-
classNames: "
|
|
622
|
-
}, /* @__PURE__ */
|
|
544
|
+
}, /* @__PURE__ */ React2.createElement(SearchList.Content, {
|
|
545
|
+
classNames: "py-form-chrome"
|
|
546
|
+
}, /* @__PURE__ */ React2.createElement(SearchList.Viewport, null, results.map((blueprint) => {
|
|
623
547
|
const isActive = activeBlueprints.has(blueprint.key);
|
|
624
|
-
return /* @__PURE__ */
|
|
548
|
+
return /* @__PURE__ */ React2.createElement(SearchList.Item, {
|
|
625
549
|
classNames: "flex items-center overflow-hidden",
|
|
626
550
|
key: blueprint.key,
|
|
627
551
|
value: blueprint.key,
|
|
@@ -629,27 +553,27 @@ var BlueprintsPanel = ({ blueprintRegistry, db, context }) => {
|
|
|
629
553
|
checked: isActive,
|
|
630
554
|
onSelect: () => onUpdateBlueprint?.(blueprint.key, !isActive)
|
|
631
555
|
});
|
|
632
|
-
}))), /* @__PURE__ */
|
|
556
|
+
}))), /* @__PURE__ */ React2.createElement(SearchList.Input, {
|
|
633
557
|
placeholder: t("search placeholder"),
|
|
634
|
-
classNames: "
|
|
558
|
+
classNames: "mb-form-chrome",
|
|
635
559
|
autoFocus: true
|
|
636
560
|
}));
|
|
637
561
|
};
|
|
638
562
|
var ModelsPanel = ({ presets, preset, onPresetChange }) => {
|
|
639
|
-
return /* @__PURE__ */
|
|
563
|
+
return /* @__PURE__ */ React2.createElement(Listbox.Root, {
|
|
640
564
|
value: preset,
|
|
641
565
|
onValueChange: onPresetChange,
|
|
642
566
|
autoFocus: true
|
|
643
567
|
}, presets?.map(({ id, label }) => {
|
|
644
|
-
return /* @__PURE__ */
|
|
568
|
+
return /* @__PURE__ */ React2.createElement(Listbox.Option, {
|
|
645
569
|
key: id,
|
|
646
570
|
value: id
|
|
647
|
-
}, /* @__PURE__ */
|
|
571
|
+
}, /* @__PURE__ */ React2.createElement(Listbox.OptionLabel, null, label), /* @__PURE__ */ React2.createElement(Listbox.OptionIndicator, null));
|
|
648
572
|
}));
|
|
649
573
|
};
|
|
650
574
|
var ANY = "__any__";
|
|
651
575
|
var ObjectsPanel = ({ db, context }) => {
|
|
652
|
-
const { t } =
|
|
576
|
+
const { t } = useTranslation2(meta.id);
|
|
653
577
|
const types = useFilteredTypes(db);
|
|
654
578
|
const typenames = useMemo6(() => {
|
|
655
579
|
const typenames2 = types.map((type) => {
|
|
@@ -680,61 +604,70 @@ var ObjectsPanel = ({ db, context }) => {
|
|
|
680
604
|
items: objects,
|
|
681
605
|
extract: (object) => Obj3.getLabel(object) ?? Obj3.getTypename(object) ?? object.id
|
|
682
606
|
});
|
|
683
|
-
return /* @__PURE__ */
|
|
607
|
+
return /* @__PURE__ */ React2.createElement(SearchList.Root, {
|
|
684
608
|
onSearch: handleSearch
|
|
685
|
-
}, /* @__PURE__ */
|
|
686
|
-
classNames: "p-
|
|
687
|
-
}, /* @__PURE__ */
|
|
609
|
+
}, /* @__PURE__ */ React2.createElement(SearchList.Content, {
|
|
610
|
+
classNames: "p-form-chrome [&:has([cmdk-list-sizer]:empty)]:py-0"
|
|
611
|
+
}, /* @__PURE__ */ React2.createElement(SearchList.Viewport, null, results.length ? results.map((object) => {
|
|
688
612
|
const isActive = contextObjects.findIndex((obj) => obj.id === object.id) !== -1;
|
|
689
|
-
|
|
613
|
+
const { icon, hue } = Option2.fromNullable(Obj3.getSchema(object)).pipe(Option2.flatMap(Annotation.IconAnnotation.get), Option2.getOrElse(() => ({
|
|
614
|
+
icon: DEFAULT_OBJECT_ICON,
|
|
615
|
+
hue: void 0
|
|
616
|
+
})));
|
|
617
|
+
const styles = hue ? getStyles(hue) : void 0;
|
|
618
|
+
return /* @__PURE__ */ React2.createElement(SearchList.Item, {
|
|
690
619
|
classNames: "flex items-center overflow-hidden",
|
|
691
620
|
key: object.id,
|
|
692
621
|
value: object.id,
|
|
622
|
+
icon,
|
|
623
|
+
iconClassNames: styles?.surfaceText,
|
|
693
624
|
label: Obj3.getLabel(object) ?? Obj3.getTypename(object) ?? object.id,
|
|
694
625
|
checked: isActive,
|
|
695
626
|
onSelect: () => onUpdateObject?.(Obj3.getDXN(object), !isActive)
|
|
696
627
|
});
|
|
697
|
-
}) : /* @__PURE__ */
|
|
628
|
+
}) : /* @__PURE__ */ React2.createElement(SearchList.Item, {
|
|
698
629
|
value: "__empty__",
|
|
699
630
|
label: t("no results")
|
|
700
|
-
}))), /* @__PURE__ */
|
|
631
|
+
}))), /* @__PURE__ */ React2.createElement("div", {
|
|
701
632
|
role: "none",
|
|
702
|
-
className: "grid grid-cols-[min-content_1fr] gap-2
|
|
703
|
-
}, /* @__PURE__ */
|
|
633
|
+
className: "grid grid-cols-[min-content_1fr] gap-2 px-form-chrome mb-form-chrome"
|
|
634
|
+
}, /* @__PURE__ */ React2.createElement(Select.Root, {
|
|
704
635
|
value: typename === ANY ? void 0 : typename,
|
|
705
636
|
onValueChange: setTypename
|
|
706
|
-
}, /* @__PURE__ */
|
|
637
|
+
}, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
|
|
707
638
|
density: "fine",
|
|
708
639
|
placeholder: t("type filter placeholder")
|
|
709
|
-
}), /* @__PURE__ */
|
|
640
|
+
}), /* @__PURE__ */ React2.createElement(Select.Portal, null, /* @__PURE__ */ React2.createElement(Select.Content, null, /* @__PURE__ */ React2.createElement(Select.ScrollUpButton, null), /* @__PURE__ */ React2.createElement(Select.Viewport, null, /* @__PURE__ */ React2.createElement(Select.Option, {
|
|
710
641
|
value: ANY
|
|
711
|
-
}, t("any type filter label")), typenames.map(({ typename: typename2, label }) => /* @__PURE__ */
|
|
642
|
+
}, t("any type filter label")), typenames.map(({ typename: typename2, label }) => /* @__PURE__ */ React2.createElement(Select.Option, {
|
|
712
643
|
key: typename2,
|
|
713
644
|
value: typename2
|
|
714
|
-
}, label))), /* @__PURE__ */
|
|
645
|
+
}, label))), /* @__PURE__ */ React2.createElement(Select.ScrollDownButton, null), /* @__PURE__ */ React2.createElement(Select.Arrow, null)))), /* @__PURE__ */ React2.createElement(SearchList.Input, {
|
|
715
646
|
placeholder: t("search placeholder"),
|
|
716
|
-
classNames: "
|
|
647
|
+
classNames: "mb-0",
|
|
717
648
|
autoFocus: true
|
|
718
649
|
})));
|
|
719
650
|
};
|
|
651
|
+
var DEFAULT_OBJECT_ICON = "ph--cube--regular";
|
|
720
652
|
|
|
721
653
|
// src/components/ChatPrompt/ChatPresets.tsx
|
|
722
|
-
import
|
|
723
|
-
import { Select as
|
|
654
|
+
import React3 from "react";
|
|
655
|
+
import { Select as Select2 } from "@dxos/react-ui";
|
|
724
656
|
|
|
725
657
|
// src/components/ChatPrompt/ChatReferences.tsx
|
|
726
|
-
import
|
|
727
|
-
import
|
|
728
|
-
import {
|
|
729
|
-
import {
|
|
658
|
+
import * as Option3 from "effect/Option";
|
|
659
|
+
import React4 from "react";
|
|
660
|
+
import { Annotation as Annotation2, Obj as Obj4 } from "@dxos/echo";
|
|
661
|
+
import { Icon, IconButton as IconButton3, toLocalizedString, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
662
|
+
import { getStyles as getStyles2, mx as mx3 } from "@dxos/ui-theme";
|
|
730
663
|
var ChatReferences = ({ classNames, context, db }) => {
|
|
731
|
-
const { t } =
|
|
664
|
+
const { t } = useTranslation3(meta.id);
|
|
732
665
|
const { objects, onUpdateObject } = useContextObjects({
|
|
733
666
|
db,
|
|
734
667
|
context
|
|
735
668
|
});
|
|
736
|
-
return /* @__PURE__ */
|
|
737
|
-
className:
|
|
669
|
+
return /* @__PURE__ */ React4.createElement("ul", {
|
|
670
|
+
className: mx3("flex", classNames)
|
|
738
671
|
}, objects.map((obj) => {
|
|
739
672
|
const dxn = Obj4.getDXN(obj);
|
|
740
673
|
const typename = Obj4.getTypename(obj);
|
|
@@ -744,11 +677,20 @@ var ChatReferences = ({ classNames, context, db }) => {
|
|
|
744
677
|
ns: typename
|
|
745
678
|
}
|
|
746
679
|
] : obj.id);
|
|
747
|
-
|
|
680
|
+
const { icon, hue } = Option3.fromNullable(Obj4.getSchema(obj)).pipe(Option3.flatMap(Annotation2.IconAnnotation.get), Option3.getOrElse(() => ({
|
|
681
|
+
icon: DEFAULT_OBJECT_ICON2,
|
|
682
|
+
hue: void 0
|
|
683
|
+
})));
|
|
684
|
+
const styles = hue ? getStyles2(hue) : void 0;
|
|
685
|
+
return /* @__PURE__ */ React4.createElement("li", {
|
|
748
686
|
key: dxn.toString(),
|
|
749
|
-
className: "dx-tag
|
|
687
|
+
className: "dx-tag py-0 ps-2 flex items-center gap-1",
|
|
750
688
|
"data-hue": "neutral"
|
|
751
|
-
},
|
|
689
|
+
}, /* @__PURE__ */ React4.createElement(Icon, {
|
|
690
|
+
icon,
|
|
691
|
+
size: 4,
|
|
692
|
+
classNames: styles?.surfaceText
|
|
693
|
+
}), toLocalizedString(label, t), /* @__PURE__ */ React4.createElement(IconButton3, {
|
|
752
694
|
icon: "ph--x--bold",
|
|
753
695
|
iconOnly: true,
|
|
754
696
|
variant: "ghost",
|
|
@@ -759,12 +701,13 @@ var ChatReferences = ({ classNames, context, db }) => {
|
|
|
759
701
|
}));
|
|
760
702
|
}));
|
|
761
703
|
};
|
|
704
|
+
var DEFAULT_OBJECT_ICON2 = "ph--cube--regular";
|
|
762
705
|
|
|
763
706
|
// src/components/ChatPrompt/ChatStatusIndicator.tsx
|
|
764
|
-
import
|
|
707
|
+
import React5, { useEffect as useEffect4, useState as useState9 } from "react";
|
|
765
708
|
import { Tooltip, useTimeout } from "@dxos/react-ui";
|
|
766
709
|
import { Spinner } from "@dxos/react-ui-sfx";
|
|
767
|
-
import { mx as
|
|
710
|
+
import { mx as mx4 } from "@dxos/ui-theme";
|
|
768
711
|
var period = 3e3;
|
|
769
712
|
var ChatStatusIndicator = ({ classNames, preset, processing, error, ...props }) => {
|
|
770
713
|
const [init, setInit] = useState9(false);
|
|
@@ -776,50 +719,50 @@ var ChatStatusIndicator = ({ classNames, preset, processing, error, ...props })
|
|
|
776
719
|
}, period / 2, [
|
|
777
720
|
preset
|
|
778
721
|
]);
|
|
779
|
-
return /* @__PURE__ */
|
|
722
|
+
return /* @__PURE__ */ React5.createElement("div", {
|
|
780
723
|
role: "none",
|
|
781
|
-
className:
|
|
782
|
-
}, /* @__PURE__ */
|
|
724
|
+
className: mx4("relative flex", classNames)
|
|
725
|
+
}, /* @__PURE__ */ React5.createElement(Spinner, {
|
|
783
726
|
duration: period,
|
|
784
727
|
state: !init ? "flash" : error ? "error" : processing ? "spin" : "pulse",
|
|
785
728
|
...props
|
|
786
|
-
}), error && /* @__PURE__ */
|
|
729
|
+
}), error && /* @__PURE__ */ React5.createElement(Tooltip.Trigger, {
|
|
787
730
|
asChild: true,
|
|
788
731
|
content: error.message
|
|
789
|
-
}, /* @__PURE__ */
|
|
732
|
+
}, /* @__PURE__ */ React5.createElement("div", {
|
|
790
733
|
className: "absolute inset-0"
|
|
791
734
|
})));
|
|
792
735
|
};
|
|
793
736
|
|
|
794
737
|
// src/components/ChatThread/ChatThread.tsx
|
|
795
|
-
import
|
|
738
|
+
import React8, { forwardRef, useCallback as useCallback6, useEffect as useEffect6, useMemo as useMemo8, useState as useState11 } from "react";
|
|
796
739
|
import { PublicKey } from "@dxos/keys";
|
|
797
740
|
import { useForwardedRef } from "@dxos/react-ui";
|
|
798
741
|
import { MarkdownStream } from "@dxos/react-ui-components";
|
|
799
|
-
import { mx as
|
|
742
|
+
import { mx as mx5 } from "@dxos/ui-theme";
|
|
800
743
|
import { keyToFallback } from "@dxos/util";
|
|
801
744
|
|
|
802
745
|
// src/components/ChatThread/registry.tsx
|
|
803
|
-
import
|
|
746
|
+
import React7 from "react";
|
|
804
747
|
import { log as log2 } from "@dxos/log";
|
|
805
|
-
import {
|
|
806
|
-
import { PromptWidget, ReferenceWidget, SelectWidget, SuggestionWidget, SummaryWidget } from "@dxos/react-ui-components";
|
|
748
|
+
import { TogglePanel as TogglePanel2 } from "@dxos/react-ui-components";
|
|
749
|
+
import { PromptWidget, ReasoningWidget, ReferenceWidget, SelectWidget, SuggestionWidget, SummaryWidget } from "@dxos/react-ui-components";
|
|
807
750
|
import { Json as Json2 } from "@dxos/react-ui-syntax-highlighter";
|
|
808
751
|
import { ContentBlock } from "@dxos/types";
|
|
809
752
|
import { getXmlTextChild } from "@dxos/ui-editor";
|
|
810
753
|
|
|
811
754
|
// src/components/ToolBlock/ToolBlock.tsx
|
|
812
|
-
import
|
|
813
|
-
import { useTranslation as
|
|
814
|
-
import { NumericTabs, TextCrawl,
|
|
755
|
+
import React6, { useCallback as useCallback5, useEffect as useEffect5, useMemo as useMemo7, useRef as useRef2, useState as useState10 } from "react";
|
|
756
|
+
import { useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
757
|
+
import { NumericTabs, TextCrawl, TogglePanel } from "@dxos/react-ui-components";
|
|
815
758
|
import { Json } from "@dxos/react-ui-syntax-highlighter";
|
|
816
759
|
import { isNonNullable, safeParseJson } from "@dxos/util";
|
|
817
760
|
var ToolBlock = ({ view, blocks = [] }) => {
|
|
818
|
-
const { t } =
|
|
761
|
+
const { t } = useTranslation4(meta.id);
|
|
819
762
|
const items = useMemo7(() => {
|
|
820
763
|
let lastToolCall;
|
|
821
764
|
const tools = [];
|
|
822
|
-
return blocks.filter((block) => block._tag === "toolCall" || block._tag === "toolResult" || block._tag === "
|
|
765
|
+
return blocks.filter((block) => block._tag === "toolCall" || block._tag === "toolResult" || block._tag === "stats").map((block) => {
|
|
823
766
|
switch (block._tag) {
|
|
824
767
|
case "toolCall": {
|
|
825
768
|
if (block.pending && lastToolCall?.block.toolCallId === block.toolCallId) {
|
|
@@ -861,12 +804,12 @@ var ToolBlock = ({ view, blocks = [] }) => {
|
|
|
861
804
|
}
|
|
862
805
|
};
|
|
863
806
|
}
|
|
864
|
-
case "
|
|
807
|
+
case "stats": {
|
|
865
808
|
if (!lastToolCall) {
|
|
866
809
|
return null;
|
|
867
810
|
}
|
|
868
811
|
return {
|
|
869
|
-
title: t("
|
|
812
|
+
title: t("stats label"),
|
|
870
813
|
content: block
|
|
871
814
|
};
|
|
872
815
|
}
|
|
@@ -885,13 +828,13 @@ var ToolBlock = ({ view, blocks = [] }) => {
|
|
|
885
828
|
if (!items.length) {
|
|
886
829
|
return null;
|
|
887
830
|
}
|
|
888
|
-
return /* @__PURE__ */
|
|
831
|
+
return /* @__PURE__ */ React6.createElement(ToolPanel, {
|
|
889
832
|
items,
|
|
890
833
|
onChangeOpen: handleChangeOpen
|
|
891
834
|
});
|
|
892
835
|
};
|
|
893
836
|
ToolBlock.displayName = "ToolBlock";
|
|
894
|
-
var
|
|
837
|
+
var ToolPanel = ({ items, onChangeOpen }) => {
|
|
895
838
|
const tabsRef = useRef2(null);
|
|
896
839
|
const [selected, setSelected] = useState10(0);
|
|
897
840
|
const [open, setOpen] = useState10(false);
|
|
@@ -907,26 +850,26 @@ var ToolContainer = ({ items, onChangeOpen }) => {
|
|
|
907
850
|
const handleSelect = useCallback5((index) => {
|
|
908
851
|
setSelected(index);
|
|
909
852
|
}, []);
|
|
910
|
-
return /* @__PURE__ */
|
|
911
|
-
classNames: "
|
|
853
|
+
return /* @__PURE__ */ React6.createElement(TogglePanel.Root, {
|
|
854
|
+
classNames: "mt-2 w-full rounded-xs",
|
|
912
855
|
open,
|
|
913
856
|
onChangeOpen: setOpen
|
|
914
|
-
}, /* @__PURE__ */
|
|
857
|
+
}, /* @__PURE__ */ React6.createElement(TogglePanel.Header, {
|
|
915
858
|
classNames: "text-sm text-placeholder"
|
|
916
|
-
}, /* @__PURE__ */
|
|
859
|
+
}, /* @__PURE__ */ React6.createElement(TextCrawl, {
|
|
917
860
|
key: "status-roll",
|
|
918
861
|
lines: items.map((item) => item.title),
|
|
919
862
|
autoAdvance: true,
|
|
920
863
|
greedy: true
|
|
921
|
-
})), /* @__PURE__ */
|
|
864
|
+
})), /* @__PURE__ */ React6.createElement(TogglePanel.Content, {
|
|
922
865
|
classNames: "grid grid-cols-[32px_1fr]"
|
|
923
|
-
}, /* @__PURE__ */
|
|
866
|
+
}, /* @__PURE__ */ React6.createElement(NumericTabs, {
|
|
924
867
|
ref: tabsRef,
|
|
925
868
|
classNames: "p-1",
|
|
926
869
|
length: items.length,
|
|
927
870
|
selected,
|
|
928
871
|
onSelect: handleSelect
|
|
929
|
-
}), /* @__PURE__ */
|
|
872
|
+
}), /* @__PURE__ */ React6.createElement(Json, {
|
|
930
873
|
data: items[selected]?.content,
|
|
931
874
|
classNames: "p-1 text-xs bg-transparent",
|
|
932
875
|
replacer: {
|
|
@@ -940,50 +883,66 @@ var ToolContainer = ({ items, onChangeOpen }) => {
|
|
|
940
883
|
// src/components/ChatThread/registry.tsx
|
|
941
884
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/ChatThread/registry.tsx";
|
|
942
885
|
var Fallback = ({ _tag, ...props }) => {
|
|
943
|
-
return /* @__PURE__ */
|
|
944
|
-
classNames: "rounded-
|
|
945
|
-
}, /* @__PURE__ */
|
|
946
|
-
classNames: "bg-
|
|
947
|
-
}, _tag), /* @__PURE__ */
|
|
948
|
-
classNames: "bg-
|
|
949
|
-
}, /* @__PURE__ */
|
|
950
|
-
classNames: "
|
|
886
|
+
return /* @__PURE__ */ React7.createElement(TogglePanel2.Root, {
|
|
887
|
+
classNames: "rounded-xs"
|
|
888
|
+
}, /* @__PURE__ */ React7.createElement(TogglePanel2.Header, {
|
|
889
|
+
classNames: "bg-group-surface"
|
|
890
|
+
}, _tag), /* @__PURE__ */ React7.createElement(TogglePanel2.Content, {
|
|
891
|
+
classNames: "bg-modal-surface"
|
|
892
|
+
}, /* @__PURE__ */ React7.createElement(Json2, {
|
|
893
|
+
classNames: "p-2! text-sm",
|
|
951
894
|
data: props
|
|
952
895
|
})));
|
|
953
896
|
};
|
|
897
|
+
var Summary = ({ text }) => {
|
|
898
|
+
return /* @__PURE__ */ React7.createElement(TogglePanel2.Root, {
|
|
899
|
+
classNames: "rounded-sm"
|
|
900
|
+
}, /* @__PURE__ */ React7.createElement(TogglePanel2.Header, {
|
|
901
|
+
classNames: "bg-group-surface"
|
|
902
|
+
}, "Conversation summarized"), /* @__PURE__ */ React7.createElement(TogglePanel2.Content, {
|
|
903
|
+
classNames: "bg-modal-surface"
|
|
904
|
+
}, text));
|
|
905
|
+
};
|
|
954
906
|
var componentRegistry = {
|
|
955
907
|
//
|
|
956
908
|
// Widgets
|
|
957
909
|
//
|
|
958
|
-
|
|
910
|
+
prompt: {
|
|
959
911
|
block: true,
|
|
960
912
|
factory: ({ children }) => {
|
|
961
913
|
const text = getXmlTextChild(children);
|
|
962
914
|
return text ? new PromptWidget(text) : null;
|
|
963
915
|
}
|
|
964
916
|
},
|
|
965
|
-
|
|
917
|
+
reasoning: {
|
|
918
|
+
block: true,
|
|
919
|
+
factory: ({ children }) => {
|
|
920
|
+
const text = getXmlTextChild(children);
|
|
921
|
+
return text ? new ReasoningWidget(text) : null;
|
|
922
|
+
}
|
|
923
|
+
},
|
|
924
|
+
reference: {
|
|
966
925
|
block: false,
|
|
967
926
|
factory: ({ children, ref }) => {
|
|
968
927
|
const text = getXmlTextChild(children);
|
|
969
928
|
return text && ref ? new ReferenceWidget(text, ref) : null;
|
|
970
929
|
}
|
|
971
930
|
},
|
|
972
|
-
|
|
931
|
+
select: {
|
|
973
932
|
block: true,
|
|
974
933
|
factory: ({ children }) => {
|
|
975
934
|
const options = children?.map((option) => option._tag === "option" && getXmlTextChild(option.children)).filter(Boolean);
|
|
976
935
|
return options?.length ? new SelectWidget(options) : null;
|
|
977
936
|
}
|
|
978
937
|
},
|
|
979
|
-
|
|
938
|
+
suggestion: {
|
|
980
939
|
block: true,
|
|
981
940
|
factory: ({ children }) => {
|
|
982
941
|
const text = getXmlTextChild(children);
|
|
983
942
|
return text ? new SuggestionWidget(text) : null;
|
|
984
943
|
}
|
|
985
944
|
},
|
|
986
|
-
|
|
945
|
+
stats: {
|
|
987
946
|
block: true,
|
|
988
947
|
factory: ({ children }) => {
|
|
989
948
|
const text = getXmlTextChild(children);
|
|
@@ -993,22 +952,26 @@ var componentRegistry = {
|
|
|
993
952
|
//
|
|
994
953
|
// React
|
|
995
954
|
//
|
|
996
|
-
|
|
955
|
+
toolCall: {
|
|
997
956
|
block: true,
|
|
998
957
|
Component: ToolBlock
|
|
999
958
|
},
|
|
1000
|
-
|
|
959
|
+
toolResult: {
|
|
1001
960
|
block: true,
|
|
1002
961
|
Component: Fallback
|
|
1003
962
|
},
|
|
1004
|
-
|
|
963
|
+
toolkit: {
|
|
1005
964
|
block: true,
|
|
1006
965
|
Component: Fallback
|
|
1007
966
|
},
|
|
967
|
+
summary: {
|
|
968
|
+
block: true,
|
|
969
|
+
Component: Summary
|
|
970
|
+
},
|
|
1008
971
|
//
|
|
1009
972
|
// Fallback
|
|
1010
973
|
//
|
|
1011
|
-
|
|
974
|
+
json: {
|
|
1012
975
|
block: true,
|
|
1013
976
|
Component: Fallback
|
|
1014
977
|
}
|
|
@@ -1025,7 +988,7 @@ var blockToMarkdownImpl = (context, message, block) => {
|
|
|
1025
988
|
block: JSON.stringify(block)
|
|
1026
989
|
}, {
|
|
1027
990
|
F: __dxlog_file2,
|
|
1028
|
-
L:
|
|
991
|
+
L: 146,
|
|
1029
992
|
S: void 0,
|
|
1030
993
|
C: (f, a) => f(...a)
|
|
1031
994
|
});
|
|
@@ -1066,7 +1029,9 @@ var blockToMarkdownImpl = (context, message, block) => {
|
|
|
1066
1029
|
return `<toolCall id="${block.toolCallId}" />`;
|
|
1067
1030
|
}
|
|
1068
1031
|
case "toolResult": {
|
|
1069
|
-
context.updateWidget(block.toolCallId, ({ blocks = [] }
|
|
1032
|
+
context.updateWidget(block.toolCallId, ({ blocks = [] } = {
|
|
1033
|
+
blocks: []
|
|
1034
|
+
}) => ({
|
|
1070
1035
|
blocks: [
|
|
1071
1036
|
...blocks,
|
|
1072
1037
|
block
|
|
@@ -1074,8 +1039,18 @@ var blockToMarkdownImpl = (context, message, block) => {
|
|
|
1074
1039
|
}));
|
|
1075
1040
|
break;
|
|
1076
1041
|
}
|
|
1042
|
+
case "stats": {
|
|
1043
|
+
return `<stats>${ContentBlock.createStatsMessage(block)}</stats>`;
|
|
1044
|
+
}
|
|
1045
|
+
case "reasoning": {
|
|
1046
|
+
const text = block.reasoningText ?? block.redactedText;
|
|
1047
|
+
if (!text) {
|
|
1048
|
+
return;
|
|
1049
|
+
}
|
|
1050
|
+
return `<reasoning>${text.replace(/\n/g, " ").trim()}</reasoning>`;
|
|
1051
|
+
}
|
|
1077
1052
|
case "summary": {
|
|
1078
|
-
return `<summary>${
|
|
1053
|
+
return `<summary>${block.content}</summary>`;
|
|
1079
1054
|
}
|
|
1080
1055
|
default: {
|
|
1081
1056
|
return `<json id="${message.id}">
|
|
@@ -1134,6 +1109,10 @@ var MessageSyncer = class {
|
|
|
1134
1109
|
* Syncs messages with the editor.
|
|
1135
1110
|
*/
|
|
1136
1111
|
append(messages, flush = false) {
|
|
1112
|
+
messages = messages.map((message) => ({
|
|
1113
|
+
...message,
|
|
1114
|
+
blocks: message.blocks.filter((block) => !block.pending || block._tag === "text")
|
|
1115
|
+
}));
|
|
1137
1116
|
if (this._initialMessageId !== messages[0]?.id) {
|
|
1138
1117
|
this.reset();
|
|
1139
1118
|
this._initialMessageId = messages[0]?.id;
|
|
@@ -1165,18 +1144,6 @@ var MessageSyncer = class {
|
|
|
1165
1144
|
}
|
|
1166
1145
|
}
|
|
1167
1146
|
process(messages, append) {
|
|
1168
|
-
log3("sync", {
|
|
1169
|
-
doc: this._model.view?.state.doc.length,
|
|
1170
|
-
messages: messages.map((message) => message.blocks.length),
|
|
1171
|
-
currentMessageIndex: this._currentMessageIndex,
|
|
1172
|
-
currentBlockIndex: this._currentBlockIndex,
|
|
1173
|
-
currentBlockContent: this._currentBlockContent
|
|
1174
|
-
}, {
|
|
1175
|
-
F: __dxlog_file3,
|
|
1176
|
-
L: 111,
|
|
1177
|
-
S: this,
|
|
1178
|
-
C: (f, a) => f(...a)
|
|
1179
|
-
});
|
|
1180
1147
|
let i = this._currentMessageIndex;
|
|
1181
1148
|
for (const message of messages.slice(this._currentMessageIndex)) {
|
|
1182
1149
|
if (i > this._currentMessageIndex) {
|
|
@@ -1194,16 +1161,6 @@ var MessageSyncer = class {
|
|
|
1194
1161
|
} else {
|
|
1195
1162
|
content = currentBlockContent;
|
|
1196
1163
|
}
|
|
1197
|
-
log3("append", {
|
|
1198
|
-
message: i,
|
|
1199
|
-
block: j,
|
|
1200
|
-
content
|
|
1201
|
-
}, {
|
|
1202
|
-
F: __dxlog_file3,
|
|
1203
|
-
L: 138,
|
|
1204
|
-
S: this,
|
|
1205
|
-
C: (f, a) => f(...a)
|
|
1206
|
-
});
|
|
1207
1164
|
this._currentBlockContent = currentBlockContent;
|
|
1208
1165
|
append(content);
|
|
1209
1166
|
}
|
|
@@ -1223,7 +1180,13 @@ var MessageSyncer = class {
|
|
|
1223
1180
|
// src/components/ChatThread/ChatThread.tsx
|
|
1224
1181
|
var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages = [], error, cursor = false, fadeIn = true, debug = false, onEvent }, forwardedRef) => {
|
|
1225
1182
|
const controllerRef = useForwardedRef(forwardedRef);
|
|
1226
|
-
const controller =
|
|
1183
|
+
const [controller, setController] = useState11(null);
|
|
1184
|
+
const refCallback = useCallback6((node) => {
|
|
1185
|
+
controllerRef.current = node;
|
|
1186
|
+
setController(node);
|
|
1187
|
+
}, [
|
|
1188
|
+
controllerRef
|
|
1189
|
+
]);
|
|
1227
1190
|
const userHue = useMemo8(() => identity?.profile?.data?.hue || keyToFallback(identity?.identityKey ?? PublicKey.random()).hue, [
|
|
1228
1191
|
identity
|
|
1229
1192
|
]);
|
|
@@ -1258,14 +1221,14 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
|
|
|
1258
1221
|
}, [
|
|
1259
1222
|
onEvent
|
|
1260
1223
|
]);
|
|
1261
|
-
return /* @__PURE__ */
|
|
1224
|
+
return /* @__PURE__ */ React8.createElement("div", {
|
|
1262
1225
|
role: "none",
|
|
1263
|
-
className:
|
|
1226
|
+
className: mx5("flex h-full w-full justify-center overflow-hidden", classNames),
|
|
1264
1227
|
style: {
|
|
1265
|
-
"--user-fill": `var(--
|
|
1228
|
+
"--user-fill": `var(--color-${userHue}-fill)`
|
|
1266
1229
|
}
|
|
1267
|
-
}, /* @__PURE__ */
|
|
1268
|
-
ref:
|
|
1230
|
+
}, /* @__PURE__ */ React8.createElement(MarkdownStream, {
|
|
1231
|
+
ref: refCallback,
|
|
1269
1232
|
registry: componentRegistry,
|
|
1270
1233
|
cursor,
|
|
1271
1234
|
fadeIn,
|
|
@@ -1277,19 +1240,18 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
|
|
|
1277
1240
|
// src/components/Chat/Chat.tsx
|
|
1278
1241
|
var [ChatContextProvider, useChatContext] = createContext("Chat");
|
|
1279
1242
|
var ChatRoot = ({ children, chat, processor, onEvent, ...props }) => {
|
|
1280
|
-
const [debug, setDebug] =
|
|
1243
|
+
const [debug, setDebug] = useState12(false);
|
|
1281
1244
|
const pending = useAtomValue(processor.messages);
|
|
1282
1245
|
const streaming = useAtomValue(processor.streaming);
|
|
1283
1246
|
const lastPrompt = useRef3(void 0);
|
|
1284
|
-
const
|
|
1247
|
+
const storedMessages = useQuery3(chat?.queue?.target, Filter4.type(Message.Message));
|
|
1285
1248
|
const messages = useMemo9(() => {
|
|
1286
|
-
const queueMessages = queue?.objects?.filter(Obj5.instanceOf(Message.Message)) ?? [];
|
|
1287
1249
|
return Array2.dedupeWith([
|
|
1288
|
-
...
|
|
1250
|
+
...storedMessages,
|
|
1289
1251
|
...pending
|
|
1290
1252
|
], ({ id: a }, { id: b }) => a === b);
|
|
1291
1253
|
}, [
|
|
1292
|
-
|
|
1254
|
+
storedMessages,
|
|
1293
1255
|
pending
|
|
1294
1256
|
]);
|
|
1295
1257
|
const event = useMemo9(() => new Event(), []);
|
|
@@ -1297,7 +1259,23 @@ var ChatRoot = ({ children, chat, processor, onEvent, ...props }) => {
|
|
|
1297
1259
|
return event.on((ev) => {
|
|
1298
1260
|
switch (ev.type) {
|
|
1299
1261
|
case "toggle-debug": {
|
|
1300
|
-
setDebug((
|
|
1262
|
+
setDebug((debug2) => !debug2);
|
|
1263
|
+
queueMicrotask(async () => {
|
|
1264
|
+
const objects = processor.context.getObjects();
|
|
1265
|
+
const blueprints = processor.context.getBlueprints();
|
|
1266
|
+
const tools = await processor.getTools();
|
|
1267
|
+
const system = await processor.getSystemPrompt();
|
|
1268
|
+
console.log("Chat processor state:", {
|
|
1269
|
+
objects,
|
|
1270
|
+
blueprints
|
|
1271
|
+
});
|
|
1272
|
+
console.log(`
|
|
1273
|
+
==== System Prompt ====
|
|
1274
|
+
${system}
|
|
1275
|
+
==== Tools ====
|
|
1276
|
+
${Object.values(tools).map((tool) => JSON.stringify(tool, null, 2)).join("\n")}
|
|
1277
|
+
`);
|
|
1278
|
+
});
|
|
1301
1279
|
break;
|
|
1302
1280
|
}
|
|
1303
1281
|
case "submit": {
|
|
@@ -1338,7 +1316,7 @@ var ChatRoot = ({ children, chat, processor, onEvent, ...props }) => {
|
|
|
1338
1316
|
onEvent
|
|
1339
1317
|
]);
|
|
1340
1318
|
const db = props.db ?? (chat && Obj5.getDatabase(chat));
|
|
1341
|
-
return /* @__PURE__ */
|
|
1319
|
+
return /* @__PURE__ */ React9.createElement(ChatContextProvider, {
|
|
1342
1320
|
debug,
|
|
1343
1321
|
event,
|
|
1344
1322
|
db,
|
|
@@ -1349,16 +1327,20 @@ var ChatRoot = ({ children, chat, processor, onEvent, ...props }) => {
|
|
|
1349
1327
|
}, children);
|
|
1350
1328
|
};
|
|
1351
1329
|
ChatRoot.displayName = "Chat.Root";
|
|
1352
|
-
var
|
|
1353
|
-
|
|
1330
|
+
var CHAT_VIEWPORT_NAME = "Chat.Viewport";
|
|
1331
|
+
var ChatViewport = ({ classNames, children, ...props }) => {
|
|
1332
|
+
return /* @__PURE__ */ React9.createElement("div", {
|
|
1354
1333
|
role: "none",
|
|
1355
|
-
|
|
1334
|
+
...props,
|
|
1335
|
+
className: mx6("flex flex-col h-full w-full", classNames)
|
|
1356
1336
|
}, children);
|
|
1357
1337
|
};
|
|
1338
|
+
ChatViewport.displayName = CHAT_VIEWPORT_NAME;
|
|
1339
|
+
var CHAT_THREAD_NAME = "Chat.Thread";
|
|
1358
1340
|
var ChatThread2 = (props) => {
|
|
1359
|
-
const { debug, event, messages, processor } = useChatContext(
|
|
1341
|
+
const { debug, event, messages, processor } = useChatContext(CHAT_THREAD_NAME);
|
|
1360
1342
|
const identity = useIdentity();
|
|
1361
|
-
const error = useAtomValue(processor.error).pipe(
|
|
1343
|
+
const error = useAtomValue(processor.error).pipe(Option4.getOrUndefined);
|
|
1362
1344
|
const controllerRef = useRef3(null);
|
|
1363
1345
|
useEffect7(() => {
|
|
1364
1346
|
return event.on((event2) => {
|
|
@@ -1386,7 +1368,7 @@ var ChatThread2 = (props) => {
|
|
|
1386
1368
|
if (!identity) {
|
|
1387
1369
|
return null;
|
|
1388
1370
|
}
|
|
1389
|
-
return /* @__PURE__ */
|
|
1371
|
+
return /* @__PURE__ */ React9.createElement(ChatThread, {
|
|
1390
1372
|
...props,
|
|
1391
1373
|
identity,
|
|
1392
1374
|
messages,
|
|
@@ -1396,16 +1378,17 @@ var ChatThread2 = (props) => {
|
|
|
1396
1378
|
ref: controllerRef
|
|
1397
1379
|
});
|
|
1398
1380
|
};
|
|
1399
|
-
ChatThread2.displayName =
|
|
1381
|
+
ChatThread2.displayName = CHAT_THREAD_NAME;
|
|
1382
|
+
var CHAT_PROMPT_NAME = "Chat.Prompt";
|
|
1400
1383
|
var ChatPrompt = ({ classNames, outline, settings = true, placeholder, expandable, online, presets, preset, onPresetChange, onOnlineChange }) => {
|
|
1401
|
-
const { t } =
|
|
1402
|
-
const { db, processor, event } = useChatContext(
|
|
1403
|
-
const error = useAtomValue(processor.error).pipe(
|
|
1384
|
+
const { t } = useTranslation5(meta.id);
|
|
1385
|
+
const { db, processor, event } = useChatContext(CHAT_PROMPT_NAME);
|
|
1386
|
+
const error = useAtomValue(processor.error).pipe(Option4.getOrUndefined);
|
|
1404
1387
|
const streaming = useAtomValue(processor.streaming);
|
|
1405
1388
|
const active = useAtomValue(processor.active);
|
|
1406
1389
|
const activeRef = useDynamicRef(active);
|
|
1407
1390
|
const editorRef = useRef3(null);
|
|
1408
|
-
const [recordingState, setRecordingState] =
|
|
1391
|
+
const [recordingState, setRecordingState] = useState12(false);
|
|
1409
1392
|
useEffect7(() => {
|
|
1410
1393
|
return event.on((event2) => {
|
|
1411
1394
|
switch (event2.type) {
|
|
@@ -1500,71 +1483,73 @@ var ChatPrompt = ({ classNames, outline, settings = true, placeholder, expandabl
|
|
|
1500
1483
|
}, [
|
|
1501
1484
|
event
|
|
1502
1485
|
]);
|
|
1503
|
-
return /* @__PURE__ */
|
|
1486
|
+
return /* @__PURE__ */ React9.createElement("div", {
|
|
1504
1487
|
role: "group",
|
|
1505
|
-
className:
|
|
1506
|
-
}, /* @__PURE__ */
|
|
1488
|
+
className: mx6("flex flex-col w-full dx-density-fine", outline && "bg-group-surface border border-subdued-separator transition transition-border [&:has(.cm-content:focus)]:border-separator rounded-sm", classNames)
|
|
1489
|
+
}, /* @__PURE__ */ React9.createElement("div", {
|
|
1507
1490
|
role: "none",
|
|
1508
1491
|
className: "flex p-2 gap-2"
|
|
1509
|
-
}, /* @__PURE__ */
|
|
1492
|
+
}, /* @__PURE__ */ React9.createElement(ChatStatusIndicator, {
|
|
1510
1493
|
classNames: "p-1",
|
|
1511
1494
|
preset,
|
|
1512
1495
|
error,
|
|
1513
1496
|
processing: streaming
|
|
1514
|
-
}), /* @__PURE__ */
|
|
1497
|
+
}), /* @__PURE__ */ React9.createElement(ChatEditor, {
|
|
1515
1498
|
ref: editorRef,
|
|
1516
1499
|
autoFocus: true,
|
|
1517
1500
|
lineWrapping: true,
|
|
1518
|
-
classNames: "col-span-2
|
|
1501
|
+
classNames: "col-span-2 pt-0.5",
|
|
1519
1502
|
placeholder: placeholder ?? t("prompt placeholder"),
|
|
1520
1503
|
extensions,
|
|
1521
1504
|
onSubmit: handleSubmit
|
|
1522
|
-
})), db && settings && /* @__PURE__ */
|
|
1505
|
+
})), db && settings && /* @__PURE__ */ React9.createElement("div", {
|
|
1523
1506
|
role: "none",
|
|
1524
1507
|
className: "flex items-center overflow-hidden"
|
|
1525
|
-
}, /* @__PURE__ */
|
|
1508
|
+
}, /* @__PURE__ */ React9.createElement(ChatOptions, {
|
|
1526
1509
|
db,
|
|
1527
1510
|
blueprintRegistry: processor.blueprintRegistry,
|
|
1528
1511
|
context: processor.context,
|
|
1529
1512
|
preset,
|
|
1530
1513
|
presets,
|
|
1531
1514
|
onPresetChange
|
|
1532
|
-
}), /* @__PURE__ */
|
|
1515
|
+
}), /* @__PURE__ */ React9.createElement("div", {
|
|
1533
1516
|
role: "none",
|
|
1534
1517
|
className: "flex grow overflow-x-auto scrollbar-none"
|
|
1535
|
-
}, /* @__PURE__ */
|
|
1518
|
+
}, /* @__PURE__ */ React9.createElement(ChatReferences, {
|
|
1536
1519
|
db,
|
|
1537
1520
|
context: processor.context
|
|
1538
|
-
})), /* @__PURE__ */
|
|
1521
|
+
})), /* @__PURE__ */ React9.createElement(ChatActions, {
|
|
1539
1522
|
classNames: "col-span-2",
|
|
1540
1523
|
microphone: true,
|
|
1541
1524
|
recording,
|
|
1542
1525
|
processing: streaming,
|
|
1543
1526
|
onEvent: handleEvent
|
|
1544
|
-
}, online !== void 0 && /* @__PURE__ */
|
|
1527
|
+
}, online !== void 0 && /* @__PURE__ */ React9.createElement(Input.Root, null, /* @__PURE__ */ React9.createElement(Input.Label, {
|
|
1545
1528
|
srOnly: true
|
|
1546
|
-
}, t("online switch label")), /* @__PURE__ */
|
|
1547
|
-
classNames: "
|
|
1529
|
+
}, t("online switch label")), /* @__PURE__ */ React9.createElement(Input.Switch, {
|
|
1530
|
+
classNames: "mx-2",
|
|
1548
1531
|
checked: online,
|
|
1549
1532
|
onCheckedChange: onOnlineChange
|
|
1550
1533
|
})))));
|
|
1551
1534
|
};
|
|
1552
|
-
ChatPrompt.displayName =
|
|
1553
|
-
var
|
|
1554
|
-
|
|
1535
|
+
ChatPrompt.displayName = CHAT_PROMPT_NAME;
|
|
1536
|
+
var CHAT_TOOLBAR_NAME = "Chat.Toolbar";
|
|
1537
|
+
var ChatToolbar = ({ classNames, companionTo, ...props }) => {
|
|
1538
|
+
const { chat } = useChatContext(CHAT_TOOLBAR_NAME);
|
|
1555
1539
|
const menu = useChatToolbarActions({
|
|
1556
1540
|
chat,
|
|
1557
1541
|
companionTo
|
|
1558
1542
|
});
|
|
1559
|
-
return /* @__PURE__ */
|
|
1543
|
+
return /* @__PURE__ */ React9.createElement(Menu.Root, {
|
|
1544
|
+
...props,
|
|
1560
1545
|
...menu,
|
|
1561
1546
|
attendableId: companionTo ? Obj5.getDXN(companionTo).toString() : chat ? Obj5.getDXN(chat).toString() : ""
|
|
1562
|
-
}, /* @__PURE__ */
|
|
1547
|
+
}, /* @__PURE__ */ React9.createElement(Menu.Toolbar, {
|
|
1563
1548
|
classNames,
|
|
1564
1549
|
textBlockWidth: true
|
|
1565
1550
|
}));
|
|
1566
1551
|
};
|
|
1567
|
-
ChatToolbar.displayName =
|
|
1552
|
+
ChatToolbar.displayName = CHAT_TOOLBAR_NAME;
|
|
1568
1553
|
var Chat = {
|
|
1569
1554
|
Root: ChatRoot,
|
|
1570
1555
|
Viewport: ChatViewport,
|
|
@@ -1573,18 +1558,338 @@ var Chat = {
|
|
|
1573
1558
|
Toolbar: ChatToolbar
|
|
1574
1559
|
};
|
|
1575
1560
|
|
|
1561
|
+
// src/components/TemplateEditor/TemplateEditor.tsx
|
|
1562
|
+
import { defaultHighlightStyle, syntaxHighlighting } from "@codemirror/language";
|
|
1563
|
+
import React10 from "react";
|
|
1564
|
+
import { createDocAccessor } from "@dxos/echo-db";
|
|
1565
|
+
import { useThemeContext, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
1566
|
+
import { useTextEditor } from "@dxos/react-ui-editor";
|
|
1567
|
+
import { createBasicExtensions, createDataExtensions, createMarkdownExtensions, createThemeExtensions, decorateMarkdown } from "@dxos/ui-editor";
|
|
1568
|
+
import { mx as mx8 } from "@dxos/ui-theme";
|
|
1569
|
+
import { isNonNullable as isNonNullable2 } from "@dxos/util";
|
|
1570
|
+
|
|
1571
|
+
// src/components/TemplateEditor/extensions/handlebars-extension.ts
|
|
1572
|
+
import { autocompletion, completionKeymap } from "@codemirror/autocomplete";
|
|
1573
|
+
import { RangeSetBuilder } from "@codemirror/state";
|
|
1574
|
+
import { Decoration, ViewPlugin, WidgetType, keymap as keymap2 } from "@codemirror/view";
|
|
1575
|
+
import { Domino, mx as mx7 } from "@dxos/ui";
|
|
1576
|
+
var handlebars = (_ = {}) => {
|
|
1577
|
+
return [
|
|
1578
|
+
handlebarsHighlightPlugin,
|
|
1579
|
+
autocompletion({
|
|
1580
|
+
activateOnTyping: true,
|
|
1581
|
+
aboveCursor: true,
|
|
1582
|
+
closeOnBlur: true,
|
|
1583
|
+
override: [
|
|
1584
|
+
handlebarsCompletions
|
|
1585
|
+
]
|
|
1586
|
+
}),
|
|
1587
|
+
keymap2.of(completionKeymap)
|
|
1588
|
+
];
|
|
1589
|
+
};
|
|
1590
|
+
var regex = {
|
|
1591
|
+
// {{! comment }}
|
|
1592
|
+
comment: /\{\{!\s*[^}]*\}\}/g,
|
|
1593
|
+
// {{var}}
|
|
1594
|
+
brackets: /\{\{[^}]*\}\}/g,
|
|
1595
|
+
// {{#command}} {{/command}}
|
|
1596
|
+
command: /\{\{[#/]([^}]+)\}\}/g,
|
|
1597
|
+
// {{var}}
|
|
1598
|
+
var: /\{\{(?!\s*!)(\w[^}]*)\}\}/g,
|
|
1599
|
+
// @dxn:queue:data:xxx
|
|
1600
|
+
dxn: /@?dxn:[\w@:]+/g,
|
|
1601
|
+
// dxos.org/type/xxx
|
|
1602
|
+
url: /[\w.-]+\.[\w.-]+\/[\w/]+/g
|
|
1603
|
+
};
|
|
1604
|
+
var tagPadding = "mx-0.5 px-1 rounded-xs";
|
|
1605
|
+
var handlebarsHighlightPlugin = ViewPlugin.fromClass(class {
|
|
1606
|
+
decorations;
|
|
1607
|
+
constructor(view) {
|
|
1608
|
+
this.decorations = this.buildDecorations(view);
|
|
1609
|
+
}
|
|
1610
|
+
update(update) {
|
|
1611
|
+
if (update.docChanged || update.viewportChanged || update.selectionSet) {
|
|
1612
|
+
this.decorations = this.buildDecorations(update.view);
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
// NOTE: Decorations may clash with other extensions (e.g., markdown).
|
|
1616
|
+
buildDecorations(view) {
|
|
1617
|
+
const selection = view.state.selection.main;
|
|
1618
|
+
const decorations = [];
|
|
1619
|
+
for (const { from, to } of view.visibleRanges) {
|
|
1620
|
+
const text = view.state.doc.sliceString(from, to);
|
|
1621
|
+
{
|
|
1622
|
+
let match;
|
|
1623
|
+
while ((match = regex.dxn.exec(text)) !== null) {
|
|
1624
|
+
const start = from + match.index;
|
|
1625
|
+
const end = start + match[0].length;
|
|
1626
|
+
const overlaps = selection.to > start && selection.from <= end;
|
|
1627
|
+
if (!overlaps) {
|
|
1628
|
+
decorations.push({
|
|
1629
|
+
from: start,
|
|
1630
|
+
to: end,
|
|
1631
|
+
decoration: Decoration.widget({
|
|
1632
|
+
widget: new DXNWidget(match[0])
|
|
1633
|
+
})
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
{
|
|
1639
|
+
let match;
|
|
1640
|
+
while ((match = regex.url.exec(text)) !== null) {
|
|
1641
|
+
const start = from + match.index;
|
|
1642
|
+
const end = start + match[0].length;
|
|
1643
|
+
decorations.push({
|
|
1644
|
+
from: start,
|
|
1645
|
+
to: end,
|
|
1646
|
+
decoration: Decoration.mark({
|
|
1647
|
+
class: mx7("dx-tag--blue", tagPadding)
|
|
1648
|
+
})
|
|
1649
|
+
});
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
{
|
|
1653
|
+
let match;
|
|
1654
|
+
while ((match = regex.brackets.exec(text)) !== null) {
|
|
1655
|
+
const start = from + match.index;
|
|
1656
|
+
const end = start + match[0].length;
|
|
1657
|
+
decorations.push({
|
|
1658
|
+
from: start,
|
|
1659
|
+
to: end,
|
|
1660
|
+
decoration: Decoration.mark({
|
|
1661
|
+
class: "text-subdued"
|
|
1662
|
+
})
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
{
|
|
1667
|
+
let match;
|
|
1668
|
+
while ((match = regex.command.exec(text)) !== null) {
|
|
1669
|
+
const start = from + match.index + 2;
|
|
1670
|
+
let end = start + match[0].length - 4;
|
|
1671
|
+
const text2 = view.state.doc.sliceString(start, end);
|
|
1672
|
+
const parts = text2.split(/\s+/);
|
|
1673
|
+
if (parts.length > 1) {
|
|
1674
|
+
const idx = start + parts[0].length;
|
|
1675
|
+
decorations.push({
|
|
1676
|
+
from: idx,
|
|
1677
|
+
to: end,
|
|
1678
|
+
decoration: Decoration.mark({
|
|
1679
|
+
class: "text-green-text"
|
|
1680
|
+
})
|
|
1681
|
+
});
|
|
1682
|
+
end = idx;
|
|
1683
|
+
}
|
|
1684
|
+
decorations.push({
|
|
1685
|
+
from: start,
|
|
1686
|
+
to: end,
|
|
1687
|
+
decoration: Decoration.mark({
|
|
1688
|
+
class: "text-blue-text"
|
|
1689
|
+
})
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
{
|
|
1694
|
+
let match;
|
|
1695
|
+
while ((match = regex.var.exec(text)) !== null) {
|
|
1696
|
+
const start = from + match.index + 2;
|
|
1697
|
+
const end = start + match[0].length - 4;
|
|
1698
|
+
decorations.push({
|
|
1699
|
+
from: start,
|
|
1700
|
+
to: end,
|
|
1701
|
+
decoration: Decoration.mark({
|
|
1702
|
+
class: "text-green-text"
|
|
1703
|
+
})
|
|
1704
|
+
});
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
decorations.sort((a, b) => a.from - b.from || a.to - b.to);
|
|
1709
|
+
const builder = new RangeSetBuilder();
|
|
1710
|
+
for (const { from, to, decoration } of decorations) {
|
|
1711
|
+
builder.add(from, to, decoration);
|
|
1712
|
+
}
|
|
1713
|
+
return builder.finish();
|
|
1714
|
+
}
|
|
1715
|
+
}, {
|
|
1716
|
+
decorations: (v) => v.decorations
|
|
1717
|
+
});
|
|
1718
|
+
var DXNWidget = class extends WidgetType {
|
|
1719
|
+
_identifier;
|
|
1720
|
+
constructor(_identifier) {
|
|
1721
|
+
super(), this._identifier = _identifier;
|
|
1722
|
+
}
|
|
1723
|
+
ignoreEvent() {
|
|
1724
|
+
return false;
|
|
1725
|
+
}
|
|
1726
|
+
eq(other) {
|
|
1727
|
+
return this._identifier === other._identifier;
|
|
1728
|
+
}
|
|
1729
|
+
toDOM() {
|
|
1730
|
+
const text = this._identifier.split(":").map((part) => {
|
|
1731
|
+
const len = 16;
|
|
1732
|
+
const plen = 4;
|
|
1733
|
+
if (part.length > len) {
|
|
1734
|
+
return `[${part.slice(0, plen)}\u2026${part.slice(-plen)}]`;
|
|
1735
|
+
}
|
|
1736
|
+
return part;
|
|
1737
|
+
}).join(":");
|
|
1738
|
+
return Domino.of("span").classNames(mx7("font-mono dx-tag--blue", tagPadding)).text(text).root;
|
|
1739
|
+
}
|
|
1740
|
+
};
|
|
1741
|
+
var variables = [
|
|
1742
|
+
"this"
|
|
1743
|
+
];
|
|
1744
|
+
var commands = [
|
|
1745
|
+
"this",
|
|
1746
|
+
"each",
|
|
1747
|
+
"if",
|
|
1748
|
+
"unless",
|
|
1749
|
+
"with"
|
|
1750
|
+
];
|
|
1751
|
+
function handlebarsCompletions(context) {
|
|
1752
|
+
const match = context.matchBefore(/\{\{[^}]*/);
|
|
1753
|
+
if (!match || match.from === match.to) {
|
|
1754
|
+
return null;
|
|
1755
|
+
}
|
|
1756
|
+
let type = "variable";
|
|
1757
|
+
let text = match.text.slice(2);
|
|
1758
|
+
let from = match.from + 2;
|
|
1759
|
+
let matches = [];
|
|
1760
|
+
if (text.startsWith("#") || text.startsWith("/")) {
|
|
1761
|
+
const idx = text.lastIndexOf(" ");
|
|
1762
|
+
if (idx !== -1) {
|
|
1763
|
+
type = "variable";
|
|
1764
|
+
matches = variables;
|
|
1765
|
+
text = text.slice(idx + 1);
|
|
1766
|
+
from += idx + 1;
|
|
1767
|
+
} else {
|
|
1768
|
+
type = "command";
|
|
1769
|
+
text = text.slice(1);
|
|
1770
|
+
matches = commands;
|
|
1771
|
+
from += 1;
|
|
1772
|
+
}
|
|
1773
|
+
} else {
|
|
1774
|
+
type = "variable";
|
|
1775
|
+
matches = variables;
|
|
1776
|
+
}
|
|
1777
|
+
const options = matches.filter((name) => name.startsWith(text)).map((name) => ({
|
|
1778
|
+
type,
|
|
1779
|
+
label: name
|
|
1780
|
+
}));
|
|
1781
|
+
return {
|
|
1782
|
+
from,
|
|
1783
|
+
options
|
|
1784
|
+
};
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
// src/components/TemplateEditor/extensions/xml-extension.ts
|
|
1788
|
+
import { syntaxTree } from "@codemirror/language";
|
|
1789
|
+
import { RangeSetBuilder as RangeSetBuilder2 } from "@codemirror/state";
|
|
1790
|
+
import { Decoration as Decoration2, ViewPlugin as ViewPlugin2 } from "@codemirror/view";
|
|
1791
|
+
var xmlDecorator = (_ = {}) => {
|
|
1792
|
+
return [
|
|
1793
|
+
xmlDecoratorPlugin
|
|
1794
|
+
];
|
|
1795
|
+
};
|
|
1796
|
+
var xmlDecoratorPlugin = ViewPlugin2.fromClass(class {
|
|
1797
|
+
decorations;
|
|
1798
|
+
constructor(view) {
|
|
1799
|
+
this.decorations = this.buildDecorations(view);
|
|
1800
|
+
}
|
|
1801
|
+
update(update) {
|
|
1802
|
+
if (update.docChanged || update.viewportChanged) {
|
|
1803
|
+
this.decorations = this.buildDecorations(update.view);
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
buildDecorations(view) {
|
|
1807
|
+
const builder = new RangeSetBuilder2();
|
|
1808
|
+
for (const { from, to } of view.visibleRanges) {
|
|
1809
|
+
syntaxTree(view.state).iterate({
|
|
1810
|
+
from,
|
|
1811
|
+
to,
|
|
1812
|
+
enter: (node) => {
|
|
1813
|
+
if (node.name === "HTMLTag" || node.name === "OpenTag" || node.name === "CloseTag" || node.name === "SelfClosingTag" || node.name === "Element") {
|
|
1814
|
+
builder.add(node.from, node.to, Decoration2.mark({
|
|
1815
|
+
class: "font-mono text-subdued"
|
|
1816
|
+
}));
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1821
|
+
return builder.finish();
|
|
1822
|
+
}
|
|
1823
|
+
}, {
|
|
1824
|
+
decorations: (v) => v.decorations
|
|
1825
|
+
});
|
|
1826
|
+
|
|
1827
|
+
// src/components/TemplateEditor/TemplateEditor.tsx
|
|
1828
|
+
var TemplateEditor = ({ id, classNames, template, lineNumbers = true }) => {
|
|
1829
|
+
const { t } = useTranslation6(meta.id);
|
|
1830
|
+
const { themeMode } = useThemeContext();
|
|
1831
|
+
const { parentRef } = useTextEditor(() => {
|
|
1832
|
+
const text = template.source?.target;
|
|
1833
|
+
if (!text) {
|
|
1834
|
+
return {};
|
|
1835
|
+
}
|
|
1836
|
+
return {
|
|
1837
|
+
initialValue: text.content ?? "",
|
|
1838
|
+
extensions: [
|
|
1839
|
+
createDataExtensions({
|
|
1840
|
+
id,
|
|
1841
|
+
text: createDocAccessor(text, [
|
|
1842
|
+
"content"
|
|
1843
|
+
])
|
|
1844
|
+
}),
|
|
1845
|
+
createBasicExtensions({
|
|
1846
|
+
bracketMatching: false,
|
|
1847
|
+
lineNumbers,
|
|
1848
|
+
lineWrapping: true,
|
|
1849
|
+
placeholder: t("template placeholder")
|
|
1850
|
+
}),
|
|
1851
|
+
createThemeExtensions({
|
|
1852
|
+
themeMode,
|
|
1853
|
+
slots: {
|
|
1854
|
+
content: {
|
|
1855
|
+
className: "!pe-4"
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
}),
|
|
1859
|
+
createMarkdownExtensions(),
|
|
1860
|
+
decorateMarkdown(),
|
|
1861
|
+
handlebars(),
|
|
1862
|
+
// xml(),
|
|
1863
|
+
// NOTE: Since we're using markdown only HTML nodes are parsed.
|
|
1864
|
+
xmlDecorator(),
|
|
1865
|
+
syntaxHighlighting(defaultHighlightStyle)
|
|
1866
|
+
].filter(isNonNullable2)
|
|
1867
|
+
};
|
|
1868
|
+
}, [
|
|
1869
|
+
themeMode,
|
|
1870
|
+
template.source?.target,
|
|
1871
|
+
lineNumbers
|
|
1872
|
+
]);
|
|
1873
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
1874
|
+
ref: parentRef,
|
|
1875
|
+
className: mx8("h-full overflow-hidden", classNames)
|
|
1876
|
+
});
|
|
1877
|
+
};
|
|
1878
|
+
|
|
1576
1879
|
// src/components/Toolbox/Toolbox.tsx
|
|
1577
|
-
import React11, { Fragment, useEffect as useEffect8, useState as
|
|
1880
|
+
import React11, { Fragment, useEffect as useEffect8, useState as useState13 } from "react";
|
|
1578
1881
|
import { Function } from "@dxos/functions";
|
|
1579
1882
|
import { log as log4 } from "@dxos/log";
|
|
1580
|
-
import { Filter as
|
|
1581
|
-
import {
|
|
1582
|
-
import { mx as
|
|
1883
|
+
import { Filter as Filter5, useQuery as useQuery4 } from "@dxos/react-client/echo";
|
|
1884
|
+
import { ScrollArea } from "@dxos/react-ui";
|
|
1885
|
+
import { mx as mx9 } from "@dxos/ui-theme";
|
|
1583
1886
|
var __dxlog_file4 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/Toolbox/Toolbox.tsx";
|
|
1584
1887
|
var Toolbox = ({ classNames, functions, services, blueprints, activeBlueprints }) => {
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1888
|
+
return /* @__PURE__ */ React11.createElement(ScrollArea.Root, {
|
|
1889
|
+
thin: true,
|
|
1890
|
+
orientation: "vertical"
|
|
1891
|
+
}, /* @__PURE__ */ React11.createElement(ScrollArea.Viewport, {
|
|
1892
|
+
classNames
|
|
1588
1893
|
}, blueprints && blueprints.length > 0 && /* @__PURE__ */ React11.createElement(Section, {
|
|
1589
1894
|
title: "Blueprints",
|
|
1590
1895
|
items: blueprints.map(({ name, description, tools }) => ({
|
|
@@ -1615,14 +1920,14 @@ var Toolbox = ({ classNames, functions, services, blueprints, activeBlueprints }
|
|
|
1615
1920
|
name,
|
|
1616
1921
|
description
|
|
1617
1922
|
}))
|
|
1618
|
-
}));
|
|
1923
|
+
})));
|
|
1619
1924
|
};
|
|
1620
1925
|
var Section = ({ title, items, striped }) => {
|
|
1621
1926
|
const stripeClassNames = "odd:bg-neutral-50 dark:odd:bg-neutral-800";
|
|
1622
1927
|
const gridClassNames = "grid grid-cols-[8rem_1fr]";
|
|
1623
|
-
const subGridClassNames =
|
|
1928
|
+
const subGridClassNames = mx9("col-span-full grid grid-cols-subgrid text-xs px-2", striped && stripeClassNames);
|
|
1624
1929
|
return /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement("h1", {
|
|
1625
|
-
className: "
|
|
1930
|
+
className: "px-2 text-sm"
|
|
1626
1931
|
}, title), /* @__PURE__ */ React11.createElement("div", {
|
|
1627
1932
|
className: gridClassNames
|
|
1628
1933
|
}, items.map(({ name, description, subitems }, i) => /* @__PURE__ */ React11.createElement(Fragment, {
|
|
@@ -1635,22 +1940,22 @@ var Section = ({ title, items, striped }) => {
|
|
|
1635
1940
|
className: "line-clamp-2"
|
|
1636
1941
|
}, description)), subitems?.map(({ name: name2, description: description2 }, i2) => /* @__PURE__ */ React11.createElement("div", {
|
|
1637
1942
|
key: i2,
|
|
1638
|
-
className:
|
|
1943
|
+
className: mx9(subGridClassNames, striped && stripeClassNames)
|
|
1639
1944
|
}, /* @__PURE__ */ React11.createElement("div", {
|
|
1640
1945
|
className: "truncate"
|
|
1641
1946
|
}, name2), /* @__PURE__ */ React11.createElement("div", {
|
|
1642
1947
|
className: "line-clamp-3 text-subdued"
|
|
1643
1948
|
}, description2)))))));
|
|
1644
1949
|
};
|
|
1645
|
-
var
|
|
1646
|
-
const services =
|
|
1647
|
-
const [serviceTools, setServiceTools] =
|
|
1950
|
+
var ToolboxPanel = ({ classNames, db, processor }) => {
|
|
1951
|
+
const services = useQuery4(db, Filter5.type(ServiceType));
|
|
1952
|
+
const [serviceTools, setServiceTools] = useState13([]);
|
|
1648
1953
|
useEffect8(() => {
|
|
1649
1954
|
log4("creating service tools...", {
|
|
1650
1955
|
services: services.length
|
|
1651
1956
|
}, {
|
|
1652
1957
|
F: __dxlog_file4,
|
|
1653
|
-
L:
|
|
1958
|
+
L: 117,
|
|
1654
1959
|
S: void 0,
|
|
1655
1960
|
C: (f, a) => f(...a)
|
|
1656
1961
|
});
|
|
@@ -1659,7 +1964,7 @@ var ToolboxContainer = ({ classNames, db, processor }) => {
|
|
|
1659
1964
|
}, [
|
|
1660
1965
|
services
|
|
1661
1966
|
]);
|
|
1662
|
-
const functions =
|
|
1967
|
+
const functions = useQuery4(db, Filter5.type(Function.Function));
|
|
1663
1968
|
return /* @__PURE__ */ React11.createElement(Toolbox, {
|
|
1664
1969
|
classNames,
|
|
1665
1970
|
blueprints: processor?.context.getBlueprints(),
|
|
@@ -1671,20 +1976,13 @@ var safeToolId = (name) => {
|
|
|
1671
1976
|
return name.split("_").pop();
|
|
1672
1977
|
};
|
|
1673
1978
|
|
|
1674
|
-
// src/components/index.ts
|
|
1675
|
-
var BlueprintArticle = lazy(() => import("./BlueprintArticle-WP3G5GLG.mjs"));
|
|
1676
|
-
var ChatCompanion = lazy(() => import("./ChatCompanion-ECQYUQ2B.mjs"));
|
|
1677
|
-
var ChatContainer = lazy(() => import("./ChatContainer-QCCOFBUX.mjs"));
|
|
1678
|
-
var ChatDialog = lazy(() => import("./ChatDialog-SMK4RSZU.mjs"));
|
|
1679
|
-
var PromptArticle = lazy(() => import("./PromptArticle-K362ZPAE.mjs"));
|
|
1680
|
-
|
|
1681
1979
|
// src/hooks/useChatToolbarActions.ts
|
|
1682
1980
|
var __dxlog_file5 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/hooks/useChatToolbarActions.ts";
|
|
1683
1981
|
var useChatToolbarActions = ({ chat, companionTo }) => {
|
|
1684
1982
|
const { invoke } = useOperationInvoker();
|
|
1685
1983
|
const { db } = useChatContext("useChatToolbarActions");
|
|
1686
|
-
const query = companionTo ? Query.select(
|
|
1687
|
-
const chats =
|
|
1984
|
+
const query = companionTo ? Query.select(Filter6.id(companionTo.id)).targetOf(Chat2.CompanionTo).source() : Query.select(Filter6.nothing());
|
|
1985
|
+
const chats = useQuery5(db, query);
|
|
1688
1986
|
return useMenuActions(useMemo10(() => {
|
|
1689
1987
|
return Atom.make(() => {
|
|
1690
1988
|
const builder = MenuBuilder.make().root({
|
|
@@ -1707,7 +2005,7 @@ var useChatToolbarActions = ({ chat, companionTo }) => {
|
|
|
1707
2005
|
}, () => {
|
|
1708
2006
|
invariant(companionTo, void 0, {
|
|
1709
2007
|
F: __dxlog_file5,
|
|
1710
|
-
L:
|
|
2008
|
+
L: 53,
|
|
1711
2009
|
S: void 0,
|
|
1712
2010
|
A: [
|
|
1713
2011
|
"companionTo",
|
|
@@ -1731,7 +2029,7 @@ var useChatToolbarActions = ({ chat, companionTo }) => {
|
|
|
1731
2029
|
}, () => Effect2.gen(function* () {
|
|
1732
2030
|
invariant(chat, void 0, {
|
|
1733
2031
|
F: __dxlog_file5,
|
|
1734
|
-
L:
|
|
2032
|
+
L: 70,
|
|
1735
2033
|
S: this,
|
|
1736
2034
|
A: [
|
|
1737
2035
|
"chat",
|
|
@@ -1770,13 +2068,13 @@ var useChatToolbarActions = ({ chat, companionTo }) => {
|
|
|
1770
2068
|
label: Obj6.getLabel(chat2) ?? [
|
|
1771
2069
|
"object name placeholder",
|
|
1772
2070
|
{
|
|
1773
|
-
ns:
|
|
2071
|
+
ns: Chat2.Chat.typename
|
|
1774
2072
|
}
|
|
1775
2073
|
]
|
|
1776
2074
|
}, () => Effect2.gen(function* () {
|
|
1777
2075
|
invariant(companionTo, void 0, {
|
|
1778
2076
|
F: __dxlog_file5,
|
|
1779
|
-
L:
|
|
2077
|
+
L: 106,
|
|
1780
2078
|
S: this,
|
|
1781
2079
|
A: [
|
|
1782
2080
|
"companionTo",
|
|
@@ -1803,7 +2101,6 @@ var useChatToolbarActions = ({ chat, companionTo }) => {
|
|
|
1803
2101
|
};
|
|
1804
2102
|
|
|
1805
2103
|
export {
|
|
1806
|
-
AssistantSettings,
|
|
1807
2104
|
useBlueprintRegistry,
|
|
1808
2105
|
useBlueprints,
|
|
1809
2106
|
useActiveBlueprints,
|
|
@@ -1821,12 +2118,8 @@ export {
|
|
|
1821
2118
|
ChatContextProvider,
|
|
1822
2119
|
useChatContext,
|
|
1823
2120
|
Chat,
|
|
2121
|
+
TemplateEditor,
|
|
1824
2122
|
Toolbox,
|
|
1825
|
-
|
|
1826
|
-
BlueprintArticle,
|
|
1827
|
-
ChatCompanion,
|
|
1828
|
-
ChatContainer,
|
|
1829
|
-
ChatDialog,
|
|
1830
|
-
PromptArticle
|
|
2123
|
+
ToolboxPanel
|
|
1831
2124
|
};
|
|
1832
|
-
//# sourceMappingURL=chunk-
|
|
2125
|
+
//# sourceMappingURL=chunk-A346P45I.mjs.map
|