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