@dxos/plugin-assistant 0.8.4-main.2e9d522 → 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/{TemplateContainer-RPJ2LBOB.mjs → BlueprintContainer-OWUSKPRK.mjs} +11 -9
- package/dist/lib/browser/BlueprintContainer-OWUSKPRK.mjs.map +7 -0
- package/dist/lib/browser/ChatCompanion-FRCVSLPP.mjs +126 -0
- package/dist/lib/browser/ChatCompanion-FRCVSLPP.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-M3IHQLRS.mjs → ChatContainer-YBJBIVUZ.mjs} +34 -13
- package/dist/lib/browser/ChatContainer-YBJBIVUZ.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-X6VN6QZI.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-JTXBKE7O.mjs → app-graph-builder-7AAWTWGA.mjs} +26 -96
- 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-CFXXQM25.mjs +182 -0
- 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 +154 -67
- 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-VNCD2H7C.mjs +109 -0
- package/dist/lib/browser/react-surface-VNCD2H7C.mjs.map +7 -0
- package/dist/lib/browser/{settings-2DGP3UTS.mjs → settings-36V3VUMW.mjs} +6 -5
- package/dist/lib/{node-esm/settings-47RYZOU4.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/{TemplateContainer-A3NAQCZE.mjs → BlueprintContainer-UFVWCRN6.mjs} +11 -9
- package/dist/lib/node-esm/BlueprintContainer-UFVWCRN6.mjs.map +7 -0
- 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-VZT74PO2.mjs → ChatContainer-TUCITJJW.mjs} +34 -13
- package/dist/lib/node-esm/ChatContainer-TUCITJJW.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-RJ6FDX4Q.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-OWSOXFTD.mjs → app-graph-builder-PNAFQUYT.mjs} +26 -96
- 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-FNZJJL7G.mjs +183 -0
- 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 +154 -67
- 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-4NLRKNBU.mjs +110 -0
- package/dist/lib/node-esm/react-surface-4NLRKNBU.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-47RYZOU4.mjs → settings-7ZCZ6AS5.mjs} +6 -5
- package/dist/lib/{browser/settings-2DGP3UTS.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/BlueprintContainer.d.ts +8 -0
- package/dist/types/src/components/BlueprintContainer.d.ts.map +1 -0
- package/dist/types/src/components/Chat/Chat.d.ts +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 -72
- 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 +2 -6
- 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 +2 -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 +5 -2
- 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 +23 -246
- 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 +27 -21
- 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 +97 -77
- package/src/AssistantPlugin.tsx +74 -12
- package/src/capabilities/ai-service.ts +28 -0
- package/src/capabilities/app-graph-builder.ts +43 -134
- 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 +50 -14
- package/src/capabilities/local-model-resolver.ts +32 -0
- package/src/capabilities/react-surface.tsx +17 -64
- 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/BlueprintContainer.tsx +24 -0
- 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 +27 -14
- package/src/components/TemplateEditor/TemplateEditor.tsx +20 -51
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +15 -8
- package/src/components/TemplateEditor/TemplateForm.tsx +6 -3
- 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 +4 -5
- 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 +34 -61
- 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 +389 -298
- 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 +31 -21
- 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-M3IHQLRS.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-X6VN6QZI.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
- package/dist/lib/browser/TemplateContainer-RPJ2LBOB.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-JTXBKE7O.mjs.map +0 -7
- package/dist/lib/browser/chunk-AEAEKWOC.mjs +0 -98
- package/dist/lib/browser/chunk-AEAEKWOC.mjs.map +0 -7
- package/dist/lib/browser/chunk-EQDW6BYQ.mjs +0 -108
- package/dist/lib/browser/chunk-EQDW6BYQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
- package/dist/lib/browser/chunk-JQBVLTM5.mjs +0 -158
- package/dist/lib/browser/chunk-JQBVLTM5.mjs.map +0 -7
- package/dist/lib/browser/chunk-OWY4CUQY.mjs +0 -2245
- package/dist/lib/browser/chunk-OWY4CUQY.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs +0 -60
- package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs.map +0 -7
- package/dist/lib/browser/react-surface-66VY37YQ.mjs +0 -150
- package/dist/lib/browser/react-surface-66VY37YQ.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-VZT74PO2.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-RJ6FDX4Q.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
- package/dist/lib/node-esm/TemplateContainer-A3NAQCZE.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-OWSOXFTD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2XL6MNPE.mjs +0 -99
- package/dist/lib/node-esm/chunk-2XL6MNPE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BISJDTBK.mjs +0 -159
- package/dist/lib/node-esm/chunk-BISJDTBK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-E33DNNDW.mjs +0 -109
- package/dist/lib/node-esm/chunk-E33DNNDW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
- package/dist/lib/node-esm/chunk-SENTQAEO.mjs +0 -2246
- package/dist/lib/node-esm/chunk-SENTQAEO.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs +0 -61
- package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs +0 -151
- package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs.map +0 -7
- 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/components/TemplateContainer.d.ts +0 -8
- package/dist/types/src/components/TemplateContainer.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 -88
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
- package/src/components/ChatThread/reducer.ts +0 -52
- package/src/components/TemplateContainer.tsx +0 -24
- 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 -95
- package/src/typings.d.ts +0 -9
|
@@ -4,14 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { Filter } from '@dxos/echo';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
type Identifier,
|
|
11
|
-
type Literal,
|
|
12
|
-
type RelationalOperator,
|
|
13
|
-
type UnaryExpression,
|
|
14
|
-
} from './types';
|
|
7
|
+
// TODO(burdon): Factor out.
|
|
8
|
+
|
|
9
|
+
import { type Expression, type Identifier, type Literal, type RelationalOperator } from './types';
|
|
15
10
|
|
|
16
11
|
const relationalOperators: Record<RelationalOperator, (value: any) => Filter<any>> = {
|
|
17
12
|
EQ: Filter.eq,
|
|
@@ -26,7 +21,7 @@ const specialPredicates: Record<string, (value: string) => Filter<any>> = {
|
|
|
26
21
|
export const createFilter = (ast: Expression): Filter<any> => {
|
|
27
22
|
switch (ast.type) {
|
|
28
23
|
case 'binary': {
|
|
29
|
-
const { operator, left, right } = ast
|
|
24
|
+
const { operator, left, right } = ast;
|
|
30
25
|
|
|
31
26
|
// Handle logical operators.
|
|
32
27
|
if (operator === 'AND') {
|
|
@@ -44,7 +39,7 @@ export const createFilter = (ast: Expression): Filter<any> => {
|
|
|
44
39
|
}
|
|
45
40
|
|
|
46
41
|
// Handle relational operators
|
|
47
|
-
const filterFn = relationalOperators[operator
|
|
42
|
+
const filterFn = relationalOperators[operator];
|
|
48
43
|
if (filterFn) {
|
|
49
44
|
return filterFn((right as Literal).value);
|
|
50
45
|
}
|
|
@@ -53,7 +48,7 @@ export const createFilter = (ast: Expression): Filter<any> => {
|
|
|
53
48
|
}
|
|
54
49
|
|
|
55
50
|
case 'unary': {
|
|
56
|
-
const { operator, argument } = ast
|
|
51
|
+
const { operator, argument } = ast;
|
|
57
52
|
if (operator === 'NOT') {
|
|
58
53
|
return Filter.not(createFilter(argument));
|
|
59
54
|
}
|
|
@@ -61,12 +56,12 @@ export const createFilter = (ast: Expression): Filter<any> => {
|
|
|
61
56
|
}
|
|
62
57
|
|
|
63
58
|
case 'identifier': {
|
|
64
|
-
const { name } = ast
|
|
59
|
+
const { name } = ast;
|
|
65
60
|
return Filter._props({ [name]: true });
|
|
66
61
|
}
|
|
67
62
|
|
|
68
63
|
case 'literal': {
|
|
69
|
-
const { value } = ast
|
|
64
|
+
const { value } = ast;
|
|
70
65
|
// Handle special '*' value for empty input.
|
|
71
66
|
if (value === '*') {
|
|
72
67
|
return Filter.everything();
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { invariant } from '@dxos/invariant';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type BinaryOperator, type Expression, type RelationalOperator } from './types';
|
|
8
8
|
|
|
9
9
|
// TODO(burdon): Move to echo-schema?
|
|
10
10
|
|
package/src/parser/types.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { Schema } from 'effect';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type ModelName } from '@dxos/ai';
|
|
8
8
|
|
|
9
9
|
const ModelProviders = ['dxos-local', 'dxos-remote', 'lm-studio'] as const;
|
|
10
10
|
|
|
@@ -14,11 +14,11 @@ type ModelProvider = Schema.Schema.Type<typeof ModelProvider>;
|
|
|
14
14
|
export type AiServicePreset = {
|
|
15
15
|
id: string;
|
|
16
16
|
provider: ModelProvider;
|
|
17
|
-
model:
|
|
17
|
+
model: ModelName;
|
|
18
18
|
label?: string;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
const createModelLabel = (model:
|
|
21
|
+
const createModelLabel = (model: ModelName) => {
|
|
22
22
|
const parts = model.split('/');
|
|
23
23
|
return parts[parts.length - 1];
|
|
24
24
|
};
|
|
@@ -27,20 +27,28 @@ const createModelLabel = (model: LLMModel) => {
|
|
|
27
27
|
export const AiServicePresets: AiServicePreset[] = [
|
|
28
28
|
{
|
|
29
29
|
provider: 'dxos-remote' as const,
|
|
30
|
-
model: '@anthropic/claude-
|
|
30
|
+
model: '@anthropic/claude-opus-4-0' as const,
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
provider: 'dxos-remote' as const,
|
|
34
|
-
model: '@anthropic/claude-
|
|
34
|
+
model: '@anthropic/claude-sonnet-4-0' as const,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
provider: 'dxos-remote' as const,
|
|
38
|
+
model: '@anthropic/claude-3-5-haiku-20241022' as const,
|
|
35
39
|
},
|
|
36
40
|
{
|
|
37
41
|
provider: 'lm-studio' as const,
|
|
38
|
-
model: '@google/gemma-3-
|
|
42
|
+
model: '@google/gemma-3-27b' as const,
|
|
39
43
|
},
|
|
40
44
|
{
|
|
41
45
|
provider: 'lm-studio' as const,
|
|
42
46
|
model: '@mlx-community/llama-3.2-3b-instruct' as const,
|
|
43
47
|
},
|
|
48
|
+
{
|
|
49
|
+
model: 'deepseek-r1:latest' as const,
|
|
50
|
+
provider: 'dxos-local' as const,
|
|
51
|
+
},
|
|
44
52
|
].map(
|
|
45
53
|
({ model, provider }, i) =>
|
|
46
54
|
({
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { AiTool, AiToolkit } from '@effect/ai';
|
|
6
|
+
import { describe, it } from '@effect/vitest';
|
|
7
|
+
import { Effect, Layer, Schema } from 'effect';
|
|
8
|
+
|
|
9
|
+
import { AiService } from '@dxos/ai';
|
|
10
|
+
import { AiServiceTestingPreset } from '@dxos/ai/testing';
|
|
11
|
+
import { AiConversation, makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '@dxos/assistant';
|
|
12
|
+
import { TestHelpers } from '@dxos/effect';
|
|
13
|
+
import {
|
|
14
|
+
ComputeEventLogger,
|
|
15
|
+
CredentialsService,
|
|
16
|
+
LocalFunctionExecutionService,
|
|
17
|
+
QueueService,
|
|
18
|
+
RemoteFunctionExecutionService,
|
|
19
|
+
TracingService,
|
|
20
|
+
} from '@dxos/functions';
|
|
21
|
+
import { TestDatabaseLayer } from '@dxos/functions/testing';
|
|
22
|
+
import { type DataType } from '@dxos/schema';
|
|
23
|
+
|
|
24
|
+
import { AiChatProcessor, type AiChatServices } from './processor';
|
|
25
|
+
|
|
26
|
+
class TestToolkit extends AiToolkit.make(
|
|
27
|
+
AiTool.make('random', {
|
|
28
|
+
description: 'Random number generator',
|
|
29
|
+
parameters: {},
|
|
30
|
+
success: Schema.Number,
|
|
31
|
+
}),
|
|
32
|
+
) {}
|
|
33
|
+
|
|
34
|
+
// TODO(burdon): Create minimal toolkit.
|
|
35
|
+
const toolkit = AiToolkit.merge(TestToolkit) as AiToolkit.Any as AiToolkit.AiToolkit<AiTool.Any>;
|
|
36
|
+
|
|
37
|
+
// TODO(burdon): Explain structure.
|
|
38
|
+
const TestServicesLayer = Layer.mergeAll(
|
|
39
|
+
TracingService.layerNoop,
|
|
40
|
+
AiServiceTestingPreset('direct'),
|
|
41
|
+
TestDatabaseLayer({
|
|
42
|
+
// indexing: { vector: true },
|
|
43
|
+
// types: [],
|
|
44
|
+
}),
|
|
45
|
+
// CredentialsService.configuredLayer([{ service: 'exa.ai', apiKey: EXA_API_KEY }]),
|
|
46
|
+
LocalFunctionExecutionService.layer,
|
|
47
|
+
RemoteFunctionExecutionService.mockLayer,
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const TestLayer: Layer.Layer<AiChatServices, never, never> = Layer.mergeAll(
|
|
51
|
+
AiService.model('@anthropic/claude-opus-4-0'),
|
|
52
|
+
makeToolResolverFromFunctions([], toolkit),
|
|
53
|
+
makeToolExecutionServiceFromFunctions([], toolkit, toolkit.toLayer({}) as any),
|
|
54
|
+
CredentialsService.layerFromDatabase(),
|
|
55
|
+
ComputeEventLogger.layerFromTracing,
|
|
56
|
+
).pipe(Layer.provideMerge(TestServicesLayer), Layer.orDie);
|
|
57
|
+
|
|
58
|
+
// TODO(burdon): Create actual test with mock LLM.
|
|
59
|
+
describe('Chat processor', () => {
|
|
60
|
+
it.effect(
|
|
61
|
+
'basic',
|
|
62
|
+
Effect.fn(
|
|
63
|
+
function* ({ expect }) {
|
|
64
|
+
const services = TestLayer;
|
|
65
|
+
const queue = yield* QueueService.createQueue<DataType.Message>();
|
|
66
|
+
const conversation = new AiConversation({ queue });
|
|
67
|
+
const processor = new AiChatProcessor(conversation, services);
|
|
68
|
+
const result = yield* Effect.promise(() => processor.request({ message: 'Hello' }));
|
|
69
|
+
void processor.cancel();
|
|
70
|
+
expect(processor.isRunning).to.be.false;
|
|
71
|
+
expect(result).to.exist;
|
|
72
|
+
},
|
|
73
|
+
Effect.provide(TestLayer),
|
|
74
|
+
TestHelpers.taggedTest('llm'),
|
|
75
|
+
),
|
|
76
|
+
);
|
|
77
|
+
});
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Registry, Rx } from '@effect-rx/rx-react';
|
|
6
|
+
import { Cause, Effect, Exit, Fiber, Layer, Option } from 'effect';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
AiService,
|
|
10
|
+
DEFAULT_EDGE_MODEL,
|
|
11
|
+
type ModelName,
|
|
12
|
+
type ModelRegistry,
|
|
13
|
+
type ToolExecutionService,
|
|
14
|
+
type ToolResolverService,
|
|
15
|
+
} from '@dxos/ai';
|
|
16
|
+
import {
|
|
17
|
+
type AiConversation,
|
|
18
|
+
type AiConversationRunParams,
|
|
19
|
+
AiSession,
|
|
20
|
+
ArtifactDiffResolver,
|
|
21
|
+
GenerationObserver,
|
|
22
|
+
createSystemPrompt,
|
|
23
|
+
} from '@dxos/assistant';
|
|
24
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
25
|
+
import { Obj } from '@dxos/echo';
|
|
26
|
+
import { throwCause } from '@dxos/effect';
|
|
27
|
+
import {
|
|
28
|
+
type CredentialsService,
|
|
29
|
+
type DatabaseService,
|
|
30
|
+
type QueueService,
|
|
31
|
+
type RemoteFunctionExecutionService,
|
|
32
|
+
type TracingService,
|
|
33
|
+
} from '@dxos/functions';
|
|
34
|
+
import { log } from '@dxos/log';
|
|
35
|
+
import { type ContentBlock, DataType } from '@dxos/schema';
|
|
36
|
+
import { trim } from '@dxos/util';
|
|
37
|
+
|
|
38
|
+
import { type Assistant } from '../types';
|
|
39
|
+
|
|
40
|
+
export type AiChatServices =
|
|
41
|
+
| CredentialsService
|
|
42
|
+
| DatabaseService
|
|
43
|
+
| QueueService
|
|
44
|
+
| RemoteFunctionExecutionService
|
|
45
|
+
| AiService.AiService
|
|
46
|
+
| ToolExecutionService
|
|
47
|
+
| ToolResolverService
|
|
48
|
+
| TracingService;
|
|
49
|
+
|
|
50
|
+
export type AiChatProcessorOptions = {
|
|
51
|
+
model?: ModelName;
|
|
52
|
+
modelRegistry?: ModelRegistry;
|
|
53
|
+
blueprintRegistry?: Blueprint.Registry;
|
|
54
|
+
observableRegistry?: Registry.Registry;
|
|
55
|
+
extensions?: ToolContextExtensions;
|
|
56
|
+
} & Pick<AiConversationRunParams, 'system'>;
|
|
57
|
+
|
|
58
|
+
const defaultOptions: Partial<AiChatProcessorOptions> = {
|
|
59
|
+
model: DEFAULT_EDGE_MODEL,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// TODO(burdon): Retry, timeout?
|
|
63
|
+
export type AiRequestOptions = {};
|
|
64
|
+
|
|
65
|
+
export type AiRequest = {
|
|
66
|
+
message: string;
|
|
67
|
+
options?: AiRequestOptions;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Handles interactions with the AI service.
|
|
72
|
+
* Handles streaming responses from the conversation.
|
|
73
|
+
*/
|
|
74
|
+
export class AiChatProcessor {
|
|
75
|
+
private readonly _rx: Registry.Registry;
|
|
76
|
+
|
|
77
|
+
/** External observer. */
|
|
78
|
+
private readonly _observer: GenerationObserver;
|
|
79
|
+
|
|
80
|
+
/** Currently active request fiber. */
|
|
81
|
+
private _fiber: Fiber.Fiber<void, any> | undefined;
|
|
82
|
+
|
|
83
|
+
/** Last request (for retries). */
|
|
84
|
+
private _lastRequest: AiRequest | undefined;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Pending messages (incl. the current user request).
|
|
88
|
+
*/
|
|
89
|
+
private readonly _pending = Rx.make<DataType.Message[]>([]);
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Currently streaming message (from the AI service).
|
|
93
|
+
*/
|
|
94
|
+
private readonly _streaming = Rx.make<Option.Option<DataType.Message>>(Option.none());
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Streaming state.
|
|
98
|
+
*/
|
|
99
|
+
public readonly streaming = Rx.make<boolean>((get) => Option.isSome(get(this._streaming)));
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Array of Messages (incl. the current message being streamed).
|
|
103
|
+
*/
|
|
104
|
+
public readonly messages = Rx.make<DataType.Message[]>((get) =>
|
|
105
|
+
Option.match(get(this._streaming), {
|
|
106
|
+
onNone: () => get(this._pending),
|
|
107
|
+
onSome: (streaming) => [...get(this._pending), streaming],
|
|
108
|
+
}),
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
/** Last error. */
|
|
112
|
+
public readonly error = Rx.make<Option.Option<Error>>(Option.none());
|
|
113
|
+
|
|
114
|
+
constructor(
|
|
115
|
+
private readonly _conversation: AiConversation,
|
|
116
|
+
// TODO(dmaretskyi): Replace this with effect's ManagedRuntime wrapping this layer.
|
|
117
|
+
private readonly _services: Layer.Layer<AiChatServices>,
|
|
118
|
+
private readonly _options: AiChatProcessorOptions = defaultOptions,
|
|
119
|
+
) {
|
|
120
|
+
// Initialize registries and defaults before using in other logic.
|
|
121
|
+
this._rx = this._options.observableRegistry ?? Registry.make();
|
|
122
|
+
this._observer = GenerationObserver.make({
|
|
123
|
+
onBlock: this._onBlock,
|
|
124
|
+
onMessage: this._onMessage,
|
|
125
|
+
});
|
|
126
|
+
if (this._options.model && !this._options.system) {
|
|
127
|
+
const capabilities = this._options.modelRegistry?.getCapabilities(this._options.model) ?? {};
|
|
128
|
+
this._options.system = createSystemPrompt(capabilities);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
get isRunning() {
|
|
133
|
+
return !!this._fiber;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
get context() {
|
|
137
|
+
return this._conversation.context;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
get conversation() {
|
|
141
|
+
return this._conversation;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
get blueprintRegistry() {
|
|
145
|
+
return this._options.blueprintRegistry;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Initiates a new request.
|
|
150
|
+
*/
|
|
151
|
+
async request(requestParam: AiRequest): Promise<void> {
|
|
152
|
+
if (this._fiber) {
|
|
153
|
+
await this.cancel();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
try {
|
|
157
|
+
this._lastRequest = requestParam;
|
|
158
|
+
this._rx.set(this.error, Option.none());
|
|
159
|
+
|
|
160
|
+
// Create request.
|
|
161
|
+
const request = this._conversation.createRequest({
|
|
162
|
+
system: this._options.system,
|
|
163
|
+
prompt: requestParam.message,
|
|
164
|
+
observer: this._observer,
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// Create fiber.
|
|
168
|
+
this._fiber = request.pipe(
|
|
169
|
+
Effect.provide(Layer.provideMerge(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL), this._services)),
|
|
170
|
+
|
|
171
|
+
// TODO(dmaretskyi): Move ArtifactDiffResolver upstream.
|
|
172
|
+
Effect.provideService(ArtifactDiffResolver, this._artifactDiffResolver),
|
|
173
|
+
|
|
174
|
+
Effect.asVoid,
|
|
175
|
+
Effect.tapErrorCause((cause) => {
|
|
176
|
+
log.error('request failed', { cause });
|
|
177
|
+
return Effect.void;
|
|
178
|
+
}),
|
|
179
|
+
Effect.runFork, // Runs in the background.
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
// Execute request.
|
|
183
|
+
const response = await this._fiber.pipe(Fiber.join, Effect.runPromiseExit);
|
|
184
|
+
if (!Exit.isSuccess(response) && !Cause.isInterruptedOnly(response.cause)) {
|
|
185
|
+
throwCause(response.cause);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
this._rx.set(this.error, Option.none());
|
|
189
|
+
this._lastRequest = undefined;
|
|
190
|
+
this._fiber = undefined;
|
|
191
|
+
} catch (err) {
|
|
192
|
+
log.error('request failed', { err });
|
|
193
|
+
this._rx.set(this.error, Option.some(new Error('AI service error', { cause: err })));
|
|
194
|
+
} finally {
|
|
195
|
+
this._fiber = undefined;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Cancels the current request.
|
|
201
|
+
*/
|
|
202
|
+
async cancel(): Promise<void> {
|
|
203
|
+
await Effect.runPromise(
|
|
204
|
+
Effect.gen(this, function* () {
|
|
205
|
+
if (this._fiber) {
|
|
206
|
+
yield* this._fiber.pipe(Fiber.interrupt);
|
|
207
|
+
}
|
|
208
|
+
}),
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
this._fiber = undefined;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Retry last failed request.
|
|
216
|
+
*/
|
|
217
|
+
async retry(): Promise<void> {
|
|
218
|
+
if (this._lastRequest) {
|
|
219
|
+
return this.request(this._lastRequest);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Update the current chat's name.
|
|
225
|
+
*/
|
|
226
|
+
async updateName(chat: Assistant.Chat): Promise<void> {
|
|
227
|
+
const system = trim`
|
|
228
|
+
It is extremely important that you respond only with the title and nothing else.
|
|
229
|
+
If you cannot do this effectively respond with "New Chat".
|
|
230
|
+
`;
|
|
231
|
+
|
|
232
|
+
const history = await this._conversation.getHistory();
|
|
233
|
+
const fiber = Effect.gen(this, function* () {
|
|
234
|
+
const session = new AiSession();
|
|
235
|
+
return yield* session.run({ system, prompt: 'Suggest a name for this chat', history });
|
|
236
|
+
}).pipe(
|
|
237
|
+
// TODO(burdon): Use simpler model.
|
|
238
|
+
Effect.provide(Layer.provideMerge(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL), this._services)),
|
|
239
|
+
Effect.tap((messages) => {
|
|
240
|
+
const message = messages.find((message) => message.sender.role === 'assistant');
|
|
241
|
+
const title = message?.blocks.find((b) => b._tag === 'text')?.text;
|
|
242
|
+
if (title) {
|
|
243
|
+
chat.name = title;
|
|
244
|
+
}
|
|
245
|
+
}),
|
|
246
|
+
Effect.runFork, // Run in the background.
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
const response = await fiber.pipe(Fiber.join, Effect.runPromiseExit);
|
|
250
|
+
if (!Exit.isSuccess(response)) {
|
|
251
|
+
throwCause(response.cause);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// TODO(burdon): Fix/factor out.
|
|
256
|
+
private _artifactDiffResolver: ArtifactDiffResolver.Service = {
|
|
257
|
+
resolve: async (_artifacts) => {
|
|
258
|
+
const versions = new Map();
|
|
259
|
+
// await Promise.all(
|
|
260
|
+
// artifacts.map(async (artifact) => {
|
|
261
|
+
// const {
|
|
262
|
+
// objects: [object],
|
|
263
|
+
// } = await space.db.query(Filter.ids(artifact.id)).run();
|
|
264
|
+
// if (!object) {
|
|
265
|
+
// return;
|
|
266
|
+
// }
|
|
267
|
+
|
|
268
|
+
// versions.set(artifact.id, {
|
|
269
|
+
// version: getVersion(object),
|
|
270
|
+
// diff: `Current state: ${JSON.stringify(object)}`,
|
|
271
|
+
// });
|
|
272
|
+
// }),
|
|
273
|
+
// );
|
|
274
|
+
|
|
275
|
+
return versions;
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
private _onMessage = Effect.fn(
|
|
280
|
+
function* (this: AiChatProcessor, message: DataType.Message) {
|
|
281
|
+
this._rx.set(this._streaming, Option.none());
|
|
282
|
+
this._rx.update(this._pending, (pending) => [...pending, message]);
|
|
283
|
+
}.bind(this),
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
private _onBlock = Effect.fn(
|
|
287
|
+
function* (this: AiChatProcessor, block: ContentBlock.Any) {
|
|
288
|
+
this._rx.update(this._streaming, (streaming) => {
|
|
289
|
+
const blocks = streaming.pipe(
|
|
290
|
+
Option.map((streaming) => streaming.blocks.filter((b) => !b.pending)),
|
|
291
|
+
Option.getOrElse(() => []),
|
|
292
|
+
);
|
|
293
|
+
|
|
294
|
+
return Option.some(
|
|
295
|
+
Obj.make(DataType.Message, {
|
|
296
|
+
created: new Date().toISOString(),
|
|
297
|
+
sender: { role: 'assistant' },
|
|
298
|
+
blocks: [...blocks, block],
|
|
299
|
+
}),
|
|
300
|
+
);
|
|
301
|
+
});
|
|
302
|
+
}.bind(this),
|
|
303
|
+
);
|
|
304
|
+
}
|
package/src/queue-logger.ts
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type Queue, Ref, type Space, getSpace } from '@dxos/client/echo';
|
|
6
6
|
import { type Sequence, type SequenceEvent, type SequenceLogger } from '@dxos/conductor';
|
|
7
7
|
import { DXN, Key, Obj } from '@dxos/echo';
|
|
8
8
|
import {
|
|
9
9
|
InvocationOutcome,
|
|
10
10
|
InvocationTraceEndEvent,
|
|
11
|
+
type InvocationTraceEvent,
|
|
11
12
|
InvocationTraceEventType,
|
|
12
13
|
InvocationTraceStartEvent,
|
|
13
14
|
TraceEvent,
|
|
14
|
-
type InvocationTraceEvent,
|
|
15
15
|
} from '@dxos/functions';
|
|
16
16
|
import { invariant } from '@dxos/invariant';
|
|
17
17
|
import { QueueSubspaceTags } from '@dxos/keys';
|
|
@@ -62,7 +62,7 @@ export class QueueLogger implements SequenceLogger {
|
|
|
62
62
|
Obj.make(TraceEvent, {
|
|
63
63
|
outcome: event.type,
|
|
64
64
|
truncated: false,
|
|
65
|
-
|
|
65
|
+
ingestionTimestamp: Date.now(),
|
|
66
66
|
logs: [
|
|
67
67
|
{
|
|
68
68
|
timestampMs: Date.now(),
|
|
@@ -80,7 +80,7 @@ export class QueueLogger implements SequenceLogger {
|
|
|
80
80
|
Obj.make(TraceEvent, {
|
|
81
81
|
outcome: event.type,
|
|
82
82
|
truncated: false,
|
|
83
|
-
|
|
83
|
+
ingestionTimestamp: Date.now(),
|
|
84
84
|
logs: [
|
|
85
85
|
{
|
|
86
86
|
timestampMs: Date.now(),
|
|
@@ -98,7 +98,7 @@ export class QueueLogger implements SequenceLogger {
|
|
|
98
98
|
Obj.make(TraceEvent, {
|
|
99
99
|
outcome: event.type,
|
|
100
100
|
truncated: false,
|
|
101
|
-
|
|
101
|
+
ingestionTimestamp: Date.now(),
|
|
102
102
|
logs: [
|
|
103
103
|
{
|
|
104
104
|
timestampMs: Date.now(),
|