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