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