@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
|
@@ -1,482 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { Rx } from '@effect-rx/rx-react';
|
|
8
|
-
import { type Meta, type StoryObj } from '@storybook/react';
|
|
9
|
-
import { Option, SchemaAST } from 'effect';
|
|
10
|
-
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
11
|
-
|
|
12
|
-
import { AgentStatusReport, EdgeAiServiceClient, createTool, type ExecutableTool, Message, ToolResult } from '@dxos/ai';
|
|
13
|
-
import { EXA_API_KEY, SpyAiService } from '@dxos/ai/testing';
|
|
14
|
-
import { Capabilities, contributes, createSurface, Events, Surface, useIntentDispatcher } from '@dxos/app-framework';
|
|
15
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
16
|
-
import { localServiceEndpoints, remoteServiceEndpoints } from '@dxos/artifact-testing';
|
|
17
|
-
import { findRelatedSchema, researchFn, type RelatedSchema } from '@dxos/assistant';
|
|
18
|
-
import { raise } from '@dxos/debug';
|
|
19
|
-
import { Type, Filter, Obj, Relation } from '@dxos/echo';
|
|
20
|
-
import { ATTR_RELATION_SOURCE, ATTR_RELATION_TARGET } from '@dxos/echo-schema';
|
|
21
|
-
import { ConfiguredCredentialsService, FunctionExecutor, ServiceContainer, TracingService } from '@dxos/functions';
|
|
22
|
-
import { invariant } from '@dxos/invariant';
|
|
23
|
-
import { log } from '@dxos/log';
|
|
24
|
-
import { ForceGraph, useGraphModel } from '@dxos/plugin-explorer';
|
|
25
|
-
import { useClient } from '@dxos/react-client';
|
|
26
|
-
import { getSpace, useQuery, useQueue, type EchoDatabase, type Live } from '@dxos/react-client/echo';
|
|
27
|
-
import { IconButton, Input, Toolbar, useAsyncState } from '@dxos/react-ui';
|
|
28
|
-
import {
|
|
29
|
-
createMenuAction,
|
|
30
|
-
createMenuItemGroup,
|
|
31
|
-
rxFromSignal,
|
|
32
|
-
useMenuActions,
|
|
33
|
-
type ActionGraphProps,
|
|
34
|
-
MenuProvider,
|
|
35
|
-
ToolbarMenu,
|
|
36
|
-
type ToolbarMenuActionGroupProperties,
|
|
37
|
-
} from '@dxos/react-ui-menu';
|
|
38
|
-
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
39
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
40
|
-
import { DataTypes } from '@dxos/schema';
|
|
41
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
42
|
-
|
|
43
|
-
import { testPlugins } from './testing';
|
|
44
|
-
import { Thread, type ThreadProps } from '../components';
|
|
45
|
-
import { ChatProcessor } from '../hooks';
|
|
46
|
-
import { createProcessorOptions } from '../testing';
|
|
47
|
-
import translations from '../translations';
|
|
48
|
-
|
|
49
|
-
const LOCAL = false;
|
|
50
|
-
const endpoints = LOCAL ? localServiceEndpoints : remoteServiceEndpoints;
|
|
51
|
-
|
|
52
|
-
type RenderProps = {
|
|
53
|
-
items?: Obj.Any[];
|
|
54
|
-
prompts?: string[];
|
|
55
|
-
} & Pick<ThreadProps, 'debug'>;
|
|
56
|
-
|
|
57
|
-
// TODO(burdon): Use ChatContainer.
|
|
58
|
-
const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) => {
|
|
59
|
-
const [, forceUpdate] = useState({});
|
|
60
|
-
|
|
61
|
-
const client = useClient();
|
|
62
|
-
const aiClient = useMemo(
|
|
63
|
-
() =>
|
|
64
|
-
new SpyAiService(
|
|
65
|
-
new EdgeAiServiceClient({
|
|
66
|
-
endpoint: endpoints.ai,
|
|
67
|
-
defaultGenerationOptions: {
|
|
68
|
-
// model: '@anthropic/claude-sonnet-4-20250514',
|
|
69
|
-
model: '@anthropic/claude-3-5-sonnet-20241022',
|
|
70
|
-
},
|
|
71
|
-
}),
|
|
72
|
-
),
|
|
73
|
-
[],
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
const space = client.spaces.default;
|
|
77
|
-
const model = useGraphModel(space);
|
|
78
|
-
|
|
79
|
-
const actionCreator = useMemo(() => createToolbar(aiClient), [aiClient]);
|
|
80
|
-
const menuProps = useMenuActions(actionCreator);
|
|
81
|
-
|
|
82
|
-
// Queue.
|
|
83
|
-
const [queueDxn, setQueueDxn] = useState<string>(() => space.queues.create().dxn.toString());
|
|
84
|
-
const queue = useQueue<Message>(Type.DXN.tryParse(queueDxn));
|
|
85
|
-
|
|
86
|
-
// Function executor.
|
|
87
|
-
const serviceContainer = useMemo(
|
|
88
|
-
() =>
|
|
89
|
-
new ServiceContainer().setServices({
|
|
90
|
-
ai: {
|
|
91
|
-
client: aiClient,
|
|
92
|
-
},
|
|
93
|
-
credentials: new ConfiguredCredentialsService([
|
|
94
|
-
{
|
|
95
|
-
service: 'exa.ai',
|
|
96
|
-
apiKey: EXA_API_KEY,
|
|
97
|
-
},
|
|
98
|
-
]),
|
|
99
|
-
queues: {
|
|
100
|
-
queues: space.queues,
|
|
101
|
-
contextQueue: queue,
|
|
102
|
-
},
|
|
103
|
-
database: {
|
|
104
|
-
db: space.db,
|
|
105
|
-
},
|
|
106
|
-
tracing: TracingService.console,
|
|
107
|
-
}),
|
|
108
|
-
[aiClient, space, queue],
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
const tools = useMemo<ExecutableTool[]>(() => [createResearchTool(serviceContainer, 'research', researchFn)], []);
|
|
112
|
-
|
|
113
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
114
|
-
|
|
115
|
-
// TODO(burdon): Replace with useChatProcessor.
|
|
116
|
-
// const processor = useChatProcessor(space);
|
|
117
|
-
const processor = useMemo<ChatProcessor | undefined>(() => {
|
|
118
|
-
if (!space) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return new ChatProcessor(
|
|
123
|
-
aiClient,
|
|
124
|
-
tools,
|
|
125
|
-
[],
|
|
126
|
-
{
|
|
127
|
-
space,
|
|
128
|
-
dispatch,
|
|
129
|
-
},
|
|
130
|
-
createProcessorOptions([]),
|
|
131
|
-
);
|
|
132
|
-
}, [aiClient, tools, space, dispatch]);
|
|
133
|
-
|
|
134
|
-
useEffect(() => {
|
|
135
|
-
if (queue?.objects.length === 0 && !queue.isLoading && prompts.length > 0) {
|
|
136
|
-
void queue.append([
|
|
137
|
-
Obj.make(Message, {
|
|
138
|
-
role: 'assistant',
|
|
139
|
-
content: prompts.map(
|
|
140
|
-
(prompt) =>
|
|
141
|
-
({
|
|
142
|
-
type: 'json',
|
|
143
|
-
disposition: 'suggest',
|
|
144
|
-
json: JSON.stringify({ text: prompt }),
|
|
145
|
-
}) as const,
|
|
146
|
-
),
|
|
147
|
-
}),
|
|
148
|
-
]);
|
|
149
|
-
}
|
|
150
|
-
}, [queueDxn, prompts, queue?.objects.length, queue?.isLoading]);
|
|
151
|
-
|
|
152
|
-
// State.
|
|
153
|
-
const objects = useQuery(space, Filter.or(...DataTypes.map((type) => Filter.type(type))));
|
|
154
|
-
const messages = [
|
|
155
|
-
...(queue?.objects.filter((item) => Obj.instanceOf(Message, item)) ?? []),
|
|
156
|
-
...(processor?.messages.value ?? []),
|
|
157
|
-
];
|
|
158
|
-
|
|
159
|
-
const handleSubmit = processor
|
|
160
|
-
? (message: string) => {
|
|
161
|
-
requestAnimationFrame(async () => {
|
|
162
|
-
invariant(processor);
|
|
163
|
-
if (processor.streaming.value) {
|
|
164
|
-
await processor.cancel();
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// Make sure everything is indexed before agent starts processing.
|
|
168
|
-
await space.db.flush({ indexes: true });
|
|
169
|
-
|
|
170
|
-
invariant(queue);
|
|
171
|
-
await processor.request(message, {
|
|
172
|
-
history: queue.objects,
|
|
173
|
-
onComplete: (messages) => {
|
|
174
|
-
void queue.append(messages);
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
: undefined;
|
|
182
|
-
|
|
183
|
-
const handlePrompt = useCallback(
|
|
184
|
-
(text: string) => {
|
|
185
|
-
void handleSubmit?.(text);
|
|
186
|
-
},
|
|
187
|
-
[handleSubmit],
|
|
188
|
-
);
|
|
189
|
-
|
|
190
|
-
const handleDelete = useCallback(
|
|
191
|
-
(id: string) => {
|
|
192
|
-
invariant(Type.ObjectId.isValid(id), 'Invalid message id');
|
|
193
|
-
void queue?.delete([id]);
|
|
194
|
-
},
|
|
195
|
-
[queue],
|
|
196
|
-
);
|
|
197
|
-
|
|
198
|
-
// TODO(dmaretskyi): Pull in relations automatically.
|
|
199
|
-
const handleAddToGraph = useCallback(async (object: Obj.Any) => {
|
|
200
|
-
space.db.add(instantiate(space.db, object));
|
|
201
|
-
await space.db.flush({ indexes: true });
|
|
202
|
-
forceUpdate({});
|
|
203
|
-
}, []);
|
|
204
|
-
|
|
205
|
-
const handleResearchMore = useCallback((object: Obj.Any | Relation.Any, relatedSchema: RelatedSchema) => {
|
|
206
|
-
const prompt = `
|
|
207
|
-
Research more about objects related to the object in terms of the by the specific relation schema:
|
|
208
|
-
<object>${JSON.stringify(object, null, 2)}</object>
|
|
209
|
-
<schema>
|
|
210
|
-
<description>${SchemaAST.getDescriptionAnnotation(relatedSchema.schema.ast).pipe(Option.getOrElse(() => ''))}</description>
|
|
211
|
-
<json>
|
|
212
|
-
${JSON.stringify(Type.toJsonSchema(relatedSchema.schema), null, 2)}
|
|
213
|
-
</json>
|
|
214
|
-
</schema>
|
|
215
|
-
`;
|
|
216
|
-
|
|
217
|
-
handlePrompt(prompt);
|
|
218
|
-
}, []);
|
|
219
|
-
|
|
220
|
-
return (
|
|
221
|
-
<div className={mx('grid w-full h-full grid-cols-3 overflow-hidden divide-x divide-separator')}>
|
|
222
|
-
{/* Thread */}
|
|
223
|
-
<div className='flex flex-col h-full gap-4 outline outline-separator overflow-hidden'>
|
|
224
|
-
{/* TODO(wittjosiah): Use react-ui-menu toolbar. */}
|
|
225
|
-
<Toolbar.Root classNames='p-2'>
|
|
226
|
-
<Input.Root>
|
|
227
|
-
<Input.TextInput
|
|
228
|
-
spellCheck={false}
|
|
229
|
-
placeholder='Queue DXN'
|
|
230
|
-
value={queueDxn}
|
|
231
|
-
onChange={(ev) => setQueueDxn(ev.target.value)}
|
|
232
|
-
/>
|
|
233
|
-
<IconButton
|
|
234
|
-
iconOnly
|
|
235
|
-
label='Copy DXN'
|
|
236
|
-
icon='ph--copy--regular'
|
|
237
|
-
onClick={() => navigator.clipboard.writeText(queueDxn)}
|
|
238
|
-
/>
|
|
239
|
-
<IconButton
|
|
240
|
-
iconOnly
|
|
241
|
-
label='Clear history'
|
|
242
|
-
icon='ph--trash--regular'
|
|
243
|
-
onClick={() => setQueueDxn(space.queues.create().dxn.toString())}
|
|
244
|
-
/>
|
|
245
|
-
<IconButton iconOnly label='Stop' icon='ph--stop--regular' onClick={() => processor?.cancel()} />
|
|
246
|
-
</Input.Root>
|
|
247
|
-
</Toolbar.Root>
|
|
248
|
-
|
|
249
|
-
{/* TODO(burdon): Replace with ThreadContainer. */}
|
|
250
|
-
<Thread
|
|
251
|
-
messages={messages}
|
|
252
|
-
processing={processor?.streaming.value}
|
|
253
|
-
error={processor?.error.value}
|
|
254
|
-
tools={processor?.tools}
|
|
255
|
-
onSubmit={processor ? handleSubmit : undefined}
|
|
256
|
-
onPrompt={processor ? handlePrompt : undefined}
|
|
257
|
-
onDelete={processor ? handleDelete : undefined}
|
|
258
|
-
onAddToGraph={handleAddToGraph}
|
|
259
|
-
{...props}
|
|
260
|
-
/>
|
|
261
|
-
</div>
|
|
262
|
-
|
|
263
|
-
{/* TODO(burdon): Filter/query. */}
|
|
264
|
-
<ForceGraph model={model} />
|
|
265
|
-
|
|
266
|
-
{/* Artifacts Deck */}
|
|
267
|
-
<div className='flex flex-col overflow-y-auto'>
|
|
268
|
-
{/* TODO(wittjosiah): Combine with thread toolbar. */}
|
|
269
|
-
<MenuProvider {...menuProps}>
|
|
270
|
-
<ToolbarMenu />
|
|
271
|
-
</MenuProvider>
|
|
272
|
-
{objects.map((object) => (
|
|
273
|
-
<div
|
|
274
|
-
key={object.id}
|
|
275
|
-
className={mx('flex flex-col border border-separator rounded m-2 mb-0 hover:bg-hoverSurface')}
|
|
276
|
-
>
|
|
277
|
-
<div className='px-2 text-xs text-foreground-secondary'>{object.id}</div>
|
|
278
|
-
<Surface
|
|
279
|
-
role='card'
|
|
280
|
-
limit={1}
|
|
281
|
-
data={{ subject: object }}
|
|
282
|
-
fallback={
|
|
283
|
-
<SyntaxHighlighter language='json' className='text-xs'>
|
|
284
|
-
{JSON.stringify(object, null, 2)}
|
|
285
|
-
</SyntaxHighlighter>
|
|
286
|
-
}
|
|
287
|
-
/>
|
|
288
|
-
<ResearchPrompts object={object} onResearch={handleResearchMore} />
|
|
289
|
-
</div>
|
|
290
|
-
))}
|
|
291
|
-
</div>
|
|
292
|
-
</div>
|
|
293
|
-
);
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
type ResearchPromptsProps = {
|
|
297
|
-
object: Obj.Any | Relation.Any;
|
|
298
|
-
onResearch: (object: Obj.Any | Relation.Any, relatedSchema: RelatedSchema) => void;
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
const ResearchPrompts = ({ object, onResearch }: ResearchPromptsProps) => {
|
|
302
|
-
const [relatedSchemas = []] = useAsyncState(
|
|
303
|
-
async () => findRelatedSchema(getSpace(object)!.db, Obj.getSchema(object)!),
|
|
304
|
-
[object],
|
|
305
|
-
);
|
|
306
|
-
return (
|
|
307
|
-
<div>
|
|
308
|
-
{relatedSchemas.map((schema) => (
|
|
309
|
-
<button
|
|
310
|
-
key={Type.getDXN(schema.schema)?.toString()}
|
|
311
|
-
onClick={() => onResearch(object, schema)}
|
|
312
|
-
className='border border-separator rounded px-2 py-1 m-1'
|
|
313
|
-
>
|
|
314
|
-
Research more of {Type.getTypename(schema.schema)}
|
|
315
|
-
</button>
|
|
316
|
-
))}
|
|
317
|
-
</div>
|
|
318
|
-
);
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
const createResearchTool = (serviceContainer: ServiceContainer, name: string, fn: typeof researchFn) => {
|
|
322
|
-
return createTool('example', {
|
|
323
|
-
name,
|
|
324
|
-
description: fn.description ?? raise(new Error('No description')),
|
|
325
|
-
schema: fn.inputSchema,
|
|
326
|
-
execute: async (input, { reportStatus }) => {
|
|
327
|
-
const executor = new FunctionExecutor(
|
|
328
|
-
serviceContainer.clone().setServices({
|
|
329
|
-
tracing: {
|
|
330
|
-
write: (event) => {
|
|
331
|
-
if (Obj.instanceOf(AgentStatusReport, event)) {
|
|
332
|
-
log.info('[too] report status', { status: event });
|
|
333
|
-
reportStatus?.(event);
|
|
334
|
-
}
|
|
335
|
-
},
|
|
336
|
-
},
|
|
337
|
-
}),
|
|
338
|
-
);
|
|
339
|
-
|
|
340
|
-
reportStatus?.(
|
|
341
|
-
Obj.make(AgentStatusReport, {
|
|
342
|
-
message: 'Researching...',
|
|
343
|
-
}),
|
|
344
|
-
);
|
|
345
|
-
|
|
346
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
347
|
-
|
|
348
|
-
const { result } = await executor.invoke(fn, input);
|
|
349
|
-
return ToolResult.Success(
|
|
350
|
-
'Research completed. The results are placed in the conversation and already presented to the user. No need to present them again.',
|
|
351
|
-
result.objects.map((obj: any) => ({
|
|
352
|
-
type: 'json',
|
|
353
|
-
json: JSON.stringify(obj),
|
|
354
|
-
disposition: 'graph',
|
|
355
|
-
})),
|
|
356
|
-
);
|
|
357
|
-
},
|
|
358
|
-
});
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* Instantiate an object from it's JSON representation.
|
|
363
|
-
* Resolves schema and relation references.
|
|
364
|
-
*
|
|
365
|
-
* @param db - The database to use for reference lookup.
|
|
366
|
-
* @param object - The object in JSON format to instantiate.
|
|
367
|
-
*/
|
|
368
|
-
// TODO(dmaretskyi): Move into core.
|
|
369
|
-
const instantiate = (db: EchoDatabase, object: unknown): Live<any> => {
|
|
370
|
-
const schema =
|
|
371
|
-
db.graph.schemaRegistry.getSchemaByDXN(Type.DXN.parse(Obj.getTypename(object as any)!)) ??
|
|
372
|
-
raise(new Error('Schema not found'));
|
|
373
|
-
|
|
374
|
-
let { id, [ATTR_RELATION_SOURCE]: source, [ATTR_RELATION_TARGET]: target, ...props } = object as any;
|
|
375
|
-
if (source) {
|
|
376
|
-
source = db.getObjectById(Type.DXN.parse(source).asEchoDXN()!.echoId) ?? raise(new Error('Source not found'));
|
|
377
|
-
}
|
|
378
|
-
if (target) {
|
|
379
|
-
target = db.getObjectById(Type.DXN.parse(target).asEchoDXN()!.echoId) ?? raise(new Error('Target not found'));
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
return Relation.make(schema, {
|
|
383
|
-
id,
|
|
384
|
-
[Relation.Source]: source,
|
|
385
|
-
[Relation.Target]: target,
|
|
386
|
-
...props,
|
|
387
|
-
});
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
const createToolbar = (aiClient: SpyAiService) =>
|
|
391
|
-
Rx.make((get) => {
|
|
392
|
-
const result: ActionGraphProps = { nodes: [], edges: [] };
|
|
393
|
-
const save = createMenuAction('save', () => aiClient.saveEvents(), {
|
|
394
|
-
label: 'Save events',
|
|
395
|
-
icon: 'ph--floppy-disk--regular',
|
|
396
|
-
});
|
|
397
|
-
const load = createMenuAction('load', () => aiClient.loadEvents(), {
|
|
398
|
-
label: 'Load events',
|
|
399
|
-
icon: 'ph--folder-open--regular',
|
|
400
|
-
});
|
|
401
|
-
const modes = createMenuItemGroup('mode', {
|
|
402
|
-
variant: 'dropdownMenu',
|
|
403
|
-
applyActive: true,
|
|
404
|
-
selectCardinality: 'single',
|
|
405
|
-
value: get(rxFromSignal(() => aiClient.mode)),
|
|
406
|
-
} as ToolbarMenuActionGroupProperties);
|
|
407
|
-
const spy = createMenuAction('spy', () => aiClient.setMode('spy'), {
|
|
408
|
-
label: 'Spy',
|
|
409
|
-
icon: 'ph--detective--regular',
|
|
410
|
-
checked: get(rxFromSignal(() => aiClient.mode === 'spy')),
|
|
411
|
-
});
|
|
412
|
-
const mock = createMenuAction('mock', () => aiClient.setMode('mock'), {
|
|
413
|
-
label: 'Mock',
|
|
414
|
-
icon: 'ph--rewind--regular',
|
|
415
|
-
checked: get(rxFromSignal(() => aiClient.mode === 'mock')),
|
|
416
|
-
});
|
|
417
|
-
result.nodes.push(save, load, modes, spy, mock);
|
|
418
|
-
result.edges.push(
|
|
419
|
-
{ source: 'root', target: save.id },
|
|
420
|
-
{ source: 'root', target: load.id },
|
|
421
|
-
{ source: 'root', target: modes.id },
|
|
422
|
-
{ source: modes.id, target: spy.id },
|
|
423
|
-
{ source: modes.id, target: mock.id },
|
|
424
|
-
);
|
|
425
|
-
return result;
|
|
426
|
-
});
|
|
427
|
-
|
|
428
|
-
const meta: Meta<typeof DefaultStory> = {
|
|
429
|
-
title: 'plugins/plugin-assistant/Research',
|
|
430
|
-
render: DefaultStory,
|
|
431
|
-
decorators: [
|
|
432
|
-
withPluginManager({
|
|
433
|
-
plugins: testPlugins({
|
|
434
|
-
config: {
|
|
435
|
-
runtime: {
|
|
436
|
-
client: {
|
|
437
|
-
storage: {
|
|
438
|
-
persistent: true,
|
|
439
|
-
},
|
|
440
|
-
enableVectorIndexing: true,
|
|
441
|
-
},
|
|
442
|
-
},
|
|
443
|
-
},
|
|
444
|
-
}),
|
|
445
|
-
capabilities: [
|
|
446
|
-
contributes(
|
|
447
|
-
Capabilities.ReactSurface,
|
|
448
|
-
createSurface({
|
|
449
|
-
id: 'test',
|
|
450
|
-
role: 'card',
|
|
451
|
-
position: 'fallback',
|
|
452
|
-
component: ({ data }) => (
|
|
453
|
-
<span className='text-xs whitespace-pre-wrap'>{JSON.stringify(data.subject, null, 2)}</span>
|
|
454
|
-
),
|
|
455
|
-
}),
|
|
456
|
-
),
|
|
457
|
-
],
|
|
458
|
-
fireEvents: [Events.SetupArtifactDefinition],
|
|
459
|
-
}),
|
|
460
|
-
withTheme,
|
|
461
|
-
withLayout({ fullscreen: true }),
|
|
462
|
-
],
|
|
463
|
-
parameters: {
|
|
464
|
-
translations,
|
|
465
|
-
controls: { disable: true },
|
|
466
|
-
},
|
|
467
|
-
};
|
|
468
|
-
|
|
469
|
-
export default meta;
|
|
470
|
-
|
|
471
|
-
type Story = StoryObj<typeof DefaultStory>;
|
|
472
|
-
|
|
473
|
-
export const Default: Story = {
|
|
474
|
-
args: {
|
|
475
|
-
debug: true,
|
|
476
|
-
prompts: [
|
|
477
|
-
//
|
|
478
|
-
'Research companies in the area of personal knowledge management and AI',
|
|
479
|
-
'Who founded Notion?',
|
|
480
|
-
],
|
|
481
|
-
},
|
|
482
|
-
};
|
package/src/stories/testing.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type Schema } from 'effect';
|
|
8
|
-
import defaulstDeep from 'lodash.defaultsdeep';
|
|
9
|
-
|
|
10
|
-
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
11
|
-
import { type ConfigProto } from '@dxos/config';
|
|
12
|
-
import { ChessPlugin } from '@dxos/plugin-chess';
|
|
13
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
14
|
-
import { InboxPlugin } from '@dxos/plugin-inbox';
|
|
15
|
-
import { MapPlugin } from '@dxos/plugin-map';
|
|
16
|
-
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
17
|
-
import { SpacePlugin } from '@dxos/plugin-space';
|
|
18
|
-
import { TablePlugin } from '@dxos/plugin-table';
|
|
19
|
-
import { type IndexConfig } from '@dxos/protocols/proto/dxos/echo/indexing';
|
|
20
|
-
import { Config } from '@dxos/react-client';
|
|
21
|
-
import { DataTypes } from '@dxos/schema';
|
|
22
|
-
|
|
23
|
-
type TestPluginsOptions = { config?: ConfigProto; types?: Schema.Schema.AnyNoContext[]; indexConfig?: IndexConfig };
|
|
24
|
-
|
|
25
|
-
export const testPlugins = ({ config, types = DataTypes, indexConfig }: TestPluginsOptions = {}) => [
|
|
26
|
-
ClientPlugin({
|
|
27
|
-
config: new Config(
|
|
28
|
-
defaulstDeep({}, config, {
|
|
29
|
-
runtime: {
|
|
30
|
-
services: {
|
|
31
|
-
edge: {
|
|
32
|
-
url: 'http://edge-main.dxos.workers.dev',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
),
|
|
38
|
-
types,
|
|
39
|
-
onClientInitialized: async (_, client) => {
|
|
40
|
-
if (!client.halo.identity.get()) {
|
|
41
|
-
await client.halo.createIdentity();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (indexConfig) {
|
|
45
|
-
// TODO(burdon): Rename services.services?
|
|
46
|
-
await client.services.services.QueryService!.setConfig(indexConfig);
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
}),
|
|
50
|
-
SpacePlugin(),
|
|
51
|
-
SettingsPlugin(),
|
|
52
|
-
IntentPlugin(),
|
|
53
|
-
|
|
54
|
-
// Artifacts.
|
|
55
|
-
ChessPlugin(),
|
|
56
|
-
InboxPlugin(),
|
|
57
|
-
MapPlugin(),
|
|
58
|
-
TablePlugin(),
|
|
59
|
-
PreviewPlugin(),
|
|
60
|
-
];
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { ToolRegistry } from '@dxos/ai';
|
|
6
|
-
import { EXA_API_KEY } from '@dxos/ai/testing';
|
|
7
|
-
import {
|
|
8
|
-
type BlueprintDefinition,
|
|
9
|
-
BlueprintParser,
|
|
10
|
-
createExaTool,
|
|
11
|
-
createGraphWriterTool,
|
|
12
|
-
createLocalSearchTool,
|
|
13
|
-
} from '@dxos/assistant';
|
|
14
|
-
import { type Space } from '@dxos/client/echo';
|
|
15
|
-
import { type DXN } from '@dxos/keys';
|
|
16
|
-
import { DataTypes } from '@dxos/schema';
|
|
17
|
-
import { isNonNullable } from '@dxos/util';
|
|
18
|
-
|
|
19
|
-
// TODO(dmaretskyi): make db available through services (same as function executor).
|
|
20
|
-
// TODO(burdon): Can tools implement "aspects" so that variants can be used rather than an explicit reference?
|
|
21
|
-
export const createToolRegistry = (space: Space, queueDxn?: DXN): ToolRegistry => {
|
|
22
|
-
return new ToolRegistry(
|
|
23
|
-
[
|
|
24
|
-
createExaTool({ apiKey: EXA_API_KEY }),
|
|
25
|
-
createLocalSearchTool(space.db, queueDxn && space.queues.get(queueDxn)),
|
|
26
|
-
queueDxn &&
|
|
27
|
-
createGraphWriterTool({
|
|
28
|
-
db: space.db,
|
|
29
|
-
queue: space.queues.get(queueDxn),
|
|
30
|
-
schema: DataTypes,
|
|
31
|
-
onDone: async (objects) => {
|
|
32
|
-
const queue = space.queues.get(queueDxn);
|
|
33
|
-
await queue.append(objects);
|
|
34
|
-
},
|
|
35
|
-
}),
|
|
36
|
-
].filter(isNonNullable),
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const RESEARCH_BLUEPRINT_DEFINITION: BlueprintDefinition = {
|
|
41
|
-
steps: [
|
|
42
|
-
{
|
|
43
|
-
instructions: 'Research information and entities related to the selected objects.',
|
|
44
|
-
tools: ['search/web_search'],
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
instructions:
|
|
48
|
-
'Based on your research find matching entires that are already in the graph. Do exaustive research.',
|
|
49
|
-
tools: ['search/local_search'],
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
instructions: 'Add researched data to the graph. Make connections to existing objects.',
|
|
53
|
-
tools: ['search/local_search', 'graph/writer'],
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const RESEARCH_BLUEPRINT = BlueprintParser.create().parse(RESEARCH_BLUEPRINT_DEFINITION);
|
package/src/types/chat.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Schema } from 'effect';
|
|
6
|
-
|
|
7
|
-
import { Queue } from '@dxos/client/echo';
|
|
8
|
-
import { Type } from '@dxos/echo';
|
|
9
|
-
|
|
10
|
-
export const AIChatType = Schema.Struct({
|
|
11
|
-
id: Type.ObjectId,
|
|
12
|
-
name: Schema.optional(Schema.String),
|
|
13
|
-
queue: Type.Ref(Queue),
|
|
14
|
-
}).pipe(
|
|
15
|
-
Type.Obj({
|
|
16
|
-
typename: 'dxos.org/type/AIChat',
|
|
17
|
-
version: '0.2.0',
|
|
18
|
-
}),
|
|
19
|
-
);
|
|
20
|
-
export interface AIChatType extends Schema.Schema.Type<typeof AIChatType> {}
|
|
21
|
-
|
|
22
|
-
export const CompanionTo = Schema.Struct({
|
|
23
|
-
id: Type.ObjectId,
|
|
24
|
-
}).pipe(
|
|
25
|
-
Type.Relation({
|
|
26
|
-
typename: 'dxos.org/relation/CompanionTo',
|
|
27
|
-
version: '0.1.0',
|
|
28
|
-
source: AIChatType,
|
|
29
|
-
target: Type.Expando,
|
|
30
|
-
}),
|
|
31
|
-
);
|
|
32
|
-
export interface CompanionTo extends Schema.Schema.Type<typeof CompanionTo> {}
|
package/src/types/template.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Schema } from 'effect';
|
|
6
|
-
|
|
7
|
-
import { Type } from '@dxos/echo';
|
|
8
|
-
import { LabelAnnotation } from '@dxos/echo-schema';
|
|
9
|
-
|
|
10
|
-
// TODO(burdon): Change to Schema.Literal (and discriminated union).
|
|
11
|
-
export enum TemplateInputType {
|
|
12
|
-
VALUE = 0,
|
|
13
|
-
PASS_THROUGH = 1,
|
|
14
|
-
RETRIEVER = 2,
|
|
15
|
-
FUNCTION = 3,
|
|
16
|
-
QUERY = 4,
|
|
17
|
-
RESOLVER = 5,
|
|
18
|
-
CONTEXT = 6,
|
|
19
|
-
SCHEMA = 7,
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const TemplateInputSchema = Schema.mutable(
|
|
23
|
-
Schema.Struct({
|
|
24
|
-
name: Schema.String,
|
|
25
|
-
type: Schema.optional(Schema.Enums(TemplateInputType)),
|
|
26
|
-
value: Schema.optional(Schema.String),
|
|
27
|
-
}),
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
export type TemplateInput = Schema.Schema.Type<typeof TemplateInputSchema>;
|
|
31
|
-
|
|
32
|
-
export const TemplateKinds = ['always', 'schema-matching', 'automatically', 'manual'] as const;
|
|
33
|
-
export type TemplateKind = (typeof TemplateKinds)[number];
|
|
34
|
-
|
|
35
|
-
export const TemplateKindSchema = Schema.Union(
|
|
36
|
-
Schema.Struct({
|
|
37
|
-
include: Schema.Literal('always'),
|
|
38
|
-
}),
|
|
39
|
-
Schema.Struct({
|
|
40
|
-
include: Schema.Literal('schema-matching'),
|
|
41
|
-
typename: Schema.String,
|
|
42
|
-
}),
|
|
43
|
-
Schema.Struct({
|
|
44
|
-
include: Schema.Literal('automatically'),
|
|
45
|
-
description: Schema.String,
|
|
46
|
-
}),
|
|
47
|
-
Schema.Struct({
|
|
48
|
-
include: Schema.Literal('manual'),
|
|
49
|
-
}),
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
export type TemplateKindType = Schema.Schema.Type<typeof TemplateKindSchema>;
|
|
53
|
-
export const TemplateType = Schema.Struct({
|
|
54
|
-
name: Schema.optional(Schema.String),
|
|
55
|
-
kind: Schema.mutable(TemplateKindSchema),
|
|
56
|
-
source: Schema.String,
|
|
57
|
-
inputs: Schema.optional(Schema.mutable(Schema.Array(TemplateInputSchema))),
|
|
58
|
-
command: Schema.optional(Schema.String),
|
|
59
|
-
}).pipe(
|
|
60
|
-
LabelAnnotation.set(['name']),
|
|
61
|
-
Type.Obj({
|
|
62
|
-
typename: 'dxos.org/type/Template',
|
|
63
|
-
version: '0.1.0',
|
|
64
|
-
}),
|
|
65
|
-
);
|
|
66
|
-
export interface TemplateType extends Schema.Schema.Type<typeof TemplateType> {}
|