@dxos/plugin-assistant 0.8.4-main.28f8d3d → 0.8.4-main.406dc2a
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/{BlueprintContainer-H7H4BQ2C.mjs → BlueprintContainer-WX2SSDVI.mjs} +6 -7
- package/dist/lib/browser/{BlueprintContainer-H7H4BQ2C.mjs.map → BlueprintContainer-WX2SSDVI.mjs.map} +3 -3
- package/dist/lib/browser/ChatCompanion-BDZ55ZRF.mjs +150 -0
- package/dist/lib/browser/ChatCompanion-BDZ55ZRF.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-OUVSX5V5.mjs → ChatContainer-RYGNN73X.mjs} +20 -23
- package/dist/lib/browser/ChatContainer-RYGNN73X.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-P4FLEOHG.mjs → ChatDialog-MVHH2U66.mjs} +12 -12
- package/dist/lib/browser/ChatDialog-MVHH2U66.mjs.map +7 -0
- package/dist/lib/browser/{SequenceContainer-627OQ557.mjs → SequenceContainer-2FEWMQGW.mjs} +6 -19
- package/dist/lib/browser/SequenceContainer-2FEWMQGW.mjs.map +7 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs +19 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-AVHHQ3KV.mjs → app-graph-builder-2U7SLCRX.mjs} +22 -34
- package/dist/lib/browser/app-graph-builder-2U7SLCRX.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-NSJARW5U.mjs +12 -0
- package/dist/lib/browser/blueprint-definition-NSJARW5U.mjs.map +7 -0
- package/dist/lib/browser/{blueprint-definition-CMGIZAOW.mjs → chunk-2CE2KPKZ.mjs} +69 -40
- package/dist/lib/browser/chunk-2CE2KPKZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-43I2LR6O.mjs +216 -0
- package/dist/lib/browser/chunk-43I2LR6O.mjs.map +7 -0
- package/dist/lib/browser/chunk-5EGXHCAZ.mjs +16 -0
- package/dist/lib/browser/chunk-5EGXHCAZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-5RICKAMN.mjs +18 -0
- package/dist/lib/browser/chunk-5RICKAMN.mjs.map +7 -0
- package/dist/lib/browser/chunk-CQ7UHYTT.mjs +296 -0
- package/dist/lib/browser/chunk-CQ7UHYTT.mjs.map +7 -0
- package/dist/lib/browser/{chunk-HRLMD35M.mjs → chunk-FP56WB24.mjs} +36 -15
- package/dist/lib/browser/chunk-FP56WB24.mjs.map +7 -0
- package/dist/lib/browser/chunk-JZRZVB2A.mjs +170 -0
- package/dist/lib/browser/chunk-JZRZVB2A.mjs.map +7 -0
- package/dist/lib/browser/chunk-WRJGOT5P.mjs +1794 -0
- package/dist/lib/browser/chunk-WRJGOT5P.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs +18 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +127 -54
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-MVOIEJXZ.mjs → intent-resolver-3GOJMBXJ.mjs} +48 -15
- package/dist/lib/browser/intent-resolver-3GOJMBXJ.mjs.map +7 -0
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs +17 -0
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-4HXS3YLT.mjs → react-surface-FTKCE6GG.mjs} +20 -76
- package/dist/lib/browser/react-surface-FTKCE6GG.mjs.map +7 -0
- package/dist/lib/browser/{settings-G2EZXMWT.mjs → settings-HBF32KV6.mjs} +5 -5
- package/dist/lib/browser/{settings-G2EZXMWT.mjs.map → settings-HBF32KV6.mjs.map} +1 -1
- package/dist/lib/browser/state-LXTS54DI.mjs +21 -0
- package/dist/lib/browser/state-LXTS54DI.mjs.map +7 -0
- package/dist/lib/browser/toolkit-NQ2GXCF5.mjs +199 -0
- package/dist/lib/browser/toolkit-NQ2GXCF5.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/{BlueprintContainer-VH4EE4CM.mjs → BlueprintContainer-4MKN6ZRB.mjs} +6 -7
- package/dist/lib/node-esm/{BlueprintContainer-VH4EE4CM.mjs.map → BlueprintContainer-4MKN6ZRB.mjs.map} +3 -3
- package/dist/lib/node-esm/ChatCompanion-XFNXVZIP.mjs +151 -0
- package/dist/lib/node-esm/ChatCompanion-XFNXVZIP.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-D5FABDNE.mjs → ChatContainer-UTJGCQXF.mjs} +20 -23
- package/dist/lib/node-esm/ChatContainer-UTJGCQXF.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-NKWVXHJP.mjs → ChatDialog-QEYZ4IOV.mjs} +12 -12
- package/dist/lib/node-esm/ChatDialog-QEYZ4IOV.mjs.map +7 -0
- package/dist/lib/node-esm/{SequenceContainer-EQ5NP2PG.mjs → SequenceContainer-PGGJUQ46.mjs} +6 -19
- package/dist/lib/node-esm/SequenceContainer-PGGJUQ46.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs +20 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-RMOUJMMG.mjs → app-graph-builder-OKNLR7H2.mjs} +22 -34
- package/dist/lib/node-esm/app-graph-builder-OKNLR7H2.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-WD2IVMAI.mjs +13 -0
- package/dist/lib/node-esm/blueprint-definition-WD2IVMAI.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-73ABYRYX.mjs +20 -0
- package/dist/lib/node-esm/chunk-73ABYRYX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DSE2IILK.mjs +217 -0
- package/dist/lib/node-esm/chunk-DSE2IILK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-E2WXZND7.mjs +297 -0
- package/dist/lib/node-esm/chunk-E2WXZND7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HXIBCBH4.mjs +171 -0
- package/dist/lib/node-esm/chunk-HXIBCBH4.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-F7RXCX5Y.mjs → chunk-TNR46C3L.mjs} +36 -15
- package/dist/lib/node-esm/chunk-TNR46C3L.mjs.map +7 -0
- package/dist/lib/node-esm/{blueprint-definition-AEWYMW6I.mjs → chunk-U2NYUS2N.mjs} +69 -39
- package/dist/lib/node-esm/chunk-U2NYUS2N.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UFKLCEAE.mjs +1795 -0
- package/dist/lib/node-esm/chunk-UFKLCEAE.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-X6AANUHZ.mjs → chunk-XQGWSZ4T.mjs} +4 -4
- package/dist/lib/node-esm/chunk-XQGWSZ4T.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs +19 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +127 -54
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-DTDNCX3C.mjs → intent-resolver-6XLVTRDJ.mjs} +48 -15
- package/dist/lib/node-esm/intent-resolver-6XLVTRDJ.mjs.map +7 -0
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs +18 -0
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-V6JNEZVO.mjs → react-surface-K7ZXQLAP.mjs} +20 -76
- package/dist/lib/node-esm/react-surface-K7ZXQLAP.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-AIP5FOJG.mjs → settings-CWP6MTWP.mjs} +5 -5
- package/dist/lib/node-esm/{settings-AIP5FOJG.mjs.map → settings-CWP6MTWP.mjs.map} +1 -1
- package/dist/lib/node-esm/state-BO6GUFLB.mjs +22 -0
- package/dist/lib/node-esm/state-BO6GUFLB.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-V57PRJNG.mjs +200 -0
- package/dist/lib/node-esm/toolkit-V57PRJNG.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/AssistantPlugin.d.ts +1 -1
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts +2 -3
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +8 -8
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +2 -3
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +7 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +10 -0
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/capabilities/state.d.ts +4 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit.d.ts +2 -3
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +16 -10
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +5 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts +13 -0
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +3 -4
- package/dist/types/src/components/ChatContainer.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 +11 -4
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +3 -4
- 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/ChatThread/ChatThread.d.ts +12 -7
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +112 -56
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/reducers.d.ts +40 -0
- package/dist/types/src/components/ChatThread/reducers.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 +36 -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/PromptSettings.d.ts.map +1 -1
- package/dist/types/src/components/SequenceContainer.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +264 -3
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +0 -5
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +262 -7
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +259 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts +12 -0
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +19 -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/Toolbar/Toolbar.d.ts +5 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/index.d.ts +2 -0
- package/dist/types/src/components/Toolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +11 -0
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +1 -3
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +263 -5
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/functions/analysis.d.ts.map +1 -1
- package/dist/types/src/functions/list.d.ts.map +1 -1
- package/dist/types/src/functions/load.d.ts +1 -1
- package/dist/types/src/functions/load.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +4 -4
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +5 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +4 -10
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +5 -5
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- 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/useFlush.d.ts.map +1 -0
- package/dist/types/src/hooks/useItemTypes.d.ts +4 -0
- package/dist/types/src/hooks/useItemTypes.d.ts.map +1 -0
- package/dist/types/src/hooks/usePresets.d.ts +2 -2
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +3 -0
- package/dist/types/src/processor/index.d.ts.map +1 -0
- package/dist/types/src/{hooks → processor}/presets.d.ts +1 -1
- package/dist/types/src/processor/presets.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +74 -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/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 +7 -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 +27 -16
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +16 -5
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantAction.d.ts +23 -6
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +21 -18
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +90 -96
- package/src/AssistantPlugin.tsx +138 -116
- package/src/capabilities/ai-service.ts +6 -7
- package/src/capabilities/app-graph-builder.ts +39 -45
- package/src/capabilities/blueprint-definition.ts +51 -19
- package/src/capabilities/capabilities.ts +8 -12
- package/src/capabilities/edge-model-resolver.ts +17 -21
- package/src/capabilities/index.ts +5 -2
- package/src/capabilities/intent-resolver.ts +38 -15
- package/src/capabilities/local-model-resolver.ts +30 -0
- package/src/capabilities/react-surface.tsx +9 -63
- package/src/capabilities/state.ts +20 -0
- package/src/capabilities/toolkit.ts +93 -31
- package/src/components/AssistantSettings/AssistantSettings.tsx +82 -75
- package/src/components/BlueprintContainer.tsx +2 -2
- package/src/components/Chat/Chat.tsx +167 -172
- package/src/components/Chat/events.ts +7 -0
- package/src/components/ChatCompanion.tsx +136 -0
- package/src/components/ChatContainer.tsx +13 -31
- package/src/components/ChatDialog.tsx +11 -11
- package/src/components/ChatProgress/ChatProgress.tsx +67 -0
- package/src/components/ChatProgress/index.ts +5 -0
- package/src/components/ChatPrompt/ChatActions.tsx +10 -24
- package/src/components/ChatPrompt/ChatOptions.tsx +200 -34
- package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +29 -36
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
- package/src/components/ChatThread/ChatThread.stories.tsx +74 -205
- package/src/components/ChatThread/ChatThread.tsx +69 -29
- package/src/components/ChatThread/Link.tsx +8 -21
- package/src/components/ChatThread/reducers.ts +151 -0
- package/src/components/ChatThread/registry.tsx +184 -0
- package/src/components/ChatThread/sync.test.ts +81 -0
- package/src/components/ChatThread/sync.ts +113 -0
- package/src/components/PromptSettings.tsx +1 -0
- package/src/components/SequenceContainer.tsx +27 -29
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +8 -6
- package/src/components/SequenceEditor/SequenceEditor.tsx +2 -2
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +17 -13
- package/src/components/TemplateEditor/TemplateEditor.tsx +16 -50
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +6 -8
- package/src/components/TemplateEditor/TemplateForm.tsx +2 -1
- package/src/components/TemplateEditor/handlebars-extension.ts +165 -0
- package/src/components/ToolBlock/ToolBlock.tsx +152 -0
- package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
- package/src/components/ToolBlock/index.ts +6 -0
- package/src/components/Toolbar/Toolbar.tsx +21 -0
- package/src/components/{Timeline → Toolbar}/index.ts +1 -1
- package/src/components/Toolbar/useChatToolbarActions.ts +126 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +9 -12
- package/src/components/Toolbox/Toolbox.tsx +10 -16
- package/src/components/index.ts +3 -1
- package/src/functions/analysis.ts +6 -4
- package/src/functions/list.ts +9 -3
- package/src/functions/load.ts +8 -5
- package/src/hooks/index.ts +4 -5
- package/src/hooks/useBlueprintRegistry.ts +24 -9
- package/src/hooks/useChatProcessor.ts +19 -26
- package/src/hooks/useChatServices.ts +30 -53
- package/src/hooks/useContextBinder.ts +30 -0
- package/src/hooks/useContextObjects.ts +58 -0
- package/src/hooks/useItemTypes.ts +37 -0
- package/src/hooks/usePresets.ts +4 -5
- package/src/index.ts +2 -0
- package/src/meta.ts +4 -6
- package/src/processor/index.ts +6 -0
- package/src/{hooks → processor}/presets.ts +10 -3
- package/src/processor/processor.test.ts +81 -0
- package/src/processor/processor.ts +302 -0
- package/src/queue-logger.ts +5 -5
- package/src/testing/index.ts +1 -1
- package/src/testing/test-generator.ts +261 -0
- package/src/testing/test-sequence.ts +1 -26
- package/src/testing/test-services.ts +2 -8
- package/src/translations.ts +29 -17
- package/src/types/Assistant.ts +9 -4
- package/src/types/AssistantAction.ts +11 -3
- package/src/types/service.ts +15 -7
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/ChatContainer-OUVSX5V5.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-P4FLEOHG.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-627OQ557.mjs.map +0 -7
- package/dist/lib/browser/ai-service-7KJ5LXBT.mjs +0 -22
- package/dist/lib/browser/ai-service-7KJ5LXBT.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-AVHHQ3KV.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs.map +0 -7
- package/dist/lib/browser/chunk-BRLHDHOF.mjs +0 -244
- package/dist/lib/browser/chunk-BRLHDHOF.mjs.map +0 -7
- package/dist/lib/browser/chunk-HRLMD35M.mjs.map +0 -7
- package/dist/lib/browser/chunk-LKP65RPA.mjs +0 -20
- package/dist/lib/browser/chunk-LKP65RPA.mjs.map +0 -7
- package/dist/lib/browser/chunk-NZDCKQ6W.mjs +0 -89
- package/dist/lib/browser/chunk-NZDCKQ6W.mjs.map +0 -7
- package/dist/lib/browser/chunk-QB7OVS6Z.mjs +0 -16
- package/dist/lib/browser/chunk-QB7OVS6Z.mjs.map +0 -7
- package/dist/lib/browser/chunk-VEBVAHNM.mjs +0 -2231
- package/dist/lib/browser/chunk-VEBVAHNM.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs +0 -24
- package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-MVOIEJXZ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-4HXS3YLT.mjs.map +0 -7
- package/dist/lib/browser/toolkit-IW4FBLLB.mjs +0 -105
- package/dist/lib/browser/toolkit-IW4FBLLB.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-D5FABDNE.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-NKWVXHJP.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-LDD32477.mjs +0 -23
- package/dist/lib/node-esm/ai-service-LDD32477.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-RMOUJMMG.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3SOC5GOP.mjs +0 -2232
- package/dist/lib/node-esm/chunk-3SOC5GOP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F7RXCX5Y.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GAWXJ7K5.mjs +0 -90
- package/dist/lib/node-esm/chunk-GAWXJ7K5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KOC6ESG7.mjs +0 -22
- package/dist/lib/node-esm/chunk-KOC6ESG7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RD755HN3.mjs +0 -245
- package/dist/lib/node-esm/chunk-RD755HN3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-X6AANUHZ.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs +0 -25
- package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-DTDNCX3C.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-V6JNEZVO.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-2VNUL77B.mjs +0 -106
- package/dist/lib/node-esm/toolkit-2VNUL77B.mjs.map +0 -7
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -18
- 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/Timeline/Timeline.d.ts +0 -24
- package/dist/types/src/components/Timeline/Timeline.d.ts.map +0 -1
- package/dist/types/src/components/Timeline/Timeline.stories.d.ts +0 -9
- package/dist/types/src/components/Timeline/Timeline.stories.d.ts.map +0 -1
- package/dist/types/src/components/Timeline/index.d.ts +0 -2
- package/dist/types/src/components/Timeline/index.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.d.ts +0 -72
- package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
- package/dist/types/src/hooks/errors.d.ts +0 -4
- package/dist/types/src/hooks/errors.d.ts.map +0 -1
- package/dist/types/src/hooks/presets.d.ts.map +0 -1
- package/dist/types/src/hooks/useResolveRef.d.ts +0 -4
- package/dist/types/src/hooks/useResolveRef.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 -268
- package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/stories/components/BlueprintContainer.d.ts +0 -5
- package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/ChatContainer.d.ts +0 -5
- package/dist/types/src/stories/components/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/GraphContainer.d.ts +0 -6
- package/dist/types/src/stories/components/GraphContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/LoggingContainer.d.ts +0 -5
- package/dist/types/src/stories/components/LoggingContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/SurfaceContainer.d.ts +0 -8
- package/dist/types/src/stories/components/SurfaceContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/TasksContainer.d.ts +0 -5
- package/dist/types/src/stories/components/TasksContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/index.d.ts +0 -8
- package/dist/types/src/stories/components/index.d.ts.map +0 -1
- package/dist/types/src/stories/components/types.d.ts +0 -7
- package/dist/types/src/stories/components/types.d.ts.map +0 -1
- package/dist/types/src/stories/hooks/index.d.ts +0 -3
- package/dist/types/src/stories/hooks/index.d.ts.map +0 -1
- package/dist/types/src/stories/hooks/useFlush.d.ts.map +0 -1
- package/dist/types/src/stories/hooks/useMatcherExtension.d.ts +0 -3
- package/dist/types/src/stories/hooks/useMatcherExtension.d.ts.map +0 -1
- package/dist/types/src/stories/testing/data.d.ts +0 -142
- package/dist/types/src/stories/testing/data.d.ts.map +0 -1
- package/dist/types/src/stories/testing/index.d.ts +0 -3
- package/dist/types/src/stories/testing/index.d.ts.map +0 -1
- package/dist/types/src/stories/testing/testing.d.ts +0 -26
- package/dist/types/src/stories/testing/testing.d.ts.map +0 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -6
- 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/src/components/ChatThread/ChatMessage.tsx +0 -282
- package/src/components/ChatThread/ToolBlock.tsx +0 -125
- package/src/components/ChatThread/reducer.ts +0 -52
- package/src/components/Timeline/Timeline.stories.tsx +0 -53
- package/src/components/Timeline/Timeline.tsx +0 -159
- package/src/hooks/chat-processor.ts +0 -260
- package/src/hooks/errors.ts +0 -8
- package/src/hooks/useResolveRef.ts +0 -33
- package/src/parser/filter-generator.test.ts +0 -32
- package/src/parser/filter-generator.ts +0 -74
- 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 -317
- package/src/stories/components/BlueprintContainer.tsx +0 -34
- package/src/stories/components/ChatContainer.tsx +0 -80
- package/src/stories/components/GraphContainer.tsx +0 -118
- package/src/stories/components/LoggingContainer.tsx +0 -22
- package/src/stories/components/SurfaceContainer.tsx +0 -62
- package/src/stories/components/TasksContainer.tsx +0 -51
- package/src/stories/components/index.ts +0 -12
- package/src/stories/components/types.ts +0 -11
- package/src/stories/hooks/index.ts +0 -6
- package/src/stories/hooks/useMatcherExtension.ts +0 -45
- package/src/stories/testing/data.ts +0 -130
- package/src/stories/testing/index.ts +0 -6
- package/src/stories/testing/testing.tsx +0 -162
- package/src/testing/test-functions.ts +0 -16
- package/src/tools/function.ts +0 -49
- package/src/tools/index.ts +0 -6
- package/src/tools/openapi.test.ts +0 -219
- package/src/tools/openapi.ts +0 -341
- package/src/typings.d.ts +0 -9
- /package/dist/types/src/{stories/hooks → hooks}/useFlush.d.ts +0 -0
- /package/src/{stories/hooks → hooks}/useFlush.ts +0 -0
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { describe, test } from 'vitest';
|
|
6
|
-
|
|
7
|
-
import { QueryParser } from './query-parser';
|
|
8
|
-
|
|
9
|
-
describe('QueryParser', () => {
|
|
10
|
-
test('empty', ({ expect }) => {
|
|
11
|
-
const parser = new QueryParser('');
|
|
12
|
-
expect(parser.parse()).toEqual({
|
|
13
|
-
type: 'literal',
|
|
14
|
-
value: '*',
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
test('invalid queries', ({ expect }) => {
|
|
19
|
-
const cases = [
|
|
20
|
-
//
|
|
21
|
-
'!',
|
|
22
|
-
'X:',
|
|
23
|
-
':Y',
|
|
24
|
-
'X;Y',
|
|
25
|
-
'x==100',
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
for (const query of cases) {
|
|
29
|
-
const parser = new QueryParser(query);
|
|
30
|
-
expect(() => parser.parse()).toThrow();
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test('valid queries', ({ expect }) => {
|
|
35
|
-
const cases = [
|
|
36
|
-
//
|
|
37
|
-
'',
|
|
38
|
-
'type:Person',
|
|
39
|
-
'$title = "foo"',
|
|
40
|
-
'(type:Person OR type:Organization) AND $title = "DXOS" AND $ts < TODAY',
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
for (const query of cases) {
|
|
44
|
-
const parser = new QueryParser(query);
|
|
45
|
-
expect(parser.parse()).to.exist;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
test('simple queries', ({ expect }) => {
|
|
50
|
-
const cases = [
|
|
51
|
-
{
|
|
52
|
-
query: 'type:Person',
|
|
53
|
-
ast: {
|
|
54
|
-
type: 'binary',
|
|
55
|
-
operator: 'EQ',
|
|
56
|
-
left: { type: 'identifier', name: 'type' },
|
|
57
|
-
right: { type: 'literal', value: 'Person' },
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
query: '$title = "DXOS"',
|
|
62
|
-
ast: {
|
|
63
|
-
type: 'binary',
|
|
64
|
-
operator: 'EQ',
|
|
65
|
-
left: { type: 'identifier', name: '$title' },
|
|
66
|
-
right: { type: 'literal', value: 'DXOS' },
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
query: '(type:Person OR type:Organization) AND $title = "DXOS" AND $ts < TODAY',
|
|
71
|
-
ast: {
|
|
72
|
-
left: {
|
|
73
|
-
left: {
|
|
74
|
-
left: {
|
|
75
|
-
left: {
|
|
76
|
-
name: 'type',
|
|
77
|
-
type: 'identifier',
|
|
78
|
-
},
|
|
79
|
-
operator: 'EQ',
|
|
80
|
-
right: {
|
|
81
|
-
type: 'literal',
|
|
82
|
-
value: 'Person',
|
|
83
|
-
},
|
|
84
|
-
type: 'binary',
|
|
85
|
-
},
|
|
86
|
-
operator: 'OR',
|
|
87
|
-
right: {
|
|
88
|
-
left: {
|
|
89
|
-
name: 'type',
|
|
90
|
-
type: 'identifier',
|
|
91
|
-
},
|
|
92
|
-
operator: 'EQ',
|
|
93
|
-
right: {
|
|
94
|
-
type: 'literal',
|
|
95
|
-
value: 'Organization',
|
|
96
|
-
},
|
|
97
|
-
type: 'binary',
|
|
98
|
-
},
|
|
99
|
-
type: 'binary',
|
|
100
|
-
},
|
|
101
|
-
operator: 'AND',
|
|
102
|
-
right: {
|
|
103
|
-
left: {
|
|
104
|
-
name: '$title',
|
|
105
|
-
type: 'identifier',
|
|
106
|
-
},
|
|
107
|
-
operator: 'EQ',
|
|
108
|
-
right: {
|
|
109
|
-
type: 'literal',
|
|
110
|
-
value: 'DXOS',
|
|
111
|
-
},
|
|
112
|
-
type: 'binary',
|
|
113
|
-
},
|
|
114
|
-
type: 'binary',
|
|
115
|
-
},
|
|
116
|
-
operator: 'AND',
|
|
117
|
-
right: {
|
|
118
|
-
left: {
|
|
119
|
-
name: '$ts',
|
|
120
|
-
type: 'identifier',
|
|
121
|
-
},
|
|
122
|
-
operator: 'LT',
|
|
123
|
-
right: {
|
|
124
|
-
type: 'literal',
|
|
125
|
-
value: 'TODAY',
|
|
126
|
-
},
|
|
127
|
-
type: 'binary',
|
|
128
|
-
},
|
|
129
|
-
type: 'binary',
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
];
|
|
133
|
-
|
|
134
|
-
for (const { query, ast } of cases) {
|
|
135
|
-
const parser = new QueryParser(query);
|
|
136
|
-
expect(parser.parse()).toEqual(ast);
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
});
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { invariant } from '@dxos/invariant';
|
|
6
|
-
|
|
7
|
-
import { type BinaryOperator, type Expression, type RelationalOperator } from './types';
|
|
8
|
-
|
|
9
|
-
// TODO(burdon): Move to echo-schema?
|
|
10
|
-
|
|
11
|
-
type RelationalSymbol = '=' | '<' | '>';
|
|
12
|
-
|
|
13
|
-
const operators: Record<RelationalSymbol, RelationalOperator> = {
|
|
14
|
-
'=': 'EQ',
|
|
15
|
-
'<': 'LT',
|
|
16
|
-
'>': 'GT',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export class QueryParser {
|
|
20
|
-
private tokens: string[] = [];
|
|
21
|
-
private current = 0;
|
|
22
|
-
|
|
23
|
-
constructor(input: string) {
|
|
24
|
-
// Tokenize the input string.
|
|
25
|
-
this.tokens = this.tokenize(input);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
private tokenize(input: string): string[] {
|
|
29
|
-
// Handle empty input.
|
|
30
|
-
if (!input.trim()) {
|
|
31
|
-
return [];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Split on spaces but preserve quoted strings.
|
|
35
|
-
const tokens: string[] = [];
|
|
36
|
-
let current = '';
|
|
37
|
-
let inQuotes = false;
|
|
38
|
-
|
|
39
|
-
for (let i = 0; i < input.length; i++) {
|
|
40
|
-
const char = input[i];
|
|
41
|
-
|
|
42
|
-
if (char === '"') {
|
|
43
|
-
// Handle quoted strings.
|
|
44
|
-
inQuotes = !inQuotes;
|
|
45
|
-
current += char;
|
|
46
|
-
} else if (char === '(' || char === ')') {
|
|
47
|
-
// If we have accumulated tokens, add them first.
|
|
48
|
-
if (current) {
|
|
49
|
-
tokens.push(current);
|
|
50
|
-
current = '';
|
|
51
|
-
}
|
|
52
|
-
// Add the parenthesis as a separate token.
|
|
53
|
-
tokens.push(char);
|
|
54
|
-
} else if (operators[char as RelationalSymbol]) {
|
|
55
|
-
// If we have accumulated tokens, add them first.
|
|
56
|
-
if (current) {
|
|
57
|
-
tokens.push(current);
|
|
58
|
-
current = '';
|
|
59
|
-
}
|
|
60
|
-
// Add the operator as a separate token.
|
|
61
|
-
tokens.push(operators[char as RelationalSymbol]);
|
|
62
|
-
} else if (char === ' ' && !inQuotes) {
|
|
63
|
-
if (current) {
|
|
64
|
-
tokens.push(current);
|
|
65
|
-
current = '';
|
|
66
|
-
}
|
|
67
|
-
} else {
|
|
68
|
-
current += char;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (current) {
|
|
73
|
-
tokens.push(current);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return tokens;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
private peek(): string {
|
|
80
|
-
return this.tokens[this.current];
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
private advance(): string {
|
|
84
|
-
return this.tokens[this.current++];
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
private match(type: string): boolean {
|
|
88
|
-
if (this.peek() === type) {
|
|
89
|
-
this.advance();
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
private isAtEnd(): boolean {
|
|
96
|
-
return this.current >= this.tokens.length;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
private parseExpression(): Expression {
|
|
100
|
-
let expr = this.parseTerm();
|
|
101
|
-
|
|
102
|
-
while (!this.isAtEnd()) {
|
|
103
|
-
const operator = this.peek();
|
|
104
|
-
if (operator === 'AND' || operator === 'OR') {
|
|
105
|
-
this.advance();
|
|
106
|
-
const right = this.parseTerm();
|
|
107
|
-
expr = {
|
|
108
|
-
type: 'binary',
|
|
109
|
-
operator: operator as BinaryOperator,
|
|
110
|
-
left: expr,
|
|
111
|
-
right,
|
|
112
|
-
};
|
|
113
|
-
} else {
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return expr;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
private parseTerm(): Expression {
|
|
122
|
-
// Handle NOT operator
|
|
123
|
-
if (this.peek() === 'NOT') {
|
|
124
|
-
this.advance();
|
|
125
|
-
const argument = this.parseTerm();
|
|
126
|
-
return {
|
|
127
|
-
type: 'unary',
|
|
128
|
-
operator: 'NOT',
|
|
129
|
-
argument,
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Handle parentheses.
|
|
134
|
-
if (this.match('(')) {
|
|
135
|
-
const expr = this.parseExpression();
|
|
136
|
-
if (!this.match(')')) {
|
|
137
|
-
throw new Error('Expected closing parenthesis');
|
|
138
|
-
}
|
|
139
|
-
return expr;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const token = this.peek();
|
|
143
|
-
|
|
144
|
-
// Handle type:Person style expressions.
|
|
145
|
-
if (token.includes(':')) {
|
|
146
|
-
const [field, value] = token.split(':');
|
|
147
|
-
this.advance();
|
|
148
|
-
if (!field || !value) {
|
|
149
|
-
throw new Error(`Invalid type expression: ${token}`);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return {
|
|
153
|
-
type: 'binary',
|
|
154
|
-
operator: 'EQ',
|
|
155
|
-
left: { type: 'identifier', name: field },
|
|
156
|
-
right: { type: 'literal', value },
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// Handle $field expressions with operators.
|
|
161
|
-
if (token.startsWith('$')) {
|
|
162
|
-
const field = token;
|
|
163
|
-
this.advance();
|
|
164
|
-
|
|
165
|
-
// Get the operator.
|
|
166
|
-
const operator = this.peek();
|
|
167
|
-
if (operator !== 'EQ' && operator !== 'LT' && operator !== 'GT') {
|
|
168
|
-
throw new Error(`Expected operator after field ${field}, got ${operator}`);
|
|
169
|
-
}
|
|
170
|
-
this.advance();
|
|
171
|
-
|
|
172
|
-
// Get the value
|
|
173
|
-
const value = this.peek();
|
|
174
|
-
this.advance();
|
|
175
|
-
invariant(value);
|
|
176
|
-
|
|
177
|
-
return {
|
|
178
|
-
type: 'binary',
|
|
179
|
-
operator: operator as BinaryOperator,
|
|
180
|
-
left: { type: 'identifier', name: field },
|
|
181
|
-
right: { type: 'literal', value: value.replace(/^"|"$/g, '') },
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
throw new Error(`Unexpected token: ${token}`);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
public parse(): Expression {
|
|
189
|
-
// Return a special expression for empty input.
|
|
190
|
-
if (this.tokens.length === 0) {
|
|
191
|
-
return {
|
|
192
|
-
type: 'literal',
|
|
193
|
-
value: '*',
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return this.parseExpression();
|
|
198
|
-
}
|
|
199
|
-
}
|
package/src/parser/types.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
export type UnaryOperator = 'NOT';
|
|
6
|
-
|
|
7
|
-
export type RelationalOperator = 'EQ' | 'LT' | 'GT';
|
|
8
|
-
|
|
9
|
-
export type BinaryOperator = RelationalOperator | 'AND' | 'OR';
|
|
10
|
-
|
|
11
|
-
export type Expression = BinaryExpression | UnaryExpression | Identifier | Literal;
|
|
12
|
-
|
|
13
|
-
export interface BinaryExpression {
|
|
14
|
-
type: 'binary';
|
|
15
|
-
operator: BinaryOperator;
|
|
16
|
-
left: Expression;
|
|
17
|
-
right: Expression;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface UnaryExpression {
|
|
21
|
-
type: 'unary';
|
|
22
|
-
operator: UnaryOperator;
|
|
23
|
-
argument: Expression;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface Identifier {
|
|
27
|
-
type: 'identifier';
|
|
28
|
-
name: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface Literal {
|
|
32
|
-
type: 'literal';
|
|
33
|
-
value: string;
|
|
34
|
-
}
|
package/src/shims.d.ts
DELETED
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
|
-
import React, { type FC, useCallback } from 'react';
|
|
9
|
-
|
|
10
|
-
import { EXA_API_KEY } from '@dxos/ai/testing';
|
|
11
|
-
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
12
|
-
import { RESEARCH_BLUEPRINT, ResearchDataTypes, ResearchGraph } from '@dxos/assistant-testing';
|
|
13
|
-
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
14
|
-
import { log } from '@dxos/log';
|
|
15
|
-
import { Board, BoardPlugin } from '@dxos/plugin-board';
|
|
16
|
-
import { Chess, ChessPlugin } from '@dxos/plugin-chess';
|
|
17
|
-
import { InboxPlugin } from '@dxos/plugin-inbox';
|
|
18
|
-
import { Map, MapPlugin } from '@dxos/plugin-map';
|
|
19
|
-
import { MarkdownPlugin } from '@dxos/plugin-markdown';
|
|
20
|
-
import { Markdown } from '@dxos/plugin-markdown';
|
|
21
|
-
import { TablePlugin } from '@dxos/plugin-table';
|
|
22
|
-
import { useClient } from '@dxos/react-client';
|
|
23
|
-
import { useSpace } from '@dxos/react-client/echo';
|
|
24
|
-
import { useAsyncEffect } from '@dxos/react-ui';
|
|
25
|
-
import { DataType } from '@dxos/schema';
|
|
26
|
-
import { render } from '@dxos/storybook-utils';
|
|
27
|
-
import { trim } from '@dxos/util';
|
|
28
|
-
|
|
29
|
-
import { translations } from '../translations';
|
|
30
|
-
import { Assistant } from '../types';
|
|
31
|
-
|
|
32
|
-
import {
|
|
33
|
-
BlueprintContainer,
|
|
34
|
-
ChatContainer,
|
|
35
|
-
type ComponentProps,
|
|
36
|
-
GraphContainer,
|
|
37
|
-
LoggingContainer,
|
|
38
|
-
SurfaceContainer,
|
|
39
|
-
TasksContainer,
|
|
40
|
-
} from './components';
|
|
41
|
-
import { addTestData, config, getDecorators, testTypes } from './testing';
|
|
42
|
-
|
|
43
|
-
const DefaultStory = ({
|
|
44
|
-
debug = true,
|
|
45
|
-
components,
|
|
46
|
-
blueprints = [],
|
|
47
|
-
}: {
|
|
48
|
-
debug?: boolean;
|
|
49
|
-
components: (FC<ComponentProps> | FC<ComponentProps>[])[];
|
|
50
|
-
blueprints?: string[];
|
|
51
|
-
}) => {
|
|
52
|
-
const client = useClient();
|
|
53
|
-
const space = useSpace();
|
|
54
|
-
|
|
55
|
-
const blueprintsDefinitions = useCapabilities(Capabilities.BlueprintDefinition);
|
|
56
|
-
useAsyncEffect(async () => {
|
|
57
|
-
if (!space) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const { objects: chats = [] } = await space.db.query(Filter.type(Assistant.Chat)).run();
|
|
61
|
-
const chat = chats[0];
|
|
62
|
-
if (!chat) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// TODO(burdon): Active should be ephemeral state of AiProcessor; write on edit/prompt.
|
|
67
|
-
|
|
68
|
-
// TODO(burdon): RACE CONDITION; must handle concurrently adding multiple blueprints instances with same key.
|
|
69
|
-
// Add blueprints to context.
|
|
70
|
-
// const binder = new AiContextBinder(await chat.queue.load());
|
|
71
|
-
// for (const key of blueprints) {
|
|
72
|
-
// const blueprint = blueprintsDefinitions.find((blueprint) => blueprint.key === key);
|
|
73
|
-
// if (blueprint) {
|
|
74
|
-
// const obj = space.db.add(Obj.clone(blueprint));
|
|
75
|
-
// await binder.bind({ blueprints: [Ref.make(obj)] });
|
|
76
|
-
// }
|
|
77
|
-
// }
|
|
78
|
-
}, [space, blueprints, blueprintsDefinitions]);
|
|
79
|
-
|
|
80
|
-
const handleEvent = useCallback<NonNullable<ComponentProps['onEvent']>>((event) => {
|
|
81
|
-
log.info('event', { event });
|
|
82
|
-
switch (event) {
|
|
83
|
-
case 'reset': {
|
|
84
|
-
void client?.reset().then(() => {
|
|
85
|
-
document.location.reload();
|
|
86
|
-
});
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}, []);
|
|
91
|
-
|
|
92
|
-
if (!space) {
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return (
|
|
97
|
-
<div
|
|
98
|
-
className='grid grid-cols gap-2 m-2'
|
|
99
|
-
style={{ gridTemplateColumns: `repeat(${components.length}, minmax(0, 40rem))` }}
|
|
100
|
-
>
|
|
101
|
-
{components.map((Component, index) =>
|
|
102
|
-
Array.isArray(Component) ? (
|
|
103
|
-
<div
|
|
104
|
-
key={index}
|
|
105
|
-
className='grid grid-rows gap-2 overflow-hidden'
|
|
106
|
-
style={{ gridTemplateRows: `repeat(${Component.length}, 1fr)` }}
|
|
107
|
-
>
|
|
108
|
-
{Component.map((Component, index) => (
|
|
109
|
-
<div key={index} className='flex flex-col overflow-hidden bg-baseSurface rounded border border-separator'>
|
|
110
|
-
<Component space={space} debug={debug} onEvent={handleEvent} />
|
|
111
|
-
</div>
|
|
112
|
-
))}
|
|
113
|
-
</div>
|
|
114
|
-
) : (
|
|
115
|
-
<div key={index} className='flex flex-col overflow-hidden bg-baseSurface rounded border border-separator'>
|
|
116
|
-
<Component space={space} debug={debug} onEvent={handleEvent} />
|
|
117
|
-
</div>
|
|
118
|
-
),
|
|
119
|
-
)}
|
|
120
|
-
</div>
|
|
121
|
-
);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const storybook = {
|
|
125
|
-
title: 'plugins/plugin-assistant/Chat',
|
|
126
|
-
render: render(DefaultStory),
|
|
127
|
-
parameters: {
|
|
128
|
-
translations,
|
|
129
|
-
controls: { disable: true },
|
|
130
|
-
},
|
|
131
|
-
} satisfies Meta<typeof DefaultStory>;
|
|
132
|
-
|
|
133
|
-
export default storybook;
|
|
134
|
-
|
|
135
|
-
type Story = StoryObj<typeof storybook>;
|
|
136
|
-
|
|
137
|
-
//
|
|
138
|
-
// Stories
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
-
export const Default = {
|
|
142
|
-
decorators: getDecorators({
|
|
143
|
-
config: config.remote,
|
|
144
|
-
}),
|
|
145
|
-
args: {
|
|
146
|
-
components: [ChatContainer],
|
|
147
|
-
},
|
|
148
|
-
} satisfies Story;
|
|
149
|
-
|
|
150
|
-
export const WithDocument = {
|
|
151
|
-
decorators: getDecorators({
|
|
152
|
-
plugins: [MarkdownPlugin()],
|
|
153
|
-
config: config.remote,
|
|
154
|
-
onInit: async ({ space, binder }) => {
|
|
155
|
-
const object = space.db.add(
|
|
156
|
-
Markdown.makeDocument({
|
|
157
|
-
name: 'Document',
|
|
158
|
-
content: trim`
|
|
159
|
-
# Hello, world!
|
|
160
|
-
This is a test.
|
|
161
|
-
`,
|
|
162
|
-
}),
|
|
163
|
-
);
|
|
164
|
-
await binder.bind({ objects: [Ref.make(object)] });
|
|
165
|
-
},
|
|
166
|
-
}),
|
|
167
|
-
args: {
|
|
168
|
-
components: [ChatContainer, SurfaceContainer],
|
|
169
|
-
},
|
|
170
|
-
} satisfies Story;
|
|
171
|
-
|
|
172
|
-
export const WithBlueprints = {
|
|
173
|
-
decorators: getDecorators({
|
|
174
|
-
plugins: [InboxPlugin(), MarkdownPlugin(), TablePlugin()],
|
|
175
|
-
config: config.remote,
|
|
176
|
-
onInit: async ({ space, binder }) => {
|
|
177
|
-
const object = space.db.add(Markdown.makeDocument({ name: 'Tasks' }));
|
|
178
|
-
await binder.bind({ objects: [Ref.make(object)] });
|
|
179
|
-
},
|
|
180
|
-
}),
|
|
181
|
-
args: {
|
|
182
|
-
components: [ChatContainer, [TasksContainer, BlueprintContainer]],
|
|
183
|
-
},
|
|
184
|
-
} satisfies Story;
|
|
185
|
-
|
|
186
|
-
export const WithChess = {
|
|
187
|
-
decorators: getDecorators({
|
|
188
|
-
plugins: [ChessPlugin()],
|
|
189
|
-
config: config.remote,
|
|
190
|
-
types: [Chess.Game],
|
|
191
|
-
onInit: async ({ space, binder }) => {
|
|
192
|
-
// TODO(burdon): Add player DID (for user and assistant).
|
|
193
|
-
const object = space.db.add(
|
|
194
|
-
Chess.makeGame({
|
|
195
|
-
name: 'Challenge',
|
|
196
|
-
pgn: '1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d4 exd4 6. cxd4 Bb4+ 7. Nc3 d5 8. exd5 Nxd5 9. O-O Be6 10. Qb3 Na5 11. Qa4+ c6 12. Bxd5 Bxc3 13. Bxe6 fxe6 *',
|
|
197
|
-
}),
|
|
198
|
-
);
|
|
199
|
-
await binder.bind({ objects: [Ref.make(object)] });
|
|
200
|
-
},
|
|
201
|
-
}),
|
|
202
|
-
args: {
|
|
203
|
-
components: [ChatContainer, SurfaceContainer],
|
|
204
|
-
blueprints: ['dxos.org/blueprint/assistant', 'dxos.org/blueprint/chess'],
|
|
205
|
-
},
|
|
206
|
-
} satisfies Story;
|
|
207
|
-
|
|
208
|
-
export const WithMap = {
|
|
209
|
-
decorators: getDecorators({
|
|
210
|
-
plugins: [MapPlugin()],
|
|
211
|
-
config: config.remote,
|
|
212
|
-
types: [Map.Map],
|
|
213
|
-
onInit: async ({ space, binder }) => {
|
|
214
|
-
const object = space.db.add(Map.makeMap());
|
|
215
|
-
await binder.bind({ objects: [Ref.make(object)] });
|
|
216
|
-
},
|
|
217
|
-
}),
|
|
218
|
-
args: {
|
|
219
|
-
components: [ChatContainer, SurfaceContainer],
|
|
220
|
-
},
|
|
221
|
-
} satisfies Story;
|
|
222
|
-
|
|
223
|
-
export const WithTrip = {
|
|
224
|
-
decorators: getDecorators({
|
|
225
|
-
plugins: [MarkdownPlugin(), MapPlugin()],
|
|
226
|
-
config: config.remote,
|
|
227
|
-
types: [Map.Map],
|
|
228
|
-
onInit: async ({ space, binder }) => {
|
|
229
|
-
// TODO(burdon): Table.
|
|
230
|
-
{
|
|
231
|
-
const object = space.db.add(Map.makeMap({ name: 'Trip' }));
|
|
232
|
-
await binder.bind({ objects: [Ref.make(object)] });
|
|
233
|
-
}
|
|
234
|
-
{
|
|
235
|
-
const object = space.db.add(
|
|
236
|
-
Markdown.makeDocument({
|
|
237
|
-
name: 'Itinerary',
|
|
238
|
-
content: trim`
|
|
239
|
-
# Itinerary
|
|
240
|
-
|
|
241
|
-
## Day 1
|
|
242
|
-
- Visit the Sagrada Familia
|
|
243
|
-
- Visit the Park Güell
|
|
244
|
-
- Visit the Casa Batlló
|
|
245
|
-
|
|
246
|
-
## Day 2
|
|
247
|
-
- Visit the Eiffel Tower
|
|
248
|
-
- Visit the Louvre
|
|
249
|
-
- Visit the Musée d'Orsay
|
|
250
|
-
`,
|
|
251
|
-
}),
|
|
252
|
-
);
|
|
253
|
-
await binder.bind({ objects: [Ref.make(object)] });
|
|
254
|
-
}
|
|
255
|
-
{
|
|
256
|
-
const object = space.db.add(
|
|
257
|
-
Markdown.makeDocument({
|
|
258
|
-
name: 'Barcelona',
|
|
259
|
-
content: trim`
|
|
260
|
-
# Barcelona
|
|
261
|
-
|
|
262
|
-
Barcelona is the capital and most populous city of Catalonia, an autonomous community in northeastern Spain.
|
|
263
|
-
It is located on the Mediterranean coast, on the banks of the Llobregat River, in the comarca of the Baix Llobregat.
|
|
264
|
-
The city is known for its rich history, vibrant culture, and stunning architecture, including the Sagrada Familia, Park Güell, and Casa Batlló.
|
|
265
|
-
`,
|
|
266
|
-
}),
|
|
267
|
-
);
|
|
268
|
-
await binder.bind({ objects: [Ref.make(object)] });
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
}),
|
|
272
|
-
args: {
|
|
273
|
-
components: [ChatContainer, SurfaceContainer],
|
|
274
|
-
},
|
|
275
|
-
} satisfies Story;
|
|
276
|
-
|
|
277
|
-
export const WithBoard = {
|
|
278
|
-
decorators: getDecorators({
|
|
279
|
-
plugins: [BoardPlugin()],
|
|
280
|
-
config: config.remote,
|
|
281
|
-
types: [Board.Board],
|
|
282
|
-
onInit: async ({ space, binder }) => {
|
|
283
|
-
const object = space.db.add(Board.makeBoard());
|
|
284
|
-
await binder.bind({ objects: [Ref.make(object)] });
|
|
285
|
-
},
|
|
286
|
-
}),
|
|
287
|
-
args: {
|
|
288
|
-
debug: true,
|
|
289
|
-
components: [ChatContainer, SurfaceContainer],
|
|
290
|
-
},
|
|
291
|
-
} satisfies Story;
|
|
292
|
-
|
|
293
|
-
export const WithResearch = {
|
|
294
|
-
decorators: getDecorators({
|
|
295
|
-
plugins: [MarkdownPlugin(), TablePlugin()],
|
|
296
|
-
config: config.persistent,
|
|
297
|
-
types: [...ResearchDataTypes, ResearchGraph, DataType.AccessToken],
|
|
298
|
-
accessTokens: [Obj.make(DataType.AccessToken, { source: 'exa.ai', token: EXA_API_KEY })],
|
|
299
|
-
}),
|
|
300
|
-
args: {
|
|
301
|
-
components: [ChatContainer, [GraphContainer, BlueprintContainer, LoggingContainer]],
|
|
302
|
-
blueprints: [RESEARCH_BLUEPRINT.key],
|
|
303
|
-
},
|
|
304
|
-
} satisfies Story;
|
|
305
|
-
|
|
306
|
-
export const WithSearch = {
|
|
307
|
-
decorators: getDecorators({
|
|
308
|
-
config: config.remote,
|
|
309
|
-
types: testTypes,
|
|
310
|
-
onInit: async ({ space }) => {
|
|
311
|
-
await addTestData(space);
|
|
312
|
-
},
|
|
313
|
-
}),
|
|
314
|
-
args: {
|
|
315
|
-
components: [ChatContainer, [GraphContainer]],
|
|
316
|
-
},
|
|
317
|
-
} satisfies Story;
|