@dxos/plugin-assistant 0.8.3-staging.0fa589b → 0.8.4-main.f9ba587
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/ChatContainer-6XNB5NEI.mjs +57 -0
- package/dist/lib/browser/ChatContainer-6XNB5NEI.mjs.map +7 -0
- package/dist/lib/browser/ChatDialog-IMWPRXTO.mjs +74 -0
- package/dist/lib/browser/ChatDialog-IMWPRXTO.mjs.map +7 -0
- package/dist/lib/browser/{BlueprintContainer-AT5Y7EXG.mjs → SequenceContainer-6XOYB2RN.mjs} +38 -37
- package/dist/lib/browser/SequenceContainer-6XOYB2RN.mjs.map +7 -0
- package/dist/lib/browser/{TemplateContainer-QQHVOTSI.mjs → TemplateContainer-6ZGGH5T4.mjs} +4 -4
- package/dist/lib/browser/TemplateContainer-6ZGGH5T4.mjs.map +7 -0
- package/dist/lib/browser/{ai-client-MK2ZZII2.mjs → ai-client-ML7OQWAO.mjs} +6 -6
- package/dist/lib/browser/ai-client-ML7OQWAO.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-E4H5DCOJ.mjs → app-graph-builder-UJ5NHRGK.mjs} +31 -33
- package/dist/lib/browser/app-graph-builder-UJ5NHRGK.mjs.map +7 -0
- package/dist/lib/browser/{chunk-JQFUME3B.mjs → chunk-44HZKIAW.mjs} +5 -5
- package/dist/lib/browser/chunk-44HZKIAW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-XOZ7YMO3.mjs → chunk-LKP65RPA.mjs} +2 -2
- package/dist/lib/browser/chunk-NTBGTFTV.mjs +15 -0
- package/dist/lib/browser/chunk-NTBGTFTV.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BI6AHRNJ.mjs → chunk-OZL4OHTU.mjs} +15 -15
- package/dist/lib/browser/chunk-OZL4OHTU.mjs.map +7 -0
- package/dist/lib/browser/chunk-TQ3QW3HJ.mjs +2072 -0
- package/dist/lib/browser/chunk-TQ3QW3HJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-AAOKC2JN.mjs → chunk-TU7UUGWQ.mjs} +68 -73
- package/dist/lib/browser/chunk-TU7UUGWQ.mjs.map +7 -0
- package/dist/lib/browser/chunk-WPZ4UANI.mjs +16 -0
- package/dist/lib/browser/index.mjs +53 -68
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-3UICTGPM.mjs → intent-resolver-LEAPB55Q.mjs} +10 -11
- package/dist/lib/browser/intent-resolver-LEAPB55Q.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-LXCNUSZN.mjs → react-surface-TMF7JJA4.mjs} +34 -37
- package/dist/lib/browser/react-surface-TMF7JJA4.mjs.map +7 -0
- package/dist/lib/browser/{settings-XRHXVWGB.mjs → settings-N4HEXADL.mjs} +6 -6
- package/dist/lib/browser/settings-N4HEXADL.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -10
- package/dist/lib/node-esm/ChatContainer-VOLG7J6N.mjs +58 -0
- package/dist/lib/node-esm/ChatContainer-VOLG7J6N.mjs.map +7 -0
- package/dist/lib/node-esm/ChatDialog-B2XNUNRM.mjs +75 -0
- package/dist/lib/node-esm/ChatDialog-B2XNUNRM.mjs.map +7 -0
- package/dist/lib/node-esm/{BlueprintContainer-STOJAVML.mjs → SequenceContainer-WWG6IMN3.mjs} +38 -37
- package/dist/lib/node-esm/SequenceContainer-WWG6IMN3.mjs.map +7 -0
- package/dist/lib/node-esm/{TemplateContainer-SOEWY2ZN.mjs → TemplateContainer-6KRNEMVE.mjs} +4 -4
- package/dist/lib/node-esm/TemplateContainer-6KRNEMVE.mjs.map +7 -0
- package/dist/lib/node-esm/{ai-client-XGZBJ6BE.mjs → ai-client-2FQ434CT.mjs} +6 -6
- package/dist/lib/node-esm/ai-client-2FQ434CT.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-3SY5MBIK.mjs → app-graph-builder-MEQ5CYNI.mjs} +31 -33
- package/dist/lib/node-esm/app-graph-builder-MEQ5CYNI.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-D3HTVK5D.mjs +2073 -0
- package/dist/lib/node-esm/chunk-D3HTVK5D.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3UEZLJ2V.mjs → chunk-E6V2RUQ2.mjs} +5 -5
- package/dist/lib/node-esm/chunk-E6V2RUQ2.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UCOFKNKN.mjs → chunk-HVMVHP4R.mjs} +15 -15
- package/dist/lib/node-esm/chunk-HVMVHP4R.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HXKRKIN2.mjs +18 -0
- package/dist/lib/node-esm/{chunk-BB2TAT4P.mjs → chunk-KOC6ESG7.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-OYN6HLXZ.mjs → chunk-VESVUAOS.mjs} +5 -5
- package/dist/lib/node-esm/chunk-VESVUAOS.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-J6UXXZGJ.mjs → chunk-YYUVTTVK.mjs} +68 -73
- package/dist/lib/node-esm/chunk-YYUVTTVK.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +53 -68
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-E6MXTYAU.mjs → intent-resolver-4ULF3F7U.mjs} +10 -11
- package/dist/lib/node-esm/intent-resolver-4ULF3F7U.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-7HA5EDWY.mjs → react-surface-6XL6SWL2.mjs} +34 -37
- package/dist/lib/node-esm/react-surface-6XL6SWL2.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-5IAY6BT4.mjs → settings-WQ76EG6O.mjs} +6 -6
- package/dist/lib/node-esm/settings-WQ76EG6O.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +4 -10
- 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.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +2 -2
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +42 -0
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -0
- package/dist/types/src/components/Chat/index.d.ts +2 -0
- package/dist/types/src/components/Chat/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +5 -5
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts +8 -0
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts +10 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +9 -0
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +11 -0
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +7 -0
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/events.d.ts +17 -0
- package/dist/types/src/components/ChatPrompt/events.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/index.d.ts +6 -0
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -0
- package/dist/types/src/components/{Thread/ThreadMessage.d.ts → ChatThread/ChatMessage.d.ts} +6 -4
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +25 -0
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +232 -0
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +18 -0
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/index.d.ts +2 -0
- package/dist/types/src/components/ChatThread/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +1 -0
- package/dist/types/src/components/SequenceContainer.d.ts +9 -0
- package/dist/types/src/components/SequenceContainer.d.ts.map +1 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +13 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +8 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/SequenceEditor/index.d.ts +2 -0
- package/dist/types/src/components/SequenceEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateContainer.d.ts +4 -3
- package/dist/types/src/components/TemplateContainer.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +10 -3
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +6 -12
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/hooks/{processor.d.ts → chat-processor.d.ts} +27 -17
- package/dist/types/src/hooks/chat-processor.d.ts.map +1 -0
- package/dist/types/src/hooks/chat-processor.test.d.ts +2 -0
- package/dist/types/src/hooks/chat-processor.test.d.ts.map +1 -0
- 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/useBlueprints.d.ts +4 -0
- package/dist/types/src/hooks/useBlueprints.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +20 -6
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextProvider.d.ts +6 -0
- package/dist/types/src/hooks/useContextProvider.d.ts.map +1 -1
- package/dist/types/src/hooks/useServiceContainer.d.ts +8 -0
- package/dist/types/src/hooks/useServiceContainer.d.ts.map +1 -0
- package/dist/types/src/queue-logger.d.ts +5 -5
- package/dist/types/src/queue-logger.d.ts.map +1 -1
- package/dist/types/src/stories/Chat.stories.d.ts +199 -0
- package/dist/types/src/stories/Chat.stories.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-sequence.d.ts +8 -0
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +61 -113
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +71 -0
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/src/types/service.d.ts +6 -6
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +76 -74
- package/src/AssistantPlugin.tsx +13 -13
- package/src/capabilities/ai-client.ts +3 -6
- package/src/capabilities/app-graph-builder.ts +30 -26
- package/src/capabilities/capabilities.ts +2 -3
- package/src/capabilities/intent-resolver.ts +6 -6
- package/src/capabilities/react-surface.tsx +29 -29
- package/src/capabilities/settings.ts +3 -3
- package/src/components/AssistantSettings/AssistantSettings.tsx +4 -4
- package/src/components/Chat/Chat.tsx +348 -0
- package/src/{experimental/transcription → components/Chat}/index.ts +2 -0
- package/src/components/ChatContainer.tsx +24 -18
- package/src/components/ChatDialog.tsx +65 -0
- package/src/components/ChatPrompt/ChatActions.tsx +76 -0
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +52 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +52 -0
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +26 -0
- package/src/components/ChatPrompt/events.ts +12 -0
- package/src/components/ChatPrompt/index.ts +10 -0
- package/src/components/{Thread/ThreadMessage.tsx → ChatThread/ChatMessage.tsx} +35 -31
- package/src/components/ChatThread/ChatThread.stories.tsx +148 -0
- package/src/components/ChatThread/ChatThread.tsx +68 -0
- package/src/components/{Thread/ToolInvocations.tsx → ChatThread/ToolBlock.tsx} +13 -8
- package/src/components/{AmbientDialog → ChatThread}/index.ts +1 -1
- package/src/components/PromptSettings.tsx +2 -2
- package/src/components/{BlueprintContainer.tsx → SequenceContainer.tsx} +23 -32
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +32 -0
- package/src/components/{BlueprintEditor/BlueprintEditor.tsx → SequenceEditor/SequenceEditor.tsx} +7 -7
- package/src/components/SequenceEditor/index.ts +5 -0
- package/src/components/TemplateContainer.tsx +7 -5
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +2 -2
- package/src/components/TemplateEditor/TemplateEditor.tsx +2 -2
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +2 -2
- package/src/components/TemplateEditor/TemplateForm.tsx +2 -3
- package/src/components/Toolbox/Toolbox.stories.tsx +4 -5
- package/src/components/Toolbox/Toolbox.tsx +56 -3
- package/src/components/index.ts +4 -5
- package/src/events.ts +2 -2
- package/src/hooks/{processor.test.ts → chat-processor.test.ts} +1 -1
- package/src/hooks/{processor.ts → chat-processor.ts} +115 -72
- package/src/hooks/index.ts +4 -4
- package/src/hooks/useBlueprints.ts +31 -0
- package/src/hooks/useChatProcessor.tsx +69 -24
- package/src/hooks/useContextProvider.ts +8 -2
- package/src/hooks/useServiceContainer.ts +42 -0
- package/src/queue-logger.ts +6 -6
- package/src/stories/Chat.stories.tsx +269 -0
- package/src/testing/index.ts +1 -1
- package/src/testing/{test-blueprint.ts → test-sequence.ts} +4 -9
- package/src/tools/openapi.test.ts +11 -11
- package/src/translations.ts +24 -22
- package/src/types/index.ts +1 -2
- package/src/types/schema.ts +86 -0
- package/dist/lib/browser/AssistantDialog-MQOOR364.mjs +0 -47
- package/dist/lib/browser/AssistantDialog-MQOOR364.mjs.map +0 -7
- package/dist/lib/browser/BlueprintContainer-AT5Y7EXG.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-C2NEAS3A.mjs +0 -40
- package/dist/lib/browser/ChatContainer-C2NEAS3A.mjs.map +0 -7
- package/dist/lib/browser/TemplateContainer-QQHVOTSI.mjs.map +0 -7
- package/dist/lib/browser/ai-client-MK2ZZII2.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-E4H5DCOJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-AAOKC2JN.mjs.map +0 -7
- package/dist/lib/browser/chunk-BI6AHRNJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-JO4W3MF7.mjs +0 -2101
- package/dist/lib/browser/chunk-JO4W3MF7.mjs.map +0 -7
- package/dist/lib/browser/chunk-JQFUME3B.mjs.map +0 -7
- package/dist/lib/browser/chunk-MEGMOFJB.mjs +0 -16
- package/dist/lib/browser/chunk-Q6UZ4F3H.mjs +0 -96
- package/dist/lib/browser/chunk-Q6UZ4F3H.mjs.map +0 -7
- package/dist/lib/browser/chunk-UE3IZ4PN.mjs +0 -15
- package/dist/lib/browser/chunk-UE3IZ4PN.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-3UICTGPM.mjs.map +0 -7
- package/dist/lib/browser/react-surface-LXCNUSZN.mjs.map +0 -7
- package/dist/lib/browser/settings-XRHXVWGB.mjs.map +0 -7
- package/dist/lib/node/AssistantDialog-AN4Z6YUV.cjs +0 -73
- package/dist/lib/node/AssistantDialog-AN4Z6YUV.cjs.map +0 -7
- package/dist/lib/node/BlueprintContainer-NOWLDYCZ.cjs +0 -344
- package/dist/lib/node/BlueprintContainer-NOWLDYCZ.cjs.map +0 -7
- package/dist/lib/node/ChatContainer-VKYBQHUB.cjs +0 -68
- package/dist/lib/node/ChatContainer-VKYBQHUB.cjs.map +0 -7
- package/dist/lib/node/TemplateContainer-JZF2DCCG.cjs +0 -58
- package/dist/lib/node/TemplateContainer-JZF2DCCG.cjs.map +0 -7
- package/dist/lib/node/ai-client-7HNSMUMT.cjs +0 -53
- package/dist/lib/node/ai-client-7HNSMUMT.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-PPR5B5KU.cjs +0 -235
- package/dist/lib/node/app-graph-builder-PPR5B5KU.cjs.map +0 -7
- package/dist/lib/node/chunk-4EEWTDQK.cjs +0 -117
- package/dist/lib/node/chunk-4EEWTDQK.cjs.map +0 -7
- package/dist/lib/node/chunk-FUAGEO7Q.cjs +0 -52
- package/dist/lib/node/chunk-FUAGEO7Q.cjs.map +0 -7
- package/dist/lib/node/chunk-HRNIUYVQ.cjs +0 -128
- package/dist/lib/node/chunk-HRNIUYVQ.cjs.map +0 -7
- package/dist/lib/node/chunk-IKZBMHSW.cjs +0 -184
- package/dist/lib/node/chunk-IKZBMHSW.cjs.map +0 -7
- package/dist/lib/node/chunk-LMDJEGZ2.cjs +0 -233
- package/dist/lib/node/chunk-LMDJEGZ2.cjs.map +0 -7
- package/dist/lib/node/chunk-NIDICM57.cjs +0 -2080
- package/dist/lib/node/chunk-NIDICM57.cjs.map +0 -7
- package/dist/lib/node/chunk-P74TWGMG.cjs +0 -44
- package/dist/lib/node/chunk-P74TWGMG.cjs.map +0 -7
- package/dist/lib/node/chunk-QGPWY6GW.cjs +0 -34
- package/dist/lib/node/chunk-QGPWY6GW.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -289
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-QSWGTKON.cjs +0 -58
- package/dist/lib/node/intent-resolver-QSWGTKON.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/react-surface-D3NBYRZ6.cjs +0 -172
- package/dist/lib/node/react-surface-D3NBYRZ6.cjs.map +0 -7
- package/dist/lib/node/settings-2JXLKYGE.cjs +0 -36
- package/dist/lib/node/settings-2JXLKYGE.cjs.map +0 -7
- package/dist/lib/node/types/index.cjs +0 -54
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/AssistantDialog-6WEMLUPU.mjs +0 -48
- package/dist/lib/node-esm/AssistantDialog-6WEMLUPU.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-STOJAVML.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-3MVBTUJN.mjs +0 -41
- package/dist/lib/node-esm/ChatContainer-3MVBTUJN.mjs.map +0 -7
- package/dist/lib/node-esm/TemplateContainer-SOEWY2ZN.mjs.map +0 -7
- package/dist/lib/node-esm/ai-client-XGZBJ6BE.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-3SY5MBIK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-34EX6E5Q.mjs +0 -18
- package/dist/lib/node-esm/chunk-3UEZLJ2V.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CDAILLCU.mjs +0 -98
- package/dist/lib/node-esm/chunk-CDAILLCU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-J6UXXZGJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OD574YIU.mjs +0 -2102
- package/dist/lib/node-esm/chunk-OD574YIU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OYN6HLXZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UCOFKNKN.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-E6MXTYAU.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-7HA5EDWY.mjs.map +0 -7
- package/dist/lib/node-esm/settings-5IAY6BT4.mjs.map +0 -7
- package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts +0 -10
- package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts.map +0 -1
- package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts +0 -8
- package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/AmbientDialog/index.d.ts +0 -2
- package/dist/types/src/components/AmbientDialog/index.d.ts.map +0 -1
- package/dist/types/src/components/AssistantDialog.d.ts +0 -7
- package/dist/types/src/components/AssistantDialog.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintContainer.d.ts +0 -9
- package/dist/types/src/components/BlueprintContainer.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts +0 -13
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.stories.d.ts +0 -8
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintEditor/index.d.ts +0 -2
- package/dist/types/src/components/BlueprintEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/Prompt.d.ts +0 -23
- package/dist/types/src/components/Prompt/Prompt.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts +0 -13
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/PromptBar.d.ts +0 -16
- package/dist/types/src/components/Prompt/PromptBar.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/PromptBar.stories.d.ts +0 -9
- package/dist/types/src/components/Prompt/PromptBar.stories.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/autocomplete.d.ts +0 -25
- package/dist/types/src/components/Prompt/autocomplete.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/index.d.ts +0 -3
- package/dist/types/src/components/Prompt/index.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/references.d.ts +0 -30
- package/dist/types/src/components/Prompt/references.d.ts.map +0 -1
- package/dist/types/src/components/Thread/Thread.d.ts +0 -28
- package/dist/types/src/components/Thread/Thread.d.ts.map +0 -1
- package/dist/types/src/components/Thread/Thread.stories.d.ts +0 -11
- package/dist/types/src/components/Thread/Thread.stories.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ThreadContainer.d.ts +0 -13
- package/dist/types/src/components/Thread/ThreadContainer.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts +0 -16
- package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ToolInvocations.d.ts +0 -13
- package/dist/types/src/components/Thread/ToolInvocations.d.ts.map +0 -1
- package/dist/types/src/components/Thread/index.d.ts +0 -3
- package/dist/types/src/components/Thread/index.d.ts.map +0 -1
- package/dist/types/src/components/Thread/reducer.d.ts.map +0 -1
- package/dist/types/src/experimental/transcription/index.d.ts +0 -1
- package/dist/types/src/experimental/transcription/index.d.ts.map +0 -1
- package/dist/types/src/hooks/processor.d.ts.map +0 -1
- package/dist/types/src/hooks/processor.test.d.ts +0 -2
- package/dist/types/src/hooks/processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/useMessageQueue.d.ts +0 -42
- package/dist/types/src/hooks/useMessageQueue.d.ts.map +0 -1
- package/dist/types/src/hooks/useServices.d.ts +0 -7
- package/dist/types/src/hooks/useServices.d.ts.map +0 -1
- package/dist/types/src/stories/Prompt.stories.d.ts +0 -8
- package/dist/types/src/stories/Prompt.stories.d.ts.map +0 -1
- package/dist/types/src/stories/Query.stories.d.ts +0 -19
- package/dist/types/src/stories/Query.stories.d.ts.map +0 -1
- package/dist/types/src/stories/Research.stories.d.ts +0 -15
- package/dist/types/src/stories/Research.stories.d.ts.map +0 -1
- package/dist/types/src/stories/test-data.d.ts +0 -3
- package/dist/types/src/stories/test-data.d.ts.map +0 -1
- package/dist/types/src/stories/testing.d.ts +0 -12
- package/dist/types/src/stories/testing.d.ts.map +0 -1
- package/dist/types/src/testing/test-blueprint.d.ts +0 -8
- package/dist/types/src/testing/test-blueprint.d.ts.map +0 -1
- package/dist/types/src/types/chat.d.ts +0 -23
- package/dist/types/src/types/chat.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -50
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/components/AmbientDialog/AmbientDialog.stories.tsx +0 -84
- package/src/components/AmbientDialog/AmbientDialog.tsx +0 -117
- package/src/components/AssistantDialog.tsx +0 -37
- package/src/components/BlueprintEditor/BlueprintEditor.stories.tsx +0 -32
- package/src/components/BlueprintEditor/index.ts +0 -5
- package/src/components/Prompt/Prompt.stories.tsx +0 -121
- package/src/components/Prompt/Prompt.tsx +0 -124
- package/src/components/Prompt/PromptBar.stories.tsx +0 -69
- package/src/components/Prompt/PromptBar.tsx +0 -105
- package/src/components/Prompt/autocomplete.ts +0 -218
- package/src/components/Prompt/index.ts +0 -6
- package/src/components/Prompt/references.ts +0 -180
- package/src/components/Thread/Thread.stories.tsx +0 -201
- package/src/components/Thread/Thread.tsx +0 -118
- package/src/components/Thread/ThreadContainer.stories.tsx +0 -283
- package/src/components/Thread/ThreadContainer.tsx +0 -105
- package/src/components/Thread/index.ts +0 -6
- package/src/hooks/useMessageQueue.ts +0 -22
- package/src/hooks/useServices.ts +0 -28
- package/src/stories/Prompt.stories.tsx +0 -60
- package/src/stories/Query.stories.tsx +0 -514
- package/src/stories/Research.stories.tsx +0 -482
- package/src/stories/test-data.ts +0 -128
- package/src/stories/testing.ts +0 -60
- package/src/types/chat.ts +0 -32
- package/src/types/types.ts +0 -48
- /package/dist/lib/browser/{chunk-XOZ7YMO3.mjs.map → chunk-LKP65RPA.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-MEGMOFJB.mjs.map → chunk-WPZ4UANI.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-34EX6E5Q.mjs.map → chunk-HXKRKIN2.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-BB2TAT4P.mjs.map → chunk-KOC6ESG7.mjs.map} +0 -0
- /package/dist/types/src/components/{Thread → ChatThread}/reducer.d.ts +0 -0
- /package/src/components/{Thread → ChatThread}/reducer.ts +0 -0
|
@@ -1,514 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type Meta, type StoryObj } from '@storybook/react';
|
|
8
|
-
import { Match, Schema } from 'effect';
|
|
9
|
-
import React, { useCallback, useEffect, useMemo, useRef, useState, type FC } from 'react';
|
|
10
|
-
|
|
11
|
-
import { EdgeAiServiceClient, type AiServiceEdgeClientOptions } from '@dxos/ai';
|
|
12
|
-
import { SpyAiService } from '@dxos/ai/testing';
|
|
13
|
-
import { Events } from '@dxos/app-framework';
|
|
14
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
15
|
-
import { localServiceEndpoints, remoteServiceEndpoints } from '@dxos/artifact-testing';
|
|
16
|
-
import { BlueprintMachine, BlueprintParser, BufferedLogger, setConsolePrinter, setLogger } from '@dxos/assistant';
|
|
17
|
-
import { combine } from '@dxos/async';
|
|
18
|
-
import { Queue, type Space } from '@dxos/client/echo';
|
|
19
|
-
import { DXN, Filter, Obj, Ref, Type } from '@dxos/echo';
|
|
20
|
-
import { SelectionModel } from '@dxos/graph';
|
|
21
|
-
import { log } from '@dxos/log';
|
|
22
|
-
import { D3ForceGraph, type D3ForceGraphProps } from '@dxos/plugin-explorer';
|
|
23
|
-
import { faker } from '@dxos/random';
|
|
24
|
-
import { useClient } from '@dxos/react-client';
|
|
25
|
-
import { useQueue } from '@dxos/react-client/echo';
|
|
26
|
-
import { Dialog, IconButton, Toolbar, useAsyncState, useTranslation } from '@dxos/react-ui';
|
|
27
|
-
import {
|
|
28
|
-
matchCompletion,
|
|
29
|
-
typeahead,
|
|
30
|
-
staticCompletion,
|
|
31
|
-
type TypeaheadContext,
|
|
32
|
-
type TypeaheadOptions,
|
|
33
|
-
} from '@dxos/react-ui-editor';
|
|
34
|
-
import { List } from '@dxos/react-ui-list';
|
|
35
|
-
import { JsonFilter } from '@dxos/react-ui-syntax-highlighter';
|
|
36
|
-
import { getHashColor, mx } from '@dxos/react-ui-theme';
|
|
37
|
-
import { DataType, DataTypes, SpaceGraphModel } from '@dxos/schema';
|
|
38
|
-
import { createObjectFactory, type TypeSpec, type ValueGenerator } from '@dxos/schema/testing';
|
|
39
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
40
|
-
|
|
41
|
-
import { addTestData } from './test-data';
|
|
42
|
-
import { testPlugins } from './testing';
|
|
43
|
-
import { AmbientDialog, PromptBar, type PromptBarProps, type PromptController } from '../components';
|
|
44
|
-
import { ASSISTANT_PLUGIN } from '../meta';
|
|
45
|
-
import { QueryParser, createFilter, type Expression } from '../parser';
|
|
46
|
-
import { createToolRegistry, RESEARCH_BLUEPRINT } from '../testing';
|
|
47
|
-
import translations from '../translations';
|
|
48
|
-
|
|
49
|
-
faker.seed(1);
|
|
50
|
-
|
|
51
|
-
// TODO(burdon): Evolve dxos/random to support this directly.
|
|
52
|
-
const generator = faker as any as ValueGenerator;
|
|
53
|
-
|
|
54
|
-
const LOCAL = false;
|
|
55
|
-
const endpoints = LOCAL ? localServiceEndpoints : remoteServiceEndpoints;
|
|
56
|
-
|
|
57
|
-
// TODO(burdon) Move to story args.
|
|
58
|
-
const aiConfig: AiServiceEdgeClientOptions = {
|
|
59
|
-
endpoint: endpoints.ai,
|
|
60
|
-
defaultGenerationOptions: {
|
|
61
|
-
model: '@anthropic/claude-3-5-sonnet-20241022',
|
|
62
|
-
// model: '@anthropic/claude-sonnet-4-20250514',
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Container for a set of ephemeral research results.
|
|
68
|
-
*/
|
|
69
|
-
const ResearchGraph = Schema.Struct({
|
|
70
|
-
queue: Type.Ref(Queue),
|
|
71
|
-
}).pipe(
|
|
72
|
-
Type.Obj({
|
|
73
|
-
typename: 'dxos.org/type/ResearchGraph',
|
|
74
|
-
version: '0.1.0',
|
|
75
|
-
}),
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
type Mode = 'graph' | 'list';
|
|
79
|
-
|
|
80
|
-
type StoryProps = { mode?: Mode; spec?: TypeSpec[] } & D3ForceGraphProps;
|
|
81
|
-
|
|
82
|
-
const DefaultStory = ({ mode, spec, ...props }: StoryProps) => {
|
|
83
|
-
const { t } = useTranslation(ASSISTANT_PLUGIN);
|
|
84
|
-
const showList = mode !== 'graph';
|
|
85
|
-
const showGraph = mode !== 'list';
|
|
86
|
-
|
|
87
|
-
const [ast, setAst] = useState<Expression | undefined>();
|
|
88
|
-
const [filter, setFilter] = useState<Filter.Any>();
|
|
89
|
-
|
|
90
|
-
const selection = useMemo(() => new SelectionModel(), []);
|
|
91
|
-
|
|
92
|
-
//
|
|
93
|
-
// Graph
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
const [model] = useState<SpaceGraphModel | undefined>(() => {
|
|
97
|
-
if (!showGraph) {
|
|
98
|
-
return undefined;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return new SpaceGraphModel().setOptions({
|
|
102
|
-
onCreateEdge: (edge, relation) => {
|
|
103
|
-
// TODO(burdon): Check type.
|
|
104
|
-
if ((relation as any).active === false) {
|
|
105
|
-
edge.data.force = false;
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
const client = useClient();
|
|
112
|
-
const [space, setSpace] = useState<Space | undefined>();
|
|
113
|
-
useEffect(() => {
|
|
114
|
-
const spaces = client.spaces.get().filter((space) => space.isOpen);
|
|
115
|
-
if (spaces.length) {
|
|
116
|
-
setSpace(spaces[0]);
|
|
117
|
-
}
|
|
118
|
-
}, [client]);
|
|
119
|
-
|
|
120
|
-
const [researchGraph] = useAsyncState(async () => {
|
|
121
|
-
if (!space) {
|
|
122
|
-
return undefined;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const { objects } = await space.db.query(Filter.type(ResearchGraph)).run();
|
|
126
|
-
if (objects.length > 0) {
|
|
127
|
-
return objects[0];
|
|
128
|
-
} else {
|
|
129
|
-
const queue = space.queues.create();
|
|
130
|
-
return space.db.add(
|
|
131
|
-
Obj.make(ResearchGraph, {
|
|
132
|
-
queue: Ref.fromDXN(queue.dxn),
|
|
133
|
-
}),
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
}, [space]);
|
|
137
|
-
|
|
138
|
-
useEffect(() => {
|
|
139
|
-
model?.setFilter(filter ?? Filter.everything());
|
|
140
|
-
}, [model, filter]);
|
|
141
|
-
|
|
142
|
-
useEffect(() => {
|
|
143
|
-
if (!space || !model) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const queue = researchGraph?.queue && space.queues.get(researchGraph.queue.dxn);
|
|
148
|
-
void model.open(space, queue);
|
|
149
|
-
return () => {
|
|
150
|
-
void model.close();
|
|
151
|
-
};
|
|
152
|
-
}, [space, model, researchGraph?.queue.dxn.toString()]);
|
|
153
|
-
|
|
154
|
-
// TODO(burdon): Hack to filter out invalid (queue) objects.
|
|
155
|
-
const objects =
|
|
156
|
-
model?.nodes
|
|
157
|
-
.filter((node) => {
|
|
158
|
-
try {
|
|
159
|
-
Obj.getTypename(node.data.object as Obj.Any);
|
|
160
|
-
return true;
|
|
161
|
-
} catch {
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
})
|
|
165
|
-
.map((node) => node.data.object as Obj.Any) ?? [];
|
|
166
|
-
|
|
167
|
-
//
|
|
168
|
-
// AI
|
|
169
|
-
//
|
|
170
|
-
|
|
171
|
-
const aiClient = useMemo(() => new SpyAiService(new EdgeAiServiceClient(aiConfig)), []);
|
|
172
|
-
const tools = useMemo(
|
|
173
|
-
() => space && researchGraph && createToolRegistry(space, researchGraph.queue.dxn),
|
|
174
|
-
[space, researchGraph?.queue.dxn],
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
const researchQueue = useQueue(researchGraph?.queue.dxn, { pollInterval: 1_000 });
|
|
178
|
-
|
|
179
|
-
const researchBlueprint = useMemo(() => BlueprintParser.create().parse(RESEARCH_BLUEPRINT), []);
|
|
180
|
-
|
|
181
|
-
const logger = useMemo(() => new BufferedLogger(), []);
|
|
182
|
-
|
|
183
|
-
//
|
|
184
|
-
// Handlers
|
|
185
|
-
//
|
|
186
|
-
|
|
187
|
-
const handleRefresh = useCallback(() => {
|
|
188
|
-
model?.invalidate();
|
|
189
|
-
}, [model]);
|
|
190
|
-
|
|
191
|
-
const handleResearch = useCallback(async () => {
|
|
192
|
-
if (!space || !tools || !researchBlueprint) {
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
const resolver = space.db.graph.createRefResolver({
|
|
197
|
-
context: {
|
|
198
|
-
space: space.db.spaceId,
|
|
199
|
-
queue: researchGraph?.queue.dxn,
|
|
200
|
-
},
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
const selected = selection.selected.value;
|
|
204
|
-
const objects = await Promise.all(selected.map((id) => resolver.resolve(DXN.fromLocalObjectId(id))));
|
|
205
|
-
const machine = new BlueprintMachine(tools, researchBlueprint);
|
|
206
|
-
const cleanup = combine(setConsolePrinter(machine, true), setLogger(machine, logger));
|
|
207
|
-
|
|
208
|
-
log.info('starting research...', { selected });
|
|
209
|
-
await machine.runToCompletion({ aiClient, input: objects });
|
|
210
|
-
|
|
211
|
-
cleanup();
|
|
212
|
-
}, [space, aiClient, tools, researchBlueprint, selection]);
|
|
213
|
-
|
|
214
|
-
const handleGenerate = useCallback(async () => {
|
|
215
|
-
if (!space) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
if (spec) {
|
|
220
|
-
const createObjects = createObjectFactory(space.db, generator);
|
|
221
|
-
await createObjects(spec);
|
|
222
|
-
} else {
|
|
223
|
-
await addTestData(space);
|
|
224
|
-
}
|
|
225
|
-
}, [space, generator, spec]);
|
|
226
|
-
|
|
227
|
-
const handleReset = useCallback(
|
|
228
|
-
async (reset = false) => {
|
|
229
|
-
if (reset) {
|
|
230
|
-
// TODO(burdon): Doesn't cleanly restart.
|
|
231
|
-
log.info('resetting client...');
|
|
232
|
-
await client.reset();
|
|
233
|
-
log.info('client reset');
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
if (space) {
|
|
238
|
-
await space.close();
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
const newSpace = await client.spaces.create();
|
|
242
|
-
setSpace(newSpace);
|
|
243
|
-
setAst(undefined);
|
|
244
|
-
setFilter(undefined);
|
|
245
|
-
promptRef.current?.setText('');
|
|
246
|
-
},
|
|
247
|
-
[space, client],
|
|
248
|
-
);
|
|
249
|
-
|
|
250
|
-
const handleSubmit = useCallback<NonNullable<PromptBarProps['onSubmit']>>(
|
|
251
|
-
(text) => {
|
|
252
|
-
try {
|
|
253
|
-
const parser = new QueryParser(text);
|
|
254
|
-
const ast = parser.parse();
|
|
255
|
-
setAst(ast);
|
|
256
|
-
const filter = createFilter(ast);
|
|
257
|
-
setFilter(filter);
|
|
258
|
-
} catch (err) {
|
|
259
|
-
// TODO(mykola): Make hybrid search.
|
|
260
|
-
const filter = Filter.text(text, { type: 'vector' });
|
|
261
|
-
setFilter(filter);
|
|
262
|
-
}
|
|
263
|
-
},
|
|
264
|
-
[space],
|
|
265
|
-
);
|
|
266
|
-
|
|
267
|
-
//
|
|
268
|
-
// Prompt
|
|
269
|
-
//
|
|
270
|
-
|
|
271
|
-
const promptRef = useRef<PromptController>(null);
|
|
272
|
-
const handleCancel = useCallback<NonNullable<PromptBarProps['onCancel']>>(() => {
|
|
273
|
-
setAst(undefined);
|
|
274
|
-
setFilter(undefined);
|
|
275
|
-
promptRef.current?.setText('');
|
|
276
|
-
}, []);
|
|
277
|
-
|
|
278
|
-
const handleMatch = useCallback<NonNullable<TypeaheadOptions['onComplete']>>(createMatcher(space), [space]);
|
|
279
|
-
|
|
280
|
-
const extensions = useMemo(() => [typeahead({ onComplete: handleMatch })], [handleMatch]);
|
|
281
|
-
|
|
282
|
-
const { state: flushState, handleFlush } = useFlush(space);
|
|
283
|
-
|
|
284
|
-
return (
|
|
285
|
-
<div className='grow grid overflow-hidden'>
|
|
286
|
-
<div className={mx('grow grid overflow-hidden', !mode && 'grid-cols-[1fr_30rem]')}>
|
|
287
|
-
{showGraph && (
|
|
288
|
-
<D3ForceGraph classNames='border-ie border-separator' model={model} selection={selection} {...props} />
|
|
289
|
-
)}
|
|
290
|
-
|
|
291
|
-
{showList && (
|
|
292
|
-
<div className='grow grid grid-rows-[min-content_1fr_1fr_1fr] overflow-hidden divide-y divide-separator'>
|
|
293
|
-
<Toolbar.Root>
|
|
294
|
-
<IconButton icon='ph--arrow-clockwise--regular' iconOnly label='refresh' onClick={handleRefresh} />
|
|
295
|
-
<IconButton icon='ph--sparkle--regular' iconOnly label='research' onClick={handleResearch} />
|
|
296
|
-
<IconButton icon='ph--plus--regular' iconOnly label='generate' onClick={handleGenerate} />
|
|
297
|
-
<IconButton
|
|
298
|
-
icon='ph--trash--regular'
|
|
299
|
-
iconOnly
|
|
300
|
-
label='reset'
|
|
301
|
-
onClick={(event) => handleReset(event.shiftKey)}
|
|
302
|
-
/>
|
|
303
|
-
<IconButton
|
|
304
|
-
disabled={flushState === 'flushing'}
|
|
305
|
-
icon={Match.value(flushState).pipe(
|
|
306
|
-
Match.when('idle', () => 'ph--floppy-disk--regular'),
|
|
307
|
-
Match.when('flushing', () => 'ph--spinner--regular'),
|
|
308
|
-
Match.when('flushed', () => 'ph--check--regular'),
|
|
309
|
-
Match.exhaustive,
|
|
310
|
-
)}
|
|
311
|
-
iconOnly
|
|
312
|
-
label='flush'
|
|
313
|
-
onClick={handleFlush}
|
|
314
|
-
/>
|
|
315
|
-
</Toolbar.Root>
|
|
316
|
-
<ItemList items={objects} />
|
|
317
|
-
<Log logger={logger} />
|
|
318
|
-
<JsonFilter
|
|
319
|
-
data={{
|
|
320
|
-
space: client.spaces.get().length,
|
|
321
|
-
db: space?.db.toJSON(),
|
|
322
|
-
queue: {
|
|
323
|
-
dxn: researchQueue?.dxn.toString(),
|
|
324
|
-
objects: researchQueue?.objects.length,
|
|
325
|
-
},
|
|
326
|
-
model: model?.toJSON(),
|
|
327
|
-
selection: selection.toJSON(),
|
|
328
|
-
ast,
|
|
329
|
-
}}
|
|
330
|
-
/>
|
|
331
|
-
</div>
|
|
332
|
-
)}
|
|
333
|
-
</div>
|
|
334
|
-
|
|
335
|
-
<Dialog.Root modal={false} open>
|
|
336
|
-
<AmbientDialog resizeable={false} onEscape={handleCancel}>
|
|
337
|
-
<PromptBar
|
|
338
|
-
ref={promptRef}
|
|
339
|
-
placeholder={t('search input placeholder')}
|
|
340
|
-
extensions={extensions}
|
|
341
|
-
onSubmit={handleSubmit}
|
|
342
|
-
onCancel={handleCancel}
|
|
343
|
-
/>
|
|
344
|
-
</AmbientDialog>
|
|
345
|
-
</Dialog.Root>
|
|
346
|
-
</div>
|
|
347
|
-
);
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
// TODO(burdon): Factor out; match against expression grammar.
|
|
351
|
-
const createMatcher =
|
|
352
|
-
(space?: Space) =>
|
|
353
|
-
({ line }: TypeaheadContext) => {
|
|
354
|
-
const words = line.split(/\s+/).filter(Boolean);
|
|
355
|
-
if (words.length > 0) {
|
|
356
|
-
const word = words.at(-1)!;
|
|
357
|
-
|
|
358
|
-
// Match type.
|
|
359
|
-
const match = word.match(/^type:(.+)/);
|
|
360
|
-
if (match) {
|
|
361
|
-
const part = match[1];
|
|
362
|
-
for (const schema of space?.db.graph.schemaRegistry.schemas ?? []) {
|
|
363
|
-
const typename = Type.getTypename(schema);
|
|
364
|
-
if (typename) {
|
|
365
|
-
const completion = matchCompletion(typename, part);
|
|
366
|
-
if (completion) {
|
|
367
|
-
return completion;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
// Match static.
|
|
374
|
-
return staticCompletion(['type:', 'AND', 'OR', 'NOT'])({ line });
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
// TODO(burdon): Replace with card list.
|
|
379
|
-
const ItemList = <T extends Obj.Any>({ items = [] }: { items?: T[] }) => {
|
|
380
|
-
return (
|
|
381
|
-
<List.Root<T> items={items}>
|
|
382
|
-
{({ items }) => (
|
|
383
|
-
<div role='list' className='grow flex flex-col overflow-y-auto'>
|
|
384
|
-
{/* TODO(burdon): Virtualize. */}
|
|
385
|
-
{items.map((item) => (
|
|
386
|
-
<List.Item<T>
|
|
387
|
-
key={item.id}
|
|
388
|
-
item={item}
|
|
389
|
-
classNames='grid grid-cols-[4rem_16rem_1fr] min-h-[32px] items-center'
|
|
390
|
-
>
|
|
391
|
-
<div className='text-xs font-mono font-thin px-1 text-subdued'>{item.id.slice(-6)}</div>
|
|
392
|
-
<div
|
|
393
|
-
className={mx('text-xs font-mono font-thin truncate px-1', getHashColor(Obj.getTypename(item))?.text)}
|
|
394
|
-
>
|
|
395
|
-
{Obj.getTypename(item)}
|
|
396
|
-
</div>
|
|
397
|
-
<List.ItemTitle>{Obj.getLabel(item)}</List.ItemTitle>
|
|
398
|
-
</List.Item>
|
|
399
|
-
))}
|
|
400
|
-
</div>
|
|
401
|
-
)}
|
|
402
|
-
</List.Root>
|
|
403
|
-
);
|
|
404
|
-
};
|
|
405
|
-
|
|
406
|
-
const useFlush = (space?: Space) => {
|
|
407
|
-
const [state, setState] = useState<'idle' | 'flushing' | 'flushed'>('idle');
|
|
408
|
-
const resetTimer = useRef<NodeJS.Timeout | null>(null);
|
|
409
|
-
|
|
410
|
-
const handleFlush = useCallback(() => {
|
|
411
|
-
if (!space) {
|
|
412
|
-
return;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
queueMicrotask(async () => {
|
|
416
|
-
if (resetTimer.current) {
|
|
417
|
-
clearTimeout(resetTimer.current);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
setState('flushing');
|
|
421
|
-
await space.db.flush();
|
|
422
|
-
setState('flushed');
|
|
423
|
-
|
|
424
|
-
resetTimer.current = setTimeout(() => {
|
|
425
|
-
setState('idle');
|
|
426
|
-
resetTimer.current = null;
|
|
427
|
-
}, 1_000);
|
|
428
|
-
});
|
|
429
|
-
}, [space]);
|
|
430
|
-
|
|
431
|
-
return { state, handleFlush };
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
const Log: FC<{ logger: BufferedLogger }> = ({ logger }) => {
|
|
435
|
-
return (
|
|
436
|
-
<div className='grow flex flex-col p-1 overflow-y-auto text-sm'>
|
|
437
|
-
{logger.messages.value.map((message, index) => (
|
|
438
|
-
<div key={index} className='text-subdued'>
|
|
439
|
-
{message}
|
|
440
|
-
</div>
|
|
441
|
-
))}
|
|
442
|
-
</div>
|
|
443
|
-
);
|
|
444
|
-
};
|
|
445
|
-
|
|
446
|
-
const meta: Meta<typeof DefaultStory> = {
|
|
447
|
-
title: 'plugins/plugin-assistant/Query',
|
|
448
|
-
render: DefaultStory,
|
|
449
|
-
decorators: [
|
|
450
|
-
withPluginManager({
|
|
451
|
-
fireEvents: [Events.SetupArtifactDefinition],
|
|
452
|
-
plugins: testPlugins({
|
|
453
|
-
types: [...DataTypes, ResearchGraph],
|
|
454
|
-
config: {
|
|
455
|
-
runtime: {
|
|
456
|
-
client: {
|
|
457
|
-
storage: {
|
|
458
|
-
persistent: true,
|
|
459
|
-
},
|
|
460
|
-
enableVectorIndexing: true,
|
|
461
|
-
},
|
|
462
|
-
},
|
|
463
|
-
},
|
|
464
|
-
}),
|
|
465
|
-
}),
|
|
466
|
-
withTheme,
|
|
467
|
-
withLayout({ fullscreen: true }),
|
|
468
|
-
],
|
|
469
|
-
parameters: {
|
|
470
|
-
translations,
|
|
471
|
-
controls: { disable: true },
|
|
472
|
-
},
|
|
473
|
-
};
|
|
474
|
-
|
|
475
|
-
type Story = StoryObj<typeof DefaultStory>;
|
|
476
|
-
|
|
477
|
-
export default meta;
|
|
478
|
-
|
|
479
|
-
export const Default: Story = {
|
|
480
|
-
args: {
|
|
481
|
-
grid: false,
|
|
482
|
-
drag: true,
|
|
483
|
-
spec: [
|
|
484
|
-
{ type: DataType.Organization, count: 10 },
|
|
485
|
-
{ type: DataType.Person, count: 30 },
|
|
486
|
-
],
|
|
487
|
-
},
|
|
488
|
-
};
|
|
489
|
-
|
|
490
|
-
export const WithList: Story = {
|
|
491
|
-
args: {
|
|
492
|
-
mode: 'list',
|
|
493
|
-
spec: [
|
|
494
|
-
{ type: DataType.Organization, count: 30 },
|
|
495
|
-
{ type: DataType.Person, count: 50 },
|
|
496
|
-
],
|
|
497
|
-
},
|
|
498
|
-
};
|
|
499
|
-
|
|
500
|
-
export const GraphList: Story = {
|
|
501
|
-
args: {
|
|
502
|
-
mode: 'graph',
|
|
503
|
-
spec: [
|
|
504
|
-
{ type: DataType.Organization, count: 30 },
|
|
505
|
-
{ type: DataType.Person, count: 50 },
|
|
506
|
-
],
|
|
507
|
-
},
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
export const Research: Story = {
|
|
511
|
-
args: {
|
|
512
|
-
drag: true,
|
|
513
|
-
},
|
|
514
|
-
};
|