@dxos/plugin-assistant 0.8.2-main.f11618f → 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-XPNXNPSW.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-OK5SMYJC.mjs → ai-client-COXVUC6V.mjs} +6 -6
- package/dist/lib/browser/ai-client-COXVUC6V.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-YH4EGNBC.mjs +206 -0
- 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-7CAHKTZQ.mjs → chunk-QTW7KVDO.mjs} +1665 -1547
- 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-W6XREK5F.mjs → intent-resolver-63EAHENI.mjs} +7 -11
- 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-LAJZQI4H.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-U6AVMAHY.cjs → ChatContainer-5CLHJOIQ.cjs} +25 -19
- package/dist/lib/node/{ChatContainer-U6AVMAHY.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-3EVTLXTT.cjs → ai-client-R2CGEYZW.cjs} +13 -13
- package/dist/lib/node/ai-client-R2CGEYZW.cjs.map +7 -0
- package/dist/lib/node/app-graph-builder-PSHIOW3Q.cjs +216 -0
- 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-CWHFK36A.cjs → chunk-H4A42LNR.cjs} +1154 -1030
- 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-MUJMV7II.cjs → intent-resolver-66F7WLW6.cjs} +13 -17
- 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-NPXTE6ND.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-GAYN3FEF.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-LYCBXZI7.mjs → ai-client-I5LXHMOZ.mjs} +6 -6
- package/dist/lib/node-esm/ai-client-I5LXHMOZ.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-Z3GMMJMD.mjs +207 -0
- 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-XFUXN5QU.mjs → chunk-SI5LOQEO.mjs} +1665 -1547
- 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-DZY2O2DG.mjs → intent-resolver-X3PWH7KM.mjs} +7 -11
- 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-K3JDH2I5.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 +3 -3
- package/dist/types/src/capabilities/ai-client.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +2 -179
- 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 +2 -178
- 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/AssistantSettings/AssistantSettings.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/Prompt/references.d.ts.map +1 -1
- package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
- package/dist/types/src/components/TemplateContainer.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +2 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.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/Thread.stories.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 +3 -2
- 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/index.d.ts +0 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- 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/useContextProvider.d.ts +1 -1
- package/dist/types/src/hooks/useContextProvider.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/hooks/useServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useTextInputEvents.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 +3 -0
- 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/service.d.ts +96 -95
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/src/types/template.d.ts +52 -52
- package/dist/types/src/types/template.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +24 -21
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +79 -61
- package/src/AssistantPlugin.tsx +5 -4
- package/src/capabilities/ai-client.ts +5 -5
- package/src/capabilities/app-graph-builder.ts +179 -109
- package/src/capabilities/capabilities.ts +1 -1
- package/src/capabilities/intent-resolver.ts +4 -6
- package/src/capabilities/react-surface.tsx +58 -13
- package/src/components/AmbientDialog/AmbientDialog.stories.tsx +2 -2
- 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 -88
- package/src/components/Prompt/autocomplete.ts +14 -8
- package/src/components/Prompt/references.ts +3 -3
- package/src/components/PromptSettings.tsx +2 -2
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +2 -2
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +1 -1
- package/src/components/TemplateEditor/TemplateForm.tsx +2 -2
- package/src/components/Thread/Thread.stories.tsx +14 -17
- package/src/components/Thread/Thread.tsx +2 -2
- package/src/components/Thread/ThreadContainer.stories.tsx +79 -49
- package/src/components/Thread/ThreadContainer.tsx +8 -9
- package/src/components/Thread/ThreadMessage.tsx +44 -9
- package/src/components/Thread/ToolInvocations.tsx +9 -7
- package/src/components/Thread/reducer.ts +1 -1
- package/src/components/Toolbox/Toolbox.stories.tsx +3 -3
- package/src/components/Toolbox/Toolbox.tsx +5 -4
- package/src/components/index.ts +2 -0
- package/src/experimental/transcription/index.ts +3 -0
- package/src/hooks/index.ts +0 -1
- package/src/hooks/processor.ts +65 -27
- package/src/hooks/useChatProcessor.tsx +9 -9
- package/src/hooks/useContextProvider.ts +21 -17
- package/src/hooks/useMessageQueue.ts +5 -5
- 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 +11 -12
- package/src/tools/openapi.test.ts +18 -19
- package/src/tools/openapi.ts +24 -17
- package/src/translations.ts +4 -2
- package/src/types/chat.ts +27 -4
- package/src/types/service.ts +39 -37
- package/src/types/template.ts +27 -25
- package/src/types/types.ts +20 -18
- package/dist/lib/browser/AssistantDialog-I47GUXWR.mjs +0 -117
- package/dist/lib/browser/AssistantDialog-I47GUXWR.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-GAYN3FEF.mjs +0 -33
- package/dist/lib/browser/TemplateContainer-WKU5XFSO.mjs +0 -22
- package/dist/lib/browser/ai-client-OK5SMYJC.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-ZXKGE3H5.mjs +0 -179
- package/dist/lib/browser/app-graph-builder-ZXKGE3H5.mjs.map +0 -7
- package/dist/lib/browser/chunk-7CAHKTZQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-BGMQ2YYP.mjs +0 -143
- package/dist/lib/browser/chunk-BGMQ2YYP.mjs.map +0 -7
- package/dist/lib/browser/chunk-E7BN4QKP.mjs +0 -190
- package/dist/lib/browser/chunk-E7BN4QKP.mjs.map +0 -7
- package/dist/lib/browser/chunk-NFUHCW2J.mjs +0 -81
- package/dist/lib/browser/chunk-TXJWGWJ7.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-W6XREK5F.mjs.map +0 -7
- package/dist/lib/browser/react-surface-QMI5KG4H.mjs +0 -90
- package/dist/lib/browser/react-surface-QMI5KG4H.mjs.map +0 -7
- package/dist/lib/node/AssistantDialog-SDS2TE5L.cjs +0 -141
- package/dist/lib/node/AssistantDialog-SDS2TE5L.cjs.map +0 -7
- package/dist/lib/node/ai-client-3EVTLXTT.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-TXHPXIIC.cjs +0 -190
- package/dist/lib/node/app-graph-builder-TXHPXIIC.cjs.map +0 -7
- package/dist/lib/node/chunk-5UELRDHQ.cjs +0 -214
- package/dist/lib/node/chunk-5UELRDHQ.cjs.map +0 -7
- package/dist/lib/node/chunk-CWHFK36A.cjs.map +0 -7
- package/dist/lib/node/chunk-GBUNQ257.cjs.map +0 -7
- package/dist/lib/node/chunk-XBJO453B.cjs +0 -169
- package/dist/lib/node/chunk-XBJO453B.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-MUJMV7II.cjs.map +0 -7
- package/dist/lib/node/react-surface-SAJF4XBB.cjs +0 -106
- package/dist/lib/node/react-surface-SAJF4XBB.cjs.map +0 -7
- package/dist/lib/node-esm/AssistantDialog-KGA5HBFO.mjs +0 -118
- package/dist/lib/node-esm/AssistantDialog-KGA5HBFO.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-XPNXNPSW.mjs +0 -34
- package/dist/lib/node-esm/TemplateContainer-3LEBT5ZC.mjs +0 -23
- package/dist/lib/node-esm/ai-client-LYCBXZI7.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-SV4WC2E2.mjs +0 -180
- package/dist/lib/node-esm/app-graph-builder-SV4WC2E2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6JK5HEUQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ECYNZYEG.mjs +0 -191
- package/dist/lib/node-esm/chunk-ECYNZYEG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-R7Q3OHWG.mjs +0 -144
- package/dist/lib/node-esm/chunk-R7Q3OHWG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XFUXN5QU.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-DZY2O2DG.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-R43NHNMC.mjs +0 -91
- package/dist/lib/node-esm/react-surface-R43NHNMC.mjs.map +0 -7
- package/dist/types/src/hooks/invocation-handler.d.ts +0 -5
- package/dist/types/src/hooks/invocation-handler.d.ts.map +0 -1
- package/dist/types/src/hooks/useLocalTriggerManager.d.ts +0 -3
- package/dist/types/src/hooks/useLocalTriggerManager.d.ts.map +0 -1
- package/src/hooks/invocation-handler.ts +0 -107
- package/src/hooks/useLocalTriggerManager.ts +0 -82
- /package/dist/lib/browser/{settings-LAJZQI4H.mjs.map → settings-SHNQ4XXP.mjs.map} +0 -0
- /package/dist/lib/node/{settings-NPXTE6ND.cjs.map → settings-ERKLO6IO.cjs.map} +0 -0
- /package/dist/lib/node-esm/{settings-K3JDH2I5.mjs.map → settings-IVQRZUCU.mjs.map} +0 -0
|
@@ -2,16 +2,26 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { Effect } from 'effect';
|
|
6
|
+
import React, { useEffect, useMemo } from 'react';
|
|
6
7
|
|
|
7
|
-
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
8
|
-
import {
|
|
8
|
+
import { Capabilities, contributes, createIntent, createSurface, useIntentDispatcher } from '@dxos/app-framework';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
import { Filter, isInstanceOf, Query } from '@dxos/echo-schema';
|
|
9
11
|
import { SettingsStore } from '@dxos/local-storage';
|
|
10
|
-
import {
|
|
12
|
+
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
13
|
+
import {
|
|
14
|
+
type AnyLiveObject,
|
|
15
|
+
fullyQualifiedId,
|
|
16
|
+
getSpace,
|
|
17
|
+
getTypename,
|
|
18
|
+
isEchoObject,
|
|
19
|
+
type SpaceId,
|
|
20
|
+
} from '@dxos/react-client/echo';
|
|
11
21
|
|
|
12
22
|
import { AssistantDialog, AssistantSettings, ChatContainer, PromptSettings, TemplateContainer } from '../components';
|
|
13
23
|
import { ASSISTANT_PLUGIN, ASSISTANT_DIALOG } from '../meta';
|
|
14
|
-
import { AIChatType, type AssistantSettingsProps, TemplateType } from '../types';
|
|
24
|
+
import { AIChatType, AssistantAction, type AssistantSettingsProps, CompanionTo, TemplateType } from '../types';
|
|
15
25
|
|
|
16
26
|
export default () =>
|
|
17
27
|
contributes(Capabilities.ReactSurface, [
|
|
@@ -32,17 +42,16 @@ export default () =>
|
|
|
32
42
|
id: `${ASSISTANT_PLUGIN}/chat`,
|
|
33
43
|
role: 'article',
|
|
34
44
|
filter: (data): data is { subject: AIChatType; variant: undefined } =>
|
|
35
|
-
|
|
45
|
+
Obj.instanceOf(AIChatType, data.subject) && data.variant !== 'assistant-chat',
|
|
36
46
|
component: ({ data, role }) => <ChatContainer role={role} chat={data.subject} />,
|
|
37
47
|
}),
|
|
38
48
|
createSurface({
|
|
39
49
|
id: `${ASSISTANT_PLUGIN}/object-chat`,
|
|
40
50
|
role: 'article',
|
|
41
|
-
filter: (data): data is { companionTo:
|
|
42
|
-
|
|
43
|
-
(data as any).companionTo.assistantChatQueue &&
|
|
44
|
-
data.subject === 'assistant-chat',
|
|
51
|
+
filter: (data): data is { companionTo: AnyLiveObject<any>; subject: AIChatType | 'assistant-chat' } =>
|
|
52
|
+
isEchoObject(data.companionTo) && (isInstanceOf(AIChatType, data.subject) || data.subject === 'assistant-chat'),
|
|
45
53
|
component: ({ data, role }) => {
|
|
54
|
+
const { dispatch } = useIntentDispatcher();
|
|
46
55
|
const associatedArtifact = useMemo(
|
|
47
56
|
() => ({
|
|
48
57
|
id: fullyQualifiedId(data.companionTo),
|
|
@@ -51,19 +60,55 @@ export default () =>
|
|
|
51
60
|
}),
|
|
52
61
|
[data.companionTo],
|
|
53
62
|
);
|
|
54
|
-
|
|
63
|
+
|
|
64
|
+
// TODO(wittjosiah): Factor out to container.
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
const timeout = setTimeout(async () => {
|
|
67
|
+
const space = getSpace(data.companionTo);
|
|
68
|
+
if (space && data.subject === 'assistant-chat') {
|
|
69
|
+
const result = await space.db
|
|
70
|
+
.query(Query.select(Filter.ids(data.companionTo.id)).targetOf(CompanionTo).source())
|
|
71
|
+
.run();
|
|
72
|
+
if (result.objects.length > 0) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const program = Effect.gen(function* () {
|
|
77
|
+
const { object } = yield* dispatch(createIntent(AssistantAction.CreateChat, { space }));
|
|
78
|
+
yield* dispatch(createIntent(SpaceAction.AddObject, { object, target: space, hidden: true }));
|
|
79
|
+
yield* dispatch(
|
|
80
|
+
createIntent(SpaceAction.AddRelation, {
|
|
81
|
+
space,
|
|
82
|
+
schema: CompanionTo,
|
|
83
|
+
source: object,
|
|
84
|
+
target: data.companionTo,
|
|
85
|
+
}),
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
void Effect.runPromise(program);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
return () => clearTimeout(timeout);
|
|
93
|
+
}, [data.subject]);
|
|
94
|
+
|
|
95
|
+
if (data.subject === 'assistant-chat') {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return <ChatContainer role={role} chat={data.subject} associatedArtifact={associatedArtifact} />;
|
|
55
100
|
},
|
|
56
101
|
}),
|
|
57
102
|
createSurface({
|
|
58
103
|
id: `${ASSISTANT_PLUGIN}/template`,
|
|
59
104
|
role: 'article',
|
|
60
|
-
filter: (data): data is { subject: TemplateType } =>
|
|
105
|
+
filter: (data): data is { subject: TemplateType } => Obj.instanceOf(TemplateType, data.subject),
|
|
61
106
|
component: ({ data, role }) => <TemplateContainer role={role} template={data.subject} />,
|
|
62
107
|
}),
|
|
63
108
|
createSurface({
|
|
64
109
|
id: `${ASSISTANT_PLUGIN}/prompt-settings`,
|
|
65
110
|
role: 'object-settings',
|
|
66
|
-
filter: (data): data is { subject: TemplateType } =>
|
|
111
|
+
filter: (data): data is { subject: TemplateType } => Obj.instanceOf(TemplateType, data.subject),
|
|
67
112
|
component: ({ data }) => <PromptSettings template={data.subject} />,
|
|
68
113
|
}),
|
|
69
114
|
]);
|
|
@@ -19,7 +19,7 @@ import { AmbientDialog } from './AmbientDialog';
|
|
|
19
19
|
import translations from '../../translations';
|
|
20
20
|
|
|
21
21
|
const meta: Meta<typeof AmbientDialog> = {
|
|
22
|
-
title: 'plugins/plugin-
|
|
22
|
+
title: 'plugins/plugin-assistant/AmbientDialog',
|
|
23
23
|
component: AmbientDialog,
|
|
24
24
|
render: () => {
|
|
25
25
|
const [open, setOpen] = useState(true);
|
|
@@ -69,7 +69,7 @@ const meta: Meta<typeof AmbientDialog> = {
|
|
|
69
69
|
plugins: [IntentPlugin()],
|
|
70
70
|
}),
|
|
71
71
|
withTheme,
|
|
72
|
-
withLayout({ fullscreen: true
|
|
72
|
+
withLayout({ fullscreen: true }),
|
|
73
73
|
],
|
|
74
74
|
parameters: {
|
|
75
75
|
translations,
|
|
@@ -15,10 +15,19 @@ const minSize = 5;
|
|
|
15
15
|
export type AmbientDialogProps = PropsWithChildren<{
|
|
16
16
|
open?: boolean;
|
|
17
17
|
title?: string;
|
|
18
|
+
resizeable?: boolean;
|
|
18
19
|
onOpenChange?: (open: boolean) => void;
|
|
20
|
+
onEscape?: () => void;
|
|
19
21
|
}>;
|
|
20
22
|
|
|
21
|
-
export const AmbientDialog = ({
|
|
23
|
+
export const AmbientDialog = ({
|
|
24
|
+
children,
|
|
25
|
+
open: controlledOpen,
|
|
26
|
+
title,
|
|
27
|
+
resizeable = true,
|
|
28
|
+
onOpenChange,
|
|
29
|
+
onEscape,
|
|
30
|
+
}: AmbientDialogProps) => {
|
|
22
31
|
const [resizeKey, setReizeKey] = useState(0);
|
|
23
32
|
const [size, setSize] = useState<Size>('min-content');
|
|
24
33
|
const [open, setOpen] = useState(controlledOpen);
|
|
@@ -47,26 +56,31 @@ export const AmbientDialog = ({ children, open: controlledOpen, title, onOpenCha
|
|
|
47
56
|
return (
|
|
48
57
|
<div role='none' className='dx-dialog__overlay bg-transparent pointer-events-none' data-block-align='end'>
|
|
49
58
|
<Dialog.Content
|
|
50
|
-
classNames='relative box-content
|
|
59
|
+
classNames='relative box-content p-0 md:is-[35rem] md:max-is-none overflow-hidden pointer-events-auto transition-[block-size] ease-in-out duration-0 [&:not([data-dx-resizing="true"])]:duration-200'
|
|
51
60
|
inOverlayLayout
|
|
52
61
|
{...resizeAttributes}
|
|
53
62
|
style={{
|
|
54
|
-
...sizeStyle(size, 'vertical', true),
|
|
63
|
+
...(resizeable ? sizeStyle(size, 'vertical', true) : {}),
|
|
55
64
|
maxBlockSize: 'calc(100dvh - env(safe-area-inset-bottom) - env(safe-area-inset-top) - 9rem)',
|
|
56
65
|
}}
|
|
66
|
+
onEscapeKeyDown={onEscape}
|
|
57
67
|
onInteractOutside={preventDefault}
|
|
58
68
|
>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
{(resizeable && (
|
|
70
|
+
<>
|
|
71
|
+
<ResizeHandle
|
|
72
|
+
key={resizeKey}
|
|
73
|
+
side='block-start'
|
|
74
|
+
defaultSize='min-content'
|
|
75
|
+
minSize={minSize}
|
|
76
|
+
fallbackSize={minSize}
|
|
77
|
+
iconPosition='center'
|
|
78
|
+
onSizeChange={setSize}
|
|
79
|
+
/>
|
|
68
80
|
|
|
69
|
-
|
|
81
|
+
<DialogHeader open={open} title={title} onToggle={handleToggle} />
|
|
82
|
+
</>
|
|
83
|
+
)) || <Dialog.Title srOnly />}
|
|
70
84
|
|
|
71
85
|
{children}
|
|
72
86
|
</Dialog.Content>
|
|
@@ -24,10 +24,10 @@ export const AssistantDialog: FC<{ chat?: AIChatType }> = ({ chat }) => {
|
|
|
24
24
|
return (
|
|
25
25
|
<AmbientDialog open={open} onOpenChange={setOpen} title={t('assistant dialog title')}>
|
|
26
26
|
<ThreadContainer
|
|
27
|
+
part={'dialog'}
|
|
27
28
|
chat={chat}
|
|
28
29
|
onOpenChange={setOpen}
|
|
29
30
|
settings={settings}
|
|
30
|
-
part={'dialog'}
|
|
31
31
|
transcription={transcription}
|
|
32
32
|
/>
|
|
33
33
|
</AmbientDialog>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { DEFAULT_EDGE_MODELS, DEFAULT_OLLAMA_MODELS } from '@dxos/
|
|
7
|
+
import { DEFAULT_EDGE_MODELS, DEFAULT_OLLAMA_MODELS } from '@dxos/ai';
|
|
8
8
|
import { Input, Select, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
import { DeprecatedFormContainer, DeprecatedFormInput } from '@dxos/react-ui-form';
|
|
10
10
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
|
|
7
|
+
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
|
+
|
|
9
|
+
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
10
|
+
|
|
11
|
+
import { BlueprintEditor } from './BlueprintEditor';
|
|
12
|
+
import { RESEARCH_BLUEPRINT } from '../../testing';
|
|
13
|
+
import translations from '../../translations';
|
|
14
|
+
|
|
15
|
+
const meta: Meta<typeof BlueprintEditor> = {
|
|
16
|
+
title: 'plugins/plugin-assistant/BlueprintEditor',
|
|
17
|
+
component: BlueprintEditor,
|
|
18
|
+
decorators: [withTheme, withLayout({ fullscreen: true, classNames: 'mli-auto max-is-[50rem] justify-center' })],
|
|
19
|
+
parameters: {
|
|
20
|
+
translations,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
|
|
26
|
+
type Story = StoryObj<typeof BlueprintEditor>;
|
|
27
|
+
|
|
28
|
+
export const Default: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
blueprint: RESEARCH_BLUEPRINT,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { Blueprint, type BlueprintParser } from '@dxos/assistant';
|
|
8
|
+
import { toJsonSchema } from '@dxos/echo-schema';
|
|
9
|
+
import { useThemeContext, type ThemedClassName } from '@dxos/react-ui';
|
|
10
|
+
import {
|
|
11
|
+
createBasicExtensions,
|
|
12
|
+
createJsonExtensions,
|
|
13
|
+
createThemeExtensions,
|
|
14
|
+
editorMonospace,
|
|
15
|
+
useTextEditor,
|
|
16
|
+
} from '@dxos/react-ui-editor';
|
|
17
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
18
|
+
|
|
19
|
+
export type BlueprintEditorProps = ThemedClassName<{
|
|
20
|
+
blueprint: BlueprintParser.DSL;
|
|
21
|
+
}>;
|
|
22
|
+
|
|
23
|
+
// TODO(burdon): Factor out JsonEditor.
|
|
24
|
+
// TODO(burdon): Make editable.
|
|
25
|
+
export const BlueprintEditor = ({ classNames, blueprint }: BlueprintEditorProps) => {
|
|
26
|
+
const { themeMode } = useThemeContext();
|
|
27
|
+
const { parentRef } = useTextEditor({
|
|
28
|
+
initialValue: JSON.stringify(blueprint, null, 2),
|
|
29
|
+
extensions: [
|
|
30
|
+
createBasicExtensions({ lineWrapping: false }),
|
|
31
|
+
createThemeExtensions({ themeMode, syntaxHighlighting: true }),
|
|
32
|
+
// TODO(burdon): ERROR: reference "/schemas/any" resolves to more than one schema
|
|
33
|
+
createJsonExtensions({ schema: toJsonSchema(Blueprint) }),
|
|
34
|
+
editorMonospace,
|
|
35
|
+
],
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div ref={parentRef} className={mx('flex w-full pli-2 overflow-x-scroll border-x border-separator', classNames)} />
|
|
40
|
+
);
|
|
41
|
+
};
|
|
@@ -7,17 +7,65 @@ import '@dxos-theme';
|
|
|
7
7
|
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
8
|
import React, { useEffect, useState } from 'react';
|
|
9
9
|
|
|
10
|
+
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
11
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
+
import { log } from '@dxos/log';
|
|
13
|
+
import { TranscriptionPlugin } from '@dxos/plugin-transcription';
|
|
10
14
|
import { withTheme, withLayout } from '@dxos/storybook-utils';
|
|
11
15
|
|
|
12
16
|
import { Prompt } from './Prompt';
|
|
13
|
-
import { PromptBar } from './PromptBar';
|
|
17
|
+
import { PromptBar, type PromptBarProps } from './PromptBar';
|
|
14
18
|
import type { ReferenceData } from './references';
|
|
15
19
|
import translations from '../../translations';
|
|
16
20
|
|
|
21
|
+
const references: ReferenceData[] = [
|
|
22
|
+
{
|
|
23
|
+
uri: 'dxn:echo:@:AAAAAAAA',
|
|
24
|
+
label: 'Meeting Notes',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
uri: 'dxn:echo:@:BBBBBBBB',
|
|
28
|
+
label: 'Project Plan',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
uri: 'dxn:echo:@:CCCCCCCC',
|
|
32
|
+
label: 'Meeting Plan',
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
const DefaultStory = (props: PromptBarProps) => {
|
|
37
|
+
const [processing, setProcessing] = useState(false);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
let t: NodeJS.Timeout;
|
|
40
|
+
if (processing) {
|
|
41
|
+
t = setTimeout(() => setProcessing(false), 10_000);
|
|
42
|
+
}
|
|
43
|
+
return () => clearTimeout(t);
|
|
44
|
+
}, [processing]);
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<PromptBar
|
|
48
|
+
classNames='w-[25rem] p-1 overflow-hidden border border-gray-200 rounded'
|
|
49
|
+
microphone
|
|
50
|
+
processing={processing}
|
|
51
|
+
onSubmit={() => setProcessing(true)}
|
|
52
|
+
onCancel={() => setProcessing(false)}
|
|
53
|
+
{...props}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
17
58
|
const meta: Meta<typeof Prompt> = {
|
|
18
|
-
title: 'plugins/plugin-
|
|
59
|
+
title: 'plugins/plugin-assistant/Prompt',
|
|
19
60
|
component: Prompt,
|
|
20
|
-
|
|
61
|
+
render: DefaultStory,
|
|
62
|
+
decorators: [
|
|
63
|
+
withPluginManager({
|
|
64
|
+
plugins: [IntentPlugin(), SettingsPlugin(), TranscriptionPlugin()],
|
|
65
|
+
}),
|
|
66
|
+
withTheme,
|
|
67
|
+
withLayout(),
|
|
68
|
+
],
|
|
21
69
|
parameters: {
|
|
22
70
|
layout: 'centered',
|
|
23
71
|
translations,
|
|
@@ -26,14 +74,14 @@ const meta: Meta<typeof Prompt> = {
|
|
|
26
74
|
|
|
27
75
|
export default meta;
|
|
28
76
|
|
|
29
|
-
type Story = StoryObj<typeof
|
|
77
|
+
type Story = StoryObj<typeof DefaultStory>;
|
|
30
78
|
|
|
31
|
-
export const Default: Story = {
|
|
79
|
+
export const Default: Story = {};
|
|
80
|
+
|
|
81
|
+
export const WithSuggestions: Story = {
|
|
32
82
|
args: {
|
|
33
|
-
classNames: 'w-96 p-4 rounded outline outline-gray-200',
|
|
34
|
-
autoFocus: true,
|
|
35
83
|
onSubmit: (text) => {
|
|
36
|
-
|
|
84
|
+
log('onSubmit', { text });
|
|
37
85
|
},
|
|
38
86
|
onSuggest: (text) => {
|
|
39
87
|
const trimmed = text.trim().toLowerCase();
|
|
@@ -54,60 +102,19 @@ export const Default: Story = {
|
|
|
54
102
|
},
|
|
55
103
|
};
|
|
56
104
|
|
|
57
|
-
export const
|
|
58
|
-
render: (args) => {
|
|
59
|
-
const [processing, setProcessing] = useState(false);
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
let t: NodeJS.Timeout;
|
|
62
|
-
if (processing) {
|
|
63
|
-
t = setTimeout(() => setProcessing(false), 10_000);
|
|
64
|
-
}
|
|
65
|
-
return () => clearTimeout(t);
|
|
66
|
-
}, [processing]);
|
|
67
|
-
console.log('processing', processing);
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<PromptBar
|
|
71
|
-
classNames='w-[25rem] p-1 overflow-hidden border border-gray-200 rounded'
|
|
72
|
-
microphone
|
|
73
|
-
processing={processing}
|
|
74
|
-
onSubmit={() => setProcessing(true)}
|
|
75
|
-
onCancel={() => setProcessing(false)}
|
|
76
|
-
{...args}
|
|
77
|
-
/>
|
|
78
|
-
);
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export const Includes: Story = {
|
|
105
|
+
export const WithReferences: Story = {
|
|
83
106
|
args: {
|
|
84
|
-
classNames: 'w-96 p-4 rounded outline outline-gray-200',
|
|
85
107
|
references: {
|
|
86
108
|
getReferences: async ({ query }) => {
|
|
87
109
|
const res = references.filter((i) => i.label.toLowerCase().startsWith(query.toLowerCase()));
|
|
88
|
-
|
|
110
|
+
log('getReferences', { query, res });
|
|
89
111
|
return res;
|
|
90
112
|
},
|
|
91
113
|
resolveReference: async ({ uri }) => {
|
|
92
114
|
const res = references.find((i) => i.uri === uri);
|
|
93
|
-
|
|
115
|
+
log('resolveReference', { uri, res });
|
|
94
116
|
return res ?? null;
|
|
95
117
|
},
|
|
96
118
|
},
|
|
97
119
|
},
|
|
98
120
|
};
|
|
99
|
-
|
|
100
|
-
const references: ReferenceData[] = [
|
|
101
|
-
{
|
|
102
|
-
uri: 'dxn:echo:@:AAAAAAAA',
|
|
103
|
-
label: 'Meeting Notes',
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
uri: 'dxn:echo:@:BBBBBBBB',
|
|
107
|
-
label: 'Project Plan',
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
uri: 'dxn:echo:@:CCCCCCCC',
|
|
111
|
-
label: 'Meeting Plan',
|
|
112
|
-
},
|
|
113
|
-
];
|
|
@@ -2,21 +2,22 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Prec } from '@codemirror/state';
|
|
5
|
+
import { type Extension, Prec } from '@codemirror/state';
|
|
6
6
|
import React, { forwardRef, useImperativeHandle } from 'react';
|
|
7
7
|
|
|
8
8
|
import { type ThemedClassName, useThemeContext } from '@dxos/react-ui';
|
|
9
9
|
import {
|
|
10
|
-
type BasicExtensionsOptions,
|
|
11
10
|
createBasicExtensions,
|
|
12
11
|
createThemeExtensions,
|
|
13
12
|
keymap,
|
|
14
13
|
useTextEditor,
|
|
14
|
+
type BasicExtensionsOptions,
|
|
15
15
|
type UseTextEditorProps,
|
|
16
16
|
} from '@dxos/react-ui-editor';
|
|
17
17
|
import { mx } from '@dxos/react-ui-theme';
|
|
18
|
+
import { isNonNullable } from '@dxos/util';
|
|
18
19
|
|
|
19
|
-
import {
|
|
20
|
+
import { autocompleteExtension, type AutocompleteOptions } from './autocomplete';
|
|
20
21
|
import { promptReferences, type ReferencesProvider } from './references';
|
|
21
22
|
|
|
22
23
|
// TODO(burdon): Handle object references.
|
|
@@ -28,8 +29,9 @@ export interface PromptController {
|
|
|
28
29
|
|
|
29
30
|
export type PromptProps = ThemedClassName<
|
|
30
31
|
{
|
|
31
|
-
|
|
32
|
+
extensions?: Extension;
|
|
32
33
|
references?: ReferencesProvider;
|
|
34
|
+
onOpenChange?: (open: boolean) => void;
|
|
33
35
|
} & AutocompleteOptions &
|
|
34
36
|
Pick<UseTextEditorProps, 'autoFocus'> &
|
|
35
37
|
Pick<BasicExtensionsOptions, 'lineWrapping' | 'placeholder'>
|
|
@@ -37,7 +39,18 @@ export type PromptProps = ThemedClassName<
|
|
|
37
39
|
|
|
38
40
|
export const Prompt = forwardRef<PromptController, PromptProps>(
|
|
39
41
|
(
|
|
40
|
-
{
|
|
42
|
+
{
|
|
43
|
+
classNames,
|
|
44
|
+
extensions,
|
|
45
|
+
references,
|
|
46
|
+
autoFocus,
|
|
47
|
+
lineWrapping = false,
|
|
48
|
+
placeholder,
|
|
49
|
+
onSubmit,
|
|
50
|
+
onSuggest,
|
|
51
|
+
onCancel,
|
|
52
|
+
onOpenChange,
|
|
53
|
+
},
|
|
41
54
|
forwardRef,
|
|
42
55
|
) => {
|
|
43
56
|
const { themeMode } = useThemeContext();
|
|
@@ -46,6 +59,7 @@ export const Prompt = forwardRef<PromptController, PromptProps>(
|
|
|
46
59
|
debug: true,
|
|
47
60
|
autoFocus,
|
|
48
61
|
extensions: [
|
|
62
|
+
autocompleteExtension({ onSubmit, onSuggest, onCancel }),
|
|
49
63
|
createBasicExtensions({
|
|
50
64
|
bracketMatching: false,
|
|
51
65
|
lineWrapping,
|
|
@@ -53,13 +67,12 @@ export const Prompt = forwardRef<PromptController, PromptProps>(
|
|
|
53
67
|
}),
|
|
54
68
|
createThemeExtensions({ themeMode }),
|
|
55
69
|
references ? promptReferences({ provider: references }) : [],
|
|
56
|
-
createAutocompleteExtension({ onSubmit, onSuggest }),
|
|
57
70
|
Prec.highest(
|
|
58
71
|
keymap.of([
|
|
59
72
|
{
|
|
60
73
|
key: 'cmd-ArrowUp',
|
|
61
74
|
preventDefault: true,
|
|
62
|
-
run: (
|
|
75
|
+
run: () => {
|
|
63
76
|
onOpenChange?.(true);
|
|
64
77
|
return true;
|
|
65
78
|
},
|
|
@@ -67,16 +80,17 @@ export const Prompt = forwardRef<PromptController, PromptProps>(
|
|
|
67
80
|
{
|
|
68
81
|
key: 'cmd-ArrowDown',
|
|
69
82
|
preventDefault: true,
|
|
70
|
-
run: (
|
|
83
|
+
run: () => {
|
|
71
84
|
onOpenChange?.(false);
|
|
72
85
|
return true;
|
|
73
86
|
},
|
|
74
87
|
},
|
|
75
88
|
]),
|
|
76
89
|
),
|
|
77
|
-
|
|
90
|
+
extensions,
|
|
91
|
+
].filter(isNonNullable),
|
|
78
92
|
},
|
|
79
|
-
[themeMode, onSubmit, onSuggest],
|
|
93
|
+
[themeMode, extensions, onSubmit, onSuggest],
|
|
80
94
|
);
|
|
81
95
|
|
|
82
96
|
// Expose editor view.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
|
|
7
|
+
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
|
+
import React, { useEffect, useState } from 'react';
|
|
9
|
+
|
|
10
|
+
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
11
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
+
import { log } from '@dxos/log';
|
|
13
|
+
import { TranscriptionPlugin } from '@dxos/plugin-transcription';
|
|
14
|
+
import { withTheme, withLayout } from '@dxos/storybook-utils';
|
|
15
|
+
|
|
16
|
+
import { PromptBar } from './PromptBar';
|
|
17
|
+
import translations from '../../translations';
|
|
18
|
+
|
|
19
|
+
const meta: Meta<typeof PromptBar> = {
|
|
20
|
+
title: 'plugins/plugin-assistant/PromptBar',
|
|
21
|
+
component: PromptBar,
|
|
22
|
+
decorators: [
|
|
23
|
+
withPluginManager({
|
|
24
|
+
plugins: [IntentPlugin(), SettingsPlugin(), TranscriptionPlugin()],
|
|
25
|
+
}),
|
|
26
|
+
withTheme,
|
|
27
|
+
withLayout(),
|
|
28
|
+
],
|
|
29
|
+
parameters: {
|
|
30
|
+
layout: 'centered',
|
|
31
|
+
translations,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default meta;
|
|
36
|
+
|
|
37
|
+
type Story = StoryObj<typeof PromptBar>;
|
|
38
|
+
|
|
39
|
+
export const Default: Story = {
|
|
40
|
+
// args: {
|
|
41
|
+
// classNames: 'w-96 p-4 rounded outline outline-gray-200',
|
|
42
|
+
// },
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const Toolbar: Story = {
|
|
46
|
+
render: (args) => {
|
|
47
|
+
const [processing, setProcessing] = useState(false);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
let t: NodeJS.Timeout;
|
|
50
|
+
if (processing) {
|
|
51
|
+
t = setTimeout(() => setProcessing(false), 10_000);
|
|
52
|
+
}
|
|
53
|
+
return () => clearTimeout(t);
|
|
54
|
+
}, [processing]);
|
|
55
|
+
log.info('processing', { processing });
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<PromptBar
|
|
59
|
+
classNames='w-[25rem] p-1 overflow-hidden border border-gray-200 rounded'
|
|
60
|
+
microphone
|
|
61
|
+
processing={processing}
|
|
62
|
+
onSubmit={() => setProcessing(true)}
|
|
63
|
+
onCancel={() => setProcessing(false)}
|
|
64
|
+
{...args}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
};
|