@dxos/plugin-assistant 0.8.4-main.f9ba587 → 0.8.4-main.fd6878d
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-6ZGGH5T4.mjs → BlueprintContainer-H7H4BQ2C.mjs} +10 -9
- package/dist/lib/browser/BlueprintContainer-H7H4BQ2C.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-6XNB5NEI.mjs → ChatContainer-OUVSX5V5.mjs} +36 -17
- package/dist/lib/browser/ChatContainer-OUVSX5V5.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-IMWPRXTO.mjs → ChatDialog-P4FLEOHG.mjs} +22 -10
- 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-UJ5NHRGK.mjs → app-graph-builder-AVHHQ3KV.mjs} +16 -73
- 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-44HZKIAW.mjs → chunk-NZDCKQ6W.mjs} +32 -30
- package/dist/lib/browser/chunk-NZDCKQ6W.mjs.map +7 -0
- package/dist/lib/browser/{chunk-NTBGTFTV.mjs → chunk-QB7OVS6Z.mjs} +3 -2
- package/dist/lib/browser/chunk-QB7OVS6Z.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TQ3QW3HJ.mjs → chunk-VEBVAHNM.mjs} +1041 -882
- 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 +116 -88
- 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-TMF7JJA4.mjs → react-surface-4HXS3YLT.mjs} +52 -45
- package/dist/lib/browser/react-surface-4HXS3YLT.mjs.map +7 -0
- package/dist/lib/browser/{settings-N4HEXADL.mjs → settings-G2EZXMWT.mjs} +5 -4
- package/dist/lib/{node-esm/settings-WQ76EG6O.mjs.map → browser/settings-G2EZXMWT.mjs.map} +1 -1
- 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 +6 -13
- package/dist/lib/node-esm/{TemplateContainer-6KRNEMVE.mjs → BlueprintContainer-VH4EE4CM.mjs} +10 -9
- package/dist/lib/node-esm/BlueprintContainer-VH4EE4CM.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-VOLG7J6N.mjs → ChatContainer-D5FABDNE.mjs} +36 -17
- package/dist/lib/node-esm/ChatContainer-D5FABDNE.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-B2XNUNRM.mjs → ChatDialog-NKWVXHJP.mjs} +22 -10
- 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-MEQ5CYNI.mjs → app-graph-builder-RMOUJMMG.mjs} +16 -73
- 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-D3HTVK5D.mjs → chunk-3SOC5GOP.mjs} +1041 -882
- 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-VESVUAOS.mjs → chunk-GAWXJ7K5.mjs} +32 -30
- 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-RD755HN3.mjs +245 -0
- package/dist/lib/node-esm/chunk-RD755HN3.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-E6V2RUQ2.mjs → chunk-X6AANUHZ.mjs} +3 -2
- 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 +116 -88
- 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-6XL6SWL2.mjs → react-surface-V6JNEZVO.mjs} +52 -45
- package/dist/lib/node-esm/react-surface-V6JNEZVO.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-WQ76EG6O.mjs → settings-AIP5FOJG.mjs} +5 -4
- package/dist/lib/{browser/settings-N4HEXADL.mjs.map → node-esm/settings-AIP5FOJG.mjs.map} +1 -1
- 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 +6 -13
- 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.map +1 -1
- package/dist/types/src/components/BlueprintContainer.d.ts +8 -0
- package/dist/types/src/components/BlueprintContainer.d.ts.map +1 -0
- package/dist/types/src/components/Chat/Chat.d.ts +16 -13
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- 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 +1 -0
- package/dist/types/src/components/Chat/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer.d.ts +5 -4
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts +6 -5
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- 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 +3 -3
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +2 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +2 -2
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +10 -10
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +6 -12
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +54 -60
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- 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 +4 -3
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/reducer.d.ts +4 -4
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +1 -1
- 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 +1 -2
- package/dist/types/src/components/SequenceContainer.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -1
- 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 +2 -2
- 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.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 +6 -9
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +1 -2
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -3
- 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 +34 -44
- package/dist/types/src/hooks/chat-processor.d.ts.map +1 -1
- 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 +8 -4
- 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 +9 -18
- 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/stories/Chat.stories.d.ts +87 -18
- package/dist/types/src/stories/Chat.stories.d.ts.map +1 -1
- 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/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.map +1 -1
- 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 +25 -13
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +40 -0
- 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 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- 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 +83 -73
- package/src/AssistantPlugin.tsx +61 -41
- package/src/capabilities/ai-service.ts +28 -0
- package/src/capabilities/app-graph-builder.ts +9 -92
- package/src/capabilities/blueprint-definition.ts +32 -0
- package/src/capabilities/capabilities.ts +11 -3
- package/src/capabilities/edge-model-resolver.ts +29 -0
- package/src/capabilities/index.ts +6 -3
- package/src/capabilities/intent-resolver.ts +39 -11
- package/src/capabilities/react-surface.tsx +35 -27
- package/src/capabilities/toolkit.ts +106 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +1 -1
- package/src/components/BlueprintContainer.tsx +24 -0
- package/src/components/Chat/Chat.tsx +148 -95
- package/src/components/Chat/events.ts +50 -0
- package/src/components/Chat/index.ts +2 -0
- package/src/components/ChatContainer.tsx +39 -15
- package/src/components/ChatDialog.tsx +10 -7
- package/src/components/ChatPrompt/ChatActions.tsx +15 -20
- package/src/components/ChatPrompt/ChatOptions.tsx +59 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +28 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +11 -8
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +17 -4
- package/src/components/ChatPrompt/index.ts +2 -3
- package/src/components/ChatThread/ChatMessage.tsx +192 -148
- package/src/components/ChatThread/ChatThread.stories.tsx +221 -109
- package/src/components/ChatThread/ChatThread.tsx +12 -23
- package/src/components/ChatThread/Link.tsx +39 -0
- package/src/components/ChatThread/ToolBlock.tsx +41 -27
- package/src/components/ChatThread/reducer.ts +14 -14
- package/src/components/PromptSettings.tsx +41 -43
- package/src/components/SequenceContainer.tsx +32 -38
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +3 -2
- package/src/components/SequenceEditor/SequenceEditor.tsx +1 -1
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +37 -35
- package/src/components/TemplateEditor/TemplateEditor.tsx +39 -23
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +23 -16
- package/src/components/TemplateEditor/TemplateForm.tsx +50 -55
- package/src/components/Timeline/Timeline.stories.tsx +53 -0
- package/src/components/Timeline/Timeline.tsx +159 -0
- package/src/components/Timeline/index.ts +5 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +7 -13
- package/src/components/Toolbox/Toolbox.tsx +21 -42
- package/src/components/index.ts +2 -5
- package/src/events.ts +2 -2
- 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 +167 -188
- package/src/hooks/errors.ts +8 -0
- package/src/hooks/index.ts +8 -4
- 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} +18 -22
- 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 +5 -5
- package/src/stories/Chat.stories.tsx +246 -198
- 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/testing/data.ts +130 -0
- package/src/stories/testing/index.ts +6 -0
- package/src/stories/testing/testing.tsx +162 -0
- package/src/testing/test-functions.ts +9 -4
- package/src/testing/test-sequence.ts +18 -20
- package/src/tools/function.ts +4 -1
- package/src/tools/openapi.test.ts +10 -8
- package/src/tools/openapi.ts +4 -1
- package/src/translations.ts +29 -13
- 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 -2
- package/dist/lib/browser/ChatContainer-6XNB5NEI.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-IMWPRXTO.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-6XOYB2RN.mjs +0 -322
- package/dist/lib/browser/SequenceContainer-6XOYB2RN.mjs.map +0 -7
- package/dist/lib/browser/TemplateContainer-6ZGGH5T4.mjs.map +0 -7
- package/dist/lib/browser/ai-client-ML7OQWAO.mjs +0 -39
- package/dist/lib/browser/ai-client-ML7OQWAO.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-UJ5NHRGK.mjs.map +0 -7
- package/dist/lib/browser/chunk-44HZKIAW.mjs.map +0 -7
- package/dist/lib/browser/chunk-NTBGTFTV.mjs.map +0 -7
- package/dist/lib/browser/chunk-OZL4OHTU.mjs +0 -157
- package/dist/lib/browser/chunk-OZL4OHTU.mjs.map +0 -7
- package/dist/lib/browser/chunk-TQ3QW3HJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-TU7UUGWQ.mjs +0 -203
- package/dist/lib/browser/chunk-TU7UUGWQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-WPZ4UANI.mjs +0 -16
- package/dist/lib/browser/chunk-WPZ4UANI.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-LEAPB55Q.mjs +0 -42
- package/dist/lib/browser/intent-resolver-LEAPB55Q.mjs.map +0 -7
- package/dist/lib/browser/react-surface-TMF7JJA4.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-VOLG7J6N.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-B2XNUNRM.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-WWG6IMN3.mjs +0 -323
- package/dist/lib/node-esm/SequenceContainer-WWG6IMN3.mjs.map +0 -7
- package/dist/lib/node-esm/TemplateContainer-6KRNEMVE.mjs.map +0 -7
- package/dist/lib/node-esm/ai-client-2FQ434CT.mjs +0 -40
- package/dist/lib/node-esm/ai-client-2FQ434CT.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-MEQ5CYNI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-D3HTVK5D.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-E6V2RUQ2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HVMVHP4R.mjs +0 -158
- package/dist/lib/node-esm/chunk-HVMVHP4R.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HXKRKIN2.mjs +0 -18
- package/dist/lib/node-esm/chunk-HXKRKIN2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VESVUAOS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YYUVTTVK.mjs +0 -204
- package/dist/lib/node-esm/chunk-YYUVTTVK.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-4ULF3F7U.mjs +0 -43
- package/dist/lib/node-esm/intent-resolver-4ULF3F7U.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-6XL6SWL2.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/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
- package/dist/types/src/components/ChatPrompt/events.d.ts +0 -17
- package/dist/types/src/components/ChatPrompt/events.d.ts.map +0 -1
- package/dist/types/src/components/TemplateContainer.d.ts +0 -9
- package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
- package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/useBlueprints.d.ts +0 -4
- package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
- package/dist/types/src/hooks/useContextProvider.d.ts +0 -23
- package/dist/types/src/hooks/useContextProvider.d.ts.map +0 -1
- package/dist/types/src/hooks/useServiceContainer.d.ts +0 -8
- package/dist/types/src/hooks/useServiceContainer.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/types/schema.d.ts +0 -71
- package/dist/types/src/types/schema.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/src/capabilities/ai-client.ts +0 -39
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
- package/src/components/ChatPrompt/events.ts +0 -12
- package/src/components/TemplateContainer.tsx +0 -25
- package/src/hooks/chat-processor.test.ts +0 -15
- package/src/hooks/useBlueprints.ts +0 -31
- package/src/hooks/useChatProcessor.tsx +0 -142
- package/src/hooks/useServiceContainer.ts +0 -42
- package/src/hooks/useTextInputEvents.ts +0 -49
- package/src/types/schema.ts +0 -86
- package/src/types/template.ts +0 -66
|
@@ -4,38 +4,41 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Extension, Prec } from '@codemirror/state';
|
|
6
6
|
import { keymap } from '@codemirror/view';
|
|
7
|
+
import { Result, useRxValue } from '@effect-rx/rx-react';
|
|
7
8
|
import { createContext } from '@radix-ui/react-context';
|
|
8
|
-
import {
|
|
9
|
+
import { Array, Option } from 'effect';
|
|
9
10
|
import React, { type PropsWithChildren, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
10
11
|
|
|
11
|
-
import { Message } from '@dxos/ai';
|
|
12
|
-
import { CollaborationActions, createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
13
12
|
import { Event } from '@dxos/async';
|
|
14
13
|
import { DXN, Obj, Ref } from '@dxos/echo';
|
|
15
14
|
import { log } from '@dxos/log';
|
|
16
15
|
import { useVoiceInput } from '@dxos/plugin-transcription';
|
|
17
|
-
import { type
|
|
16
|
+
import { type Space, getSpace, useQueue } from '@dxos/react-client/echo';
|
|
18
17
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
19
|
-
import {
|
|
18
|
+
import { Input, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
20
19
|
import { ChatEditor, type ChatEditorController, type ChatEditorProps, references } from '@dxos/react-ui-chat';
|
|
21
20
|
import { type ScrollController } from '@dxos/react-ui-components';
|
|
22
21
|
import { mx } from '@dxos/react-ui-theme';
|
|
22
|
+
import { DataType } from '@dxos/schema';
|
|
23
23
|
import { isNotFalsy } from '@dxos/util';
|
|
24
24
|
|
|
25
|
-
import { type
|
|
25
|
+
import { type AiChatProcessor, useBlueprintHandlers, useReferencesProvider } from '../../hooks';
|
|
26
26
|
import { meta } from '../../meta';
|
|
27
27
|
import { type Assistant } from '../../types';
|
|
28
28
|
import {
|
|
29
29
|
ChatActions,
|
|
30
30
|
type ChatActionsProps,
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
ChatOptions,
|
|
32
|
+
ChatPresets,
|
|
33
|
+
type ChatPresetsProps,
|
|
33
34
|
ChatReferences,
|
|
34
35
|
type ChatReferencesProps,
|
|
35
36
|
ChatStatusIndicator,
|
|
36
37
|
} from '../ChatPrompt';
|
|
37
38
|
import { ChatThread as NativeChatThread, type ChatThreadProps as NativeChatThreadProps } from '../ChatThread';
|
|
38
39
|
|
|
40
|
+
import { type ChatEvent } from './events';
|
|
41
|
+
|
|
39
42
|
// TODO(burdon): Factor out.
|
|
40
43
|
const Endcap = ({ children }: PropsWithChildren) => {
|
|
41
44
|
return (
|
|
@@ -51,14 +54,12 @@ const Endcap = ({ children }: PropsWithChildren) => {
|
|
|
51
54
|
|
|
52
55
|
// TODO(burdon): Inject via effect layer.
|
|
53
56
|
type ChatContextValue = {
|
|
57
|
+
debug?: boolean;
|
|
54
58
|
event: Event<ChatEvent>;
|
|
55
59
|
space: Space;
|
|
56
60
|
chat: Assistant.Chat;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
/** @deprecated Remove and replace with context. */
|
|
61
|
-
artifact?: Expando;
|
|
61
|
+
messages: DataType.Message[];
|
|
62
|
+
processor: AiChatProcessor;
|
|
62
63
|
};
|
|
63
64
|
|
|
64
65
|
// NOTE: Do not export.
|
|
@@ -70,50 +71,64 @@ const [ChatContextProvider, useChatContext] = createContext<ChatContextValue>('C
|
|
|
70
71
|
|
|
71
72
|
type ChatRootProps = ThemedClassName<
|
|
72
73
|
PropsWithChildren<
|
|
73
|
-
Pick<ChatContextValue, 'chat' | 'processor'
|
|
74
|
+
Pick<ChatContextValue, 'chat' | 'processor'> & {
|
|
74
75
|
onEvent?: (event: ChatEvent) => void;
|
|
75
76
|
}
|
|
76
77
|
>
|
|
77
78
|
>;
|
|
78
79
|
|
|
79
|
-
const ChatRoot = ({ classNames, children, chat, processor,
|
|
80
|
+
const ChatRoot = ({ classNames, children, chat, processor, onEvent, ...props }: ChatRootProps) => {
|
|
81
|
+
const [debug, setDebug] = useState(false);
|
|
80
82
|
const space = getSpace(chat);
|
|
81
83
|
|
|
82
84
|
// Messages.
|
|
83
|
-
const queue = useQueue<Message>(chat?.queue.dxn);
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
85
|
+
const queue = useQueue<DataType.Message>(chat?.queue.dxn);
|
|
86
|
+
const pending = useRxValue(processor.messages);
|
|
87
|
+
const streaming = useRxValue(processor.streaming);
|
|
88
|
+
|
|
89
|
+
const messages = useMemo(() => {
|
|
90
|
+
const queueMessages = queue?.objects?.filter(Obj.instanceOf(DataType.Message)) ?? [];
|
|
91
|
+
return Result.match(pending, {
|
|
92
|
+
onInitial: () => queueMessages,
|
|
93
|
+
onSuccess: (pending) => Array.dedupeWith([...queueMessages, ...pending.value], (a, b) => a.id === b.id),
|
|
94
|
+
onFailure: () => queueMessages,
|
|
95
|
+
});
|
|
96
|
+
}, [queue?.objects, pending]);
|
|
97
|
+
|
|
98
|
+
// TODO(burdon): Replace with tool to select artifact.
|
|
99
|
+
// const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
100
|
+
// useEffect(() => {
|
|
101
|
+
// if (!processor?.streaming.value && queue?.objects) {
|
|
102
|
+
// const message = queue.objects[queue.objects.length - 1];
|
|
103
|
+
// if (dispatch && space && chat && message) {
|
|
104
|
+
// void dispatch(
|
|
105
|
+
// createIntent(CollaborationActions.InsertContent, {
|
|
106
|
+
// target: artifact,
|
|
107
|
+
// object: Ref.fromDXN(new DXN(DXN.kind.QUEUE, [...chat.queue.dxn.parts, message.id])),
|
|
108
|
+
// label: 'View proposal',
|
|
109
|
+
// }),
|
|
110
|
+
// );
|
|
111
|
+
// }
|
|
112
|
+
// }
|
|
113
|
+
// }, [queue, processor?.streaming.value]);
|
|
109
114
|
|
|
110
115
|
// Events.
|
|
111
116
|
const event = useMemo(() => new Event<ChatEvent>(), []);
|
|
112
117
|
useEffect(() => {
|
|
113
118
|
return event.on((event) => {
|
|
114
119
|
switch (event.type) {
|
|
120
|
+
case 'toggle-debug': {
|
|
121
|
+
setDebug((current) => {
|
|
122
|
+
const debug = !current;
|
|
123
|
+
log.info('toggle-debug', { debug });
|
|
124
|
+
// log.config({ filter: debug ? 'assistant:debug' : 'info' });
|
|
125
|
+
return debug;
|
|
126
|
+
});
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
|
|
115
130
|
case 'submit': {
|
|
116
|
-
if (!
|
|
131
|
+
if (!streaming) {
|
|
117
132
|
void processor.request(event.text);
|
|
118
133
|
}
|
|
119
134
|
break;
|
|
@@ -123,19 +138,29 @@ const ChatRoot = ({ classNames, children, chat, processor, artifact, onEvent, ..
|
|
|
123
138
|
void processor.cancel();
|
|
124
139
|
break;
|
|
125
140
|
}
|
|
126
|
-
}
|
|
127
141
|
|
|
128
|
-
|
|
142
|
+
default: {
|
|
143
|
+
onEvent?.(event);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
129
146
|
});
|
|
130
|
-
}, [event, onEvent]);
|
|
147
|
+
}, [event, onEvent, processor, streaming]);
|
|
131
148
|
|
|
132
149
|
if (!space) {
|
|
133
150
|
return null;
|
|
134
151
|
}
|
|
135
152
|
|
|
136
153
|
return (
|
|
137
|
-
<ChatContextProvider
|
|
138
|
-
|
|
154
|
+
<ChatContextProvider
|
|
155
|
+
debug={debug}
|
|
156
|
+
event={event}
|
|
157
|
+
chat={chat}
|
|
158
|
+
space={space}
|
|
159
|
+
processor={processor}
|
|
160
|
+
messages={messages}
|
|
161
|
+
{...props}
|
|
162
|
+
>
|
|
163
|
+
<div role='none' className={mx('flex flex-col h-full overflow-hidden', classNames)}>
|
|
139
164
|
{children}
|
|
140
165
|
</div>
|
|
141
166
|
</ChatContextProvider>
|
|
@@ -148,10 +173,10 @@ ChatRoot.displayName = 'Chat.Root';
|
|
|
148
173
|
// Thread
|
|
149
174
|
//
|
|
150
175
|
|
|
151
|
-
type ChatThreadProps = Omit<NativeChatThreadProps, 'identity' | 'space' | 'messages' | 'tools' | '
|
|
176
|
+
type ChatThreadProps = Omit<NativeChatThreadProps, 'identity' | 'space' | 'messages' | 'tools' | 'onEvent'>;
|
|
152
177
|
|
|
153
178
|
const ChatThread = (props: ChatThreadProps) => {
|
|
154
|
-
const { event, space,
|
|
179
|
+
const { debug, event, space, messages } = useChatContext(ChatThread.displayName);
|
|
155
180
|
const identity = useIdentity();
|
|
156
181
|
|
|
157
182
|
const scrollerRef = useRef<ScrollController>(null);
|
|
@@ -166,16 +191,6 @@ const ChatThread = (props: ChatThreadProps) => {
|
|
|
166
191
|
});
|
|
167
192
|
}, [event]);
|
|
168
193
|
|
|
169
|
-
const handlePrompt = useCallback<NonNullable<NativeChatThreadProps['onPrompt']>>(
|
|
170
|
-
(text) => {
|
|
171
|
-
if (!processor.streaming.value) {
|
|
172
|
-
event.emit({ type: 'submit', text });
|
|
173
|
-
return true;
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
[processor, event],
|
|
177
|
-
);
|
|
178
|
-
|
|
179
194
|
if (!identity) {
|
|
180
195
|
return null;
|
|
181
196
|
}
|
|
@@ -184,11 +199,11 @@ const ChatThread = (props: ChatThreadProps) => {
|
|
|
184
199
|
<NativeChatThread
|
|
185
200
|
{...props}
|
|
186
201
|
ref={scrollerRef}
|
|
202
|
+
debug={debug}
|
|
187
203
|
identity={identity}
|
|
188
204
|
space={space}
|
|
189
205
|
messages={messages}
|
|
190
|
-
|
|
191
|
-
onPrompt={handlePrompt}
|
|
206
|
+
onEvent={(ev) => event.emit(ev)}
|
|
192
207
|
/>
|
|
193
208
|
);
|
|
194
209
|
};
|
|
@@ -199,11 +214,30 @@ ChatThread.displayName = 'Chat.Thread';
|
|
|
199
214
|
// Prompt
|
|
200
215
|
//
|
|
201
216
|
|
|
202
|
-
type ChatPromptProps = ThemedClassName<
|
|
217
|
+
type ChatPromptProps = ThemedClassName<
|
|
218
|
+
Pick<ChatEditorProps, 'placeholder'> &
|
|
219
|
+
Omit<ChatPresetsProps, 'onChange'> & {
|
|
220
|
+
expandable?: boolean;
|
|
221
|
+
online?: boolean;
|
|
222
|
+
onChangeOnline?: (online: boolean) => void;
|
|
223
|
+
onChangePreset?: ChatPresetsProps['onChange'];
|
|
224
|
+
}
|
|
225
|
+
>;
|
|
203
226
|
|
|
204
|
-
const ChatPrompt = ({
|
|
227
|
+
const ChatPrompt = ({
|
|
228
|
+
classNames,
|
|
229
|
+
placeholder,
|
|
230
|
+
expandable,
|
|
231
|
+
online,
|
|
232
|
+
presets,
|
|
233
|
+
preset,
|
|
234
|
+
onChangePreset,
|
|
235
|
+
onChangeOnline,
|
|
236
|
+
}: ChatPromptProps) => {
|
|
205
237
|
const { t } = useTranslation(meta.id);
|
|
206
238
|
const { space, event, processor } = useChatContext(ChatPrompt.displayName);
|
|
239
|
+
const streaming = useRxValue(processor.streaming);
|
|
240
|
+
const error = useRxValue(processor.error).pipe(Option.getOrUndefined);
|
|
207
241
|
|
|
208
242
|
const [active, setActive] = useState(false);
|
|
209
243
|
useEffect(() => {
|
|
@@ -230,23 +264,23 @@ const ChatPrompt = ({ classNames, placeholder, expandable }: ChatPromptProps) =>
|
|
|
230
264
|
},
|
|
231
265
|
});
|
|
232
266
|
|
|
233
|
-
const [blueprints, handleUpdateBlueprints] = useBlueprints(processor.context);
|
|
234
|
-
|
|
235
267
|
// TODO(burdon): Reconcile with object tags.
|
|
236
|
-
const
|
|
268
|
+
const referencesProvider = useReferencesProvider(space);
|
|
237
269
|
const extensions = useMemo<Extension[]>(() => {
|
|
238
270
|
return [
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
resolveReference: async ({ uri }) => contextProvider.resolveMetadata({ uri }),
|
|
244
|
-
},
|
|
245
|
-
}),
|
|
246
|
-
expandable &&
|
|
247
|
-
Prec.highest(
|
|
248
|
-
keymap.of([
|
|
271
|
+
referencesProvider && references({ provider: referencesProvider }),
|
|
272
|
+
Prec.highest(
|
|
273
|
+
keymap.of(
|
|
274
|
+
[
|
|
249
275
|
{
|
|
276
|
+
key: 'cmd-d',
|
|
277
|
+
preventDefault: true,
|
|
278
|
+
run: () => {
|
|
279
|
+
event.emit({ type: 'toggle-debug' });
|
|
280
|
+
return true;
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
expandable && {
|
|
250
284
|
key: 'cmd-ArrowUp',
|
|
251
285
|
preventDefault: true,
|
|
252
286
|
run: () => {
|
|
@@ -254,7 +288,7 @@ const ChatPrompt = ({ classNames, placeholder, expandable }: ChatPromptProps) =>
|
|
|
254
288
|
return true;
|
|
255
289
|
},
|
|
256
290
|
},
|
|
257
|
-
{
|
|
291
|
+
expandable && {
|
|
258
292
|
key: 'cmd-ArrowDown',
|
|
259
293
|
preventDefault: true,
|
|
260
294
|
run: () => {
|
|
@@ -262,19 +296,20 @@ const ChatPrompt = ({ classNames, placeholder, expandable }: ChatPromptProps) =>
|
|
|
262
296
|
return true;
|
|
263
297
|
},
|
|
264
298
|
},
|
|
265
|
-
]),
|
|
299
|
+
].filter(isNotFalsy),
|
|
266
300
|
),
|
|
301
|
+
),
|
|
267
302
|
].filter(isNotFalsy);
|
|
268
|
-
}, [event, expandable,
|
|
303
|
+
}, [event, expandable, referencesProvider]);
|
|
269
304
|
|
|
270
305
|
const handleSubmit = useCallback<NonNullable<ChatEditorProps['onSubmit']>>(
|
|
271
306
|
(text) => {
|
|
272
|
-
if (!
|
|
307
|
+
if (!streaming) {
|
|
273
308
|
event.emit({ type: 'submit', text });
|
|
274
309
|
return true;
|
|
275
310
|
}
|
|
276
311
|
},
|
|
277
|
-
[
|
|
312
|
+
[streaming, event],
|
|
278
313
|
);
|
|
279
314
|
|
|
280
315
|
const handleEvent = useCallback<NonNullable<ChatActionsProps['onEvent']>>(
|
|
@@ -284,20 +319,26 @@ const ChatPrompt = ({ classNames, placeholder, expandable }: ChatPromptProps) =>
|
|
|
284
319
|
[event],
|
|
285
320
|
);
|
|
286
321
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
322
|
+
const handleUpdateReferences = useCallback<NonNullable<ChatReferencesProps['onUpdate']>>((dxns) => {
|
|
323
|
+
log.info('update', { dxns });
|
|
324
|
+
void processor.context.bind({ objects: dxns.map((dxn) => Ref.fromDXN(DXN.parse(dxn))) });
|
|
290
325
|
}, []);
|
|
291
326
|
|
|
327
|
+
const { onUpdateBlueprint } = useBlueprintHandlers({
|
|
328
|
+
space,
|
|
329
|
+
context: processor.context,
|
|
330
|
+
blueprintRegistry: processor.blueprintRegistry,
|
|
331
|
+
});
|
|
332
|
+
|
|
292
333
|
return (
|
|
293
334
|
<div
|
|
294
335
|
className={mx(
|
|
295
|
-
'is-full grid grid-cols-[var(--rail-action)
|
|
336
|
+
'is-full grid grid-cols-[var(--rail-action)_1fr_var(--rail-action)] grid-rows-[min-content_min-content_min-content]',
|
|
296
337
|
classNames,
|
|
297
338
|
)}
|
|
298
339
|
>
|
|
299
340
|
<Endcap>
|
|
300
|
-
<ChatStatusIndicator error={
|
|
341
|
+
<ChatStatusIndicator preset={preset} error={error} processing={streaming} />
|
|
301
342
|
</Endcap>
|
|
302
343
|
|
|
303
344
|
<ChatEditor
|
|
@@ -310,25 +351,37 @@ const ChatPrompt = ({ classNames, placeholder, expandable }: ChatPromptProps) =>
|
|
|
310
351
|
onSubmit={handleSubmit}
|
|
311
352
|
/>
|
|
312
353
|
|
|
313
|
-
<
|
|
314
|
-
blueprintRegistry={processor.blueprintRegistry}
|
|
315
|
-
blueprints={blueprints}
|
|
316
|
-
onChange={handleUpdateBlueprints}
|
|
317
|
-
/>
|
|
318
|
-
|
|
354
|
+
<div />
|
|
319
355
|
<ChatReferences
|
|
320
|
-
classNames='flex pis-1 items-center'
|
|
356
|
+
classNames='col-span-2 flex pis-1 items-center'
|
|
321
357
|
space={space}
|
|
322
358
|
context={processor.context}
|
|
323
359
|
onUpdate={handleUpdateReferences}
|
|
324
360
|
/>
|
|
325
361
|
|
|
362
|
+
<ChatOptions
|
|
363
|
+
blueprintRegistry={processor.blueprintRegistry}
|
|
364
|
+
context={processor.context}
|
|
365
|
+
onUpdateBlueprint={onUpdateBlueprint}
|
|
366
|
+
/>
|
|
367
|
+
|
|
326
368
|
<ChatActions
|
|
369
|
+
classNames='col-span-2'
|
|
327
370
|
microphone={true}
|
|
328
371
|
recording={recording}
|
|
329
|
-
processing={
|
|
372
|
+
processing={streaming}
|
|
330
373
|
onEvent={handleEvent}
|
|
331
|
-
|
|
374
|
+
>
|
|
375
|
+
<>
|
|
376
|
+
<div className='grow' />
|
|
377
|
+
{presets && <ChatPresets preset={preset} presets={presets} onChange={onChangePreset} />}
|
|
378
|
+
{online !== undefined && (
|
|
379
|
+
<Input.Root>
|
|
380
|
+
<Input.Switch classNames='mis-2 mie-2' checked={online} onCheckedChange={onChangeOnline} />
|
|
381
|
+
</Input.Root>
|
|
382
|
+
)}
|
|
383
|
+
</>
|
|
384
|
+
</ChatActions>
|
|
332
385
|
</div>
|
|
333
386
|
);
|
|
334
387
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Obj } from '@dxos/echo';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The main `ChatRoot` manages the `ChatContextValue` which contains an `event` property that subcomponents
|
|
9
|
+
* can subscribe to and submit events. Unhandled events are passed to the external `onEvent` callback.
|
|
10
|
+
*/
|
|
11
|
+
export type ChatEvent =
|
|
12
|
+
| {
|
|
13
|
+
type: 'toggle-debug';
|
|
14
|
+
}
|
|
15
|
+
//
|
|
16
|
+
// Thread
|
|
17
|
+
//
|
|
18
|
+
| {
|
|
19
|
+
type: 'submit';
|
|
20
|
+
text: string;
|
|
21
|
+
}
|
|
22
|
+
| {
|
|
23
|
+
type: 'cancel';
|
|
24
|
+
}
|
|
25
|
+
| {
|
|
26
|
+
type: 'delete';
|
|
27
|
+
id: string;
|
|
28
|
+
}
|
|
29
|
+
| {
|
|
30
|
+
type: 'add';
|
|
31
|
+
object: Obj.Any;
|
|
32
|
+
}
|
|
33
|
+
//
|
|
34
|
+
// UX
|
|
35
|
+
//
|
|
36
|
+
| {
|
|
37
|
+
type: 'scroll-to-bottom';
|
|
38
|
+
}
|
|
39
|
+
| {
|
|
40
|
+
type: 'thread-open';
|
|
41
|
+
}
|
|
42
|
+
| {
|
|
43
|
+
type: 'thread-close';
|
|
44
|
+
}
|
|
45
|
+
| {
|
|
46
|
+
type: 'record-start';
|
|
47
|
+
}
|
|
48
|
+
| {
|
|
49
|
+
type: 'record-stop';
|
|
50
|
+
};
|
|
@@ -2,40 +2,64 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useEffect } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, useCapability } from '@dxos/app-framework';
|
|
8
|
-
import { type AssociatedArtifact } from '@dxos/artifact';
|
|
9
8
|
import { getSpace } from '@dxos/client/echo';
|
|
10
9
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
10
|
+
import { type MaybePromise } from '@dxos/util';
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
|
|
12
|
+
import {
|
|
13
|
+
type AiChatProcessor,
|
|
14
|
+
useBlueprintRegistry,
|
|
15
|
+
useChatProcessor,
|
|
16
|
+
useChatServices,
|
|
17
|
+
useOnline,
|
|
18
|
+
usePresets,
|
|
19
|
+
} from '../hooks';
|
|
14
20
|
import { meta } from '../meta';
|
|
15
21
|
import { type Assistant } from '../types';
|
|
16
22
|
|
|
23
|
+
import { Chat } from './Chat';
|
|
24
|
+
|
|
17
25
|
export type ChatContainerProps = {
|
|
18
|
-
role: string;
|
|
19
26
|
chat: Assistant.Chat;
|
|
20
|
-
|
|
27
|
+
role?: string;
|
|
28
|
+
onProcessorReady?: (processor: AiChatProcessor) => MaybePromise<void>;
|
|
21
29
|
};
|
|
22
30
|
|
|
23
|
-
export const ChatContainer = ({
|
|
31
|
+
export const ChatContainer = ({ chat, onProcessorReady }: ChatContainerProps) => {
|
|
24
32
|
const space = getSpace(chat);
|
|
25
33
|
const settings = useCapability(Capabilities.SettingsStore).getStore<Assistant.Settings>(meta.id)?.value;
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
34
|
+
const services = useChatServices({ space });
|
|
35
|
+
const [online, setOnline] = useOnline();
|
|
36
|
+
const { preset, ...chatProps } = usePresets(online);
|
|
37
|
+
const blueprintRegistry = useBlueprintRegistry();
|
|
38
|
+
const processor = useChatProcessor({ space, chat, preset, services, blueprintRegistry, settings });
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (processor && onProcessorReady) {
|
|
42
|
+
const timeout = setTimeout(() => onProcessorReady(processor));
|
|
43
|
+
return () => clearTimeout(timeout);
|
|
44
|
+
}
|
|
45
|
+
}, [processor, onProcessorReady]);
|
|
46
|
+
|
|
47
|
+
if (!chat || !processor) {
|
|
29
48
|
return null;
|
|
30
49
|
}
|
|
31
50
|
|
|
32
|
-
// TODO(burdon): Add attention attributes.
|
|
33
51
|
return (
|
|
34
|
-
<StackItem.Content
|
|
35
|
-
<Chat.Root chat={chat} processor={processor}
|
|
52
|
+
<StackItem.Content classNames='container-max-width'>
|
|
53
|
+
<Chat.Root chat={chat} processor={processor}>
|
|
36
54
|
<Chat.Thread />
|
|
37
|
-
<div className='
|
|
38
|
-
<Chat.Prompt
|
|
55
|
+
<div className='p-2'>
|
|
56
|
+
<Chat.Prompt
|
|
57
|
+
{...chatProps}
|
|
58
|
+
classNames='p-2 border border-transparent rounded-md'
|
|
59
|
+
preset={preset?.id}
|
|
60
|
+
online={online}
|
|
61
|
+
onChangeOnline={setOnline}
|
|
62
|
+
/>
|
|
39
63
|
</div>
|
|
40
64
|
</Chat.Root>
|
|
41
65
|
</StackItem.Content>
|
|
@@ -4,16 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Capabilities, useCapability } from '@dxos/app-framework';
|
|
8
8
|
import { getSpace } from '@dxos/client/echo';
|
|
9
9
|
import { useTranslation } from '@dxos/react-ui';
|
|
10
10
|
import { ChatDialog as NativeChatDialog } from '@dxos/react-ui-chat';
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
import { useChatProcessor, useServiceContainer } from '../hooks';
|
|
12
|
+
import { useBlueprintRegistry, useChatProcessor, useChatServices, useOnline, usePresets } from '../hooks';
|
|
14
13
|
import { meta } from '../meta';
|
|
15
14
|
import { type Assistant } from '../types';
|
|
16
15
|
|
|
16
|
+
import { Chat, type ChatRootProps } from './Chat';
|
|
17
|
+
|
|
17
18
|
export type ChatDialogProps = {
|
|
18
19
|
chat?: Assistant.Chat;
|
|
19
20
|
};
|
|
@@ -23,8 +24,11 @@ export const ChatDialog = ({ chat }: ChatDialogProps) => {
|
|
|
23
24
|
|
|
24
25
|
const space = getSpace(chat);
|
|
25
26
|
const settings = useCapability(Capabilities.SettingsStore).getStore<Assistant.Settings>(meta.id)?.value;
|
|
26
|
-
const
|
|
27
|
-
const
|
|
27
|
+
const services = useChatServices({ space });
|
|
28
|
+
const [online, setOnline] = useOnline();
|
|
29
|
+
const { preset, ...chatProps } = usePresets(online);
|
|
30
|
+
const blueprintRegistry = useBlueprintRegistry();
|
|
31
|
+
const processor = useChatProcessor({ space, chat, preset, services, blueprintRegistry, settings });
|
|
28
32
|
|
|
29
33
|
// TODO(burdon): Refocus when open.
|
|
30
34
|
const [open, setOpen] = useState(true);
|
|
@@ -36,7 +40,6 @@ export const ChatDialog = ({ chat }: ChatDialogProps) => {
|
|
|
36
40
|
setOpen(true);
|
|
37
41
|
setExpanded(true);
|
|
38
42
|
break;
|
|
39
|
-
|
|
40
43
|
case 'thread-close':
|
|
41
44
|
setOpen(false);
|
|
42
45
|
break;
|
|
@@ -55,7 +58,7 @@ export const ChatDialog = ({ chat }: ChatDialogProps) => {
|
|
|
55
58
|
<Chat.Thread />
|
|
56
59
|
</NativeChatDialog.Content>
|
|
57
60
|
<NativeChatDialog.Footer>
|
|
58
|
-
<Chat.Prompt expandable />
|
|
61
|
+
<Chat.Prompt {...chatProps} preset={preset?.id} online={online} onChangeOnline={setOnline} expandable />
|
|
59
62
|
</NativeChatDialog.Footer>
|
|
60
63
|
</NativeChatDialog.Root>
|
|
61
64
|
</Chat.Root>
|
|
@@ -2,35 +2,29 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { type PropsWithChildren } from 'react';
|
|
6
6
|
|
|
7
|
-
import { IconButton,
|
|
7
|
+
import { IconButton, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
8
8
|
import { mx } from '@dxos/react-ui-theme';
|
|
9
9
|
|
|
10
|
-
import { type ChatEvent } from './events';
|
|
11
10
|
import { meta } from '../../meta';
|
|
11
|
+
import { type ChatEvent } from '../Chat';
|
|
12
12
|
|
|
13
|
-
export type ChatActionsProps =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
export type ChatActionsProps = ThemedClassName<
|
|
14
|
+
PropsWithChildren<{
|
|
15
|
+
microphone?: boolean;
|
|
16
|
+
recording?: boolean;
|
|
17
|
+
processing?: boolean;
|
|
18
|
+
onEvent?: (event: ChatEvent) => void;
|
|
19
|
+
}>
|
|
20
|
+
>;
|
|
19
21
|
|
|
20
|
-
export const ChatActions = ({ microphone, recording, processing, onEvent }: ChatActionsProps) => {
|
|
22
|
+
export const ChatActions = ({ classNames, children, microphone, recording, processing, onEvent }: ChatActionsProps) => {
|
|
21
23
|
const { t } = useTranslation(meta.id);
|
|
22
24
|
|
|
23
25
|
return (
|
|
24
|
-
<div className='flex items-center mie-1'>
|
|
25
|
-
{
|
|
26
|
-
<Select.Root value={'ollama'} disabled>
|
|
27
|
-
<Select.TriggerButton classNames='mie-2 text-sm' />
|
|
28
|
-
<Select.Content>
|
|
29
|
-
<Select.Option value={'ollama'} classNames='text-sm'>
|
|
30
|
-
Ollama
|
|
31
|
-
</Select.Option>
|
|
32
|
-
</Select.Content>
|
|
33
|
-
</Select.Root>
|
|
26
|
+
<div className={mx('flex items-center mie-1', classNames)}>
|
|
27
|
+
{children}
|
|
34
28
|
|
|
35
29
|
{(processing && (
|
|
36
30
|
<IconButton
|
|
@@ -45,6 +39,7 @@ export const ChatActions = ({ microphone, recording, processing, onEvent }: Chat
|
|
|
45
39
|
/>
|
|
46
40
|
)) || (
|
|
47
41
|
<IconButton
|
|
42
|
+
disabled
|
|
48
43
|
classNames='px-1.5'
|
|
49
44
|
variant='ghost'
|
|
50
45
|
size={5}
|