@dxos/plugin-assistant 0.8.4-main.f9ba587 → 0.8.4-main.fcfe5033a5
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/AssistantSettings-7QMO3LGF.mjs +97 -0
- package/dist/lib/browser/AssistantSettings-7QMO3LGF.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/blueprints/index.mjs.map +7 -0
- package/dist/lib/browser/chunk-ATHYBVGN.mjs +176 -0
- package/dist/lib/browser/chunk-ATHYBVGN.mjs.map +7 -0
- package/dist/lib/browser/chunk-EZRS3J25.mjs +30 -0
- package/dist/lib/browser/chunk-EZRS3J25.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-LMVTXH54.mjs +154 -0
- package/dist/lib/browser/chunk-LMVTXH54.mjs.map +7 -0
- package/dist/lib/browser/create-chat-LBZHGVSN.mjs +82 -0
- package/dist/lib/browser/create-chat-LBZHGVSN.mjs.map +7 -0
- package/dist/lib/browser/ensure-companion-chat-ZEZA34MZ.mjs +65 -0
- package/dist/lib/browser/ensure-companion-chat-ZEZA34MZ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3410 -223
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/on-create-space-54RNX5JI.mjs +22 -0
- package/dist/lib/browser/on-create-space-54RNX5JI.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +13 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/resolve-navigation-targets-NZOD66NY.mjs +22 -0
- package/dist/lib/browser/resolve-navigation-targets-NZOD66NY.mjs.map +7 -0
- package/dist/lib/browser/run-prompt-in-new-chat-THLK5YQC.mjs +136 -0
- package/dist/lib/browser/run-prompt-in-new-chat-THLK5YQC.mjs.map +7 -0
- package/dist/lib/browser/set-current-chat-LRS3VFSH.mjs +54 -0
- package/dist/lib/browser/set-current-chat-LRS3VFSH.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +8 -14
- package/dist/lib/browser/update-chat-name-3Y36KFAS.mjs +71 -0
- package/dist/lib/browser/update-chat-name-3Y36KFAS.mjs.map +7 -0
- package/dist/lib/node-esm/AssistantSettings-UVUTKO7E.mjs +98 -0
- package/dist/lib/node-esm/AssistantSettings-UVUTKO7E.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +9 -0
- package/dist/lib/node-esm/blueprints/index.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-NZIKC7AN.mjs +32 -0
- package/dist/lib/node-esm/chunk-NZIKC7AN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-PXAJSTGZ.mjs +177 -0
- package/dist/lib/node-esm/chunk-PXAJSTGZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-W3JZ2F4T.mjs +155 -0
- package/dist/lib/node-esm/chunk-W3JZ2F4T.mjs.map +7 -0
- package/dist/lib/node-esm/create-chat-3BEG4R6J.mjs +83 -0
- package/dist/lib/node-esm/create-chat-3BEG4R6J.mjs.map +7 -0
- package/dist/lib/node-esm/ensure-companion-chat-6K2WEWFP.mjs +66 -0
- package/dist/lib/node-esm/ensure-companion-chat-6K2WEWFP.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +3410 -223
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/on-create-space-YRPZ6HZY.mjs +23 -0
- package/dist/lib/node-esm/on-create-space-YRPZ6HZY.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +14 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/resolve-navigation-targets-3PPK7XLH.mjs +23 -0
- package/dist/lib/node-esm/resolve-navigation-targets-3PPK7XLH.mjs.map +7 -0
- package/dist/lib/node-esm/run-prompt-in-new-chat-OUYKCMQ7.mjs +137 -0
- package/dist/lib/node-esm/run-prompt-in-new-chat-OUYKCMQ7.mjs.map +7 -0
- package/dist/lib/node-esm/set-current-chat-SMXZJD3F.mjs +55 -0
- package/dist/lib/node-esm/set-current-chat-SMXZJD3F.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +8 -14
- package/dist/lib/node-esm/update-chat-name-HM2P4NSI.mjs +72 -0
- package/dist/lib/node-esm/update-chat-name-HM2P4NSI.mjs.map +7 -0
- package/dist/types/src/AssistantPlugin.d.ts +2 -1
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/assistant/blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/assistant/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/blueprint.test.d.ts +2 -0
- package/dist/types/src/blueprints/assistant/blueprint.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/index.d.ts +2 -0
- package/dist/types/src/blueprints/assistant/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/ai-service.d.ts +6 -0
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts +9 -0
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +7 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +29 -6
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +16 -0
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/markdown.d.ts +5 -0
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
- package/dist/types/src/capabilities/migrations.d.ts +5 -0
- package/dist/types/src/capabilities/migrations.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +4 -2
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +21 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit.d.ts +6 -0
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +4 -4
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.stories.d.ts +15 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/index.d.ts +1 -1
- package/dist/types/src/components/AssistantSettings/index.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +41 -19
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +39 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -0
- package/dist/types/src/components/Chat/index.d.ts +1 -0
- package/dist/types/src/components/Chat/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +10 -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 +7 -5
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +22 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts +19 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.stories.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 +5 -6
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +7 -4
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +2 -2
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +13 -17
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +24 -221
- 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/MarkdownStream.stories.d.ts +35 -0
- package/dist/types/src/components/ChatThread/MarkdownStream.stories.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 +43 -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/ChatThread/tool-widget-state.d.ts +18 -0
- package/dist/types/src/components/ChatThread/tool-widget-state.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/tool-widget-state.test.d.ts +2 -0
- package/dist/types/src/components/ChatThread/tool-widget-state.test.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/FallbackWidget.d.ts +8 -0
- package/dist/types/src/components/ChatThread/widgets/FallbackWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/PromptWidget.d.ts +14 -0
- package/dist/types/src/components/ChatThread/widgets/PromptWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.d.ts +25 -0
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.stories.d.ts +18 -0
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/ReferenceWidget.d.ts +9 -0
- package/dist/types/src/components/ChatThread/widgets/ReferenceWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/SelectWidget.d.ts +14 -0
- package/dist/types/src/components/ChatThread/widgets/SelectWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/StatsWidget.d.ts +12 -0
- package/dist/types/src/components/ChatThread/widgets/StatsWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/StatusWidget.d.ts +25 -0
- package/dist/types/src/components/ChatThread/widgets/StatusWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/SuggestionWidget.d.ts +11 -0
- package/dist/types/src/components/ChatThread/widgets/SuggestionWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/SummaryWidget.d.ts +5 -0
- package/dist/types/src/components/ChatThread/widgets/SummaryWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.d.ts +9 -0
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.stories.d.ts +15 -0
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/index.d.ts +11 -0
- package/dist/types/src/components/ChatThread/widgets/index.d.ts.map +1 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts +10 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts.map +1 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts +8 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts.map +1 -0
- package/dist/types/src/components/ProcessTree/index.d.ts +2 -0
- package/dist/types/src/components/ProcessTree/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +9 -11
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +13 -7
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +16 -5
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +10 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts +12 -0
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts +3 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts +8 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +12 -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/Toolbox/Toolbox.d.ts +17 -21
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +14 -5
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -8
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/AgentArticle/AgentArticle.d.ts +6 -0
- package/dist/types/src/containers/AgentArticle/AgentArticle.d.ts.map +1 -0
- package/dist/types/src/containers/AgentArticle/AgentArticle.stories.d.ts +21 -0
- package/dist/types/src/containers/AgentArticle/AgentArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/AgentArticle/index.d.ts +2 -0
- package/dist/types/src/containers/AgentArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/AgentProperties/AgentProperties.d.ts +6 -0
- package/dist/types/src/containers/AgentProperties/AgentProperties.d.ts.map +1 -0
- package/dist/types/src/containers/AgentProperties/AgentProperties.stories.d.ts +16 -0
- package/dist/types/src/containers/AgentProperties/AgentProperties.stories.d.ts.map +1 -0
- package/dist/types/src/containers/AgentProperties/index.d.ts +2 -0
- package/dist/types/src/containers/AgentProperties/index.d.ts.map +1 -0
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts +6 -0
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts.map +1 -0
- package/dist/types/src/containers/BlueprintArticle/index.d.ts +2 -0
- package/dist/types/src/containers/BlueprintArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts +18 -0
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/containers/ChatCompanion/index.d.ts +2 -0
- package/dist/types/src/containers/ChatCompanion/index.d.ts.map +1 -0
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts +12 -0
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts.map +1 -0
- package/dist/types/src/containers/ChatContainer/index.d.ts +2 -0
- package/dist/types/src/containers/ChatContainer/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/ChatDialog}/ChatDialog.d.ts +2 -3
- package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts.map +1 -0
- package/dist/types/src/containers/ChatDialog/index.d.ts +2 -0
- package/dist/types/src/containers/ChatDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts +6 -0
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PromptArticle/index.d.ts +2 -0
- package/dist/types/src/containers/PromptArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/PromptList/PromptList.d.ts +6 -0
- package/dist/types/src/containers/PromptList/PromptList.d.ts.map +1 -0
- package/dist/types/src/containers/PromptList/PromptList.stories.d.ts +21 -0
- package/dist/types/src/containers/PromptList/PromptList.stories.d.ts.map +1 -0
- package/dist/types/src/containers/PromptList/index.d.ts +2 -0
- package/dist/types/src/containers/PromptList/index.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts +9 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts +15 -0
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts +19 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.test.d.ts +2 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.test.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/execution-graph.d.ts +17 -0
- package/dist/types/src/containers/TracePanel/execution-graph.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/index.d.ts +4 -0
- package/dist/types/src/containers/TracePanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts +4 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/index.d.ts +2 -0
- package/dist/types/src/containers/TriggerStatus/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +12 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/extensions/index.d.ts +2 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -0
- package/dist/types/src/extensions/prompt-extension.d.ts +10 -0
- package/dist/types/src/extensions/prompt-extension.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 +25 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +12 -24
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +10 -0
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatToolbarActions.d.ts +8 -0
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextBinder.d.ts +5 -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/useFilteredTypes.d.ts +3 -0
- package/dist/types/src/hooks/useFilteredTypes.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/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/index.d.ts +3 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +5 -4
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create-chat.d.ts +5 -0
- package/dist/types/src/operations/create-chat.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +135 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/ensure-companion-chat.d.ts +5 -0
- package/dist/types/src/operations/ensure-companion-chat.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/on-create-space.d.ts +5 -0
- package/dist/types/src/operations/on-create-space.d.ts.map +1 -0
- package/dist/types/src/operations/resolve-navigation-targets.d.ts +15 -0
- package/dist/types/src/operations/resolve-navigation-targets.d.ts.map +1 -0
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts +5 -0
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts.map +1 -0
- package/dist/types/src/operations/set-current-chat.d.ts +5 -0
- package/dist/types/src/operations/set-current-chat.d.ts.map +1 -0
- package/dist/types/src/operations/update-chat-name.d.ts +5 -0
- package/dist/types/src/operations/update-chat-name.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 +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/queue-logger.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +8 -0
- package/dist/types/src/testing/test-generator.d.ts.map +1 -0
- package/dist/types/src/testing/test-sequence.d.ts +0 -4
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts +2 -2
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/testing/trace-timeline.test.d.ts +2 -0
- package/dist/types/src/testing/trace-timeline.test.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +2 -64
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +20 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +11 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +32 -0
- package/dist/types/src/types/capabilities.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/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +5 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +14 -213
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +151 -93
- package/src/AssistantPlugin.tsx +222 -114
- package/src/blueprints/assistant/blueprint.test.ts +46 -0
- package/src/blueprints/assistant/blueprint.ts +31 -0
- package/src/blueprints/assistant/index.ts +5 -0
- package/src/{components/SequenceEditor → blueprints}/index.ts +1 -1
- package/src/capabilities/ai-service.ts +30 -0
- package/src/capabilities/app-graph-builder.ts +192 -227
- package/src/capabilities/blueprint-definition.ts +58 -0
- package/src/capabilities/companion-chat-provisioner.ts +164 -0
- package/src/capabilities/edge-model-resolver.ts +33 -0
- package/src/capabilities/index.ts +21 -8
- package/src/capabilities/local-model-resolver.ts +48 -0
- package/src/capabilities/markdown.ts +40 -0
- package/src/capabilities/migrations.ts +35 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +140 -123
- package/src/capabilities/settings.ts +24 -12
- package/src/capabilities/state.ts +35 -0
- package/src/capabilities/toolkit.ts +13 -0
- package/src/components/AssistantSettings/AssistantSettings.stories.tsx +34 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +102 -75
- package/src/components/AssistantSettings/index.ts +2 -2
- package/src/components/Chat/Chat.tsx +310 -184
- package/src/components/Chat/events.ts +63 -0
- package/src/components/Chat/index.ts +2 -0
- package/src/components/ChatProgress/ChatProgress.tsx +56 -0
- package/src/components/ChatProgress/index.ts +5 -0
- package/src/components/ChatPrompt/ChatActions.tsx +46 -47
- package/src/components/ChatPrompt/ChatOptions.stories.tsx +122 -0
- package/src/components/ChatPrompt/ChatOptions.tsx +404 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +29 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +42 -37
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +33 -17
- package/src/components/ChatPrompt/index.ts +2 -3
- package/src/components/ChatThread/ChatThread.stories.tsx +120 -125
- package/src/components/ChatThread/ChatThread.tsx +80 -50
- package/src/components/ChatThread/Link.tsx +26 -0
- package/src/components/ChatThread/MarkdownStream.stories.tsx +243 -0
- package/src/components/ChatThread/registry.tsx +238 -0
- package/src/components/ChatThread/sync.test.ts +99 -0
- package/src/components/ChatThread/sync.ts +165 -0
- package/src/components/ChatThread/testing/thinking.md +21 -0
- package/src/components/ChatThread/testing/thread-1.md +30 -0
- package/src/components/ChatThread/testing/thread-2.md +56 -0
- package/src/components/ChatThread/testing/thread-widgets.md +79 -0
- package/src/components/ChatThread/tool-widget-state.test.ts +34 -0
- package/src/components/ChatThread/tool-widget-state.ts +48 -0
- package/src/components/ChatThread/widgets/FallbackWidget.tsx +26 -0
- package/src/components/ChatThread/widgets/PromptWidget.ts +28 -0
- package/src/components/ChatThread/widgets/ReasoningWidget.stories.tsx +68 -0
- package/src/components/ChatThread/widgets/ReasoningWidget.ts +133 -0
- package/src/components/ChatThread/widgets/ReferenceWidget.ts +31 -0
- package/src/components/ChatThread/widgets/SelectWidget.ts +37 -0
- package/src/components/ChatThread/widgets/StatsWidget.ts +29 -0
- package/src/components/ChatThread/widgets/StatusWidget.ts +133 -0
- package/src/components/ChatThread/widgets/SuggestionWidget.ts +41 -0
- package/src/components/ChatThread/widgets/SummaryWidget.tsx +28 -0
- package/src/components/ChatThread/widgets/ToolWidget.stories.tsx +54 -0
- package/src/components/ChatThread/widgets/ToolWidget.tsx +156 -0
- package/src/components/ChatThread/widgets/index.ts +14 -0
- package/src/components/ProcessTree/ProcessTree.stories.tsx +109 -0
- package/src/components/ProcessTree/ProcessTree.tsx +86 -0
- package/src/components/ProcessTree/index.ts +5 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +54 -43
- package/src/components/TemplateEditor/TemplateEditor.tsx +62 -60
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +39 -25
- package/src/components/TemplateEditor/TemplateForm.tsx +123 -81
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +274 -0
- package/src/components/TemplateEditor/extensions/index.ts +6 -0
- package/src/components/TemplateEditor/extensions/xml-extension.ts +64 -0
- package/src/components/ToolBlock/ToolBlock.tsx +144 -0
- package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
- package/src/components/ToolBlock/index.ts +6 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +17 -29
- package/src/components/Toolbox/Toolbox.tsx +88 -110
- package/src/components/index.ts +3 -11
- package/src/containers/AgentArticle/AgentArticle.stories.tsx +120 -0
- package/src/containers/AgentArticle/AgentArticle.tsx +198 -0
- package/src/containers/AgentArticle/index.ts +5 -0
- package/src/containers/AgentProperties/AgentProperties.stories.tsx +100 -0
- package/src/containers/AgentProperties/AgentProperties.tsx +158 -0
- package/src/containers/AgentProperties/index.ts +5 -0
- package/src/containers/BlueprintArticle/BlueprintArticle.tsx +29 -0
- package/src/containers/BlueprintArticle/index.ts +5 -0
- package/src/containers/ChatCompanion/ChatCompanion.tsx +142 -0
- package/src/containers/ChatCompanion/index.ts +5 -0
- package/src/containers/ChatContainer/ChatContainer.tsx +95 -0
- package/src/containers/ChatContainer/index.ts +5 -0
- package/src/containers/ChatDialog/ChatDialog.tsx +72 -0
- package/src/containers/ChatDialog/index.ts +5 -0
- package/src/containers/PromptArticle/PromptArticle.tsx +59 -0
- package/src/containers/PromptArticle/index.ts +5 -0
- package/src/containers/PromptList/PromptList.stories.tsx +129 -0
- package/src/containers/PromptList/PromptList.tsx +49 -0
- package/src/containers/PromptList/index.ts +5 -0
- package/src/containers/TracePanel/TracePanel.stories.tsx +230 -0
- package/src/containers/TracePanel/TracePanel.tsx +114 -0
- package/src/containers/TracePanel/dxn-extractor.test.ts +153 -0
- package/src/containers/TracePanel/dxn-extractor.ts +178 -0
- package/src/containers/TracePanel/execution-graph.ts +425 -0
- package/src/containers/TracePanel/index.ts +9 -0
- package/src/containers/TriggerStatus/TriggerStatus.tsx +144 -0
- package/src/containers/TriggerStatus/index.ts +5 -0
- package/src/containers/index.ts +16 -0
- package/src/extensions/index.ts +5 -0
- package/src/extensions/prompt-extension.ts +111 -0
- package/src/hooks/index.ts +10 -6
- package/src/hooks/useBlueprintRegistry.ts +109 -0
- package/src/hooks/useChatProcessor.ts +90 -0
- package/src/hooks/useChatServices.ts +26 -0
- package/src/hooks/useChatToolbarActions.ts +122 -0
- package/src/hooks/useContextBinder.ts +43 -0
- package/src/hooks/useContextObjects.ts +50 -0
- package/src/hooks/useFilteredTypes.ts +37 -0
- package/src/hooks/useFlush.ts +35 -0
- package/src/hooks/useOnline.ts +10 -0
- package/src/hooks/usePresets.ts +45 -0
- package/src/hooks/useReferencesProvider.ts +54 -0
- package/src/index.ts +3 -2
- package/src/meta.ts +15 -9
- package/src/operations/create-chat.ts +80 -0
- package/src/operations/definitions.ts +127 -0
- package/src/operations/ensure-companion-chat.ts +61 -0
- package/src/operations/index.ts +17 -0
- package/src/operations/on-create-space.ts +24 -0
- package/src/operations/resolve-navigation-targets.ts +26 -0
- package/src/operations/run-prompt-in-new-chat.ts +113 -0
- package/src/operations/set-current-chat.ts +50 -0
- package/src/operations/update-chat-name.ts +61 -0
- package/src/processor/index.ts +6 -0
- package/src/processor/presets.ts +68 -0
- package/src/processor/processor.test.ts +40 -0
- package/src/processor/processor.ts +321 -0
- package/src/queue-logger.ts +33 -23
- package/src/testing/index.ts +1 -1
- package/src/testing/test-generator.ts +293 -0
- package/src/testing/test-sequence.ts +5 -32
- package/src/testing/test-services.ts +10 -14
- package/src/testing/trace-timeline.conversations.json +1 -0
- package/src/testing/trace-timeline.test.ts +246 -0
- package/src/translations.ts +166 -55
- package/src/types/Assistant.ts +14 -0
- package/src/types/Settings.ts +21 -0
- package/src/types/capabilities.ts +35 -0
- package/src/types/defs.ts +5 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +8 -2
- package/src/types/service.ts +27 -16
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/ChatContainer-6XNB5NEI.mjs +0 -57
- package/dist/lib/browser/ChatContainer-6XNB5NEI.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-IMWPRXTO.mjs +0 -74
- package/dist/lib/browser/ChatDialog-IMWPRXTO.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-6XOYB2RN.mjs +0 -322
- package/dist/lib/browser/SequenceContainer-6XOYB2RN.mjs.map +0 -7
- package/dist/lib/browser/TemplateContainer-6ZGGH5T4.mjs +0 -28
- package/dist/lib/browser/TemplateContainer-6ZGGH5T4.mjs.map +0 -7
- package/dist/lib/browser/ai-client-ML7OQWAO.mjs +0 -39
- package/dist/lib/browser/ai-client-ML7OQWAO.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-UJ5NHRGK.mjs +0 -223
- package/dist/lib/browser/app-graph-builder-UJ5NHRGK.mjs.map +0 -7
- package/dist/lib/browser/chunk-44HZKIAW.mjs +0 -87
- package/dist/lib/browser/chunk-44HZKIAW.mjs.map +0 -7
- package/dist/lib/browser/chunk-LKP65RPA.mjs +0 -20
- package/dist/lib/browser/chunk-LKP65RPA.mjs.map +0 -7
- package/dist/lib/browser/chunk-NTBGTFTV.mjs +0 -15
- package/dist/lib/browser/chunk-NTBGTFTV.mjs.map +0 -7
- package/dist/lib/browser/chunk-OZL4OHTU.mjs +0 -157
- package/dist/lib/browser/chunk-OZL4OHTU.mjs.map +0 -7
- package/dist/lib/browser/chunk-TQ3QW3HJ.mjs +0 -2072
- package/dist/lib/browser/chunk-TQ3QW3HJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-TU7UUGWQ.mjs +0 -203
- package/dist/lib/browser/chunk-TU7UUGWQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-WPZ4UANI.mjs +0 -16
- package/dist/lib/browser/chunk-WPZ4UANI.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-LEAPB55Q.mjs +0 -42
- package/dist/lib/browser/intent-resolver-LEAPB55Q.mjs.map +0 -7
- package/dist/lib/browser/react-surface-TMF7JJA4.mjs +0 -156
- package/dist/lib/browser/react-surface-TMF7JJA4.mjs.map +0 -7
- package/dist/lib/browser/settings-N4HEXADL.mjs +0 -22
- package/dist/lib/browser/settings-N4HEXADL.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-VOLG7J6N.mjs +0 -58
- package/dist/lib/node-esm/ChatContainer-VOLG7J6N.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-B2XNUNRM.mjs +0 -75
- package/dist/lib/node-esm/ChatDialog-B2XNUNRM.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-WWG6IMN3.mjs +0 -323
- package/dist/lib/node-esm/SequenceContainer-WWG6IMN3.mjs.map +0 -7
- package/dist/lib/node-esm/TemplateContainer-6KRNEMVE.mjs +0 -29
- package/dist/lib/node-esm/TemplateContainer-6KRNEMVE.mjs.map +0 -7
- package/dist/lib/node-esm/ai-client-2FQ434CT.mjs +0 -40
- package/dist/lib/node-esm/ai-client-2FQ434CT.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-MEQ5CYNI.mjs +0 -224
- package/dist/lib/node-esm/app-graph-builder-MEQ5CYNI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-D3HTVK5D.mjs +0 -2073
- package/dist/lib/node-esm/chunk-D3HTVK5D.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-E6V2RUQ2.mjs +0 -16
- package/dist/lib/node-esm/chunk-E6V2RUQ2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HVMVHP4R.mjs +0 -158
- package/dist/lib/node-esm/chunk-HVMVHP4R.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HXKRKIN2.mjs +0 -18
- package/dist/lib/node-esm/chunk-HXKRKIN2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KOC6ESG7.mjs +0 -22
- package/dist/lib/node-esm/chunk-KOC6ESG7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VESVUAOS.mjs +0 -88
- package/dist/lib/node-esm/chunk-VESVUAOS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YYUVTTVK.mjs +0 -204
- package/dist/lib/node-esm/chunk-YYUVTTVK.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-4ULF3F7U.mjs +0 -43
- package/dist/lib/node-esm/intent-resolver-4ULF3F7U.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-6XL6SWL2.mjs +0 -157
- package/dist/lib/node-esm/react-surface-6XL6SWL2.mjs.map +0 -7
- package/dist/lib/node-esm/settings-WQ76EG6O.mjs +0 -23
- package/dist/lib/node-esm/settings-WQ76EG6O.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/capabilities/capabilities.d.ts +0 -6
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/ChatContainer.d.ts +0 -11
- package/dist/types/src/components/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/components/ChatDialog.d.ts.map +0 -1
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
- package/dist/types/src/components/ChatPrompt/events.d.ts +0 -17
- package/dist/types/src/components/ChatPrompt/events.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -18
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +0 -18
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
- package/dist/types/src/components/PromptSettings.d.ts +0 -6
- package/dist/types/src/components/PromptSettings.d.ts.map +0 -1
- package/dist/types/src/components/SequenceContainer.d.ts +0 -9
- package/dist/types/src/components/SequenceContainer.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +0 -13
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +0 -8
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/index.d.ts +0 -2
- package/dist/types/src/components/SequenceEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/TemplateContainer.d.ts +0 -9
- package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.d.ts +0 -82
- 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/useBlueprints.d.ts +0 -4
- package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
- package/dist/types/src/hooks/useContextProvider.d.ts +0 -23
- package/dist/types/src/hooks/useContextProvider.d.ts.map +0 -1
- package/dist/types/src/hooks/useServiceContainer.d.ts +0 -8
- package/dist/types/src/hooks/useServiceContainer.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/Chat.stories.d.ts +0 -199
- package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -3
- package/dist/types/src/testing/test-functions.d.ts.map +0 -1
- package/dist/types/src/tools/function.d.ts +0 -5
- package/dist/types/src/tools/function.d.ts.map +0 -1
- package/dist/types/src/tools/index.d.ts +0 -3
- package/dist/types/src/tools/index.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.d.ts +0 -10
- package/dist/types/src/tools/openapi.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.test.d.ts +0 -2
- package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -71
- package/dist/types/src/types/schema.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/src/capabilities/ai-client.ts +0 -39
- package/src/capabilities/capabilities.ts +0 -14
- package/src/capabilities/intent-resolver.ts +0 -45
- package/src/components/ChatContainer.tsx +0 -45
- package/src/components/ChatDialog.tsx +0 -65
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
- package/src/components/ChatPrompt/events.ts +0 -12
- package/src/components/ChatThread/ChatMessage.tsx +0 -238
- package/src/components/ChatThread/ToolBlock.tsx +0 -111
- package/src/components/ChatThread/reducer.ts +0 -52
- package/src/components/PromptSettings.tsx +0 -91
- package/src/components/SequenceContainer.tsx +0 -139
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -32
- package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
- package/src/components/TemplateContainer.tsx +0 -25
- package/src/events.ts +0 -11
- package/src/hooks/chat-processor.test.ts +0 -15
- package/src/hooks/chat-processor.ts +0 -281
- package/src/hooks/useBlueprints.ts +0 -31
- package/src/hooks/useChatProcessor.tsx +0 -142
- package/src/hooks/useContextProvider.ts +0 -61
- package/src/hooks/useServiceContainer.ts +0 -42
- 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/Chat.stories.tsx +0 -269
- package/src/testing/test-functions.ts +0 -11
- 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 -86
- package/src/types/template.ts +0 -66
- package/src/typings.d.ts +0 -9
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import { getObjectPathFromObject, LayoutOperation } from '@dxos/app-toolkit';
|
|
9
|
+
import { AiContextBinder } from '@dxos/assistant';
|
|
10
|
+
import { AgentPrompt } from '@dxos/assistant-toolkit';
|
|
11
|
+
import { Blueprint, Prompt, Template } from '@dxos/blueprints';
|
|
12
|
+
import { Database, Feed, Filter, Obj, Ref } from '@dxos/echo';
|
|
13
|
+
import { createFeedServiceLayer } from '@dxos/echo-db';
|
|
14
|
+
import { invariant } from '@dxos/invariant';
|
|
15
|
+
import { log } from '@dxos/log';
|
|
16
|
+
import { Operation } from '@dxos/operation';
|
|
17
|
+
import { AutomationCapabilities } from '@dxos/plugin-automation/types';
|
|
18
|
+
import { ClientCapabilities } from '@dxos/plugin-client/types';
|
|
19
|
+
import { Text } from '@dxos/schema';
|
|
20
|
+
|
|
21
|
+
import { AssistantCapabilities } from '../types';
|
|
22
|
+
import { CreateChat, RunPromptInNewChat } from './definitions';
|
|
23
|
+
|
|
24
|
+
const handler: Operation.WithHandler<typeof RunPromptInNewChat> = RunPromptInNewChat.pipe(
|
|
25
|
+
Operation.withHandler(
|
|
26
|
+
Effect.fnUntraced(
|
|
27
|
+
function* ({ db, prompt, objects, blueprints, background }) {
|
|
28
|
+
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
29
|
+
const { object: chat } = yield* Operation.invoke(CreateChat, { db });
|
|
30
|
+
|
|
31
|
+
if ((objects && objects.length > 0) || (blueprints && blueprints.length > 0)) {
|
|
32
|
+
const feedTarget = chat.feed.target;
|
|
33
|
+
invariant(feedTarget, 'Chat feed not found.');
|
|
34
|
+
const client = yield* Capability.get(ClientCapabilities.Client);
|
|
35
|
+
const space = client.spaces.get(db.spaceId);
|
|
36
|
+
invariant(space, 'Space not found.');
|
|
37
|
+
const feedServiceLayer = createFeedServiceLayer(space.queues);
|
|
38
|
+
const runtime = yield* Effect.runtime<Feed.FeedService>().pipe(Effect.provide(feedServiceLayer));
|
|
39
|
+
const binder = new AiContextBinder({ feed: feedTarget, runtime, registry });
|
|
40
|
+
yield* Effect.promise(() =>
|
|
41
|
+
binder.use(async (b: AiContextBinder) => {
|
|
42
|
+
const bindingProps: Parameters<AiContextBinder['bind']>[0] = {};
|
|
43
|
+
|
|
44
|
+
if (objects && objects.length > 0) {
|
|
45
|
+
bindingProps.objects = objects.map((obj) => Ref.make(obj));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (blueprints && blueprints.length > 0) {
|
|
49
|
+
const allBlueprints = await db.query(Filter.type(Blueprint.Blueprint)).run();
|
|
50
|
+
const matchedBlueprints = allBlueprints.filter(
|
|
51
|
+
(blueprint) => blueprint.key && blueprints.includes(blueprint.key),
|
|
52
|
+
);
|
|
53
|
+
if (matchedBlueprints.length > 0) {
|
|
54
|
+
bindingProps.blueprints = matchedBlueprints.map((blueprint) => Ref.make(blueprint));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
await b.bind(bindingProps);
|
|
59
|
+
}),
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (background) {
|
|
64
|
+
const promptRef =
|
|
65
|
+
typeof prompt === 'string'
|
|
66
|
+
? Ref.make(
|
|
67
|
+
Prompt.make({
|
|
68
|
+
instructions: prompt,
|
|
69
|
+
blueprints: [],
|
|
70
|
+
context: [],
|
|
71
|
+
}),
|
|
72
|
+
)
|
|
73
|
+
: prompt;
|
|
74
|
+
yield* Database.flush();
|
|
75
|
+
const computeRuntime = yield* Capability.get(AutomationCapabilities.ComputeRuntime);
|
|
76
|
+
const runtime = yield* computeRuntime.getRuntime(db.spaceId).runtimeEffect;
|
|
77
|
+
yield* Operation.invoke(AgentPrompt, {
|
|
78
|
+
prompt: promptRef,
|
|
79
|
+
input: {},
|
|
80
|
+
chat: Ref.make(chat),
|
|
81
|
+
}).pipe(
|
|
82
|
+
Effect.provide(runtime),
|
|
83
|
+
Effect.catchAll((error) => {
|
|
84
|
+
log.catch(error);
|
|
85
|
+
return Effect.void;
|
|
86
|
+
}),
|
|
87
|
+
);
|
|
88
|
+
return { object: chat };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const chatPath = getObjectPathFromObject(chat);
|
|
92
|
+
const pendingPromptText =
|
|
93
|
+
typeof prompt === 'string'
|
|
94
|
+
? prompt
|
|
95
|
+
: yield* Effect.gen(function* () {
|
|
96
|
+
const promptObj = yield* Effect.promise(() => prompt.load());
|
|
97
|
+
const source = yield* Effect.promise(() => promptObj.instructions.source.load());
|
|
98
|
+
invariant(Obj.instanceOf(Text.Text, source), 'Prompt template source must be Text.');
|
|
99
|
+
return Template.process(source.content ?? '');
|
|
100
|
+
});
|
|
101
|
+
yield* Capabilities.updateAtomValue(AssistantCapabilities.State, (current) => ({
|
|
102
|
+
...current,
|
|
103
|
+
pendingPrompts: { ...current.pendingPrompts, [chatPath]: pendingPromptText },
|
|
104
|
+
}));
|
|
105
|
+
yield* Operation.invoke(LayoutOperation.Open, { subject: [chatPath] });
|
|
106
|
+
return { object: chat };
|
|
107
|
+
},
|
|
108
|
+
(effect, { db }) => effect.pipe(Effect.provide(Database.layer(db))),
|
|
109
|
+
),
|
|
110
|
+
),
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
export default handler;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
10
|
+
|
|
11
|
+
import { AssistantCapabilities } from '../types';
|
|
12
|
+
import { CreateChat, SetCurrentChat } from './definitions';
|
|
13
|
+
|
|
14
|
+
const handler: Operation.WithHandler<typeof SetCurrentChat> = SetCurrentChat.pipe(
|
|
15
|
+
Operation.withHandler(
|
|
16
|
+
Effect.fnUntraced(function* ({ companionTo, chat }) {
|
|
17
|
+
const companionToId = Obj.getDXN(companionTo).toString();
|
|
18
|
+
|
|
19
|
+
if (chat) {
|
|
20
|
+
const chatId = Obj.getDXN(chat).toString();
|
|
21
|
+
yield* Capabilities.updateAtomValue(AssistantCapabilities.State, (current) => ({
|
|
22
|
+
...current,
|
|
23
|
+
currentChat: { ...current.currentChat, [companionToId]: chatId },
|
|
24
|
+
}));
|
|
25
|
+
} else {
|
|
26
|
+
// New thread: create a transient chat and cache it so the graph connector
|
|
27
|
+
// can resolve it immediately via the cache fallback tier.
|
|
28
|
+
const operationInvoker = yield* Capability.get(Capabilities.OperationInvoker);
|
|
29
|
+
const db = Obj.getDatabase(companionTo);
|
|
30
|
+
if (db) {
|
|
31
|
+
const { data } = yield* Effect.promise(() =>
|
|
32
|
+
operationInvoker.invokePromise(CreateChat, { db, addToSpace: false }),
|
|
33
|
+
);
|
|
34
|
+
if (data?.object) {
|
|
35
|
+
yield* Capabilities.updateAtomValue(AssistantCapabilities.CompanionChatCache, (current) => ({
|
|
36
|
+
...current,
|
|
37
|
+
[companionToId]: data.object,
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
yield* Capabilities.updateAtomValue(AssistantCapabilities.State, (current) => ({
|
|
42
|
+
...current,
|
|
43
|
+
currentChat: { ...current.currentChat, [companionToId]: undefined },
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
}),
|
|
47
|
+
),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
export default handler;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as LanguageModel from '@effect/ai/LanguageModel';
|
|
6
|
+
import * as Prompt from '@effect/ai/Prompt';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
|
|
9
|
+
import { AiPreprocessor, AiService } from '@dxos/ai';
|
|
10
|
+
import { Database, Feed, Filter, Obj } from '@dxos/echo';
|
|
11
|
+
import { log } from '@dxos/log';
|
|
12
|
+
import { Operation } from '@dxos/operation';
|
|
13
|
+
import { Message } from '@dxos/types';
|
|
14
|
+
import { trim } from '@dxos/util';
|
|
15
|
+
|
|
16
|
+
import { UpdateChatName } from './definitions';
|
|
17
|
+
|
|
18
|
+
const handler: Operation.WithHandler<typeof UpdateChatName> = UpdateChatName.pipe(
|
|
19
|
+
Operation.withHandler(
|
|
20
|
+
Effect.fnUntraced(
|
|
21
|
+
function* ({ chat }) {
|
|
22
|
+
log.info('updating chat name', { chat });
|
|
23
|
+
|
|
24
|
+
const feed = yield* Database.load(chat.feed);
|
|
25
|
+
const history = yield* Feed.runQuery(feed, Filter.type(Message.Message));
|
|
26
|
+
|
|
27
|
+
log.info('history', { history: history.length });
|
|
28
|
+
|
|
29
|
+
const system = trim`
|
|
30
|
+
It is extremely important that you respond only with the title and nothing else.
|
|
31
|
+
Do not use markdown or other formatting.
|
|
32
|
+
If you cannot do this effectively respond with "New Chat".
|
|
33
|
+
|
|
34
|
+
<example_reply>
|
|
35
|
+
Fishing Trip
|
|
36
|
+
</example_reply>
|
|
37
|
+
`;
|
|
38
|
+
const prompt = 'Suggest a name for this chat';
|
|
39
|
+
|
|
40
|
+
const historyPrompt = yield* AiPreprocessor.preprocessPrompt(history, {
|
|
41
|
+
system,
|
|
42
|
+
cacheControl: 'ephemeral',
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const response = yield* LanguageModel.generateText({
|
|
46
|
+
prompt: Prompt.merge(historyPrompt, prompt),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const newName = response.text.replaceAll(/[^a-zA-Z0-9\s]/g, '').trim();
|
|
50
|
+
|
|
51
|
+
Obj.change(chat, (chat) => {
|
|
52
|
+
chat.name = newName;
|
|
53
|
+
});
|
|
54
|
+
log.info('chat name updated', { chat, newName: chat.name });
|
|
55
|
+
},
|
|
56
|
+
Effect.provide(AiService.model('@anthropic/claude-haiku-4-5')),
|
|
57
|
+
),
|
|
58
|
+
),
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
export default handler;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { type ModelName } from '@dxos/ai';
|
|
8
|
+
|
|
9
|
+
const ModelProviders = ['dxos-local', 'dxos-remote', 'lm-studio', 'ollama'] 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-6' as const,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
provider: 'dxos-remote' as const,
|
|
34
|
+
model: '@anthropic/claude-sonnet-4-5' as const,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
provider: 'dxos-remote' as const,
|
|
38
|
+
model: '@anthropic/claude-3-5-haiku-20241022' as const,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
provider: 'ollama' as const,
|
|
42
|
+
model: 'gpt-oss:20b' as const,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
provider: 'ollama' as const,
|
|
46
|
+
model: 'gemma4:latest' as const,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
provider: 'lm-studio' as const,
|
|
50
|
+
model: '@google/gemma-3-27b' as const,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
provider: 'lm-studio' as const,
|
|
54
|
+
model: '@meta/llama-3.2-3b-instruct' as const,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
model: 'deepseek-r1:latest' as const,
|
|
58
|
+
provider: 'dxos-local' as const,
|
|
59
|
+
},
|
|
60
|
+
].map(
|
|
61
|
+
({ model, provider }, i) =>
|
|
62
|
+
({
|
|
63
|
+
id: `preset-${i}`,
|
|
64
|
+
provider,
|
|
65
|
+
model,
|
|
66
|
+
label: createModelLabel(model),
|
|
67
|
+
}) satisfies AiServicePreset,
|
|
68
|
+
);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, it } from '@effect/vitest';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as ManagedRuntime from 'effect/ManagedRuntime';
|
|
8
|
+
|
|
9
|
+
import { AiSession } from '@dxos/assistant';
|
|
10
|
+
import { Chat } from '@dxos/assistant-toolkit';
|
|
11
|
+
import { AssistantTestLayer } from '@dxos/assistant/testing';
|
|
12
|
+
import { Database, Feed } from '@dxos/echo';
|
|
13
|
+
import { acquireReleaseResource } from '@dxos/effect';
|
|
14
|
+
import { TestHelpers } from '@dxos/effect/testing';
|
|
15
|
+
|
|
16
|
+
import { AiChatProcessor } from './processor';
|
|
17
|
+
|
|
18
|
+
const TestLayer = AssistantTestLayer({ tracing: 'noop', types: [Chat.Chat, Feed.Feed] });
|
|
19
|
+
|
|
20
|
+
describe('Chat processor', () => {
|
|
21
|
+
it.scoped(
|
|
22
|
+
'basic',
|
|
23
|
+
Effect.fn(
|
|
24
|
+
function* ({ expect }) {
|
|
25
|
+
const feed = Feed.make();
|
|
26
|
+
yield* Database.add(feed);
|
|
27
|
+
const runtime = yield* Effect.runtime<Feed.FeedService>();
|
|
28
|
+
const session = yield* acquireReleaseResource(() => new AiSession({ feed, runtime }));
|
|
29
|
+
const managedRuntime = ManagedRuntime.make(
|
|
30
|
+
Effect.runSync(Effect.map(Effect.context<never>(), () => undefined as any)) as any,
|
|
31
|
+
);
|
|
32
|
+
const processor = new AiChatProcessor(session, managedRuntime as any, feed);
|
|
33
|
+
expect(processor).toBeDefined();
|
|
34
|
+
expect(processor.active).toBeDefined();
|
|
35
|
+
},
|
|
36
|
+
Effect.provide(TestLayer),
|
|
37
|
+
TestHelpers.provideTestContext,
|
|
38
|
+
),
|
|
39
|
+
);
|
|
40
|
+
});
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Atom, Registry } from '@effect-atom/atom-react';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Fiber from 'effect/Fiber';
|
|
8
|
+
import * as Option from 'effect/Option';
|
|
9
|
+
import * as Stream from 'effect/Stream';
|
|
10
|
+
|
|
11
|
+
import { type AiService, DEFAULT_EDGE_MODEL, type ModelName, type ModelRegistry } from '@dxos/ai';
|
|
12
|
+
import {
|
|
13
|
+
AiContextService,
|
|
14
|
+
type AiSession,
|
|
15
|
+
createSystemPrompt,
|
|
16
|
+
formatSystemPrompt,
|
|
17
|
+
AgentService,
|
|
18
|
+
PartialBlock,
|
|
19
|
+
ToolExecutionServices,
|
|
20
|
+
} from '@dxos/assistant';
|
|
21
|
+
import { type Chat } from '@dxos/assistant-toolkit';
|
|
22
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
23
|
+
import { type Database, Feed, Obj, Ref } from '@dxos/echo';
|
|
24
|
+
import { runAndForwardErrors, unwrapExit } from '@dxos/effect';
|
|
25
|
+
import { Trace, type CredentialsService, type QueueService } from '@dxos/functions';
|
|
26
|
+
import { log } from '@dxos/log';
|
|
27
|
+
import { Operation } from '@dxos/operation';
|
|
28
|
+
import type { AutomationCapabilities } from '@dxos/plugin-automation/types';
|
|
29
|
+
import { Message } from '@dxos/types';
|
|
30
|
+
|
|
31
|
+
import { UpdateChatName } from '../operations/definitions';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Services type for the old direct-conversation processor path.
|
|
35
|
+
* Retained for backward compatibility with CLI and update-name.
|
|
36
|
+
*/
|
|
37
|
+
export type AiChatServices =
|
|
38
|
+
| CredentialsService
|
|
39
|
+
| Database.Service
|
|
40
|
+
| QueueService
|
|
41
|
+
| AiService.AiService
|
|
42
|
+
| Trace.TraceService;
|
|
43
|
+
|
|
44
|
+
export type AiChatProcessorOptions = {
|
|
45
|
+
model?: ModelName;
|
|
46
|
+
modelRegistry?: ModelRegistry;
|
|
47
|
+
blueprintRegistry?: Blueprint.Registry;
|
|
48
|
+
observableRegistry?: Registry.Registry;
|
|
49
|
+
/**
|
|
50
|
+
* For tracing.
|
|
51
|
+
*/
|
|
52
|
+
chat?: Ref.Ref<Chat.Chat>;
|
|
53
|
+
system?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Probability of automatically updating chat name after each request.
|
|
56
|
+
* Chat name is always updated if it has no name.
|
|
57
|
+
* @default 0.1 (10%)
|
|
58
|
+
*/
|
|
59
|
+
autoUpdateNameChance?: number;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const defaultOptions: Partial<AiChatProcessorOptions> = {
|
|
63
|
+
model: DEFAULT_EDGE_MODEL,
|
|
64
|
+
autoUpdateNameChance: 0.1,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type AiRequestOptions = {};
|
|
68
|
+
|
|
69
|
+
export type AiRequest = {
|
|
70
|
+
message: string;
|
|
71
|
+
options?: AiRequestOptions;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Handles interactions with the AI service.
|
|
76
|
+
* Uses AgentService to spawn a process-backed agent and subscribes to ephemeral trace events for streaming.
|
|
77
|
+
*/
|
|
78
|
+
export class AiChatProcessor {
|
|
79
|
+
readonly #registry: Registry.Registry;
|
|
80
|
+
|
|
81
|
+
/** Pending messages (finalized, non-streaming). */
|
|
82
|
+
readonly #pending = Atom.make<Message.Message[]>([]);
|
|
83
|
+
|
|
84
|
+
/** Currently streaming messages (from ephemeral trace events). */
|
|
85
|
+
readonly #streaming = Atom.make<Message.Message[]>([]);
|
|
86
|
+
|
|
87
|
+
/** Set of message IDs that have been finalized (non-pending delivered via ephemeral). */
|
|
88
|
+
readonly #finalizedIds = new Set<string>();
|
|
89
|
+
|
|
90
|
+
/** Currently active request fiber. */
|
|
91
|
+
#requestFiber: Fiber.RuntimeFiber<void, unknown> | undefined;
|
|
92
|
+
|
|
93
|
+
/** Last request (for retries). */
|
|
94
|
+
#lastRequest: AiRequest | undefined;
|
|
95
|
+
|
|
96
|
+
/** Streaming state. */
|
|
97
|
+
public readonly streaming = Atom.make<boolean>((get) => get(this.#streaming).length > 0);
|
|
98
|
+
|
|
99
|
+
/** Active state. */
|
|
100
|
+
public readonly active = Atom.make(false);
|
|
101
|
+
|
|
102
|
+
/** Array of Messages (incl. the current message being streamed). */
|
|
103
|
+
public readonly messages = Atom.make<Message.Message[]>((get) => [...get(this.#pending), ...get(this.#streaming)]);
|
|
104
|
+
|
|
105
|
+
/** Last error. */
|
|
106
|
+
public readonly error = Atom.make<Option.Option<Error>>(Option.none());
|
|
107
|
+
|
|
108
|
+
constructor(
|
|
109
|
+
private readonly _conversation: AiSession,
|
|
110
|
+
private readonly _runtime: AutomationCapabilities.ComputeRuntime,
|
|
111
|
+
private readonly _feed: Feed.Feed,
|
|
112
|
+
private readonly _options: AiChatProcessorOptions = defaultOptions,
|
|
113
|
+
) {
|
|
114
|
+
this.#registry = this._options.observableRegistry ?? Registry.make();
|
|
115
|
+
if (this._options.model && !this._options.system) {
|
|
116
|
+
const capabilities = this._options.modelRegistry?.getCapabilities(this._options.model) ?? {};
|
|
117
|
+
this._options.system = createSystemPrompt(capabilities);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
get context() {
|
|
122
|
+
return this._conversation.context;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
get conversation() {
|
|
126
|
+
return this._conversation;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
get blueprintRegistry() {
|
|
130
|
+
return this._options.blueprintRegistry;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
get system(): string {
|
|
134
|
+
return this._options.system ?? '';
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async getTools(): Promise<Record<string, any>> {
|
|
138
|
+
return this._runtime.runPromise(Effect.provide(this._conversation.getTools(), ToolExecutionServices));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async getSystemPrompt(): Promise<string> {
|
|
142
|
+
return this._runtime.runPromise(
|
|
143
|
+
Effect.gen(this, function* () {
|
|
144
|
+
const blueprints = this.context.getBlueprints();
|
|
145
|
+
const objects = this.context.getObjects();
|
|
146
|
+
return yield* formatSystemPrompt({ system: this._options.system, blueprints, objects });
|
|
147
|
+
}).pipe(Effect.provideService(AiContextService, { binder: this.context }), Effect.orDie),
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Initiates a new request via AgentService.
|
|
153
|
+
*/
|
|
154
|
+
async request(requestProp: AiRequest): Promise<void> {
|
|
155
|
+
if (this.#requestFiber) {
|
|
156
|
+
await this.cancel();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
try {
|
|
160
|
+
this.#lastRequest = requestProp;
|
|
161
|
+
this.#registry.set(this.error, Option.none());
|
|
162
|
+
this.#registry.set(this.active, true);
|
|
163
|
+
|
|
164
|
+
const effect = Effect.gen(this, function* () {
|
|
165
|
+
// NOTE: Gets or creates a session for the feed.
|
|
166
|
+
log.info('init agent session', { feed: Obj.getDXN(this._feed).toString(), model: this._options.model });
|
|
167
|
+
const session = yield* AgentService.getSession(this._feed, { model: this._options.model });
|
|
168
|
+
const ephemeralStream = session.subscribeEphemeral();
|
|
169
|
+
yield* ephemeralStream.pipe(
|
|
170
|
+
Stream.runForEach((message) =>
|
|
171
|
+
Effect.sync(() => {
|
|
172
|
+
for (const event of message.events) {
|
|
173
|
+
if (Trace.isOfType(PartialBlock, event)) {
|
|
174
|
+
this.#handleEphemeralMessage(event.data);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}),
|
|
178
|
+
),
|
|
179
|
+
Effect.fork,
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
log('chat processor submitting prompt', { length: requestProp.message.length });
|
|
183
|
+
yield* session.submitPrompt(requestProp.message);
|
|
184
|
+
log('chat processor submitPrompt returned, waiting for agent', {});
|
|
185
|
+
yield* session.waitForCompletion();
|
|
186
|
+
log.info('session complete');
|
|
187
|
+
|
|
188
|
+
this.#flushStreaming();
|
|
189
|
+
|
|
190
|
+
yield* this.#maybeUpdateChatName();
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
this.#requestFiber = this._runtime.runFork(effect);
|
|
194
|
+
|
|
195
|
+
try {
|
|
196
|
+
await this._runtime.runPromise(Fiber.join(this.#requestFiber));
|
|
197
|
+
} catch (err: any) {
|
|
198
|
+
if (err._tag === 'InterruptedException' || err.message?.includes('interrupted')) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
throw err;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
this.#registry.set(this.error, Option.none());
|
|
205
|
+
this.#lastRequest = undefined;
|
|
206
|
+
this.#requestFiber = undefined;
|
|
207
|
+
} catch (err) {
|
|
208
|
+
log.error('request failed', { error: err });
|
|
209
|
+
this.#registry.set(this.error, Option.some(new Error('AI service error', { cause: err })));
|
|
210
|
+
} finally {
|
|
211
|
+
log.info('setting active to false');
|
|
212
|
+
this.#registry.set(this.active, false);
|
|
213
|
+
this.#requestFiber = undefined;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Cancels the current request.
|
|
219
|
+
*/
|
|
220
|
+
async cancel(): Promise<void> {
|
|
221
|
+
await runAndForwardErrors(
|
|
222
|
+
Effect.gen(this, function* () {
|
|
223
|
+
if (this.#requestFiber) {
|
|
224
|
+
yield* Fiber.interrupt(this.#requestFiber);
|
|
225
|
+
}
|
|
226
|
+
}),
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
this.#requestFiber = undefined;
|
|
230
|
+
this.#registry.set(this.active, false);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Retry last failed request.
|
|
235
|
+
*/
|
|
236
|
+
async retry(): Promise<void> {
|
|
237
|
+
if (this.#lastRequest) {
|
|
238
|
+
return this.request(this.#lastRequest);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Update the current chat's name.
|
|
244
|
+
*/
|
|
245
|
+
async updateName(chat: Chat.Chat): Promise<void> {
|
|
246
|
+
unwrapExit(await this._runtime.runPromiseExit(Operation.invoke(UpdateChatName, { chat })));
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Handles an ephemeral message from the agent process.
|
|
251
|
+
* Both pending and completed blocks arrive here. Completed blocks are deduped
|
|
252
|
+
* against messages already written to the feed queue to handle the race between
|
|
253
|
+
* ephemeral delivery and feed replication.
|
|
254
|
+
*/
|
|
255
|
+
#handleEphemeralMessage(event: Trace.PayloadType<typeof PartialBlock>) {
|
|
256
|
+
const isPending = event.block.pending;
|
|
257
|
+
const message = Obj.make(Message.Message, {
|
|
258
|
+
id: event.messageId,
|
|
259
|
+
created: new Date().toISOString(),
|
|
260
|
+
sender: { role: event.role },
|
|
261
|
+
blocks: [event.block],
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
if (isPending) {
|
|
265
|
+
if (this.#finalizedIds.has(event.messageId)) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
this.#registry.update(this.#streaming, (streaming) => {
|
|
269
|
+
const idx = streaming.findIndex((existing) => existing.id === event.messageId);
|
|
270
|
+
if (idx >= 0) {
|
|
271
|
+
const updated = [...streaming];
|
|
272
|
+
updated[idx] = message;
|
|
273
|
+
return updated;
|
|
274
|
+
}
|
|
275
|
+
return [...streaming, message];
|
|
276
|
+
});
|
|
277
|
+
} else {
|
|
278
|
+
this.#finalizedIds.add(event.messageId);
|
|
279
|
+
this.#registry.update(this.#streaming, (streaming) => streaming.filter((existing) => existing.id !== message.id));
|
|
280
|
+
this.#registry.update(this.#pending, (pending) => {
|
|
281
|
+
if (pending.some((existing) => existing.id === message.id)) {
|
|
282
|
+
return pending;
|
|
283
|
+
}
|
|
284
|
+
return [...pending, message];
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Move remaining streaming messages to pending (called when agent completes).
|
|
291
|
+
*/
|
|
292
|
+
#flushStreaming() {
|
|
293
|
+
const remaining = this.#registry.get(this.#streaming);
|
|
294
|
+
if (remaining.length > 0) {
|
|
295
|
+
this.#registry.update(this.#pending, (pending) => [...pending, ...remaining]);
|
|
296
|
+
this.#registry.set(this.#streaming, []);
|
|
297
|
+
}
|
|
298
|
+
this.#finalizedIds.clear();
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Conditionally schedule chat name update in detached fork mode.
|
|
303
|
+
* Updates if chat has no name OR based on random chance (default 10%).
|
|
304
|
+
*/
|
|
305
|
+
#maybeUpdateChatName(): Effect.Effect<void, never, Operation.Service> {
|
|
306
|
+
const chat = this._options.chat?.target;
|
|
307
|
+
if (!chat) {
|
|
308
|
+
return Effect.void;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const chance = this._options.autoUpdateNameChance ?? defaultOptions.autoUpdateNameChance ?? 0.1;
|
|
312
|
+
const shouldUpdate = !chat.name || Math.random() < chance;
|
|
313
|
+
if (!shouldUpdate) {
|
|
314
|
+
return Effect.void;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// TODO(dmaretskyi): Operation.schedule didn't work.
|
|
318
|
+
log.info('scheduling chat name update', { hasName: !!chat.name, chance });
|
|
319
|
+
return Operation.schedule(UpdateChatName, { chat });
|
|
320
|
+
}
|
|
321
|
+
}
|