@dxos/plugin-assistant 0.8.2-main.fbd8ed0 → 0.8.2-staging.42af850
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/AssistantDialog-K6POM23O.mjs +46 -0
- package/dist/lib/browser/AssistantDialog-K6POM23O.mjs.map +7 -0
- package/dist/lib/browser/ChatContainer-QTO4LE2C.mjs +39 -0
- package/dist/lib/{node-esm/ChatContainer-FAYGNMQW.mjs.map → browser/ChatContainer-QTO4LE2C.mjs.map} +1 -1
- package/dist/lib/browser/TemplateContainer-AKUYL4AV.mjs +28 -0
- package/dist/lib/{node-esm/TemplateContainer-3LEBT5ZC.mjs.map → browser/TemplateContainer-AKUYL4AV.mjs.map} +1 -1
- package/dist/lib/browser/{ai-client-5PRCXI7N.mjs → ai-client-COXVUC6V.mjs} +4 -4
- package/dist/lib/browser/ai-client-COXVUC6V.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-HTK3HFGM.mjs → app-graph-builder-YH4EGNBC.mjs} +45 -28
- package/dist/lib/browser/app-graph-builder-YH4EGNBC.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TXJWGWJ7.mjs → chunk-3F44MBHU.mjs} +3 -3
- package/dist/lib/browser/chunk-3F44MBHU.mjs.map +7 -0
- package/dist/lib/browser/chunk-IHEBFO5O.mjs +205 -0
- package/dist/lib/browser/chunk-IHEBFO5O.mjs.map +7 -0
- package/dist/lib/browser/chunk-JQFUME3B.mjs +87 -0
- package/dist/lib/{node-esm/chunk-PBZA7XJR.mjs.map → browser/chunk-JQFUME3B.mjs.map} +1 -1
- package/dist/lib/browser/chunk-Q6UZ4F3H.mjs +96 -0
- package/dist/lib/browser/chunk-Q6UZ4F3H.mjs.map +7 -0
- package/dist/lib/browser/{chunk-OWZHLWW5.mjs → chunk-QTW7KVDO.mjs} +1595 -1452
- package/dist/lib/browser/chunk-QTW7KVDO.mjs.map +7 -0
- package/dist/lib/browser/chunk-USJBRB3H.mjs +155 -0
- package/dist/lib/browser/chunk-USJBRB3H.mjs.map +7 -0
- package/dist/lib/browser/{chunk-3HCI5FIL.mjs → chunk-XOZ7YMO3.mjs} +3 -3
- package/dist/lib/browser/{chunk-3HCI5FIL.mjs.map → chunk-XOZ7YMO3.mjs.map} +1 -1
- package/dist/lib/browser/index.mjs +24 -10
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-QV5AAVJZ.mjs → intent-resolver-63EAHENI.mjs} +6 -5
- package/dist/lib/browser/intent-resolver-63EAHENI.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-XCV6NR75.mjs +131 -0
- package/dist/lib/browser/react-surface-XCV6NR75.mjs.map +7 -0
- package/dist/lib/browser/{settings-OZX7J65A.mjs → settings-SHNQ4XXP.mjs} +3 -3
- package/dist/lib/browser/types/index.mjs +4 -2
- package/dist/lib/node/AssistantDialog-FDATKYE5.cjs +72 -0
- package/dist/lib/node/AssistantDialog-FDATKYE5.cjs.map +7 -0
- package/dist/lib/node/{ChatContainer-WVAAOEOH.cjs → ChatContainer-5CLHJOIQ.cjs} +25 -19
- package/dist/lib/node/{ChatContainer-WVAAOEOH.cjs.map → ChatContainer-5CLHJOIQ.cjs.map} +1 -1
- package/dist/lib/node/{TemplateContainer-EQXKHWTF.cjs → TemplateContainer-CTG2MB4W.cjs} +18 -12
- package/dist/lib/node/{TemplateContainer-EQXKHWTF.cjs.map → TemplateContainer-CTG2MB4W.cjs.map} +1 -1
- package/dist/lib/node/{ai-client-OUPSRQT7.cjs → ai-client-R2CGEYZW.cjs} +12 -12
- package/dist/lib/node/ai-client-R2CGEYZW.cjs.map +7 -0
- package/dist/lib/node/{app-graph-builder-LEO63CZZ.cjs → app-graph-builder-PSHIOW3Q.cjs} +62 -46
- package/dist/lib/node/app-graph-builder-PSHIOW3Q.cjs.map +7 -0
- package/dist/lib/node/{chunk-XI2ARIEO.cjs → chunk-4EEWTDQK.cjs} +45 -39
- package/dist/lib/node/{chunk-XI2ARIEO.cjs.map → chunk-4EEWTDQK.cjs.map} +1 -1
- package/dist/lib/node/chunk-FLJWJ35M.cjs +181 -0
- package/dist/lib/node/chunk-FLJWJ35M.cjs.map +7 -0
- package/dist/lib/node/{chunk-OOHFSPWR.cjs → chunk-H4A42LNR.cjs} +1126 -983
- package/dist/lib/node/chunk-H4A42LNR.cjs.map +7 -0
- package/dist/lib/node/chunk-HRNIUYVQ.cjs +128 -0
- package/dist/lib/node/chunk-HRNIUYVQ.cjs.map +7 -0
- package/dist/lib/node/{chunk-Q5XWEMHB.cjs → chunk-P74TWGMG.cjs} +6 -6
- package/dist/lib/node/{chunk-Q5XWEMHB.cjs.map → chunk-P74TWGMG.cjs.map} +1 -1
- package/dist/lib/node/chunk-RXPA2C2A.cjs +230 -0
- package/dist/lib/node/chunk-RXPA2C2A.cjs.map +7 -0
- package/dist/lib/node/{chunk-GBUNQ257.cjs → chunk-TS3H5OSX.cjs} +7 -7
- package/dist/lib/node/chunk-TS3H5OSX.cjs.map +7 -0
- package/dist/lib/node/index.cjs +72 -59
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-QDGZMWLY.cjs → intent-resolver-66F7WLW6.cjs} +13 -12
- package/dist/lib/node/intent-resolver-66F7WLW6.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-surface-TASAPRPQ.cjs +145 -0
- package/dist/lib/node/react-surface-TASAPRPQ.cjs.map +7 -0
- package/dist/lib/node/{settings-WLTC7XO5.cjs → settings-ERKLO6IO.cjs} +8 -8
- package/dist/lib/node/types/index.cjs +16 -14
- package/dist/lib/node/types/index.cjs.map +2 -2
- package/dist/lib/node-esm/AssistantDialog-PIMYK774.mjs +47 -0
- package/dist/lib/node-esm/AssistantDialog-PIMYK774.mjs.map +7 -0
- package/dist/lib/node-esm/ChatContainer-QTC5NYE2.mjs +40 -0
- package/dist/lib/{browser/ChatContainer-ZNKENYKZ.mjs.map → node-esm/ChatContainer-QTC5NYE2.mjs.map} +1 -1
- package/dist/lib/node-esm/TemplateContainer-IVDQ4XQG.mjs +29 -0
- package/dist/lib/{browser/TemplateContainer-WKU5XFSO.mjs.map → node-esm/TemplateContainer-IVDQ4XQG.mjs.map} +1 -1
- package/dist/lib/node-esm/{ai-client-RZQWEDUX.mjs → ai-client-I5LXHMOZ.mjs} +4 -4
- package/dist/lib/node-esm/ai-client-I5LXHMOZ.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-WXJNZDYB.mjs → app-graph-builder-Z3GMMJMD.mjs} +45 -28
- package/dist/lib/node-esm/app-graph-builder-Z3GMMJMD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ECRK6TUQ.mjs → chunk-BB2TAT4P.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-ECRK6TUQ.mjs.map → chunk-BB2TAT4P.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-CDAILLCU.mjs +98 -0
- package/dist/lib/node-esm/chunk-CDAILLCU.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-6JK5HEUQ.mjs → chunk-HLPGKJ7N.mjs} +3 -3
- package/dist/lib/node-esm/chunk-HLPGKJ7N.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-PBZA7XJR.mjs → chunk-OYN6HLXZ.mjs} +42 -36
- package/dist/lib/{browser/chunk-NFUHCW2J.mjs.map → node-esm/chunk-OYN6HLXZ.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-QU626JMR.mjs +156 -0
- package/dist/lib/node-esm/chunk-QU626JMR.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ED55ZE4G.mjs → chunk-SI5LOQEO.mjs} +1595 -1452
- package/dist/lib/node-esm/chunk-SI5LOQEO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZKBACPIW.mjs +206 -0
- package/dist/lib/node-esm/chunk-ZKBACPIW.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +24 -10
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-Q3I6S6HN.mjs → intent-resolver-X3PWH7KM.mjs} +6 -5
- package/dist/lib/node-esm/intent-resolver-X3PWH7KM.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-QMIQCXUM.mjs +132 -0
- package/dist/lib/node-esm/react-surface-QMIQCXUM.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-CLE57WEP.mjs → settings-IVQRZUCU.mjs} +3 -3
- package/dist/lib/node-esm/types/index.mjs +4 -2
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-client.d.ts +1 -1
- package/dist/types/src/capabilities/ai-client.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts +3 -1
- package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts.map +1 -1
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts +8 -0
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts.map +1 -0
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.stories.d.ts +8 -0
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/BlueprintEditor/index.d.ts +2 -0
- package/dist/types/src/components/BlueprintEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/Prompt/Prompt.d.ts +5 -2
- package/dist/types/src/components/Prompt/Prompt.d.ts.map +1 -1
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts +6 -3
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts.map +1 -1
- package/dist/types/src/components/Prompt/PromptBar.d.ts +9 -4
- package/dist/types/src/components/Prompt/PromptBar.d.ts.map +1 -1
- package/dist/types/src/components/Prompt/PromptBar.stories.d.ts +9 -0
- package/dist/types/src/components/Prompt/PromptBar.stories.d.ts.map +1 -0
- package/dist/types/src/components/Prompt/autocomplete.d.ts +5 -1
- package/dist/types/src/components/Prompt/autocomplete.d.ts.map +1 -1
- package/dist/types/src/components/Thread/Thread.d.ts +2 -2
- package/dist/types/src/components/Thread/Thread.d.ts.map +1 -1
- package/dist/types/src/components/Thread/ThreadContainer.d.ts +1 -1
- package/dist/types/src/components/Thread/ThreadContainer.d.ts.map +1 -1
- package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts +2 -2
- package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/Thread/ThreadMessage.d.ts +4 -2
- package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +1 -1
- package/dist/types/src/components/Thread/ToolInvocations.d.ts +1 -1
- package/dist/types/src/components/Thread/ToolInvocations.d.ts.map +1 -1
- package/dist/types/src/components/Thread/reducer.d.ts +1 -1
- package/dist/types/src/components/Thread/reducer.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +2 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/experimental/transcription/index.d.ts +1 -0
- package/dist/types/src/experimental/transcription/index.d.ts.map +1 -0
- package/dist/types/src/hooks/processor.d.ts +6 -5
- package/dist/types/src/hooks/processor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useMessageQueue.d.ts +11 -7
- package/dist/types/src/hooks/useMessageQueue.d.ts.map +1 -1
- package/dist/types/src/parser/filter-generator.d.ts +4 -0
- package/dist/types/src/parser/filter-generator.d.ts.map +1 -0
- package/dist/types/src/parser/filter-generator.test.d.ts +2 -0
- package/dist/types/src/parser/filter-generator.test.d.ts.map +1 -0
- package/dist/types/src/parser/index.d.ts +4 -0
- package/dist/types/src/parser/index.d.ts.map +1 -0
- package/dist/types/src/parser/query-parser.d.ts +15 -0
- package/dist/types/src/parser/query-parser.d.ts.map +1 -0
- package/dist/types/src/parser/query-parser.test.d.ts +2 -0
- package/dist/types/src/parser/query-parser.test.d.ts.map +1 -0
- package/dist/types/src/parser/types.d.ts +24 -0
- package/dist/types/src/parser/types.d.ts.map +1 -0
- package/dist/types/src/stories/Prompt.stories.d.ts +8 -0
- package/dist/types/src/stories/Prompt.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Query.stories.d.ts +19 -0
- package/dist/types/src/stories/Query.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Research.stories.d.ts +15 -0
- package/dist/types/src/stories/Research.stories.d.ts.map +1 -0
- package/dist/types/src/stories/test-data.d.ts +3 -0
- package/dist/types/src/stories/test-data.d.ts.map +1 -0
- package/dist/types/src/stories/testing.d.ts +12 -0
- package/dist/types/src/stories/testing.d.ts.map +1 -0
- package/dist/types/src/testing/blueprint.d.ts +7 -0
- package/dist/types/src/testing/blueprint.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-functions.d.ts +1 -1
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/tools/function.d.ts +4 -4
- package/dist/types/src/tools/function.d.ts.map +1 -1
- package/dist/types/src/tools/openapi.d.ts +3 -3
- package/dist/types/src/tools/openapi.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +63 -6
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/chat.d.ts +18 -8
- package/dist/types/src/types/chat.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +6 -3
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/package.json +73 -61
- package/src/AssistantPlugin.tsx +5 -4
- package/src/capabilities/ai-client.ts +1 -1
- package/src/capabilities/app-graph-builder.ts +34 -24
- package/src/capabilities/capabilities.ts +1 -1
- package/src/capabilities/intent-resolver.ts +3 -2
- package/src/capabilities/react-surface.tsx +58 -13
- package/src/components/AmbientDialog/AmbientDialog.stories.tsx +1 -1
- package/src/components/AmbientDialog/AmbientDialog.tsx +27 -13
- package/src/components/AssistantDialog.tsx +1 -1
- package/src/components/AssistantSettings/AssistantSettings.tsx +1 -1
- package/src/components/BlueprintEditor/BlueprintEditor.stories.tsx +32 -0
- package/src/components/BlueprintEditor/BlueprintEditor.tsx +41 -0
- package/src/components/BlueprintEditor/index.ts +5 -0
- package/src/components/Prompt/Prompt.stories.tsx +59 -52
- package/src/components/Prompt/Prompt.tsx +24 -10
- package/src/components/Prompt/PromptBar.stories.tsx +68 -0
- package/src/components/Prompt/PromptBar.tsx +82 -80
- package/src/components/Prompt/autocomplete.ts +14 -8
- package/src/components/Prompt/references.ts +3 -3
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +2 -2
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +1 -1
- package/src/components/Thread/Thread.stories.tsx +2 -2
- package/src/components/Thread/Thread.tsx +2 -2
- package/src/components/Thread/ThreadContainer.stories.tsx +77 -47
- package/src/components/Thread/ThreadContainer.tsx +8 -9
- package/src/components/Thread/ThreadMessage.tsx +43 -8
- package/src/components/Thread/ToolInvocations.tsx +9 -7
- package/src/components/Thread/reducer.ts +1 -1
- package/src/components/Toolbox/Toolbox.stories.tsx +1 -1
- package/src/components/Toolbox/Toolbox.tsx +2 -1
- package/src/components/index.ts +2 -0
- package/src/experimental/transcription/index.ts +3 -0
- package/src/hooks/processor.ts +65 -27
- package/src/hooks/useChatProcessor.tsx +4 -4
- package/src/hooks/useContextProvider.ts +6 -6
- package/src/hooks/useMessageQueue.ts +4 -4
- package/src/meta.ts +2 -2
- package/src/parser/filter-generator.test.ts +32 -0
- package/src/parser/filter-generator.ts +81 -0
- package/src/parser/index.ts +7 -0
- package/src/parser/query-parser.test.ts +139 -0
- package/src/parser/query-parser.ts +199 -0
- package/src/parser/types.ts +34 -0
- package/src/shims.d.ts +8 -0
- package/src/stories/Prompt.stories.tsx +59 -0
- package/src/stories/Query.stories.tsx +448 -0
- package/src/stories/Research.stories.tsx +495 -0
- package/src/stories/test-data.ts +128 -0
- package/src/stories/testing.ts +64 -0
- package/src/testing/blueprint.ts +47 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/test-functions.ts +1 -1
- package/src/tools/function.ts +8 -7
- package/src/tools/openapi.test.ts +18 -19
- package/src/tools/openapi.ts +20 -14
- package/src/translations.ts +4 -2
- package/src/types/chat.ts +27 -4
- package/src/types/types.ts +3 -1
- package/dist/lib/browser/AssistantDialog-DTWVEQBB.mjs +0 -117
- package/dist/lib/browser/AssistantDialog-DTWVEQBB.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-ZNKENYKZ.mjs +0 -33
- package/dist/lib/browser/TemplateContainer-WKU5XFSO.mjs +0 -22
- package/dist/lib/browser/ai-client-5PRCXI7N.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-HTK3HFGM.mjs.map +0 -7
- package/dist/lib/browser/chunk-5P7U35RJ.mjs +0 -192
- package/dist/lib/browser/chunk-5P7U35RJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-7VDZP5WX.mjs +0 -143
- package/dist/lib/browser/chunk-7VDZP5WX.mjs.map +0 -7
- package/dist/lib/browser/chunk-NFUHCW2J.mjs +0 -81
- package/dist/lib/browser/chunk-OWZHLWW5.mjs.map +0 -7
- package/dist/lib/browser/chunk-TXJWGWJ7.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-QV5AAVJZ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-JJPYWEIN.mjs +0 -90
- package/dist/lib/browser/react-surface-JJPYWEIN.mjs.map +0 -7
- package/dist/lib/node/AssistantDialog-RJJHZI63.cjs +0 -141
- package/dist/lib/node/AssistantDialog-RJJHZI63.cjs.map +0 -7
- package/dist/lib/node/ai-client-OUPSRQT7.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-LEO63CZZ.cjs.map +0 -7
- package/dist/lib/node/chunk-GBUNQ257.cjs.map +0 -7
- package/dist/lib/node/chunk-GQ3XS5FZ.cjs +0 -169
- package/dist/lib/node/chunk-GQ3XS5FZ.cjs.map +0 -7
- package/dist/lib/node/chunk-OOHFSPWR.cjs.map +0 -7
- package/dist/lib/node/chunk-VG2UQY4S.cjs +0 -216
- package/dist/lib/node/chunk-VG2UQY4S.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-QDGZMWLY.cjs.map +0 -7
- package/dist/lib/node/react-surface-XNEIJJYJ.cjs +0 -106
- package/dist/lib/node/react-surface-XNEIJJYJ.cjs.map +0 -7
- package/dist/lib/node-esm/AssistantDialog-D33WZUGR.mjs +0 -118
- package/dist/lib/node-esm/AssistantDialog-D33WZUGR.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-FAYGNMQW.mjs +0 -34
- package/dist/lib/node-esm/TemplateContainer-3LEBT5ZC.mjs +0 -23
- package/dist/lib/node-esm/ai-client-RZQWEDUX.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-WXJNZDYB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6JK5HEUQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-74GFINWJ.mjs +0 -144
- package/dist/lib/node-esm/chunk-74GFINWJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ED55ZE4G.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UZWYXNR5.mjs +0 -193
- package/dist/lib/node-esm/chunk-UZWYXNR5.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-Q3I6S6HN.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-RI3JONQY.mjs +0 -91
- package/dist/lib/node-esm/react-surface-RI3JONQY.mjs.map +0 -7
- /package/dist/lib/browser/{settings-OZX7J65A.mjs.map → settings-SHNQ4XXP.mjs.map} +0 -0
- /package/dist/lib/node/{settings-WLTC7XO5.cjs.map → settings-ERKLO6IO.cjs.map} +0 -0
- /package/dist/lib/node-esm/{settings-CLE57WEP.mjs.map → settings-IVQRZUCU.mjs.map} +0 -0
|
@@ -7,7 +7,7 @@ import { useMemo } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
9
9
|
import { Filter, type Space } from '@dxos/client/echo';
|
|
10
|
-
import {
|
|
10
|
+
import { Obj } from '@dxos/echo';
|
|
11
11
|
import { type BaseEchoObject, getDXN, getLabel } from '@dxos/echo-schema';
|
|
12
12
|
import { log } from '@dxos/log';
|
|
13
13
|
|
|
@@ -35,23 +35,23 @@ export const useContextProvider = (space?: Space): ContextProvider | undefined =
|
|
|
35
35
|
return (
|
|
36
36
|
objects
|
|
37
37
|
.map((object) => {
|
|
38
|
-
log.info('object', { object, label: getLabel(
|
|
38
|
+
log.info('object', { object, label: getLabel(Obj.getSchema(object)!, object) });
|
|
39
39
|
return object;
|
|
40
40
|
})
|
|
41
|
-
.filter((object) => stringMatch(query, getLabel(
|
|
41
|
+
.filter((object) => stringMatch(query, getLabel(Obj.getSchema(object)!, object) ?? ''))
|
|
42
42
|
// TODO(dmaretskyi): `Type.getDXN` (at the point of writing) didn't work here as it was schema-only.
|
|
43
43
|
.filter((object) => !!getDXN(object))
|
|
44
44
|
.map((object) => ({
|
|
45
45
|
uri: getDXN(object as any)!.toString(),
|
|
46
|
-
label: getLabel(
|
|
46
|
+
label: getLabel(Obj.getSchema(object)!, object) ?? '',
|
|
47
47
|
}))
|
|
48
48
|
);
|
|
49
49
|
},
|
|
50
50
|
resolveMetadata: async ({ uri }) => {
|
|
51
|
-
const object = await space.db.query(
|
|
51
|
+
const object = await space.db.query(Filter.ids(uri)).first();
|
|
52
52
|
return {
|
|
53
53
|
uri,
|
|
54
|
-
label: getLabel(
|
|
54
|
+
label: getLabel(Obj.getSchema(object)!, object) ?? '',
|
|
55
55
|
};
|
|
56
56
|
},
|
|
57
57
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type Message } from '@dxos/
|
|
7
|
+
import { type Message } from '@dxos/ai';
|
|
8
8
|
import { createQueueDxn } from '@dxos/echo-schema';
|
|
9
9
|
import { getSpace, useQueue } from '@dxos/react-client/echo';
|
|
10
10
|
|
|
@@ -13,9 +13,9 @@ import { type AIChatType } from '../types';
|
|
|
13
13
|
export const useMessageQueue = (chat?: AIChatType) => {
|
|
14
14
|
const space = getSpace(chat);
|
|
15
15
|
const queueDxn = useMemo(() => {
|
|
16
|
-
const dxn = space && chat?.
|
|
17
|
-
return dxn ? createQueueDxn(space.id) : undefined;
|
|
18
|
-
}, [space, chat?.
|
|
16
|
+
const dxn = space && chat?.queue.dxn;
|
|
17
|
+
return dxn ? createQueueDxn(space.id, dxn.parts.at(-1)) : undefined;
|
|
18
|
+
}, [space, chat?.queue.dxn]);
|
|
19
19
|
|
|
20
20
|
return useQueue<Message>(queueDxn);
|
|
21
21
|
};
|
package/src/meta.ts
CHANGED
|
@@ -13,6 +13,6 @@ export const meta: PluginMeta = {
|
|
|
13
13
|
name: 'Assistant',
|
|
14
14
|
description: 'The Assistant tab allows you to chat with your spaces inside of Composer.',
|
|
15
15
|
icon: 'ph--atom--regular',
|
|
16
|
-
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/
|
|
17
|
-
tags: ['
|
|
16
|
+
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-assistant',
|
|
17
|
+
tags: ['labs'],
|
|
18
18
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { Filter } from '@dxos/echo-schema';
|
|
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
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Filter } from '@dxos/echo-schema';
|
|
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
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { invariant } from '@dxos/invariant';
|
|
6
|
+
|
|
7
|
+
import { type Expression, type BinaryOperator, 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
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react';
|
|
8
|
+
import React, { useCallback, useState } from 'react';
|
|
9
|
+
|
|
10
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
+
import { JsonFilter } from '@dxos/react-ui-syntax-highlighter';
|
|
12
|
+
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
13
|
+
|
|
14
|
+
import { PromptBar, type PromptBarProps } from '../components';
|
|
15
|
+
import { type Expression, QueryParser } from '../parser';
|
|
16
|
+
import translations from '../translations';
|
|
17
|
+
|
|
18
|
+
const DefaultStory = (props: PromptBarProps) => {
|
|
19
|
+
const [ast, setAst] = useState<Expression>();
|
|
20
|
+
const handleSubmit = useCallback<NonNullable<PromptBarProps['onSubmit']>>((text) => {
|
|
21
|
+
const parser = new QueryParser(text);
|
|
22
|
+
const ast = parser.parse();
|
|
23
|
+
setAst(ast);
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div className='flex flex-col w-[40rem] border border-separator rounded-md'>
|
|
28
|
+
<PromptBar {...props} onSubmit={handleSubmit} />
|
|
29
|
+
<JsonFilter data={{ ast }} />
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const meta: Meta<typeof PromptBar> = {
|
|
35
|
+
title: 'plugins/plugin-assistant/QueryPrompt',
|
|
36
|
+
render: DefaultStory,
|
|
37
|
+
decorators: [
|
|
38
|
+
withPluginManager({
|
|
39
|
+
plugins: [],
|
|
40
|
+
}),
|
|
41
|
+
withTheme,
|
|
42
|
+
withLayout({
|
|
43
|
+
fullscreen: true,
|
|
44
|
+
classNames: 'justify-center',
|
|
45
|
+
}),
|
|
46
|
+
],
|
|
47
|
+
parameters: {
|
|
48
|
+
translations,
|
|
49
|
+
layout: 'centered',
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
type Story = StoryObj<typeof PromptBar>;
|
|
54
|
+
|
|
55
|
+
export default meta;
|
|
56
|
+
|
|
57
|
+
export const Default: Story = {
|
|
58
|
+
args: {},
|
|
59
|
+
};
|