@dxos/plugin-assistant 0.8.4-main.3eb6e50203 → 0.8.4-main.422d1c7879
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 +3 -7
- 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-LMVTXH54.mjs +154 -0
- package/dist/lib/browser/chunk-LMVTXH54.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +74 -0
- package/dist/lib/browser/cli/index.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 +3308 -264
- 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 +1 -4
- 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 +3 -7
- 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/cli/index.mjs +75 -0
- package/dist/lib/node-esm/cli/index.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 +3308 -264
- 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 +1 -4
- 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.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 +1 -6
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- 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 +6 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- 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/edge-model-resolver.d.ts → edge-model-resolver.d.ts} +1 -1
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +29 -11
- 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 +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +6 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- 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/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +10 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +4 -6
- 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 +15 -14
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +6 -3
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts +2 -1
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +2 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- 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/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Anchor.stories.d.ts +14 -0
- package/dist/types/src/components/ChatThread/Anchor.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +2 -2
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +6 -426
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts +42 -0
- package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts +43 -16
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
- 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 +15 -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 +5 -4
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +1 -419
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +1 -419
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +0 -9
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
- 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 +1 -419
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -11
- 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 +0 -1
- 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 +7 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts +16 -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 +5 -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/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +5 -5
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +3 -6
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextBinder.d.ts +3 -2
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -1
- package/dist/types/src/hooks/useFilteredTypes.d.ts +1 -1
- package/dist/types/src/hooks/useFilteredTypes.d.ts.map +1 -1
- package/dist/types/src/hooks/usePresets.d.ts +1 -1
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -1
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -0
- 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/prompt.test.d.ts +2 -0
- package/dist/types/src/operations/prompt.test.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 +0 -1
- package/dist/types/src/processor/index.d.ts.map +1 -1
- package/dist/types/src/processor/presets.d.ts +1 -1
- package/dist/types/src/processor/presets.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +30 -29
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/queue-logger.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.test.d.ts +2 -0
- package/dist/types/src/testing/test-generator.test.d.ts.map +1 -0
- package/dist/types/src/testing/test-services.d.ts +1 -1
- 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 -419
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +14 -14
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- 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 +12 -13
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +112 -95
- package/src/AssistantPlugin.tsx +115 -46
- 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/blueprints/index.ts +1 -8
- package/src/capabilities/app-graph-builder.ts +162 -0
- package/src/capabilities/blueprint-definition.ts +58 -0
- package/src/capabilities/companion-chat-provisioner.ts +164 -0
- package/src/capabilities/index.ts +22 -11
- package/src/capabilities/{local-model-resolver/local-model-resolver.ts → local-model-resolver.ts} +14 -4
- 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 +161 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +2 -2
- package/src/capabilities/{state/state.ts → state.ts} +11 -3
- package/src/capabilities/toolkit.ts +13 -0
- package/src/{components/Typewriter → cli}/index.ts +1 -1
- package/src/cli/plugin.ts +84 -0
- package/src/components/AssistantSettings/AssistantSettings.stories.tsx +34 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +104 -92
- package/src/components/AssistantSettings/index.ts +2 -2
- package/src/components/Chat/Chat.tsx +80 -64
- package/src/components/ChatProgress/ChatProgress.tsx +9 -6
- package/src/components/ChatPrompt/ChatActions.tsx +24 -12
- package/src/components/ChatPrompt/ChatOptions.stories.tsx +122 -0
- package/src/components/ChatPrompt/ChatOptions.tsx +205 -39
- package/src/components/ChatPrompt/ChatReferences.tsx +18 -8
- package/src/components/ChatThread/Anchor.stories.tsx +95 -0
- package/src/components/ChatThread/ChatThread.stories.tsx +61 -68
- package/src/components/ChatThread/ChatThread.tsx +28 -24
- package/src/components/ChatThread/MarkdownStream.stories.tsx +280 -0
- package/src/components/ChatThread/registry.tsx +117 -44
- package/src/components/ChatThread/sync.test.ts +111 -17
- package/src/components/ChatThread/sync.ts +92 -96
- package/src/components/ChatThread/testing/reasoning.md +25 -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.md → thread-2.md} +19 -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 +30 -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 +131 -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 +3 -8
- package/src/components/TemplateEditor/TemplateEditor.tsx +50 -42
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +6 -5
- package/src/components/TemplateEditor/TemplateForm.tsx +9 -10
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +5 -5
- package/src/components/ToolBlock/ToolBlock.tsx +22 -21
- package/src/components/Toolbox/Toolbox.stories.tsx +4 -6
- package/src/components/Toolbox/Toolbox.tsx +65 -58
- package/src/components/index.ts +3 -16
- package/src/containers/AgentArticle/AgentArticle.stories.tsx +120 -0
- package/src/containers/AgentArticle/AgentArticle.tsx +200 -0
- package/src/containers/AgentArticle/index.ts +5 -0
- package/src/containers/AgentProperties/AgentProperties.stories.tsx +100 -0
- package/src/containers/AgentProperties/AgentProperties.tsx +127 -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/{components → containers/ChatDialog}/ChatDialog.tsx +7 -10
- 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 +272 -0
- package/src/containers/TracePanel/TracePanel.tsx +113 -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 +452 -0
- package/src/containers/TracePanel/index.ts +9 -0
- package/src/containers/TriggerStatus/TriggerStatus.tsx +129 -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/useBlueprintRegistry.ts +6 -2
- package/src/hooks/useChatProcessor.ts +35 -23
- package/src/hooks/useChatServices.ts +6 -27
- package/src/hooks/useChatToolbarActions.ts +9 -9
- package/src/hooks/useContextBinder.ts +17 -6
- package/src/hooks/useContextObjects.ts +8 -4
- package/src/hooks/useFilteredTypes.ts +3 -3
- package/src/hooks/usePresets.ts +2 -1
- package/src/hooks/useReferencesProvider.ts +1 -5
- package/src/index.ts +1 -1
- package/src/meta.ts +6 -3
- 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/prompt.test.ts +79 -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 +0 -1
- package/src/processor/presets.ts +11 -3
- package/src/processor/processor.test.ts +18 -50
- package/src/processor/processor.ts +178 -158
- package/src/queue-logger.ts +19 -8
- package/src/testing/data/trace-timeline.dx.json +2120 -0
- package/src/testing/test-generator.test.ts +81 -0
- package/src/testing/test-generator.ts +79 -42
- package/src/testing/test-sequence.ts +3 -3
- package/src/testing/test-services.ts +2 -2
- package/src/testing/trace-timeline.conversations.json +1 -0
- package/src/testing/trace-timeline.test.ts +246 -0
- package/src/translations.ts +153 -102
- package/src/types/Assistant.ts +4 -18
- package/src/types/Settings.ts +21 -0
- package/src/types/capabilities.ts +11 -3
- package/src/types/events.ts +2 -2
- package/src/types/index.ts +0 -1
- package/src/types/service.ts +5 -5
- package/dist/lib/browser/BlueprintArticle-6SP2ZWJ2.mjs +0 -30
- package/dist/lib/browser/BlueprintArticle-6SP2ZWJ2.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-CAKFZAWN.mjs +0 -200
- package/dist/lib/browser/ChatCompanion-CAKFZAWN.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-QB37VONJ.mjs +0 -73
- package/dist/lib/browser/ChatContainer-QB37VONJ.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-ASVBLOOS.mjs +0 -85
- package/dist/lib/browser/ChatDialog-ASVBLOOS.mjs.map +0 -7
- package/dist/lib/browser/InitiativeContainer-V522FCYH.mjs +0 -266
- package/dist/lib/browser/InitiativeContainer-V522FCYH.mjs.map +0 -7
- package/dist/lib/browser/PromptArticle-PK3CBRUB.mjs +0 -52
- package/dist/lib/browser/PromptArticle-PK3CBRUB.mjs.map +0 -7
- package/dist/lib/browser/ai-service-CY2BYPH6.mjs +0 -22
- package/dist/lib/browser/ai-service-CY2BYPH6.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-MUZGUQSC.mjs +0 -234
- package/dist/lib/browser/app-graph-builder-MUZGUQSC.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-YAGWYVCL.mjs +0 -14
- package/dist/lib/browser/blueprint-definition-YAGWYVCL.mjs.map +0 -7
- package/dist/lib/browser/chunk-3ETBCBMH.mjs +0 -47
- package/dist/lib/browser/chunk-3ETBCBMH.mjs.map +0 -7
- package/dist/lib/browser/chunk-6BVCG5SJ.mjs +0 -230
- package/dist/lib/browser/chunk-6BVCG5SJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-DKQMSMBN.mjs +0 -326
- package/dist/lib/browser/chunk-DKQMSMBN.mjs.map +0 -7
- package/dist/lib/browser/chunk-EXVT7D4B.mjs +0 -23
- package/dist/lib/browser/chunk-EXVT7D4B.mjs.map +0 -7
- package/dist/lib/browser/chunk-IJYAKPEU.mjs +0 -286
- package/dist/lib/browser/chunk-IJYAKPEU.mjs.map +0 -7
- package/dist/lib/browser/chunk-JA7PUZC7.mjs +0 -1974
- package/dist/lib/browser/chunk-JA7PUZC7.mjs.map +0 -7
- package/dist/lib/browser/chunk-POPBT2AQ.mjs +0 -198
- package/dist/lib/browser/chunk-POPBT2AQ.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-YTMFQEN5.mjs +0 -21
- package/dist/lib/browser/edge-model-resolver-YTMFQEN5.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-CGRQH37T.mjs +0 -20
- package/dist/lib/browser/local-model-resolver-CGRQH37T.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-2673CFJS.mjs +0 -133
- package/dist/lib/browser/operation-resolver-2673CFJS.mjs.map +0 -7
- package/dist/lib/browser/react-surface-T3FN4GVP.mjs +0 -125
- package/dist/lib/browser/react-surface-T3FN4GVP.mjs.map +0 -7
- package/dist/lib/browser/repair-IRXDYF4R.mjs +0 -51
- package/dist/lib/browser/repair-IRXDYF4R.mjs.map +0 -7
- package/dist/lib/browser/settings-XF6GKHCG.mjs +0 -33
- package/dist/lib/browser/settings-XF6GKHCG.mjs.map +0 -7
- package/dist/lib/browser/state-OYDPWLKA.mjs +0 -26
- package/dist/lib/browser/state-OYDPWLKA.mjs.map +0 -7
- package/dist/lib/browser/toolkit-IDXQCSTX.mjs +0 -19
- package/dist/lib/browser/toolkit-IDXQCSTX.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintArticle-7LI6UXKZ.mjs +0 -31
- package/dist/lib/node-esm/BlueprintArticle-7LI6UXKZ.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-W4PGOCGR.mjs +0 -201
- package/dist/lib/node-esm/ChatCompanion-W4PGOCGR.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-ECFQVH6O.mjs +0 -74
- package/dist/lib/node-esm/ChatContainer-ECFQVH6O.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-AFLPYSIU.mjs +0 -86
- package/dist/lib/node-esm/ChatDialog-AFLPYSIU.mjs.map +0 -7
- package/dist/lib/node-esm/InitiativeContainer-U4LGO3BW.mjs +0 -267
- package/dist/lib/node-esm/InitiativeContainer-U4LGO3BW.mjs.map +0 -7
- package/dist/lib/node-esm/PromptArticle-BHPABYLT.mjs +0 -53
- package/dist/lib/node-esm/PromptArticle-BHPABYLT.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-ZI3A6RVG.mjs +0 -23
- package/dist/lib/node-esm/ai-service-ZI3A6RVG.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-4QN5M6PD.mjs +0 -235
- package/dist/lib/node-esm/app-graph-builder-4QN5M6PD.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-H3LFAEK2.mjs +0 -15
- package/dist/lib/node-esm/blueprint-definition-H3LFAEK2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2LEN26ZQ.mjs +0 -48
- package/dist/lib/node-esm/chunk-2LEN26ZQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3XC7LQSO.mjs +0 -1975
- package/dist/lib/node-esm/chunk-3XC7LQSO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-75PHXBN3.mjs +0 -327
- package/dist/lib/node-esm/chunk-75PHXBN3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F6LA7XNS.mjs +0 -199
- package/dist/lib/node-esm/chunk-F6LA7XNS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LB72WG6R.mjs +0 -231
- package/dist/lib/node-esm/chunk-LB72WG6R.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MJD5XWQV.mjs +0 -288
- package/dist/lib/node-esm/chunk-MJD5XWQV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs +0 -25
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-CMJ3KNLQ.mjs +0 -22
- package/dist/lib/node-esm/edge-model-resolver-CMJ3KNLQ.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-FFDAKOXN.mjs +0 -21
- package/dist/lib/node-esm/local-model-resolver-FFDAKOXN.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-2ZD2DXOU.mjs +0 -134
- package/dist/lib/node-esm/operation-resolver-2ZD2DXOU.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-T4VMCCKZ.mjs +0 -126
- package/dist/lib/node-esm/react-surface-T4VMCCKZ.mjs.map +0 -7
- package/dist/lib/node-esm/repair-DMI55PON.mjs +0 -52
- package/dist/lib/node-esm/repair-DMI55PON.mjs.map +0 -7
- package/dist/lib/node-esm/settings-NGGZA7S7.mjs +0 -34
- package/dist/lib/node-esm/settings-NGGZA7S7.mjs.map +0 -7
- package/dist/lib/node-esm/state-VSCPGN7R.mjs +0 -27
- package/dist/lib/node-esm/state-VSCPGN7R.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-JPRJRDDB.mjs +0 -20
- package/dist/lib/node-esm/toolkit-JPRJRDDB.mjs.map +0 -7
- package/dist/types/src/blueprints/assistant-blueprint.d.ts +0 -11
- package/dist/types/src/blueprints/assistant-blueprint.d.ts.map +0 -1
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts +0 -6
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts.map +0 -1
- package/dist/types/src/capabilities/ai-service/index.d.ts +0 -3
- package/dist/types/src/capabilities/ai-service/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +0 -6
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -26
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -4
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/edge-model-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/edge-model-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/local-model-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/local-model-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts +0 -13
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/repair/index.d.ts +0 -3
- package/dist/types/src/capabilities/repair/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/repair/repair.d.ts +0 -6
- package/dist/types/src/capabilities/repair/repair.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -15
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.d.ts +0 -18
- package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/index.d.ts +0 -11
- package/dist/types/src/capabilities/state/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/state.d.ts +0 -13
- package/dist/types/src/capabilities/state/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/toolkit/index.d.ts +0 -3
- package/dist/types/src/capabilities/toolkit/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts +0 -6
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintArticle.d.ts +0 -7
- package/dist/types/src/components/BlueprintArticle.d.ts.map +0 -1
- package/dist/types/src/components/ChatCompanion.d.ts +0 -13
- package/dist/types/src/components/ChatCompanion.d.ts.map +0 -1
- package/dist/types/src/components/ChatContainer.d.ts +0 -19
- 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/InitiativeContainer.d.ts +0 -9
- package/dist/types/src/components/InitiativeContainer.d.ts.map +0 -1
- package/dist/types/src/components/PromptArticle.d.ts +0 -7
- package/dist/types/src/components/PromptArticle.d.ts.map +0 -1
- package/dist/types/src/components/TriggerStatus/TriggerStatus.d.ts +0 -4
- package/dist/types/src/components/TriggerStatus/TriggerStatus.d.ts.map +0 -1
- package/dist/types/src/components/TriggerStatus/index.d.ts +0 -2
- package/dist/types/src/components/TriggerStatus/index.d.ts.map +0 -1
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts +0 -12
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts.map +0 -1
- package/dist/types/src/components/Typewriter/Typewriter.d.ts +0 -11
- package/dist/types/src/components/Typewriter/Typewriter.d.ts.map +0 -1
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts +0 -7
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts.map +0 -1
- package/dist/types/src/components/Typewriter/assistant-extension.d.ts +0 -5
- package/dist/types/src/components/Typewriter/assistant-extension.d.ts.map +0 -1
- package/dist/types/src/components/Typewriter/index.d.ts +0 -2
- package/dist/types/src/components/Typewriter/index.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -4
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/object-list.d.ts +0 -10
- package/dist/types/src/functions/object-list.d.ts.map +0 -1
- package/dist/types/src/functions/object-load.d.ts +0 -8
- package/dist/types/src/functions/object-load.d.ts.map +0 -1
- package/dist/types/src/functions/object-search.d.ts +0 -10
- package/dist/types/src/functions/object-search.d.ts.map +0 -1
- package/dist/types/src/processor/update-name.d.ts +0 -10
- package/dist/types/src/processor/update-name.d.ts.map +0 -1
- package/dist/types/src/types/AssistantAction.d.ts +0 -97
- package/dist/types/src/types/AssistantAction.d.ts.map +0 -1
- package/src/blueprints/assistant-blueprint.ts +0 -57
- package/src/capabilities/ai-service/index.ts +0 -7
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -200
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +0 -74
- package/src/capabilities/blueprint-definition/index.ts +0 -8
- package/src/capabilities/edge-model-resolver/index.ts +0 -7
- package/src/capabilities/local-model-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -112
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -111
- package/src/capabilities/repair/index.ts +0 -7
- package/src/capabilities/repair/repair.ts +0 -62
- package/src/capabilities/settings/index.ts +0 -7
- package/src/capabilities/state/index.ts +0 -7
- package/src/capabilities/toolkit/index.ts +0 -7
- package/src/capabilities/toolkit/toolkit.ts +0 -27
- package/src/components/BlueprintArticle.tsx +0 -28
- package/src/components/ChatCompanion.tsx +0 -226
- package/src/components/ChatContainer.tsx +0 -68
- package/src/components/InitiativeContainer.tsx +0 -340
- package/src/components/PromptArticle.tsx +0 -49
- package/src/components/TriggerStatus/TriggerStatus.tsx +0 -142
- package/src/components/TriggerStatus/index.ts +0 -5
- package/src/components/Typewriter/AssistantToolbar.tsx +0 -161
- package/src/components/Typewriter/Typewriter.stories.tsx +0 -83
- package/src/components/Typewriter/Typewriter.tsx +0 -54
- package/src/components/Typewriter/assistant-extension.tsx +0 -144
- package/src/functions/index.ts +0 -7
- package/src/functions/object-list.ts +0 -49
- package/src/functions/object-load.ts +0 -44
- package/src/functions/object-search.ts +0 -46
- package/src/processor/update-name.ts +0 -58
- package/src/types/AssistantAction.ts +0 -76
- /package/src/capabilities/{ai-service/ai-service.ts → ai-service.ts} +0 -0
- /package/src/capabilities/{edge-model-resolver/edge-model-resolver.ts → edge-model-resolver.ts} +0 -0
|
@@ -5,56 +5,65 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
|
-
import {
|
|
8
|
+
import { ContentBlock, type Message } from '@dxos/types';
|
|
9
|
+
import { type XmlWidgetRegistry, getXmlTextChild } from '@dxos/ui-editor';
|
|
10
|
+
|
|
11
|
+
import { type BlockRenderer, type MessageThreadContext } from './sync';
|
|
12
|
+
import { applyToolBlockToWidgetState } from './tool-widget-state';
|
|
9
13
|
import {
|
|
14
|
+
FallbackWidget,
|
|
10
15
|
PromptWidget,
|
|
16
|
+
ReasoningWidget,
|
|
11
17
|
ReferenceWidget,
|
|
12
18
|
SelectWidget,
|
|
13
19
|
SuggestionWidget,
|
|
20
|
+
StatsWidget,
|
|
14
21
|
SummaryWidget,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import { type XmlWidgetProps, type XmlWidgetRegistry, getXmlTextChild } from '@dxos/ui-editor';
|
|
19
|
-
|
|
20
|
-
import { ToolBlock } from '../ToolBlock';
|
|
21
|
-
|
|
22
|
-
import { type BlockRenderer, type MessageThreadContext } from './sync';
|
|
23
|
-
|
|
24
|
-
const Fallback = ({ _tag, ...props }: XmlWidgetProps<MessageThreadContext>) => {
|
|
25
|
-
return (
|
|
26
|
-
<ToggleContainer.Root classNames='rounded-sm'>
|
|
27
|
-
<ToggleContainer.Header classNames='bg-groupSurface'>{_tag}</ToggleContainer.Header>
|
|
28
|
-
<ToggleContainer.Content classNames='bg-modalSurface'>
|
|
29
|
-
<Json classNames='!p-2 text-sm' data={props} />
|
|
30
|
-
</ToggleContainer.Content>
|
|
31
|
-
</ToggleContainer.Root>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
22
|
+
ToolWidget,
|
|
23
|
+
StatusWidget,
|
|
24
|
+
} from './widgets';
|
|
34
25
|
|
|
35
26
|
/**
|
|
36
27
|
* Custom XML tags registry.
|
|
37
28
|
*/
|
|
38
29
|
export const componentRegistry: XmlWidgetRegistry = {
|
|
39
30
|
//
|
|
40
|
-
// Widgets
|
|
31
|
+
// DOM Widgets
|
|
41
32
|
//
|
|
42
33
|
|
|
43
|
-
|
|
34
|
+
prompt: {
|
|
44
35
|
block: true,
|
|
45
36
|
factory: ({ children }) => {
|
|
46
37
|
const text = getXmlTextChild(children);
|
|
47
38
|
return text ? new PromptWidget(text) : null;
|
|
48
39
|
},
|
|
49
40
|
},
|
|
50
|
-
|
|
41
|
+
synthetic: {
|
|
42
|
+
block: true,
|
|
43
|
+
factory: ({ children, range }) => {
|
|
44
|
+
const text = getXmlTextChild(children);
|
|
45
|
+
// TODO(dmaretskyi): Synthetic blocks are "user"-turn messages generated by the system, i.e. and event from a trigger, an email-encoded to JSON, etc.
|
|
46
|
+
// They are meant to start agent, to process the event without looking like user-authored prompt.
|
|
47
|
+
// Create a new widget type for them.
|
|
48
|
+
return text ? new ReasoningWidget(text, range.from) : null;
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
reasoning: {
|
|
52
|
+
block: true,
|
|
53
|
+
streaming: true,
|
|
54
|
+
factory: ({ children, range }) => {
|
|
55
|
+
const text = getXmlTextChild(children);
|
|
56
|
+
return text ? new ReasoningWidget(text, range.from) : null;
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
reference: {
|
|
51
60
|
block: false,
|
|
52
61
|
factory: ({ children, ref }) => {
|
|
53
62
|
const text = getXmlTextChild(children);
|
|
54
63
|
return text && ref ? new ReferenceWidget(text, ref) : null;
|
|
55
64
|
},
|
|
56
65
|
},
|
|
57
|
-
|
|
66
|
+
select: {
|
|
58
67
|
block: true,
|
|
59
68
|
factory: ({ children }) => {
|
|
60
69
|
const options = children
|
|
@@ -63,45 +72,61 @@ export const componentRegistry: XmlWidgetRegistry = {
|
|
|
63
72
|
return options?.length ? new SelectWidget(options) : null;
|
|
64
73
|
},
|
|
65
74
|
},
|
|
66
|
-
|
|
75
|
+
suggestion: {
|
|
67
76
|
block: true,
|
|
68
77
|
factory: ({ children }) => {
|
|
69
78
|
const text = getXmlTextChild(children);
|
|
70
79
|
return text ? new SuggestionWidget(text) : null;
|
|
71
80
|
},
|
|
72
81
|
},
|
|
73
|
-
|
|
82
|
+
stats: {
|
|
74
83
|
block: true,
|
|
75
84
|
factory: ({ children }) => {
|
|
76
85
|
const text = getXmlTextChild(children);
|
|
77
|
-
return text ? new
|
|
86
|
+
return text ? new StatsWidget(text) : null;
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
status: {
|
|
90
|
+
block: true,
|
|
91
|
+
streaming: true,
|
|
92
|
+
factory: ({ children, range }) => {
|
|
93
|
+
const text = getXmlTextChild(children);
|
|
94
|
+
return text ? new StatusWidget(text, range.from) : null;
|
|
78
95
|
},
|
|
79
96
|
},
|
|
80
97
|
|
|
81
98
|
//
|
|
82
|
-
// React
|
|
99
|
+
// React Widgets (portaled outside of the editor)
|
|
83
100
|
//
|
|
84
101
|
|
|
85
|
-
|
|
102
|
+
summary: {
|
|
103
|
+
block: true,
|
|
104
|
+
Component: SummaryWidget,
|
|
105
|
+
},
|
|
106
|
+
toolCall: {
|
|
86
107
|
block: true,
|
|
87
|
-
Component:
|
|
108
|
+
Component: (props) => (
|
|
109
|
+
<div role='none' className='py-2'>
|
|
110
|
+
<ToolWidget {...props} />
|
|
111
|
+
</div>
|
|
112
|
+
),
|
|
88
113
|
},
|
|
89
|
-
|
|
114
|
+
toolResult: {
|
|
90
115
|
block: true,
|
|
91
|
-
Component:
|
|
116
|
+
Component: FallbackWidget,
|
|
92
117
|
},
|
|
93
|
-
|
|
118
|
+
toolkit: {
|
|
94
119
|
block: true,
|
|
95
|
-
Component:
|
|
120
|
+
Component: FallbackWidget,
|
|
96
121
|
},
|
|
97
122
|
|
|
98
123
|
//
|
|
99
124
|
// Fallback
|
|
100
125
|
//
|
|
101
126
|
|
|
102
|
-
|
|
127
|
+
json: {
|
|
103
128
|
block: true,
|
|
104
|
-
Component:
|
|
129
|
+
Component: FallbackWidget,
|
|
105
130
|
},
|
|
106
131
|
};
|
|
107
132
|
|
|
@@ -126,7 +151,11 @@ const blockToMarkdownImpl = (context: MessageThreadContext, message: Message.Mes
|
|
|
126
151
|
switch (block._tag) {
|
|
127
152
|
case 'text': {
|
|
128
153
|
if (message.sender.role === 'user') {
|
|
129
|
-
|
|
154
|
+
if (block.disposition === 'synthetic') {
|
|
155
|
+
return renderXMLBlock('synthetic', { content: block.text, pending: block.pending });
|
|
156
|
+
} else {
|
|
157
|
+
return `<prompt>${block.text}</prompt>`;
|
|
158
|
+
}
|
|
130
159
|
} else {
|
|
131
160
|
const text = block.text.trim();
|
|
132
161
|
if (text.length > 0) {
|
|
@@ -135,40 +164,84 @@ const blockToMarkdownImpl = (context: MessageThreadContext, message: Message.Mes
|
|
|
135
164
|
}
|
|
136
165
|
break;
|
|
137
166
|
}
|
|
167
|
+
|
|
138
168
|
case 'reference': {
|
|
169
|
+
if (block.pending) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
139
172
|
const dxn = block.reference.dxn;
|
|
140
173
|
return `<reference ref="${dxn.toString()}">${context.getObjectLabel(dxn)}</reference>`;
|
|
141
174
|
}
|
|
175
|
+
|
|
142
176
|
case 'suggestion': {
|
|
143
177
|
if (block.pending) {
|
|
144
178
|
return;
|
|
145
179
|
}
|
|
146
180
|
return `<suggestion>${block.text}</suggestion>`;
|
|
147
181
|
}
|
|
182
|
+
|
|
148
183
|
case 'select': {
|
|
149
184
|
if (block.pending || block.options.length === 0) {
|
|
150
185
|
return;
|
|
151
186
|
}
|
|
152
187
|
return `<select>${block.options.map((option) => `<option>${option}</option>`).join('')}</select>`;
|
|
153
188
|
}
|
|
189
|
+
|
|
154
190
|
case 'toolCall': {
|
|
155
|
-
context
|
|
156
|
-
blocks: [block],
|
|
157
|
-
});
|
|
191
|
+
applyToolBlockToWidgetState(context, block);
|
|
158
192
|
return `<toolCall id="${block.toolCallId}" />`;
|
|
159
193
|
}
|
|
194
|
+
|
|
160
195
|
case 'toolResult': {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}));
|
|
196
|
+
// TODO(dmaretskyi): the parameter could be undefined, perhaps tool blocks are not arriving in order.
|
|
197
|
+
applyToolBlockToWidgetState(context, block);
|
|
164
198
|
break;
|
|
165
199
|
}
|
|
200
|
+
|
|
201
|
+
case 'stats': {
|
|
202
|
+
return '';
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
case 'reasoning': {
|
|
206
|
+
let text = block.reasoningText ?? block.redactedText;
|
|
207
|
+
if (!text) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
return renderXMLBlock('reasoning', { content: text, pending: block.pending });
|
|
211
|
+
}
|
|
212
|
+
|
|
166
213
|
case 'summary': {
|
|
167
|
-
return
|
|
214
|
+
return renderXMLBlock('summary', { content: block.content, pending: block.pending });
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
case 'status': {
|
|
218
|
+
return renderXMLBlock('status', { content: block.statusText, pending: block.pending });
|
|
168
219
|
}
|
|
220
|
+
|
|
169
221
|
default: {
|
|
170
222
|
// TODO(burdon): Needs stable ID.
|
|
171
223
|
return `<json id="${message.id}">\n${JSON.stringify(block)}\n</json>`;
|
|
172
224
|
}
|
|
173
225
|
}
|
|
174
226
|
};
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Escape text embedded in generated XML so the mixed XML parser does not treat `&`, `<`, `>` as markup.
|
|
230
|
+
*/
|
|
231
|
+
const escapeXmlTextContent = (raw: string): string =>
|
|
232
|
+
raw.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
233
|
+
|
|
234
|
+
const renderXMLBlock = (tag: string, opts: { content?: string; pending?: boolean; attributes?: string }) => {
|
|
235
|
+
// Replace paragraph breaks so that the markdown parser does not split the content into multiple paragraphs.
|
|
236
|
+
// NOTE: do not strip leading list-marker prefixes (`-`, `*`, `1. `, ...) per line — the streaming
|
|
237
|
+
// tag's range is replaced atomically by the XML widget so the inner markdown is never user-visible,
|
|
238
|
+
// and stripping can collapse a line to empty mid-stream (e.g. when only `1. ` has arrived), breaking
|
|
239
|
+
// the prefix-extension contract that `MessageSyncer` relies on for incremental appends.
|
|
240
|
+
const content = escapeXmlTextContent((opts.content ?? '').replace(/\n\n/g, ' ').trim());
|
|
241
|
+
|
|
242
|
+
if (opts.pending) {
|
|
243
|
+
return `<${tag}${opts.attributes ? ` ${opts.attributes}` : ''}>${content}`;
|
|
244
|
+
} else {
|
|
245
|
+
return `<${tag}${opts.attributes ? ` ${opts.attributes}` : ''}>${content}</${tag}>`;
|
|
246
|
+
}
|
|
247
|
+
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
|
|
1
3
|
//
|
|
2
4
|
// Copyright 2025 DXOS.org
|
|
3
5
|
//
|
|
@@ -8,25 +10,25 @@ import * as Effect from 'effect/Effect';
|
|
|
8
10
|
|
|
9
11
|
import { Obj } from '@dxos/echo';
|
|
10
12
|
import { type Mutable } from '@dxos/echo/internal';
|
|
11
|
-
import { type ContentBlock } from '@dxos/types';
|
|
13
|
+
import { type ContentBlock, type Message } from '@dxos/types';
|
|
12
14
|
|
|
13
|
-
import { createMessage } from '
|
|
15
|
+
import { createMessage } from '#testing';
|
|
14
16
|
|
|
15
17
|
import { blockToMarkdown } from './registry';
|
|
16
|
-
import { MessageSyncer, type TextModel } from './sync';
|
|
18
|
+
import { type BlockRenderer, MessageSyncer, type MessageThreadContext, type TextModel } from './sync';
|
|
17
19
|
|
|
18
20
|
class TestDocument implements TextModel {
|
|
19
21
|
private readonly _view = new EditorView({ extensions: [] });
|
|
20
22
|
|
|
21
|
-
get
|
|
22
|
-
return this._view;
|
|
23
|
+
get length() {
|
|
24
|
+
return this._view.state.doc.length;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
get content() {
|
|
26
28
|
return this._view.state.doc.toString();
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
async
|
|
31
|
+
async setContent(text: string) {
|
|
30
32
|
this._view.dispatch({
|
|
31
33
|
changes: { from: 0, to: this._view.state.doc.length, insert: text },
|
|
32
34
|
});
|
|
@@ -53,13 +55,13 @@ describe('reducers', () => {
|
|
|
53
55
|
createMessage('assistant', [{ _tag: 'text', text: 'Hi there!' }]),
|
|
54
56
|
];
|
|
55
57
|
|
|
56
|
-
syncer.
|
|
58
|
+
syncer.update(messages);
|
|
57
59
|
expect(doc.content).toEqual(['<prompt>Hello</prompt>', 'Hi there!', ''].join('\n'));
|
|
58
60
|
|
|
59
|
-
Obj.change(messages[1], (
|
|
60
|
-
|
|
61
|
+
Obj.change(messages[1], (obj) => {
|
|
62
|
+
obj.blocks.push({ _tag: 'text', text: 'How can I help?' });
|
|
61
63
|
});
|
|
62
|
-
syncer.
|
|
64
|
+
syncer.update(messages);
|
|
63
65
|
expect(doc.content).toEqual(['<prompt>Hello</prompt>', 'Hi there!', 'How can I help?', ''].join('\n'));
|
|
64
66
|
}),
|
|
65
67
|
);
|
|
@@ -75,23 +77,115 @@ describe('reducers', () => {
|
|
|
75
77
|
createMessage('assistant', [{ _tag: 'text', text: 'Hi there!', pending: true }]),
|
|
76
78
|
];
|
|
77
79
|
|
|
78
|
-
syncer.
|
|
80
|
+
syncer.update(messages);
|
|
79
81
|
expect(doc.content).toEqual(['<prompt>Hello</prompt>', 'Hi there!'].join('\n'));
|
|
80
82
|
|
|
81
|
-
Obj.change(messages[1], (
|
|
82
|
-
const block =
|
|
83
|
+
Obj.change(messages[1], (obj) => {
|
|
84
|
+
const block = obj.blocks[0] as Mutable<ContentBlock.Text>;
|
|
83
85
|
block.text = 'Hi there! How are you?';
|
|
84
86
|
block.pending = false;
|
|
85
87
|
});
|
|
86
|
-
syncer.
|
|
88
|
+
syncer.update(messages);
|
|
87
89
|
|
|
88
|
-
Obj.change(messages[1], (
|
|
89
|
-
|
|
90
|
+
Obj.change(messages[1], (obj) => {
|
|
91
|
+
obj.blocks.push({ _tag: 'text', text: 'How can I help?' });
|
|
90
92
|
});
|
|
91
|
-
syncer.
|
|
93
|
+
syncer.update(messages);
|
|
92
94
|
expect(doc.content).toEqual(
|
|
93
95
|
['<prompt>Hello</prompt>', 'Hi there! How are you?', 'How can I help?', ''].join('\n'),
|
|
94
96
|
);
|
|
95
97
|
}),
|
|
96
98
|
);
|
|
99
|
+
|
|
100
|
+
// Regression: streaming reasoning text that passes through a bare list-marker state
|
|
101
|
+
// (e.g. `"…\n1. "`) used to make `stripBulletLikeLinePrefixes` collapse the line to empty,
|
|
102
|
+
// breaking the prefix-diff invariant in `MessageSyncer` and producing a duplicate `<reasoning>`
|
|
103
|
+
// opening tag in the document.
|
|
104
|
+
it.effect(
|
|
105
|
+
'streaming reasoning with list-marker transitions does not duplicate opening tag',
|
|
106
|
+
Effect.fn(function* ({ expect }) {
|
|
107
|
+
const doc = new TestDocument();
|
|
108
|
+
const syncer = new MessageSyncer(doc, blockToMarkdown);
|
|
109
|
+
|
|
110
|
+
const setReasoning = (message: Message.Message, text: string, pending: boolean) => {
|
|
111
|
+
Obj.change(message, (message) => {
|
|
112
|
+
const block = message.blocks[0] as Mutable<ContentBlock.Reasoning>;
|
|
113
|
+
block.reasoningText = text;
|
|
114
|
+
block.pending = pending;
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const messages = [createMessage('assistant', [{ _tag: 'reasoning', reasoningText: 'abc\n1', pending: true }])];
|
|
119
|
+
|
|
120
|
+
// Tick 1: `"abc\n1"` — `\d+[.)]\s` regex does not match (no dot/space yet).
|
|
121
|
+
syncer.update(messages);
|
|
122
|
+
|
|
123
|
+
// Tick 2: `"abc\n1."` — still no match (no trailing whitespace).
|
|
124
|
+
setReasoning(messages[0], 'abc\n1.', true);
|
|
125
|
+
syncer.update(messages);
|
|
126
|
+
|
|
127
|
+
// Tick 3: `"abc\n1. "` — line `"1. "` matches and is stripped to empty.
|
|
128
|
+
setReasoning(messages[0], 'abc\n1. ', true);
|
|
129
|
+
syncer.update(messages);
|
|
130
|
+
|
|
131
|
+
// Tick 4: `"abc\n1. foo"` — list item with content.
|
|
132
|
+
setReasoning(messages[0], 'abc\n1. foo', true);
|
|
133
|
+
syncer.update(messages);
|
|
134
|
+
|
|
135
|
+
// Tick 5: finalize.
|
|
136
|
+
setReasoning(messages[0], 'abc\n1. foo', false);
|
|
137
|
+
syncer.update(messages);
|
|
138
|
+
|
|
139
|
+
const openTagCount = (doc.content.match(/<reasoning>/g) ?? []).length;
|
|
140
|
+
const closeTagCount = (doc.content.match(/<\/reasoning>/g) ?? []).length;
|
|
141
|
+
expect(openTagCount).toBe(1);
|
|
142
|
+
expect(closeTagCount).toBe(1);
|
|
143
|
+
}),
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
// Direct test of `MessageSyncer`'s tolerance for non-monotonic renderer output —
|
|
147
|
+
// any renderer that produces a shorter string for the same streaming block (e.g., due
|
|
148
|
+
// to whitespace normalisation or future transforms) must not produce duplicate output.
|
|
149
|
+
it.effect(
|
|
150
|
+
'non-monotonic renderer output does not duplicate previously-emitted content',
|
|
151
|
+
Effect.fn(function* ({ expect }) {
|
|
152
|
+
const doc = new TestDocument();
|
|
153
|
+
|
|
154
|
+
const renderer: BlockRenderer = (_ctx: MessageThreadContext, _msg: Message.Message, block: ContentBlock.Any) => {
|
|
155
|
+
if (block._tag !== 'reasoning') {
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
const text = block.reasoningText ?? '';
|
|
159
|
+
// Simulate a non-monotonic transform: collapse a line that is a sole digit+dot+space.
|
|
160
|
+
const normalised = text
|
|
161
|
+
.split(/\r?\n/)
|
|
162
|
+
.map((line) => line.replace(/^\s*\d+[.)]\s$/, ''))
|
|
163
|
+
.join('\n')
|
|
164
|
+
.trim();
|
|
165
|
+
return block.pending ? `<reasoning>${normalised}` : `<reasoning>${normalised}</reasoning>\n`;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const syncer = new MessageSyncer(doc, renderer);
|
|
169
|
+
|
|
170
|
+
const messages = [createMessage('assistant', [{ _tag: 'reasoning', reasoningText: 'abc\n1.', pending: true }])];
|
|
171
|
+
|
|
172
|
+
syncer.update(messages);
|
|
173
|
+
Obj.change(messages[0], (obj) => {
|
|
174
|
+
const block = obj.blocks[0] as Mutable<ContentBlock.Reasoning>;
|
|
175
|
+
block.reasoningText = 'abc\n1. ';
|
|
176
|
+
});
|
|
177
|
+
syncer.update(messages);
|
|
178
|
+
Obj.change(messages[0], (obj) => {
|
|
179
|
+
const block = obj.blocks[0] as Mutable<ContentBlock.Reasoning>;
|
|
180
|
+
block.reasoningText = 'abc\n1. tail';
|
|
181
|
+
block.pending = false;
|
|
182
|
+
});
|
|
183
|
+
syncer.update(messages);
|
|
184
|
+
|
|
185
|
+
const openTagCount = (doc.content.match(/<reasoning>/g) ?? []).length;
|
|
186
|
+
const closeTagCount = (doc.content.match(/<\/reasoning>/g) ?? []).length;
|
|
187
|
+
expect(openTagCount).toBe(1);
|
|
188
|
+
expect(closeTagCount).toBe(1);
|
|
189
|
+
}),
|
|
190
|
+
);
|
|
97
191
|
});
|
|
@@ -3,15 +3,31 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type DXN } from '@dxos/echo';
|
|
6
|
-
import { log } from '@dxos/log';
|
|
7
6
|
import { type MarkdownStreamController } from '@dxos/react-ui-components';
|
|
8
7
|
import { type ContentBlock, type Message } from '@dxos/types';
|
|
9
8
|
import { type StateDispatch, type XmlWidgetStateManager } from '@dxos/ui-editor';
|
|
10
9
|
|
|
10
|
+
import { rehydrateToolWidgetsFromMessages } from './tool-widget-state';
|
|
11
|
+
|
|
11
12
|
/**
|
|
12
13
|
* Update document.
|
|
13
14
|
*/
|
|
14
|
-
export type TextModel = Pick<MarkdownStreamController, '
|
|
15
|
+
export type TextModel = Pick<MarkdownStreamController, 'length' | 'setContent' | 'append' | 'updateWidget'>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Renders a block to markdown.
|
|
19
|
+
*
|
|
20
|
+
* Contract: for any block whose lifetime spans multiple invocations (i.e. a streaming block
|
|
21
|
+
* with `pending: true` whose content grows over time, transitioning to `pending: false`), the
|
|
22
|
+
* sequence of returned strings must be monotonically extending — each subsequent value must be
|
|
23
|
+
* a string-extension of the previous. The {@link MessageSyncer} relies on this invariant to
|
|
24
|
+
* compute appendable deltas without diffing.
|
|
25
|
+
*/
|
|
26
|
+
export type BlockRenderer = (
|
|
27
|
+
context: MessageThreadContext,
|
|
28
|
+
message: Message.Message,
|
|
29
|
+
block: ContentBlock.Any,
|
|
30
|
+
) => string | undefined;
|
|
15
31
|
|
|
16
32
|
/**
|
|
17
33
|
* Thread context passed to renderer.
|
|
@@ -23,132 +39,112 @@ export class MessageThreadContext implements Pick<MarkdownStreamController, 'upd
|
|
|
23
39
|
this._widgetState?.updateWidget(id, value);
|
|
24
40
|
}
|
|
25
41
|
|
|
26
|
-
// TODO(burdon): Resolve from hypergraph.
|
|
42
|
+
// TODO(burdon): Resolve name from hypergraph.
|
|
27
43
|
getObjectLabel(_id: DXN) {
|
|
28
44
|
return 'Object';
|
|
29
45
|
}
|
|
30
46
|
}
|
|
31
47
|
|
|
32
|
-
/**
|
|
33
|
-
* Renders a block to markdown.
|
|
34
|
-
*/
|
|
35
|
-
export type BlockRenderer = (
|
|
36
|
-
context: MessageThreadContext,
|
|
37
|
-
message: Message.Message,
|
|
38
|
-
block: ContentBlock.Any,
|
|
39
|
-
) => string | undefined;
|
|
40
|
-
|
|
41
48
|
/**
|
|
42
49
|
* Syncs messages with the editor.
|
|
50
|
+
*
|
|
51
|
+
* Reflects the AI streaming contract:
|
|
52
|
+
* - Messages and their blocks are appended in order.
|
|
53
|
+
* - Only the last block in `messages` may be `pending`; all earlier blocks are finalized.
|
|
54
|
+
* - The renderer's output for a streaming block grows monotonically (see {@link BlockRenderer}).
|
|
55
|
+
* - The document is read-only outside this syncer.
|
|
56
|
+
*
|
|
57
|
+
* Under those rules the syncer needs only:
|
|
58
|
+
* - `_completed`: the flat-block index past which everything has been fully appended.
|
|
59
|
+
* - `_trailing`: chars of the in-flight block (at index `_completed`) already appended.
|
|
60
|
+
* - `_threadId`: identity sentinel; if `messages[0]?.id` changes, the document is replaced.
|
|
43
61
|
*/
|
|
44
62
|
export class MessageSyncer {
|
|
45
|
-
private
|
|
46
|
-
private
|
|
47
|
-
private
|
|
48
|
-
private _currentBlockContent?: string;
|
|
63
|
+
private _threadId?: string;
|
|
64
|
+
private _completed = 0;
|
|
65
|
+
private _trailing = 0;
|
|
49
66
|
|
|
50
67
|
private readonly _context: MessageThreadContext;
|
|
51
68
|
|
|
52
69
|
constructor(
|
|
53
|
-
private readonly
|
|
54
|
-
private readonly
|
|
70
|
+
private readonly _document: TextModel,
|
|
71
|
+
private readonly _renderer: BlockRenderer,
|
|
55
72
|
) {
|
|
56
|
-
this._context = new MessageThreadContext(this.
|
|
73
|
+
this._context = new MessageThreadContext(this._document);
|
|
57
74
|
}
|
|
58
75
|
|
|
59
76
|
get context() {
|
|
60
77
|
return this._context;
|
|
61
78
|
}
|
|
62
79
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.
|
|
69
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Replace the document with the rendering of `messages`. Use on mount, on thread switch,
|
|
82
|
+
* and from {@link update} when it detects an identity change in `messages[0]`.
|
|
83
|
+
*/
|
|
84
|
+
reset(messages: Message.Message[] = []): void {
|
|
85
|
+
this._threadId = messages[0]?.id;
|
|
86
|
+
this._completed = 0;
|
|
87
|
+
this._trailing = 0;
|
|
88
|
+
const buffer = this._walk(messages);
|
|
89
|
+
// Match the pre-rewrite behaviour: rendering from a steady state (initial mount with
|
|
90
|
+
// non-empty messages, or thread switch) lands the entire content via `setContent` — which
|
|
91
|
+
// uses `wireBypass`, so the editor jumps straight to the final text and `update()` returns
|
|
92
|
+
// `true` so the caller can scroll to the bottom. Live streaming partials that arrive
|
|
93
|
+
// *after* this initial render flow through `update()`'s incremental path → `_document.append`
|
|
94
|
+
// → wire's drip filter, preserving the char-by-char typewriter for incoming text.
|
|
95
|
+
void this._document.setContent(buffer).then(() => {
|
|
96
|
+
rehydrateToolWidgetsFromMessages(this._context, messages);
|
|
97
|
+
});
|
|
70
98
|
}
|
|
71
99
|
|
|
72
100
|
/**
|
|
73
|
-
*
|
|
101
|
+
* Stream the suffix of the rendered messages into the document.
|
|
102
|
+
* Returns `true` if the document was replaced (initial mount or thread switch), `false`
|
|
103
|
+
* if the call was a streaming append (or a no-op).
|
|
74
104
|
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
this.reset();
|
|
79
|
-
this._initialMessageId = messages[0]?.id;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (flush && this._model.view?.state.doc.length === 0) {
|
|
83
|
-
const buffer: string[] = [];
|
|
84
|
-
this.process(messages, (content) => {
|
|
85
|
-
buffer.push(content);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
const content = buffer.join('');
|
|
89
|
-
this._model.view?.dispatch({
|
|
90
|
-
changes: [
|
|
91
|
-
{
|
|
92
|
-
from: 0,
|
|
93
|
-
to: this._model.view?.state.doc.length ?? 0,
|
|
94
|
-
insert: content,
|
|
95
|
-
},
|
|
96
|
-
],
|
|
97
|
-
selection: { anchor: content.length },
|
|
98
|
-
});
|
|
99
|
-
|
|
105
|
+
update(messages: Message.Message[]): boolean {
|
|
106
|
+
if (messages[0]?.id !== this._threadId) {
|
|
107
|
+
this.reset(messages);
|
|
100
108
|
return true;
|
|
101
|
-
} else {
|
|
102
|
-
this.process(messages, (content) => {
|
|
103
|
-
void this._model.append(content);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
return false;
|
|
107
109
|
}
|
|
110
|
+
const buffer = this._walk(messages);
|
|
111
|
+
if (buffer.length > 0) {
|
|
112
|
+
void this._document.append(buffer);
|
|
113
|
+
}
|
|
114
|
+
return false;
|
|
108
115
|
}
|
|
109
116
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
for (const block of message.blocks.slice(this._currentBlockIndex)) {
|
|
128
|
-
this._currentBlockIndex = j;
|
|
129
|
-
const currentBlockContent = this._blockRenderer(this._context, message, block);
|
|
130
|
-
if (currentBlockContent) {
|
|
131
|
-
let content: string = '';
|
|
132
|
-
if (this._currentBlockContent && currentBlockContent.startsWith(this._currentBlockContent)) {
|
|
133
|
-
content = currentBlockContent.slice(this._currentBlockContent.length);
|
|
134
|
-
} else {
|
|
135
|
-
content = currentBlockContent;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
log('append', { message: i, block: j, content });
|
|
139
|
-
this._currentBlockContent = currentBlockContent;
|
|
140
|
-
append(content);
|
|
117
|
+
/**
|
|
118
|
+
* Walk flat blocks starting at `_completed`, advancing the cursors and returning the chars
|
|
119
|
+
* to append. Blocks before `_completed` are skipped — their renderer is never re-invoked,
|
|
120
|
+
* which preserves single-shot side effects (e.g. tool widget state mutation).
|
|
121
|
+
*/
|
|
122
|
+
_walk(messages: Message.Message[]): string {
|
|
123
|
+
let buffer = '';
|
|
124
|
+
let index = 0;
|
|
125
|
+
outer: for (const message of messages) {
|
|
126
|
+
for (const block of message.blocks) {
|
|
127
|
+
if (index < this._completed) {
|
|
128
|
+
index++;
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
const rendered = this._renderer(this._context, message, block) ?? '';
|
|
132
|
+
if (rendered.length > this._trailing) {
|
|
133
|
+
buffer += rendered.slice(this._trailing);
|
|
141
134
|
}
|
|
142
|
-
|
|
143
135
|
if (block.pending) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
this.
|
|
147
|
-
|
|
136
|
+
// Stay on this block; record how far we've appended so the next call can resume.
|
|
137
|
+
// `Math.max`-style guard against a non-monotonic renderer output without shrinking the doc.
|
|
138
|
+
if (rendered.length > this._trailing) {
|
|
139
|
+
this._trailing = rendered.length;
|
|
140
|
+
}
|
|
141
|
+
break outer;
|
|
148
142
|
}
|
|
149
|
-
|
|
143
|
+
this._completed = index + 1;
|
|
144
|
+
this._trailing = 0;
|
|
145
|
+
index++;
|
|
150
146
|
}
|
|
151
|
-
i++;
|
|
152
147
|
}
|
|
148
|
+
return buffer;
|
|
153
149
|
}
|
|
154
150
|
}
|