@dxos/plugin-assistant 0.8.4-main.5acf9ea → 0.8.4-main.5ea62a8
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-IZ4AK5EO.mjs → BlueprintContainer-OWUSKPRK.mjs} +4 -3
- package/dist/lib/browser/ChatCompanion-FRCVSLPP.mjs +126 -0
- package/dist/lib/browser/ChatCompanion-FRCVSLPP.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-RP3QEXYX.mjs → ChatContainer-YBJBIVUZ.mjs} +34 -13
- package/dist/lib/browser/ChatContainer-YBJBIVUZ.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-ZVLXFHEY.mjs → ChatDialog-MTPJLEHM.mjs} +26 -9
- package/dist/lib/browser/ChatDialog-MTPJLEHM.mjs.map +7 -0
- package/dist/lib/browser/{SequenceContainer-3UDVKWPA.mjs → SequenceContainer-TF5QNXYM.mjs} +5 -17
- package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs.map +7 -0
- package/dist/lib/browser/ai-service-NRZPTUHO.mjs +22 -0
- package/dist/lib/browser/ai-service-NRZPTUHO.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-XSEOKJLG.mjs → app-graph-builder-7AAWTWGA.mjs} +25 -36
- package/dist/lib/browser/app-graph-builder-7AAWTWGA.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-CRZPIA5A.mjs +12 -0
- package/dist/lib/browser/blueprint-definition-CRZPIA5A.mjs.map +7 -0
- package/dist/lib/browser/chunk-6QMISAU6.mjs +167 -0
- package/dist/lib/browser/chunk-6QMISAU6.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LERGF5YG.mjs → chunk-CFXXQM25.mjs} +96 -22
- package/dist/lib/browser/chunk-CFXXQM25.mjs.map +7 -0
- package/dist/lib/browser/chunk-IJAJRAR7.mjs +18 -0
- package/dist/lib/browser/chunk-IJAJRAR7.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-O4LUJEDV.mjs +20 -0
- package/dist/lib/browser/{chunk-FDCJSQYF.mjs.map → chunk-O4LUJEDV.mjs.map} +2 -2
- package/dist/lib/browser/chunk-OYFQS7JM.mjs +157 -0
- package/dist/lib/browser/chunk-OYFQS7JM.mjs.map +7 -0
- package/dist/lib/browser/chunk-SMIVXXAI.mjs +202 -0
- package/dist/lib/browser/chunk-SMIVXXAI.mjs.map +7 -0
- package/dist/lib/browser/chunk-V5H5CCZA.mjs +218 -0
- package/dist/lib/browser/chunk-V5H5CCZA.mjs.map +7 -0
- package/dist/lib/browser/chunk-XL557TXF.mjs +2332 -0
- package/dist/lib/browser/chunk-XL557TXF.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-E5M3CC46.mjs +22 -0
- package/dist/lib/browser/edge-model-resolver-E5M3CC46.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +134 -59
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-BQO5SVGI.mjs +112 -0
- package/dist/lib/browser/intent-resolver-BQO5SVGI.mjs.map +7 -0
- package/dist/lib/browser/local-model-resolver-VZ5WZQIC.mjs +21 -0
- package/dist/lib/browser/local-model-resolver-VZ5WZQIC.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-3GYEHQRP.mjs → react-surface-VNCD2H7C.mjs} +25 -66
- package/dist/lib/browser/react-surface-VNCD2H7C.mjs.map +7 -0
- package/dist/lib/browser/{settings-5GTTCVGD.mjs → settings-36V3VUMW.mjs} +6 -5
- package/dist/lib/{node-esm/settings-J2EXEM5H.mjs.map → browser/settings-36V3VUMW.mjs.map} +1 -1
- package/dist/lib/browser/state-D5IVKNYG.mjs +21 -0
- package/dist/lib/browser/state-D5IVKNYG.mjs.map +7 -0
- package/dist/lib/browser/toolkit-Y5OYX5PO.mjs +191 -0
- package/dist/lib/browser/toolkit-Y5OYX5PO.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -4
- package/dist/lib/node-esm/{BlueprintContainer-RGTMNLNX.mjs → BlueprintContainer-UFVWCRN6.mjs} +4 -3
- package/dist/lib/{browser/BlueprintContainer-IZ4AK5EO.mjs.map → node-esm/BlueprintContainer-UFVWCRN6.mjs.map} +1 -1
- package/dist/lib/node-esm/ChatCompanion-ZNRZEKH5.mjs +127 -0
- package/dist/lib/node-esm/ChatCompanion-ZNRZEKH5.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-W3W6FWV3.mjs → ChatContainer-TUCITJJW.mjs} +34 -13
- package/dist/lib/node-esm/ChatContainer-TUCITJJW.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-QW4JRKVO.mjs → ChatDialog-JLM7RDZQ.mjs} +26 -9
- package/dist/lib/node-esm/ChatDialog-JLM7RDZQ.mjs.map +7 -0
- package/dist/lib/node-esm/{SequenceContainer-RQQH5XOC.mjs → SequenceContainer-UXOVZPZO.mjs} +5 -17
- package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-UDEPIPTO.mjs +23 -0
- package/dist/lib/node-esm/ai-service-UDEPIPTO.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-PANCJUHV.mjs → app-graph-builder-PNAFQUYT.mjs} +25 -36
- package/dist/lib/node-esm/app-graph-builder-PNAFQUYT.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-275J3XL2.mjs +13 -0
- package/dist/lib/node-esm/blueprint-definition-275J3XL2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-2X6VEO32.mjs +2333 -0
- package/dist/lib/node-esm/chunk-2X6VEO32.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7YOGZI66.mjs +203 -0
- package/dist/lib/node-esm/chunk-7YOGZI66.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CAQKGW3B.mjs +159 -0
- package/dist/lib/node-esm/chunk-CAQKGW3B.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-MS3PJARN.mjs → chunk-FNZJJL7G.mjs} +96 -22
- package/dist/lib/node-esm/chunk-FNZJJL7G.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-RLBN4RNR.mjs +168 -0
- package/dist/lib/node-esm/chunk-RLBN4RNR.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UWUUZQWJ.mjs +219 -0
- package/dist/lib/node-esm/chunk-UWUUZQWJ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-VFY2JG62.mjs +22 -0
- package/dist/lib/node-esm/{chunk-QN2H2EHV.mjs.map → chunk-VFY2JG62.mjs.map} +2 -2
- package/dist/lib/node-esm/chunk-YPXEA46Q.mjs +19 -0
- package/dist/lib/node-esm/chunk-YPXEA46Q.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-SZHDLXCT.mjs +23 -0
- package/dist/lib/node-esm/edge-model-resolver-SZHDLXCT.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +134 -59
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-FIS3T5KP.mjs +113 -0
- package/dist/lib/node-esm/intent-resolver-FIS3T5KP.mjs.map +7 -0
- package/dist/lib/node-esm/local-model-resolver-2KCBKMYA.mjs +22 -0
- package/dist/lib/node-esm/local-model-resolver-2KCBKMYA.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-QDQWJ7FZ.mjs → react-surface-4NLRKNBU.mjs} +25 -66
- package/dist/lib/node-esm/react-surface-4NLRKNBU.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-J2EXEM5H.mjs → settings-7ZCZ6AS5.mjs} +6 -5
- package/dist/lib/{browser/settings-5GTTCVGD.mjs.map → node-esm/settings-7ZCZ6AS5.mjs.map} +1 -1
- package/dist/lib/node-esm/state-4VLKPLW3.mjs +22 -0
- package/dist/lib/node-esm/state-4VLKPLW3.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs +192 -0
- package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +7 -4
- 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 +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +7 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +19 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +11 -3
- 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 +4 -0
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +19 -16
- 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 +4 -4
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/components/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 +20 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +4 -5
- 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/ChatPrompt/index.d.ts +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +21 -5
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +4 -4
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +108 -30
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +12 -12
- package/dist/types/src/components/ChatThread/ToolBlock.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/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.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +257 -2
- 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 +257 -6
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +254 -1
- 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/Toolbar/Toolbar.d.ts +4 -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 +4 -9
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +258 -4
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -1
- 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/execution-graph/execution-graph.d.ts +21 -0
- package/dist/types/src/execution-graph/execution-graph.d.ts.map +1 -0
- package/dist/types/src/execution-graph/index.d.ts +2 -0
- package/dist/types/src/execution-graph/index.d.ts.map +1 -0
- 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/index.d.ts +10 -3
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +24 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +7 -20
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +4 -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/useExecutionGraph.d.ts +7 -0
- package/dist/types/src/hooks/useExecutionGraph.d.ts.map +1 -0
- package/dist/types/src/hooks/useFlush.d.ts +6 -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/useMatcherExtension.d.ts +3 -0
- package/dist/types/src/hooks/useMatcherExtension.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.map +1 -1
- 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/query-parser.d.ts.map +1 -1
- package/dist/types/src/parser/types.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 +2 -2
- package/dist/types/src/processor/presets.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +80 -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/stories/Chat.stories.d.ts +22 -203
- package/dist/types/src/stories/Chat.stories.d.ts.map +1 -1
- package/dist/types/src/stories/components/BlueprintContainer.d.ts +4 -0
- package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/ChatContainer.d.ts +4 -0
- package/dist/types/src/stories/components/ChatContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/CommentsContainer.d.ts +4 -0
- package/dist/types/src/stories/components/CommentsContainer.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 +4 -0
- package/dist/types/src/stories/components/LoggingContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/MessageContainer.d.ts +4 -0
- package/dist/types/src/stories/components/MessageContainer.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 +4 -0
- package/dist/types/src/stories/components/TasksContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/TokenManagerContainer.d.ts +3 -0
- package/dist/types/src/stories/components/TokenManagerContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/index.d.ts +11 -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/testing/data.d.ts +5 -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 +44 -0
- package/dist/types/src/stories/testing/testing.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-data.d.ts +4 -0
- package/dist/types/src/testing/test-data.d.ts.map +1 -0
- package/dist/types/src/testing/test-functions.d.ts +5 -2
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/testing/test-sequence.d.ts +0 -4
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +26 -11
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +42 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -0
- package/dist/types/src/types/AssistantAction.d.ts +107 -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 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +9 -6
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +99 -81
- package/src/AssistantPlugin.tsx +52 -16
- package/src/capabilities/ai-service.ts +28 -0
- package/src/capabilities/app-graph-builder.ts +41 -48
- package/src/capabilities/blueprint-definition.ts +42 -0
- package/src/capabilities/capabilities.ts +31 -0
- package/src/capabilities/edge-model-resolver.ts +27 -0
- package/src/capabilities/index.ts +9 -0
- package/src/capabilities/intent-resolver.ts +45 -23
- package/src/capabilities/local-model-resolver.ts +32 -0
- package/src/capabilities/react-surface.tsx +10 -57
- package/src/capabilities/state.ts +20 -0
- package/src/capabilities/toolkit.ts +163 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +83 -76
- package/src/components/Chat/Chat.tsx +171 -165
- package/src/components/Chat/events.ts +7 -0
- package/src/components/ChatCompanion.tsx +111 -0
- package/src/components/ChatContainer.tsx +19 -13
- package/src/components/ChatDialog.tsx +11 -7
- package/src/components/ChatProgress/ChatProgress.tsx +68 -0
- package/src/components/ChatProgress/index.ts +5 -0
- package/src/components/ChatPrompt/ChatActions.tsx +10 -24
- package/src/components/ChatPrompt/ChatOptions.tsx +233 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +31 -36
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
- package/src/components/ChatPrompt/index.ts +1 -1
- package/src/components/ChatThread/ChatMessage.tsx +214 -148
- package/src/components/ChatThread/ChatThread.stories.tsx +244 -104
- package/src/components/ChatThread/ChatThread.tsx +44 -22
- package/src/components/ChatThread/Link.tsx +23 -0
- package/src/components/ChatThread/ToolBlock.tsx +103 -77
- package/src/components/ChatThread/reducers.ts +151 -0
- package/src/components/PromptSettings.tsx +1 -0
- package/src/components/SequenceContainer.tsx +27 -28
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +5 -4
- package/src/components/SequenceEditor/SequenceEditor.tsx +1 -1
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +25 -12
- package/src/components/TemplateEditor/TemplateEditor.tsx +14 -47
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +12 -5
- package/src/components/TemplateEditor/TemplateForm.tsx +3 -1
- package/src/components/TemplateEditor/handlebars-extension.ts +165 -0
- package/src/components/Toolbar/Toolbar.tsx +20 -0
- package/src/components/Toolbar/index.ts +5 -0
- package/src/components/Toolbar/useChatToolbarActions.ts +125 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +10 -16
- package/src/components/Toolbox/Toolbox.tsx +21 -51
- package/src/components/index.ts +3 -4
- package/src/events.ts +2 -2
- package/src/execution-graph/execution-graph.ts +211 -0
- package/src/execution-graph/index.ts +5 -0
- package/src/functions/analysis.ts +20 -0
- package/src/functions/index.ts +7 -0
- package/src/functions/list.ts +46 -0
- package/src/functions/load.ts +43 -0
- package/src/hooks/index.ts +10 -4
- package/src/hooks/useBlueprintRegistry.ts +80 -0
- package/src/hooks/useChatProcessor.ts +20 -97
- package/src/hooks/useChatServices.ts +29 -32
- package/src/hooks/useContextBinder.ts +18 -0
- package/src/hooks/useContextObjects.ts +58 -0
- package/src/hooks/useExecutionGraph.ts +20 -0
- package/src/hooks/useFlush.ts +35 -0
- package/src/hooks/useItemTypes.ts +37 -0
- package/src/hooks/useMatcherExtension.ts +45 -0
- package/src/hooks/useOnline.ts +10 -0
- package/src/hooks/usePresets.ts +44 -0
- package/src/hooks/useReferencesProvider.ts +11 -9
- package/src/hooks/useResolveRef.ts +33 -0
- package/src/meta.ts +1 -1
- package/src/parser/filter-generator.ts +8 -13
- package/src/parser/query-parser.ts +1 -1
- package/src/parser/types.ts +2 -0
- package/src/processor/index.ts +6 -0
- package/src/{hooks → processor}/presets.ts +14 -6
- package/src/processor/processor.test.ts +77 -0
- package/src/processor/processor.ts +304 -0
- package/src/queue-logger.ts +5 -5
- package/src/stories/Chat.stories.tsx +391 -293
- package/src/stories/components/BlueprintContainer.tsx +32 -0
- package/src/stories/components/ChatContainer.tsx +57 -0
- package/src/stories/components/CommentsContainer.tsx +25 -0
- package/src/stories/components/GraphContainer.tsx +118 -0
- package/src/stories/components/LoggingContainer.tsx +21 -0
- package/src/stories/components/MessageContainer.tsx +27 -0
- package/src/stories/components/SurfaceContainer.tsx +52 -0
- package/src/stories/components/TasksContainer.tsx +49 -0
- package/src/stories/components/TokenManagerContainer.tsx +14 -0
- package/src/stories/components/index.ts +15 -0
- package/src/stories/components/types.ts +11 -0
- package/src/stories/testing/data.ts +142 -0
- package/src/stories/testing/index.ts +6 -0
- package/src/stories/testing/testing.tsx +254 -0
- package/src/testing/index.ts +2 -1
- package/src/testing/test-data.ts +109 -0
- package/src/testing/test-functions.ts +8 -3
- package/src/testing/test-sequence.ts +2 -27
- package/src/translations.ts +30 -11
- package/src/types/Assistant.ts +61 -0
- package/src/types/AssistantAction.ts +62 -0
- package/src/types/defs.ts +5 -0
- package/src/types/index.ts +4 -1
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/ChatContainer-RP3QEXYX.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-ZVLXFHEY.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-XSEOKJLG.mjs.map +0 -7
- package/dist/lib/browser/chunk-63GG6U6D.mjs +0 -2226
- package/dist/lib/browser/chunk-63GG6U6D.mjs.map +0 -7
- package/dist/lib/browser/chunk-7W7LHTRH.mjs +0 -171
- package/dist/lib/browser/chunk-7W7LHTRH.mjs.map +0 -7
- package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
- package/dist/lib/browser/chunk-KFXSBNZR.mjs +0 -89
- package/dist/lib/browser/chunk-KFXSBNZR.mjs.map +0 -7
- package/dist/lib/browser/chunk-LERGF5YG.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs +0 -75
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3GYEHQRP.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-W3W6FWV3.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-QW4JRKVO.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-PANCJUHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs +0 -2227
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MS3PJARN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
- package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs +0 -90
- package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs +0 -172
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs +0 -76
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs.map +0 -7
- package/dist/types/src/capability-definitions.d.ts +0 -7
- package/dist/types/src/capability-definitions.d.ts.map +0 -1
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.d.ts +0 -86
- package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
- package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/presets.d.ts.map +0 -1
- package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
- package/dist/types/src/hooks/useBlueprints.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/dist/types/src/types/schema.d.ts +0 -120
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capability-definitions.ts +0 -15
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
- package/src/components/ChatThread/reducer.ts +0 -52
- package/src/hooks/chat-processor.test.ts +0 -16
- package/src/hooks/chat-processor.ts +0 -314
- package/src/hooks/useBlueprints.ts +0 -57
- package/src/shims.d.ts +0 -8
- package/src/tools/function.ts +0 -46
- package/src/tools/index.ts +0 -6
- package/src/tools/openapi.test.ts +0 -217
- package/src/tools/openapi.ts +0 -338
- package/src/types/schema.ts +0 -108
- package/src/typings.d.ts +0 -9
- /package/dist/lib/{node-esm/BlueprintContainer-RGTMNLNX.mjs.map → browser/BlueprintContainer-OWUSKPRK.mjs.map} +0 -0
|
@@ -2,142 +2,65 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { RegistryContext } from '@effect-rx/rx-react';
|
|
5
6
|
import { type Layer } from 'effect';
|
|
6
|
-
import {
|
|
7
|
+
import { useContext, useMemo } from 'react';
|
|
7
8
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { Conversation, createSystemPrompt } from '@dxos/assistant';
|
|
11
|
-
import { type ArtifactDefinition, type AssociatedArtifact, type Blueprint } from '@dxos/blueprints';
|
|
12
|
-
import { FunctionType } from '@dxos/functions';
|
|
9
|
+
import { AiConversation } from '@dxos/assistant';
|
|
10
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
13
11
|
import { log } from '@dxos/log';
|
|
14
|
-
import {
|
|
15
|
-
import { Filter, fullyQualifiedId, type Queue, type Space, useQuery } from '@dxos/react-client/echo';
|
|
16
|
-
import { isNonNullable } from '@dxos/util';
|
|
12
|
+
import { type Queue } from '@dxos/react-client/echo';
|
|
17
13
|
|
|
18
|
-
import { type
|
|
19
|
-
import {
|
|
20
|
-
import { type Assistant, ServiceType } from '../types';
|
|
14
|
+
import { AiChatProcessor, type AiChatServices, type AiServicePreset } from '../processor';
|
|
15
|
+
import { type Assistant } from '../types';
|
|
21
16
|
|
|
22
|
-
type UseChatProcessorProps = {
|
|
23
|
-
preset?: AiServicePreset;
|
|
24
|
-
space?: Space;
|
|
17
|
+
export type UseChatProcessorProps = {
|
|
25
18
|
chat?: Assistant.Chat;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
services?: Layer.Layer<ChatServices>;
|
|
19
|
+
preset?: AiServicePreset;
|
|
20
|
+
services?: Layer.Layer<AiChatServices>;
|
|
29
21
|
blueprintRegistry?: Blueprint.Registry;
|
|
30
|
-
// TODO(burdon): Not currently used.
|
|
31
22
|
settings?: Assistant.Settings;
|
|
32
|
-
|
|
33
|
-
/** @deprecated */
|
|
34
|
-
instructions?: string;
|
|
35
|
-
/** @deprecated */
|
|
36
|
-
artifact?: AssociatedArtifact;
|
|
37
|
-
/** @deprecated */
|
|
38
|
-
noPluginArtifacts?: boolean;
|
|
39
23
|
};
|
|
40
24
|
|
|
41
25
|
/**
|
|
42
|
-
* Configure and create
|
|
26
|
+
* Configure and create AiChatProcessor.
|
|
43
27
|
*/
|
|
44
28
|
export const useChatProcessor = ({
|
|
45
|
-
preset,
|
|
46
|
-
space,
|
|
47
29
|
chat,
|
|
30
|
+
preset,
|
|
48
31
|
services,
|
|
49
32
|
blueprintRegistry,
|
|
50
33
|
settings,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
noPluginArtifacts,
|
|
54
|
-
}: UseChatProcessorProps): ChatProcessor | undefined => {
|
|
55
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
56
|
-
const globalTools = useCapabilities(Capabilities.Tools);
|
|
57
|
-
|
|
58
|
-
// TODO(burdon): Spec artifacts.
|
|
59
|
-
let artifacts: readonly ArtifactDefinition[] = useCapabilities(Capabilities.ArtifactDefinition);
|
|
60
|
-
if (noPluginArtifacts) {
|
|
61
|
-
artifacts = Stable.array;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Services.
|
|
65
|
-
const remoteServices = useQuery(space, Filter.type(ServiceType));
|
|
66
|
-
const [serviceTools, setServiceTools] = useState<ExecutableTool[]>([]);
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
log('creating service tools...');
|
|
69
|
-
queueMicrotask(async () => {
|
|
70
|
-
const tools = await Promise.all(remoteServices.map((service) => createToolsFromService(service)));
|
|
71
|
-
setServiceTools(tools.flat());
|
|
72
|
-
});
|
|
73
|
-
}, [remoteServices]);
|
|
74
|
-
|
|
75
|
-
// Tools and context.
|
|
76
|
-
const config = useConfig();
|
|
77
|
-
const functions = useQuery(space, Filter.type(FunctionType));
|
|
78
|
-
const chatId = useMemo(() => (chat ? fullyQualifiedId(chat) : undefined), [chat]);
|
|
79
|
-
const [tools, extensions] = useMemo(() => {
|
|
80
|
-
log('creating tools...');
|
|
81
|
-
const tools: ExecutableTool[] = [
|
|
82
|
-
...globalTools.flat(),
|
|
83
|
-
...serviceTools,
|
|
84
|
-
...functions
|
|
85
|
-
.map((fn) => convertFunctionToTool(fn, config.values.runtime?.services?.edge?.url ?? '', space?.id))
|
|
86
|
-
.filter(isNonNullable),
|
|
87
|
-
];
|
|
88
|
-
const extensions = { space, dispatch, pivotId: chatId };
|
|
89
|
-
return [tools, extensions];
|
|
90
|
-
}, [dispatch, globalTools, space, chatId, serviceTools, functions]);
|
|
91
|
-
|
|
92
|
-
// TODO(burdon): Create from template.
|
|
93
|
-
const systemPrompt = useMemo(
|
|
94
|
-
() =>
|
|
95
|
-
createSystemPrompt({
|
|
96
|
-
artifacts: artifacts.map((definition) => `${definition.name}\n${definition.instructions}`),
|
|
97
|
-
artifact,
|
|
98
|
-
instructions,
|
|
99
|
-
}),
|
|
100
|
-
[artifacts, artifact, instructions],
|
|
101
|
-
);
|
|
34
|
+
}: UseChatProcessorProps): AiChatProcessor | undefined => {
|
|
35
|
+
const observableRegistry = useContext(RegistryContext);
|
|
102
36
|
|
|
37
|
+
// Create conversation from chat queue.
|
|
103
38
|
const conversation = useMemo(() => {
|
|
104
39
|
if (!chat?.queue.target) {
|
|
105
40
|
return;
|
|
106
41
|
}
|
|
107
42
|
|
|
108
|
-
return new
|
|
43
|
+
return new AiConversation({ queue: chat.queue.target as Queue<any> });
|
|
109
44
|
}, [chat?.queue.target]);
|
|
110
45
|
|
|
111
46
|
// Create processor.
|
|
112
|
-
// TODO(burdon): Updated on each query update above; should just update current processor?
|
|
113
47
|
const processor = useMemo(() => {
|
|
114
48
|
if (!services || !conversation) {
|
|
115
49
|
return undefined;
|
|
116
50
|
}
|
|
117
51
|
|
|
118
|
-
log
|
|
52
|
+
log('creating processor', {
|
|
119
53
|
preset,
|
|
120
|
-
artifacts: artifacts.length,
|
|
121
|
-
systemPrompt: systemPrompt.length,
|
|
122
54
|
model: preset?.model,
|
|
123
55
|
settings,
|
|
124
56
|
});
|
|
125
57
|
|
|
126
|
-
return new
|
|
127
|
-
|
|
128
|
-
extensions,
|
|
58
|
+
return new AiChatProcessor(conversation, services, {
|
|
59
|
+
observableRegistry,
|
|
129
60
|
blueprintRegistry,
|
|
130
|
-
artifacts,
|
|
131
|
-
systemPrompt,
|
|
132
61
|
model: preset?.model,
|
|
133
62
|
});
|
|
134
|
-
}, [services, conversation,
|
|
63
|
+
}, [services, conversation, blueprintRegistry, preset]);
|
|
135
64
|
|
|
136
65
|
return processor;
|
|
137
66
|
};
|
|
138
|
-
|
|
139
|
-
// TODO(dmaretskyi): Extract.
|
|
140
|
-
export const Stable = Object.freeze({
|
|
141
|
-
array: [] as readonly never[],
|
|
142
|
-
object: {} as {},
|
|
143
|
-
});
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type AiTool, AiToolkit } from '@effect/ai';
|
|
5
6
|
import { Layer } from 'effect';
|
|
6
7
|
import { useMemo } from 'react';
|
|
7
|
-
import { useDeepCompareMemoize } from 'use-deep-compare-effect';
|
|
8
8
|
|
|
9
|
-
import { type AiService, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';
|
|
10
9
|
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
11
10
|
import { makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '@dxos/assistant';
|
|
12
11
|
import { type Space } from '@dxos/client/echo';
|
|
@@ -20,48 +19,46 @@ import {
|
|
|
20
19
|
TracingService,
|
|
21
20
|
} from '@dxos/functions';
|
|
22
21
|
|
|
23
|
-
import { AssistantCapabilities } from '../
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// TODO(burdon): Deconstruct into separate layers?
|
|
28
|
-
export type ChatServices =
|
|
29
|
-
| AiService
|
|
30
|
-
| CredentialsService
|
|
31
|
-
| DatabaseService
|
|
32
|
-
| QueueService
|
|
33
|
-
| RemoteFunctionExecutionService
|
|
34
|
-
| ToolResolverService
|
|
35
|
-
| ToolExecutionService
|
|
36
|
-
| TracingService;
|
|
22
|
+
import { AssistantCapabilities } from '../capabilities';
|
|
23
|
+
import { type AiChatServices } from '../processor';
|
|
24
|
+
import { type Assistant } from '../types';
|
|
37
25
|
|
|
38
26
|
export type UseChatServicesProps = {
|
|
39
27
|
space?: Space;
|
|
28
|
+
chat?: Assistant.Chat;
|
|
40
29
|
};
|
|
41
30
|
|
|
42
31
|
/**
|
|
43
32
|
* Construct service layer.
|
|
44
33
|
*/
|
|
45
|
-
export const useChatServices = ({ space }: UseChatServicesProps): Layer.Layer<
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
const
|
|
34
|
+
export const useChatServices = ({ space, chat }: UseChatServicesProps): Layer.Layer<AiChatServices> | undefined => {
|
|
35
|
+
const serviceLayer = useCapabilities(AssistantCapabilities.AiServiceLayer).at(0) ?? Layer.die('AiService not found');
|
|
36
|
+
const functions = useCapabilities(Capabilities.Functions);
|
|
37
|
+
const toolkits = useCapabilities(Capabilities.Toolkit);
|
|
38
|
+
const handlers = useCapabilities(Capabilities.ToolkitHandler);
|
|
49
39
|
|
|
50
40
|
return useMemo(() => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
CredentialsService.configuredLayer([]),
|
|
57
|
-
space ? DatabaseService.makeLayer(space.db) : DatabaseService.notAvailable,
|
|
58
|
-
space ? QueueService.makeLayer(space.queues) : QueueService.notAvailable,
|
|
41
|
+
const allFunctions = functions.flat();
|
|
42
|
+
// TODO(wittjosiah): Don't cast.
|
|
43
|
+
const toolkit = AiToolkit.merge(...toolkits) as AiToolkit.Any as AiToolkit.AiToolkit<AiTool.Any>;
|
|
44
|
+
const handlersLayer = Layer.mergeAll(Layer.empty, ...handlers);
|
|
59
45
|
|
|
46
|
+
return Layer.mergeAll(
|
|
47
|
+
serviceLayer,
|
|
48
|
+
makeToolResolverFromFunctions(allFunctions, toolkit),
|
|
49
|
+
makeToolExecutionServiceFromFunctions(allFunctions, toolkit, handlersLayer),
|
|
50
|
+
CredentialsService.layerFromDatabase(),
|
|
60
51
|
ComputeEventLogger.layerFromTracing,
|
|
61
52
|
).pipe(
|
|
62
|
-
Layer.provideMerge(
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
Layer.provideMerge(
|
|
54
|
+
Layer.mergeAll(
|
|
55
|
+
space ? DatabaseService.layer(space.db) : DatabaseService.notAvailable,
|
|
56
|
+
space ? QueueService.layer(space.queues) : QueueService.notAvailable,
|
|
57
|
+
chat?.traceQueue?.target ? TracingService.layerQueue(chat.traceQueue?.target) : TracingService.layerNoop,
|
|
58
|
+
LocalFunctionExecutionService.layer,
|
|
59
|
+
RemoteFunctionExecutionService.mockLayer,
|
|
60
|
+
),
|
|
61
|
+
),
|
|
65
62
|
);
|
|
66
|
-
}, [space,
|
|
63
|
+
}, [space, functions, toolkits, handlers, chat?.traceQueue?.target]);
|
|
67
64
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { AiContextBinder } from '@dxos/assistant';
|
|
8
|
+
|
|
9
|
+
import { type Assistant } from '../types';
|
|
10
|
+
|
|
11
|
+
export const useContextBinder = (chat: Assistant.Chat | undefined): AiContextBinder | undefined => {
|
|
12
|
+
const binder = useMemo(() => {
|
|
13
|
+
const queue = chat?.queue.target;
|
|
14
|
+
return queue && new AiContextBinder(queue);
|
|
15
|
+
}, [chat]);
|
|
16
|
+
|
|
17
|
+
return binder;
|
|
18
|
+
};
|
|
@@ -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,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Queue } from '@dxos/client/echo';
|
|
8
|
+
import { Obj, type Ref } from '@dxos/echo';
|
|
9
|
+
import { useQueue } from '@dxos/react-client/echo';
|
|
10
|
+
|
|
11
|
+
import { ExecutionGraph } from '../execution-graph';
|
|
12
|
+
|
|
13
|
+
export const useExecutionGraph = (queueRef?: Ref.Ref<Queue>, lastRequest = false) => {
|
|
14
|
+
const queue = useQueue(queueRef?.dxn);
|
|
15
|
+
return useMemo(() => {
|
|
16
|
+
const graph = new ExecutionGraph();
|
|
17
|
+
graph.addEvents(queue?.objects.filter(Obj.isObject) ?? []);
|
|
18
|
+
return graph.getGraph(lastRequest);
|
|
19
|
+
}, [queue?.objects, lastRequest]);
|
|
20
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCallback, useRef, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Space } from '@dxos/client/echo';
|
|
8
|
+
|
|
9
|
+
export const useFlush = (space?: Space) => {
|
|
10
|
+
const [state, setState] = useState<'idle' | 'flushing' | 'flushed'>('idle');
|
|
11
|
+
const resetTimer = useRef<NodeJS.Timeout | null>(null);
|
|
12
|
+
|
|
13
|
+
const handleFlush = useCallback(() => {
|
|
14
|
+
if (!space) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
queueMicrotask(async () => {
|
|
19
|
+
if (resetTimer.current) {
|
|
20
|
+
clearTimeout(resetTimer.current);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
setState('flushing');
|
|
24
|
+
await space.db.flush();
|
|
25
|
+
setState('flushed');
|
|
26
|
+
|
|
27
|
+
resetTimer.current = setTimeout(() => {
|
|
28
|
+
setState('idle');
|
|
29
|
+
resetTimer.current = null;
|
|
30
|
+
}, 1_000);
|
|
31
|
+
});
|
|
32
|
+
}, [space]);
|
|
33
|
+
|
|
34
|
+
return { state, handleFlush };
|
|
35
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Option } from 'effect';
|
|
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
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Space } from '@dxos/client/echo';
|
|
8
|
+
import { Type } from '@dxos/echo';
|
|
9
|
+
import { type TypeaheadContext, matchCompletion, staticCompletion, typeahead } from '@dxos/react-ui-editor';
|
|
10
|
+
|
|
11
|
+
// TODO(burdon): Move def to @dxos/echo.
|
|
12
|
+
export const useMatcherExtension = (space: Space) => {
|
|
13
|
+
return useMemo(() => {
|
|
14
|
+
const handleComplete = ({ line }: TypeaheadContext) => {
|
|
15
|
+
const words = line.split(/\s+/).filter(Boolean);
|
|
16
|
+
if (words.length > 0) {
|
|
17
|
+
const word = words.at(-1)!;
|
|
18
|
+
|
|
19
|
+
// Match type.
|
|
20
|
+
const match = word.match(/^type:(.+)/);
|
|
21
|
+
if (match) {
|
|
22
|
+
const part = match[1];
|
|
23
|
+
for (const schema of space?.db.graph.schemaRegistry.schemas ?? []) {
|
|
24
|
+
const typename = Type.getTypename(schema);
|
|
25
|
+
if (typename) {
|
|
26
|
+
const completion = matchCompletion(typename, part);
|
|
27
|
+
if (completion) {
|
|
28
|
+
return completion;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Match static.
|
|
35
|
+
return staticCompletion(['type:', 'AND', 'OR', 'NOT'])({ line });
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return [
|
|
40
|
+
typeahead({
|
|
41
|
+
onComplete: handleComplete,
|
|
42
|
+
}),
|
|
43
|
+
];
|
|
44
|
+
}, [space]);
|
|
45
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Dispatch, type SetStateAction, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
export const useOnline = (): [boolean, Dispatch<SetStateAction<boolean>>] => {
|
|
8
|
+
const [online, setOnline] = useState(true);
|
|
9
|
+
return [online, setOnline];
|
|
10
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type ChatPromptProps } from '../components';
|
|
8
|
+
import { type AiServicePreset, AiServicePresets } from '../processor';
|
|
9
|
+
|
|
10
|
+
export type UsePresets = {
|
|
11
|
+
preset: AiServicePreset | undefined;
|
|
12
|
+
} & Pick<ChatPromptProps, 'presets' | 'onPresetChange'>;
|
|
13
|
+
|
|
14
|
+
export const usePresets = (online: boolean): UsePresets => {
|
|
15
|
+
// TODO(burdon): Memo preset for provider.
|
|
16
|
+
const [preset, setPreset] = useState<AiServicePreset>();
|
|
17
|
+
const presets = useMemo(
|
|
18
|
+
() => AiServicePresets.filter((preset) => online === (preset.provider === 'dxos-remote')),
|
|
19
|
+
[online],
|
|
20
|
+
);
|
|
21
|
+
const presetOptions = useMemo(
|
|
22
|
+
() => presets.map(({ id, model, label }) => ({ id, label: label ?? model })),
|
|
23
|
+
[presets],
|
|
24
|
+
);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setPreset(presets[0]);
|
|
27
|
+
}, [presets]);
|
|
28
|
+
|
|
29
|
+
const handlePresetChange = useCallback<NonNullable<ChatPromptProps['onPresetChange']>>(
|
|
30
|
+
(id) => {
|
|
31
|
+
const preset = presets.find((preset) => preset.id === id);
|
|
32
|
+
if (preset) {
|
|
33
|
+
setPreset(preset);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
[presets],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
preset: preset,
|
|
41
|
+
presets: presetOptions,
|
|
42
|
+
onPresetChange: handlePresetChange,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -6,15 +6,14 @@ import { useMemo } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
8
8
|
import { type Space } from '@dxos/client/echo';
|
|
9
|
-
import { Filter, Obj
|
|
9
|
+
import { Filter, Obj } from '@dxos/echo';
|
|
10
10
|
import { type ReferencesProvider } from '@dxos/react-ui-chat';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Resolve references to objects in the space.
|
|
14
14
|
*/
|
|
15
15
|
export const useReferencesProvider = (space?: Space): ReferencesProvider | undefined => {
|
|
16
|
-
|
|
17
|
-
const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
|
|
16
|
+
const blueprints = useCapabilities(Capabilities.BlueprintDefinition);
|
|
18
17
|
|
|
19
18
|
return useMemo<ReferencesProvider | undefined>((): ReferencesProvider | undefined => {
|
|
20
19
|
if (!space) {
|
|
@@ -23,10 +22,13 @@ export const useReferencesProvider = (space?: Space): ReferencesProvider | undef
|
|
|
23
22
|
|
|
24
23
|
return {
|
|
25
24
|
getReferences: async ({ query }) => {
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
// TODO(burdon): Previously we filtered by types declared by the artifact definitions.
|
|
26
|
+
// const schemas = blueprints.map((blueprint) => blueprint.schema).flat();
|
|
27
|
+
// const { objects } = await space.db
|
|
28
|
+
// .query(Filter.or(...schemas.map((schema) => Filter.type(schema as Type.Schema))))
|
|
29
|
+
// .run();
|
|
30
|
+
|
|
31
|
+
const { objects } = await space.db.query(Filter.everything()).run();
|
|
30
32
|
|
|
31
33
|
return (
|
|
32
34
|
objects
|
|
@@ -39,7 +41,7 @@ export const useReferencesProvider = (space?: Space): ReferencesProvider | undef
|
|
|
39
41
|
// TODO(dmaretskyi): `Type.getDXN` (at the point of writing) didn't work here as it was schema-only.
|
|
40
42
|
.filter((object) => !!Obj.getDXN(object as Obj.Any))
|
|
41
43
|
.map((object) => ({
|
|
42
|
-
uri: Obj.getDXN(object as any)
|
|
44
|
+
uri: Obj.getDXN(object as any).toString(),
|
|
43
45
|
label: Obj.getLabel(object as any) ?? '',
|
|
44
46
|
}))
|
|
45
47
|
);
|
|
@@ -49,7 +51,7 @@ export const useReferencesProvider = (space?: Space): ReferencesProvider | undef
|
|
|
49
51
|
return { uri, label: Obj.getLabel(object) ?? '' };
|
|
50
52
|
},
|
|
51
53
|
} satisfies ReferencesProvider;
|
|
52
|
-
}, [space,
|
|
54
|
+
}, [space, blueprints]);
|
|
53
55
|
};
|
|
54
56
|
|
|
55
57
|
const stringMatch = (query: string, label: string) => label.toLowerCase().startsWith(query.toLowerCase());
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useMemo, useSyncExternalStore } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Space } from '@dxos/client/echo';
|
|
8
|
+
import { type Ref } from '@dxos/echo';
|
|
9
|
+
|
|
10
|
+
// TODO(burdon): Factor out.
|
|
11
|
+
export const useResolvedRef = <T>(space: Space, ref: Ref.Ref<T>): T | undefined => {
|
|
12
|
+
const { subscribe, getSnapshot } = useMemo(() => {
|
|
13
|
+
const resolver = space.db.graph.createRefResolver({});
|
|
14
|
+
let currentCallback: (() => void) | undefined = undefined;
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
subscribe: (cb: () => void) => {
|
|
18
|
+
currentCallback = cb;
|
|
19
|
+
return () => {
|
|
20
|
+
if (currentCallback === cb) {
|
|
21
|
+
currentCallback = undefined;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
getSnapshot: () =>
|
|
26
|
+
resolver?.resolveSync(ref.dxn, true, () => {
|
|
27
|
+
currentCallback?.();
|
|
28
|
+
}) as T | undefined,
|
|
29
|
+
};
|
|
30
|
+
}, [space, ref.dxn.toString()]);
|
|
31
|
+
|
|
32
|
+
return useSyncExternalStore<T | undefined>(subscribe, getSnapshot);
|
|
33
|
+
};
|
package/src/meta.ts
CHANGED
|
@@ -11,7 +11,7 @@ export const ASSISTANT_DIALOG = `${ASSISTANT_PLUGIN}/assistant/dialog`;
|
|
|
11
11
|
export const meta: PluginMeta = {
|
|
12
12
|
id: ASSISTANT_PLUGIN,
|
|
13
13
|
name: 'Assistant',
|
|
14
|
-
description: 'The Assistant
|
|
14
|
+
description: 'The Assistant plugin allows you to chat with your spaces inside of Composer.',
|
|
15
15
|
icon: 'ph--atom--regular',
|
|
16
16
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-assistant',
|
|
17
17
|
tags: ['labs'],
|