@dxos/plugin-assistant 0.8.3 → 0.8.4-main.28f8d3d
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/{TemplateContainer-QQHVOTSI.mjs → BlueprintContainer-H7H4BQ2C.mjs} +11 -10
- package/dist/lib/browser/BlueprintContainer-H7H4BQ2C.mjs.map +7 -0
- package/dist/lib/browser/ChatContainer-OUVSX5V5.mjs +76 -0
- package/dist/lib/browser/ChatContainer-OUVSX5V5.mjs.map +7 -0
- package/dist/lib/browser/ChatDialog-P4FLEOHG.mjs +86 -0
- package/dist/lib/browser/ChatDialog-P4FLEOHG.mjs.map +7 -0
- package/dist/lib/browser/SequenceContainer-627OQ557.mjs +163 -0
- package/dist/lib/browser/SequenceContainer-627OQ557.mjs.map +7 -0
- package/dist/lib/browser/ai-service-7KJ5LXBT.mjs +22 -0
- package/dist/lib/browser/ai-service-7KJ5LXBT.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-E4H5DCOJ.mjs → app-graph-builder-AVHHQ3KV.mjs} +30 -89
- package/dist/lib/browser/app-graph-builder-AVHHQ3KV.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs +146 -0
- package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs.map +7 -0
- package/dist/lib/browser/chunk-BRLHDHOF.mjs +244 -0
- package/dist/lib/browser/chunk-BRLHDHOF.mjs.map +7 -0
- package/dist/lib/browser/chunk-HRLMD35M.mjs +191 -0
- package/dist/lib/browser/chunk-HRLMD35M.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/{chunk-XOZ7YMO3.mjs → chunk-LKP65RPA.mjs} +2 -2
- package/dist/lib/browser/{chunk-JQFUME3B.mjs → chunk-NZDCKQ6W.mjs} +36 -34
- package/dist/lib/browser/chunk-NZDCKQ6W.mjs.map +7 -0
- package/dist/lib/browser/chunk-QB7OVS6Z.mjs +16 -0
- package/dist/lib/browser/chunk-QB7OVS6Z.mjs.map +7 -0
- package/dist/lib/browser/chunk-VEBVAHNM.mjs +2231 -0
- package/dist/lib/browser/chunk-VEBVAHNM.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs +24 -0
- package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +141 -128
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/intent-resolver-MVOIEJXZ.mjs +81 -0
- package/dist/lib/browser/intent-resolver-MVOIEJXZ.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-LXCNUSZN.mjs → react-surface-4HXS3YLT.mjs} +66 -62
- package/dist/lib/browser/react-surface-4HXS3YLT.mjs.map +7 -0
- package/dist/lib/browser/{settings-XRHXVWGB.mjs → settings-G2EZXMWT.mjs} +7 -6
- package/dist/lib/browser/settings-G2EZXMWT.mjs.map +7 -0
- package/dist/lib/browser/toolkit-IW4FBLLB.mjs +105 -0
- package/dist/lib/browser/toolkit-IW4FBLLB.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -20
- package/dist/lib/node-esm/{TemplateContainer-SOEWY2ZN.mjs → BlueprintContainer-VH4EE4CM.mjs} +11 -10
- package/dist/lib/node-esm/BlueprintContainer-VH4EE4CM.mjs.map +7 -0
- package/dist/lib/node-esm/ChatContainer-D5FABDNE.mjs +77 -0
- package/dist/lib/node-esm/ChatContainer-D5FABDNE.mjs.map +7 -0
- package/dist/lib/node-esm/ChatDialog-NKWVXHJP.mjs +87 -0
- package/dist/lib/node-esm/ChatDialog-NKWVXHJP.mjs.map +7 -0
- package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs +164 -0
- package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-LDD32477.mjs +23 -0
- package/dist/lib/node-esm/ai-service-LDD32477.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-3SY5MBIK.mjs → app-graph-builder-RMOUJMMG.mjs} +30 -89
- package/dist/lib/node-esm/app-graph-builder-RMOUJMMG.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs +147 -0
- package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-3SOC5GOP.mjs +2232 -0
- package/dist/lib/node-esm/chunk-3SOC5GOP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-F7RXCX5Y.mjs +192 -0
- package/dist/lib/node-esm/chunk-F7RXCX5Y.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-OYN6HLXZ.mjs → chunk-GAWXJ7K5.mjs} +36 -34
- package/dist/lib/node-esm/chunk-GAWXJ7K5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-BB2TAT4P.mjs → chunk-KOC6ESG7.mjs} +2 -2
- package/dist/lib/node-esm/chunk-RD755HN3.mjs +245 -0
- package/dist/lib/node-esm/chunk-RD755HN3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-X6AANUHZ.mjs +17 -0
- package/dist/lib/node-esm/chunk-X6AANUHZ.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs +25 -0
- package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +141 -128
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/intent-resolver-DTDNCX3C.mjs +82 -0
- package/dist/lib/node-esm/intent-resolver-DTDNCX3C.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-7HA5EDWY.mjs → react-surface-V6JNEZVO.mjs} +66 -62
- package/dist/lib/node-esm/react-surface-V6JNEZVO.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-5IAY6BT4.mjs → settings-AIP5FOJG.mjs} +7 -6
- package/dist/lib/node-esm/settings-AIP5FOJG.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-2VNUL77B.mjs +106 -0
- package/dist/lib/node-esm/toolkit-2VNUL77B.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +7 -20
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts +5 -0
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +8 -3
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +6 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
- 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/capabilities/toolkit.d.ts +5 -0
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
- 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/BlueprintContainer.d.ts +5 -6
- package/dist/types/src/components/BlueprintContainer.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +45 -0
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -0
- package/dist/types/src/components/Chat/events.d.ts +30 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -0
- package/dist/types/src/components/Chat/index.d.ts +3 -0
- package/dist/types/src/components/Chat/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +8 -7
- 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 +11 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +13 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts +11 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.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 +8 -0
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.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/ChatThread/ChatMessage.d.ts +18 -0
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +19 -0
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +226 -0
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +19 -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/{Thread → ChatThread}/reducer.d.ts +4 -4
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +1 -0
- package/dist/types/src/components/PromptSettings.d.ts +2 -2
- package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
- package/dist/types/src/components/SequenceContainer.d.ts +8 -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/TemplateEditor/TemplateEditor.d.ts +4 -3
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +3 -3
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +5 -4
- 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/Timeline/Timeline.d.ts +24 -0
- package/dist/types/src/components/Timeline/Timeline.d.ts.map +1 -0
- package/dist/types/src/components/Timeline/Timeline.stories.d.ts +9 -0
- package/dist/types/src/components/Timeline/Timeline.stories.d.ts.map +1 -0
- package/dist/types/src/components/Timeline/index.d.ts +2 -0
- package/dist/types/src/components/Timeline/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +10 -6
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +2 -3
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +7 -12
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/functions/analysis.d.ts +5 -0
- package/dist/types/src/functions/analysis.d.ts.map +1 -0
- package/dist/types/src/functions/index.d.ts +4 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/list.d.ts +10 -0
- package/dist/types/src/functions/list.d.ts.map +1 -0
- package/dist/types/src/functions/load.d.ts +8 -0
- package/dist/types/src/functions/load.d.ts.map +1 -0
- package/dist/types/src/hooks/chat-processor.d.ts +72 -0
- package/dist/types/src/hooks/chat-processor.d.ts.map +1 -0
- package/dist/types/src/hooks/errors.d.ts +4 -0
- package/dist/types/src/hooks/errors.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +9 -5
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/presets.d.ts +13 -0
- package/dist/types/src/hooks/presets.d.ts.map +1 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +21 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +16 -11
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +13 -0
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -0
- package/dist/types/src/hooks/useOnline.d.ts +3 -0
- package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
- package/dist/types/src/hooks/usePresets.d.ts +7 -0
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts +7 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -0
- package/dist/types/src/hooks/useResolveRef.d.ts +4 -0
- package/dist/types/src/hooks/useResolveRef.d.ts.map +1 -0
- package/dist/types/src/parser/filter-generator.d.ts.map +1 -1
- package/dist/types/src/parser/index.d.ts +1 -1
- package/dist/types/src/parser/index.d.ts.map +1 -1
- package/dist/types/src/parser/query-parser.d.ts.map +1 -1
- 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 +268 -0
- package/dist/types/src/stories/Chat.stories.d.ts.map +1 -0
- package/dist/types/src/stories/components/BlueprintContainer.d.ts +5 -0
- package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/ChatContainer.d.ts +5 -0
- package/dist/types/src/stories/components/ChatContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/GraphContainer.d.ts +6 -0
- package/dist/types/src/stories/components/GraphContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/LoggingContainer.d.ts +5 -0
- package/dist/types/src/stories/components/LoggingContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/SurfaceContainer.d.ts +8 -0
- package/dist/types/src/stories/components/SurfaceContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/TasksContainer.d.ts +5 -0
- package/dist/types/src/stories/components/TasksContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/index.d.ts +8 -0
- package/dist/types/src/stories/components/index.d.ts.map +1 -0
- package/dist/types/src/stories/components/types.d.ts +7 -0
- package/dist/types/src/stories/components/types.d.ts.map +1 -0
- package/dist/types/src/stories/hooks/index.d.ts +3 -0
- package/dist/types/src/stories/hooks/index.d.ts.map +1 -0
- package/dist/types/src/stories/hooks/useFlush.d.ts +6 -0
- package/dist/types/src/stories/hooks/useFlush.d.ts.map +1 -0
- package/dist/types/src/stories/hooks/useMatcherExtension.d.ts +3 -0
- package/dist/types/src/stories/hooks/useMatcherExtension.d.ts.map +1 -0
- package/dist/types/src/stories/testing/data.d.ts +142 -0
- package/dist/types/src/stories/testing/data.d.ts.map +1 -0
- package/dist/types/src/stories/testing/index.d.ts +3 -0
- package/dist/types/src/stories/testing/index.d.ts.map +1 -0
- package/dist/types/src/stories/testing/testing.d.ts +26 -0
- package/dist/types/src/stories/testing/testing.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-functions.d.ts +5 -2
- package/dist/types/src/testing/test-functions.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/tools/function.d.ts.map +1 -1
- package/dist/types/src/tools/openapi.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +73 -113
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/{chat.d.ts → Assistant.d.ts} +20 -3
- package/dist/types/src/types/Assistant.d.ts.map +1 -0
- package/dist/types/src/types/AssistantAction.d.ts +90 -0
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
- package/dist/types/src/types/defs.d.ts +2 -0
- package/dist/types/src/types/defs.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -3
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +12 -12
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +86 -74
- package/src/AssistantPlugin.tsx +63 -43
- package/src/capabilities/ai-service.ts +28 -0
- package/src/capabilities/app-graph-builder.ts +28 -107
- package/src/capabilities/blueprint-definition.ts +32 -0
- package/src/capabilities/capabilities.ts +12 -5
- package/src/capabilities/edge-model-resolver.ts +29 -0
- package/src/capabilities/index.ts +6 -3
- package/src/capabilities/intent-resolver.ts +40 -12
- package/src/capabilities/react-surface.tsx +54 -46
- package/src/capabilities/settings.ts +3 -3
- package/src/capabilities/toolkit.ts +106 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +4 -4
- package/src/components/BlueprintContainer.tsx +9 -133
- package/src/components/Chat/Chat.tsx +401 -0
- package/src/components/Chat/events.ts +50 -0
- package/src/components/Chat/index.ts +7 -0
- package/src/components/ChatContainer.tsx +51 -21
- package/src/components/ChatDialog.tsx +68 -0
- package/src/components/ChatPrompt/ChatActions.tsx +71 -0
- package/src/components/ChatPrompt/ChatOptions.tsx +59 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +28 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +55 -0
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +39 -0
- package/src/components/ChatPrompt/index.ts +9 -0
- package/src/components/ChatThread/ChatMessage.tsx +282 -0
- package/src/components/ChatThread/ChatThread.stories.tsx +260 -0
- package/src/components/ChatThread/ChatThread.tsx +57 -0
- package/src/components/ChatThread/Link.tsx +39 -0
- package/src/components/ChatThread/ToolBlock.tsx +125 -0
- package/src/components/{AmbientDialog → ChatThread}/index.ts +1 -1
- package/src/components/{Thread → ChatThread}/reducer.ts +14 -14
- package/src/components/PromptSettings.tsx +43 -45
- package/src/components/SequenceContainer.tsx +133 -0
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +33 -0
- package/src/components/{BlueprintEditor/BlueprintEditor.tsx → SequenceEditor/SequenceEditor.tsx} +8 -8
- package/src/components/SequenceEditor/index.ts +5 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +38 -36
- package/src/components/TemplateEditor/TemplateEditor.tsx +41 -25
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +24 -17
- package/src/components/TemplateEditor/TemplateForm.tsx +51 -57
- package/src/components/Timeline/Timeline.stories.tsx +53 -0
- package/src/components/Timeline/Timeline.tsx +159 -0
- package/src/{experimental/transcription → components/Timeline}/index.ts +2 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +9 -16
- package/src/components/Toolbox/Toolbox.tsx +49 -17
- package/src/components/index.ts +4 -8
- package/src/events.ts +3 -3
- package/src/functions/analysis.ts +20 -0
- package/src/functions/index.ts +7 -0
- package/src/functions/list.ts +42 -0
- package/src/functions/load.ts +43 -0
- package/src/hooks/chat-processor.ts +260 -0
- package/src/hooks/errors.ts +8 -0
- package/src/hooks/index.ts +9 -5
- package/src/hooks/presets.ts +53 -0
- package/src/hooks/useBlueprintRegistry.ts +79 -0
- package/src/hooks/useChatProcessor.ts +81 -0
- package/src/hooks/useChatServices.ts +72 -0
- package/src/hooks/useOnline.ts +10 -0
- package/src/hooks/usePresets.ts +45 -0
- package/src/hooks/{useContextProvider.ts → useReferencesProvider.ts} +22 -20
- package/src/hooks/useResolveRef.ts +33 -0
- package/src/parser/filter-generator.ts +6 -13
- package/src/parser/index.ts +1 -1
- package/src/parser/query-parser.ts +1 -1
- package/src/queue-logger.ts +11 -11
- package/src/stories/Chat.stories.tsx +317 -0
- package/src/stories/components/BlueprintContainer.tsx +34 -0
- package/src/stories/components/ChatContainer.tsx +80 -0
- package/src/stories/components/GraphContainer.tsx +118 -0
- package/src/stories/components/LoggingContainer.tsx +22 -0
- package/src/stories/components/SurfaceContainer.tsx +62 -0
- package/src/stories/components/TasksContainer.tsx +51 -0
- package/src/stories/components/index.ts +12 -0
- package/src/stories/components/types.ts +11 -0
- package/src/stories/hooks/index.ts +6 -0
- package/src/stories/hooks/useFlush.ts +35 -0
- package/src/stories/hooks/useMatcherExtension.ts +45 -0
- package/src/stories/{test-data.ts → testing/data.ts} +10 -8
- package/src/stories/testing/index.ts +6 -0
- package/src/stories/testing/testing.tsx +162 -0
- package/src/testing/index.ts +1 -1
- package/src/testing/test-functions.ts +9 -4
- package/src/testing/test-sequence.ts +51 -0
- package/src/tools/function.ts +4 -1
- package/src/tools/openapi.test.ts +14 -12
- package/src/tools/openapi.ts +4 -1
- package/src/translations.ts +46 -28
- package/src/types/Assistant.ts +59 -0
- package/src/types/AssistantAction.ts +54 -0
- package/src/types/defs.ts +5 -0
- package/src/types/index.ts +4 -3
- 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 +0 -321
- 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 +0 -39
- 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 +0 -208
- package/dist/lib/browser/chunk-AAOKC2JN.mjs.map +0 -7
- package/dist/lib/browser/chunk-BI6AHRNJ.mjs +0 -157
- 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-MEGMOFJB.mjs.map +0 -7
- 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 +0 -43
- 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 +0 -322
- 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 +0 -40
- 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-34EX6E5Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3UEZLJ2V.mjs +0 -16
- 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 +0 -209
- 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 +0 -158
- package/dist/lib/node-esm/chunk-UCOFKNKN.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-E6MXTYAU.mjs +0 -44
- 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/capabilities/ai-client.d.ts +0 -5
- package/dist/types/src/capabilities/ai-client.d.ts.map +0 -1
- 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/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/TemplateContainer.d.ts +0 -8
- package/dist/types/src/components/TemplateContainer.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 +0 -16
- 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 +0 -72
- 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/useContextProvider.d.ts +0 -17
- package/dist/types/src/hooks/useContextProvider.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/hooks/useTextInputEvents.d.ts +0 -13
- package/dist/types/src/hooks/useTextInputEvents.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.map +0 -1
- package/dist/types/src/types/template.d.ts +0 -56
- package/dist/types/src/types/template.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/capabilities/ai-client.ts +0 -42
- 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/TemplateContainer.tsx +0 -23
- 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/ThreadMessage.tsx +0 -234
- package/src/components/Thread/ToolInvocations.tsx +0 -106
- package/src/components/Thread/index.ts +0 -6
- package/src/hooks/processor.test.ts +0 -15
- package/src/hooks/processor.ts +0 -238
- package/src/hooks/useChatProcessor.tsx +0 -97
- package/src/hooks/useMessageQueue.ts +0 -22
- package/src/hooks/useServices.ts +0 -28
- package/src/hooks/useTextInputEvents.ts +0 -49
- 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/testing.ts +0 -60
- package/src/testing/test-blueprint.ts +0 -58
- package/src/types/chat.ts +0 -32
- package/src/types/template.ts +0 -66
- package/src/types/types.ts +0 -48
- /package/dist/lib/browser/{chunk-XOZ7YMO3.mjs.map → chunk-LKP65RPA.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-BB2TAT4P.mjs.map → chunk-KOC6ESG7.mjs.map} +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
|
|
7
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
8
|
+
|
|
9
|
+
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
10
|
+
import { invariant } from '@dxos/invariant';
|
|
11
|
+
import { log } from '@dxos/log';
|
|
12
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
13
|
+
import { Toolbar, useTranslation } from '@dxos/react-ui';
|
|
14
|
+
|
|
15
|
+
import { Chat } from '../../components';
|
|
16
|
+
import { useBlueprintRegistry, useChatProcessor, useChatServices } from '../../hooks';
|
|
17
|
+
import { useOnline, usePresets } from '../../hooks';
|
|
18
|
+
import { meta } from '../../meta';
|
|
19
|
+
import { Assistant } from '../../types';
|
|
20
|
+
|
|
21
|
+
import { type ComponentProps } from './types';
|
|
22
|
+
|
|
23
|
+
export const ChatContainer = ({ space, onEvent }: ComponentProps) => {
|
|
24
|
+
const { t } = useTranslation(meta.id);
|
|
25
|
+
const [online, setOnline] = useOnline();
|
|
26
|
+
const { preset, ...chatProps } = usePresets(online);
|
|
27
|
+
|
|
28
|
+
const chats = useQuery(space, Filter.type(Assistant.Chat));
|
|
29
|
+
const [chat, setChat] = useState<Assistant.Chat>();
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setChat((currentChat) => currentChat ?? chats[0]);
|
|
32
|
+
}, [chat, chats]);
|
|
33
|
+
|
|
34
|
+
const blueprintRegistry = useBlueprintRegistry();
|
|
35
|
+
const services = useChatServices({ space });
|
|
36
|
+
const processor = useChatProcessor({ space, chat, preset, services, blueprintRegistry });
|
|
37
|
+
|
|
38
|
+
const handleNewChat = useCallback(() => {
|
|
39
|
+
invariant(space);
|
|
40
|
+
const chat = space.db.add(
|
|
41
|
+
Obj.make(Assistant.Chat, {
|
|
42
|
+
queue: Ref.fromDXN(space.queues.create().dxn),
|
|
43
|
+
}),
|
|
44
|
+
);
|
|
45
|
+
setChat(chat);
|
|
46
|
+
}, [space]);
|
|
47
|
+
|
|
48
|
+
const handleBranchChat = useCallback(() => {}, [space]);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<>
|
|
52
|
+
<Toolbar.Root classNames='density-coarse border-b border-subduedSeparator'>
|
|
53
|
+
<Toolbar.IconButton icon='ph--plus--regular' iconOnly label={t('button new thread')} onClick={handleNewChat} />
|
|
54
|
+
<Toolbar.IconButton
|
|
55
|
+
disabled
|
|
56
|
+
icon='ph--git-branch--regular'
|
|
57
|
+
iconOnly
|
|
58
|
+
label={t('button branch thread')}
|
|
59
|
+
onClick={handleBranchChat}
|
|
60
|
+
/>
|
|
61
|
+
<div className='flex-1' />
|
|
62
|
+
<Toolbar.IconButton icon='ph--trash--regular' iconOnly label='Reset' onClick={() => onEvent?.('reset')} />
|
|
63
|
+
</Toolbar.Root>
|
|
64
|
+
{!chat || !processor ? null : (
|
|
65
|
+
<Chat.Root chat={chat} processor={processor} onEvent={(event) => log.info('event', { event })}>
|
|
66
|
+
<Chat.Thread />
|
|
67
|
+
<div className='p-4'>
|
|
68
|
+
<Chat.Prompt
|
|
69
|
+
{...chatProps}
|
|
70
|
+
classNames='p-2 border border-transparent rounded focus-within:outline focus-within:border-transparent outline-primary-500'
|
|
71
|
+
preset={preset?.id}
|
|
72
|
+
online={online}
|
|
73
|
+
onChangeOnline={setOnline}
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
</Chat.Root>
|
|
77
|
+
)}
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Match } from 'effect';
|
|
6
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { ResearchGraph } from '@dxos/assistant-testing';
|
|
9
|
+
import { Filter, Query } from '@dxos/echo';
|
|
10
|
+
import { D3ForceGraph, useGraphModel } from '@dxos/plugin-explorer';
|
|
11
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
12
|
+
import { IconButton, Toolbar } from '@dxos/react-ui';
|
|
13
|
+
import { ChatEditor, type ChatEditorController, type ChatEditorProps } from '@dxos/react-ui-chat';
|
|
14
|
+
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
15
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
16
|
+
|
|
17
|
+
import { type Expression, QueryParser, createFilter } from '../../parser';
|
|
18
|
+
import { useFlush, useMatcherExtension } from '../hooks';
|
|
19
|
+
|
|
20
|
+
import { type ComponentProps } from './types';
|
|
21
|
+
|
|
22
|
+
export const GraphContainer = ({ space }: ComponentProps) => {
|
|
23
|
+
const [ast, setAst] = useState<Expression | undefined>();
|
|
24
|
+
const [filter, setFilter] = useState<Filter.Any>();
|
|
25
|
+
const [open, setOpen] = useState(false);
|
|
26
|
+
|
|
27
|
+
const [researchGraph] = useQuery(space, Query.type(ResearchGraph));
|
|
28
|
+
const queue = researchGraph?.queue.target;
|
|
29
|
+
|
|
30
|
+
const model = useGraphModel(space, undefined, undefined, queue);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
model?.setFilter(filter ?? Filter.everything());
|
|
33
|
+
}, [model, filter]);
|
|
34
|
+
|
|
35
|
+
const handleSubmit = useCallback<NonNullable<ChatEditorProps['onSubmit']>>(
|
|
36
|
+
(text) => {
|
|
37
|
+
try {
|
|
38
|
+
const parser = new QueryParser(text);
|
|
39
|
+
const ast = parser.parse();
|
|
40
|
+
setAst(ast);
|
|
41
|
+
const filter = createFilter(ast);
|
|
42
|
+
setFilter(filter);
|
|
43
|
+
setOpen(true);
|
|
44
|
+
} catch {
|
|
45
|
+
// TODO(mykola): Make hybrid search.
|
|
46
|
+
const filter = Filter.text(text, { type: 'vector' });
|
|
47
|
+
setFilter(filter);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
[space],
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div className={mx('relative grid h-full', open && 'grid-rows-[min-content_1fr]')}>
|
|
55
|
+
<SearchBar space={space} onSubmit={handleSubmit} />
|
|
56
|
+
<D3ForceGraph model={model} />
|
|
57
|
+
|
|
58
|
+
{/* TODO(burdon): Create component with context state for story. */}
|
|
59
|
+
{(open && (
|
|
60
|
+
<div className='absolute left-2 right-2 bottom-2 h-[8rem] flex overflow-hidden bg-baseSurface border border-subduedSeparator'>
|
|
61
|
+
<SyntaxHighlighter language='json' classNames='text-sm'>
|
|
62
|
+
{JSON.stringify({ ast, filter }, null, 2)}
|
|
63
|
+
</SyntaxHighlighter>
|
|
64
|
+
<div className='absolute bottom-1 right-1'>
|
|
65
|
+
<IconButton variant='ghost' icon='ph--x--regular' iconOnly label='Close' onClick={() => setOpen(false)} />
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
)) || (
|
|
69
|
+
<div className='absolute bottom-3 right-3'>
|
|
70
|
+
<IconButton
|
|
71
|
+
variant='ghost'
|
|
72
|
+
icon='ph--arrow-line-up--regular'
|
|
73
|
+
iconOnly
|
|
74
|
+
label='Open'
|
|
75
|
+
onClick={() => setOpen(true)}
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
)}
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const SearchBar = ({ space, onSubmit }: ComponentProps & Pick<ChatEditorProps, 'onSubmit'>) => {
|
|
84
|
+
const { state: flushState, handleFlush } = useFlush(space);
|
|
85
|
+
const extensions = useMatcherExtension(space);
|
|
86
|
+
const editorRef = useRef<ChatEditorController>(null);
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<Toolbar.Root classNames='density-coarse border-b border-subduedSeparator'>
|
|
90
|
+
<ChatEditor
|
|
91
|
+
ref={editorRef}
|
|
92
|
+
autoFocus
|
|
93
|
+
placeholder='Search'
|
|
94
|
+
extensions={extensions}
|
|
95
|
+
fireIfEmpty
|
|
96
|
+
onSubmit={onSubmit}
|
|
97
|
+
/>
|
|
98
|
+
<Toolbar.IconButton
|
|
99
|
+
icon='ph--magnifying-glass--regular'
|
|
100
|
+
iconOnly
|
|
101
|
+
label='Search'
|
|
102
|
+
onClick={() => onSubmit?.(editorRef.current?.getText() ?? '')}
|
|
103
|
+
/>
|
|
104
|
+
<Toolbar.IconButton
|
|
105
|
+
disabled={flushState === 'flushing'}
|
|
106
|
+
icon={Match.value(flushState).pipe(
|
|
107
|
+
Match.when('idle', () => 'ph--floppy-disk--regular'),
|
|
108
|
+
Match.when('flushing', () => 'ph--spinner--regular'),
|
|
109
|
+
Match.when('flushed', () => 'ph--check--regular'),
|
|
110
|
+
Match.exhaustive,
|
|
111
|
+
)}
|
|
112
|
+
iconOnly
|
|
113
|
+
label='flush'
|
|
114
|
+
onClick={handleFlush}
|
|
115
|
+
/>
|
|
116
|
+
</Toolbar.Root>
|
|
117
|
+
);
|
|
118
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
import { Toolbar } from '@dxos/react-ui';
|
|
10
|
+
|
|
11
|
+
import { Timeline } from '../../components';
|
|
12
|
+
|
|
13
|
+
import { type ComponentProps } from './types';
|
|
14
|
+
|
|
15
|
+
export const LoggingContainer = (_: ComponentProps) => {
|
|
16
|
+
return (
|
|
17
|
+
<div className='flex flex-col h-full'>
|
|
18
|
+
<Toolbar.Root classNames='density-coarse border-b border-subduedSeparator'>Timeline</Toolbar.Root>
|
|
19
|
+
<Timeline branches={[]} commits={[]} />
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
import { Surface } from '@dxos/app-framework';
|
|
10
|
+
import { AiContextBinder } from '@dxos/assistant';
|
|
11
|
+
import { Filter, Obj, Ref, type Type } from '@dxos/echo';
|
|
12
|
+
import { log } from '@dxos/log';
|
|
13
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
14
|
+
import { useAsyncState } from '@dxos/react-ui';
|
|
15
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
16
|
+
|
|
17
|
+
import { Assistant } from '../../types';
|
|
18
|
+
|
|
19
|
+
import { type ComponentProps } from './types';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Shows the surface relating to the first bound object to the curent chat.
|
|
23
|
+
*/
|
|
24
|
+
export const SurfaceContainer = ({ space, debug }: ComponentProps) => {
|
|
25
|
+
const chats = useQuery(space, Filter.type(Assistant.Chat));
|
|
26
|
+
const [objects] = useAsyncState<Type.Expando[]>(async () => {
|
|
27
|
+
if (!chats.length) {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Get the latest chat (is this deterministic?)
|
|
32
|
+
const chat = chats[chats.length - 1];
|
|
33
|
+
const binder = new AiContextBinder(chat.queue.target!);
|
|
34
|
+
const refs = binder.objects.value;
|
|
35
|
+
const objects = await Ref.Array.loadAll(refs);
|
|
36
|
+
// TODO(burdon): Auto log meta for ECHO objects?
|
|
37
|
+
log('loaded', { objects: objects.map((obj) => ({ typename: Obj.getTypename(obj), id: obj.id })) });
|
|
38
|
+
return objects;
|
|
39
|
+
}, [chats]);
|
|
40
|
+
|
|
41
|
+
// TODO(burdon): Specify role hint to hide toolbar.
|
|
42
|
+
return (
|
|
43
|
+
<div className='flex flex-col bs-full overflow-y-auto divide-y divide-separator'>
|
|
44
|
+
{objects?.map((object) => (
|
|
45
|
+
<div key={object.id} className='group contents'>
|
|
46
|
+
{debug && (
|
|
47
|
+
<div
|
|
48
|
+
className={mx(
|
|
49
|
+
'flex gap-2 items-center text-xs justify-center',
|
|
50
|
+
'text-subdued group-first:border-none border-t border-subduedSeparator',
|
|
51
|
+
)}
|
|
52
|
+
>
|
|
53
|
+
<span>{Obj.getTypename(object)}</span>
|
|
54
|
+
<span>{object.id}</span>
|
|
55
|
+
</div>
|
|
56
|
+
)}
|
|
57
|
+
<Surface role='section' limit={1} data={{ subject: object }} />
|
|
58
|
+
</div>
|
|
59
|
+
))}
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
import { Filter, Obj } from '@dxos/echo';
|
|
10
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
11
|
+
import { createDocAccessor, useQuery } from '@dxos/react-client/echo';
|
|
12
|
+
import { Toolbar, useThemeContext } from '@dxos/react-ui';
|
|
13
|
+
import {
|
|
14
|
+
Editor,
|
|
15
|
+
createBasicExtensions,
|
|
16
|
+
createDataExtensions,
|
|
17
|
+
createMarkdownExtensions,
|
|
18
|
+
createThemeExtensions,
|
|
19
|
+
outliner,
|
|
20
|
+
} from '@dxos/react-ui-editor';
|
|
21
|
+
|
|
22
|
+
import { type ComponentProps } from './types';
|
|
23
|
+
|
|
24
|
+
export const TasksContainer = ({ space }: ComponentProps) => {
|
|
25
|
+
const { themeMode } = useThemeContext();
|
|
26
|
+
const [document] = useQuery(space, Filter.type(Markdown.Document));
|
|
27
|
+
if (!document?.content.target) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<Toolbar.Root classNames='border-b border-subduedSeparator'>
|
|
34
|
+
<h2>{Obj.getLabel(document)}</h2>
|
|
35
|
+
</Toolbar.Root>
|
|
36
|
+
<Editor
|
|
37
|
+
id={document.id}
|
|
38
|
+
text={document.content.target}
|
|
39
|
+
classNames='h-full p-2 overflow-hidden'
|
|
40
|
+
extensions={[
|
|
41
|
+
// TODO(burdon): Create util.
|
|
42
|
+
createDataExtensions({ id: document.id, text: createDocAccessor(document.content.target, ['content']) }),
|
|
43
|
+
createBasicExtensions({ readOnly: false }),
|
|
44
|
+
createMarkdownExtensions({ themeMode }),
|
|
45
|
+
createThemeExtensions({ themeMode }),
|
|
46
|
+
outliner(),
|
|
47
|
+
]}
|
|
48
|
+
/>
|
|
49
|
+
</>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
export * from './types';
|
|
6
|
+
|
|
7
|
+
export * from './BlueprintContainer';
|
|
8
|
+
export * from './ChatContainer';
|
|
9
|
+
export * from './GraphContainer';
|
|
10
|
+
export * from './LoggingContainer';
|
|
11
|
+
export * from './SurfaceContainer';
|
|
12
|
+
export * from './TasksContainer';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCallback, useRef, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Space } from '@dxos/client/echo';
|
|
8
|
+
|
|
9
|
+
export const useFlush = (space?: Space) => {
|
|
10
|
+
const [state, setState] = useState<'idle' | 'flushing' | 'flushed'>('idle');
|
|
11
|
+
const resetTimer = useRef<NodeJS.Timeout | null>(null);
|
|
12
|
+
|
|
13
|
+
const handleFlush = useCallback(() => {
|
|
14
|
+
if (!space) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
queueMicrotask(async () => {
|
|
19
|
+
if (resetTimer.current) {
|
|
20
|
+
clearTimeout(resetTimer.current);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
setState('flushing');
|
|
24
|
+
await space.db.flush();
|
|
25
|
+
setState('flushed');
|
|
26
|
+
|
|
27
|
+
resetTimer.current = setTimeout(() => {
|
|
28
|
+
setState('idle');
|
|
29
|
+
resetTimer.current = null;
|
|
30
|
+
}, 1_000);
|
|
31
|
+
});
|
|
32
|
+
}, [space]);
|
|
33
|
+
|
|
34
|
+
return { state, handleFlush };
|
|
35
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// TODO(burdon): Move def to @dxos/echo.
|
|
6
|
+
import { useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
import { type Space } from '@dxos/client/echo';
|
|
9
|
+
import { Type } from '@dxos/echo';
|
|
10
|
+
import { type TypeaheadContext, matchCompletion, staticCompletion, typeahead } from '@dxos/react-ui-editor';
|
|
11
|
+
|
|
12
|
+
export const useMatcherExtension = (space: Space) => {
|
|
13
|
+
return useMemo(() => {
|
|
14
|
+
const handleComplete = ({ line }: TypeaheadContext) => {
|
|
15
|
+
const words = line.split(/\s+/).filter(Boolean);
|
|
16
|
+
if (words.length > 0) {
|
|
17
|
+
const word = words.at(-1)!;
|
|
18
|
+
|
|
19
|
+
// Match type.
|
|
20
|
+
const match = word.match(/^type:(.+)/);
|
|
21
|
+
if (match) {
|
|
22
|
+
const part = match[1];
|
|
23
|
+
for (const schema of space?.db.graph.schemaRegistry.schemas ?? []) {
|
|
24
|
+
const typename = Type.getTypename(schema);
|
|
25
|
+
if (typename) {
|
|
26
|
+
const completion = matchCompletion(typename, part);
|
|
27
|
+
if (completion) {
|
|
28
|
+
return completion;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Match static.
|
|
35
|
+
return staticCompletion(['type:', 'AND', 'OR', 'NOT'])({ line });
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return [
|
|
40
|
+
typeahead({
|
|
41
|
+
onComplete: handleComplete,
|
|
42
|
+
}),
|
|
43
|
+
];
|
|
44
|
+
}, [space]);
|
|
45
|
+
};
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Live, type Space } from '@dxos/client/echo';
|
|
6
|
-
import { Obj,
|
|
6
|
+
import { Obj, Relation, type Type } from '@dxos/echo';
|
|
7
7
|
import { invariant } from '@dxos/invariant';
|
|
8
8
|
import { DataType } from '@dxos/schema';
|
|
9
9
|
|
|
10
|
+
export const testTypes = [DataType.Organization, DataType.Person, DataType.Employer, DataType.HasConnection];
|
|
11
|
+
|
|
10
12
|
const organizations: (Type.Properties<DataType.Organization> & { id: string })[] = [
|
|
11
13
|
{ id: 'dxos', name: 'DXOS', website: 'https://dxos.org' },
|
|
12
14
|
{ id: 'socket_supply', name: 'Socket Supply', website: 'https://socketsupply.com' },
|
|
@@ -41,8 +43,8 @@ const people: (Type.Properties<DataType.Person> & { id: string })[] = [
|
|
|
41
43
|
];
|
|
42
44
|
|
|
43
45
|
const testObjects: Record<string, any[]> = {
|
|
44
|
-
[
|
|
45
|
-
[
|
|
46
|
+
[DataType.Organization.typename]: organizations,
|
|
47
|
+
[DataType.Person.typename]: people,
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
const testRelationships: Record<
|
|
@@ -52,8 +54,8 @@ const testRelationships: Record<
|
|
|
52
54
|
target: string;
|
|
53
55
|
} & Record<string, any>)[]
|
|
54
56
|
> = {
|
|
55
|
-
[
|
|
56
|
-
//
|
|
57
|
+
[DataType.Employer.typename]: [
|
|
58
|
+
// prettier-ignore
|
|
57
59
|
{ source: 'rich_burdon', target: 'dxos' },
|
|
58
60
|
{ source: 'rich_burdon', target: 'google', active: false }, // TODO(burdon): Should not contribute to force.
|
|
59
61
|
{ source: 'rich_burdon', target: 'deshaw', active: false },
|
|
@@ -75,13 +77,13 @@ const testRelationships: Record<
|
|
|
75
77
|
],
|
|
76
78
|
|
|
77
79
|
// TODO(burdon): Limit graph view to selected relationship types.
|
|
78
|
-
[
|
|
79
|
-
//
|
|
80
|
+
[DataType.HasConnection.typename]: [
|
|
81
|
+
// prettier-ignore
|
|
80
82
|
{ kind: 'partner', source: 'dxos', target: 'ink_and_switch' },
|
|
81
83
|
{ kind: 'partner', source: 'dxos', target: 'effectful' },
|
|
82
84
|
{ kind: 'partner', source: 'dxos', target: 'socket_supply' },
|
|
83
85
|
|
|
84
|
-
//
|
|
86
|
+
// prettier-ignore
|
|
85
87
|
{ kind: 'investor', source: 'blueyard', target: 'dxos' },
|
|
86
88
|
{ kind: 'investor', source: 'blueyard', target: 'protocol_labs' },
|
|
87
89
|
{ kind: 'investor', source: 'protocol_labs', target: 'dxos' },
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Capabilities,
|
|
7
|
+
Events,
|
|
8
|
+
IntentPlugin,
|
|
9
|
+
type Plugin,
|
|
10
|
+
SettingsPlugin,
|
|
11
|
+
contributes,
|
|
12
|
+
defineModule,
|
|
13
|
+
definePlugin,
|
|
14
|
+
} from '@dxos/app-framework';
|
|
15
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
16
|
+
import { AiContextBinder } from '@dxos/assistant';
|
|
17
|
+
import {
|
|
18
|
+
DESIGN_BLUEPRINT,
|
|
19
|
+
PLANNING_BLUEPRINT,
|
|
20
|
+
RESEARCH_BLUEPRINT,
|
|
21
|
+
readDocument,
|
|
22
|
+
readTasks,
|
|
23
|
+
remoteServiceEndpoints,
|
|
24
|
+
research,
|
|
25
|
+
updateDocument,
|
|
26
|
+
updateTasks,
|
|
27
|
+
} from '@dxos/assistant-testing';
|
|
28
|
+
import { Blueprint } from '@dxos/blueprints';
|
|
29
|
+
import { type Space } from '@dxos/client/echo';
|
|
30
|
+
import { Obj, Ref } from '@dxos/echo';
|
|
31
|
+
import { log } from '@dxos/log';
|
|
32
|
+
import { AttentionPlugin } from '@dxos/plugin-attention';
|
|
33
|
+
import { ClientPlugin } from '@dxos/plugin-client';
|
|
34
|
+
import { type ClientPluginOptions } from '@dxos/plugin-client/types';
|
|
35
|
+
import { GraphPlugin } from '@dxos/plugin-graph';
|
|
36
|
+
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
37
|
+
import { SpacePlugin } from '@dxos/plugin-space';
|
|
38
|
+
import { Config } from '@dxos/react-client';
|
|
39
|
+
import { type DataType } from '@dxos/schema';
|
|
40
|
+
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
41
|
+
|
|
42
|
+
import { AssistantPlugin } from '../../AssistantPlugin';
|
|
43
|
+
import { Assistant } from '../../types';
|
|
44
|
+
|
|
45
|
+
// TODO(burdon): Factor out.
|
|
46
|
+
export const config = {
|
|
47
|
+
remote: new Config({
|
|
48
|
+
runtime: {
|
|
49
|
+
services: {
|
|
50
|
+
ai: {
|
|
51
|
+
// TODO(burdon): Normalize props ('url'?)
|
|
52
|
+
server: remoteServiceEndpoints.ai,
|
|
53
|
+
},
|
|
54
|
+
edge: {
|
|
55
|
+
url: remoteServiceEndpoints.edge,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
persistent: new Config({
|
|
61
|
+
runtime: {
|
|
62
|
+
client: {
|
|
63
|
+
storage: {
|
|
64
|
+
persistent: true,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
services: {
|
|
68
|
+
ai: {
|
|
69
|
+
server: remoteServiceEndpoints.ai,
|
|
70
|
+
},
|
|
71
|
+
edge: {
|
|
72
|
+
url: remoteServiceEndpoints.edge,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
}),
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
type DecoratorsProps = Omit<ClientPluginOptions, 'onClientInitialized' | 'onSpacesReady'> & {
|
|
80
|
+
plugins?: Plugin[];
|
|
81
|
+
accessTokens?: DataType.AccessToken[];
|
|
82
|
+
onInit?: (props: { space: Space; chat: Assistant.Chat; binder: AiContextBinder }) => Promise<void>;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Create storybook decorators.
|
|
87
|
+
*/
|
|
88
|
+
export const getDecorators = ({ types = [], plugins = [], accessTokens = [], onInit, ...props }: DecoratorsProps) => [
|
|
89
|
+
withPluginManager({
|
|
90
|
+
plugins: [
|
|
91
|
+
// System plugins.
|
|
92
|
+
AttentionPlugin(),
|
|
93
|
+
GraphPlugin(),
|
|
94
|
+
IntentPlugin(),
|
|
95
|
+
SettingsPlugin(),
|
|
96
|
+
SpacePlugin(),
|
|
97
|
+
ClientPlugin({
|
|
98
|
+
types: [Markdown.Document, Assistant.Chat, Blueprint.Blueprint, ...types],
|
|
99
|
+
onClientInitialized: async ({ client }) => {
|
|
100
|
+
log.info('onClientInitialized', { identity: client.halo.identity.get()?.did });
|
|
101
|
+
// Abort if already initialized.
|
|
102
|
+
if (client.halo.identity.get()) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
await client.halo.createIdentity();
|
|
107
|
+
await client.spaces.waitUntilReady();
|
|
108
|
+
|
|
109
|
+
const space = client.spaces.default;
|
|
110
|
+
// TODO(burdon): Should not require this.
|
|
111
|
+
// ERROR: invariant violation: Database was not initialized with root object.
|
|
112
|
+
// TODO(burdon): onSpacesReady is never called.
|
|
113
|
+
await space.waitUntilReady();
|
|
114
|
+
|
|
115
|
+
// Add tokens.
|
|
116
|
+
for (const accessToken of accessTokens) {
|
|
117
|
+
space.db.add(Obj.clone(accessToken));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Create chat and queue.
|
|
121
|
+
const chat = space.db.add(
|
|
122
|
+
Obj.make(Assistant.Chat, {
|
|
123
|
+
queue: Ref.fromDXN(space.queues.create().dxn),
|
|
124
|
+
}),
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
await space.db.flush({ indexes: true });
|
|
128
|
+
await onInit?.({ space, chat, binder: new AiContextBinder(await chat.queue.load()) });
|
|
129
|
+
await space.db.flush({ indexes: true });
|
|
130
|
+
},
|
|
131
|
+
...props,
|
|
132
|
+
}),
|
|
133
|
+
|
|
134
|
+
// User plugins.
|
|
135
|
+
AssistantPlugin(),
|
|
136
|
+
|
|
137
|
+
// Custom.
|
|
138
|
+
definePlugin({ id: 'example.com/plugin/testing', name: 'Testing' }, [
|
|
139
|
+
defineModule({
|
|
140
|
+
id: 'example.com/plugin/testing/module/testing',
|
|
141
|
+
activatesOn: Events.SetupArtifactDefinition,
|
|
142
|
+
activate: () => [
|
|
143
|
+
contributes(Capabilities.BlueprintDefinition, DESIGN_BLUEPRINT),
|
|
144
|
+
contributes(Capabilities.BlueprintDefinition, PLANNING_BLUEPRINT),
|
|
145
|
+
contributes(Capabilities.BlueprintDefinition, RESEARCH_BLUEPRINT),
|
|
146
|
+
contributes(Capabilities.Functions, [readDocument, updateDocument]),
|
|
147
|
+
contributes(Capabilities.Functions, [readTasks, updateTasks]),
|
|
148
|
+
contributes(Capabilities.Functions, [research]),
|
|
149
|
+
],
|
|
150
|
+
}),
|
|
151
|
+
]),
|
|
152
|
+
|
|
153
|
+
// Test-specific.
|
|
154
|
+
...plugins,
|
|
155
|
+
],
|
|
156
|
+
}),
|
|
157
|
+
withLayout({
|
|
158
|
+
fullscreen: true,
|
|
159
|
+
classNames: 'justify-center bg-deckSurface',
|
|
160
|
+
}),
|
|
161
|
+
withTheme,
|
|
162
|
+
];
|