@dxos/plugin-assistant 0.8.4-main.28f8d3d → 0.8.4-main.406dc2a
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/{BlueprintContainer-H7H4BQ2C.mjs → BlueprintContainer-WX2SSDVI.mjs} +6 -7
- package/dist/lib/browser/{BlueprintContainer-H7H4BQ2C.mjs.map → BlueprintContainer-WX2SSDVI.mjs.map} +3 -3
- package/dist/lib/browser/ChatCompanion-BDZ55ZRF.mjs +150 -0
- package/dist/lib/browser/ChatCompanion-BDZ55ZRF.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-OUVSX5V5.mjs → ChatContainer-RYGNN73X.mjs} +20 -23
- package/dist/lib/browser/ChatContainer-RYGNN73X.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-P4FLEOHG.mjs → ChatDialog-MVHH2U66.mjs} +12 -12
- package/dist/lib/browser/ChatDialog-MVHH2U66.mjs.map +7 -0
- package/dist/lib/browser/{SequenceContainer-627OQ557.mjs → SequenceContainer-2FEWMQGW.mjs} +6 -19
- package/dist/lib/browser/SequenceContainer-2FEWMQGW.mjs.map +7 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs +19 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-AVHHQ3KV.mjs → app-graph-builder-2U7SLCRX.mjs} +22 -34
- package/dist/lib/browser/app-graph-builder-2U7SLCRX.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-NSJARW5U.mjs +12 -0
- package/dist/lib/browser/blueprint-definition-NSJARW5U.mjs.map +7 -0
- package/dist/lib/browser/{blueprint-definition-CMGIZAOW.mjs → chunk-2CE2KPKZ.mjs} +69 -40
- package/dist/lib/browser/chunk-2CE2KPKZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-43I2LR6O.mjs +216 -0
- package/dist/lib/browser/chunk-43I2LR6O.mjs.map +7 -0
- package/dist/lib/browser/chunk-5EGXHCAZ.mjs +16 -0
- package/dist/lib/browser/chunk-5EGXHCAZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-5RICKAMN.mjs +18 -0
- package/dist/lib/browser/chunk-5RICKAMN.mjs.map +7 -0
- package/dist/lib/browser/chunk-CQ7UHYTT.mjs +296 -0
- package/dist/lib/browser/chunk-CQ7UHYTT.mjs.map +7 -0
- package/dist/lib/browser/{chunk-HRLMD35M.mjs → chunk-FP56WB24.mjs} +36 -15
- package/dist/lib/browser/chunk-FP56WB24.mjs.map +7 -0
- package/dist/lib/browser/chunk-JZRZVB2A.mjs +170 -0
- package/dist/lib/browser/chunk-JZRZVB2A.mjs.map +7 -0
- package/dist/lib/browser/chunk-WRJGOT5P.mjs +1794 -0
- package/dist/lib/browser/chunk-WRJGOT5P.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs +18 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +127 -54
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-MVOIEJXZ.mjs → intent-resolver-3GOJMBXJ.mjs} +48 -15
- package/dist/lib/browser/intent-resolver-3GOJMBXJ.mjs.map +7 -0
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs +17 -0
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-4HXS3YLT.mjs → react-surface-FTKCE6GG.mjs} +20 -76
- package/dist/lib/browser/react-surface-FTKCE6GG.mjs.map +7 -0
- package/dist/lib/browser/{settings-G2EZXMWT.mjs → settings-HBF32KV6.mjs} +5 -5
- package/dist/lib/browser/{settings-G2EZXMWT.mjs.map → settings-HBF32KV6.mjs.map} +1 -1
- package/dist/lib/browser/state-LXTS54DI.mjs +21 -0
- package/dist/lib/browser/state-LXTS54DI.mjs.map +7 -0
- package/dist/lib/browser/toolkit-NQ2GXCF5.mjs +199 -0
- package/dist/lib/browser/toolkit-NQ2GXCF5.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/{BlueprintContainer-VH4EE4CM.mjs → BlueprintContainer-4MKN6ZRB.mjs} +6 -7
- package/dist/lib/node-esm/{BlueprintContainer-VH4EE4CM.mjs.map → BlueprintContainer-4MKN6ZRB.mjs.map} +3 -3
- package/dist/lib/node-esm/ChatCompanion-XFNXVZIP.mjs +151 -0
- package/dist/lib/node-esm/ChatCompanion-XFNXVZIP.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-D5FABDNE.mjs → ChatContainer-UTJGCQXF.mjs} +20 -23
- package/dist/lib/node-esm/ChatContainer-UTJGCQXF.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-NKWVXHJP.mjs → ChatDialog-QEYZ4IOV.mjs} +12 -12
- package/dist/lib/node-esm/ChatDialog-QEYZ4IOV.mjs.map +7 -0
- package/dist/lib/node-esm/{SequenceContainer-EQ5NP2PG.mjs → SequenceContainer-PGGJUQ46.mjs} +6 -19
- package/dist/lib/node-esm/SequenceContainer-PGGJUQ46.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs +20 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-RMOUJMMG.mjs → app-graph-builder-OKNLR7H2.mjs} +22 -34
- package/dist/lib/node-esm/app-graph-builder-OKNLR7H2.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-WD2IVMAI.mjs +13 -0
- package/dist/lib/node-esm/blueprint-definition-WD2IVMAI.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-73ABYRYX.mjs +20 -0
- package/dist/lib/node-esm/chunk-73ABYRYX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DSE2IILK.mjs +217 -0
- package/dist/lib/node-esm/chunk-DSE2IILK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-E2WXZND7.mjs +297 -0
- package/dist/lib/node-esm/chunk-E2WXZND7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HXIBCBH4.mjs +171 -0
- package/dist/lib/node-esm/chunk-HXIBCBH4.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-F7RXCX5Y.mjs → chunk-TNR46C3L.mjs} +36 -15
- package/dist/lib/node-esm/chunk-TNR46C3L.mjs.map +7 -0
- package/dist/lib/node-esm/{blueprint-definition-AEWYMW6I.mjs → chunk-U2NYUS2N.mjs} +69 -39
- package/dist/lib/node-esm/chunk-U2NYUS2N.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UFKLCEAE.mjs +1795 -0
- package/dist/lib/node-esm/chunk-UFKLCEAE.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-X6AANUHZ.mjs → chunk-XQGWSZ4T.mjs} +4 -4
- package/dist/lib/node-esm/chunk-XQGWSZ4T.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs +19 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +127 -54
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-DTDNCX3C.mjs → intent-resolver-6XLVTRDJ.mjs} +48 -15
- package/dist/lib/node-esm/intent-resolver-6XLVTRDJ.mjs.map +7 -0
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs +18 -0
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-V6JNEZVO.mjs → react-surface-K7ZXQLAP.mjs} +20 -76
- package/dist/lib/node-esm/react-surface-K7ZXQLAP.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-AIP5FOJG.mjs → settings-CWP6MTWP.mjs} +5 -5
- package/dist/lib/node-esm/{settings-AIP5FOJG.mjs.map → settings-CWP6MTWP.mjs.map} +1 -1
- package/dist/lib/node-esm/state-BO6GUFLB.mjs +22 -0
- package/dist/lib/node-esm/state-BO6GUFLB.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-V57PRJNG.mjs +200 -0
- package/dist/lib/node-esm/toolkit-V57PRJNG.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/AssistantPlugin.d.ts +1 -1
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts +2 -3
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +8 -8
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +2 -3
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +7 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +10 -0
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/capabilities/state.d.ts +4 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit.d.ts +2 -3
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +16 -10
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +5 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts +13 -0
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +3 -4
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +7 -0
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
- package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
- package/dist/types/src/components/ChatProgress/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +11 -4
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +3 -4
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +12 -7
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +112 -56
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/reducers.d.ts +40 -0
- package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/registry.d.ts +11 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.d.ts +36 -0
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts +2 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts.map +1 -0
- package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
- package/dist/types/src/components/SequenceContainer.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +264 -3
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +0 -5
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +262 -7
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +259 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts +12 -0
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +19 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts +2 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/index.d.ts +3 -0
- package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +5 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/index.d.ts +2 -0
- package/dist/types/src/components/Toolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +11 -0
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +1 -3
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +263 -5
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/functions/analysis.d.ts.map +1 -1
- package/dist/types/src/functions/list.d.ts.map +1 -1
- package/dist/types/src/functions/load.d.ts +1 -1
- package/dist/types/src/functions/load.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +4 -4
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +5 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +4 -10
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +5 -5
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextBinder.d.ts +4 -0
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
- package/dist/types/src/hooks/useFlush.d.ts.map +1 -0
- package/dist/types/src/hooks/useItemTypes.d.ts +4 -0
- package/dist/types/src/hooks/useItemTypes.d.ts.map +1 -0
- package/dist/types/src/hooks/usePresets.d.ts +2 -2
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +3 -0
- package/dist/types/src/processor/index.d.ts.map +1 -0
- package/dist/types/src/{hooks → processor}/presets.d.ts +1 -1
- package/dist/types/src/processor/presets.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +74 -0
- package/dist/types/src/processor/processor.d.ts.map +1 -0
- package/dist/types/src/processor/processor.test.d.ts +2 -0
- package/dist/types/src/processor/processor.test.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-generator.d.ts +7 -0
- package/dist/types/src/testing/test-generator.d.ts.map +1 -0
- package/dist/types/src/testing/test-sequence.d.ts +0 -4
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts +2 -2
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +27 -16
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +16 -5
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantAction.d.ts +23 -6
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +21 -18
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +90 -96
- package/src/AssistantPlugin.tsx +138 -116
- package/src/capabilities/ai-service.ts +6 -7
- package/src/capabilities/app-graph-builder.ts +39 -45
- package/src/capabilities/blueprint-definition.ts +51 -19
- package/src/capabilities/capabilities.ts +8 -12
- package/src/capabilities/edge-model-resolver.ts +17 -21
- package/src/capabilities/index.ts +5 -2
- package/src/capabilities/intent-resolver.ts +38 -15
- package/src/capabilities/local-model-resolver.ts +30 -0
- package/src/capabilities/react-surface.tsx +9 -63
- package/src/capabilities/state.ts +20 -0
- package/src/capabilities/toolkit.ts +93 -31
- package/src/components/AssistantSettings/AssistantSettings.tsx +82 -75
- package/src/components/BlueprintContainer.tsx +2 -2
- package/src/components/Chat/Chat.tsx +167 -172
- package/src/components/Chat/events.ts +7 -0
- package/src/components/ChatCompanion.tsx +136 -0
- package/src/components/ChatContainer.tsx +13 -31
- package/src/components/ChatDialog.tsx +11 -11
- package/src/components/ChatProgress/ChatProgress.tsx +67 -0
- package/src/components/ChatProgress/index.ts +5 -0
- package/src/components/ChatPrompt/ChatActions.tsx +10 -24
- package/src/components/ChatPrompt/ChatOptions.tsx +200 -34
- package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +29 -36
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
- package/src/components/ChatThread/ChatThread.stories.tsx +74 -205
- package/src/components/ChatThread/ChatThread.tsx +69 -29
- package/src/components/ChatThread/Link.tsx +8 -21
- package/src/components/ChatThread/reducers.ts +151 -0
- package/src/components/ChatThread/registry.tsx +184 -0
- package/src/components/ChatThread/sync.test.ts +81 -0
- package/src/components/ChatThread/sync.ts +113 -0
- package/src/components/PromptSettings.tsx +1 -0
- package/src/components/SequenceContainer.tsx +27 -29
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +8 -6
- package/src/components/SequenceEditor/SequenceEditor.tsx +2 -2
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +17 -13
- package/src/components/TemplateEditor/TemplateEditor.tsx +16 -50
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +6 -8
- package/src/components/TemplateEditor/TemplateForm.tsx +2 -1
- package/src/components/TemplateEditor/handlebars-extension.ts +165 -0
- package/src/components/ToolBlock/ToolBlock.tsx +152 -0
- package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
- package/src/components/ToolBlock/index.ts +6 -0
- package/src/components/Toolbar/Toolbar.tsx +21 -0
- package/src/components/{Timeline → Toolbar}/index.ts +1 -1
- package/src/components/Toolbar/useChatToolbarActions.ts +126 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +9 -12
- package/src/components/Toolbox/Toolbox.tsx +10 -16
- package/src/components/index.ts +3 -1
- package/src/functions/analysis.ts +6 -4
- package/src/functions/list.ts +9 -3
- package/src/functions/load.ts +8 -5
- package/src/hooks/index.ts +4 -5
- package/src/hooks/useBlueprintRegistry.ts +24 -9
- package/src/hooks/useChatProcessor.ts +19 -26
- package/src/hooks/useChatServices.ts +30 -53
- package/src/hooks/useContextBinder.ts +30 -0
- package/src/hooks/useContextObjects.ts +58 -0
- package/src/hooks/useItemTypes.ts +37 -0
- package/src/hooks/usePresets.ts +4 -5
- package/src/index.ts +2 -0
- package/src/meta.ts +4 -6
- package/src/processor/index.ts +6 -0
- package/src/{hooks → processor}/presets.ts +10 -3
- package/src/processor/processor.test.ts +81 -0
- package/src/processor/processor.ts +302 -0
- package/src/queue-logger.ts +5 -5
- package/src/testing/index.ts +1 -1
- package/src/testing/test-generator.ts +261 -0
- package/src/testing/test-sequence.ts +1 -26
- package/src/testing/test-services.ts +2 -8
- package/src/translations.ts +29 -17
- package/src/types/Assistant.ts +9 -4
- package/src/types/AssistantAction.ts +11 -3
- package/src/types/service.ts +15 -7
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/ChatContainer-OUVSX5V5.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-P4FLEOHG.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-627OQ557.mjs.map +0 -7
- package/dist/lib/browser/ai-service-7KJ5LXBT.mjs +0 -22
- package/dist/lib/browser/ai-service-7KJ5LXBT.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-AVHHQ3KV.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs.map +0 -7
- package/dist/lib/browser/chunk-BRLHDHOF.mjs +0 -244
- package/dist/lib/browser/chunk-BRLHDHOF.mjs.map +0 -7
- package/dist/lib/browser/chunk-HRLMD35M.mjs.map +0 -7
- package/dist/lib/browser/chunk-LKP65RPA.mjs +0 -20
- package/dist/lib/browser/chunk-LKP65RPA.mjs.map +0 -7
- package/dist/lib/browser/chunk-NZDCKQ6W.mjs +0 -89
- package/dist/lib/browser/chunk-NZDCKQ6W.mjs.map +0 -7
- package/dist/lib/browser/chunk-QB7OVS6Z.mjs +0 -16
- package/dist/lib/browser/chunk-QB7OVS6Z.mjs.map +0 -7
- package/dist/lib/browser/chunk-VEBVAHNM.mjs +0 -2231
- package/dist/lib/browser/chunk-VEBVAHNM.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs +0 -24
- package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-MVOIEJXZ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-4HXS3YLT.mjs.map +0 -7
- package/dist/lib/browser/toolkit-IW4FBLLB.mjs +0 -105
- package/dist/lib/browser/toolkit-IW4FBLLB.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-D5FABDNE.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-NKWVXHJP.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-LDD32477.mjs +0 -23
- package/dist/lib/node-esm/ai-service-LDD32477.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-RMOUJMMG.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3SOC5GOP.mjs +0 -2232
- package/dist/lib/node-esm/chunk-3SOC5GOP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F7RXCX5Y.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GAWXJ7K5.mjs +0 -90
- package/dist/lib/node-esm/chunk-GAWXJ7K5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KOC6ESG7.mjs +0 -22
- package/dist/lib/node-esm/chunk-KOC6ESG7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RD755HN3.mjs +0 -245
- package/dist/lib/node-esm/chunk-RD755HN3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-X6AANUHZ.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs +0 -25
- package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-DTDNCX3C.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-V6JNEZVO.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-2VNUL77B.mjs +0 -106
- package/dist/lib/node-esm/toolkit-2VNUL77B.mjs.map +0 -7
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -18
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +0 -19
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
- package/dist/types/src/components/Timeline/Timeline.d.ts +0 -24
- package/dist/types/src/components/Timeline/Timeline.d.ts.map +0 -1
- package/dist/types/src/components/Timeline/Timeline.stories.d.ts +0 -9
- package/dist/types/src/components/Timeline/Timeline.stories.d.ts.map +0 -1
- package/dist/types/src/components/Timeline/index.d.ts +0 -2
- package/dist/types/src/components/Timeline/index.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.d.ts +0 -72
- package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
- package/dist/types/src/hooks/errors.d.ts +0 -4
- package/dist/types/src/hooks/errors.d.ts.map +0 -1
- package/dist/types/src/hooks/presets.d.ts.map +0 -1
- package/dist/types/src/hooks/useResolveRef.d.ts +0 -4
- package/dist/types/src/hooks/useResolveRef.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.d.ts +0 -4
- package/dist/types/src/parser/filter-generator.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.test.d.ts +0 -2
- package/dist/types/src/parser/filter-generator.test.d.ts.map +0 -1
- package/dist/types/src/parser/index.d.ts +0 -4
- package/dist/types/src/parser/index.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.d.ts +0 -15
- package/dist/types/src/parser/query-parser.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.test.d.ts +0 -2
- package/dist/types/src/parser/query-parser.test.d.ts.map +0 -1
- package/dist/types/src/parser/types.d.ts +0 -24
- package/dist/types/src/parser/types.d.ts.map +0 -1
- package/dist/types/src/stories/Chat.stories.d.ts +0 -268
- package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/stories/components/BlueprintContainer.d.ts +0 -5
- package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/ChatContainer.d.ts +0 -5
- package/dist/types/src/stories/components/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/GraphContainer.d.ts +0 -6
- package/dist/types/src/stories/components/GraphContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/LoggingContainer.d.ts +0 -5
- package/dist/types/src/stories/components/LoggingContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/SurfaceContainer.d.ts +0 -8
- package/dist/types/src/stories/components/SurfaceContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/TasksContainer.d.ts +0 -5
- package/dist/types/src/stories/components/TasksContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/index.d.ts +0 -8
- package/dist/types/src/stories/components/index.d.ts.map +0 -1
- package/dist/types/src/stories/components/types.d.ts +0 -7
- package/dist/types/src/stories/components/types.d.ts.map +0 -1
- package/dist/types/src/stories/hooks/index.d.ts +0 -3
- package/dist/types/src/stories/hooks/index.d.ts.map +0 -1
- package/dist/types/src/stories/hooks/useFlush.d.ts.map +0 -1
- package/dist/types/src/stories/hooks/useMatcherExtension.d.ts +0 -3
- package/dist/types/src/stories/hooks/useMatcherExtension.d.ts.map +0 -1
- package/dist/types/src/stories/testing/data.d.ts +0 -142
- package/dist/types/src/stories/testing/data.d.ts.map +0 -1
- package/dist/types/src/stories/testing/index.d.ts +0 -3
- package/dist/types/src/stories/testing/index.d.ts.map +0 -1
- package/dist/types/src/stories/testing/testing.d.ts +0 -26
- package/dist/types/src/stories/testing/testing.d.ts.map +0 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -6
- package/dist/types/src/testing/test-functions.d.ts.map +0 -1
- package/dist/types/src/tools/function.d.ts +0 -5
- package/dist/types/src/tools/function.d.ts.map +0 -1
- package/dist/types/src/tools/index.d.ts +0 -3
- package/dist/types/src/tools/index.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.d.ts +0 -10
- package/dist/types/src/tools/openapi.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.test.d.ts +0 -2
- package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
- package/src/components/ChatThread/ChatMessage.tsx +0 -282
- package/src/components/ChatThread/ToolBlock.tsx +0 -125
- package/src/components/ChatThread/reducer.ts +0 -52
- package/src/components/Timeline/Timeline.stories.tsx +0 -53
- package/src/components/Timeline/Timeline.tsx +0 -159
- package/src/hooks/chat-processor.ts +0 -260
- package/src/hooks/errors.ts +0 -8
- package/src/hooks/useResolveRef.ts +0 -33
- package/src/parser/filter-generator.test.ts +0 -32
- package/src/parser/filter-generator.ts +0 -74
- package/src/parser/index.ts +0 -7
- package/src/parser/query-parser.test.ts +0 -139
- package/src/parser/query-parser.ts +0 -199
- package/src/parser/types.ts +0 -34
- package/src/shims.d.ts +0 -8
- package/src/stories/Chat.stories.tsx +0 -317
- package/src/stories/components/BlueprintContainer.tsx +0 -34
- package/src/stories/components/ChatContainer.tsx +0 -80
- package/src/stories/components/GraphContainer.tsx +0 -118
- package/src/stories/components/LoggingContainer.tsx +0 -22
- package/src/stories/components/SurfaceContainer.tsx +0 -62
- package/src/stories/components/TasksContainer.tsx +0 -51
- package/src/stories/components/index.ts +0 -12
- package/src/stories/components/types.ts +0 -11
- package/src/stories/hooks/index.ts +0 -6
- package/src/stories/hooks/useMatcherExtension.ts +0 -45
- package/src/stories/testing/data.ts +0 -130
- package/src/stories/testing/index.ts +0 -6
- package/src/stories/testing/testing.tsx +0 -162
- package/src/testing/test-functions.ts +0 -16
- package/src/tools/function.ts +0 -49
- package/src/tools/index.ts +0 -6
- package/src/tools/openapi.test.ts +0 -219
- package/src/tools/openapi.ts +0 -341
- package/src/typings.d.ts +0 -9
- /package/dist/types/src/{stories/hooks → hooks}/useFlush.d.ts +0 -0
- /package/src/{stories/hooks → hooks}/useFlush.ts +0 -0
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React from 'react';
|
|
9
7
|
|
|
10
8
|
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
@@ -15,7 +13,7 @@ import { ClientPlugin } from '@dxos/plugin-client';
|
|
|
15
13
|
import { MapPlugin } from '@dxos/plugin-map';
|
|
16
14
|
import { SpacePlugin } from '@dxos/plugin-space';
|
|
17
15
|
import { TablePlugin } from '@dxos/plugin-table';
|
|
18
|
-
import {
|
|
16
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
19
17
|
|
|
20
18
|
import { translations } from '../../translations';
|
|
21
19
|
|
|
@@ -25,11 +23,12 @@ const DefaultStory = (props: ToolboxProps) => {
|
|
|
25
23
|
return <Toolbox {...props} classNames='w-[30rem] h-[15rem] rounded-sm border border-separator py-1' />;
|
|
26
24
|
};
|
|
27
25
|
|
|
28
|
-
const meta
|
|
26
|
+
const meta = {
|
|
29
27
|
title: 'plugins/plugin-assistant/Toolbox',
|
|
30
|
-
component: Toolbox,
|
|
28
|
+
component: Toolbox as any,
|
|
31
29
|
render: DefaultStory,
|
|
32
30
|
decorators: [
|
|
31
|
+
withTheme,
|
|
33
32
|
withPluginManager({
|
|
34
33
|
plugins: [
|
|
35
34
|
ClientPlugin({
|
|
@@ -37,7 +36,7 @@ const meta: Meta<typeof Toolbox> = {
|
|
|
37
36
|
await client.halo.createIdentity();
|
|
38
37
|
},
|
|
39
38
|
}),
|
|
40
|
-
SpacePlugin(),
|
|
39
|
+
SpacePlugin({}),
|
|
41
40
|
SettingsPlugin(),
|
|
42
41
|
IntentPlugin(),
|
|
43
42
|
ChessPlugin(),
|
|
@@ -46,17 +45,15 @@ const meta: Meta<typeof Toolbox> = {
|
|
|
46
45
|
],
|
|
47
46
|
capabilities,
|
|
48
47
|
}),
|
|
49
|
-
withTheme,
|
|
50
|
-
withLayout(),
|
|
51
48
|
],
|
|
52
49
|
parameters: {
|
|
53
50
|
layout: 'centered',
|
|
54
51
|
translations,
|
|
55
52
|
},
|
|
56
|
-
}
|
|
53
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
57
54
|
|
|
58
55
|
export default meta;
|
|
59
56
|
|
|
60
|
-
type Story =
|
|
57
|
+
type Story = StoryObj<typeof meta>;
|
|
61
58
|
|
|
62
|
-
export const Default = {}
|
|
59
|
+
export const Default: Story = {};
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { type FC, Fragment, useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type Tool } from '@dxos/ai';
|
|
8
7
|
import { type Blueprint } from '@dxos/blueprints';
|
|
9
8
|
import { type Ref } from '@dxos/echo';
|
|
10
9
|
import { FunctionType } from '@dxos/functions';
|
|
@@ -14,13 +13,12 @@ import { type ThemedClassName } from '@dxos/react-ui';
|
|
|
14
13
|
import { useTranslation } from '@dxos/react-ui';
|
|
15
14
|
import { mx } from '@dxos/react-ui-theme';
|
|
16
15
|
|
|
17
|
-
import { type AiChatProcessor } from '../../hooks';
|
|
18
16
|
import { meta } from '../../meta';
|
|
19
|
-
import {
|
|
17
|
+
import { type AiChatProcessor } from '../../processor';
|
|
20
18
|
import { ServiceType } from '../../types';
|
|
21
19
|
|
|
22
20
|
export type ToolboxProps = ThemedClassName<{
|
|
23
|
-
services?: { service: ServiceType
|
|
21
|
+
services?: { service: ServiceType }[];
|
|
24
22
|
functions?: FunctionType[];
|
|
25
23
|
// TODO(burdon): Combine into single array.
|
|
26
24
|
blueprints?: readonly Ref.Ref<Blueprint.Blueprint>[];
|
|
@@ -57,10 +55,10 @@ export const Toolbox = ({ classNames, functions, services, blueprints, activeBlu
|
|
|
57
55
|
{services && services.length > 0 && (
|
|
58
56
|
<Section
|
|
59
57
|
title='Services'
|
|
60
|
-
items={services.map(({ service: { serviceId, name, description }
|
|
58
|
+
items={services.map(({ service: { serviceId, name, description } }) => ({
|
|
61
59
|
name: name ?? serviceId,
|
|
62
60
|
description,
|
|
63
|
-
subitems: tools.map(({ name, description }) => ({ name: `∙ ${name}`, description })),
|
|
61
|
+
// subitems: tools.map(({ name, description }) => ({ name: `∙ ${name}`, description })),
|
|
64
62
|
}))}
|
|
65
63
|
/>
|
|
66
64
|
)}
|
|
@@ -68,10 +66,6 @@ export const Toolbox = ({ classNames, functions, services, blueprints, activeBlu
|
|
|
68
66
|
{functions && functions.length > 0 && (
|
|
69
67
|
<Section title='Functions' items={functions.map(({ name, description }) => ({ name, description }))} />
|
|
70
68
|
)}
|
|
71
|
-
|
|
72
|
-
{!blueprints?.length && !activeBlueprints?.length && !services?.length && !functions?.length && (
|
|
73
|
-
<div>{t('no tools')}</div>
|
|
74
|
-
)}
|
|
75
69
|
</div>
|
|
76
70
|
);
|
|
77
71
|
};
|
|
@@ -118,15 +112,15 @@ export type ToolboxContainerProps = ThemedClassName<{
|
|
|
118
112
|
export const ToolboxContainer = ({ classNames, space, processor }: ToolboxContainerProps) => {
|
|
119
113
|
// Registered services.
|
|
120
114
|
const services = useQuery(space, Filter.type(ServiceType));
|
|
121
|
-
const [serviceTools, setServiceTools] = useState<{ service: ServiceType
|
|
115
|
+
const [serviceTools, setServiceTools] = useState<{ service: ServiceType }[]>([]);
|
|
122
116
|
useEffect(() => {
|
|
123
117
|
log('creating service tools...', { services: services.length });
|
|
124
118
|
queueMicrotask(async () => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
)
|
|
128
|
-
|
|
129
|
-
setServiceTools(tools);
|
|
119
|
+
// TODO(burdon): Fix.
|
|
120
|
+
// const tools = await Promise.all(
|
|
121
|
+
// services.map(async (service) => ({ service, tools: await createToolsFromService(service) })),
|
|
122
|
+
// );
|
|
123
|
+
// setServiceTools(tools);
|
|
130
124
|
});
|
|
131
125
|
}, [services]);
|
|
132
126
|
|
package/src/components/index.ts
CHANGED
|
@@ -6,12 +6,14 @@ import { lazy } from 'react';
|
|
|
6
6
|
|
|
7
7
|
export * from './AssistantSettings';
|
|
8
8
|
export * from './Chat';
|
|
9
|
+
export * from './ChatProgress';
|
|
9
10
|
export * from './PromptSettings';
|
|
10
11
|
export * from './TemplateEditor';
|
|
11
|
-
export * from './
|
|
12
|
+
export * from './Toolbar';
|
|
12
13
|
export * from './Toolbox';
|
|
13
14
|
|
|
14
15
|
export const BlueprintContainer = lazy(() => import('./BlueprintContainer'));
|
|
16
|
+
export const ChatCompanion = lazy(() => import('./ChatCompanion'));
|
|
15
17
|
export const ChatContainer = lazy(() => import('./ChatContainer'));
|
|
16
18
|
export const ChatDialog = lazy(() => import('./ChatDialog'));
|
|
17
19
|
export const SequenceContainer = lazy(() => import('./SequenceContainer'));
|
|
@@ -2,19 +2,21 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
6
7
|
|
|
7
8
|
import { defineFunction } from '@dxos/functions';
|
|
8
9
|
import { log } from '@dxos/log';
|
|
9
10
|
|
|
10
11
|
export default defineFunction({
|
|
11
|
-
|
|
12
|
+
key: 'dxos.org/function/assistant-analysis',
|
|
13
|
+
name: 'Assistant analysis',
|
|
12
14
|
description: 'Enter analysis analysis mode.',
|
|
13
15
|
inputSchema: Schema.Struct({
|
|
14
16
|
enable: Schema.Boolean.annotations({ description: 'Enable or disable analysis mode.' }),
|
|
15
17
|
}),
|
|
16
18
|
outputSchema: Schema.Void,
|
|
17
|
-
handler: Effect.fn(function* ({ data: { enable } }) {
|
|
18
|
-
log.info('analysis mode', { enable });
|
|
19
|
+
handler: Effect.fn(function* ({ context, data: { enable } }) {
|
|
20
|
+
log.info('analysis mode', { space: context.space?.id, enable });
|
|
19
21
|
}),
|
|
20
22
|
});
|
package/src/functions/list.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
6
7
|
|
|
7
8
|
import { Filter, Obj, Query } from '@dxos/echo';
|
|
8
9
|
import { DatabaseService, defineFunction } from '@dxos/functions';
|
|
@@ -10,7 +11,8 @@ import { trim } from '@dxos/util';
|
|
|
10
11
|
|
|
11
12
|
// TODO(burdon): Factor out to space plugin.
|
|
12
13
|
export default defineFunction({
|
|
13
|
-
|
|
14
|
+
key: 'dxos.org/function/assistant/list',
|
|
15
|
+
name: 'Assistant list',
|
|
14
16
|
description:
|
|
15
17
|
// TODO(wittjosiah): Find a better way to prompt for looking up typenames before querying with them.
|
|
16
18
|
trim`
|
|
@@ -31,7 +33,11 @@ export default defineFunction({
|
|
|
31
33
|
),
|
|
32
34
|
}),
|
|
33
35
|
handler: Effect.fn(function* ({ data: { typename } }) {
|
|
34
|
-
|
|
36
|
+
// TODO(wittjosiah): Typename query is not working for dynamic schemas.
|
|
37
|
+
const [schema] = yield* DatabaseService.runSchemaQuery({ typename });
|
|
38
|
+
const filter = schema ? Filter.type(schema) : Filter.typename(typename);
|
|
39
|
+
|
|
40
|
+
const { objects } = yield* DatabaseService.runQuery(Query.select(filter));
|
|
35
41
|
const results = objects.map((object) => ({
|
|
36
42
|
dxn: Obj.getDXN(object).toString(),
|
|
37
43
|
label: Obj.getLabel(object),
|
package/src/functions/load.ts
CHANGED
|
@@ -2,17 +2,20 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Function from 'effect/Function';
|
|
7
|
+
import * as Option from 'effect/Option';
|
|
8
|
+
import * as Schema from 'effect/Schema';
|
|
6
9
|
|
|
7
10
|
import { ArtifactId } from '@dxos/assistant';
|
|
8
11
|
import { Obj } from '@dxos/echo';
|
|
9
12
|
import { DatabaseService, defineFunction } from '@dxos/functions';
|
|
10
|
-
import { log } from '@dxos/log';
|
|
11
13
|
|
|
12
14
|
// TODO(burdon): Common error handling.
|
|
13
15
|
// TODO(burdon): Factor out to space plugin.
|
|
14
16
|
export default defineFunction({
|
|
15
|
-
|
|
17
|
+
key: 'dxos.org/function/assistant/load',
|
|
18
|
+
name: 'Assistant load',
|
|
16
19
|
description: 'Loads the object.',
|
|
17
20
|
inputSchema: Schema.Struct({
|
|
18
21
|
id: ArtifactId.annotations({
|
|
@@ -28,13 +31,13 @@ export default defineFunction({
|
|
|
28
31
|
}),
|
|
29
32
|
handler: Effect.fn(function* ({ data: { id, typename } }) {
|
|
30
33
|
const object = yield* DatabaseService.resolve(ArtifactId.toDXN(id));
|
|
31
|
-
return yield* pipe(
|
|
34
|
+
return yield* Function.pipe(
|
|
32
35
|
Option.fromNullable(object),
|
|
33
36
|
Option.flatMap((object) => (Obj.getTypename(object) === typename ? Option.some(object) : Option.none())),
|
|
34
37
|
Option.match({
|
|
35
38
|
onNone: () => Effect.fail('Object not found.'),
|
|
36
39
|
onSome: (object) => {
|
|
37
|
-
log.info('object', { object });
|
|
40
|
+
// log.info('object', { object });
|
|
38
41
|
return Effect.succeed({ object });
|
|
39
42
|
},
|
|
40
43
|
}),
|
package/src/hooks/index.ts
CHANGED
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export * from './chat-processor';
|
|
6
|
-
export * from './errors';
|
|
7
|
-
export * from './presets';
|
|
8
|
-
|
|
9
5
|
export * from './useBlueprintRegistry';
|
|
10
6
|
export * from './useChatProcessor';
|
|
11
7
|
export * from './useChatServices';
|
|
8
|
+
export * from './useContextBinder';
|
|
9
|
+
export * from './useContextObjects';
|
|
10
|
+
export * from './useFlush';
|
|
11
|
+
export * from './useItemTypes';
|
|
12
12
|
export * from './useOnline';
|
|
13
13
|
export * from './usePresets';
|
|
14
14
|
export * from './useReferencesProvider';
|
|
15
|
-
export * from './useResolveRef';
|
|
@@ -10,7 +10,8 @@ import { type AiContextBinder } from '@dxos/assistant';
|
|
|
10
10
|
import { Blueprint } from '@dxos/blueprints';
|
|
11
11
|
import { type Space } from '@dxos/client/echo';
|
|
12
12
|
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
13
|
-
import {
|
|
13
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
14
|
+
import { distinctBy, isNonNullable } from '@dxos/util';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Provide a registry of blueprints from plugins.
|
|
@@ -21,25 +22,38 @@ export const useBlueprintRegistry = () => {
|
|
|
21
22
|
return useMemo(() => new Blueprint.Registry(blueprints), [blueprints]);
|
|
22
23
|
};
|
|
23
24
|
|
|
25
|
+
export const useBlueprints = ({
|
|
26
|
+
blueprintRegistry,
|
|
27
|
+
space,
|
|
28
|
+
}: {
|
|
29
|
+
blueprintRegistry?: Blueprint.Registry;
|
|
30
|
+
space?: Space;
|
|
31
|
+
}) => {
|
|
32
|
+
const staticBlueprints = useMemo(() => blueprintRegistry?.query() ?? [], [blueprintRegistry]);
|
|
33
|
+
const spaceBlueprints = useQuery(space, Filter.type(Blueprint.Blueprint));
|
|
34
|
+
return useMemo(() => {
|
|
35
|
+
const blueprints = distinctBy([...staticBlueprints, ...spaceBlueprints], (b) => b.key);
|
|
36
|
+
blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
|
|
37
|
+
return blueprints;
|
|
38
|
+
}, [staticBlueprints, spaceBlueprints]);
|
|
39
|
+
};
|
|
40
|
+
|
|
24
41
|
/**
|
|
25
42
|
* Create reactive map of active blueprints (by key).
|
|
26
43
|
*/
|
|
27
|
-
export const
|
|
44
|
+
export const useActiveBlueprints = ({ context }: { context?: AiContextBinder }) => {
|
|
28
45
|
const [active, setActive] = useState<Map<string, Blueprint.Blueprint>>(new Map());
|
|
46
|
+
|
|
29
47
|
useSignalEffect(() => {
|
|
30
48
|
const refs = [...(context?.blueprints.value ?? [])];
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
setActive(new Map(blueprints.map((blueprint) => [blueprint.key, blueprint])));
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
return () => clearTimeout(t);
|
|
49
|
+
const blueprints = refs.map((ref) => ref.target).filter(isNonNullable);
|
|
50
|
+
setActive(new Map(blueprints.map((blueprint) => [blueprint.key, blueprint])));
|
|
37
51
|
});
|
|
38
52
|
|
|
39
53
|
return active;
|
|
40
54
|
};
|
|
41
55
|
|
|
42
|
-
// TODO(burdon):
|
|
56
|
+
// TODO(burdon): Move logic into binder.
|
|
43
57
|
export const useBlueprintHandlers = ({
|
|
44
58
|
space,
|
|
45
59
|
context,
|
|
@@ -64,6 +78,7 @@ export const useBlueprintHandlers = ({
|
|
|
64
78
|
if (!blueprint) {
|
|
65
79
|
return;
|
|
66
80
|
}
|
|
81
|
+
|
|
67
82
|
// NOTE: Possible race condition with other peers.
|
|
68
83
|
storedBlueprint = space.db.add(Obj.clone(blueprint));
|
|
69
84
|
}
|
|
@@ -3,23 +3,22 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { RegistryContext } from '@effect-rx/rx-react';
|
|
6
|
-
import
|
|
7
|
-
import { useContext, useMemo } from 'react';
|
|
6
|
+
import type * as Runtime from 'effect/Runtime';
|
|
7
|
+
import { useContext, useMemo, useState } from 'react';
|
|
8
8
|
|
|
9
|
-
import { useIntentDispatcher } from '@dxos/app-framework';
|
|
10
9
|
import { AiConversation } from '@dxos/assistant';
|
|
11
10
|
import { type Blueprint } from '@dxos/blueprints';
|
|
12
11
|
import { log } from '@dxos/log';
|
|
13
|
-
import { type Queue
|
|
12
|
+
import { type Queue } from '@dxos/react-client/echo';
|
|
13
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
14
14
|
|
|
15
|
-
import { AiChatProcessor, type AiChatServices, type AiServicePreset } from '../
|
|
15
|
+
import { AiChatProcessor, type AiChatServices, type AiServicePreset } from '../processor';
|
|
16
16
|
import { type Assistant } from '../types';
|
|
17
17
|
|
|
18
18
|
export type UseChatProcessorProps = {
|
|
19
|
-
space?: Space;
|
|
20
19
|
chat?: Assistant.Chat;
|
|
21
20
|
preset?: AiServicePreset;
|
|
22
|
-
services?:
|
|
21
|
+
services?: () => Promise<Runtime.Runtime<AiChatServices>>;
|
|
23
22
|
blueprintRegistry?: Blueprint.Registry;
|
|
24
23
|
settings?: Assistant.Settings;
|
|
25
24
|
};
|
|
@@ -28,7 +27,6 @@ export type UseChatProcessorProps = {
|
|
|
28
27
|
* Configure and create AiChatProcessor.
|
|
29
28
|
*/
|
|
30
29
|
export const useChatProcessor = ({
|
|
31
|
-
space,
|
|
32
30
|
chat,
|
|
33
31
|
preset,
|
|
34
32
|
services,
|
|
@@ -36,22 +34,24 @@ export const useChatProcessor = ({
|
|
|
36
34
|
settings,
|
|
37
35
|
}: UseChatProcessorProps): AiChatProcessor | undefined => {
|
|
38
36
|
const observableRegistry = useContext(RegistryContext);
|
|
39
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
40
37
|
|
|
41
|
-
//
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const conversation = useMemo(() => {
|
|
38
|
+
// Create conversation from chat queue.
|
|
39
|
+
const [conversation, setConversation] = useState<AiConversation>();
|
|
40
|
+
useAsyncEffect(async () => {
|
|
46
41
|
if (!chat?.queue.target) {
|
|
47
42
|
return;
|
|
48
43
|
}
|
|
49
44
|
|
|
50
|
-
|
|
45
|
+
const conversation = new AiConversation({ queue: chat.queue.target as Queue<any> });
|
|
46
|
+
await conversation.open();
|
|
47
|
+
setConversation(conversation);
|
|
48
|
+
|
|
49
|
+
return () => {
|
|
50
|
+
void conversation.close();
|
|
51
|
+
};
|
|
51
52
|
}, [chat?.queue.target]);
|
|
52
53
|
|
|
53
54
|
// Create processor.
|
|
54
|
-
// TODO(burdon): Updated on each query update above; should just update current processor?
|
|
55
55
|
const processor = useMemo(() => {
|
|
56
56
|
if (!services || !conversation) {
|
|
57
57
|
return undefined;
|
|
@@ -63,19 +63,12 @@ export const useChatProcessor = ({
|
|
|
63
63
|
settings,
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
return new AiChatProcessor(
|
|
67
|
-
extensions,
|
|
68
|
-
blueprintRegistry,
|
|
66
|
+
return new AiChatProcessor(conversation, services, {
|
|
69
67
|
observableRegistry,
|
|
68
|
+
blueprintRegistry,
|
|
70
69
|
model: preset?.model,
|
|
71
70
|
});
|
|
72
|
-
}, [services, conversation, blueprintRegistry,
|
|
71
|
+
}, [services, conversation, blueprintRegistry, preset]);
|
|
73
72
|
|
|
74
73
|
return processor;
|
|
75
74
|
};
|
|
76
|
-
|
|
77
|
-
// TODO(dmaretskyi): Extract.
|
|
78
|
-
export const Stable = Object.freeze({
|
|
79
|
-
array: [] as readonly never[],
|
|
80
|
-
object: {} as {},
|
|
81
|
-
});
|
|
@@ -2,71 +2,48 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import type * as Runtime from 'effect/Runtime';
|
|
7
7
|
import { useMemo } from 'react';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
11
|
-
import { makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '@dxos/assistant';
|
|
9
|
+
import { useCapability } from '@dxos/app-framework';
|
|
12
10
|
import { type Space } from '@dxos/client/echo';
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
DatabaseService,
|
|
17
|
-
LocalFunctionExecutionService,
|
|
18
|
-
QueueService,
|
|
19
|
-
RemoteFunctionExecutionService,
|
|
20
|
-
TracingService,
|
|
21
|
-
} from '@dxos/functions';
|
|
11
|
+
import { TracingService } from '@dxos/functions';
|
|
12
|
+
import { AutomationCapabilities } from '@dxos/plugin-automation';
|
|
13
|
+
import { useClient } from '@dxos/react-client';
|
|
22
14
|
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
// TODO(burdon): Deconstruct into separate layers?
|
|
26
|
-
export type AiChatServices =
|
|
27
|
-
| AiService.AiService
|
|
28
|
-
| CredentialsService
|
|
29
|
-
| DatabaseService
|
|
30
|
-
| QueueService
|
|
31
|
-
| RemoteFunctionExecutionService
|
|
32
|
-
| ToolResolverService
|
|
33
|
-
| ToolExecutionService
|
|
34
|
-
| TracingService;
|
|
15
|
+
import { type AiChatServices } from '../processor';
|
|
16
|
+
import { type Assistant } from '../types';
|
|
35
17
|
|
|
36
18
|
export type UseChatServicesProps = {
|
|
37
19
|
space?: Space;
|
|
20
|
+
chat?: Assistant.Chat;
|
|
38
21
|
};
|
|
39
22
|
|
|
40
23
|
/**
|
|
41
24
|
* Construct service layer.
|
|
42
25
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
26
|
+
// TODO(dmaretskyi): Better return type.
|
|
27
|
+
export const useChatServices = ({
|
|
28
|
+
space,
|
|
29
|
+
chat,
|
|
30
|
+
}: UseChatServicesProps): (() => Promise<Runtime.Runtime<AiChatServices>>) | undefined => {
|
|
31
|
+
const client = useClient();
|
|
32
|
+
space ??= client.spaces.default;
|
|
33
|
+
|
|
34
|
+
const computeRuntimeResolver = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
48
35
|
|
|
49
36
|
return useMemo(() => {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
Layer.mergeAll(
|
|
63
|
-
space ? DatabaseService.layer(space.db) : DatabaseService.notAvailable,
|
|
64
|
-
space ? QueueService.layer(space.queues) : QueueService.notAvailable,
|
|
65
|
-
TracingService.layerNoop,
|
|
66
|
-
LocalFunctionExecutionService.layer,
|
|
67
|
-
RemoteFunctionExecutionService.mockLayer,
|
|
68
|
-
),
|
|
69
|
-
),
|
|
70
|
-
);
|
|
71
|
-
}, [space, functions, toolkits, handlers]);
|
|
37
|
+
const runtime = computeRuntimeResolver.getRuntime(space.id);
|
|
38
|
+
return () =>
|
|
39
|
+
runtime.runPromise(
|
|
40
|
+
Effect.gen(function* () {
|
|
41
|
+
return yield* Effect.runtime<AiChatServices>().pipe(
|
|
42
|
+
Effect.provide(
|
|
43
|
+
chat?.traceQueue?.target ? TracingService.layerQueue(chat.traceQueue?.target) : TracingService.layerNoop,
|
|
44
|
+
),
|
|
45
|
+
);
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
}, [space, chat?.traceQueue?.target]);
|
|
72
49
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { AiContextBinder } from '@dxos/assistant';
|
|
8
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
9
|
+
|
|
10
|
+
import { type Assistant } from '../types';
|
|
11
|
+
|
|
12
|
+
export const useContextBinder = (chat: Assistant.Chat | undefined): AiContextBinder | undefined => {
|
|
13
|
+
const [binder, setBinder] = useState<AiContextBinder>();
|
|
14
|
+
|
|
15
|
+
useAsyncEffect(async () => {
|
|
16
|
+
if (!chat?.queue.target) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const binder = new AiContextBinder(chat.queue.target);
|
|
21
|
+
await binder.open();
|
|
22
|
+
setBinder(binder);
|
|
23
|
+
|
|
24
|
+
return () => {
|
|
25
|
+
void binder.close();
|
|
26
|
+
};
|
|
27
|
+
}, [chat?.queue.target]);
|
|
28
|
+
|
|
29
|
+
return binder;
|
|
30
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type AiContextBinder } from '@dxos/assistant';
|
|
8
|
+
import { type DXN, type Obj, Ref } from '@dxos/echo';
|
|
9
|
+
import { log } from '@dxos/log';
|
|
10
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
11
|
+
import { isNonNullable } from '@dxos/util';
|
|
12
|
+
|
|
13
|
+
export type UseContextObjects = {
|
|
14
|
+
objects: Obj.Any[];
|
|
15
|
+
onUpdateObject: (dxn: DXN, checked: boolean) => Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create reactive map of active object references (by DXN string).
|
|
20
|
+
*/
|
|
21
|
+
export const useContextObjects = ({
|
|
22
|
+
space,
|
|
23
|
+
context,
|
|
24
|
+
}: {
|
|
25
|
+
space?: Space;
|
|
26
|
+
context?: AiContextBinder;
|
|
27
|
+
}): UseContextObjects => {
|
|
28
|
+
const objects = context?.objects.value.map((ref) => ref.target).filter(isNonNullable) ?? [];
|
|
29
|
+
|
|
30
|
+
const handleUpdateObject = useCallback<UseContextObjects['onUpdateObject']>(
|
|
31
|
+
async (dxn: DXN, checked: boolean) => {
|
|
32
|
+
if (!space || !context) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Load the object by DXN/id from the current space.
|
|
37
|
+
const id = dxn.asEchoDXN();
|
|
38
|
+
const object = id && (await space.db.getObjectById(id.echoId));
|
|
39
|
+
if (!object) {
|
|
40
|
+
log.warn('Object not found', { dxn, id });
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const ref = Ref.fromDXN(dxn);
|
|
45
|
+
if (checked) {
|
|
46
|
+
await context.bind({ objects: [ref] });
|
|
47
|
+
} else {
|
|
48
|
+
await context.unbind({ objects: [ref] });
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
[space, context],
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
objects,
|
|
56
|
+
onUpdateObject: handleUpdateObject,
|
|
57
|
+
};
|
|
58
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Option from 'effect/Option';
|
|
6
|
+
import { useEffect, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { type Type } from '@dxos/echo';
|
|
9
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
10
|
+
import { ItemAnnotation } from '@dxos/schema';
|
|
11
|
+
|
|
12
|
+
// TODO(burdon): Pass in filter.
|
|
13
|
+
export const useItemTypes = (space?: Space): Type.Obj.Any[] => {
|
|
14
|
+
const [types, setTypes] = useState<Type.Obj.Any[]>([]);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!space) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return space.db.schemaRegistry.query().subscribe(
|
|
21
|
+
(query) => {
|
|
22
|
+
const types = Array.from(
|
|
23
|
+
new Set(
|
|
24
|
+
[...space.db.graph.schemaRegistry.schemas, ...query.results].filter((type) =>
|
|
25
|
+
Option.isSome(ItemAnnotation.get(type)),
|
|
26
|
+
),
|
|
27
|
+
),
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
setTypes(types);
|
|
31
|
+
},
|
|
32
|
+
{ fire: true },
|
|
33
|
+
);
|
|
34
|
+
}, [space]);
|
|
35
|
+
|
|
36
|
+
return types;
|
|
37
|
+
};
|