@dxos/plugin-assistant 0.8.3-staging.0fa589b → 0.8.4-main.1da679c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{TemplateContainer-QQHVOTSI.mjs → BlueprintContainer-6MZHBQ25.mjs} +11 -10
- package/dist/lib/browser/BlueprintContainer-6MZHBQ25.mjs.map +7 -0
- package/dist/lib/browser/ChatCompanion-B4DLQE6Y.mjs +124 -0
- package/dist/lib/browser/ChatCompanion-B4DLQE6Y.mjs.map +7 -0
- package/dist/lib/browser/ChatContainer-Z7A3RKOY.mjs +73 -0
- package/dist/lib/browser/ChatContainer-Z7A3RKOY.mjs.map +7 -0
- package/dist/lib/browser/ChatDialog-PL5TSGD5.mjs +86 -0
- package/dist/lib/browser/ChatDialog-PL5TSGD5.mjs.map +7 -0
- package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs +150 -0
- package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs.map +7 -0
- package/dist/lib/browser/ai-service-4VESSFNB.mjs +18 -0
- package/dist/lib/browser/ai-service-4VESSFNB.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-BBDHBJXA.mjs +153 -0
- package/dist/lib/browser/app-graph-builder-BBDHBJXA.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-3SATLYJW.mjs +12 -0
- package/dist/lib/browser/blueprint-definition-3SATLYJW.mjs.map +7 -0
- package/dist/lib/browser/chunk-BBT6KNXA.mjs +165 -0
- package/dist/lib/browser/chunk-BBT6KNXA.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-JDI4FEKA.mjs +299 -0
- package/dist/lib/browser/chunk-JDI4FEKA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-XOZ7YMO3.mjs → chunk-O4LUJEDV.mjs} +3 -3
- package/dist/lib/browser/{chunk-XOZ7YMO3.mjs.map → chunk-O4LUJEDV.mjs.map} +1 -1
- package/dist/lib/browser/chunk-PQI3MGDN.mjs +169 -0
- package/dist/lib/browser/chunk-PQI3MGDN.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-TMKK6VCA.mjs +216 -0
- package/dist/lib/browser/chunk-TMKK6VCA.mjs.map +7 -0
- package/dist/lib/browser/chunk-YKODYEYR.mjs +16 -0
- package/dist/lib/browser/chunk-YKODYEYR.mjs.map +7 -0
- package/dist/lib/browser/chunk-YOBHCEEI.mjs +1941 -0
- package/dist/lib/browser/chunk-YOBHCEEI.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-6YWYDPTS.mjs +18 -0
- package/dist/lib/browser/edge-model-resolver-6YWYDPTS.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +191 -128
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-MRZJU255.mjs +112 -0
- package/dist/lib/browser/intent-resolver-MRZJU255.mjs.map +7 -0
- package/dist/lib/browser/local-model-resolver-QXLLTV2H.mjs +17 -0
- package/dist/lib/browser/local-model-resolver-QXLLTV2H.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-UKMOARXR.mjs +107 -0
- package/dist/lib/browser/react-surface-UKMOARXR.mjs.map +7 -0
- package/dist/lib/browser/{settings-XRHXVWGB.mjs → settings-4AJ34FKF.mjs} +9 -8
- package/dist/lib/browser/settings-4AJ34FKF.mjs.map +7 -0
- package/dist/lib/browser/state-ABR7YSSA.mjs +21 -0
- package/dist/lib/browser/state-ABR7YSSA.mjs.map +7 -0
- package/dist/lib/browser/toolkit-U7SKGAIC.mjs +191 -0
- package/dist/lib/browser/toolkit-U7SKGAIC.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -20
- package/dist/lib/node-esm/{TemplateContainer-SOEWY2ZN.mjs → BlueprintContainer-MUHW5HNY.mjs} +11 -10
- package/dist/lib/node-esm/BlueprintContainer-MUHW5HNY.mjs.map +7 -0
- package/dist/lib/node-esm/ChatCompanion-DK6FULBU.mjs +125 -0
- package/dist/lib/node-esm/ChatCompanion-DK6FULBU.mjs.map +7 -0
- package/dist/lib/node-esm/ChatContainer-7IN7ZICQ.mjs +74 -0
- package/dist/lib/node-esm/ChatContainer-7IN7ZICQ.mjs.map +7 -0
- package/dist/lib/node-esm/ChatDialog-LPE653RZ.mjs +87 -0
- package/dist/lib/node-esm/ChatDialog-LPE653RZ.mjs.map +7 -0
- package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs +151 -0
- package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-I5JU4JN2.mjs +19 -0
- package/dist/lib/node-esm/ai-service-I5JU4JN2.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-EMR5JF6Z.mjs +154 -0
- package/dist/lib/node-esm/app-graph-builder-EMR5JF6Z.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-B6UDX5U3.mjs +13 -0
- package/dist/lib/node-esm/blueprint-definition-B6UDX5U3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4WLFSXZG.mjs +170 -0
- package/dist/lib/node-esm/chunk-4WLFSXZG.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-5MYWJPYA.mjs +167 -0
- package/dist/lib/node-esm/chunk-5MYWJPYA.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-3UEZLJ2V.mjs → chunk-FHRJMZ7L.mjs} +6 -5
- package/dist/lib/node-esm/chunk-FHRJMZ7L.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-GCNF3CQU.mjs +217 -0
- package/dist/lib/node-esm/chunk-GCNF3CQU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-H3ZC4UL7.mjs +300 -0
- package/dist/lib/node-esm/chunk-H3ZC4UL7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-BB2TAT4P.mjs → chunk-VFY2JG62.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-BB2TAT4P.mjs.map → chunk-VFY2JG62.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-X2YUKRBE.mjs +1942 -0
- package/dist/lib/node-esm/chunk-X2YUKRBE.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-A7B6QHLL.mjs +19 -0
- package/dist/lib/node-esm/edge-model-resolver-A7B6QHLL.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +191 -128
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-CIXO3KMY.mjs +113 -0
- package/dist/lib/node-esm/intent-resolver-CIXO3KMY.mjs.map +7 -0
- package/dist/lib/node-esm/local-model-resolver-JCYDHAZY.mjs +18 -0
- package/dist/lib/node-esm/local-model-resolver-JCYDHAZY.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-5NDJAWA2.mjs +108 -0
- package/dist/lib/node-esm/react-surface-5NDJAWA2.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-5IAY6BT4.mjs → settings-K2QW4ATZ.mjs} +9 -8
- package/dist/lib/node-esm/settings-K2QW4ATZ.mjs.map +7 -0
- package/dist/lib/node-esm/state-6UHESJI5.mjs +22 -0
- package/dist/lib/node-esm/state-6UHESJI5.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-LNLRBVDU.mjs +192 -0
- package/dist/lib/node-esm/toolkit-LNLRBVDU.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +7 -20
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts +4 -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 +8 -3
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- 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 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/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 +2 -2
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/BlueprintContainer.d.ts +5 -6
- package/dist/types/src/components/BlueprintContainer.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +50 -0
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -0
- package/dist/types/src/components/Chat/events.d.ts +35 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -0
- package/dist/types/src/components/Chat/index.d.ts +3 -0
- package/dist/types/src/components/Chat/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatCompanion.d.ts +13 -0
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +7 -7
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts +8 -0
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -0
- package/dist/types/src/components/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 +11 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -0
- 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 +11 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +10 -0
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +10 -0
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/index.d.ts +6 -0
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +22 -0
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +282 -0
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/index.d.ts +2 -0
- package/dist/types/src/components/ChatThread/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/reducers.d.ts +40 -0
- package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/registry.d.ts +11 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.d.ts +36 -0
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts +2 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts.map +1 -0
- package/dist/types/src/components/PromptSettings.d.ts +2 -2
- package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
- package/dist/types/src/components/SequenceContainer.d.ts +8 -0
- package/dist/types/src/components/SequenceContainer.d.ts.map +1 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +13 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +267 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/SequenceEditor/index.d.ts +2 -0
- package/dist/types/src/components/SequenceEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +4 -8
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +261 -6
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +5 -4
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +259 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts +12 -0
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +19 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts +2 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/index.d.ts +3 -0
- package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +5 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/index.d.ts +2 -0
- package/dist/types/src/components/Toolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +11 -0
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +10 -8
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +262 -4
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +9 -12
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/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 -5
- 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 +12 -13
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +13 -0
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -0
- package/dist/types/src/hooks/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 +6 -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/useOnline.d.ts +3 -0
- package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
- package/dist/types/src/hooks/usePresets.d.ts +7 -0
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts +7 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -0
- package/dist/types/src/processor/index.d.ts +3 -0
- package/dist/types/src/processor/index.d.ts.map +1 -0
- package/dist/types/src/processor/presets.d.ts +13 -0
- package/dist/types/src/processor/presets.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +73 -0
- package/dist/types/src/processor/processor.d.ts.map +1 -0
- package/dist/types/src/processor/processor.test.d.ts.map +1 -0
- package/dist/types/src/queue-logger.d.ts +5 -5
- package/dist/types/src/queue-logger.d.ts.map +1 -1
- package/dist/types/src/stories/Chat.stories.d.ts +31 -0
- package/dist/types/src/stories/Chat.stories.d.ts.map +1 -0
- 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/ChessContainer.d.ts +4 -0
- package/dist/types/src/stories/components/ChessContainer.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/DebugCard.d.ts +8 -0
- package/dist/types/src/stories/components/DebugCard.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/InvocationsContainer.d.ts +4 -0
- package/dist/types/src/stories/components/InvocationsContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/LoggingContainer.d.ts +7 -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/ProjectContainer.d.ts +4 -0
- package/dist/types/src/stories/components/ProjectContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/PromptContainer.d.ts +6 -0
- package/dist/types/src/stories/components/PromptContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/ResearchInputStack.d.ts +4 -0
- package/dist/types/src/stories/components/ResearchInputStack.d.ts.map +1 -0
- package/dist/types/src/stories/components/ResearchOutputStack.d.ts +4 -0
- package/dist/types/src/stories/components/ResearchOutputStack.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/TriggersContainer.d.ts +3 -0
- package/dist/types/src/stories/components/TriggersContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/index.d.ts +17 -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 +9 -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/schema.d.ts +7 -0
- package/dist/types/src/stories/testing/schema.d.ts.map +1 -0
- package/dist/types/src/stories/testing/testing.d.ts +48 -0
- package/dist/types/src/stories/testing/testing.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +3 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-data.d.ts +14 -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-generator.d.ts +7 -0
- package/dist/types/src/testing/test-generator.d.ts.map +1 -0
- package/dist/types/src/testing/test-sequence.d.ts +4 -0
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +84 -113
- 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 -3
- 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 +112 -81
- package/src/AssistantPlugin.tsx +86 -43
- package/src/capabilities/ai-service.ts +26 -0
- package/src/capabilities/app-graph-builder.ts +58 -144
- package/src/capabilities/blueprint-definition.ts +61 -0
- package/src/capabilities/capabilities.ts +9 -6
- package/src/capabilities/edge-model-resolver.ts +25 -0
- package/src/capabilities/index.ts +7 -1
- package/src/capabilities/intent-resolver.ts +67 -18
- package/src/capabilities/local-model-resolver.ts +30 -0
- package/src/capabilities/react-surface.tsx +40 -86
- package/src/capabilities/settings.ts +3 -3
- package/src/capabilities/state.ts +20 -0
- package/src/capabilities/toolkit.ts +163 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +86 -79
- package/src/components/BlueprintContainer.tsx +9 -133
- package/src/components/Chat/Chat.tsx +389 -0
- package/src/components/Chat/events.ts +57 -0
- package/src/components/Chat/index.ts +7 -0
- package/src/components/ChatCompanion.tsx +111 -0
- package/src/components/ChatContainer.tsx +33 -21
- package/src/components/ChatDialog.tsx +68 -0
- package/src/components/ChatProgress/ChatProgress.tsx +68 -0
- package/src/components/{AmbientDialog → ChatProgress}/index.ts +1 -1
- package/src/components/ChatPrompt/ChatActions.tsx +57 -0
- package/src/components/ChatPrompt/ChatOptions.tsx +233 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +29 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +48 -0
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +42 -0
- package/src/components/ChatPrompt/index.ts +9 -0
- package/src/components/ChatThread/ChatThread.stories.tsx +130 -0
- package/src/components/ChatThread/ChatThread.tsx +93 -0
- package/src/components/ChatThread/Link.tsx +26 -0
- package/src/components/ChatThread/index.ts +5 -0
- package/src/components/ChatThread/reducers.ts +151 -0
- package/src/components/ChatThread/registry.tsx +189 -0
- package/src/components/ChatThread/sync.test.ts +81 -0
- package/src/components/ChatThread/sync.ts +113 -0
- package/src/components/PromptSettings.tsx +44 -45
- package/src/components/SequenceContainer.tsx +131 -0
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +33 -0
- package/src/components/{BlueprintEditor/BlueprintEditor.tsx → SequenceEditor/SequenceEditor.tsx} +8 -8
- package/src/components/SequenceEditor/index.ts +5 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +45 -37
- package/src/components/TemplateEditor/TemplateEditor.tsx +30 -48
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +26 -19
- package/src/components/TemplateEditor/TemplateForm.tsx +52 -57
- package/src/components/TemplateEditor/handlebars-extension.ts +165 -0
- package/src/components/ToolBlock/ToolBlock.tsx +152 -0
- package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
- package/src/components/ToolBlock/index.ts +6 -0
- package/src/components/Toolbar/Toolbar.tsx +21 -0
- package/src/{experimental/transcription → components/Toolbar}/index.ts +2 -0
- package/src/components/Toolbar/useChatToolbarActions.ts +126 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +12 -19
- package/src/components/Toolbox/Toolbox.tsx +53 -27
- package/src/components/index.ts +6 -8
- package/src/events.ts +3 -3
- 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 +42 -0
- package/src/hooks/index.ts +10 -6
- package/src/hooks/useBlueprintRegistry.ts +80 -0
- package/src/hooks/useChatProcessor.ts +66 -0
- package/src/hooks/useChatServices.ts +48 -0
- 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/useOnline.ts +10 -0
- package/src/hooks/usePresets.ts +44 -0
- package/src/hooks/{useContextProvider.ts → useReferencesProvider.ts} +22 -20
- package/src/meta.ts +1 -1
- package/src/processor/index.ts +6 -0
- package/src/processor/presets.ts +60 -0
- package/src/processor/processor.test.ts +77 -0
- package/src/processor/processor.ts +302 -0
- package/src/queue-logger.ts +16 -16
- package/src/stories/Chat.stories.tsx +804 -0
- package/src/stories/components/BlueprintContainer.tsx +34 -0
- package/src/stories/components/ChatContainer.tsx +74 -0
- package/src/stories/components/ChessContainer.tsx +17 -0
- package/src/stories/components/CommentsContainer.tsx +25 -0
- package/src/stories/components/DebugCard.tsx +61 -0
- package/src/stories/components/GraphContainer.tsx +119 -0
- package/src/stories/components/InvocationsContainer.tsx +17 -0
- package/src/stories/components/LoggingContainer.tsx +33 -0
- package/src/stories/components/MessageContainer.tsx +22 -0
- package/src/stories/components/ProjectContainer.tsx +17 -0
- package/src/stories/components/PromptContainer.tsx +52 -0
- package/src/stories/components/ResearchInputStack.tsx +30 -0
- package/src/stories/components/ResearchOutputStack.tsx +29 -0
- package/src/stories/components/TasksContainer.tsx +49 -0
- package/src/stories/components/TokenManagerContainer.tsx +14 -0
- package/src/stories/components/TriggersContainer.tsx +12 -0
- package/src/stories/components/index.ts +21 -0
- package/src/stories/components/types.ts +11 -0
- package/src/stories/{test-data.ts → testing/data.ts} +23 -9
- package/src/stories/testing/index.ts +6 -0
- package/src/stories/testing/schema.ts +17 -0
- package/src/stories/testing/testing.tsx +284 -0
- package/src/testing/index.ts +3 -1
- package/src/testing/test-data.ts +255 -0
- package/src/testing/test-functions.ts +9 -4
- package/src/testing/test-generator.ts +257 -0
- package/src/testing/test-sequence.ts +26 -0
- package/src/translations.ts +58 -28
- 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 -3
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/AssistantDialog-MQOOR364.mjs +0 -47
- package/dist/lib/browser/AssistantDialog-MQOOR364.mjs.map +0 -7
- package/dist/lib/browser/BlueprintContainer-AT5Y7EXG.mjs +0 -321
- package/dist/lib/browser/BlueprintContainer-AT5Y7EXG.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-C2NEAS3A.mjs +0 -40
- package/dist/lib/browser/ChatContainer-C2NEAS3A.mjs.map +0 -7
- package/dist/lib/browser/TemplateContainer-QQHVOTSI.mjs.map +0 -7
- package/dist/lib/browser/ai-client-MK2ZZII2.mjs +0 -39
- package/dist/lib/browser/ai-client-MK2ZZII2.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-E4H5DCOJ.mjs +0 -225
- package/dist/lib/browser/app-graph-builder-E4H5DCOJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-AAOKC2JN.mjs +0 -208
- package/dist/lib/browser/chunk-AAOKC2JN.mjs.map +0 -7
- package/dist/lib/browser/chunk-BI6AHRNJ.mjs +0 -157
- package/dist/lib/browser/chunk-BI6AHRNJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-JO4W3MF7.mjs +0 -2101
- package/dist/lib/browser/chunk-JO4W3MF7.mjs.map +0 -7
- package/dist/lib/browser/chunk-JQFUME3B.mjs +0 -87
- package/dist/lib/browser/chunk-JQFUME3B.mjs.map +0 -7
- package/dist/lib/browser/chunk-MEGMOFJB.mjs +0 -16
- package/dist/lib/browser/chunk-MEGMOFJB.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q6UZ4F3H.mjs +0 -96
- package/dist/lib/browser/chunk-Q6UZ4F3H.mjs.map +0 -7
- package/dist/lib/browser/chunk-UE3IZ4PN.mjs +0 -15
- package/dist/lib/browser/chunk-UE3IZ4PN.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-3UICTGPM.mjs +0 -43
- package/dist/lib/browser/intent-resolver-3UICTGPM.mjs.map +0 -7
- package/dist/lib/browser/react-surface-LXCNUSZN.mjs +0 -159
- package/dist/lib/browser/react-surface-LXCNUSZN.mjs.map +0 -7
- package/dist/lib/browser/settings-XRHXVWGB.mjs.map +0 -7
- package/dist/lib/node/AssistantDialog-AN4Z6YUV.cjs +0 -73
- package/dist/lib/node/AssistantDialog-AN4Z6YUV.cjs.map +0 -7
- package/dist/lib/node/BlueprintContainer-NOWLDYCZ.cjs +0 -344
- package/dist/lib/node/BlueprintContainer-NOWLDYCZ.cjs.map +0 -7
- package/dist/lib/node/ChatContainer-VKYBQHUB.cjs +0 -68
- package/dist/lib/node/ChatContainer-VKYBQHUB.cjs.map +0 -7
- package/dist/lib/node/TemplateContainer-JZF2DCCG.cjs +0 -58
- package/dist/lib/node/TemplateContainer-JZF2DCCG.cjs.map +0 -7
- package/dist/lib/node/ai-client-7HNSMUMT.cjs +0 -53
- package/dist/lib/node/ai-client-7HNSMUMT.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-PPR5B5KU.cjs +0 -235
- package/dist/lib/node/app-graph-builder-PPR5B5KU.cjs.map +0 -7
- package/dist/lib/node/chunk-4EEWTDQK.cjs +0 -117
- package/dist/lib/node/chunk-4EEWTDQK.cjs.map +0 -7
- package/dist/lib/node/chunk-FUAGEO7Q.cjs +0 -52
- package/dist/lib/node/chunk-FUAGEO7Q.cjs.map +0 -7
- package/dist/lib/node/chunk-HRNIUYVQ.cjs +0 -128
- package/dist/lib/node/chunk-HRNIUYVQ.cjs.map +0 -7
- package/dist/lib/node/chunk-IKZBMHSW.cjs +0 -184
- package/dist/lib/node/chunk-IKZBMHSW.cjs.map +0 -7
- package/dist/lib/node/chunk-LMDJEGZ2.cjs +0 -233
- package/dist/lib/node/chunk-LMDJEGZ2.cjs.map +0 -7
- package/dist/lib/node/chunk-NIDICM57.cjs +0 -2080
- package/dist/lib/node/chunk-NIDICM57.cjs.map +0 -7
- package/dist/lib/node/chunk-P74TWGMG.cjs +0 -44
- package/dist/lib/node/chunk-P74TWGMG.cjs.map +0 -7
- package/dist/lib/node/chunk-QGPWY6GW.cjs +0 -34
- package/dist/lib/node/chunk-QGPWY6GW.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -289
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-QSWGTKON.cjs +0 -58
- package/dist/lib/node/intent-resolver-QSWGTKON.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/react-surface-D3NBYRZ6.cjs +0 -172
- package/dist/lib/node/react-surface-D3NBYRZ6.cjs.map +0 -7
- package/dist/lib/node/settings-2JXLKYGE.cjs +0 -36
- package/dist/lib/node/settings-2JXLKYGE.cjs.map +0 -7
- package/dist/lib/node/types/index.cjs +0 -54
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/AssistantDialog-6WEMLUPU.mjs +0 -48
- package/dist/lib/node-esm/AssistantDialog-6WEMLUPU.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-STOJAVML.mjs +0 -322
- package/dist/lib/node-esm/BlueprintContainer-STOJAVML.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-3MVBTUJN.mjs +0 -41
- package/dist/lib/node-esm/ChatContainer-3MVBTUJN.mjs.map +0 -7
- package/dist/lib/node-esm/TemplateContainer-SOEWY2ZN.mjs.map +0 -7
- package/dist/lib/node-esm/ai-client-XGZBJ6BE.mjs +0 -40
- package/dist/lib/node-esm/ai-client-XGZBJ6BE.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-3SY5MBIK.mjs +0 -226
- package/dist/lib/node-esm/app-graph-builder-3SY5MBIK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-34EX6E5Q.mjs +0 -18
- package/dist/lib/node-esm/chunk-34EX6E5Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3UEZLJ2V.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CDAILLCU.mjs +0 -98
- package/dist/lib/node-esm/chunk-CDAILLCU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-J6UXXZGJ.mjs +0 -209
- package/dist/lib/node-esm/chunk-J6UXXZGJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OD574YIU.mjs +0 -2102
- package/dist/lib/node-esm/chunk-OD574YIU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OYN6HLXZ.mjs +0 -88
- package/dist/lib/node-esm/chunk-OYN6HLXZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UCOFKNKN.mjs +0 -158
- package/dist/lib/node-esm/chunk-UCOFKNKN.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-E6MXTYAU.mjs +0 -44
- package/dist/lib/node-esm/intent-resolver-E6MXTYAU.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-7HA5EDWY.mjs +0 -160
- package/dist/lib/node-esm/react-surface-7HA5EDWY.mjs.map +0 -7
- package/dist/lib/node-esm/settings-5IAY6BT4.mjs.map +0 -7
- package/dist/types/src/capabilities/ai-client.d.ts +0 -5
- package/dist/types/src/capabilities/ai-client.d.ts.map +0 -1
- package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts +0 -10
- package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts.map +0 -1
- package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts +0 -8
- package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/AmbientDialog/index.d.ts +0 -2
- package/dist/types/src/components/AmbientDialog/index.d.ts.map +0 -1
- package/dist/types/src/components/AssistantDialog.d.ts +0 -7
- package/dist/types/src/components/AssistantDialog.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts +0 -13
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.stories.d.ts +0 -8
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintEditor/index.d.ts +0 -2
- package/dist/types/src/components/BlueprintEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/Prompt.d.ts +0 -23
- package/dist/types/src/components/Prompt/Prompt.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts +0 -13
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/PromptBar.d.ts +0 -16
- package/dist/types/src/components/Prompt/PromptBar.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/PromptBar.stories.d.ts +0 -9
- package/dist/types/src/components/Prompt/PromptBar.stories.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/autocomplete.d.ts +0 -25
- package/dist/types/src/components/Prompt/autocomplete.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/index.d.ts +0 -3
- package/dist/types/src/components/Prompt/index.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/references.d.ts +0 -30
- package/dist/types/src/components/Prompt/references.d.ts.map +0 -1
- package/dist/types/src/components/TemplateContainer.d.ts +0 -8
- package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
- package/dist/types/src/components/Thread/Thread.d.ts +0 -28
- package/dist/types/src/components/Thread/Thread.d.ts.map +0 -1
- package/dist/types/src/components/Thread/Thread.stories.d.ts +0 -11
- package/dist/types/src/components/Thread/Thread.stories.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ThreadContainer.d.ts +0 -13
- package/dist/types/src/components/Thread/ThreadContainer.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts +0 -16
- package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ThreadMessage.d.ts +0 -16
- package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ToolInvocations.d.ts +0 -13
- package/dist/types/src/components/Thread/ToolInvocations.d.ts.map +0 -1
- package/dist/types/src/components/Thread/index.d.ts +0 -3
- package/dist/types/src/components/Thread/index.d.ts.map +0 -1
- package/dist/types/src/components/Thread/reducer.d.ts +0 -12
- package/dist/types/src/components/Thread/reducer.d.ts.map +0 -1
- package/dist/types/src/experimental/transcription/index.d.ts +0 -1
- package/dist/types/src/experimental/transcription/index.d.ts.map +0 -1
- package/dist/types/src/hooks/processor.d.ts +0 -72
- package/dist/types/src/hooks/processor.d.ts.map +0 -1
- package/dist/types/src/hooks/processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/useContextProvider.d.ts +0 -17
- package/dist/types/src/hooks/useContextProvider.d.ts.map +0 -1
- package/dist/types/src/hooks/useMessageQueue.d.ts +0 -42
- package/dist/types/src/hooks/useMessageQueue.d.ts.map +0 -1
- package/dist/types/src/hooks/useServices.d.ts +0 -7
- package/dist/types/src/hooks/useServices.d.ts.map +0 -1
- package/dist/types/src/hooks/useTextInputEvents.d.ts +0 -13
- package/dist/types/src/hooks/useTextInputEvents.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.d.ts +0 -4
- package/dist/types/src/parser/filter-generator.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.test.d.ts +0 -2
- package/dist/types/src/parser/filter-generator.test.d.ts.map +0 -1
- package/dist/types/src/parser/index.d.ts +0 -4
- package/dist/types/src/parser/index.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.d.ts +0 -15
- package/dist/types/src/parser/query-parser.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.test.d.ts +0 -2
- package/dist/types/src/parser/query-parser.test.d.ts.map +0 -1
- package/dist/types/src/parser/types.d.ts +0 -24
- package/dist/types/src/parser/types.d.ts.map +0 -1
- package/dist/types/src/stories/Prompt.stories.d.ts +0 -8
- package/dist/types/src/stories/Prompt.stories.d.ts.map +0 -1
- package/dist/types/src/stories/Query.stories.d.ts +0 -19
- package/dist/types/src/stories/Query.stories.d.ts.map +0 -1
- package/dist/types/src/stories/Research.stories.d.ts +0 -15
- package/dist/types/src/stories/Research.stories.d.ts.map +0 -1
- package/dist/types/src/stories/test-data.d.ts +0 -3
- package/dist/types/src/stories/test-data.d.ts.map +0 -1
- package/dist/types/src/stories/testing.d.ts +0 -12
- package/dist/types/src/stories/testing.d.ts.map +0 -1
- package/dist/types/src/testing/test-blueprint.d.ts +0 -8
- package/dist/types/src/testing/test-blueprint.d.ts.map +0 -1
- package/dist/types/src/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/chat.d.ts +0 -23
- package/dist/types/src/types/chat.d.ts.map +0 -1
- package/dist/types/src/types/template.d.ts +0 -56
- package/dist/types/src/types/template.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -50
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/capabilities/ai-client.ts +0 -42
- package/src/components/AmbientDialog/AmbientDialog.stories.tsx +0 -84
- package/src/components/AmbientDialog/AmbientDialog.tsx +0 -117
- package/src/components/AssistantDialog.tsx +0 -37
- package/src/components/BlueprintEditor/BlueprintEditor.stories.tsx +0 -32
- package/src/components/BlueprintEditor/index.ts +0 -5
- package/src/components/Prompt/Prompt.stories.tsx +0 -121
- package/src/components/Prompt/Prompt.tsx +0 -124
- package/src/components/Prompt/PromptBar.stories.tsx +0 -69
- package/src/components/Prompt/PromptBar.tsx +0 -105
- package/src/components/Prompt/autocomplete.ts +0 -218
- package/src/components/Prompt/index.ts +0 -6
- package/src/components/Prompt/references.ts +0 -180
- package/src/components/TemplateContainer.tsx +0 -23
- package/src/components/Thread/Thread.stories.tsx +0 -201
- package/src/components/Thread/Thread.tsx +0 -118
- package/src/components/Thread/ThreadContainer.stories.tsx +0 -283
- package/src/components/Thread/ThreadContainer.tsx +0 -105
- package/src/components/Thread/ThreadMessage.tsx +0 -234
- package/src/components/Thread/ToolInvocations.tsx +0 -106
- package/src/components/Thread/index.ts +0 -6
- package/src/components/Thread/reducer.ts +0 -52
- package/src/hooks/processor.test.ts +0 -15
- package/src/hooks/processor.ts +0 -238
- package/src/hooks/useChatProcessor.tsx +0 -97
- package/src/hooks/useMessageQueue.ts +0 -22
- package/src/hooks/useServices.ts +0 -28
- package/src/hooks/useTextInputEvents.ts +0 -49
- package/src/parser/filter-generator.test.ts +0 -32
- package/src/parser/filter-generator.ts +0 -81
- package/src/parser/index.ts +0 -7
- package/src/parser/query-parser.test.ts +0 -139
- package/src/parser/query-parser.ts +0 -199
- package/src/parser/types.ts +0 -34
- package/src/shims.d.ts +0 -8
- package/src/stories/Prompt.stories.tsx +0 -60
- package/src/stories/Query.stories.tsx +0 -514
- package/src/stories/Research.stories.tsx +0 -482
- package/src/stories/testing.ts +0 -60
- package/src/testing/test-blueprint.ts +0 -58
- package/src/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/chat.ts +0 -32
- package/src/types/template.ts +0 -66
- package/src/types/types.ts +0 -48
- package/src/typings.d.ts +0 -9
- /package/dist/types/src/{hooks → processor}/processor.test.d.ts +0 -0
|
@@ -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,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,29 +6,29 @@ 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
|
+
import { type ReferencesProvider } from '@dxos/react-ui-chat';
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const stringMatch = (query: string, label: string) => label.toLowerCase().startsWith(query.toLowerCase());
|
|
17
|
-
|
|
18
|
-
export const useContextProvider = (space?: Space): ContextProvider | undefined => {
|
|
19
|
-
const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
|
|
12
|
+
/**
|
|
13
|
+
* Resolve references to objects in the space.
|
|
14
|
+
*/
|
|
15
|
+
export const useReferencesProvider = (space?: Space): ReferencesProvider | undefined => {
|
|
16
|
+
const blueprints = useCapabilities(Capabilities.BlueprintDefinition);
|
|
20
17
|
|
|
21
|
-
return useMemo<
|
|
18
|
+
return useMemo<ReferencesProvider | undefined>((): ReferencesProvider | undefined => {
|
|
22
19
|
if (!space) {
|
|
23
20
|
return undefined;
|
|
24
21
|
}
|
|
25
22
|
|
|
26
23
|
return {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
getReferences: async ({ query }) => {
|
|
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();
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
34
|
objects
|
|
@@ -41,15 +41,17 @@ export const useContextProvider = (space?: Space): ContextProvider | undefined =
|
|
|
41
41
|
// TODO(dmaretskyi): `Type.getDXN` (at the point of writing) didn't work here as it was schema-only.
|
|
42
42
|
.filter((object) => !!Obj.getDXN(object as Obj.Any))
|
|
43
43
|
.map((object) => ({
|
|
44
|
-
uri: Obj.getDXN(object as any)
|
|
44
|
+
uri: Obj.getDXN(object as any).toString(),
|
|
45
45
|
label: Obj.getLabel(object as any) ?? '',
|
|
46
46
|
}))
|
|
47
47
|
);
|
|
48
48
|
},
|
|
49
|
-
|
|
49
|
+
resolveReference: async ({ uri }) => {
|
|
50
50
|
const object = await space.db.query(Filter.ids(uri)).first();
|
|
51
51
|
return { uri, label: Obj.getLabel(object) ?? '' };
|
|
52
52
|
},
|
|
53
|
-
};
|
|
54
|
-
}, [space,
|
|
53
|
+
} satisfies ReferencesProvider;
|
|
54
|
+
}, [space, blueprints]);
|
|
55
55
|
};
|
|
56
|
+
|
|
57
|
+
const stringMatch = (query: string, label: string) => label.toLowerCase().startsWith(query.toLowerCase());
|
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'],
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Schema } from 'effect';
|
|
6
|
+
|
|
7
|
+
import { type ModelName } from '@dxos/ai';
|
|
8
|
+
|
|
9
|
+
const ModelProviders = ['dxos-local', 'dxos-remote', 'lm-studio'] as const;
|
|
10
|
+
|
|
11
|
+
const ModelProvider = Schema.Literal(...ModelProviders);
|
|
12
|
+
type ModelProvider = Schema.Schema.Type<typeof ModelProvider>;
|
|
13
|
+
|
|
14
|
+
export type AiServicePreset = {
|
|
15
|
+
id: string;
|
|
16
|
+
provider: ModelProvider;
|
|
17
|
+
model: ModelName;
|
|
18
|
+
label?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const createModelLabel = (model: ModelName) => {
|
|
22
|
+
const parts = model.split('/');
|
|
23
|
+
return parts[parts.length - 1];
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// TODO(burdon): Users should be able to create and edit presets.
|
|
27
|
+
export const AiServicePresets: AiServicePreset[] = [
|
|
28
|
+
{
|
|
29
|
+
provider: 'dxos-remote' as const,
|
|
30
|
+
model: '@anthropic/claude-opus-4-0' as const,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
provider: 'dxos-remote' as const,
|
|
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,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
provider: 'lm-studio' as const,
|
|
42
|
+
model: '@google/gemma-3-27b' as const,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
provider: 'lm-studio' as const,
|
|
46
|
+
model: '@mlx-community/llama-3.2-3b-instruct' as const,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
model: 'deepseek-r1:latest' as const,
|
|
50
|
+
provider: 'dxos-local' as const,
|
|
51
|
+
},
|
|
52
|
+
].map(
|
|
53
|
+
({ model, provider }, i) =>
|
|
54
|
+
({
|
|
55
|
+
id: `preset-${i}`,
|
|
56
|
+
provider,
|
|
57
|
+
model,
|
|
58
|
+
label: createModelLabel(model),
|
|
59
|
+
}) satisfies AiServicePreset,
|
|
60
|
+
);
|
|
@@ -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 = yield* Effect.runtime<AiChatServices>();
|
|
65
|
+
const queue = yield* QueueService.createQueue<DataType.Message>();
|
|
66
|
+
const conversation = new AiConversation({ queue });
|
|
67
|
+
const processor = new AiChatProcessor(conversation, async () => services);
|
|
68
|
+
const result = yield* Effect.promise(() => processor.request({ message: 'Hello' }));
|
|
69
|
+
void processor.cancel();
|
|
70
|
+
expect(processor.active).to.be.false;
|
|
71
|
+
expect(result).to.exist;
|
|
72
|
+
},
|
|
73
|
+
Effect.provide(TestLayer),
|
|
74
|
+
TestHelpers.taggedTest('llm'),
|
|
75
|
+
),
|
|
76
|
+
);
|
|
77
|
+
});
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Registry, Rx } from '@effect-rx/rx-react';
|
|
6
|
+
import { Cause, Effect, Exit, Fiber, Option, Runtime } 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
|
+
/** Pending messages (incl. the current user request). */
|
|
87
|
+
private readonly _pending = Rx.make<DataType.Message[]>([]);
|
|
88
|
+
|
|
89
|
+
/** Currently streaming message (from the AI service). */
|
|
90
|
+
private readonly _streaming = Rx.make<Option.Option<DataType.Message>>(Option.none());
|
|
91
|
+
|
|
92
|
+
/** Streaming state. */
|
|
93
|
+
public readonly streaming = Rx.make<boolean>((get) => Option.isSome(get(this._streaming)));
|
|
94
|
+
|
|
95
|
+
/** Active state. */
|
|
96
|
+
public readonly active = Rx.make(false);
|
|
97
|
+
|
|
98
|
+
/** Array of Messages (incl. the current message being streamed). */
|
|
99
|
+
public readonly messages = Rx.make<DataType.Message[]>((get) =>
|
|
100
|
+
Option.match(get(this._streaming), {
|
|
101
|
+
onNone: () => get(this._pending),
|
|
102
|
+
onSome: (streaming) => [...get(this._pending), streaming],
|
|
103
|
+
}),
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
/** Last error. */
|
|
107
|
+
public readonly error = Rx.make<Option.Option<Error>>(Option.none());
|
|
108
|
+
|
|
109
|
+
constructor(
|
|
110
|
+
private readonly _conversation: AiConversation,
|
|
111
|
+
// TODO(dmaretskyi): Replace this with effect's ManagedRuntime wrapping this layer.
|
|
112
|
+
private readonly _services: () => Promise<Runtime.Runtime<AiChatServices>>,
|
|
113
|
+
private readonly _options: AiChatProcessorOptions = defaultOptions,
|
|
114
|
+
) {
|
|
115
|
+
// Initialize registries and defaults before using in other logic.
|
|
116
|
+
this._rx = this._options.observableRegistry ?? Registry.make();
|
|
117
|
+
this._observer = GenerationObserver.make({
|
|
118
|
+
onBlock: this._onBlock,
|
|
119
|
+
onMessage: this._onMessage,
|
|
120
|
+
});
|
|
121
|
+
if (this._options.model && !this._options.system) {
|
|
122
|
+
const capabilities = this._options.modelRegistry?.getCapabilities(this._options.model) ?? {};
|
|
123
|
+
this._options.system = createSystemPrompt(capabilities);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
get context() {
|
|
128
|
+
return this._conversation.context;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
get conversation() {
|
|
132
|
+
return this._conversation;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
get blueprintRegistry() {
|
|
136
|
+
return this._options.blueprintRegistry;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Initiates a new request.
|
|
141
|
+
*/
|
|
142
|
+
async request(requestParam: AiRequest): Promise<void> {
|
|
143
|
+
if (this._fiber) {
|
|
144
|
+
await this.cancel();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
try {
|
|
148
|
+
this._lastRequest = requestParam;
|
|
149
|
+
this._rx.set(this.error, Option.none());
|
|
150
|
+
this._rx.set(this.active, true);
|
|
151
|
+
|
|
152
|
+
// Create request.
|
|
153
|
+
const request = this._conversation.createRequest({
|
|
154
|
+
system: this._options.system,
|
|
155
|
+
prompt: requestParam.message,
|
|
156
|
+
observer: this._observer,
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
const runtime = await this._services();
|
|
160
|
+
|
|
161
|
+
// Create fiber.
|
|
162
|
+
this._fiber = request.pipe(
|
|
163
|
+
Effect.provide(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL)),
|
|
164
|
+
|
|
165
|
+
// TODO(dmaretskyi): Move ArtifactDiffResolver upstream.
|
|
166
|
+
Effect.provideService(ArtifactDiffResolver, this._artifactDiffResolver),
|
|
167
|
+
|
|
168
|
+
Effect.asVoid,
|
|
169
|
+
Effect.tapErrorCause((cause) => {
|
|
170
|
+
log.error('request failed', { cause });
|
|
171
|
+
return Effect.void;
|
|
172
|
+
}),
|
|
173
|
+
Runtime.runFork(runtime), // Runs in the background.
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
// Execute request.
|
|
177
|
+
const response = await this._fiber.pipe(Fiber.join, Effect.runPromiseExit);
|
|
178
|
+
if (!Exit.isSuccess(response) && !Cause.isInterruptedOnly(response.cause)) {
|
|
179
|
+
throwCause(response.cause);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
this._rx.set(this.error, Option.none());
|
|
183
|
+
this._lastRequest = undefined;
|
|
184
|
+
this._fiber = undefined;
|
|
185
|
+
} catch (err) {
|
|
186
|
+
log.error('request failed', { err });
|
|
187
|
+
this._rx.set(this.error, Option.some(new Error('AI service error', { cause: err })));
|
|
188
|
+
} finally {
|
|
189
|
+
this._fiber = undefined;
|
|
190
|
+
this._rx.set(this.active, false);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Cancels the current request.
|
|
196
|
+
*/
|
|
197
|
+
async cancel(): Promise<void> {
|
|
198
|
+
await Effect.runPromise(
|
|
199
|
+
Effect.gen(this, function* () {
|
|
200
|
+
if (this._fiber) {
|
|
201
|
+
yield* this._fiber.pipe(Fiber.interrupt);
|
|
202
|
+
}
|
|
203
|
+
}),
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
this._fiber = undefined;
|
|
207
|
+
this._rx.set(this.active, false);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Retry last failed request.
|
|
212
|
+
*/
|
|
213
|
+
async retry(): Promise<void> {
|
|
214
|
+
if (this._lastRequest) {
|
|
215
|
+
return this.request(this._lastRequest);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Update the current chat's name.
|
|
221
|
+
*/
|
|
222
|
+
async updateName(chat: Assistant.Chat): Promise<void> {
|
|
223
|
+
const runtime = await this._services();
|
|
224
|
+
|
|
225
|
+
const system = trim`
|
|
226
|
+
It is extremely important that you respond only with the title and nothing else.
|
|
227
|
+
If you cannot do this effectively respond with "New Chat".
|
|
228
|
+
`;
|
|
229
|
+
|
|
230
|
+
const history = await this._conversation.getHistory();
|
|
231
|
+
const fiber = Effect.gen(this, function* () {
|
|
232
|
+
const session = new AiSession();
|
|
233
|
+
return yield* session.run({ system, prompt: 'Suggest a name for this chat', history });
|
|
234
|
+
}).pipe(
|
|
235
|
+
// TODO(burdon): Use simpler model.
|
|
236
|
+
Effect.provide(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL)),
|
|
237
|
+
Effect.tap((messages) => {
|
|
238
|
+
const message = messages.find((message) => message.sender.role === 'assistant');
|
|
239
|
+
const title = message?.blocks.find((b) => b._tag === 'text')?.text;
|
|
240
|
+
if (title) {
|
|
241
|
+
chat.name = title;
|
|
242
|
+
}
|
|
243
|
+
}),
|
|
244
|
+
Runtime.runFork(runtime), // Run in the background.
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
const response = await fiber.pipe(Fiber.join, Effect.runPromiseExit);
|
|
248
|
+
if (!Exit.isSuccess(response)) {
|
|
249
|
+
throwCause(response.cause);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// TODO(burdon): Fix/factor out.
|
|
254
|
+
private _artifactDiffResolver: ArtifactDiffResolver.Service = {
|
|
255
|
+
resolve: async (_artifacts) => {
|
|
256
|
+
const versions = new Map();
|
|
257
|
+
// await Promise.all(
|
|
258
|
+
// artifacts.map(async (artifact) => {
|
|
259
|
+
// const {
|
|
260
|
+
// objects: [object],
|
|
261
|
+
// } = await space.db.query(Filter.ids(artifact.id)).run();
|
|
262
|
+
// if (!object) {
|
|
263
|
+
// return;
|
|
264
|
+
// }
|
|
265
|
+
|
|
266
|
+
// versions.set(artifact.id, {
|
|
267
|
+
// version: getVersion(object),
|
|
268
|
+
// diff: `Current state: ${JSON.stringify(object)}`,
|
|
269
|
+
// });
|
|
270
|
+
// }),
|
|
271
|
+
// );
|
|
272
|
+
|
|
273
|
+
return versions;
|
|
274
|
+
},
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
private _onMessage = Effect.fn(
|
|
278
|
+
function* (this: AiChatProcessor, message: DataType.Message) {
|
|
279
|
+
this._rx.set(this._streaming, Option.none());
|
|
280
|
+
this._rx.update(this._pending, (pending) => [...pending, message]);
|
|
281
|
+
}.bind(this),
|
|
282
|
+
);
|
|
283
|
+
|
|
284
|
+
private _onBlock = Effect.fn(
|
|
285
|
+
function* (this: AiChatProcessor, block: ContentBlock.Any) {
|
|
286
|
+
this._rx.update(this._streaming, (streaming) => {
|
|
287
|
+
const blocks = streaming.pipe(
|
|
288
|
+
Option.map((streaming) => streaming.blocks.filter((b) => !b.pending)),
|
|
289
|
+
Option.getOrElse(() => []),
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
return Option.some(
|
|
293
|
+
Obj.make(DataType.Message, {
|
|
294
|
+
created: new Date().toISOString(),
|
|
295
|
+
sender: { role: 'assistant' },
|
|
296
|
+
blocks: [...blocks, block],
|
|
297
|
+
}),
|
|
298
|
+
);
|
|
299
|
+
});
|
|
300
|
+
}.bind(this),
|
|
301
|
+
);
|
|
302
|
+
}
|