@dxos/plugin-assistant 0.8.4-main.9735255 → 0.8.4-main.9be5663bfe
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-RUV2WOQH.mjs +154 -0
- package/dist/lib/browser/chunk-RUV2WOQH.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-FR4AWZ2P.mjs +65 -0
- package/dist/lib/browser/ensure-companion-chat-FR4AWZ2P.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3163 -245
- 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-4YQ37XIS.mjs +136 -0
- package/dist/lib/browser/run-prompt-in-new-chat-4YQ37XIS.mjs.map +7 -0
- package/dist/lib/browser/set-current-chat-WJI3WAVM.mjs +54 -0
- package/dist/lib/browser/set-current-chat-WJI3WAVM.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-PY4X6FJT.mjs +155 -0
- package/dist/lib/node-esm/chunk-PY4X6FJT.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-BLP7NT32.mjs +66 -0
- package/dist/lib/node-esm/ensure-companion-chat-BLP7NT32.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +3163 -245
- 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-2IJBSDTM.mjs +137 -0
- package/dist/lib/node-esm/run-prompt-in-new-chat-2IJBSDTM.mjs.map +7 -0
- package/dist/lib/node-esm/set-current-chat-KBMMZULR.mjs +55 -0
- package/dist/lib/node-esm/set-current-chat-KBMMZULR.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.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 +41 -11
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +13 -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/settings.d.ts → settings.d.ts} +4 -3
- 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/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 +553 -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 -11
- 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.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +3 -3
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +535 -303
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts +573 -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 +6 -5
- 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 +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 +553 -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 +529 -295
- 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 +529 -295
- 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 +529 -295
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts +2 -2
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts.map +1 -1
- package/dist/types/src/components/Typewriter/Typewriter.d.ts.map +1 -1
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -12
- 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 +554 -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 +554 -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 +559 -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 +6 -0
- package/dist/types/src/containers/TracePanel/TracePanel.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/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/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +7 -6
- 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/useChatToolbarActions.d.ts +2 -2
- package/dist/types/src/hooks/useChatToolbarActions.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/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/processor.d.ts +33 -28
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts.map +1 -1
- 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/translations.d.ts +529 -295
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +17 -39
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +10 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +11 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -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 +120 -92
- package/src/AssistantPlugin.tsx +148 -52
- package/src/blueprints/assistant/blueprint.conversations.json +1 -0
- 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/{ai-service/ai-service.ts → ai-service.ts} +4 -3
- package/src/capabilities/app-graph-builder.ts +217 -0
- package/src/capabilities/blueprint-definition.ts +58 -0
- package/src/capabilities/companion-chat-provisioner.ts +164 -0
- package/src/capabilities/{edge-model-resolver/edge-model-resolver.ts → edge-model-resolver.ts} +4 -3
- package/src/capabilities/index.ts +22 -11
- package/src/capabilities/{local-model-resolver/local-model-resolver.ts → local-model-resolver.ts} +4 -3
- package/src/capabilities/markdown.ts +40 -0
- package/src/capabilities/migrations.ts +34 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +157 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +5 -4
- package/src/capabilities/{state/state.ts → state.ts} +11 -3
- package/src/capabilities/toolkit.ts +13 -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 +88 -45
- package/src/components/ChatProgress/ChatProgress.tsx +9 -7
- package/src/components/ChatPrompt/ChatActions.tsx +25 -5
- package/src/components/ChatPrompt/ChatOptions.tsx +43 -29
- package/src/components/ChatPrompt/ChatReferences.tsx +18 -8
- package/src/components/ChatThread/ChatThread.stories.tsx +31 -48
- package/src/components/ChatThread/ChatThread.tsx +28 -17
- package/src/components/ChatThread/Link.tsx +1 -1
- package/src/components/ChatThread/MarkdownStream.stories.tsx +243 -0
- package/src/components/ChatThread/registry.tsx +107 -43
- package/src/components/ChatThread/sync.test.ts +12 -10
- package/src/components/ChatThread/sync.ts +43 -32
- 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 +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 +85 -0
- package/src/components/ProcessTree/index.ts +5 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +4 -9
- package/src/components/TemplateEditor/TemplateEditor.tsx +50 -42
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +7 -6
- package/src/components/TemplateEditor/TemplateForm.tsx +9 -10
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +4 -4
- package/src/components/ToolBlock/ToolBlock.tsx +21 -20
- package/src/components/Toolbox/Toolbox.stories.tsx +4 -6
- package/src/components/Toolbox/Toolbox.tsx +66 -60
- package/src/components/Typewriter/AssistantToolbar.tsx +7 -7
- package/src/components/Typewriter/Typewriter.stories.tsx +18 -15
- package/src/components/Typewriter/Typewriter.tsx +6 -10
- package/src/components/Typewriter/assistant-extension.tsx +5 -8
- package/src/components/index.ts +3 -7
- package/src/containers/AgentArticle/AgentArticle.stories.tsx +105 -0
- package/src/containers/AgentArticle/AgentArticle.tsx +157 -0
- package/src/containers/AgentArticle/index.ts +5 -0
- package/src/containers/AgentProperties/AgentProperties.stories.tsx +91 -0
- package/src/containers/AgentProperties/AgentProperties.tsx +169 -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/{components → containers/ChatCompanion}/ChatCompanion.tsx +23 -44
- 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 +10 -12
- 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.tsx +361 -0
- package/src/containers/TracePanel/dxn-extractor.test.ts +153 -0
- package/src/containers/TracePanel/dxn-extractor.ts +178 -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/useBlueprintRegistry.ts +8 -4
- package/src/hooks/useChatProcessor.ts +30 -17
- package/src/hooks/useChatServices.ts +7 -28
- package/src/hooks/useChatToolbarActions.ts +13 -12
- 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/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 +2 -2
- package/src/processor/processor.test.ts +18 -50
- package/src/processor/processor.ts +190 -129
- package/src/queue-logger.ts +2 -2
- package/src/testing/test-generator.ts +45 -14
- package/src/testing/test-sequence.ts +3 -3
- package/src/testing/test-services.ts +2 -2
- package/src/translations.ts +134 -83
- package/src/types/Assistant.ts +8 -56
- 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 +3 -1
- package/src/types/service.ts +5 -5
- package/dist/lib/browser/BlueprintArticle-WP3G5GLG.mjs +0 -31
- package/dist/lib/browser/BlueprintArticle-WP3G5GLG.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-ECQYUQ2B.mjs +0 -153
- package/dist/lib/browser/ChatCompanion-ECQYUQ2B.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-QCCOFBUX.mjs +0 -73
- package/dist/lib/browser/ChatContainer-QCCOFBUX.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-SMK4RSZU.mjs +0 -85
- package/dist/lib/browser/ChatDialog-SMK4RSZU.mjs.map +0 -7
- package/dist/lib/browser/PromptArticle-K362ZPAE.mjs +0 -53
- package/dist/lib/browser/PromptArticle-K362ZPAE.mjs.map +0 -7
- package/dist/lib/browser/ai-service-5GUDOEWF.mjs +0 -21
- package/dist/lib/browser/ai-service-5GUDOEWF.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-DSNH2OMY.mjs +0 -212
- package/dist/lib/browser/app-graph-builder-DSNH2OMY.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-DGHH7MUU.mjs +0 -14
- package/dist/lib/browser/blueprint-definition-DGHH7MUU.mjs.map +0 -7
- package/dist/lib/browser/chunk-3JYPE2MM.mjs +0 -1832
- package/dist/lib/browser/chunk-3JYPE2MM.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-ML3QCFKA.mjs +0 -265
- package/dist/lib/browser/chunk-ML3QCFKA.mjs.map +0 -7
- package/dist/lib/browser/chunk-MRJVYGLU.mjs +0 -208
- package/dist/lib/browser/chunk-MRJVYGLU.mjs.map +0 -7
- package/dist/lib/browser/chunk-V772AMZM.mjs +0 -250
- package/dist/lib/browser/chunk-V772AMZM.mjs.map +0 -7
- package/dist/lib/browser/chunk-WGQTU6UJ.mjs +0 -41
- package/dist/lib/browser/chunk-WGQTU6UJ.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-26BOY6HY.mjs +0 -20
- package/dist/lib/browser/edge-model-resolver-26BOY6HY.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-ZFIM6GGV.mjs +0 -19
- package/dist/lib/browser/local-model-resolver-ZFIM6GGV.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-7XJLBRQY.mjs +0 -132
- package/dist/lib/browser/operation-resolver-7XJLBRQY.mjs.map +0 -7
- package/dist/lib/browser/react-surface-NCITRSJJ.mjs +0 -109
- package/dist/lib/browser/react-surface-NCITRSJJ.mjs.map +0 -7
- package/dist/lib/browser/repair-6QGAKOVM.mjs +0 -54
- package/dist/lib/browser/repair-6QGAKOVM.mjs.map +0 -7
- package/dist/lib/browser/settings-4ZDLUMYE.mjs +0 -32
- package/dist/lib/browser/settings-4ZDLUMYE.mjs.map +0 -7
- package/dist/lib/browser/state-AN6336ZX.mjs +0 -26
- package/dist/lib/browser/state-AN6336ZX.mjs.map +0 -7
- package/dist/lib/browser/toolkit-7AVTEPMA.mjs +0 -18
- package/dist/lib/browser/toolkit-7AVTEPMA.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintArticle-WZ76E2C4.mjs +0 -32
- package/dist/lib/node-esm/BlueprintArticle-WZ76E2C4.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-Q4FUZ2MW.mjs +0 -154
- package/dist/lib/node-esm/ChatCompanion-Q4FUZ2MW.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-AKI33HIB.mjs +0 -74
- package/dist/lib/node-esm/ChatContainer-AKI33HIB.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-AP45PVZR.mjs +0 -86
- package/dist/lib/node-esm/ChatDialog-AP45PVZR.mjs.map +0 -7
- package/dist/lib/node-esm/PromptArticle-D4HAIIC6.mjs +0 -54
- package/dist/lib/node-esm/PromptArticle-D4HAIIC6.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-PXKKCFIF.mjs +0 -22
- package/dist/lib/node-esm/ai-service-PXKKCFIF.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-TJCUEXW5.mjs +0 -213
- package/dist/lib/node-esm/app-graph-builder-TJCUEXW5.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-SEMDEIYG.mjs +0 -15
- package/dist/lib/node-esm/blueprint-definition-SEMDEIYG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-355W5B27.mjs +0 -251
- package/dist/lib/node-esm/chunk-355W5B27.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-DCA5QWQT.mjs +0 -209
- package/dist/lib/node-esm/chunk-DCA5QWQT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MSBPC4RJ.mjs +0 -42
- package/dist/lib/node-esm/chunk-MSBPC4RJ.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/chunk-XI5T3MJC.mjs +0 -1833
- package/dist/lib/node-esm/chunk-XI5T3MJC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZRIPP7YF.mjs +0 -267
- package/dist/lib/node-esm/chunk-ZRIPP7YF.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-G5KMODPO.mjs +0 -21
- package/dist/lib/node-esm/edge-model-resolver-G5KMODPO.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-KDZLYI7Y.mjs +0 -20
- package/dist/lib/node-esm/local-model-resolver-KDZLYI7Y.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-SX4WMNA7.mjs +0 -133
- package/dist/lib/node-esm/operation-resolver-SX4WMNA7.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-ST6V7LPE.mjs +0 -110
- package/dist/lib/node-esm/react-surface-ST6V7LPE.mjs.map +0 -7
- package/dist/lib/node-esm/repair-QJ7CQDKU.mjs +0 -55
- package/dist/lib/node-esm/repair-QJ7CQDKU.mjs.map +0 -7
- package/dist/lib/node-esm/settings-CQEOHR3R.mjs +0 -33
- package/dist/lib/node-esm/settings-CQEOHR3R.mjs.map +0 -7
- package/dist/lib/node-esm/state-HDON4REW.mjs +0 -27
- package/dist/lib/node-esm/state-HDON4REW.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-OWGCEKOO.mjs +0 -19
- package/dist/lib/node-esm/toolkit-OWGCEKOO.mjs.map +0 -7
- package/dist/types/src/blueprints/assistant-blueprint.d.ts +0 -209
- package/dist/types/src/blueprints/assistant-blueprint.d.ts.map +0 -1
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts +0 -5
- 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 -21
- 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 +0 -6
- 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 -12
- 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.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 -5
- 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/PromptArticle.d.ts +0 -7
- package/dist/types/src/components/PromptArticle.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 -95
- package/dist/types/src/types/AssistantAction.d.ts.map +0 -1
- package/src/blueprints/assistant-blueprint.ts +0 -62
- package/src/capabilities/ai-service/index.ts +0 -7
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -180
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +0 -60
- 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 -110
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -95
- package/src/capabilities/repair/index.ts +0 -7
- package/src/capabilities/repair/repair.ts +0 -63
- 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 -26
- package/src/components/BlueprintArticle.tsx +0 -29
- package/src/components/ChatContainer.tsx +0 -61
- package/src/components/PromptArticle.tsx +0 -50
- package/src/functions/index.ts +0 -7
- package/src/functions/object-list.ts +0 -49
- package/src/functions/object-load.ts +0 -47
- package/src/functions/object-search.ts +0 -46
- package/src/processor/update-name.ts +0 -59
- package/src/types/AssistantAction.ts +0 -75
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import type * as Tool from '@effect/ai/Tool';
|
|
6
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { NumericTabs, TextCrawl, TogglePanel, type TogglePanelRootProps } from '@dxos/react-ui-components';
|
|
10
|
+
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
11
|
+
import { type ContentBlock, type Message } from '@dxos/types';
|
|
12
|
+
import { type XmlWidgetProps } from '@dxos/ui-editor';
|
|
13
|
+
import { isNonNullable, safeParseJson } from '@dxos/util';
|
|
14
|
+
|
|
15
|
+
import { meta } from '#meta';
|
|
16
|
+
|
|
17
|
+
export const isToolMessage = (message: Message.Message) => {
|
|
18
|
+
return message.blocks.some((block: ContentBlock.Any) => block._tag === 'toolCall' || block._tag === 'toolResult');
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type ToolWidgetProps = XmlWidgetProps<{
|
|
22
|
+
blocks: ContentBlock.Any[];
|
|
23
|
+
}>;
|
|
24
|
+
|
|
25
|
+
export const ToolWidget = ({ view, blocks = [] }: ToolWidgetProps) => {
|
|
26
|
+
const { t } = useTranslation(meta.id);
|
|
27
|
+
|
|
28
|
+
const items = useMemo<ToolPanelProps['items']>(() => {
|
|
29
|
+
let lastToolCall: { tool: Tool.Any | undefined; block: ContentBlock.ToolCall } | undefined;
|
|
30
|
+
// TODO(burdon): Get from context?
|
|
31
|
+
const tools: Tool.Any[] = []; //processor.conversation.toolkit?.tools ?? [];
|
|
32
|
+
return blocks
|
|
33
|
+
.filter((block) => block._tag === 'toolCall' || block._tag === 'toolResult' || block._tag === 'stats')
|
|
34
|
+
.map((block) => {
|
|
35
|
+
switch (block._tag) {
|
|
36
|
+
case 'toolCall': {
|
|
37
|
+
if (block.pending && lastToolCall?.block.toolCallId === block.toolCallId) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const tool = tools.find((tool) => tool.name === block.name);
|
|
42
|
+
lastToolCall = { tool, block };
|
|
43
|
+
return {
|
|
44
|
+
title: tool?.description ?? [t('tool-call.label'), block.name].filter(Boolean).join(' '),
|
|
45
|
+
content: {
|
|
46
|
+
...block,
|
|
47
|
+
input: safeParseJson(block.input),
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
case 'toolResult': {
|
|
53
|
+
// TODO(burdon): Parse error type.
|
|
54
|
+
if (block.error) {
|
|
55
|
+
return {
|
|
56
|
+
title: t('tool-error.label'),
|
|
57
|
+
content: block,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const title =
|
|
62
|
+
lastToolCall?.tool?.description ??
|
|
63
|
+
[t('tool-result.label'), lastToolCall?.block.name].filter(Boolean).join(' ');
|
|
64
|
+
lastToolCall = undefined;
|
|
65
|
+
return {
|
|
66
|
+
title,
|
|
67
|
+
content: {
|
|
68
|
+
...block,
|
|
69
|
+
result: safeParseJson(block.result),
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
case 'stats': {
|
|
75
|
+
if (!lastToolCall) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
title: t('stats.label'),
|
|
81
|
+
content: block,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
.filter(isNonNullable);
|
|
87
|
+
}, [blocks, t]);
|
|
88
|
+
|
|
89
|
+
const handleChangeOpen = useCallback(() => {
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
// Measure after animation.
|
|
92
|
+
view?.requestMeasure();
|
|
93
|
+
}, 1_000);
|
|
94
|
+
}, [view]);
|
|
95
|
+
|
|
96
|
+
// Ignore if empty.
|
|
97
|
+
if (!items.length) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return <ToolPanel items={items} onChangeOpen={handleChangeOpen} />;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
type ToolPanelProps = {
|
|
105
|
+
items: { title: string; content: any }[];
|
|
106
|
+
} & Pick<TogglePanelRootProps, 'onChangeOpen'>;
|
|
107
|
+
|
|
108
|
+
const ToolPanel = ({ items, onChangeOpen }: ToolPanelProps) => {
|
|
109
|
+
const tabsRef = useRef<HTMLDivElement>(null);
|
|
110
|
+
const [selected, setSelected] = useState(0);
|
|
111
|
+
const [open, setOpen] = useState(false);
|
|
112
|
+
|
|
113
|
+
// Clamp selected to avoid out-of-bounds after items shrink.
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
setSelected((prev) => Math.min(prev, Math.max(0, items.length - 1)));
|
|
116
|
+
}, [items.length]);
|
|
117
|
+
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
onChangeOpen?.(open);
|
|
120
|
+
if (open) {
|
|
121
|
+
tabsRef.current?.focus();
|
|
122
|
+
}
|
|
123
|
+
}, [open, onChangeOpen]);
|
|
124
|
+
|
|
125
|
+
const handleSelect = useCallback((index: number) => {
|
|
126
|
+
setSelected(index);
|
|
127
|
+
}, []);
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<TogglePanel.Root open={open} onChangeOpen={setOpen}>
|
|
131
|
+
<TogglePanel.Header classNames='text-sm text-placeholder'>
|
|
132
|
+
<TextCrawl key='status-roll' lines={items.map((item) => item.title)} autoAdvance greedy />
|
|
133
|
+
</TogglePanel.Header>
|
|
134
|
+
<TogglePanel.Content>
|
|
135
|
+
<TogglePanel.Viewport classNames='grid grid-cols-[32px_1fr]'>
|
|
136
|
+
<NumericTabs
|
|
137
|
+
ref={tabsRef}
|
|
138
|
+
classNames='p-1'
|
|
139
|
+
length={items.length}
|
|
140
|
+
selected={selected}
|
|
141
|
+
onSelect={handleSelect}
|
|
142
|
+
/>
|
|
143
|
+
<Json.Data
|
|
144
|
+
data={items[selected]?.content}
|
|
145
|
+
classNames='p-1 text-xs bg-transparent'
|
|
146
|
+
replacer={{
|
|
147
|
+
maxDepth: 3,
|
|
148
|
+
maxArrayLen: 10,
|
|
149
|
+
maxStringLen: 128,
|
|
150
|
+
}}
|
|
151
|
+
/>
|
|
152
|
+
</TogglePanel.Viewport>
|
|
153
|
+
</TogglePanel.Content>
|
|
154
|
+
</TogglePanel.Root>
|
|
155
|
+
);
|
|
156
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
export * from './FallbackWidget';
|
|
6
|
+
export * from './PromptWidget';
|
|
7
|
+
export * from './ReasoningWidget';
|
|
8
|
+
export * from './ReferenceWidget';
|
|
9
|
+
export * from './SelectWidget';
|
|
10
|
+
export * from './StatsWidget';
|
|
11
|
+
export * from './SummaryWidget';
|
|
12
|
+
export * from './SuggestionWidget';
|
|
13
|
+
export * from './ToolWidget';
|
|
14
|
+
export * from './StatusWidget';
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
7
|
+
|
|
8
|
+
import { Process } from '@dxos/functions-runtime';
|
|
9
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
10
|
+
|
|
11
|
+
import { ProcessTree } from './ProcessTree';
|
|
12
|
+
|
|
13
|
+
const makeProcess = (
|
|
14
|
+
overrides: Partial<Process.Info> & Pick<Process.Info, 'pid' | 'state'> & { name: string },
|
|
15
|
+
): Process.Info => ({
|
|
16
|
+
parentPid: null,
|
|
17
|
+
key: `test.process.${overrides.name}`,
|
|
18
|
+
params: { name: overrides.name, target: null },
|
|
19
|
+
error: null,
|
|
20
|
+
startedAt: Date.now() - 10_000,
|
|
21
|
+
completedAt: Option.none(),
|
|
22
|
+
metrics: { wallTime: 0, inputCount: 0, outputCount: 0 },
|
|
23
|
+
...overrides,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const seedProcesses: Process.Info[] = [
|
|
27
|
+
makeProcess({
|
|
28
|
+
pid: Process.ID.make('97793611-815e-4a67-bc04-60fa67b2c987'),
|
|
29
|
+
name: 'Trigger watcher',
|
|
30
|
+
state: Process.State.RUNNING,
|
|
31
|
+
metrics: { wallTime: 4200, inputCount: 12, outputCount: 3 },
|
|
32
|
+
}),
|
|
33
|
+
makeProcess({
|
|
34
|
+
pid: Process.ID.make('531e9b15-57f5-472c-8cad-f81eb2a5b564'),
|
|
35
|
+
parentPid: Process.ID.make('97793611-815e-4a67-bc04-60fa67b2c987'),
|
|
36
|
+
name: 'Summarize document',
|
|
37
|
+
state: Process.State.SUCCEEDED,
|
|
38
|
+
completedAt: Option.some(Date.now() - 2_000),
|
|
39
|
+
metrics: { wallTime: 1500, inputCount: 1, outputCount: 1 },
|
|
40
|
+
}),
|
|
41
|
+
makeProcess({
|
|
42
|
+
pid: Process.ID.make('98c8d4b6-7b20-4267-a6df-4ca227bcb86d'),
|
|
43
|
+
parentPid: Process.ID.make('97793611-815e-4a67-bc04-60fa67b2c987'),
|
|
44
|
+
name: 'Translate content',
|
|
45
|
+
state: Process.State.HYBERNATING,
|
|
46
|
+
metrics: { wallTime: 800, inputCount: 1, outputCount: 0 },
|
|
47
|
+
}),
|
|
48
|
+
makeProcess({
|
|
49
|
+
pid: Process.ID.make('4d72c688-750b-47f2-87da-8a464e141b74'),
|
|
50
|
+
name: 'Data pipeline',
|
|
51
|
+
state: Process.State.FAILED,
|
|
52
|
+
error: 'Connection timeout',
|
|
53
|
+
metrics: { wallTime: 3100, inputCount: 5, outputCount: 2 },
|
|
54
|
+
}),
|
|
55
|
+
makeProcess({
|
|
56
|
+
pid: Process.ID.make('030098d2-4e77-4569-ae77-1c6c34bf0136'),
|
|
57
|
+
name: 'Idle listener',
|
|
58
|
+
state: Process.State.IDLE,
|
|
59
|
+
}),
|
|
60
|
+
makeProcess({
|
|
61
|
+
pid: Process.ID.make('0c4dca89-0e13-4ad7-aa7a-d10deb8333ed'),
|
|
62
|
+
name: 'Shutting down',
|
|
63
|
+
state: Process.State.TERMINATING,
|
|
64
|
+
}),
|
|
65
|
+
makeProcess({
|
|
66
|
+
pid: Process.ID.make('1620e57f-c9bf-4b76-b3b3-10f96c36a8b3'),
|
|
67
|
+
name: 'Completed cleanup',
|
|
68
|
+
state: Process.State.TERMINATED,
|
|
69
|
+
completedAt: Option.some(Date.now() - 5_000),
|
|
70
|
+
}),
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
const meta: Meta<typeof ProcessTree> = {
|
|
74
|
+
title: 'plugins/plugin-assistant/components/ProcessTree',
|
|
75
|
+
component: ProcessTree,
|
|
76
|
+
decorators: [withLayout({ layout: 'column', classNames: 'w-(--dx-complementary-sidebar-size)' }), withTheme()],
|
|
77
|
+
} satisfies Meta<typeof ProcessTree>;
|
|
78
|
+
|
|
79
|
+
export default meta;
|
|
80
|
+
|
|
81
|
+
type Story = StoryObj<typeof meta>;
|
|
82
|
+
|
|
83
|
+
export const Default: Story = {
|
|
84
|
+
args: {
|
|
85
|
+
processes: seedProcesses,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const AllRunning: Story = {
|
|
90
|
+
args: {
|
|
91
|
+
processes: [
|
|
92
|
+
makeProcess({
|
|
93
|
+
pid: Process.ID.make('1344bac8-745b-44a6-9af6-dc19509a7844'),
|
|
94
|
+
name: 'Agent alpha',
|
|
95
|
+
state: Process.State.RUNNING,
|
|
96
|
+
}),
|
|
97
|
+
makeProcess({
|
|
98
|
+
pid: Process.ID.make('b7c9787a-6705-47dc-a197-d37f1adfa338'),
|
|
99
|
+
name: 'Agent beta',
|
|
100
|
+
state: Process.State.RUNNING,
|
|
101
|
+
}),
|
|
102
|
+
makeProcess({
|
|
103
|
+
pid: Process.ID.make('43493533-a94c-4072-b18f-c0e0fd806bf5'),
|
|
104
|
+
name: 'Agent gamma',
|
|
105
|
+
state: Process.State.RUNNING,
|
|
106
|
+
}),
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Match from 'effect/Match';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Process } from '@dxos/functions-runtime';
|
|
9
|
+
import { Icon, ScrollArea, Treegrid } from '@dxos/react-ui';
|
|
10
|
+
import { composable, composableProps, mx } from '@dxos/ui-theme';
|
|
11
|
+
|
|
12
|
+
export type ProcessTreeProps = {
|
|
13
|
+
processes: readonly Process.Info[];
|
|
14
|
+
onProcessSelect?: (process: Process.Info) => void;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const ProcessTree = composable<HTMLDivElement, ProcessTreeProps>(
|
|
18
|
+
({ processes, onProcessSelect, ...props }, forwardedRef) => {
|
|
19
|
+
const filteredProcesses: Process.Info[] = [
|
|
20
|
+
...processes.filter((process) => [Process.State.RUNNING, Process.State.HYBERNATING].includes(process.state)),
|
|
21
|
+
...processes.filter((process) => [Process.State.IDLE].includes(process.state)).slice(0, 3),
|
|
22
|
+
...processes
|
|
23
|
+
.filter((process) =>
|
|
24
|
+
[Process.State.SUCCEEDED, Process.State.FAILED, Process.State.TERMINATED].includes(process.state),
|
|
25
|
+
)
|
|
26
|
+
.slice(0, 3),
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<ScrollArea.Root {...composableProps(props, { classNames: 'dx-expander' })} thin ref={forwardedRef}>
|
|
31
|
+
<ScrollArea.Viewport>
|
|
32
|
+
<Treegrid.Root gridTemplateColumns='1fr'>
|
|
33
|
+
{filteredProcesses
|
|
34
|
+
.filter((process) => process.parentPid === null)
|
|
35
|
+
.map((process) => {
|
|
36
|
+
const activeChildren = filteredProcesses.filter(
|
|
37
|
+
(candidate) =>
|
|
38
|
+
candidate.parentPid?.toString() === process.pid.toString() &&
|
|
39
|
+
candidate.state === Process.State.RUNNING,
|
|
40
|
+
);
|
|
41
|
+
return (
|
|
42
|
+
<Treegrid.Row
|
|
43
|
+
key={process.pid.toString()}
|
|
44
|
+
id={process.pid.toString()}
|
|
45
|
+
parentOf={process.parentPid?.toString()}
|
|
46
|
+
>
|
|
47
|
+
<Treegrid.Cell
|
|
48
|
+
indent
|
|
49
|
+
classNames='flex items-center p-1 gap-2 min-w-0'
|
|
50
|
+
onClick={() => onProcessSelect?.(process)}
|
|
51
|
+
>
|
|
52
|
+
<Icon
|
|
53
|
+
size={4}
|
|
54
|
+
icon={Match.value(process.state).pipe(
|
|
55
|
+
Match.when(Process.State.RUNNING, () => 'ph--spinner-gap--regular'),
|
|
56
|
+
Match.when(Process.State.SUCCEEDED, () => 'ph--check-circle--regular'),
|
|
57
|
+
Match.when(Process.State.FAILED, () => 'ph--warning--regular'),
|
|
58
|
+
Match.when(Process.State.HYBERNATING, () => 'ph--spinner--regular'),
|
|
59
|
+
Match.when(Process.State.IDLE, () => 'ph--hourglass--regular'),
|
|
60
|
+
Match.when(Process.State.TERMINATING, () => 'ph--x-circle--regular'),
|
|
61
|
+
Match.when(Process.State.TERMINATED, () => 'ph--x-circle--regular'),
|
|
62
|
+
Match.orElse(() => 'ph--spinner-gap--regular'),
|
|
63
|
+
)}
|
|
64
|
+
classNames={mx(
|
|
65
|
+
process.state === Process.State.RUNNING && 'animate-spin',
|
|
66
|
+
process.state === Process.State.FAILED && 'text-error-text',
|
|
67
|
+
process.state === Process.State.SUCCEEDED && 'text-success-text',
|
|
68
|
+
)}
|
|
69
|
+
/>
|
|
70
|
+
<div role='none' className='flex items-center gap-2 text-xs overflow-hidden'>
|
|
71
|
+
<span className='text-description'>{process.params.name}</span>
|
|
72
|
+
{activeChildren.length > 0 && (
|
|
73
|
+
<span className='text-xs text-description ml-1'>{activeChildren[0].params.name}</span>
|
|
74
|
+
)}
|
|
75
|
+
</div>
|
|
76
|
+
</Treegrid.Cell>
|
|
77
|
+
</Treegrid.Row>
|
|
78
|
+
);
|
|
79
|
+
})}
|
|
80
|
+
</Treegrid.Root>
|
|
81
|
+
</ScrollArea.Viewport>
|
|
82
|
+
</ScrollArea.Root>
|
|
83
|
+
);
|
|
84
|
+
},
|
|
85
|
+
);
|
|
@@ -13,7 +13,6 @@ import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
|
13
13
|
import { trim } from '@dxos/util';
|
|
14
14
|
|
|
15
15
|
import { translations } from '../../translations';
|
|
16
|
-
|
|
17
16
|
import { TemplateEditor, type TemplateEditorProps } from './TemplateEditor';
|
|
18
17
|
|
|
19
18
|
const FENCE = '```';
|
|
@@ -45,7 +44,7 @@ const TEMPLATE = trim`
|
|
|
45
44
|
const DefaultStory = ({ source }: TemplateEditorProps & { source: string }) => {
|
|
46
45
|
const client = useClient();
|
|
47
46
|
const [blueprint] = useState(() => {
|
|
48
|
-
const space = client.spaces.
|
|
47
|
+
const space = client.spaces.get()[0];
|
|
49
48
|
return space.db.add(
|
|
50
49
|
Blueprint.make({
|
|
51
50
|
key: 'example.com/blueprint/test',
|
|
@@ -56,20 +55,16 @@ const DefaultStory = ({ source }: TemplateEditorProps & { source: string }) => {
|
|
|
56
55
|
});
|
|
57
56
|
|
|
58
57
|
return (
|
|
59
|
-
<TemplateEditor
|
|
60
|
-
classNames='bg-baseSurface is-full max-is-proseMaxWidth'
|
|
61
|
-
id={blueprint.id}
|
|
62
|
-
template={blueprint.instructions}
|
|
63
|
-
/>
|
|
58
|
+
<TemplateEditor classNames='dx-document bg-base-surface' id={blueprint.id} template={blueprint.instructions} />
|
|
64
59
|
);
|
|
65
60
|
};
|
|
66
61
|
|
|
67
62
|
const meta = {
|
|
68
|
-
title: 'plugins/plugin-assistant/TemplateEditor',
|
|
63
|
+
title: 'plugins/plugin-assistant/components/TemplateEditor',
|
|
69
64
|
component: TemplateEditor as any,
|
|
70
65
|
render: DefaultStory,
|
|
71
66
|
decorators: [
|
|
72
|
-
withTheme,
|
|
67
|
+
withTheme(),
|
|
73
68
|
withLayout({ layout: 'column' }),
|
|
74
69
|
withClientProvider({
|
|
75
70
|
types: [Blueprint.Blueprint],
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { defaultHighlightStyle, syntaxHighlighting } from '@codemirror/language';
|
|
6
|
+
import { composeRefs } from '@radix-ui/react-compose-refs';
|
|
6
7
|
import React from 'react';
|
|
7
8
|
|
|
8
9
|
import { type Template } from '@dxos/blueprints';
|
|
9
10
|
import { createDocAccessor } from '@dxos/echo-db';
|
|
10
|
-
import {
|
|
11
|
+
import { useThemeContext, useTranslation } from '@dxos/react-ui';
|
|
11
12
|
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
12
13
|
import {
|
|
13
14
|
createBasicExtensions,
|
|
@@ -16,55 +17,62 @@ import {
|
|
|
16
17
|
createThemeExtensions,
|
|
17
18
|
decorateMarkdown,
|
|
18
19
|
} from '@dxos/ui-editor';
|
|
19
|
-
import {
|
|
20
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
20
21
|
import { isNonNullable } from '@dxos/util';
|
|
21
22
|
|
|
22
|
-
import { meta } from '
|
|
23
|
+
import { meta } from '#meta';
|
|
23
24
|
|
|
24
25
|
import { handlebars, xmlDecorator } from './extensions';
|
|
25
26
|
|
|
26
|
-
export type TemplateEditorProps =
|
|
27
|
+
export type TemplateEditorProps = {
|
|
27
28
|
id: string;
|
|
28
29
|
template: Template.Template;
|
|
29
30
|
lineNumbers?: boolean;
|
|
30
|
-
}
|
|
31
|
+
};
|
|
31
32
|
|
|
32
|
-
export const TemplateEditor =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
export const TemplateEditor = composable<HTMLDivElement, TemplateEditorProps>(
|
|
34
|
+
({ classNames, id, template, lineNumbers = true, ...props }, forwardedRef) => {
|
|
35
|
+
const { t } = useTranslation(meta.id);
|
|
36
|
+
const { themeMode } = useThemeContext();
|
|
37
|
+
const { parentRef } = useTextEditor(() => {
|
|
38
|
+
const text = template.source?.target;
|
|
39
|
+
if (!text) {
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
40
42
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
].filter(isNonNullable),
|
|
66
|
-
};
|
|
67
|
-
}, [themeMode, template.source?.target, lineNumbers]);
|
|
43
|
+
return {
|
|
44
|
+
initialValue: text.content ?? '',
|
|
45
|
+
extensions: [
|
|
46
|
+
createDataExtensions({
|
|
47
|
+
id,
|
|
48
|
+
text: createDocAccessor(text, ['content']),
|
|
49
|
+
}),
|
|
50
|
+
createBasicExtensions({
|
|
51
|
+
bracketMatching: false,
|
|
52
|
+
lineNumbers,
|
|
53
|
+
lineWrapping: true,
|
|
54
|
+
placeholder: t('template.placeholder'),
|
|
55
|
+
}),
|
|
56
|
+
createThemeExtensions({ themeMode }),
|
|
57
|
+
createMarkdownExtensions(),
|
|
58
|
+
decorateMarkdown(),
|
|
59
|
+
handlebars(),
|
|
60
|
+
// xml(),
|
|
61
|
+
// NOTE: Since we're using markdown only HTML nodes are parsed.
|
|
62
|
+
xmlDecorator(),
|
|
63
|
+
syntaxHighlighting(defaultHighlightStyle),
|
|
64
|
+
].filter(isNonNullable),
|
|
65
|
+
};
|
|
66
|
+
}, [themeMode, template.source?.target, lineNumbers]);
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
return (
|
|
69
|
+
<div
|
|
70
|
+
{...composableProps(props, {
|
|
71
|
+
role: 'none',
|
|
72
|
+
classNames: ['h-full overflow-hidden', classNames],
|
|
73
|
+
})}
|
|
74
|
+
ref={composeRefs(parentRef, forwardedRef)}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
},
|
|
78
|
+
);
|
|
@@ -7,13 +7,13 @@ import React, { useCallback, useState } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { Blueprint, Template } from '@dxos/blueprints';
|
|
9
9
|
import { Obj } from '@dxos/echo';
|
|
10
|
+
import { invariant } from '@dxos/invariant';
|
|
10
11
|
import { useClient } from '@dxos/react-client';
|
|
11
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
12
13
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
13
14
|
import { trim } from '@dxos/util';
|
|
14
15
|
|
|
15
16
|
import { translations } from '../../translations';
|
|
16
|
-
|
|
17
17
|
import { type TemplateChangeCallback, TemplateForm } from './TemplateForm';
|
|
18
18
|
|
|
19
19
|
const TEMPLATE = trim`
|
|
@@ -29,7 +29,8 @@ const TEMPLATE = trim`
|
|
|
29
29
|
const DefaultStory = () => {
|
|
30
30
|
const client = useClient();
|
|
31
31
|
const [blueprint] = useState(() => {
|
|
32
|
-
const space = client.spaces.
|
|
32
|
+
const space = client.spaces.get()[0];
|
|
33
|
+
invariant(space, 'TemplateForm story requires at least one space');
|
|
33
34
|
return space.db.add(
|
|
34
35
|
Blueprint.make({
|
|
35
36
|
key: 'example.com/blueprint/test',
|
|
@@ -41,24 +42,24 @@ const DefaultStory = () => {
|
|
|
41
42
|
|
|
42
43
|
const handleChange: TemplateChangeCallback = useCallback(
|
|
43
44
|
(mutate) => {
|
|
44
|
-
Obj.change(blueprint, (
|
|
45
|
+
Obj.change(blueprint, (blueprint) => mutate(blueprint.instructions));
|
|
45
46
|
},
|
|
46
47
|
[blueprint],
|
|
47
48
|
);
|
|
48
49
|
|
|
49
50
|
return (
|
|
50
|
-
<div role='none' className='flex
|
|
51
|
+
<div role='none' className='flex w-[40rem] border border-separator overflow-hidden'>
|
|
51
52
|
<TemplateForm id={blueprint.id} template={blueprint.instructions} onChange={handleChange} />
|
|
52
53
|
</div>
|
|
53
54
|
);
|
|
54
55
|
};
|
|
55
56
|
|
|
56
57
|
const meta = {
|
|
57
|
-
title: 'plugins/plugin-assistant/TemplateForm',
|
|
58
|
+
title: 'plugins/plugin-assistant/components/TemplateForm',
|
|
58
59
|
component: TemplateForm,
|
|
59
60
|
render: DefaultStory,
|
|
60
61
|
decorators: [
|
|
61
|
-
withTheme,
|
|
62
|
+
withTheme(),
|
|
62
63
|
withLayout({ layout: 'column' }),
|
|
63
64
|
withClientProvider({
|
|
64
65
|
types: [Blueprint.Blueprint],
|
|
@@ -8,10 +8,9 @@ import React, { Fragment, useCallback, useEffect } from 'react';
|
|
|
8
8
|
import { type Template } from '@dxos/blueprints';
|
|
9
9
|
import { type Obj } from '@dxos/echo';
|
|
10
10
|
import { Input, Select, useTranslation } from '@dxos/react-ui';
|
|
11
|
-
import { attentionSurface, groupBorder, mx } from '@dxos/ui-theme';
|
|
12
11
|
import { isNonNullable } from '@dxos/util';
|
|
13
12
|
|
|
14
|
-
import { meta } from '
|
|
13
|
+
import { meta } from '#meta';
|
|
15
14
|
|
|
16
15
|
import { TemplateEditor } from './TemplateEditor';
|
|
17
16
|
|
|
@@ -61,14 +60,14 @@ export const TemplateForm = ({ id, template, commandEditable = true, onChange }:
|
|
|
61
60
|
);
|
|
62
61
|
|
|
63
62
|
return (
|
|
64
|
-
<div className=
|
|
63
|
+
<div className='flex flex-col w-full overflow-hidden gap-4'>
|
|
65
64
|
{/* {commandEditable && (
|
|
66
65
|
<div className='flex items-center pl-4'>
|
|
67
66
|
<span className='text-neutral-500'>/</span>
|
|
68
67
|
<Input.Root>
|
|
69
68
|
<Input.TextInput
|
|
70
|
-
placeholder={t('command
|
|
71
|
-
classNames='
|
|
69
|
+
placeholder={t('command.placeholder')}
|
|
70
|
+
classNames='w-full bg-transparent m-2'
|
|
72
71
|
value={template.command ?? ''}
|
|
73
72
|
onChange={(event) => {
|
|
74
73
|
onChange?.((t) => {
|
|
@@ -80,20 +79,20 @@ export const TemplateForm = ({ id, template, commandEditable = true, onChange }:
|
|
|
80
79
|
</div>
|
|
81
80
|
)} */}
|
|
82
81
|
|
|
83
|
-
<TemplateEditor id={id} template={template} classNames=
|
|
82
|
+
<TemplateEditor id={id} template={template} classNames='bg-base-surface min-h-[120px]' />
|
|
84
83
|
|
|
85
84
|
{(template.inputs?.length ?? 0) > 0 && (
|
|
86
85
|
<div className='grid grid-cols-[10rem_10rem_1fr] gap-1 items-center'>
|
|
87
86
|
{template.inputs?.filter(isNonNullable).map((input) => (
|
|
88
87
|
<Fragment key={input.name}>
|
|
89
|
-
<div className='
|
|
88
|
+
<div className='ps-3 text-blue-text'>{input.name}</div>
|
|
90
89
|
|
|
91
90
|
<Input.Root>
|
|
92
91
|
<Select.Root
|
|
93
92
|
value={input.kind}
|
|
94
93
|
onValueChange={(kind) => handleInputKindChange(input.name, kind as Template.InputKind)}
|
|
95
94
|
>
|
|
96
|
-
<Select.TriggerButton placeholder='Type' classNames='
|
|
95
|
+
<Select.TriggerButton placeholder='Type' classNames='w-full' />
|
|
97
96
|
<Select.Portal>
|
|
98
97
|
<Select.Content>
|
|
99
98
|
<Select.Viewport>
|
|
@@ -114,8 +113,8 @@ export const TemplateForm = ({ id, template, commandEditable = true, onChange }:
|
|
|
114
113
|
<div>
|
|
115
114
|
<Input.Root>
|
|
116
115
|
<Input.TextInput
|
|
117
|
-
placeholder={t('command
|
|
118
|
-
classNames='
|
|
116
|
+
placeholder={t('command.placeholder')}
|
|
117
|
+
classNames='w-full bg-transparent'
|
|
119
118
|
value={input.default ?? ''}
|
|
120
119
|
onChange={(event) => handleInputDefaultChange(input.name, event.target.value)}
|
|
121
120
|
/>
|