@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
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { forwardRef, useImperativeHandle } from 'react';
|
|
6
|
-
|
|
7
|
-
import { SequenceDefinition } from '@dxos/conductor';
|
|
8
|
-
import { Type } from '@dxos/echo';
|
|
9
|
-
import { useThemeContext, type ThemedClassName } from '@dxos/react-ui';
|
|
10
|
-
import {
|
|
11
|
-
type EditorView,
|
|
12
|
-
createBasicExtensions,
|
|
13
|
-
createJsonExtensions,
|
|
14
|
-
createThemeExtensions,
|
|
15
|
-
useTextEditor,
|
|
16
|
-
} from '@dxos/react-ui-editor';
|
|
17
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
18
|
-
|
|
19
|
-
export type SequenceEditorProps = ThemedClassName<{
|
|
20
|
-
sequence: SequenceDefinition;
|
|
21
|
-
}>;
|
|
22
|
-
|
|
23
|
-
// TODO(burdon): Factor out JsonEditor.
|
|
24
|
-
export const SequenceEditor = forwardRef<EditorView | undefined, SequenceEditorProps>(
|
|
25
|
-
({ classNames, sequence }, forwardedRef) => {
|
|
26
|
-
const { themeMode } = useThemeContext();
|
|
27
|
-
const { parentRef, view } = useTextEditor({
|
|
28
|
-
initialValue: JSON.stringify(sequence, null, 2),
|
|
29
|
-
extensions: [
|
|
30
|
-
createBasicExtensions({
|
|
31
|
-
lineNumbers: true,
|
|
32
|
-
lineWrapping: false,
|
|
33
|
-
monospace: true,
|
|
34
|
-
scrollPastEnd: true,
|
|
35
|
-
}),
|
|
36
|
-
createThemeExtensions({
|
|
37
|
-
themeMode,
|
|
38
|
-
syntaxHighlighting: true,
|
|
39
|
-
}),
|
|
40
|
-
createJsonExtensions({
|
|
41
|
-
schema: Type.toJsonSchema(SequenceDefinition, { strict: true }),
|
|
42
|
-
}),
|
|
43
|
-
],
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
useImperativeHandle(forwardedRef, () => view, [view]);
|
|
47
|
-
|
|
48
|
-
return <div ref={parentRef} className={mx('overflow-hidden', classNames)} />;
|
|
49
|
-
},
|
|
50
|
-
);
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Template } from '@dxos/blueprints';
|
|
8
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
9
|
-
|
|
10
|
-
import { TemplateEditor } from './TemplateEditor';
|
|
11
|
-
|
|
12
|
-
export type TemplateContainerProps = {
|
|
13
|
-
template: Template.Template;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const TemplateContainer = ({ template }: TemplateContainerProps) => {
|
|
17
|
-
return (
|
|
18
|
-
<StackItem.Content classNames='container-max-width'>
|
|
19
|
-
<TemplateEditor template={template} />
|
|
20
|
-
</StackItem.Content>
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default TemplateContainer;
|
package/src/events.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { describe, it } from 'vitest';
|
|
6
|
-
|
|
7
|
-
import { ChatProcessor } from './chat-processor';
|
|
8
|
-
|
|
9
|
-
describe('ChatProcessor', () => {
|
|
10
|
-
it('should be instantiable', ({ expect }) => {
|
|
11
|
-
const services = {} as any; // TODO(burdon): Create mock.
|
|
12
|
-
const client = {} as any; // TODO(burdon): Create mock.
|
|
13
|
-
const processor = new ChatProcessor(services, client);
|
|
14
|
-
expect(processor).toBeDefined();
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Signal, batch, computed, signal } from '@preact/signals-core';
|
|
6
|
-
import { Effect, type Layer } from 'effect';
|
|
7
|
-
|
|
8
|
-
import { AiService, DEFAULT_EDGE_MODEL, type ExecutableTool, type GenerateRequest } from '@dxos/ai';
|
|
9
|
-
import { type PromiseIntentDispatcher } from '@dxos/app-framework';
|
|
10
|
-
import { type AiSession, ArtifactDiffResolver, type ContextBinder, type Conversation } from '@dxos/assistant';
|
|
11
|
-
import { type ArtifactDefinition, type Blueprint } from '@dxos/blueprints';
|
|
12
|
-
import { Context } from '@dxos/context';
|
|
13
|
-
import { Obj } from '@dxos/echo';
|
|
14
|
-
import { runAndForwardErrors } from '@dxos/effect';
|
|
15
|
-
import { log } from '@dxos/log';
|
|
16
|
-
import { Filter, type Space, getVersion } from '@dxos/react-client/echo';
|
|
17
|
-
import { DataType } from '@dxos/schema';
|
|
18
|
-
|
|
19
|
-
import type { ChatServices } from './useChatServices';
|
|
20
|
-
|
|
21
|
-
// TODO(burdon): Factor out.
|
|
22
|
-
declare global {
|
|
23
|
-
interface ToolContextExtensions {
|
|
24
|
-
space?: Space;
|
|
25
|
-
dispatch?: PromiseIntentDispatcher;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
type RequestOptions = {
|
|
30
|
-
// Empty for now.
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type ChatProcessorOptions = {
|
|
34
|
-
// TODO(burdon): Change to AiToolkit.
|
|
35
|
-
tools?: readonly ExecutableTool[];
|
|
36
|
-
blueprintRegistry?: Blueprint.Registry;
|
|
37
|
-
|
|
38
|
-
// TODO(dmaretskyi): Remove.
|
|
39
|
-
artifacts?: readonly ArtifactDefinition[];
|
|
40
|
-
extensions?: ToolContextExtensions;
|
|
41
|
-
// TODO(burdon): Remove systemPrompt -- should come from blueprint.
|
|
42
|
-
} & Pick<GenerateRequest, 'model' | 'systemPrompt'>;
|
|
43
|
-
|
|
44
|
-
const defaultOptions: Partial<ChatProcessorOptions> = {
|
|
45
|
-
model: DEFAULT_EDGE_MODEL,
|
|
46
|
-
systemPrompt: 'you are a helpful assistant',
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Handles interactions with the AI service.
|
|
51
|
-
* Maintains a queue of messages and handles streaming responses from the AI service.
|
|
52
|
-
* Executes tools based on AI responses.
|
|
53
|
-
* Supports cancellation of in-progress requests.
|
|
54
|
-
*/
|
|
55
|
-
// TODO(burdon): Rename ChatContext?
|
|
56
|
-
export class ChatProcessor {
|
|
57
|
-
/**
|
|
58
|
-
* Pending messages (incl. the current user request).
|
|
59
|
-
* @reactive
|
|
60
|
-
*/
|
|
61
|
-
private readonly _pending: Signal<DataType.Message[]> = signal([]);
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Current streaming message (from the AI service).
|
|
65
|
-
* @reactive
|
|
66
|
-
*/
|
|
67
|
-
private readonly _streaming: Signal<DataType.Message | undefined> = signal(undefined);
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Streaming state.
|
|
71
|
-
* @reactive
|
|
72
|
-
*/
|
|
73
|
-
public readonly streaming: Signal<boolean> = computed(() => this._streaming.value !== undefined);
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Last error.
|
|
77
|
-
* @reactive
|
|
78
|
-
*/
|
|
79
|
-
public readonly error: Signal<Error | undefined> = signal(undefined);
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Array of Messages (incl. the current message being streamed).
|
|
83
|
-
* @reactive
|
|
84
|
-
*/
|
|
85
|
-
public readonly messages: Signal<DataType.Message[]> = computed(() => {
|
|
86
|
-
const messages = [...this._pending.value];
|
|
87
|
-
if (this._streaming.value) {
|
|
88
|
-
// TODO(dmaretskyi): Replace with Obj.clone.
|
|
89
|
-
// NOTE: We have to clone the message here so that react will re-render.
|
|
90
|
-
messages.push(Obj.make(DataType.Message, this._streaming.value));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return messages;
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
// TODO(burdon): Replace with Toolkit.
|
|
97
|
-
private _tools?: ExecutableTool[];
|
|
98
|
-
|
|
99
|
-
/** Current session. */
|
|
100
|
-
private _session: AiSession | undefined = undefined;
|
|
101
|
-
|
|
102
|
-
constructor(
|
|
103
|
-
// TODO(dmaretskyi): Replace this with effect's ManagedRuntime wrapping this layer.
|
|
104
|
-
private readonly _services: Layer.Layer<ChatServices>,
|
|
105
|
-
private readonly _conversation: Conversation,
|
|
106
|
-
private readonly _options: ChatProcessorOptions = defaultOptions,
|
|
107
|
-
) {
|
|
108
|
-
this._tools = [...(_options.tools ?? [])];
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
get conversation() {
|
|
112
|
-
return this._conversation;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
get context(): ContextBinder {
|
|
116
|
-
return this._conversation.context;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
get blueprintRegistry() {
|
|
120
|
-
return this._options.blueprintRegistry;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
get tools() {
|
|
124
|
-
return this._tools;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* @deprecated Replace with blueprints
|
|
129
|
-
*/
|
|
130
|
-
setTools(tools: ExecutableTool[]): void {
|
|
131
|
-
this._tools = tools;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Make GPT request.
|
|
136
|
-
*/
|
|
137
|
-
async request(message: string, options: RequestOptions = {}): Promise<DataType.Message[]> {
|
|
138
|
-
await using ctx = Context.default(); // Auto-disposed at the end of this block.
|
|
139
|
-
|
|
140
|
-
this._conversation.onBegin.on(ctx, (session) => {
|
|
141
|
-
log.info('onBegin', { session, isDisposed: ctx.disposed });
|
|
142
|
-
|
|
143
|
-
this._session = session;
|
|
144
|
-
ctx.onDispose(() => {
|
|
145
|
-
log.info('onDispose', { session, isDisposed: ctx.disposed });
|
|
146
|
-
if (this._session === session) {
|
|
147
|
-
this._session = undefined;
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
// User message.
|
|
152
|
-
session.userMessage.on((message) => {
|
|
153
|
-
log.info('userMessage', { message });
|
|
154
|
-
this._pending.value = [...this._pending.value, message];
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
// Message complete.
|
|
158
|
-
session.message.on((message) => {
|
|
159
|
-
batch(() => {
|
|
160
|
-
this._pending.value = [...this._pending.value, message];
|
|
161
|
-
this._streaming.value = undefined;
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
// Streaming update (happens before message complete).
|
|
166
|
-
session.update.on((block) => {
|
|
167
|
-
batch(() => {
|
|
168
|
-
if (!this._streaming.value) {
|
|
169
|
-
// TODO(burdon): Hack to create temp message; better for session to send initial partial object?
|
|
170
|
-
this._streaming.value = Obj.make(DataType.Message, {
|
|
171
|
-
created: new Date().toISOString(),
|
|
172
|
-
sender: { role: 'assistant' },
|
|
173
|
-
blocks: [block],
|
|
174
|
-
});
|
|
175
|
-
} else if (this._streaming.value.blocks.at(-1)?.pending === true) {
|
|
176
|
-
this._streaming.value.blocks[this._streaming.value.blocks.length - 1] = block;
|
|
177
|
-
} else {
|
|
178
|
-
this._streaming.value.blocks.push(block);
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
session.block.on((block) => {
|
|
184
|
-
if (!this._streaming.value) {
|
|
185
|
-
// TODO(burdon): Hack to create temp message; better for session to send initial partial object?
|
|
186
|
-
this._streaming.value = Obj.make(DataType.Message, {
|
|
187
|
-
created: new Date().toISOString(),
|
|
188
|
-
sender: { role: 'assistant' },
|
|
189
|
-
blocks: [block],
|
|
190
|
-
});
|
|
191
|
-
} else if (this._streaming.value.blocks.at(-1)?.pending === true) {
|
|
192
|
-
this._streaming.value.blocks[this._streaming.value.blocks.length - 1] = block;
|
|
193
|
-
} else {
|
|
194
|
-
this._streaming.value.blocks.push(block);
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
// TODO(dmaretskyi): Handle tool status reports.
|
|
199
|
-
// session.toolStatusReport.on(({ message, status }) => {
|
|
200
|
-
// const msg = this._pending.peek().find((m) => m.id === message.id);
|
|
201
|
-
// const toolUse = msg?.content.find((block) => block.type === 'tool_use');
|
|
202
|
-
// if (!toolUse) {
|
|
203
|
-
// return;
|
|
204
|
-
// }
|
|
205
|
-
|
|
206
|
-
// const block = msg?.content.find(
|
|
207
|
-
// (block): block is ToolUseContentBlock => block.type === 'tool_use' && block.id === toolUse.id,
|
|
208
|
-
// );
|
|
209
|
-
// if (block) {
|
|
210
|
-
// this._pending.value = this._pending.value.map((m) => {
|
|
211
|
-
// if (m.id === message.id) {
|
|
212
|
-
// return {
|
|
213
|
-
// ...m,
|
|
214
|
-
// content: m.content.map((block) =>
|
|
215
|
-
// block.type === 'tool_use' && block.id === toolUse.id ? { ...block, currentStatus: status } : block,
|
|
216
|
-
// ),
|
|
217
|
-
// };
|
|
218
|
-
// }
|
|
219
|
-
|
|
220
|
-
// return m;
|
|
221
|
-
// });
|
|
222
|
-
// } else {
|
|
223
|
-
// log.warn('no block for status report');
|
|
224
|
-
// }
|
|
225
|
-
// });
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
try {
|
|
229
|
-
const messages = await runAndForwardErrors(
|
|
230
|
-
this._conversation
|
|
231
|
-
.run({
|
|
232
|
-
prompt: message,
|
|
233
|
-
// TODO(burdon): Construct from blueprints?
|
|
234
|
-
systemPrompt: this._options.systemPrompt,
|
|
235
|
-
})
|
|
236
|
-
.pipe(
|
|
237
|
-
//
|
|
238
|
-
Effect.provide(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL)),
|
|
239
|
-
// TODO(dmaretskyi): Move ArtifactDiffResolver upstream.
|
|
240
|
-
Effect.provideService(ArtifactDiffResolver, this._artifactDiffResolver),
|
|
241
|
-
Effect.provide(this._services),
|
|
242
|
-
Effect.tapErrorCause((cause) => {
|
|
243
|
-
log.error('error', { cause });
|
|
244
|
-
return Effect.void;
|
|
245
|
-
}),
|
|
246
|
-
),
|
|
247
|
-
);
|
|
248
|
-
|
|
249
|
-
log('completed', { messages });
|
|
250
|
-
} catch (err) {
|
|
251
|
-
log.catch(err);
|
|
252
|
-
if (err instanceof Error && err.message.includes('Overloaded')) {
|
|
253
|
-
this.error.value = new AiServiceOverloadedError('AI service overloaded', { cause: err });
|
|
254
|
-
} else {
|
|
255
|
-
this.error.value = new Error('AI service error', { cause: err });
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return this._reset();
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Cancel pending requests.
|
|
264
|
-
* @returns Pending requests (incl. the request message).
|
|
265
|
-
*/
|
|
266
|
-
async cancel(): Promise<DataType.Message[]> {
|
|
267
|
-
log.info('cancelling...');
|
|
268
|
-
|
|
269
|
-
// TODO(dmaretskyi): Conversation should handle aborting.
|
|
270
|
-
this._session?.abort();
|
|
271
|
-
return this._reset();
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
private async _reset(): Promise<DataType.Message[]> {
|
|
275
|
-
const messages = this._pending.value;
|
|
276
|
-
batch(() => {
|
|
277
|
-
this._pending.value = [];
|
|
278
|
-
this._streaming.value = undefined;
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
return messages;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
private _artifactDiffResolver: ArtifactDiffResolver.Service = {
|
|
285
|
-
resolve: async (artifacts) => {
|
|
286
|
-
const space = this._options.extensions?.space;
|
|
287
|
-
if (!space) {
|
|
288
|
-
return new Map();
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
const versions = new Map();
|
|
292
|
-
await Promise.all(
|
|
293
|
-
artifacts.map(async (artifact) => {
|
|
294
|
-
const {
|
|
295
|
-
objects: [object],
|
|
296
|
-
} = await space.db.query(Filter.ids(artifact.id)).run();
|
|
297
|
-
if (!object) {
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
versions.set(artifact.id, {
|
|
301
|
-
version: getVersion(object),
|
|
302
|
-
diff: `Current state: ${JSON.stringify(object)}`,
|
|
303
|
-
});
|
|
304
|
-
}),
|
|
305
|
-
);
|
|
306
|
-
return versions;
|
|
307
|
-
},
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// TODO(wittjosiah): Move to ai-service-client.
|
|
312
|
-
export class AiServiceOverloadedError extends Error {
|
|
313
|
-
code = 'AI_SERVICE_OVERLOADED';
|
|
314
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { effect } from '@preact/signals-react';
|
|
6
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
7
|
-
|
|
8
|
-
import { type ContextBinder } from '@dxos/assistant';
|
|
9
|
-
import { Blueprint } from '@dxos/blueprints';
|
|
10
|
-
import { type Space } from '@dxos/client/echo';
|
|
11
|
-
import { Obj, Ref } from '@dxos/echo';
|
|
12
|
-
import { log } from '@dxos/log';
|
|
13
|
-
import { isNonNullable } from '@dxos/util';
|
|
14
|
-
|
|
15
|
-
export type UpdateCallback = (key: string, active: boolean) => void;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Get collection of active blueprints based on the context.
|
|
19
|
-
*/
|
|
20
|
-
export const useBlueprints = (
|
|
21
|
-
space: Space,
|
|
22
|
-
context: ContextBinder,
|
|
23
|
-
blueprintRegistry?: Blueprint.Registry,
|
|
24
|
-
): [Blueprint.Blueprint[], UpdateCallback] => {
|
|
25
|
-
const [blueprints, setBlueprints] = useState<Blueprint.Blueprint[]>([]);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
let t: NodeJS.Timeout;
|
|
28
|
-
effect(() => {
|
|
29
|
-
const refs = [...(context.blueprints.value ?? [])];
|
|
30
|
-
t = setTimeout(async () => {
|
|
31
|
-
const blueprints = (await Ref.Array.loadAll(refs)).filter(isNonNullable);
|
|
32
|
-
setBlueprints(blueprints);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
return () => clearTimeout(t);
|
|
37
|
-
}, [context]);
|
|
38
|
-
|
|
39
|
-
const handleUpdate = useCallback<UpdateCallback>(
|
|
40
|
-
(key: string, active: boolean) => {
|
|
41
|
-
log.info('update', { key, active });
|
|
42
|
-
if (active) {
|
|
43
|
-
// TODO(burdon): Check if already in space.
|
|
44
|
-
const blueprint = blueprintRegistry?.getByKey(key);
|
|
45
|
-
if (blueprint) {
|
|
46
|
-
// TODO(dmaretskyi): This should be done by Obj.clone.
|
|
47
|
-
const { id: _id, ...data } = blueprint;
|
|
48
|
-
const obj = space.db.add(Obj.make(Blueprint.Blueprint, data));
|
|
49
|
-
void context.bind({ blueprints: [Ref.make(obj)] });
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
[space, context],
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
return [blueprints, handleUpdate] as const;
|
|
57
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { describe, test } from 'vitest';
|
|
6
|
-
|
|
7
|
-
import { Filter } from '@dxos/echo';
|
|
8
|
-
|
|
9
|
-
import { createFilter } from './filter-generator';
|
|
10
|
-
import { QueryParser } from './query-parser';
|
|
11
|
-
|
|
12
|
-
describe('FilterGenerator', () => {
|
|
13
|
-
test('simple queries', ({ expect }) => {
|
|
14
|
-
const parser = new QueryParser('type:example.com/type/Person');
|
|
15
|
-
const ast = parser.parse();
|
|
16
|
-
expect(ast).toEqual({
|
|
17
|
-
type: 'binary',
|
|
18
|
-
operator: 'EQ',
|
|
19
|
-
left: {
|
|
20
|
-
type: 'identifier',
|
|
21
|
-
name: 'type',
|
|
22
|
-
},
|
|
23
|
-
right: {
|
|
24
|
-
type: 'literal',
|
|
25
|
-
value: 'example.com/type/Person',
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const filter = createFilter(ast);
|
|
30
|
-
expect(filter).toEqual(Filter.typename('example.com/type/Person'));
|
|
31
|
-
});
|
|
32
|
-
});
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Filter } from '@dxos/echo';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
type BinaryExpression,
|
|
9
|
-
type Expression,
|
|
10
|
-
type Identifier,
|
|
11
|
-
type Literal,
|
|
12
|
-
type RelationalOperator,
|
|
13
|
-
type UnaryExpression,
|
|
14
|
-
} from './types';
|
|
15
|
-
|
|
16
|
-
const relationalOperators: Record<RelationalOperator, (value: any) => Filter<any>> = {
|
|
17
|
-
EQ: Filter.eq,
|
|
18
|
-
LT: Filter.lt,
|
|
19
|
-
GT: Filter.gt,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const specialPredicates: Record<string, (value: string) => Filter<any>> = {
|
|
23
|
-
['type' as const]: Filter.typename,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const createFilter = (ast: Expression): Filter<any> => {
|
|
27
|
-
switch (ast.type) {
|
|
28
|
-
case 'binary': {
|
|
29
|
-
const { operator, left, right } = ast as BinaryExpression;
|
|
30
|
-
|
|
31
|
-
// Handle logical operators.
|
|
32
|
-
if (operator === 'AND') {
|
|
33
|
-
return Filter.and(createFilter(left), createFilter(right));
|
|
34
|
-
}
|
|
35
|
-
if (operator === 'OR') {
|
|
36
|
-
return Filter.or(createFilter(left), createFilter(right));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Handle special predicates (e.g., "type:Person")
|
|
40
|
-
const predicateName = (left as Identifier).name;
|
|
41
|
-
const specialFilter = specialPredicates[predicateName];
|
|
42
|
-
if (specialFilter) {
|
|
43
|
-
return specialFilter((right as Literal).value);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Handle relational operators
|
|
47
|
-
const filterFn = relationalOperators[operator as RelationalOperator];
|
|
48
|
-
if (filterFn) {
|
|
49
|
-
return filterFn((right as Literal).value);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
throw new Error(`Unsupported operator: ${operator}`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
case 'unary': {
|
|
56
|
-
const { operator, argument } = ast as UnaryExpression;
|
|
57
|
-
if (operator === 'NOT') {
|
|
58
|
-
return Filter.not(createFilter(argument));
|
|
59
|
-
}
|
|
60
|
-
throw new Error(`Unsupported unary operator: ${operator}`);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
case 'identifier': {
|
|
64
|
-
const { name } = ast as Identifier;
|
|
65
|
-
return Filter._props({ [name]: true });
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
case 'literal': {
|
|
69
|
-
const { value } = ast as Literal;
|
|
70
|
-
// Handle special '*' value for empty input.
|
|
71
|
-
if (value === '*') {
|
|
72
|
-
return Filter.everything();
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return Filter.eq(value);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
default:
|
|
79
|
-
throw new Error(`Unsupported expression type: ${(ast as any).type}`);
|
|
80
|
-
}
|
|
81
|
-
};
|