@dxos/plugin-assistant 0.8.4-main.c1de068 → 0.8.4-main.c85a9c8dae
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-2LFAG5OQ.mjs +93 -0
- package/dist/lib/browser/AssistantSettings-2LFAG5OQ.mjs.map +7 -0
- package/dist/lib/browser/BlueprintArticle-CCS25MNW.mjs +36 -0
- package/dist/lib/browser/BlueprintArticle-CCS25MNW.mjs.map +7 -0
- package/dist/lib/browser/ChatCompanion-UGD4V34A.mjs +202 -0
- package/dist/lib/browser/ChatCompanion-UGD4V34A.mjs.map +7 -0
- package/dist/lib/browser/ChatContainer-ZGRSZ5EU.mjs +12 -0
- package/dist/lib/browser/ChatContainer-ZGRSZ5EU.mjs.map +7 -0
- package/dist/lib/browser/ChatDialog-AET7GVIB.mjs +85 -0
- package/dist/lib/browser/ChatDialog-AET7GVIB.mjs.map +7 -0
- package/dist/lib/browser/ProjectArticle-QDBTIFNE.mjs +91 -0
- package/dist/lib/browser/ProjectArticle-QDBTIFNE.mjs.map +7 -0
- package/dist/lib/browser/ProjectSettings-R6RRARLO.mjs +194 -0
- package/dist/lib/browser/ProjectSettings-R6RRARLO.mjs.map +7 -0
- package/dist/lib/browser/PromptArticle-USQO4WX6.mjs +71 -0
- package/dist/lib/browser/PromptArticle-USQO4WX6.mjs.map +7 -0
- package/dist/lib/browser/TriggerStatus-65X3EUSN.mjs +122 -0
- package/dist/lib/browser/TriggerStatus-65X3EUSN.mjs.map +7 -0
- package/dist/lib/browser/ai-service-CY2BYPH6.mjs +22 -0
- package/dist/lib/browser/ai-service-CY2BYPH6.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-SFYYUKTT.mjs +234 -0
- package/dist/lib/browser/app-graph-builder-SFYYUKTT.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-RB5RHZZM.mjs +34 -0
- package/dist/lib/browser/blueprint-definition-RB5RHZZM.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/blueprints/index.mjs.map +7 -0
- package/dist/lib/browser/chunk-7DXYAXLZ.mjs +230 -0
- package/dist/lib/browser/chunk-7DXYAXLZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-EXVT7D4B.mjs +23 -0
- package/dist/lib/browser/chunk-EXVT7D4B.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-JYY5AD65.mjs +286 -0
- package/dist/lib/browser/chunk-JYY5AD65.mjs.map +7 -0
- package/dist/lib/browser/chunk-LEXIQDXZ.mjs +26 -0
- package/dist/lib/browser/chunk-LEXIQDXZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-RU4G5NY4.mjs +69 -0
- package/dist/lib/browser/chunk-RU4G5NY4.mjs.map +7 -0
- package/dist/lib/browser/chunk-UUA6GNGG.mjs +2125 -0
- package/dist/lib/browser/chunk-UUA6GNGG.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-YTMFQEN5.mjs +21 -0
- package/dist/lib/browser/edge-model-resolver-YTMFQEN5.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +299 -161
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/local-model-resolver-CGRQH37T.mjs +20 -0
- package/dist/lib/browser/local-model-resolver-CGRQH37T.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-ELXDQZEG.mjs +136 -0
- package/dist/lib/browser/operation-resolver-ELXDQZEG.mjs.map +7 -0
- package/dist/lib/browser/react-surface-KYQSZO2I.mjs +144 -0
- package/dist/lib/browser/react-surface-KYQSZO2I.mjs.map +7 -0
- package/dist/lib/browser/repair-ZFZWZALX.mjs +52 -0
- package/dist/lib/browser/repair-ZFZWZALX.mjs.map +7 -0
- package/dist/lib/browser/settings-YREVQAZ5.mjs +33 -0
- package/dist/lib/browser/settings-YREVQAZ5.mjs.map +7 -0
- package/dist/lib/browser/state-MPG42ZO4.mjs +26 -0
- package/dist/lib/browser/state-MPG42ZO4.mjs.map +7 -0
- 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 +11 -4
- package/dist/lib/node-esm/AssistantSettings-QWFEMJG7.mjs +94 -0
- package/dist/lib/node-esm/AssistantSettings-QWFEMJG7.mjs.map +7 -0
- package/dist/lib/node-esm/BlueprintArticle-SNEN6LOY.mjs +37 -0
- package/dist/lib/node-esm/BlueprintArticle-SNEN6LOY.mjs.map +7 -0
- package/dist/lib/node-esm/ChatCompanion-NP4R5BFE.mjs +203 -0
- package/dist/lib/node-esm/ChatCompanion-NP4R5BFE.mjs.map +7 -0
- package/dist/lib/node-esm/ChatContainer-IFHDIFJH.mjs +13 -0
- package/dist/lib/node-esm/ChatContainer-IFHDIFJH.mjs.map +7 -0
- package/dist/lib/node-esm/ChatDialog-UZNQBTKZ.mjs +86 -0
- package/dist/lib/node-esm/ChatDialog-UZNQBTKZ.mjs.map +7 -0
- package/dist/lib/node-esm/ProjectArticle-BCIBESJN.mjs +92 -0
- package/dist/lib/node-esm/ProjectArticle-BCIBESJN.mjs.map +7 -0
- package/dist/lib/node-esm/ProjectSettings-Q5QY6BYS.mjs +195 -0
- package/dist/lib/node-esm/ProjectSettings-Q5QY6BYS.mjs.map +7 -0
- package/dist/lib/node-esm/PromptArticle-PGMJMQK7.mjs +72 -0
- package/dist/lib/node-esm/PromptArticle-PGMJMQK7.mjs.map +7 -0
- package/dist/lib/node-esm/TriggerStatus-UR5S7PXJ.mjs +123 -0
- package/dist/lib/node-esm/TriggerStatus-UR5S7PXJ.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-ZI3A6RVG.mjs +23 -0
- package/dist/lib/node-esm/ai-service-ZI3A6RVG.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-E25JXI34.mjs +235 -0
- package/dist/lib/node-esm/app-graph-builder-E25JXI34.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-L7XKRYIW.mjs +35 -0
- package/dist/lib/node-esm/blueprint-definition-L7XKRYIW.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +9 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-3QBVFAYO.mjs +28 -0
- package/dist/lib/node-esm/chunk-3QBVFAYO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-6NCLKQCL.mjs +70 -0
- package/dist/lib/node-esm/chunk-6NCLKQCL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-GZ4ERNT2.mjs +2126 -0
- package/dist/lib/node-esm/chunk-GZ4ERNT2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-JMBYVUD6.mjs +288 -0
- package/dist/lib/node-esm/chunk-JMBYVUD6.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MWYYLALM.mjs +231 -0
- package/dist/lib/node-esm/chunk-MWYYLALM.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs +25 -0
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-CMJ3KNLQ.mjs +22 -0
- package/dist/lib/node-esm/edge-model-resolver-CMJ3KNLQ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +299 -161
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/local-model-resolver-FFDAKOXN.mjs +21 -0
- package/dist/lib/node-esm/local-model-resolver-FFDAKOXN.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-Q5GNP2GH.mjs +137 -0
- package/dist/lib/node-esm/operation-resolver-Q5GNP2GH.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-JJRGVGKD.mjs +145 -0
- package/dist/lib/node-esm/react-surface-JJRGVGKD.mjs.map +7 -0
- package/dist/lib/node-esm/repair-LXFVOK4B.mjs +53 -0
- package/dist/lib/node-esm/repair-LXFVOK4B.mjs.map +7 -0
- package/dist/lib/node-esm/settings-N452OW6Y.mjs +34 -0
- package/dist/lib/node-esm/settings-N452OW6Y.mjs.map +7 -0
- package/dist/lib/node-esm/state-WHZFKIEL.mjs +27 -0
- package/dist/lib/node-esm/state-WHZFKIEL.mjs.map +7 -0
- 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 +11 -4
- package/dist/types/src/AssistantPlugin.d.ts +2 -1
- 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 +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts +6 -0
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts.map +1 -0
- package/dist/types/src/capabilities/ai-service/index.d.ts +3 -0
- package/dist/types/src/capabilities/ai-service/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts +7 -0
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/edge-model-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +11 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/local-model-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts +13 -0
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/repair/index.d.ts +3 -0
- package/dist/types/src/capabilities/repair/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/repair/repair.d.ts +6 -0
- package/dist/types/src/capabilities/repair/repair.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +15 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +18 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +11 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +13 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit/index.d.ts +3 -0
- package/dist/types/src/capabilities/toolkit/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts +6 -0
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/Chat/Chat.d.ts +39 -22
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +10 -1
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +7 -0
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
- package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
- package/dist/types/src/components/ChatProgress/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +20 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +5 -6
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +13 -11
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +285 -71
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/registry.d.ts +11 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.d.ts +42 -0
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts +2 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +3 -6
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +431 -7
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +13 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +428 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts +12 -0
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts +3 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts +8 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +21 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts +2 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/index.d.ts +3 -0
- package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +9 -15
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +432 -5
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts +12 -0
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/Typewriter.d.ts +11 -0
- package/dist/types/src/components/Typewriter/Typewriter.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts +7 -0
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/assistant-extension.d.ts +5 -0
- package/dist/types/src/components/Typewriter/assistant-extension.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/index.d.ts +2 -0
- package/dist/types/src/components/Typewriter/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +0 -8
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/AssistantSettings/AssistantSettings.d.ts +8 -0
- package/dist/types/src/containers/AssistantSettings/AssistantSettings.d.ts.map +1 -0
- 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/containers/ChatCompanion/ChatCompanion.d.ts +12 -0
- 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/containers/ChatContainer/ChatContainer.d.ts +18 -0
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts.map +1 -0
- package/dist/types/src/containers/ChatContainer/index.d.ts +3 -0
- package/dist/types/src/containers/ChatContainer/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/ChatDialog}/ChatDialog.d.ts +2 -3
- package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts.map +1 -0
- package/dist/types/src/containers/ChatDialog/index.d.ts +3 -0
- package/dist/types/src/containers/ChatDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/Project/ProjectArticle.d.ts +7 -0
- package/dist/types/src/containers/Project/ProjectArticle.d.ts.map +1 -0
- package/dist/types/src/containers/Project/ProjectSettings.d.ts +6 -0
- package/dist/types/src/containers/Project/ProjectSettings.d.ts.map +1 -0
- package/dist/types/src/containers/Project/index.d.ts +7 -0
- package/dist/types/src/containers/Project/index.d.ts.map +1 -0
- package/dist/types/src/containers/Project/triggers.d.ts +6 -0
- package/dist/types/src/containers/Project/triggers.d.ts.map +1 -0
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts +6 -0
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PromptArticle/index.d.ts +3 -0
- package/dist/types/src/containers/PromptArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts +4 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/index.d.ts +3 -0
- package/dist/types/src/containers/TriggerStatus/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +10 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +8 -3
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +25 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +10 -20
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +7 -8
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts +8 -0
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextBinder.d.ts +4 -0
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
- package/dist/types/src/hooks/useFilteredTypes.d.ts +3 -0
- package/dist/types/src/hooks/useFilteredTypes.d.ts.map +1 -0
- package/dist/types/src/hooks/useFlush.d.ts +6 -0
- package/dist/types/src/hooks/useFlush.d.ts.map +1 -0
- package/dist/types/src/hooks/useOnline.d.ts +3 -0
- package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
- package/dist/types/src/hooks/usePresets.d.ts +7 -0
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +3 -4
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +4 -0
- package/dist/types/src/processor/index.d.ts.map +1 -0
- package/dist/types/src/{hooks → processor}/presets.d.ts +3 -3
- package/dist/types/src/processor/presets.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +79 -0
- package/dist/types/src/processor/processor.d.ts.map +1 -0
- package/dist/types/src/processor/processor.test.d.ts +2 -0
- package/dist/types/src/processor/processor.test.d.ts.map +1 -0
- package/dist/types/src/processor/update-name.d.ts +10 -0
- package/dist/types/src/processor/update-name.d.ts.map +1 -0
- package/dist/types/src/queue-logger.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +8 -0
- package/dist/types/src/testing/test-generator.d.ts.map +1 -0
- package/dist/types/src/testing/test-sequence.d.ts +0 -4
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts +2 -2
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +376 -37
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +20 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -0
- package/dist/types/src/types/AssistantAction.d.ts +93 -0
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +33 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/defs.d.ts +2 -0
- package/dist/types/src/types/defs.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +6 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +14 -213
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +125 -96
- package/src/AssistantPlugin.tsx +162 -88
- 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/{components/SequenceEditor → blueprints}/index.ts +1 -1
- package/src/capabilities/ai-service/ai-service.ts +30 -0
- package/src/capabilities/ai-service/index.ts +7 -0
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +198 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +48 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/edge-model-resolver/edge-model-resolver.ts +33 -0
- package/src/capabilities/edge-model-resolver/index.ts +7 -0
- package/src/capabilities/index.ts +11 -6
- package/src/capabilities/local-model-resolver/index.ts +7 -0
- package/src/capabilities/local-model-resolver/local-model-resolver.ts +38 -0
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +121 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +121 -0
- package/src/capabilities/repair/index.ts +7 -0
- package/src/capabilities/repair/repair.ts +69 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +31 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +27 -0
- package/src/capabilities/toolkit/index.ts +7 -0
- package/src/capabilities/toolkit/toolkit.ts +15 -0
- package/src/components/Chat/Chat.tsx +278 -198
- package/src/components/Chat/events.ts +14 -1
- package/src/components/ChatProgress/ChatProgress.tsx +53 -0
- package/src/components/ChatProgress/index.ts +5 -0
- package/src/components/ChatPrompt/ChatActions.tsx +20 -28
- package/src/components/ChatPrompt/ChatOptions.tsx +258 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +42 -38
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
- package/src/components/ChatPrompt/index.ts +1 -1
- package/src/components/ChatThread/ChatThread.stories.tsx +124 -117
- package/src/components/ChatThread/ChatThread.tsx +75 -36
- package/src/components/ChatThread/Link.tsx +26 -0
- package/src/components/ChatThread/registry.tsx +207 -0
- package/src/components/ChatThread/sync.test.ts +99 -0
- package/src/components/ChatThread/sync.ts +160 -0
- package/src/components/ChatThread/testing/thread.md +37 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +41 -20
- package/src/components/TemplateEditor/TemplateEditor.tsx +33 -52
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +30 -17
- package/src/components/TemplateEditor/TemplateForm.tsx +85 -36
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +274 -0
- package/src/components/TemplateEditor/extensions/index.ts +6 -0
- package/src/components/TemplateEditor/extensions/xml-extension.ts +64 -0
- package/src/components/ToolBlock/ToolBlock.tsx +143 -0
- package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
- package/src/components/ToolBlock/index.ts +6 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +19 -29
- package/src/components/Toolbox/Toolbox.tsx +68 -100
- package/src/components/Typewriter/AssistantToolbar.tsx +161 -0
- package/src/components/Typewriter/Typewriter.stories.tsx +86 -0
- package/src/components/Typewriter/Typewriter.tsx +54 -0
- package/src/components/Typewriter/assistant-extension.tsx +142 -0
- package/src/components/Typewriter/index.ts +5 -0
- package/src/components/index.ts +0 -13
- package/src/containers/AssistantSettings/AssistantSettings.tsx +120 -0
- package/src/containers/AssistantSettings/index.ts +7 -0
- package/src/containers/BlueprintArticle/BlueprintArticle.tsx +30 -0
- package/src/containers/BlueprintArticle/index.ts +7 -0
- package/src/containers/ChatCompanion/ChatCompanion.tsx +225 -0
- package/src/containers/ChatCompanion/index.ts +7 -0
- package/src/containers/ChatContainer/ChatContainer.tsx +69 -0
- package/src/containers/ChatContainer/index.ts +7 -0
- package/src/containers/ChatDialog/ChatDialog.tsx +72 -0
- package/src/containers/ChatDialog/index.ts +7 -0
- package/src/containers/Project/ProjectArticle.tsx +117 -0
- package/src/containers/Project/ProjectSettings.tsx +118 -0
- package/src/containers/Project/index.ts +16 -0
- package/src/containers/Project/triggers.ts +131 -0
- package/src/containers/PromptArticle/PromptArticle.tsx +59 -0
- package/src/containers/PromptArticle/index.ts +7 -0
- package/src/containers/TriggerStatus/TriggerStatus.tsx +150 -0
- package/src/containers/TriggerStatus/index.ts +7 -0
- package/src/containers/index.ts +15 -0
- package/src/hooks/index.ts +8 -4
- package/src/hooks/useBlueprintRegistry.ts +108 -0
- package/src/hooks/useChatProcessor.ts +40 -105
- package/src/hooks/useChatServices.ts +31 -75
- package/src/hooks/useChatToolbarActions.ts +122 -0
- package/src/hooks/useContextBinder.ts +32 -0
- package/src/hooks/useContextObjects.ts +46 -0
- package/src/hooks/useFilteredTypes.ts +37 -0
- package/src/hooks/useFlush.ts +35 -0
- package/src/hooks/useOnline.ts +10 -0
- package/src/hooks/usePresets.ts +44 -0
- package/src/hooks/useReferencesProvider.ts +12 -13
- package/src/index.ts +3 -1
- package/src/meta.ts +11 -8
- package/src/processor/index.ts +7 -0
- package/src/{hooks → processor}/presets.ts +16 -8
- package/src/processor/processor.test.ts +73 -0
- package/src/processor/processor.ts +296 -0
- package/src/processor/update-name.ts +58 -0
- package/src/queue-logger.ts +17 -18
- package/src/testing/index.ts +1 -1
- package/src/testing/test-generator.ts +262 -0
- package/src/testing/test-sequence.ts +5 -30
- package/src/testing/test-services.ts +10 -14
- package/src/translations.ts +71 -28
- package/src/types/Assistant.ts +28 -0
- package/src/types/AssistantAction.ts +76 -0
- package/src/types/capabilities.ts +27 -0
- package/src/types/defs.ts +5 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +9 -1
- package/src/types/service.ts +27 -16
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/ChatContainer-M3IHQLRS.mjs +0 -54
- package/dist/lib/browser/ChatContainer-M3IHQLRS.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-X6VN6QZI.mjs +0 -72
- package/dist/lib/browser/ChatDialog-X6VN6QZI.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs +0 -162
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
- package/dist/lib/browser/TemplateContainer-RPJ2LBOB.mjs +0 -27
- package/dist/lib/browser/TemplateContainer-RPJ2LBOB.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-JTXBKE7O.mjs +0 -223
- package/dist/lib/browser/app-graph-builder-JTXBKE7O.mjs.map +0 -7
- package/dist/lib/browser/chunk-AEAEKWOC.mjs +0 -98
- package/dist/lib/browser/chunk-AEAEKWOC.mjs.map +0 -7
- package/dist/lib/browser/chunk-EQDW6BYQ.mjs +0 -108
- package/dist/lib/browser/chunk-EQDW6BYQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
- package/dist/lib/browser/chunk-FDCJSQYF.mjs.map +0 -7
- package/dist/lib/browser/chunk-JQBVLTM5.mjs +0 -158
- package/dist/lib/browser/chunk-JQBVLTM5.mjs.map +0 -7
- package/dist/lib/browser/chunk-OWY4CUQY.mjs +0 -2245
- package/dist/lib/browser/chunk-OWY4CUQY.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs +0 -60
- package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs.map +0 -7
- package/dist/lib/browser/react-surface-66VY37YQ.mjs +0 -150
- package/dist/lib/browser/react-surface-66VY37YQ.mjs.map +0 -7
- package/dist/lib/browser/settings-2DGP3UTS.mjs +0 -22
- package/dist/lib/browser/settings-2DGP3UTS.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-VZT74PO2.mjs +0 -55
- package/dist/lib/node-esm/ChatContainer-VZT74PO2.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-RJ6FDX4Q.mjs +0 -73
- package/dist/lib/node-esm/ChatDialog-RJ6FDX4Q.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs +0 -163
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
- package/dist/lib/node-esm/TemplateContainer-A3NAQCZE.mjs +0 -28
- package/dist/lib/node-esm/TemplateContainer-A3NAQCZE.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-OWSOXFTD.mjs +0 -224
- package/dist/lib/node-esm/app-graph-builder-OWSOXFTD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2XL6MNPE.mjs +0 -99
- package/dist/lib/node-esm/chunk-2XL6MNPE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BISJDTBK.mjs +0 -159
- package/dist/lib/node-esm/chunk-BISJDTBK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-E33DNNDW.mjs +0 -109
- package/dist/lib/node-esm/chunk-E33DNNDW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SENTQAEO.mjs +0 -2246
- package/dist/lib/node-esm/chunk-SENTQAEO.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs +0 -61
- package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs +0 -151
- package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs.map +0 -7
- package/dist/lib/node-esm/settings-47RYZOU4.mjs +0 -23
- package/dist/lib/node-esm/settings-47RYZOU4.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +0 -6
- package/dist/types/src/components/AssistantSettings/AssistantSettings.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/ChatContainer.d.ts +0 -11
- 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/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -17
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +0 -19
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
- package/dist/types/src/components/PromptSettings.d.ts +0 -6
- package/dist/types/src/components/PromptSettings.d.ts.map +0 -1
- package/dist/types/src/components/SequenceContainer.d.ts +0 -8
- package/dist/types/src/components/SequenceContainer.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +0 -13
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +0 -8
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/index.d.ts +0 -2
- package/dist/types/src/components/SequenceEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/TemplateContainer.d.ts +0 -8
- package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.d.ts +0 -86
- package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
- package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/presets.d.ts.map +0 -1
- package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
- package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.d.ts +0 -4
- package/dist/types/src/parser/filter-generator.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.test.d.ts +0 -2
- package/dist/types/src/parser/filter-generator.test.d.ts.map +0 -1
- package/dist/types/src/parser/index.d.ts +0 -4
- package/dist/types/src/parser/index.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.d.ts +0 -15
- package/dist/types/src/parser/query-parser.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.test.d.ts +0 -2
- package/dist/types/src/parser/query-parser.test.d.ts.map +0 -1
- package/dist/types/src/parser/types.d.ts +0 -24
- package/dist/types/src/parser/types.d.ts.map +0 -1
- package/dist/types/src/stories/Chat.stories.d.ts +0 -249
- package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -3
- package/dist/types/src/testing/test-functions.d.ts.map +0 -1
- package/dist/types/src/tools/function.d.ts +0 -5
- package/dist/types/src/tools/function.d.ts.map +0 -1
- package/dist/types/src/tools/index.d.ts +0 -3
- package/dist/types/src/tools/index.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.d.ts +0 -10
- package/dist/types/src/tools/openapi.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.test.d.ts +0 -2
- package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -88
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -253
- package/src/capabilities/intent-resolver.ts +0 -58
- package/src/capabilities/react-surface.tsx +0 -138
- package/src/capabilities/settings.ts +0 -19
- package/src/components/AssistantSettings/AssistantSettings.tsx +0 -105
- package/src/components/AssistantSettings/index.ts +0 -5
- package/src/components/ChatContainer.tsx +0 -45
- package/src/components/ChatDialog.tsx +0 -64
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
- package/src/components/ChatThread/ChatMessage.tsx +0 -268
- package/src/components/ChatThread/ToolBlock.tsx +0 -121
- package/src/components/ChatThread/reducer.ts +0 -52
- package/src/components/PromptSettings.tsx +0 -89
- package/src/components/SequenceContainer.tsx +0 -132
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -32
- package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
- package/src/components/TemplateContainer.tsx +0 -24
- package/src/events.ts +0 -11
- package/src/hooks/chat-processor.test.ts +0 -16
- package/src/hooks/chat-processor.ts +0 -314
- package/src/hooks/useBlueprints.ts +0 -57
- package/src/parser/filter-generator.test.ts +0 -32
- package/src/parser/filter-generator.ts +0 -81
- package/src/parser/index.ts +0 -7
- package/src/parser/query-parser.test.ts +0 -139
- package/src/parser/query-parser.ts +0 -199
- package/src/parser/types.ts +0 -34
- package/src/shims.d.ts +0 -8
- package/src/stories/Chat.stories.tsx +0 -378
- package/src/testing/test-functions.ts +0 -11
- package/src/tools/function.ts +0 -46
- package/src/tools/index.ts +0 -6
- package/src/tools/openapi.test.ts +0 -217
- package/src/tools/openapi.ts +0 -338
- package/src/types/schema.ts +0 -95
- package/src/typings.d.ts +0 -9
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Option from 'effect/Option';
|
|
6
|
+
import { useEffect, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { type Database, type Type } from '@dxos/echo';
|
|
9
|
+
import { EntityKind, SystemTypeAnnotation, getTypeAnnotation } from '@dxos/echo/internal';
|
|
10
|
+
|
|
11
|
+
// TODO(burdon): Pass in filter.
|
|
12
|
+
// TODO(wittjosiah): Factor out.
|
|
13
|
+
export const useFilteredTypes = (db?: Database.Database): Type.AnyEntity[] => {
|
|
14
|
+
const [types, setTypes] = useState<Type.AnyEntity[]>([]);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!db) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return db.schemaRegistry.query({ location: ['database', 'runtime'] }).subscribe(
|
|
21
|
+
(query) => {
|
|
22
|
+
const types = Array.from(
|
|
23
|
+
new Set(
|
|
24
|
+
query.results
|
|
25
|
+
.filter((schema) => getTypeAnnotation(schema)?.kind !== EntityKind.Relation)
|
|
26
|
+
.filter((schema) => SystemTypeAnnotation.get(schema).pipe(Option.getOrElse(() => false))),
|
|
27
|
+
),
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
setTypes(types);
|
|
31
|
+
},
|
|
32
|
+
{ fire: true },
|
|
33
|
+
);
|
|
34
|
+
}, [db]);
|
|
35
|
+
|
|
36
|
+
return types;
|
|
37
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCallback, useRef, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Space } from '@dxos/client/echo';
|
|
8
|
+
|
|
9
|
+
export const useFlush = (space?: Space) => {
|
|
10
|
+
const [state, setState] = useState<'idle' | 'flushing' | 'flushed'>('idle');
|
|
11
|
+
const resetTimer = useRef<NodeJS.Timeout | null>(null);
|
|
12
|
+
|
|
13
|
+
const handleFlush = useCallback(() => {
|
|
14
|
+
if (!space) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
queueMicrotask(async () => {
|
|
19
|
+
if (resetTimer.current) {
|
|
20
|
+
clearTimeout(resetTimer.current);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
setState('flushing');
|
|
24
|
+
await space.db.flush();
|
|
25
|
+
setState('flushed');
|
|
26
|
+
|
|
27
|
+
resetTimer.current = setTimeout(() => {
|
|
28
|
+
setState('idle');
|
|
29
|
+
resetTimer.current = null;
|
|
30
|
+
}, 1_000);
|
|
31
|
+
});
|
|
32
|
+
}, [space]);
|
|
33
|
+
|
|
34
|
+
return { state, handleFlush };
|
|
35
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Dispatch, type SetStateAction, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
export const useOnline = (): [boolean, Dispatch<SetStateAction<boolean>>] => {
|
|
8
|
+
const [online, setOnline] = useState(true);
|
|
9
|
+
return [online, setOnline];
|
|
10
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type ChatPromptProps } from '../components';
|
|
8
|
+
import { type AiServicePreset, AiServicePresets } from '../processor';
|
|
9
|
+
|
|
10
|
+
export type UsePresets = {
|
|
11
|
+
preset: AiServicePreset | undefined;
|
|
12
|
+
} & Pick<ChatPromptProps, 'presets' | 'onPresetChange'>;
|
|
13
|
+
|
|
14
|
+
export const usePresets = (online: boolean): UsePresets => {
|
|
15
|
+
// TODO(burdon): Memo preset for provider.
|
|
16
|
+
const [preset, setPreset] = useState<AiServicePreset>();
|
|
17
|
+
const presets = useMemo(
|
|
18
|
+
() => AiServicePresets.filter((preset) => online === (preset.provider === 'dxos-remote')),
|
|
19
|
+
[online],
|
|
20
|
+
);
|
|
21
|
+
const presetOptions = useMemo(
|
|
22
|
+
() => presets.map(({ id, model, label }) => ({ id, label: label ?? model })),
|
|
23
|
+
[presets],
|
|
24
|
+
);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setPreset(presets[0]);
|
|
27
|
+
}, [presets]);
|
|
28
|
+
|
|
29
|
+
const handlePresetChange = useCallback<NonNullable<ChatPromptProps['onPresetChange']>>(
|
|
30
|
+
(id) => {
|
|
31
|
+
const preset = presets.find((preset) => preset.id === id);
|
|
32
|
+
if (preset) {
|
|
33
|
+
setPreset(preset);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
[presets],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
preset: preset,
|
|
41
|
+
presets: presetOptions,
|
|
42
|
+
onPresetChange: handlePresetChange,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -4,18 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
8
7
|
import { type Space } from '@dxos/client/echo';
|
|
9
|
-
import { Filter, Obj
|
|
8
|
+
import { Filter, Obj } from '@dxos/echo';
|
|
10
9
|
import { type ReferencesProvider } from '@dxos/react-ui-chat';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Resolve references to objects in the space.
|
|
14
13
|
*/
|
|
15
14
|
export const useReferencesProvider = (space?: Space): ReferencesProvider | undefined => {
|
|
16
|
-
// TODO(burdon): Pass in.
|
|
17
|
-
const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
|
|
18
|
-
|
|
19
15
|
return useMemo<ReferencesProvider | undefined>((): ReferencesProvider | undefined => {
|
|
20
16
|
if (!space) {
|
|
21
17
|
return undefined;
|
|
@@ -23,10 +19,13 @@ export const useReferencesProvider = (space?: Space): ReferencesProvider | undef
|
|
|
23
19
|
|
|
24
20
|
return {
|
|
25
21
|
getReferences: async ({ query }) => {
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
// TODO(burdon): Previously we filtered by types declared by the artifact definitions.
|
|
23
|
+
// const schemas = blueprints.map((blueprint) => blueprint.schema).flat();
|
|
24
|
+
// const objects = await space.db
|
|
25
|
+
// .query(Filter.or(...schemas.map((schema) => Filter.type(schema as Type.Schema))))
|
|
26
|
+
// .run();
|
|
27
|
+
|
|
28
|
+
const objects = await space.db.query(Filter.everything()).run();
|
|
30
29
|
|
|
31
30
|
return (
|
|
32
31
|
objects
|
|
@@ -37,19 +36,19 @@ export const useReferencesProvider = (space?: Space): ReferencesProvider | undef
|
|
|
37
36
|
// })
|
|
38
37
|
.filter((object) => stringMatch(query, Obj.getLabel(object as any) ?? ''))
|
|
39
38
|
// TODO(dmaretskyi): `Type.getDXN` (at the point of writing) didn't work here as it was schema-only.
|
|
40
|
-
.filter((object) => !!Obj.getDXN(object as Obj.
|
|
39
|
+
.filter((object) => !!Obj.getDXN(object as Obj.Unknown))
|
|
41
40
|
.map((object) => ({
|
|
42
|
-
uri: Obj.getDXN(object as any)
|
|
41
|
+
uri: Obj.getDXN(object as any).toString(),
|
|
43
42
|
label: Obj.getLabel(object as any) ?? '',
|
|
44
43
|
}))
|
|
45
44
|
);
|
|
46
45
|
},
|
|
47
46
|
resolveReference: async ({ uri }) => {
|
|
48
|
-
const object = await space.db.query(Filter.
|
|
47
|
+
const object = await space.db.query(Filter.id(uri)).first();
|
|
49
48
|
return { uri, label: Obj.getLabel(object) ?? '' };
|
|
50
49
|
},
|
|
51
50
|
} satisfies ReferencesProvider;
|
|
52
|
-
}, [space
|
|
51
|
+
}, [space]);
|
|
53
52
|
};
|
|
54
53
|
|
|
55
54
|
const stringMatch = (query: string, label: string) => label.toLowerCase().startsWith(query.toLowerCase());
|
package/src/index.ts
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
export * from './blueprints';
|
|
5
6
|
export * from './capabilities';
|
|
6
7
|
export * from './components';
|
|
7
|
-
export * from './
|
|
8
|
+
export * from './hooks';
|
|
8
9
|
export * from './meta';
|
|
10
|
+
export * from './translations';
|
|
9
11
|
export * from './types';
|
|
10
12
|
|
|
11
13
|
export * from './AssistantPlugin';
|
package/src/meta.ts
CHANGED
|
@@ -2,17 +2,20 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
export const ASSISTANT_DIALOG = `${ASSISTANT_PLUGIN}/assistant/dialog`;
|
|
10
|
-
|
|
11
|
-
export const meta: PluginMeta = {
|
|
12
|
-
id: ASSISTANT_PLUGIN,
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'dxos.org/plugin/assistant',
|
|
13
10
|
name: 'Assistant',
|
|
14
|
-
description:
|
|
11
|
+
description: trim`
|
|
12
|
+
Intelligent AI assistant that can analyze and interact with objects across your spaces.
|
|
13
|
+
Chat naturally to get insights, search content, and perform actions using AI-powered context awareness.
|
|
14
|
+
`,
|
|
15
15
|
icon: 'ph--atom--regular',
|
|
16
|
+
iconHue: 'sky',
|
|
16
17
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-assistant',
|
|
17
18
|
tags: ['labs'],
|
|
18
19
|
};
|
|
20
|
+
|
|
21
|
+
export const ASSISTANT_DIALOG = `${meta.id}/assistant/dialog`;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type ModelName } from '@dxos/ai';
|
|
8
8
|
|
|
9
9
|
const ModelProviders = ['dxos-local', 'dxos-remote', 'lm-studio'] as const;
|
|
10
10
|
|
|
@@ -14,11 +14,11 @@ type ModelProvider = Schema.Schema.Type<typeof ModelProvider>;
|
|
|
14
14
|
export type AiServicePreset = {
|
|
15
15
|
id: string;
|
|
16
16
|
provider: ModelProvider;
|
|
17
|
-
model:
|
|
17
|
+
model: ModelName;
|
|
18
18
|
label?: string;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
const createModelLabel = (model:
|
|
21
|
+
const createModelLabel = (model: ModelName) => {
|
|
22
22
|
const parts = model.split('/');
|
|
23
23
|
return parts[parts.length - 1];
|
|
24
24
|
};
|
|
@@ -27,19 +27,27 @@ const createModelLabel = (model: LLMModel) => {
|
|
|
27
27
|
export const AiServicePresets: AiServicePreset[] = [
|
|
28
28
|
{
|
|
29
29
|
provider: 'dxos-remote' as const,
|
|
30
|
-
model: '@anthropic/claude-
|
|
30
|
+
model: '@anthropic/claude-opus-4-0' as const,
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
provider: 'dxos-remote' as const,
|
|
34
|
-
model: '@anthropic/claude-
|
|
34
|
+
model: '@anthropic/claude-sonnet-4-0' as const,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
provider: 'dxos-remote' as const,
|
|
38
|
+
model: '@anthropic/claude-3-5-haiku-20241022' as const,
|
|
35
39
|
},
|
|
36
40
|
{
|
|
37
41
|
provider: 'lm-studio' as const,
|
|
38
|
-
model: '@google/gemma-3-
|
|
42
|
+
model: '@google/gemma-3-27b' as const,
|
|
39
43
|
},
|
|
40
44
|
{
|
|
41
45
|
provider: 'lm-studio' as const,
|
|
42
|
-
model: '@
|
|
46
|
+
model: '@meta/llama-3.2-3b-instruct' as const,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
model: 'deepseek-r1:latest' as const,
|
|
50
|
+
provider: 'dxos-local' as const,
|
|
43
51
|
},
|
|
44
52
|
].map(
|
|
45
53
|
({ model, provider }, i) =>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Tool from '@effect/ai/Tool';
|
|
6
|
+
import * as Toolkit from '@effect/ai/Toolkit';
|
|
7
|
+
import { describe, it } from '@effect/vitest';
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
import * as Layer from 'effect/Layer';
|
|
10
|
+
import * as Schema from 'effect/Schema';
|
|
11
|
+
|
|
12
|
+
import { AiService } from '@dxos/ai';
|
|
13
|
+
import { GenericToolkit } from '@dxos/ai';
|
|
14
|
+
import { AiServiceTestingPreset } from '@dxos/ai/testing';
|
|
15
|
+
import { AiConversation, ToolExecutionServices } from '@dxos/assistant';
|
|
16
|
+
import { acquireReleaseResource } from '@dxos/effect';
|
|
17
|
+
import { TestHelpers } from '@dxos/effect/testing';
|
|
18
|
+
import { CredentialsService, QueueService, TracingService } from '@dxos/functions';
|
|
19
|
+
import { FunctionInvocationServiceLayerTestMocked, TestDatabaseLayer } from '@dxos/functions-runtime/testing';
|
|
20
|
+
import { type Message } from '@dxos/types';
|
|
21
|
+
|
|
22
|
+
import { AiChatProcessor, type AiChatServices } from './processor';
|
|
23
|
+
|
|
24
|
+
const TestToolkit = Toolkit.make(
|
|
25
|
+
Tool.make('random', {
|
|
26
|
+
description: 'Random number generator',
|
|
27
|
+
parameters: {},
|
|
28
|
+
success: Schema.Number,
|
|
29
|
+
}),
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
// TODO(burdon): Explain structure.
|
|
33
|
+
const TestServicesLayer = Layer.mergeAll(
|
|
34
|
+
TracingService.layerNoop,
|
|
35
|
+
AiServiceTestingPreset('direct'),
|
|
36
|
+
TestDatabaseLayer({
|
|
37
|
+
// indexing: { vector: true },
|
|
38
|
+
// types: [],
|
|
39
|
+
}),
|
|
40
|
+
// CredentialsService.configuredLayer([{ service: 'exa.ai', apiKey: EXA_API_KEY }]),
|
|
41
|
+
FunctionInvocationServiceLayerTestMocked({ functions: [] }).pipe(Layer.provideMerge(TracingService.layerNoop)),
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const TestLayer: Layer.Layer<AiChatServices, never, never> = Layer.mergeAll(
|
|
45
|
+
AiService.model('@anthropic/claude-opus-4-0'),
|
|
46
|
+
ToolExecutionServices,
|
|
47
|
+
CredentialsService.layerFromDatabase(),
|
|
48
|
+
).pipe(
|
|
49
|
+
Layer.provideMerge(GenericToolkit.providerLayer(GenericToolkit.make(TestToolkit, TestToolkit.toLayer({} as any)))),
|
|
50
|
+
Layer.provideMerge(TestServicesLayer),
|
|
51
|
+
Layer.orDie,
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
// TODO(burdon): Create actual test with mock LLM.
|
|
55
|
+
describe('Chat processor', () => {
|
|
56
|
+
it.scoped(
|
|
57
|
+
'basic',
|
|
58
|
+
Effect.fn(
|
|
59
|
+
function* ({ expect }) {
|
|
60
|
+
const services = yield* Effect.runtime<AiChatServices>();
|
|
61
|
+
const queue = yield* QueueService.createQueue<Message.Message>();
|
|
62
|
+
const conversation = yield* acquireReleaseResource(() => new AiConversation({ queue }));
|
|
63
|
+
const processor = new AiChatProcessor(conversation, async () => services);
|
|
64
|
+
const result = yield* Effect.promise(() => processor.request({ message: 'Hello' }));
|
|
65
|
+
void processor.cancel();
|
|
66
|
+
expect(processor.active).to.be.false;
|
|
67
|
+
expect(result).to.exist;
|
|
68
|
+
},
|
|
69
|
+
Effect.provide(TestLayer),
|
|
70
|
+
TestHelpers.taggedTest('llm'),
|
|
71
|
+
),
|
|
72
|
+
);
|
|
73
|
+
});
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import type * as Tool from '@effect/ai/Tool';
|
|
6
|
+
import { Atom, Registry } from '@effect-atom/atom-react';
|
|
7
|
+
import * as Cause from 'effect/Cause';
|
|
8
|
+
import * as Effect from 'effect/Effect';
|
|
9
|
+
import * as Exit from 'effect/Exit';
|
|
10
|
+
import * as Fiber from 'effect/Fiber';
|
|
11
|
+
import * as Option from 'effect/Option';
|
|
12
|
+
import * as Runtime from 'effect/Runtime';
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
AiService,
|
|
16
|
+
DEFAULT_EDGE_MODEL,
|
|
17
|
+
type ModelName,
|
|
18
|
+
type ModelRegistry,
|
|
19
|
+
type ToolExecutionService,
|
|
20
|
+
type ToolResolverService,
|
|
21
|
+
} from '@dxos/ai';
|
|
22
|
+
import {
|
|
23
|
+
AiContextService,
|
|
24
|
+
type AiConversation,
|
|
25
|
+
type AiConversationRunProps,
|
|
26
|
+
ArtifactDiffResolver,
|
|
27
|
+
GenerationObserver,
|
|
28
|
+
createSystemPrompt,
|
|
29
|
+
} from '@dxos/assistant';
|
|
30
|
+
import { formatSystemPrompt } from '@dxos/assistant';
|
|
31
|
+
import { type Chat } from '@dxos/assistant-toolkit';
|
|
32
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
33
|
+
import { Obj } from '@dxos/echo';
|
|
34
|
+
import { type Database } from '@dxos/echo';
|
|
35
|
+
import { runAndForwardErrors, throwCause, unwrapExit } from '@dxos/effect';
|
|
36
|
+
import {
|
|
37
|
+
type CredentialsService,
|
|
38
|
+
type FunctionInvocationService,
|
|
39
|
+
type QueueService,
|
|
40
|
+
type TracingService,
|
|
41
|
+
} from '@dxos/functions';
|
|
42
|
+
import { log } from '@dxos/log';
|
|
43
|
+
import { type ContentBlock, Message } from '@dxos/types';
|
|
44
|
+
|
|
45
|
+
import { updateName } from './update-name';
|
|
46
|
+
|
|
47
|
+
export type AiChatServices =
|
|
48
|
+
| CredentialsService
|
|
49
|
+
| Database.Service
|
|
50
|
+
| QueueService
|
|
51
|
+
| FunctionInvocationService
|
|
52
|
+
| AiService.AiService
|
|
53
|
+
| ToolExecutionService
|
|
54
|
+
| ToolResolverService
|
|
55
|
+
| TracingService;
|
|
56
|
+
|
|
57
|
+
export type AiChatProcessorOptions = {
|
|
58
|
+
model?: ModelName;
|
|
59
|
+
modelRegistry?: ModelRegistry;
|
|
60
|
+
blueprintRegistry?: Blueprint.Registry;
|
|
61
|
+
observableRegistry?: Registry.Registry;
|
|
62
|
+
extensions?: ToolContextExtensions;
|
|
63
|
+
} & Pick<AiConversationRunProps, 'system'>;
|
|
64
|
+
|
|
65
|
+
const defaultOptions: Partial<AiChatProcessorOptions> = {
|
|
66
|
+
model: DEFAULT_EDGE_MODEL,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// TODO(burdon): Retry, timeout?
|
|
70
|
+
export type AiRequestOptions = {};
|
|
71
|
+
|
|
72
|
+
export type AiRequest = {
|
|
73
|
+
message: string;
|
|
74
|
+
options?: AiRequestOptions;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Handles interactions with the AI service.
|
|
79
|
+
* Handles streaming responses from the conversation.
|
|
80
|
+
*/
|
|
81
|
+
export class AiChatProcessor {
|
|
82
|
+
private readonly _registry: Registry.Registry;
|
|
83
|
+
|
|
84
|
+
/** External observer. */
|
|
85
|
+
private readonly _observer: GenerationObserver;
|
|
86
|
+
|
|
87
|
+
/** Pending messages (incl. the current user request). */
|
|
88
|
+
private readonly _pending = Atom.make<Message.Message[]>([]);
|
|
89
|
+
|
|
90
|
+
/** Currently streaming message (from the AI service). */
|
|
91
|
+
private readonly _streaming = Atom.make<Message.Message[]>([]);
|
|
92
|
+
|
|
93
|
+
/** Currently active request fiber. */
|
|
94
|
+
private _fiber: Fiber.Fiber<void, any> | undefined;
|
|
95
|
+
|
|
96
|
+
/** Last request (for retries). */
|
|
97
|
+
private _lastRequest: AiRequest | undefined;
|
|
98
|
+
|
|
99
|
+
/** Streaming state. */
|
|
100
|
+
public readonly streaming = Atom.make<boolean>((get) => get(this._streaming).length > 0);
|
|
101
|
+
|
|
102
|
+
/** Active state. */
|
|
103
|
+
public readonly active = Atom.make(false);
|
|
104
|
+
|
|
105
|
+
/** Array of Messages (incl. the current message being streamed). */
|
|
106
|
+
public readonly messages = Atom.make<Message.Message[]>((get) => [...get(this._pending), ...get(this._streaming)]);
|
|
107
|
+
|
|
108
|
+
/** Last error. */
|
|
109
|
+
public readonly error = Atom.make<Option.Option<Error>>(Option.none());
|
|
110
|
+
|
|
111
|
+
constructor(
|
|
112
|
+
private readonly _conversation: AiConversation,
|
|
113
|
+
// TODO(dmaretskyi): Replace this with effect's ManagedRuntime wrapping this layer.
|
|
114
|
+
private readonly _services: () => Promise<Runtime.Runtime<AiChatServices>>,
|
|
115
|
+
private readonly _options: AiChatProcessorOptions = defaultOptions,
|
|
116
|
+
) {
|
|
117
|
+
// Initialize registries and defaults before using in other logic.
|
|
118
|
+
this._registry = this._options.observableRegistry ?? Registry.make();
|
|
119
|
+
this._observer = GenerationObserver.make({
|
|
120
|
+
onBlock: this._onBlock,
|
|
121
|
+
onMessage: this._onMessage,
|
|
122
|
+
});
|
|
123
|
+
if (this._options.model && !this._options.system) {
|
|
124
|
+
const capabilities = this._options.modelRegistry?.getCapabilities(this._options.model) ?? {};
|
|
125
|
+
this._options.system = createSystemPrompt(capabilities);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
get context() {
|
|
130
|
+
return this._conversation.context;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
get conversation() {
|
|
134
|
+
return this._conversation;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
get blueprintRegistry() {
|
|
138
|
+
return this._options.blueprintRegistry;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
get system(): string {
|
|
142
|
+
return this._options.system ?? '';
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async getTools(): Promise<Record<string, Tool.Any>> {
|
|
146
|
+
return unwrapExit(await this._conversation.getTools().pipe(await Runtime.runPromiseExit(await this._services())));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async getSystemPrompt(): Promise<string> {
|
|
150
|
+
return unwrapExit(
|
|
151
|
+
await Effect.gen(this, function* () {
|
|
152
|
+
const blueprints = this.context.getBlueprints();
|
|
153
|
+
const objects = this.context.getObjects();
|
|
154
|
+
const system = yield* formatSystemPrompt({ system: this._options.system, blueprints, objects });
|
|
155
|
+
return system;
|
|
156
|
+
}).pipe(
|
|
157
|
+
Effect.provideService(AiContextService, {
|
|
158
|
+
binder: this.context,
|
|
159
|
+
}),
|
|
160
|
+
await Runtime.runPromiseExit(await this._services()),
|
|
161
|
+
),
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Initiates a new request.
|
|
167
|
+
*/
|
|
168
|
+
async request(requestProp: AiRequest): Promise<void> {
|
|
169
|
+
if (this._fiber) {
|
|
170
|
+
await this.cancel();
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
try {
|
|
174
|
+
this._lastRequest = requestProp;
|
|
175
|
+
this._registry.set(this.error, Option.none());
|
|
176
|
+
this._registry.set(this.active, true);
|
|
177
|
+
|
|
178
|
+
const services = await this._services();
|
|
179
|
+
|
|
180
|
+
// Create request.
|
|
181
|
+
const request = this._conversation.createRequest({
|
|
182
|
+
system: this._options.system,
|
|
183
|
+
prompt: requestProp.message,
|
|
184
|
+
observer: this._observer,
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
// Create fiber.
|
|
188
|
+
this._fiber = request.pipe(
|
|
189
|
+
Effect.provide(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL)),
|
|
190
|
+
// TODO(dmaretskyi): Move ArtifactDiffResolver upstream.
|
|
191
|
+
Effect.provideService(ArtifactDiffResolver, this._artifactDiffResolver),
|
|
192
|
+
Effect.asVoid,
|
|
193
|
+
Runtime.runFork(services), // Runs in the background.
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
// Execute request.
|
|
197
|
+
const response = await this._fiber.pipe(Fiber.join, Effect.runPromiseExit);
|
|
198
|
+
if (!Exit.isSuccess(response) && !Cause.isInterruptedOnly(response.cause)) {
|
|
199
|
+
throwCause(response.cause);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
this._registry.set(this.error, Option.none());
|
|
203
|
+
this._lastRequest = undefined;
|
|
204
|
+
this._fiber = undefined;
|
|
205
|
+
} catch (err) {
|
|
206
|
+
log.error('request failed', { error: err });
|
|
207
|
+
this._registry.set(this.error, Option.some(new Error('AI service error', { cause: err })));
|
|
208
|
+
} finally {
|
|
209
|
+
this._registry.set(this.active, false);
|
|
210
|
+
this._fiber = undefined;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Cancels the current request.
|
|
216
|
+
*/
|
|
217
|
+
async cancel(): Promise<void> {
|
|
218
|
+
await runAndForwardErrors(
|
|
219
|
+
Effect.gen(this, function* () {
|
|
220
|
+
if (this._fiber) {
|
|
221
|
+
yield* this._fiber.pipe(Fiber.interrupt);
|
|
222
|
+
}
|
|
223
|
+
}),
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
this._fiber = undefined;
|
|
227
|
+
this._registry.set(this.active, false);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Retry last failed request.
|
|
232
|
+
*/
|
|
233
|
+
async retry(): Promise<void> {
|
|
234
|
+
if (this._lastRequest) {
|
|
235
|
+
return this.request(this._lastRequest);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Update the current chat's name.
|
|
241
|
+
*/
|
|
242
|
+
async updateName(chat: Chat.Chat): Promise<void> {
|
|
243
|
+
const runtime = await this._services();
|
|
244
|
+
await updateName(runtime, this._conversation, chat, this._options.model);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// TODO(burdon): Fix/factor out.
|
|
248
|
+
private _artifactDiffResolver: ArtifactDiffResolver.Service = {
|
|
249
|
+
resolve: async (_artifacts) => {
|
|
250
|
+
const versions = new Map();
|
|
251
|
+
// await Promise.all(
|
|
252
|
+
// artifacts.map(async (artifact) => {
|
|
253
|
+
// const {
|
|
254
|
+
// objects: [object],
|
|
255
|
+
// } = await space.db.query(Filter.id(artifact.id)).run();
|
|
256
|
+
// if (!object) {
|
|
257
|
+
// return;
|
|
258
|
+
// }
|
|
259
|
+
|
|
260
|
+
// versions.set(artifact.id, {
|
|
261
|
+
// version: getVersion(object),
|
|
262
|
+
// diff: `Current state: ${JSON.stringify(object)}`,
|
|
263
|
+
// });
|
|
264
|
+
// }),
|
|
265
|
+
// );
|
|
266
|
+
|
|
267
|
+
return versions;
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
// TODO(dmaretskyi): Due to the way effect streams do buffering, we cannot rely on _onBlock and _onMessage to be called in order.
|
|
272
|
+
private _onBlock = Effect.fn(
|
|
273
|
+
function* (this: AiChatProcessor, block: ContentBlock.Any) {
|
|
274
|
+
this._registry.update(this._streaming, (streaming) => {
|
|
275
|
+
const blocks = streaming.filter((message) => message.blocks.every((block) => !block.pending));
|
|
276
|
+
|
|
277
|
+
// AiSession emits a message per each assistant content-block, so we do the same.
|
|
278
|
+
return [
|
|
279
|
+
...blocks,
|
|
280
|
+
Obj.make(Message.Message, {
|
|
281
|
+
created: new Date().toISOString(),
|
|
282
|
+
sender: { role: 'assistant' },
|
|
283
|
+
blocks: [block],
|
|
284
|
+
}),
|
|
285
|
+
];
|
|
286
|
+
});
|
|
287
|
+
}.bind(this),
|
|
288
|
+
);
|
|
289
|
+
|
|
290
|
+
private _onMessage = Effect.fn(
|
|
291
|
+
function* (this: AiChatProcessor, message: Message.Message) {
|
|
292
|
+
this._registry.set(this._streaming, []);
|
|
293
|
+
this._registry.update(this._pending, (pending) => [...pending, message]);
|
|
294
|
+
}.bind(this),
|
|
295
|
+
);
|
|
296
|
+
}
|