@dxos/plugin-assistant 0.8.4-main.422d1c7879 → 0.8.4-main.51f1e5ca51
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-GG52BLKS.mjs +40 -0
- package/dist/lib/browser/AssistantSettings-GG52BLKS.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +26 -3
- package/dist/lib/browser/blueprints/index.mjs.map +4 -4
- package/dist/lib/browser/{chunk-ATHYBVGN.mjs → chunk-RIJNPAYC.mjs} +5 -5
- package/dist/lib/browser/chunk-RIJNPAYC.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LMVTXH54.mjs → chunk-SEMCG4ZK.mjs} +58 -17
- package/dist/lib/browser/chunk-SEMCG4ZK.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +3 -4
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- package/dist/lib/browser/{create-chat-LBZHGVSN.mjs → create-chat-FZJASOQS.mjs} +5 -13
- package/dist/lib/browser/create-chat-FZJASOQS.mjs.map +7 -0
- package/dist/lib/browser/{ensure-companion-chat-ZEZA34MZ.mjs → ensure-companion-chat-PHUWWFVY.mjs} +4 -4
- package/dist/lib/browser/ensure-companion-chat-PHUWWFVY.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +804 -880
- 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 → on-create-space-OQNCM7NC.mjs} +3 -3
- package/dist/lib/browser/{on-create-space-54RNX5JI.mjs.map → on-create-space-OQNCM7NC.mjs.map} +1 -1
- package/dist/lib/browser/operations/index.mjs +3 -3
- package/dist/lib/browser/operations/index.mjs.map +3 -3
- package/dist/lib/browser/{resolve-navigation-targets-NZOD66NY.mjs → resolve-navigation-targets-PMNR7D3P.mjs} +3 -3
- package/dist/lib/browser/{resolve-navigation-targets-NZOD66NY.mjs.map → resolve-navigation-targets-PMNR7D3P.mjs.map} +1 -1
- package/dist/lib/browser/{run-prompt-in-new-chat-THLK5YQC.mjs → run-prompt-in-new-chat-4XDYFKCV.mjs} +10 -39
- package/dist/lib/browser/run-prompt-in-new-chat-4XDYFKCV.mjs.map +7 -0
- package/dist/lib/browser/{set-current-chat-LRS3VFSH.mjs → set-current-chat-7V4DA66I.mjs} +4 -4
- package/dist/lib/browser/set-current-chat-7V4DA66I.mjs.map +7 -0
- package/dist/lib/browser/translations.mjs +171 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -3
- package/dist/lib/browser/{update-chat-name-3Y36KFAS.mjs → update-chat-name-ZGMU2UGN.mjs} +7 -22
- package/dist/lib/browser/update-chat-name-ZGMU2UGN.mjs.map +7 -0
- package/dist/lib/node-esm/AssistantSettings-23A5IMHS.mjs +41 -0
- package/dist/lib/node-esm/AssistantSettings-23A5IMHS.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +26 -3
- package/dist/lib/node-esm/blueprints/index.mjs.map +4 -4
- package/dist/lib/node-esm/{chunk-PXAJSTGZ.mjs → chunk-NCIZY5ZV.mjs} +5 -5
- package/dist/lib/node-esm/chunk-NCIZY5ZV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-W3JZ2F4T.mjs → chunk-XAFVSEUJ.mjs} +58 -17
- package/dist/lib/node-esm/chunk-XAFVSEUJ.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +3 -4
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- package/dist/lib/node-esm/{create-chat-3BEG4R6J.mjs → create-chat-RY6A4WUV.mjs} +5 -13
- package/dist/lib/node-esm/create-chat-RY6A4WUV.mjs.map +7 -0
- package/dist/lib/node-esm/{ensure-companion-chat-6K2WEWFP.mjs → ensure-companion-chat-BTDU5TS2.mjs} +4 -4
- package/dist/lib/node-esm/ensure-companion-chat-BTDU5TS2.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +804 -880
- 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 → on-create-space-4LWCYT3H.mjs} +3 -3
- package/dist/lib/node-esm/{on-create-space-YRPZ6HZY.mjs.map → on-create-space-4LWCYT3H.mjs.map} +1 -1
- package/dist/lib/node-esm/operations/index.mjs +3 -3
- package/dist/lib/node-esm/operations/index.mjs.map +3 -3
- package/dist/lib/node-esm/{resolve-navigation-targets-3PPK7XLH.mjs → resolve-navigation-targets-GHS3XPVP.mjs} +3 -3
- package/dist/lib/node-esm/{resolve-navigation-targets-3PPK7XLH.mjs.map → resolve-navigation-targets-GHS3XPVP.mjs.map} +1 -1
- package/dist/lib/node-esm/{run-prompt-in-new-chat-OUYKCMQ7.mjs → run-prompt-in-new-chat-UF54E34O.mjs} +10 -39
- package/dist/lib/node-esm/run-prompt-in-new-chat-UF54E34O.mjs.map +7 -0
- package/dist/lib/node-esm/{set-current-chat-SMXZJD3F.mjs → set-current-chat-SWPAOLZL.mjs} +4 -4
- package/dist/lib/node-esm/set-current-chat-SWPAOLZL.mjs.map +7 -0
- package/dist/lib/node-esm/translations.mjs +172 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -3
- package/dist/lib/node-esm/{update-chat-name-HM2P4NSI.mjs → update-chat-name-CW6K5M37.mjs} +7 -22
- package/dist/lib/node-esm/update-chat-name-CW6K5M37.mjs.map +7 -0
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/assistant/blueprint.d.ts +2 -2
- package/dist/types/src/blueprints/assistant/blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts.map +1 -1
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts +1 -1
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
- package/dist/types/src/capabilities/migrations.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
- package/dist/types/src/cli/plugin.d.ts.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.stories.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +29 -39
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/context.d.ts +29 -0
- package/dist/types/src/components/Chat/context.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +5 -3
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatPrompt.d.ts +28 -0
- package/dist/types/src/components/ChatPrompt/ChatPrompt.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatus.d.ts +20 -0
- package/dist/types/src/components/ChatPrompt/ChatStatus.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +2 -0
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Anchor.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +6 -3
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +4 -3
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts +1 -1
- package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts +18 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/tool-widget-state.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/FallbackWidget.d.ts +4 -4
- package/dist/types/src/components/ChatThread/widgets/FallbackWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/ReferenceWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/SelectWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/StatsWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/StatusWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/SuggestionWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/SummaryWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/defaults.d.ts +5 -0
- package/dist/types/src/components/ChatThread/widgets/defaults.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/index.d.ts +1 -2
- package/dist/types/src/components/ChatThread/widgets/index.d.ts.map +1 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts +2 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts.map +1 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts +0 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -2
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +3 -3
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -1
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +4 -4
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +3 -3
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/containers/AgentArticle/AgentArticle.d.ts.map +1 -1
- package/dist/types/src/containers/AgentArticle/AgentArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/AgentProperties/AgentProperties.d.ts.map +1 -1
- package/dist/types/src/containers/AgentProperties/AgentProperties.stories.d.ts.map +1 -1
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts +1 -1
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts.map +1 -1
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts +1 -1
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts +6 -0
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts.map +1 -0
- package/dist/types/src/containers/RoutineArticle/index.d.ts +2 -0
- package/dist/types/src/containers/RoutineArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/RoutineList/RoutineList.d.ts +6 -0
- package/dist/types/src/containers/RoutineList/RoutineList.d.ts.map +1 -0
- package/dist/types/src/containers/{PromptList/PromptList.stories.d.ts → RoutineList/RoutineList.stories.d.ts} +1 -1
- package/dist/types/src/containers/RoutineList/RoutineList.stories.d.ts.map +1 -0
- package/dist/types/src/containers/RoutineList/index.d.ts +2 -0
- package/dist/types/src/containers/RoutineList/index.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts +3 -2
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts +1 -4
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts +1 -1
- package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/execution-graph.d.ts +81 -1
- package/dist/types/src/containers/TracePanel/execution-graph.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/execution-graph.test.d.ts +2 -0
- package/dist/types/src/containers/TracePanel/execution-graph.test.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/index.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/testing/index.d.ts +3 -0
- package/dist/types/src/containers/TracePanel/testing/index.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/testing/simulated-agent.d.ts +14 -0
- package/dist/types/src/containers/TracePanel/testing/simulated-agent.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/testing/snapshot-playback.d.ts +12 -0
- package/dist/types/src/containers/TracePanel/testing/snapshot-playback.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +2 -2
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/extensions/prompt-extension.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +2 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatKeymap.d.ts +12 -0
- package/dist/types/src/hooks/useChatKeymap.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -1
- 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/useDebug.d.ts +10 -0
- package/dist/types/src/hooks/useDebug.d.ts.map +1 -0
- package/dist/types/src/hooks/useFilteredTypes.d.ts.map +1 -1
- package/dist/types/src/hooks/useFlush.d.ts +1 -1
- package/dist/types/src/hooks/useFlush.d.ts.map +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 +0 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/create-chat.d.ts +1 -1
- package/dist/types/src/operations/create-chat.d.ts.map +1 -1
- package/dist/types/src/operations/definitions.d.ts +24 -19
- package/dist/types/src/operations/definitions.d.ts.map +1 -1
- package/dist/types/src/operations/ensure-companion-chat.d.ts +1 -1
- package/dist/types/src/operations/ensure-companion-chat.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +1 -1
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/on-create-space.d.ts +1 -1
- package/dist/types/src/operations/on-create-space.d.ts.map +1 -1
- package/dist/types/src/operations/resolve-navigation-targets.d.ts +1 -1
- package/dist/types/src/operations/resolve-navigation-targets.d.ts.map +1 -1
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts +1 -1
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts.map +1 -1
- package/dist/types/src/operations/set-current-chat.d.ts +1 -1
- package/dist/types/src/operations/set-current-chat.d.ts.map +1 -1
- package/dist/types/src/operations/update-chat-name.d.ts +1 -1
- package/dist/types/src/operations/update-chat-name.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +2 -2
- 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/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +1 -1
- package/dist/types/src/testing/test-generator.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/testing/test-trace.d.ts +5 -0
- package/dist/types/src/testing/test-trace.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +22 -6
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +20 -5
- package/dist/types/src/types/Settings.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/events.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 +1 -1
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +95 -91
- package/src/AssistantPlugin.tsx +10 -12
- package/src/blueprints/assistant/blueprint.test.ts +3 -3
- package/src/blueprints/assistant/blueprint.ts +3 -3
- package/src/capabilities/app-graph-builder.ts +3 -3
- package/src/capabilities/blueprint-definition.ts +0 -4
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/markdown.ts +1 -1
- package/src/capabilities/migrations.ts +1 -8
- package/src/capabilities/operation-handler.ts +1 -1
- package/src/capabilities/react-surface.tsx +16 -10
- package/src/cli/plugin.ts +3 -4
- package/src/components/AssistantSettings/AssistantSettings.stories.tsx +3 -2
- package/src/components/AssistantSettings/AssistantSettings.tsx +22 -111
- package/src/components/Chat/Chat.tsx +56 -260
- package/src/components/Chat/context.ts +39 -0
- package/src/components/ChatPrompt/ChatActions.tsx +10 -10
- package/src/components/ChatPrompt/ChatOptions.stories.tsx +24 -10
- package/src/components/ChatPrompt/ChatOptions.tsx +60 -31
- package/src/components/ChatPrompt/ChatPrompt.tsx +179 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +1 -1
- package/src/components/ChatPrompt/ChatStatus.tsx +123 -0
- package/src/components/ChatPrompt/index.ts +2 -0
- package/src/components/ChatThread/ChatThread.stories.tsx +3 -3
- package/src/components/ChatThread/ChatThread.tsx +31 -18
- package/src/components/ChatThread/DEBUG.md +41 -0
- package/src/components/ChatThread/MarkdownStream.stories.tsx +5 -4
- package/src/components/ChatThread/registry.tsx +53 -14
- package/src/components/ChatThread/sync.test.ts +80 -12
- package/src/components/ChatThread/sync.ts +1 -1
- package/src/components/ChatThread/widgets/ReasoningWidget.ts +6 -6
- package/src/components/ChatThread/widgets/ReferenceWidget.ts +3 -1
- package/src/components/ChatThread/widgets/SelectWidget.ts +3 -1
- package/src/components/ChatThread/widgets/StatsWidget.ts +3 -1
- package/src/components/ChatThread/widgets/StatusWidget.ts +3 -1
- package/src/components/ChatThread/widgets/SuggestionWidget.ts +1 -1
- package/src/components/ChatThread/widgets/SummaryWidget.tsx +3 -2
- package/src/components/ChatThread/widgets/ToolWidget.stories.tsx +2 -1
- package/src/components/ChatThread/widgets/defaults.ts +8 -0
- package/src/components/ChatThread/widgets/index.ts +1 -2
- package/src/components/ProcessTree/ProcessTree.stories.tsx +12 -38
- package/src/components/ProcessTree/ProcessTree.tsx +67 -35
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +3 -2
- package/src/components/TemplateEditor/TemplateEditor.tsx +5 -5
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +4 -3
- package/src/components/TemplateEditor/TemplateForm.tsx +3 -3
- package/src/components/Toolbox/Toolbox.stories.tsx +2 -1
- package/src/components/Toolbox/Toolbox.tsx +2 -2
- package/src/containers/AgentArticle/AgentArticle.stories.tsx +1 -1
- package/src/containers/AgentArticle/AgentArticle.tsx +2 -2
- package/src/containers/AgentProperties/AgentProperties.stories.tsx +2 -1
- package/src/containers/AgentProperties/AgentProperties.tsx +2 -2
- package/src/containers/BlueprintArticle/BlueprintArticle.tsx +1 -1
- package/src/containers/ChatCompanion/ChatCompanion.tsx +1 -1
- package/src/containers/ChatContainer/ChatContainer.tsx +16 -6
- package/src/containers/ChatDialog/ChatDialog.tsx +3 -9
- package/src/containers/{PromptArticle/PromptArticle.tsx → RoutineArticle/RoutineArticle.tsx} +4 -4
- package/src/containers/RoutineArticle/index.ts +5 -0
- package/src/containers/{PromptList/PromptList.stories.tsx → RoutineList/RoutineList.stories.tsx} +10 -9
- package/src/containers/{PromptList/PromptList.tsx → RoutineList/RoutineList.tsx} +6 -5
- package/src/containers/RoutineList/index.ts +5 -0
- package/src/containers/TracePanel/TracePanel.stories.tsx +204 -198
- package/src/containers/TracePanel/TracePanel.tsx +69 -44
- package/src/containers/TracePanel/dxn-extractor.test.ts +7 -7
- package/src/containers/TracePanel/dxn-extractor.ts +4 -4
- package/src/containers/TracePanel/execution-graph.test.ts +382 -0
- package/src/containers/TracePanel/execution-graph.ts +340 -213
- package/src/containers/TracePanel/testing/index.ts +6 -0
- package/src/containers/TracePanel/testing/simulated-agent.ts +114 -0
- package/src/containers/TracePanel/testing/snapshot-playback.ts +45 -0
- package/src/containers/index.ts +2 -2
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useBlueprintRegistry.ts +1 -1
- package/src/hooks/useChatKeymap.ts +52 -0
- package/src/hooks/useChatProcessor.ts +1 -1
- package/src/hooks/useDebug.ts +38 -0
- package/src/index.ts +0 -3
- package/src/operations/create-chat.ts +2 -2
- package/src/operations/definitions.ts +4 -4
- package/src/operations/ensure-companion-chat.ts +1 -1
- package/src/operations/index.ts +1 -1
- package/src/operations/on-create-space.ts +1 -1
- package/src/operations/prompt.test.ts +5 -6
- package/src/operations/resolve-navigation-targets.ts +1 -1
- package/src/operations/run-prompt-in-new-chat.ts +3 -3
- package/src/operations/set-current-chat.ts +1 -1
- package/src/operations/update-chat-name.ts +2 -2
- package/src/processor/processor.test.ts +1 -1
- package/src/processor/processor.ts +4 -4
- package/src/queue-logger.ts +1 -1
- package/src/testing/data/trace-timeline.dx.json +3737 -1200
- package/src/testing/index.ts +1 -0
- package/src/testing/test-generator.test.ts +1 -1
- package/src/testing/test-generator.ts +4 -4
- package/src/testing/test-trace.ts +20 -0
- package/src/testing/trace-timeline.conversations.json +1 -1
- package/src/testing/trace-timeline.test.ts +53 -49
- package/src/translations.ts +24 -31
- package/src/types/Assistant.ts +11 -0
- package/src/types/Settings.ts +62 -7
- package/src/types/index.ts +0 -1
- package/src/types/service.ts +1 -1
- package/dist/lib/browser/AssistantSettings-7QMO3LGF.mjs +0 -97
- package/dist/lib/browser/AssistantSettings-7QMO3LGF.mjs.map +0 -7
- package/dist/lib/browser/chunk-ATHYBVGN.mjs.map +0 -7
- package/dist/lib/browser/chunk-EZRS3J25.mjs +0 -30
- package/dist/lib/browser/chunk-EZRS3J25.mjs.map +0 -7
- package/dist/lib/browser/chunk-LMVTXH54.mjs.map +0 -7
- package/dist/lib/browser/create-chat-LBZHGVSN.mjs.map +0 -7
- package/dist/lib/browser/ensure-companion-chat-ZEZA34MZ.mjs.map +0 -7
- package/dist/lib/browser/run-prompt-in-new-chat-THLK5YQC.mjs.map +0 -7
- package/dist/lib/browser/set-current-chat-LRS3VFSH.mjs.map +0 -7
- package/dist/lib/browser/update-chat-name-3Y36KFAS.mjs.map +0 -7
- package/dist/lib/node-esm/AssistantSettings-UVUTKO7E.mjs +0 -98
- package/dist/lib/node-esm/AssistantSettings-UVUTKO7E.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NZIKC7AN.mjs +0 -32
- package/dist/lib/node-esm/chunk-NZIKC7AN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PXAJSTGZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-W3JZ2F4T.mjs.map +0 -7
- package/dist/lib/node-esm/create-chat-3BEG4R6J.mjs.map +0 -7
- package/dist/lib/node-esm/ensure-companion-chat-6K2WEWFP.mjs.map +0 -7
- package/dist/lib/node-esm/run-prompt-in-new-chat-OUYKCMQ7.mjs.map +0 -7
- package/dist/lib/node-esm/set-current-chat-SMXZJD3F.mjs.map +0 -7
- package/dist/lib/node-esm/update-chat-name-HM2P4NSI.mjs.map +0 -7
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +0 -10
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +0 -1
- package/dist/types/src/components/ChatProgress/index.d.ts +0 -2
- package/dist/types/src/components/ChatProgress/index.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/widgets/PromptWidget.d.ts +0 -15
- package/dist/types/src/components/ChatThread/widgets/PromptWidget.d.ts.map +0 -1
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts +0 -6
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts.map +0 -1
- package/dist/types/src/containers/PromptArticle/index.d.ts +0 -2
- package/dist/types/src/containers/PromptArticle/index.d.ts.map +0 -1
- package/dist/types/src/containers/PromptList/PromptList.d.ts +0 -6
- package/dist/types/src/containers/PromptList/PromptList.d.ts.map +0 -1
- package/dist/types/src/containers/PromptList/PromptList.stories.d.ts.map +0 -1
- package/dist/types/src/containers/PromptList/index.d.ts +0 -2
- package/dist/types/src/containers/PromptList/index.d.ts.map +0 -1
- package/dist/types/src/types/defs.d.ts +0 -2
- package/dist/types/src/types/defs.d.ts.map +0 -1
- package/src/components/ChatProgress/ChatProgress.tsx +0 -56
- package/src/components/ChatProgress/index.ts +0 -5
- package/src/components/ChatThread/widgets/PromptWidget.ts +0 -30
- package/src/containers/PromptArticle/index.ts +0 -5
- package/src/containers/PromptList/index.ts +0 -5
- package/src/types/defs.ts +0 -5
|
@@ -1,44 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
blueprint_default
|
|
3
|
-
} from "./chunk-EZRS3J25.mjs";
|
|
4
|
-
import {
|
|
5
|
-
ApiAuthorization,
|
|
6
|
-
AssistantCapabilities,
|
|
7
|
-
AssistantEvents,
|
|
8
|
-
Assistant_exports,
|
|
9
|
-
LLM_PROVIDERS,
|
|
10
|
-
ServiceType,
|
|
11
|
-
categoryIcons
|
|
12
|
-
} from "./chunk-LMVTXH54.mjs";
|
|
13
1
|
import {
|
|
14
2
|
UpdateChatName
|
|
15
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RIJNPAYC.mjs";
|
|
16
4
|
import "./chunk-J5LGTIGS.mjs";
|
|
17
5
|
|
|
18
6
|
// src/components/index.ts
|
|
19
7
|
import { lazy } from "react";
|
|
20
8
|
|
|
21
9
|
// src/components/Chat/Chat.tsx
|
|
22
|
-
import {
|
|
23
|
-
import { keymap } from "@codemirror/view";
|
|
24
|
-
import { useAtomValue } from "@effect-atom/atom-react";
|
|
25
|
-
import { createContext } from "@radix-ui/react-context";
|
|
10
|
+
import { useAtomValue as useAtomValue2 } from "@effect-atom/atom-react";
|
|
26
11
|
import * as Array2 from "effect/Array";
|
|
27
|
-
import * as
|
|
28
|
-
import
|
|
12
|
+
import * as Option4 from "effect/Option";
|
|
13
|
+
import React13, { useCallback as useCallback5, useEffect as useEffect6, useMemo as useMemo5, useRef as useRef3, useState as useState7 } from "react";
|
|
29
14
|
import { Event } from "@dxos/async";
|
|
30
15
|
import { Filter as Filter2, Obj as Obj3 } from "@dxos/echo";
|
|
31
|
-
import { useVoiceInput } from "@dxos/plugin-transcription";
|
|
32
16
|
import { useQuery as useQuery2 } from "@dxos/react-client/echo";
|
|
33
17
|
import { useIdentity } from "@dxos/react-client/halo";
|
|
34
|
-
import { Input as Input2, useDynamicRef, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
35
|
-
import { ChatEditor } from "@dxos/react-ui-chat";
|
|
36
18
|
import { Menu } from "@dxos/react-ui-menu";
|
|
37
19
|
import { Message } from "@dxos/types";
|
|
38
|
-
import { composable, composableProps
|
|
39
|
-
import {
|
|
40
|
-
import { useChatToolbarActions } from "#hooks";
|
|
41
|
-
import { meta as meta6 } from "#meta";
|
|
20
|
+
import { composable, composableProps } from "@dxos/ui-theme";
|
|
21
|
+
import { useChatKeymapExtensions as useChatKeymapExtensions2, useChatToolbarActions, useDebug } from "#hooks";
|
|
42
22
|
|
|
43
23
|
// src/components/ChatPrompt/ChatActions.tsx
|
|
44
24
|
import React from "react";
|
|
@@ -48,17 +28,8 @@ import { meta } from "#meta";
|
|
|
48
28
|
var ChatActions = ({ classNames, children, microphone, recording, processing, debug, onEvent }) => {
|
|
49
29
|
const { t } = useTranslation(meta.id);
|
|
50
30
|
return /* @__PURE__ */ React.createElement("div", {
|
|
51
|
-
className: mx("flex items-center
|
|
52
|
-
}, children, /* @__PURE__ */ React.createElement(IconButton, {
|
|
53
|
-
disabled: !processing,
|
|
54
|
-
variant: "ghost",
|
|
55
|
-
icon: "ph--x--regular",
|
|
56
|
-
iconOnly: true,
|
|
57
|
-
label: t("cancel-processing.button"),
|
|
58
|
-
onClick: () => onEvent?.({
|
|
59
|
-
type: "cancel"
|
|
60
|
-
})
|
|
61
|
-
}), microphone && /* @__PURE__ */ React.createElement(IconButton, {
|
|
31
|
+
className: mx("flex items-center", classNames)
|
|
32
|
+
}, children, microphone && /* @__PURE__ */ React.createElement(IconButton, {
|
|
62
33
|
disabled: !processing,
|
|
63
34
|
classNames: mx(recording && "bg-primary-500"),
|
|
64
35
|
variant: "ghost",
|
|
@@ -86,6 +57,15 @@ var ChatActions = ({ classNames, children, microphone, recording, processing, de
|
|
|
86
57
|
onClick: () => onEvent?.({
|
|
87
58
|
type: "toggle-debug"
|
|
88
59
|
})
|
|
60
|
+
}), /* @__PURE__ */ React.createElement(IconButton, {
|
|
61
|
+
disabled: !processing,
|
|
62
|
+
variant: "ghost",
|
|
63
|
+
icon: "ph--x--regular",
|
|
64
|
+
iconOnly: true,
|
|
65
|
+
label: t("cancel-processing.button"),
|
|
66
|
+
onClick: () => onEvent?.({
|
|
67
|
+
type: "cancel"
|
|
68
|
+
})
|
|
89
69
|
}));
|
|
90
70
|
};
|
|
91
71
|
|
|
@@ -94,22 +74,23 @@ import * as Option from "effect/Option";
|
|
|
94
74
|
import React2, { useCallback, useMemo, useState } from "react";
|
|
95
75
|
import { McpServer } from "@dxos/assistant-toolkit";
|
|
96
76
|
import { Annotation, Filter, Obj, Type } from "@dxos/echo";
|
|
97
|
-
import { useQuery } from "@dxos/react-client/echo";
|
|
77
|
+
import { useObject, useQuery } from "@dxos/react-client/echo";
|
|
98
78
|
import { IconButton as IconButton2, Input, Popover, Select, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
99
79
|
import { Listbox, SearchList, useSearchListResults } from "@dxos/react-ui-search";
|
|
100
80
|
import { Tabs } from "@dxos/react-ui-tabs";
|
|
101
81
|
import { getStyles, mx as mx2 } from "@dxos/ui-theme";
|
|
102
82
|
import { useActiveBlueprints, useBlueprintHandlers, useBlueprints, useContextObjects, useFilteredTypes } from "#hooks";
|
|
103
83
|
import { meta as meta2 } from "#meta";
|
|
84
|
+
import { Assistant } from "#types";
|
|
104
85
|
var styles = {
|
|
105
|
-
panel: "w-[calc(100dvw-.5rem)] sm:w-max
|
|
106
|
-
toolbar: "p-
|
|
86
|
+
panel: "w-[calc(100dvw-.5rem)] sm:w-max max-w-document-width",
|
|
87
|
+
toolbar: "p-0! gap-0! border-t border-separator"
|
|
107
88
|
};
|
|
108
|
-
var ChatOptions = ({ db, context, blueprintRegistry, presets, preset, onPresetChange }) => {
|
|
89
|
+
var ChatOptions = ({ chat, db, context, blueprintRegistry, presets, preset, onPresetChange }) => {
|
|
109
90
|
const { t } = useTranslation2(meta2.id);
|
|
110
91
|
return /* @__PURE__ */ React2.createElement("div", {
|
|
111
92
|
role: "none",
|
|
112
|
-
className: "flex
|
|
93
|
+
className: "flex"
|
|
113
94
|
}, /* @__PURE__ */ React2.createElement(Popover.Root, null, /* @__PURE__ */ React2.createElement(Popover.Trigger, {
|
|
114
95
|
asChild: true
|
|
115
96
|
}, /* @__PURE__ */ React2.createElement(IconButton2, {
|
|
@@ -134,49 +115,61 @@ var ChatOptions = ({ db, context, blueprintRegistry, presets, preset, onPresetCh
|
|
|
134
115
|
side: "top",
|
|
135
116
|
classNames: styles.panel
|
|
136
117
|
}, /* @__PURE__ */ React2.createElement(Popover.Viewport, null, /* @__PURE__ */ React2.createElement(Tabs.Root, {
|
|
118
|
+
classNames: "flex",
|
|
137
119
|
orientation: "horizontal",
|
|
138
|
-
defaultValue: "
|
|
120
|
+
defaultValue: "view",
|
|
139
121
|
defaultActivePart: "list",
|
|
140
122
|
tabIndex: -1
|
|
141
123
|
}, /* @__PURE__ */ React2.createElement(Tabs.Viewport, {
|
|
142
|
-
|
|
143
|
-
classNames: mx2("max-h-(--radix-popover-content-available-height) grid grid-rows-[1fr_min-content]", '[&_[cmdk-root]]:contents [&_[role="tabpanel"]]:grid [&_[role="tabpanel"]]:grid-rows-[1fr_min-content]', '[&_[role="listbox"]]:min-h-0 [&_[role="listbox"]]:overflow-y-auto', '[&_[role="tabpanel"]]:min-h-0 [&_[role="tabpanel"]]:px-form-chrome [&_[role="tabpanel"][data-state="active"]]:order-first [&_[role="tabpanel"][data-state="inactive"]]:hidden')
|
|
124
|
+
classNames: mx2("grid grid-rows-[1fr_40px] w-full")
|
|
144
125
|
}, /* @__PURE__ */ React2.createElement(Tabs.Panel, {
|
|
145
|
-
value: "model",
|
|
146
|
-
tabIndex: -1,
|
|
147
|
-
classNames: "dx-focus-ring-inset"
|
|
148
|
-
}, /* @__PURE__ */ React2.createElement(ModelsPanel, {
|
|
149
|
-
presets,
|
|
150
|
-
preset,
|
|
151
|
-
onPresetChange
|
|
152
|
-
})), /* @__PURE__ */ React2.createElement(Tabs.Panel, {
|
|
153
|
-
value: "mcp-servers",
|
|
154
126
|
tabIndex: -1,
|
|
155
|
-
classNames: "dx-focus-ring-inset"
|
|
156
|
-
|
|
157
|
-
|
|
127
|
+
classNames: "dx-focus-ring-inset overflow-hidden",
|
|
128
|
+
value: "view"
|
|
129
|
+
}, /* @__PURE__ */ React2.createElement(ViewPanel, {
|
|
130
|
+
chat
|
|
158
131
|
})), /* @__PURE__ */ React2.createElement(Tabs.Panel, {
|
|
159
|
-
value: "blueprints",
|
|
160
132
|
tabIndex: -1,
|
|
161
|
-
classNames: "dx-focus-ring-inset"
|
|
133
|
+
classNames: "dx-focus-ring-inset overflow-hidden",
|
|
134
|
+
value: "blueprints"
|
|
162
135
|
}, /* @__PURE__ */ React2.createElement(BlueprintsPanel, {
|
|
163
136
|
blueprintRegistry,
|
|
164
137
|
db,
|
|
165
138
|
context
|
|
139
|
+
})), /* @__PURE__ */ React2.createElement(Tabs.Panel, {
|
|
140
|
+
tabIndex: -1,
|
|
141
|
+
classNames: "dx-focus-ring-inset overflow-hidden",
|
|
142
|
+
value: "mcp-servers"
|
|
143
|
+
}, /* @__PURE__ */ React2.createElement(McpServersPanel, {
|
|
144
|
+
db
|
|
145
|
+
})), /* @__PURE__ */ React2.createElement(Tabs.Panel, {
|
|
146
|
+
tabIndex: -1,
|
|
147
|
+
classNames: "dx-focus-ring-inset overflow-hidden",
|
|
148
|
+
value: "model"
|
|
149
|
+
}, /* @__PURE__ */ React2.createElement(ModelsPanel, {
|
|
150
|
+
presets,
|
|
151
|
+
preset,
|
|
152
|
+
onPresetChange
|
|
166
153
|
})), /* @__PURE__ */ React2.createElement(Tabs.Tablist, {
|
|
167
|
-
classNames:
|
|
154
|
+
classNames: [
|
|
155
|
+
styles.toolbar
|
|
156
|
+
]
|
|
168
157
|
}, /* @__PURE__ */ React2.createElement(Tabs.IconTab, {
|
|
169
|
-
value: "
|
|
170
|
-
icon: "ph--
|
|
171
|
-
label: t("chat-
|
|
158
|
+
value: "view",
|
|
159
|
+
icon: "ph--eye--regular",
|
|
160
|
+
label: t("chat-view.title")
|
|
172
161
|
}), /* @__PURE__ */ React2.createElement(Tabs.IconTab, {
|
|
173
162
|
value: "blueprints",
|
|
174
163
|
icon: "ph--blueprint--regular",
|
|
175
|
-
label: t("blueprints
|
|
164
|
+
label: t("options.blueprints.title")
|
|
176
165
|
}), /* @__PURE__ */ React2.createElement(Tabs.IconTab, {
|
|
177
166
|
value: "mcp-servers",
|
|
178
167
|
icon: "ph--plugs-connected--regular",
|
|
179
|
-
label: t("mcp
|
|
168
|
+
label: t("options.mcp.title")
|
|
169
|
+
}), /* @__PURE__ */ React2.createElement(Tabs.IconTab, {
|
|
170
|
+
value: "model",
|
|
171
|
+
icon: "ph--cpu--regular",
|
|
172
|
+
label: t("options.chat-model.title")
|
|
180
173
|
}))))), /* @__PURE__ */ React2.createElement(Popover.Arrow, null)))));
|
|
181
174
|
};
|
|
182
175
|
var BlueprintsPanel = ({ blueprintRegistry, db, context }) => {
|
|
@@ -200,7 +193,7 @@ var BlueprintsPanel = ({ blueprintRegistry, db, context }) => {
|
|
|
200
193
|
return /* @__PURE__ */ React2.createElement(SearchList.Root, {
|
|
201
194
|
onSearch: handleSearch
|
|
202
195
|
}, /* @__PURE__ */ React2.createElement(SearchList.Content, {
|
|
203
|
-
classNames: "
|
|
196
|
+
classNames: "flex flex-col"
|
|
204
197
|
}, /* @__PURE__ */ React2.createElement(SearchList.Viewport, null, results.map((blueprint) => {
|
|
205
198
|
const isActive = activeBlueprints.has(blueprint.key);
|
|
206
199
|
return /* @__PURE__ */ React2.createElement(SearchList.Item, {
|
|
@@ -211,11 +204,26 @@ var BlueprintsPanel = ({ blueprintRegistry, db, context }) => {
|
|
|
211
204
|
checked: isActive,
|
|
212
205
|
onSelect: () => onUpdateBlueprint?.(blueprint.key, !isActive)
|
|
213
206
|
});
|
|
214
|
-
}))
|
|
207
|
+
})), /* @__PURE__ */ React2.createElement(SearchList.Input, {
|
|
215
208
|
placeholder: t("search.placeholder"),
|
|
216
|
-
classNames: "
|
|
209
|
+
classNames: "border-t border-separator",
|
|
217
210
|
autoFocus: true
|
|
218
|
-
}));
|
|
211
|
+
})));
|
|
212
|
+
};
|
|
213
|
+
var ViewPanel = ({ chat }) => {
|
|
214
|
+
const { t } = useTranslation2(meta2.id);
|
|
215
|
+
const [view, setView] = useObject(chat, "view");
|
|
216
|
+
const value2 = view ?? "normal";
|
|
217
|
+
return /* @__PURE__ */ React2.createElement(Listbox.Root, {
|
|
218
|
+
value: value2,
|
|
219
|
+
onValueChange: setView,
|
|
220
|
+
autoFocus: true
|
|
221
|
+
}, Assistant.ChatViews.map((view2) => /* @__PURE__ */ React2.createElement(Listbox.Option, {
|
|
222
|
+
key: view2,
|
|
223
|
+
value: view2
|
|
224
|
+
}, /* @__PURE__ */ React2.createElement(Listbox.OptionLabel, null, t(`chat-view.${view2}.label`, {
|
|
225
|
+
defaultValue: view2
|
|
226
|
+
})), /* @__PURE__ */ React2.createElement(Listbox.OptionIndicator, null))));
|
|
219
227
|
};
|
|
220
228
|
var ModelsPanel = ({ presets, preset, onPresetChange }) => {
|
|
221
229
|
return /* @__PURE__ */ React2.createElement(Listbox.Root, {
|
|
@@ -246,7 +254,7 @@ var McpServersPanel = ({ db }) => {
|
|
|
246
254
|
db
|
|
247
255
|
]);
|
|
248
256
|
const handleToggle = useCallback((server, enabled) => {
|
|
249
|
-
Obj.
|
|
257
|
+
Obj.update(server, (server2) => {
|
|
250
258
|
server2.enabled = enabled;
|
|
251
259
|
});
|
|
252
260
|
}, []);
|
|
@@ -256,7 +264,7 @@ var McpServersPanel = ({ db }) => {
|
|
|
256
264
|
db
|
|
257
265
|
]);
|
|
258
266
|
return /* @__PURE__ */ React2.createElement("div", {
|
|
259
|
-
className: "
|
|
267
|
+
className: "p-form-chrome"
|
|
260
268
|
}, servers.map((server) => /* @__PURE__ */ React2.createElement("div", {
|
|
261
269
|
key: server.id,
|
|
262
270
|
className: "flex items-center gap-2 px-form-chrome"
|
|
@@ -279,8 +287,7 @@ var McpServersPanel = ({ db }) => {
|
|
|
279
287
|
onSubmit: handleAdd,
|
|
280
288
|
onCancel: () => setAdding(false)
|
|
281
289
|
}) : /* @__PURE__ */ React2.createElement("div", {
|
|
282
|
-
role: "none"
|
|
283
|
-
className: "px-form-chrome"
|
|
290
|
+
role: "none"
|
|
284
291
|
}, /* @__PURE__ */ React2.createElement(IconButton2, {
|
|
285
292
|
variant: "ghost",
|
|
286
293
|
icon: "ph--plus--regular",
|
|
@@ -399,13 +406,13 @@ var ObjectsPanel = ({ db, context }) => {
|
|
|
399
406
|
icon: "ph--cube--regular",
|
|
400
407
|
hue: void 0
|
|
401
408
|
})));
|
|
402
|
-
const
|
|
409
|
+
const styles3 = hue ? getStyles(hue) : void 0;
|
|
403
410
|
return /* @__PURE__ */ React2.createElement(SearchList.Item, {
|
|
404
411
|
classNames: "flex items-center overflow-hidden",
|
|
405
412
|
key: object.id,
|
|
406
413
|
value: object.id,
|
|
407
414
|
icon,
|
|
408
|
-
iconClassNames:
|
|
415
|
+
iconClassNames: styles3?.surfaceText,
|
|
409
416
|
label: Obj.getLabel(object) ?? Obj.getTypename(object) ?? object.id,
|
|
410
417
|
checked: isActive,
|
|
411
418
|
onSelect: () => onUpdateObject?.(Obj.getDXN(object), !isActive)
|
|
@@ -436,6 +443,17 @@ var ObjectsPanel = ({ db, context }) => {
|
|
|
436
443
|
import React3 from "react";
|
|
437
444
|
import { Select as Select2 } from "@dxos/react-ui";
|
|
438
445
|
|
|
446
|
+
// src/components/ChatPrompt/ChatPrompt.tsx
|
|
447
|
+
import { useAtomValue } from "@effect-atom/atom-react";
|
|
448
|
+
import * as Option3 from "effect/Option";
|
|
449
|
+
import React6, { useCallback as useCallback2, useEffect as useEffect2, useRef, useState as useState3 } from "react";
|
|
450
|
+
import { useVoiceInput } from "@dxos/plugin-transcription";
|
|
451
|
+
import { Input as Input2, useDynamicRef, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
452
|
+
import { ChatEditor } from "@dxos/react-ui-chat";
|
|
453
|
+
import { mx as mx5 } from "@dxos/ui-theme";
|
|
454
|
+
import { useChatKeymapExtensions } from "#hooks";
|
|
455
|
+
import { meta as meta4 } from "#meta";
|
|
456
|
+
|
|
439
457
|
// src/components/ChatPrompt/ChatReferences.tsx
|
|
440
458
|
import * as Option2 from "effect/Option";
|
|
441
459
|
import React4 from "react";
|
|
@@ -465,7 +483,7 @@ var ChatReferences = ({ classNames, context, db }) => {
|
|
|
465
483
|
icon: DEFAULT_OBJECT_ICON,
|
|
466
484
|
hue: void 0
|
|
467
485
|
})));
|
|
468
|
-
const
|
|
486
|
+
const styles3 = hue ? getStyles2(hue) : void 0;
|
|
469
487
|
return /* @__PURE__ */ React4.createElement("li", {
|
|
470
488
|
key: dxn.toString(),
|
|
471
489
|
className: "dx-tag py-0 ps-2 flex items-center gap-1",
|
|
@@ -473,12 +491,12 @@ var ChatReferences = ({ classNames, context, db }) => {
|
|
|
473
491
|
}, /* @__PURE__ */ React4.createElement(Icon, {
|
|
474
492
|
icon,
|
|
475
493
|
size: 4,
|
|
476
|
-
classNames:
|
|
494
|
+
classNames: styles3?.surfaceText
|
|
477
495
|
}), toLocalizedString(label, t), /* @__PURE__ */ React4.createElement(IconButton3, {
|
|
478
496
|
icon: "ph--x--bold",
|
|
479
497
|
iconOnly: true,
|
|
480
498
|
variant: "ghost",
|
|
481
|
-
label: t("remove-object
|
|
499
|
+
label: t("remove-object.label"),
|
|
482
500
|
classNames: "p-0 hover:bg-transparent",
|
|
483
501
|
size: 3,
|
|
484
502
|
onClick: () => onUpdateObject?.(dxn, false)
|
|
@@ -518,16 +536,197 @@ var ChatStatusIndicator = ({ classNames, preset, processing, error, ...props })
|
|
|
518
536
|
})));
|
|
519
537
|
};
|
|
520
538
|
|
|
539
|
+
// src/components/ChatPrompt/ChatPrompt.tsx
|
|
540
|
+
var ChatPrompt = ({ classNames, outline, chat, db, processor, event, online, placeholder, onOnlineChange, onPresetChange, settings = true, presets, preset }) => {
|
|
541
|
+
const { t } = useTranslation4(meta4.id);
|
|
542
|
+
const error = useAtomValue(processor.error).pipe(Option3.getOrUndefined);
|
|
543
|
+
const streaming = useAtomValue(processor.streaming);
|
|
544
|
+
const active = useAtomValue(processor.active);
|
|
545
|
+
const activeRef = useDynamicRef(active);
|
|
546
|
+
const editorRef = useRef(null);
|
|
547
|
+
const [recordingState, setRecordingState] = useState3(false);
|
|
548
|
+
useEffect2(() => {
|
|
549
|
+
return event.on((ev) => {
|
|
550
|
+
switch (ev.type) {
|
|
551
|
+
case "update-prompt":
|
|
552
|
+
if (!editorRef.current?.getText()?.length) {
|
|
553
|
+
editorRef.current?.setText(ev.text);
|
|
554
|
+
editorRef.current?.focus();
|
|
555
|
+
}
|
|
556
|
+
break;
|
|
557
|
+
case "record-start":
|
|
558
|
+
setRecordingState(true);
|
|
559
|
+
break;
|
|
560
|
+
case "record-stop":
|
|
561
|
+
setRecordingState(false);
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
}, [
|
|
566
|
+
event
|
|
567
|
+
]);
|
|
568
|
+
const { recording } = useVoiceInput({
|
|
569
|
+
active: recordingState,
|
|
570
|
+
onUpdate: (text) => {
|
|
571
|
+
editorRef.current?.setText(text);
|
|
572
|
+
editorRef.current?.focus();
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
const extensions = useChatKeymapExtensions({
|
|
576
|
+
event
|
|
577
|
+
});
|
|
578
|
+
const handleSubmit = useCallback2((text) => {
|
|
579
|
+
if (!activeRef.current) {
|
|
580
|
+
event.emit({
|
|
581
|
+
type: "submit",
|
|
582
|
+
text
|
|
583
|
+
});
|
|
584
|
+
return true;
|
|
585
|
+
}
|
|
586
|
+
}, [
|
|
587
|
+
event
|
|
588
|
+
]);
|
|
589
|
+
const handleEvent = useCallback2((ev) => {
|
|
590
|
+
event.emit(ev);
|
|
591
|
+
}, [
|
|
592
|
+
event
|
|
593
|
+
]);
|
|
594
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
595
|
+
role: "group",
|
|
596
|
+
className: mx5("flex flex-col w-full dx-density-fine", outline && "bg-group-surface rounded-sm! border border-subdued-separator transition transition-border [&:has(.cm-content:focus)]:border-separator", classNames)
|
|
597
|
+
}, /* @__PURE__ */ React6.createElement("div", {
|
|
598
|
+
role: "none",
|
|
599
|
+
className: "flex p-2 gap-2"
|
|
600
|
+
}, /* @__PURE__ */ React6.createElement(ChatStatusIndicator, {
|
|
601
|
+
classNames: "p-1",
|
|
602
|
+
preset,
|
|
603
|
+
error,
|
|
604
|
+
processing: streaming
|
|
605
|
+
}), /* @__PURE__ */ React6.createElement(ChatEditor, {
|
|
606
|
+
ref: editorRef,
|
|
607
|
+
autoFocus: true,
|
|
608
|
+
lineWrapping: true,
|
|
609
|
+
classNames: "col-span-2 pt-0.5",
|
|
610
|
+
placeholder: placeholder ?? t("prompt.placeholder"),
|
|
611
|
+
extensions,
|
|
612
|
+
onSubmit: handleSubmit
|
|
613
|
+
})), db && settings && /* @__PURE__ */ React6.createElement("div", {
|
|
614
|
+
role: "none",
|
|
615
|
+
className: "flex items-center overflow-hidden p-1.5"
|
|
616
|
+
}, /* @__PURE__ */ React6.createElement(ChatOptions, {
|
|
617
|
+
chat,
|
|
618
|
+
db,
|
|
619
|
+
blueprintRegistry: processor.blueprintRegistry,
|
|
620
|
+
context: processor.context,
|
|
621
|
+
preset,
|
|
622
|
+
presets,
|
|
623
|
+
onPresetChange
|
|
624
|
+
}), /* @__PURE__ */ React6.createElement("div", {
|
|
625
|
+
role: "none",
|
|
626
|
+
className: "flex h-8 grow overflow-x-auto scrollbar-none"
|
|
627
|
+
}, /* @__PURE__ */ React6.createElement(ChatReferences, {
|
|
628
|
+
db,
|
|
629
|
+
context: processor.context
|
|
630
|
+
})), /* @__PURE__ */ React6.createElement(ChatActions, {
|
|
631
|
+
classNames: "col-span-2",
|
|
632
|
+
microphone: true,
|
|
633
|
+
recording,
|
|
634
|
+
processing: streaming,
|
|
635
|
+
onEvent: handleEvent
|
|
636
|
+
}, online !== void 0 && /* @__PURE__ */ React6.createElement(Input2.Root, null, /* @__PURE__ */ React6.createElement(Input2.Label, {
|
|
637
|
+
srOnly: true
|
|
638
|
+
}, t("online-switch.label")), /* @__PURE__ */ React6.createElement(Input2.Switch, {
|
|
639
|
+
classNames: "mx-2",
|
|
640
|
+
checked: online,
|
|
641
|
+
onCheckedChange: onOnlineChange
|
|
642
|
+
})))));
|
|
643
|
+
};
|
|
644
|
+
ChatPrompt.displayName = "Chat.Prompt";
|
|
645
|
+
|
|
646
|
+
// src/components/ChatPrompt/ChatStatus.tsx
|
|
647
|
+
import React7, { useEffect as useEffect3, useMemo as useMemo2, useState as useState4 } from "react";
|
|
648
|
+
import { ChatStatus as NaturalChatStatus, formatElapsed } from "@dxos/react-ui-chat";
|
|
649
|
+
import { Matrix } from "@dxos/react-ui-sfx";
|
|
650
|
+
import { Unit } from "@dxos/util";
|
|
651
|
+
|
|
652
|
+
// src/components/Chat/context.ts
|
|
653
|
+
import { createContext } from "@radix-ui/react-context";
|
|
654
|
+
var [ChatContextProvider, useChatContext] = createContext("Chat");
|
|
655
|
+
|
|
656
|
+
// src/components/ChatPrompt/ChatStatus.tsx
|
|
657
|
+
var CHAT_STREAM_STATUS_NAME = "Chat.StreamStatus";
|
|
658
|
+
var TICK_MS = 1e3;
|
|
659
|
+
var ChatStatus = ({ classNames, icon }) => {
|
|
660
|
+
const { messages, requestTiming } = useChatContext(CHAT_STREAM_STATUS_NAME);
|
|
661
|
+
const { lastOutputTokens, sessionTotalTokens } = useMemo2(() => {
|
|
662
|
+
let last;
|
|
663
|
+
let total = 0;
|
|
664
|
+
for (const message of messages) {
|
|
665
|
+
for (const block of message.blocks) {
|
|
666
|
+
if (isStats(block) && block.usage) {
|
|
667
|
+
last = block.usage.outputTokens;
|
|
668
|
+
total += block.usage.totalTokens ?? 0;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
return {
|
|
673
|
+
lastOutputTokens: last,
|
|
674
|
+
sessionTotalTokens: total
|
|
675
|
+
};
|
|
676
|
+
}, [
|
|
677
|
+
messages
|
|
678
|
+
]);
|
|
679
|
+
const isRunning = requestTiming != null && requestTiming.endedAt == null;
|
|
680
|
+
const show = requestTiming || lastOutputTokens || sessionTotalTokens > 0;
|
|
681
|
+
if (!show) {
|
|
682
|
+
return null;
|
|
683
|
+
}
|
|
684
|
+
return /* @__PURE__ */ React7.createElement(NaturalChatStatus.Root, {
|
|
685
|
+
defaultRunning: false,
|
|
686
|
+
classNames: [
|
|
687
|
+
"py-2 gap-2 text-sm",
|
|
688
|
+
classNames
|
|
689
|
+
]
|
|
690
|
+
}, icon && /* @__PURE__ */ React7.createElement(NaturalChatStatus.Icon, null, /* @__PURE__ */ React7.createElement(Matrix, {
|
|
691
|
+
classNames: "w-5 h-5",
|
|
692
|
+
dotClassNames: "bg-primary-500",
|
|
693
|
+
dim: 4,
|
|
694
|
+
dotSize: 3,
|
|
695
|
+
count: 10,
|
|
696
|
+
interval: 500,
|
|
697
|
+
active: isRunning
|
|
698
|
+
})), show && /* @__PURE__ */ React7.createElement("div", {
|
|
699
|
+
role: "none",
|
|
700
|
+
className: "flex items-center"
|
|
701
|
+
}, requestTiming && /* @__PURE__ */ React7.createElement(NaturalChatStatus.Text, null, /* @__PURE__ */ React7.createElement(Elapsed, {
|
|
702
|
+
timing: requestTiming
|
|
703
|
+
})), lastOutputTokens != null && /* @__PURE__ */ React7.createElement(React7.Fragment, null, requestTiming && /* @__PURE__ */ React7.createElement(NaturalChatStatus.Separator, null), /* @__PURE__ */ React7.createElement(NaturalChatStatus.Text, null, "\u2193 ", Unit.Thousand(lastOutputTokens).toString())), sessionTotalTokens > 0 && /* @__PURE__ */ React7.createElement(React7.Fragment, null, (requestTiming || lastOutputTokens != null) && /* @__PURE__ */ React7.createElement(NaturalChatStatus.Separator, null), /* @__PURE__ */ React7.createElement(NaturalChatStatus.Text, null, "\u03A3 ", Unit.Thousand(sessionTotalTokens).toString()))));
|
|
704
|
+
};
|
|
705
|
+
var Elapsed = ({ timing }) => {
|
|
706
|
+
const isRunning = timing.endedAt == null;
|
|
707
|
+
const [now, setNow] = useState4(Date.now());
|
|
708
|
+
useEffect3(() => {
|
|
709
|
+
if (!isRunning) {
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
const id = setInterval(() => setNow(Date.now()), TICK_MS);
|
|
713
|
+
return () => clearInterval(id);
|
|
714
|
+
}, [
|
|
715
|
+
isRunning
|
|
716
|
+
]);
|
|
717
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, formatElapsed((timing.endedAt ?? now) - timing.startedAt));
|
|
718
|
+
};
|
|
719
|
+
var isStats = (block) => block._tag === "stats";
|
|
720
|
+
|
|
521
721
|
// src/components/ChatThread/ChatThread.tsx
|
|
522
|
-
import
|
|
722
|
+
import React12, { forwardRef, useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo4, useState as useState6 } from "react";
|
|
523
723
|
import { PublicKey } from "@dxos/keys";
|
|
524
724
|
import { setRef } from "@dxos/react-ui";
|
|
525
|
-
import { MarkdownStream } from "@dxos/react-ui-
|
|
526
|
-
import { mx as mx6 } from "@dxos/ui-theme";
|
|
725
|
+
import { MarkdownStream } from "@dxos/react-ui-markdown";
|
|
527
726
|
import { keyToFallback } from "@dxos/util";
|
|
528
727
|
|
|
529
728
|
// src/components/ChatThread/registry.tsx
|
|
530
|
-
import
|
|
729
|
+
import React11 from "react";
|
|
531
730
|
import { log } from "@dxos/log";
|
|
532
731
|
import { getXmlTextChild } from "@dxos/ui-editor";
|
|
533
732
|
|
|
@@ -567,45 +766,33 @@ var rehydrateToolWidgetsFromMessages = (context, messages) => {
|
|
|
567
766
|
};
|
|
568
767
|
|
|
569
768
|
// src/components/ChatThread/widgets/FallbackWidget.tsx
|
|
570
|
-
import
|
|
769
|
+
import React8 from "react";
|
|
571
770
|
import { TogglePanel } from "@dxos/react-ui-components";
|
|
572
771
|
import { JsonHighlighter } from "@dxos/react-ui-syntax-highlighter";
|
|
573
772
|
var FallbackWidget = ({ _tag, ...props }) => {
|
|
574
|
-
return /* @__PURE__ */
|
|
773
|
+
return /* @__PURE__ */ React8.createElement(TogglePanel.Root, null, /* @__PURE__ */ React8.createElement(TogglePanel.Header, {
|
|
575
774
|
classNames: "bg-group-surface"
|
|
576
|
-
}, _tag), /* @__PURE__ */
|
|
775
|
+
}, _tag), /* @__PURE__ */ React8.createElement(TogglePanel.Content, {
|
|
577
776
|
classNames: "bg-modal-surface"
|
|
578
|
-
}, /* @__PURE__ */
|
|
777
|
+
}, /* @__PURE__ */ React8.createElement(TogglePanel.Viewport, null, /* @__PURE__ */ React8.createElement(JsonHighlighter, {
|
|
579
778
|
classNames: "p-2! text-sm",
|
|
580
779
|
data: props
|
|
581
780
|
}))));
|
|
582
781
|
};
|
|
583
782
|
FallbackWidget.displayName = "Fallback";
|
|
584
783
|
|
|
585
|
-
// src/components/ChatThread/widgets/
|
|
784
|
+
// src/components/ChatThread/widgets/ReasoningWidget.ts
|
|
586
785
|
import { WidgetType } from "@codemirror/view";
|
|
587
786
|
import { Domino } from "@dxos/ui";
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
eq(other) {
|
|
594
|
-
return this.text === other.text;
|
|
595
|
-
}
|
|
596
|
-
/**
|
|
597
|
-
* NOTE: An ancestor element must set `data-hue` so `.dx-panel` resolves to the user's hue tokens
|
|
598
|
-
* (see `packages/ui/ui-theme/src/css/components/panel.css`).
|
|
599
|
-
*/
|
|
600
|
-
toDOM() {
|
|
601
|
-
return Domino.of("div").classNames("flex justify-end my-2").append(Domino.of("div").classNames("dx-panel px-3 py-1.5 rounded-sm").text(this.text)).root;
|
|
602
|
-
}
|
|
787
|
+
|
|
788
|
+
// src/components/ChatThread/widgets/defaults.ts
|
|
789
|
+
var styles2 = {
|
|
790
|
+
padding: "my-4",
|
|
791
|
+
border: "border border-subdued-separator rounded-sm"
|
|
603
792
|
};
|
|
604
793
|
|
|
605
794
|
// src/components/ChatThread/widgets/ReasoningWidget.ts
|
|
606
|
-
|
|
607
|
-
import { Domino as Domino2 } from "@dxos/ui";
|
|
608
|
-
var ReasoningWidget = class extends WidgetType2 {
|
|
795
|
+
var ReasoningWidget = class extends WidgetType {
|
|
609
796
|
text;
|
|
610
797
|
#pos;
|
|
611
798
|
/** The timer id last registered for this instance (may differ from the map if superseded). */
|
|
@@ -618,21 +805,20 @@ var ReasoningWidget = class extends WidgetType2 {
|
|
|
618
805
|
return this.text === other.text && this.#pos === other.#pos;
|
|
619
806
|
}
|
|
620
807
|
toDOM() {
|
|
621
|
-
|
|
808
|
+
return Domino.of("div").classNames(styles2.padding).append(Domino.of("div").classNames("relative overflow-hidden p-px", styles2.border).attributes({
|
|
622
809
|
"data-trail-container": ""
|
|
623
|
-
}).append(
|
|
810
|
+
}).append(Domino.of("div").classNames("relative z-10 bg-base-surface rounded-sm text-sm text-subdued px-2 py-1").append(Domino.of("div").classNames("max-h-[5lh] overflow-y-auto").text(this.text).attributes({
|
|
624
811
|
"data-reasoning-text": ""
|
|
625
|
-
})),
|
|
812
|
+
})), Domino.of("div").attributes({
|
|
626
813
|
"data-id": this.#pos
|
|
627
814
|
}))).root;
|
|
628
|
-
return root;
|
|
629
815
|
}
|
|
630
816
|
updateDOM(dom) {
|
|
631
817
|
dom.querySelector("[data-reasoning-text]")?.replaceChildren(this.text);
|
|
632
818
|
const container = dom.querySelector("[data-trail-container]");
|
|
633
819
|
let trailHost = container?.querySelector("[data-id]");
|
|
634
820
|
if (container && !trailHost) {
|
|
635
|
-
trailHost =
|
|
821
|
+
trailHost = Domino.of("div").attributes({
|
|
636
822
|
"data-id": this.#pos
|
|
637
823
|
}).root;
|
|
638
824
|
container.append(trailHost);
|
|
@@ -679,14 +865,14 @@ var trail = [
|
|
|
679
865
|
var TRAIL_REMOVAL_DELAY_MS = 1e3;
|
|
680
866
|
var trailRemovalTimers = /* @__PURE__ */ new Map();
|
|
681
867
|
var createTrailLayers = () => [
|
|
682
|
-
|
|
683
|
-
|
|
868
|
+
Domino.of("div").classNames(...trail, "animate-trail").root,
|
|
869
|
+
Domino.of("div").classNames(...trail, "animate-trail-offset").root
|
|
684
870
|
];
|
|
685
871
|
|
|
686
872
|
// src/components/ChatThread/widgets/ReferenceWidget.ts
|
|
687
|
-
import { WidgetType as
|
|
688
|
-
import { Domino as
|
|
689
|
-
var ReferenceWidget = class extends
|
|
873
|
+
import { WidgetType as WidgetType2 } from "@codemirror/view";
|
|
874
|
+
import { Domino as Domino2 } from "@dxos/ui";
|
|
875
|
+
var ReferenceWidget = class extends WidgetType2 {
|
|
690
876
|
text;
|
|
691
877
|
dxn;
|
|
692
878
|
constructor(text, dxn) {
|
|
@@ -696,16 +882,16 @@ var ReferenceWidget = class extends WidgetType3 {
|
|
|
696
882
|
return this.dxn === other.dxn;
|
|
697
883
|
}
|
|
698
884
|
toDOM() {
|
|
699
|
-
return
|
|
885
|
+
return Domino2.of("div").classNames(styles2.padding).append(Domino2.of("dx-anchor").classNames("dx-tag--anchor").attributes({
|
|
700
886
|
dxn: this.dxn
|
|
701
887
|
}).text(this.text)).root;
|
|
702
888
|
}
|
|
703
889
|
};
|
|
704
890
|
|
|
705
891
|
// src/components/ChatThread/widgets/SelectWidget.ts
|
|
706
|
-
import { WidgetType as
|
|
707
|
-
import { Domino as
|
|
708
|
-
var SelectWidget = class extends
|
|
892
|
+
import { WidgetType as WidgetType3 } from "@codemirror/view";
|
|
893
|
+
import { Domino as Domino3 } from "@dxos/ui";
|
|
894
|
+
var SelectWidget = class extends WidgetType3 {
|
|
709
895
|
options;
|
|
710
896
|
constructor(options) {
|
|
711
897
|
super(), this.options = options;
|
|
@@ -717,9 +903,9 @@ var SelectWidget = class extends WidgetType4 {
|
|
|
717
903
|
* NOTE: Container must set var based on user's identity.
|
|
718
904
|
*/
|
|
719
905
|
toDOM() {
|
|
720
|
-
return
|
|
906
|
+
return Domino3.of("div").attributes({
|
|
721
907
|
role: "group"
|
|
722
|
-
}).classNames("flex flex-wrap
|
|
908
|
+
}).classNames(styles2.padding, "flex flex-wrap gap-1").append(...this.options.map((option) => Domino3.of("button").classNames("dx-button inline-block max-w-[100cqi]").attributes({
|
|
723
909
|
"data-action": "submit",
|
|
724
910
|
"data-value": option,
|
|
725
911
|
"data-density": "fine"
|
|
@@ -728,9 +914,9 @@ var SelectWidget = class extends WidgetType4 {
|
|
|
728
914
|
};
|
|
729
915
|
|
|
730
916
|
// src/components/ChatThread/widgets/StatsWidget.ts
|
|
731
|
-
import { WidgetType as
|
|
732
|
-
import { Domino as
|
|
733
|
-
var StatsWidget = class extends
|
|
917
|
+
import { WidgetType as WidgetType4 } from "@codemirror/view";
|
|
918
|
+
import { Domino as Domino4 } from "@dxos/ui";
|
|
919
|
+
var StatsWidget = class extends WidgetType4 {
|
|
734
920
|
text;
|
|
735
921
|
constructor(text) {
|
|
736
922
|
super(), this.text = text;
|
|
@@ -739,7 +925,7 @@ var StatsWidget = class extends WidgetType5 {
|
|
|
739
925
|
return this.text === other.text;
|
|
740
926
|
}
|
|
741
927
|
toDOM() {
|
|
742
|
-
return
|
|
928
|
+
return Domino4.of("div").classNames(styles2.padding, "text-sm text-placeholder").text(this.text).root;
|
|
743
929
|
}
|
|
744
930
|
updateDOM(dom) {
|
|
745
931
|
dom.textContent = this.text;
|
|
@@ -747,26 +933,97 @@ var StatsWidget = class extends WidgetType5 {
|
|
|
747
933
|
}
|
|
748
934
|
};
|
|
749
935
|
|
|
936
|
+
// src/components/ChatThread/widgets/StatusWidget.ts
|
|
937
|
+
import { WidgetType as WidgetType5 } from "@codemirror/view";
|
|
938
|
+
import { Domino as Domino5 } from "@dxos/ui";
|
|
939
|
+
var StatusWidget = class extends WidgetType5 {
|
|
940
|
+
text;
|
|
941
|
+
#pos;
|
|
942
|
+
/** The timer id last registered for this instance (may differ from the map if superseded). */
|
|
943
|
+
#ownedTimerId = null;
|
|
944
|
+
constructor(text, pos) {
|
|
945
|
+
super(), this.text = text;
|
|
946
|
+
this.#pos = pos === void 0 || pos === "" ? "status" : String(pos);
|
|
947
|
+
}
|
|
948
|
+
eq(other) {
|
|
949
|
+
return this.text === other.text && this.#pos === other.#pos;
|
|
950
|
+
}
|
|
951
|
+
toDOM() {
|
|
952
|
+
return Domino5.of("div").classNames(styles2.padding).append(Domino5.of("div").classNames("relative overflow-hidden rounded-sm").append(Domino5.of("div").classNames("grid grid-cols-[24px_1fr] gap-x-0.5 gap-y-0 items-start px-0.5 py-0.5 text-placeholder").append(Domino5.of("div").classNames("flex h-5 w-full shrink-0 items-center justify-center self-start").append(Domino5.of("span").classNames("block size-1.5 shrink-0 rounded-full bg-current opacity-45")), Domino5.of("div").classNames("relative min-w-0").append(Domino5.of("div").classNames("relative z-10 rounded-sm text-sm leading-5").attributes({
|
|
953
|
+
"data-status-text": ""
|
|
954
|
+
}).text(this.text), Domino5.of("div").attributes({
|
|
955
|
+
"data-id": this.#pos
|
|
956
|
+
}))))).root;
|
|
957
|
+
}
|
|
958
|
+
updateDOM(dom) {
|
|
959
|
+
dom.querySelector("[data-status-text]")?.replaceChildren(this.text);
|
|
960
|
+
const trailHost = dom.querySelector("[data-id]");
|
|
961
|
+
if (trailHost?.childElementCount === 0) {
|
|
962
|
+
trailHost.append(...createTrailLayers2());
|
|
963
|
+
}
|
|
964
|
+
this.#scheduleTrailRemoval(dom);
|
|
965
|
+
return true;
|
|
966
|
+
}
|
|
967
|
+
destroy(_dom) {
|
|
968
|
+
this.#clearOwnedTrailTimer();
|
|
969
|
+
}
|
|
970
|
+
#scheduleTrailRemoval(dom) {
|
|
971
|
+
const previous = trailRemovalTimers2.get(this.#pos);
|
|
972
|
+
if (previous !== void 0) {
|
|
973
|
+
clearTimeout(previous);
|
|
974
|
+
}
|
|
975
|
+
const timerId = setTimeout(() => {
|
|
976
|
+
if (trailRemovalTimers2.get(this.#pos) !== timerId) {
|
|
977
|
+
return;
|
|
978
|
+
}
|
|
979
|
+
trailRemovalTimers2.delete(this.#pos);
|
|
980
|
+
this.#ownedTimerId = null;
|
|
981
|
+
dom.querySelector("[data-id]")?.remove();
|
|
982
|
+
}, TRAIL_REMOVAL_DELAY_MS2);
|
|
983
|
+
trailRemovalTimers2.set(this.#pos, timerId);
|
|
984
|
+
this.#ownedTimerId = timerId;
|
|
985
|
+
}
|
|
986
|
+
#clearOwnedTrailTimer() {
|
|
987
|
+
const active = trailRemovalTimers2.get(this.#pos);
|
|
988
|
+
if (active !== void 0 && active === this.#ownedTimerId) {
|
|
989
|
+
clearTimeout(active);
|
|
990
|
+
trailRemovalTimers2.delete(this.#pos);
|
|
991
|
+
}
|
|
992
|
+
this.#ownedTimerId = null;
|
|
993
|
+
}
|
|
994
|
+
};
|
|
995
|
+
var trail2 = [
|
|
996
|
+
"absolute z-0 aspect-[2/1] w-16",
|
|
997
|
+
"bg-[radial-gradient(at_100%_50%,_theme(colors.green.700),_transparent_80%)]",
|
|
998
|
+
"[offset-anchor:100%_50%] [offset-path:border-box]"
|
|
999
|
+
];
|
|
1000
|
+
var TRAIL_REMOVAL_DELAY_MS2 = 1e3;
|
|
1001
|
+
var trailRemovalTimers2 = /* @__PURE__ */ new Map();
|
|
1002
|
+
var createTrailLayers2 = () => [
|
|
1003
|
+
Domino5.of("div").classNames(...trail2, "animate-trail").root,
|
|
1004
|
+
Domino5.of("div").classNames(...trail2, "animate-trail-offset").root
|
|
1005
|
+
];
|
|
1006
|
+
|
|
750
1007
|
// src/components/ChatThread/widgets/SummaryWidget.tsx
|
|
751
|
-
import
|
|
752
|
-
import { useTranslation as
|
|
1008
|
+
import React9 from "react";
|
|
1009
|
+
import { useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
753
1010
|
import { TogglePanel as TogglePanel2 } from "@dxos/react-ui-components";
|
|
754
|
-
import { meta as
|
|
1011
|
+
import { meta as meta5 } from "#meta";
|
|
755
1012
|
var SummaryWidget = ({ children }) => {
|
|
756
|
-
const { t } =
|
|
757
|
-
return /* @__PURE__ */
|
|
758
|
-
classNames:
|
|
759
|
-
}, /* @__PURE__ */
|
|
1013
|
+
const { t } = useTranslation5(meta5.id);
|
|
1014
|
+
return /* @__PURE__ */ React9.createElement(TogglePanel2.Root, {
|
|
1015
|
+
classNames: styles2.border
|
|
1016
|
+
}, /* @__PURE__ */ React9.createElement(TogglePanel2.Header, {
|
|
760
1017
|
classNames: "text-sm bg-group-surface"
|
|
761
|
-
}, t("summary.label")), /* @__PURE__ */
|
|
1018
|
+
}, t("summary.label")), /* @__PURE__ */ React9.createElement(TogglePanel2.Content, null, /* @__PURE__ */ React9.createElement("div", {
|
|
762
1019
|
role: "none",
|
|
763
|
-
className: "p-1 text-sm text-
|
|
1020
|
+
className: "p-1 text-sm text-subdued"
|
|
764
1021
|
}, children)));
|
|
765
1022
|
};
|
|
766
1023
|
|
|
767
1024
|
// src/components/ChatThread/widgets/SuggestionWidget.ts
|
|
768
1025
|
import { WidgetType as WidgetType6 } from "@codemirror/view";
|
|
769
|
-
import { Domino as Domino6, mx as
|
|
1026
|
+
import { Domino as Domino6, mx as mx6 } from "@dxos/ui";
|
|
770
1027
|
var SuggestionWidget = class extends WidgetType6 {
|
|
771
1028
|
text;
|
|
772
1029
|
constructor(text) {
|
|
@@ -776,26 +1033,26 @@ var SuggestionWidget = class extends WidgetType6 {
|
|
|
776
1033
|
return this.text === other.text;
|
|
777
1034
|
}
|
|
778
1035
|
toDOM() {
|
|
779
|
-
return Domino6.of("span").classNames(
|
|
1036
|
+
return Domino6.of("span").classNames(mx6("inline-flex max-w-[calc(100cqi-8px)] my-1 pe-2 overflow-hidden")).append(Domino6.of("button").attributes({
|
|
780
1037
|
"data-action": "submit",
|
|
781
1038
|
"data-density": "fine",
|
|
782
1039
|
"data-value": this.text
|
|
783
|
-
}).classNames(
|
|
1040
|
+
}).classNames(mx6("dx-button gap-2 w-full overflow-hidden")).append(Domino6.of("dx-icon").attributes({
|
|
784
1041
|
icon: "ph--lightning--regular"
|
|
785
1042
|
}), Domino6.of("span").classNames("flex-1 truncate min-w-0").text(this.text))).root;
|
|
786
1043
|
}
|
|
787
1044
|
};
|
|
788
1045
|
|
|
789
1046
|
// src/components/ChatThread/widgets/ToolWidget.tsx
|
|
790
|
-
import
|
|
791
|
-
import { useTranslation as
|
|
1047
|
+
import React10, { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef2, useState as useState5 } from "react";
|
|
1048
|
+
import { useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
792
1049
|
import { NumericTabs, TextCrawl, TogglePanel as TogglePanel3 } from "@dxos/react-ui-components";
|
|
793
1050
|
import { JsonHighlighter as JsonHighlighter2 } from "@dxos/react-ui-syntax-highlighter";
|
|
794
1051
|
import { isNonNullable, safeParseJson } from "@dxos/util";
|
|
795
|
-
import { meta as
|
|
1052
|
+
import { meta as meta6 } from "#meta";
|
|
796
1053
|
var ToolWidget = ({ view, blocks = [] }) => {
|
|
797
|
-
const { t } =
|
|
798
|
-
const items =
|
|
1054
|
+
const { t } = useTranslation6(meta6.id);
|
|
1055
|
+
const items = useMemo3(() => {
|
|
799
1056
|
let lastToolCall;
|
|
800
1057
|
const tools = [];
|
|
801
1058
|
return blocks.filter((block) => block._tag === "toolCall" || block._tag === "toolResult" || block._tag === "stats").map((block) => {
|
|
@@ -855,7 +1112,7 @@ var ToolWidget = ({ view, blocks = [] }) => {
|
|
|
855
1112
|
blocks,
|
|
856
1113
|
t
|
|
857
1114
|
]);
|
|
858
|
-
const handleChangeOpen =
|
|
1115
|
+
const handleChangeOpen = useCallback3(() => {
|
|
859
1116
|
setTimeout(() => {
|
|
860
1117
|
view?.requestMeasure();
|
|
861
1118
|
}, 1e3);
|
|
@@ -865,21 +1122,21 @@ var ToolWidget = ({ view, blocks = [] }) => {
|
|
|
865
1122
|
if (!items.length) {
|
|
866
1123
|
return null;
|
|
867
1124
|
}
|
|
868
|
-
return /* @__PURE__ */
|
|
1125
|
+
return /* @__PURE__ */ React10.createElement(ToolPanel, {
|
|
869
1126
|
items,
|
|
870
1127
|
onChangeOpen: handleChangeOpen
|
|
871
1128
|
});
|
|
872
1129
|
};
|
|
873
1130
|
var ToolPanel = ({ items, onChangeOpen }) => {
|
|
874
|
-
const tabsRef =
|
|
875
|
-
const [selected, setSelected] =
|
|
876
|
-
const [open, setOpen] =
|
|
877
|
-
|
|
1131
|
+
const tabsRef = useRef2(null);
|
|
1132
|
+
const [selected, setSelected] = useState5(0);
|
|
1133
|
+
const [open, setOpen] = useState5(false);
|
|
1134
|
+
useEffect4(() => {
|
|
878
1135
|
setSelected((prev) => Math.min(prev, Math.max(0, items.length - 1)));
|
|
879
1136
|
}, [
|
|
880
1137
|
items.length
|
|
881
1138
|
]);
|
|
882
|
-
|
|
1139
|
+
useEffect4(() => {
|
|
883
1140
|
onChangeOpen?.(open);
|
|
884
1141
|
if (open) {
|
|
885
1142
|
tabsRef.current?.focus();
|
|
@@ -888,28 +1145,28 @@ var ToolPanel = ({ items, onChangeOpen }) => {
|
|
|
888
1145
|
open,
|
|
889
1146
|
onChangeOpen
|
|
890
1147
|
]);
|
|
891
|
-
const handleSelect =
|
|
1148
|
+
const handleSelect = useCallback3((index) => {
|
|
892
1149
|
setSelected(index);
|
|
893
1150
|
}, []);
|
|
894
|
-
return /* @__PURE__ */
|
|
1151
|
+
return /* @__PURE__ */ React10.createElement(TogglePanel3.Root, {
|
|
895
1152
|
open,
|
|
896
1153
|
onChangeOpen: setOpen
|
|
897
|
-
}, /* @__PURE__ */
|
|
1154
|
+
}, /* @__PURE__ */ React10.createElement(TogglePanel3.Header, {
|
|
898
1155
|
classNames: "text-sm text-placeholder"
|
|
899
|
-
}, /* @__PURE__ */
|
|
1156
|
+
}, /* @__PURE__ */ React10.createElement(TextCrawl, {
|
|
900
1157
|
key: "status-roll",
|
|
901
1158
|
lines: items.map((item) => item.title),
|
|
902
1159
|
autoAdvance: true,
|
|
903
1160
|
greedy: true
|
|
904
|
-
})), /* @__PURE__ */
|
|
1161
|
+
})), /* @__PURE__ */ React10.createElement(TogglePanel3.Content, null, /* @__PURE__ */ React10.createElement(TogglePanel3.Viewport, {
|
|
905
1162
|
classNames: "grid grid-cols-[32px_1fr]"
|
|
906
|
-
}, /* @__PURE__ */
|
|
1163
|
+
}, /* @__PURE__ */ React10.createElement(NumericTabs, {
|
|
907
1164
|
ref: tabsRef,
|
|
908
1165
|
classNames: "p-1",
|
|
909
1166
|
length: items.length,
|
|
910
1167
|
selected,
|
|
911
1168
|
onSelect: handleSelect
|
|
912
|
-
}), /* @__PURE__ */
|
|
1169
|
+
}), /* @__PURE__ */ React10.createElement(JsonHighlighter2, {
|
|
913
1170
|
data: items[selected]?.content,
|
|
914
1171
|
classNames: "p-1 text-xs bg-transparent",
|
|
915
1172
|
replacer: {
|
|
@@ -920,90 +1177,18 @@ var ToolPanel = ({ items, onChangeOpen }) => {
|
|
|
920
1177
|
}))));
|
|
921
1178
|
};
|
|
922
1179
|
|
|
923
|
-
// src/components/ChatThread/widgets/StatusWidget.ts
|
|
924
|
-
import { WidgetType as WidgetType7 } from "@codemirror/view";
|
|
925
|
-
import { Domino as Domino7 } from "@dxos/ui";
|
|
926
|
-
var StatusWidget = class extends WidgetType7 {
|
|
927
|
-
text;
|
|
928
|
-
#pos;
|
|
929
|
-
/** The timer id last registered for this instance (may differ from the map if superseded). */
|
|
930
|
-
#ownedTimerId = null;
|
|
931
|
-
constructor(text, pos) {
|
|
932
|
-
super(), this.text = text;
|
|
933
|
-
this.#pos = pos === void 0 || pos === "" ? "status" : String(pos);
|
|
934
|
-
}
|
|
935
|
-
eq(other) {
|
|
936
|
-
return this.text === other.text && this.#pos === other.#pos;
|
|
937
|
-
}
|
|
938
|
-
toDOM() {
|
|
939
|
-
return Domino7.of("div").classNames("py-0.5").append(Domino7.of("div").classNames("relative overflow-hidden rounded-sm").append(Domino7.of("div").classNames("grid grid-cols-[24px_1fr] gap-x-0.5 gap-y-0 items-start px-0.5 py-0.5 text-placeholder").append(Domino7.of("div").classNames("flex h-5 w-full shrink-0 items-center justify-center self-start").append(Domino7.of("span").classNames("block size-1.5 shrink-0 rounded-full bg-current opacity-45")), Domino7.of("div").classNames("relative min-w-0").append(Domino7.of("div").classNames("relative z-10 rounded-sm text-sm leading-5").attributes({
|
|
940
|
-
"data-status-text": ""
|
|
941
|
-
}).text(this.text), Domino7.of("div").attributes({
|
|
942
|
-
"data-id": this.#pos
|
|
943
|
-
}))))).root;
|
|
944
|
-
}
|
|
945
|
-
updateDOM(dom) {
|
|
946
|
-
dom.querySelector("[data-status-text]")?.replaceChildren(this.text);
|
|
947
|
-
const trailHost = dom.querySelector("[data-id]");
|
|
948
|
-
if (trailHost?.childElementCount === 0) {
|
|
949
|
-
trailHost.append(...createTrailLayers2());
|
|
950
|
-
}
|
|
951
|
-
this.#scheduleTrailRemoval(dom);
|
|
952
|
-
return true;
|
|
953
|
-
}
|
|
954
|
-
destroy(_dom) {
|
|
955
|
-
this.#clearOwnedTrailTimer();
|
|
956
|
-
}
|
|
957
|
-
#scheduleTrailRemoval(dom) {
|
|
958
|
-
const previous = trailRemovalTimers2.get(this.#pos);
|
|
959
|
-
if (previous !== void 0) {
|
|
960
|
-
clearTimeout(previous);
|
|
961
|
-
}
|
|
962
|
-
const timerId = setTimeout(() => {
|
|
963
|
-
if (trailRemovalTimers2.get(this.#pos) !== timerId) {
|
|
964
|
-
return;
|
|
965
|
-
}
|
|
966
|
-
trailRemovalTimers2.delete(this.#pos);
|
|
967
|
-
this.#ownedTimerId = null;
|
|
968
|
-
dom.querySelector("[data-id]")?.remove();
|
|
969
|
-
}, TRAIL_REMOVAL_DELAY_MS2);
|
|
970
|
-
trailRemovalTimers2.set(this.#pos, timerId);
|
|
971
|
-
this.#ownedTimerId = timerId;
|
|
972
|
-
}
|
|
973
|
-
#clearOwnedTrailTimer() {
|
|
974
|
-
const active = trailRemovalTimers2.get(this.#pos);
|
|
975
|
-
if (active !== void 0 && active === this.#ownedTimerId) {
|
|
976
|
-
clearTimeout(active);
|
|
977
|
-
trailRemovalTimers2.delete(this.#pos);
|
|
978
|
-
}
|
|
979
|
-
this.#ownedTimerId = null;
|
|
980
|
-
}
|
|
981
|
-
};
|
|
982
|
-
var trail2 = [
|
|
983
|
-
"absolute z-0 aspect-[2/1] w-16",
|
|
984
|
-
"bg-[radial-gradient(at_100%_50%,_theme(colors.green.700),_transparent_80%)]",
|
|
985
|
-
"[offset-anchor:100%_50%] [offset-path:border-box]"
|
|
986
|
-
];
|
|
987
|
-
var TRAIL_REMOVAL_DELAY_MS2 = 1e3;
|
|
988
|
-
var trailRemovalTimers2 = /* @__PURE__ */ new Map();
|
|
989
|
-
var createTrailLayers2 = () => [
|
|
990
|
-
Domino7.of("div").classNames(...trail2, "animate-trail").root,
|
|
991
|
-
Domino7.of("div").classNames(...trail2, "animate-trail-offset").root
|
|
992
|
-
];
|
|
993
|
-
|
|
994
1180
|
// src/components/ChatThread/registry.tsx
|
|
995
1181
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/ChatThread/registry.tsx";
|
|
996
1182
|
var componentRegistry = {
|
|
997
1183
|
//
|
|
998
|
-
//
|
|
1184
|
+
// Block-only (no widget — see note above).
|
|
999
1185
|
//
|
|
1000
1186
|
prompt: {
|
|
1001
|
-
block: true
|
|
1002
|
-
factory: ({ children }) => {
|
|
1003
|
-
const text = getXmlTextChild(children);
|
|
1004
|
-
return text ? new PromptWidget(text) : null;
|
|
1005
|
-
}
|
|
1187
|
+
block: true
|
|
1006
1188
|
},
|
|
1189
|
+
//
|
|
1190
|
+
// DOM Widgets
|
|
1191
|
+
//
|
|
1007
1192
|
synthetic: {
|
|
1008
1193
|
block: true,
|
|
1009
1194
|
factory: ({ children, range }) => {
|
|
@@ -1064,10 +1249,10 @@ var componentRegistry = {
|
|
|
1064
1249
|
},
|
|
1065
1250
|
toolCall: {
|
|
1066
1251
|
block: true,
|
|
1067
|
-
Component: (props) => /* @__PURE__ */
|
|
1252
|
+
Component: (props) => /* @__PURE__ */ React11.createElement("div", {
|
|
1068
1253
|
role: "none",
|
|
1069
1254
|
className: "py-2"
|
|
1070
|
-
}, /* @__PURE__ */
|
|
1255
|
+
}, /* @__PURE__ */ React11.createElement(ToolWidget, props))
|
|
1071
1256
|
},
|
|
1072
1257
|
toolResult: {
|
|
1073
1258
|
block: true,
|
|
@@ -1085,22 +1270,36 @@ var componentRegistry = {
|
|
|
1085
1270
|
Component: FallbackWidget
|
|
1086
1271
|
}
|
|
1087
1272
|
};
|
|
1088
|
-
var blockToMarkdown = (
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1273
|
+
var blockToMarkdown = createBlockRenderer("normal");
|
|
1274
|
+
function createBlockRenderer(viewType) {
|
|
1275
|
+
return (context, message, block) => {
|
|
1276
|
+
if (!isBlockVisible(viewType, message, block)) {
|
|
1277
|
+
return;
|
|
1278
|
+
}
|
|
1279
|
+
let str = blockToMarkdownImpl(context, message, block);
|
|
1280
|
+
if (str && !block.pending) {
|
|
1281
|
+
return str += "\n";
|
|
1282
|
+
}
|
|
1283
|
+
return str;
|
|
1284
|
+
};
|
|
1285
|
+
}
|
|
1286
|
+
var isBlockVisible = (viewType, message, block) => {
|
|
1287
|
+
switch (viewType) {
|
|
1288
|
+
case "debug":
|
|
1289
|
+
return true;
|
|
1290
|
+
case "normal":
|
|
1291
|
+
return block._tag !== "reasoning";
|
|
1292
|
+
case "summary":
|
|
1293
|
+
return block._tag === "text" && block.disposition !== "synthetic";
|
|
1294
|
+
case "thinking":
|
|
1295
|
+
default:
|
|
1296
|
+
return true;
|
|
1092
1297
|
}
|
|
1093
|
-
return str;
|
|
1094
1298
|
};
|
|
1095
1299
|
var blockToMarkdownImpl = (context, message, block) => {
|
|
1096
1300
|
log("blockToMarkdown", {
|
|
1097
1301
|
block: JSON.stringify(block)
|
|
1098
|
-
}, {
|
|
1099
|
-
F: __dxlog_file,
|
|
1100
|
-
L: 150,
|
|
1101
|
-
S: void 0,
|
|
1102
|
-
C: (f, a) => f(...a)
|
|
1103
|
-
});
|
|
1302
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 151, S: void 0 });
|
|
1104
1303
|
switch (block._tag) {
|
|
1105
1304
|
case "text": {
|
|
1106
1305
|
if (message.sender.role === "user") {
|
|
@@ -1283,34 +1482,35 @@ var MessageSyncer = class {
|
|
|
1283
1482
|
// src/components/ChatThread/ChatThread.tsx
|
|
1284
1483
|
var defaultOptions = {
|
|
1285
1484
|
autoScroll: true,
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages = [], error, options = defaultOptions, debug = false, onEvent }, forwardedRef) => {
|
|
1294
|
-
const [controller, setController] = useState4(null);
|
|
1295
|
-
const handleMarkdownStreamRef = useCallback3((instance) => {
|
|
1485
|
+
cursor: false,
|
|
1486
|
+
fader: false,
|
|
1487
|
+
typewriter: true
|
|
1488
|
+
};
|
|
1489
|
+
var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages = [], error, options = defaultOptions, footer, debug = false, extensions, viewType, onEvent }, forwardedRef) => {
|
|
1490
|
+
const [controller, setController] = useState6(null);
|
|
1491
|
+
const handleMarkdownStreamRef = useCallback4((instance) => {
|
|
1296
1492
|
setController(instance);
|
|
1297
1493
|
setRef(forwardedRef, instance);
|
|
1298
1494
|
}, [
|
|
1299
1495
|
forwardedRef
|
|
1300
1496
|
]);
|
|
1301
|
-
const userHue =
|
|
1497
|
+
const userHue = useMemo4(() => identity?.profile?.data?.hue || keyToFallback(identity?.identityKey ?? PublicKey.random()).hue, [
|
|
1302
1498
|
identity
|
|
1303
1499
|
]);
|
|
1304
|
-
|
|
1500
|
+
useEffect5(() => {
|
|
1305
1501
|
controller?.scrollToBottom();
|
|
1306
1502
|
}, [
|
|
1307
1503
|
controller,
|
|
1308
1504
|
error
|
|
1309
1505
|
]);
|
|
1310
|
-
const
|
|
1311
|
-
|
|
1506
|
+
const renderer = useMemo4(() => createBlockRenderer(viewType), [
|
|
1507
|
+
viewType
|
|
1312
1508
|
]);
|
|
1313
|
-
|
|
1509
|
+
const syncer = useMemo4(() => controller && new MessageSyncer(controller, renderer), [
|
|
1510
|
+
controller,
|
|
1511
|
+
renderer
|
|
1512
|
+
]);
|
|
1513
|
+
useEffect5(() => {
|
|
1314
1514
|
if (!syncer) {
|
|
1315
1515
|
return;
|
|
1316
1516
|
}
|
|
@@ -1322,7 +1522,7 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
|
|
|
1322
1522
|
syncer,
|
|
1323
1523
|
messages
|
|
1324
1524
|
]);
|
|
1325
|
-
const handleEvent =
|
|
1525
|
+
const handleEvent = useCallback4(({ type, value: value2 }) => {
|
|
1326
1526
|
switch (type) {
|
|
1327
1527
|
case "submit": {
|
|
1328
1528
|
value2 && onEvent?.({
|
|
@@ -1335,59 +1535,47 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
|
|
|
1335
1535
|
}, [
|
|
1336
1536
|
onEvent
|
|
1337
1537
|
]);
|
|
1338
|
-
return /* @__PURE__ */
|
|
1538
|
+
return /* @__PURE__ */ React12.createElement("div", {
|
|
1339
1539
|
role: "none",
|
|
1340
1540
|
"data-hue": userHue,
|
|
1341
|
-
className:
|
|
1342
|
-
}, /* @__PURE__ */
|
|
1541
|
+
className: "contents"
|
|
1542
|
+
}, /* @__PURE__ */ React12.createElement(MarkdownStream, {
|
|
1543
|
+
key: viewType,
|
|
1544
|
+
classNames,
|
|
1343
1545
|
registry: componentRegistry,
|
|
1344
1546
|
options,
|
|
1345
1547
|
debug,
|
|
1548
|
+
extensions,
|
|
1549
|
+
footer,
|
|
1346
1550
|
onEvent: handleEvent,
|
|
1347
1551
|
ref: handleMarkdownStreamRef
|
|
1348
1552
|
}));
|
|
1349
1553
|
});
|
|
1350
1554
|
|
|
1351
1555
|
// src/components/Chat/Chat.tsx
|
|
1352
|
-
var
|
|
1353
|
-
|
|
1354
|
-
const
|
|
1355
|
-
const
|
|
1356
|
-
const
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
const
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1556
|
+
var ChatRoot = ({ children, chat, feed, processor, onEvent, ...props }) => {
|
|
1557
|
+
const [debug, setDebug] = useState7(false);
|
|
1558
|
+
const streaming = useAtomValue2(processor.streaming);
|
|
1559
|
+
const active = useAtomValue2(processor.active);
|
|
1560
|
+
const requestTiming = useRequestTiming({
|
|
1561
|
+
active
|
|
1562
|
+
});
|
|
1563
|
+
const lastPrompt = useRef3(void 0);
|
|
1564
|
+
const db = props.db ?? (chat && Obj3.getDatabase(chat));
|
|
1565
|
+
const feedMessages = useQuery2(feed, Filter2.type(Message.Message));
|
|
1566
|
+
const pendingMessages = useAtomValue2(processor.messages);
|
|
1567
|
+
const messages = useMemo5(() => Array2.dedupeWith([
|
|
1568
|
+
...feedMessages,
|
|
1569
|
+
...pendingMessages
|
|
1570
|
+
], ({ id: a }, { id: b }) => a === b), [
|
|
1571
|
+
feedMessages,
|
|
1572
|
+
pendingMessages
|
|
1367
1573
|
]);
|
|
1368
|
-
const dump =
|
|
1369
|
-
const objects = processor.context.getObjects();
|
|
1370
|
-
const blueprints = processor.context.getBlueprints();
|
|
1371
|
-
const system = await processor.getSystemPrompt();
|
|
1372
|
-
const tools = await processor.getTools();
|
|
1373
|
-
console.group("Chat", {
|
|
1374
|
-
objects,
|
|
1375
|
-
blueprints
|
|
1376
|
-
});
|
|
1377
|
-
console.log(trim`
|
|
1378
|
-
System Prompt:
|
|
1379
|
-
${system}
|
|
1380
|
-
`);
|
|
1381
|
-
console.log(trim`
|
|
1382
|
-
Tools:
|
|
1383
|
-
${Object.values(tools).map((tool) => JSON.stringify(tool, null, 2)).join("\n")}
|
|
1384
|
-
`);
|
|
1385
|
-
console.groupEnd();
|
|
1386
|
-
}, [
|
|
1574
|
+
const dump = useDebug({
|
|
1387
1575
|
processor
|
|
1388
|
-
|
|
1389
|
-
const event =
|
|
1390
|
-
|
|
1576
|
+
});
|
|
1577
|
+
const event = useMemo5(() => new Event(), []);
|
|
1578
|
+
useEffect6(() => {
|
|
1391
1579
|
return event.on((ev) => {
|
|
1392
1580
|
switch (ev.type) {
|
|
1393
1581
|
case "toggle-debug": {
|
|
@@ -1439,18 +1627,37 @@ var ChatRoot = ({ children, chat, queue, processor, onEvent, ...props }) => {
|
|
|
1439
1627
|
streaming,
|
|
1440
1628
|
onEvent
|
|
1441
1629
|
]);
|
|
1442
|
-
|
|
1443
|
-
return /* @__PURE__ */ React11.createElement(ChatContextProvider, {
|
|
1630
|
+
return /* @__PURE__ */ React13.createElement(ChatContextProvider, {
|
|
1444
1631
|
debug,
|
|
1445
1632
|
event,
|
|
1446
1633
|
db,
|
|
1447
1634
|
chat,
|
|
1448
1635
|
messages,
|
|
1449
1636
|
processor,
|
|
1637
|
+
requestTiming,
|
|
1450
1638
|
...props
|
|
1451
1639
|
}, children);
|
|
1452
1640
|
};
|
|
1453
1641
|
ChatRoot.displayName = "Chat.Root";
|
|
1642
|
+
var useRequestTiming = ({ active }) => {
|
|
1643
|
+
const [requestTiming, setRequestTiming] = useState7(null);
|
|
1644
|
+
useEffect6(() => {
|
|
1645
|
+
if (active) {
|
|
1646
|
+
setRequestTiming({
|
|
1647
|
+
startedAt: Date.now(),
|
|
1648
|
+
endedAt: null
|
|
1649
|
+
});
|
|
1650
|
+
} else {
|
|
1651
|
+
setRequestTiming((prev) => prev && prev.endedAt == null ? {
|
|
1652
|
+
...prev,
|
|
1653
|
+
endedAt: Date.now()
|
|
1654
|
+
} : prev);
|
|
1655
|
+
}
|
|
1656
|
+
}, [
|
|
1657
|
+
active
|
|
1658
|
+
]);
|
|
1659
|
+
return requestTiming;
|
|
1660
|
+
};
|
|
1454
1661
|
var CHAT_TOOLBAR_NAME = "Chat.Toolbar";
|
|
1455
1662
|
var ChatToolbar = composable(({ attendableId, companionTo, ...props }, forwardedRef) => {
|
|
1456
1663
|
const { chat } = useChatContext(CHAT_TOOLBAR_NAME);
|
|
@@ -1458,32 +1665,36 @@ var ChatToolbar = composable(({ attendableId, companionTo, ...props }, forwarded
|
|
|
1458
1665
|
chat,
|
|
1459
1666
|
companionTo
|
|
1460
1667
|
});
|
|
1461
|
-
return /* @__PURE__ */
|
|
1668
|
+
return /* @__PURE__ */ React13.createElement(Menu.Root, {
|
|
1462
1669
|
...menuActions,
|
|
1463
1670
|
attendableId
|
|
1464
|
-
}, /* @__PURE__ */
|
|
1671
|
+
}, /* @__PURE__ */ React13.createElement(Menu.Toolbar, {
|
|
1465
1672
|
...composableProps(props),
|
|
1466
1673
|
ref: forwardedRef
|
|
1467
1674
|
}));
|
|
1468
1675
|
});
|
|
1469
1676
|
ChatToolbar.displayName = CHAT_TOOLBAR_NAME;
|
|
1470
|
-
var
|
|
1471
|
-
var
|
|
1472
|
-
return /* @__PURE__ */
|
|
1677
|
+
var CHAT_CONTENT_NAME = "Chat.Content";
|
|
1678
|
+
var ChatContent = composable(({ children, ...props }, forwardedRef) => {
|
|
1679
|
+
return /* @__PURE__ */ React13.createElement("div", {
|
|
1473
1680
|
...composableProps(props, {
|
|
1474
1681
|
classNames: "dx-expander flex flex-col"
|
|
1475
1682
|
}),
|
|
1476
1683
|
ref: forwardedRef
|
|
1477
1684
|
}, children);
|
|
1478
1685
|
});
|
|
1479
|
-
|
|
1686
|
+
ChatContent.displayName = CHAT_CONTENT_NAME;
|
|
1480
1687
|
var CHAT_THREAD_NAME = "Chat.Thread";
|
|
1481
|
-
var ChatThread2 = (props) => {
|
|
1688
|
+
var ChatThread2 = ({ viewType, debug: debugProp, ...props }) => {
|
|
1482
1689
|
const { debug, event, messages, processor } = useChatContext(CHAT_THREAD_NAME);
|
|
1690
|
+
const debugView = viewType === "debug";
|
|
1483
1691
|
const identity = useIdentity();
|
|
1484
|
-
const error =
|
|
1485
|
-
const
|
|
1486
|
-
|
|
1692
|
+
const error = useAtomValue2(processor.error).pipe(Option4.getOrUndefined);
|
|
1693
|
+
const extensions = useChatKeymapExtensions2({
|
|
1694
|
+
event
|
|
1695
|
+
});
|
|
1696
|
+
const controllerRef = useRef3(null);
|
|
1697
|
+
useEffect6(() => {
|
|
1487
1698
|
return event.on((event2) => {
|
|
1488
1699
|
switch (event2.type) {
|
|
1489
1700
|
case "submit":
|
|
@@ -1501,7 +1712,7 @@ var ChatThread2 = (props) => {
|
|
|
1501
1712
|
}, [
|
|
1502
1713
|
event
|
|
1503
1714
|
]);
|
|
1504
|
-
const handleEvent =
|
|
1715
|
+
const handleEvent = useCallback5((ev) => {
|
|
1505
1716
|
event.emit(ev);
|
|
1506
1717
|
}, [
|
|
1507
1718
|
event
|
|
@@ -1509,187 +1720,50 @@ var ChatThread2 = (props) => {
|
|
|
1509
1720
|
if (!identity) {
|
|
1510
1721
|
return null;
|
|
1511
1722
|
}
|
|
1512
|
-
return /* @__PURE__ */
|
|
1723
|
+
return /* @__PURE__ */ React13.createElement(ChatThread, {
|
|
1513
1724
|
...props,
|
|
1514
1725
|
identity,
|
|
1515
1726
|
messages,
|
|
1516
1727
|
error,
|
|
1517
|
-
debug,
|
|
1728
|
+
debug: debugProp ?? (debug || debugView),
|
|
1729
|
+
viewType,
|
|
1730
|
+
extensions,
|
|
1518
1731
|
onEvent: handleEvent,
|
|
1519
1732
|
ref: controllerRef
|
|
1520
1733
|
});
|
|
1521
1734
|
};
|
|
1522
1735
|
ChatThread2.displayName = CHAT_THREAD_NAME;
|
|
1523
1736
|
var CHAT_PROMPT_NAME = "Chat.Prompt";
|
|
1524
|
-
var
|
|
1525
|
-
const {
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
const editorRef = useRef2(null);
|
|
1532
|
-
const [recordingState, setRecordingState] = useState5(false);
|
|
1533
|
-
useEffect4(() => {
|
|
1534
|
-
return event.on((event2) => {
|
|
1535
|
-
switch (event2.type) {
|
|
1536
|
-
case "update-prompt":
|
|
1537
|
-
if (!editorRef.current?.getText()?.length) {
|
|
1538
|
-
editorRef.current?.setText(event2.text);
|
|
1539
|
-
editorRef.current?.focus();
|
|
1540
|
-
}
|
|
1541
|
-
break;
|
|
1542
|
-
case "record-start":
|
|
1543
|
-
setRecordingState(true);
|
|
1544
|
-
break;
|
|
1545
|
-
case "record-stop":
|
|
1546
|
-
setRecordingState(false);
|
|
1547
|
-
break;
|
|
1548
|
-
}
|
|
1549
|
-
});
|
|
1550
|
-
}, [
|
|
1737
|
+
var ChatPrompt2 = (props) => {
|
|
1738
|
+
const { chat, db, processor, event } = useChatContext(CHAT_PROMPT_NAME);
|
|
1739
|
+
return /* @__PURE__ */ React13.createElement(ChatPrompt, {
|
|
1740
|
+
...props,
|
|
1741
|
+
chat,
|
|
1742
|
+
db,
|
|
1743
|
+
processor,
|
|
1551
1744
|
event
|
|
1552
|
-
]);
|
|
1553
|
-
const { recording } = useVoiceInput({
|
|
1554
|
-
active: recordingState,
|
|
1555
|
-
onUpdate: (text) => {
|
|
1556
|
-
editorRef.current?.setText(text);
|
|
1557
|
-
editorRef.current?.focus();
|
|
1558
|
-
}
|
|
1559
1745
|
});
|
|
1560
|
-
const extensions = useMemo4(() => {
|
|
1561
|
-
return [
|
|
1562
|
-
Prec.highest(keymap.of([
|
|
1563
|
-
{
|
|
1564
|
-
key: "Mod-d",
|
|
1565
|
-
preventDefault: true,
|
|
1566
|
-
run: () => {
|
|
1567
|
-
event.emit({
|
|
1568
|
-
type: "toggle-debug"
|
|
1569
|
-
});
|
|
1570
|
-
return true;
|
|
1571
|
-
}
|
|
1572
|
-
},
|
|
1573
|
-
{
|
|
1574
|
-
key: "Mod-ArrowUp",
|
|
1575
|
-
preventDefault: true,
|
|
1576
|
-
run: () => {
|
|
1577
|
-
event.emit({
|
|
1578
|
-
type: "nav-previous"
|
|
1579
|
-
});
|
|
1580
|
-
return true;
|
|
1581
|
-
},
|
|
1582
|
-
shift: () => {
|
|
1583
|
-
event.emit({
|
|
1584
|
-
type: "thread-open"
|
|
1585
|
-
});
|
|
1586
|
-
return true;
|
|
1587
|
-
}
|
|
1588
|
-
},
|
|
1589
|
-
{
|
|
1590
|
-
key: "Mod-ArrowDown",
|
|
1591
|
-
preventDefault: true,
|
|
1592
|
-
run: () => {
|
|
1593
|
-
event.emit({
|
|
1594
|
-
type: "nav-next"
|
|
1595
|
-
});
|
|
1596
|
-
return true;
|
|
1597
|
-
},
|
|
1598
|
-
shift: () => {
|
|
1599
|
-
event.emit({
|
|
1600
|
-
type: "thread-close"
|
|
1601
|
-
});
|
|
1602
|
-
return true;
|
|
1603
|
-
}
|
|
1604
|
-
}
|
|
1605
|
-
]))
|
|
1606
|
-
].filter(isTruthy);
|
|
1607
|
-
}, [
|
|
1608
|
-
event,
|
|
1609
|
-
expandable
|
|
1610
|
-
]);
|
|
1611
|
-
const handleSubmit = useCallback4((text) => {
|
|
1612
|
-
if (!activeRef.current) {
|
|
1613
|
-
event.emit({
|
|
1614
|
-
type: "submit",
|
|
1615
|
-
text
|
|
1616
|
-
});
|
|
1617
|
-
return true;
|
|
1618
|
-
}
|
|
1619
|
-
}, [
|
|
1620
|
-
event
|
|
1621
|
-
]);
|
|
1622
|
-
const handleEvent = useCallback4((ev) => {
|
|
1623
|
-
event.emit(ev);
|
|
1624
|
-
}, [
|
|
1625
|
-
event
|
|
1626
|
-
]);
|
|
1627
|
-
return /* @__PURE__ */ React11.createElement("div", {
|
|
1628
|
-
role: "group",
|
|
1629
|
-
className: mx7("flex flex-col w-full dx-density-fine", outline && "bg-group-surface border border-subdued-separator transition transition-border [&:has(.cm-content:focus)]:border-separator rounded-sm", classNames)
|
|
1630
|
-
}, /* @__PURE__ */ React11.createElement("div", {
|
|
1631
|
-
role: "none",
|
|
1632
|
-
className: "flex p-2 gap-2"
|
|
1633
|
-
}, /* @__PURE__ */ React11.createElement(ChatStatusIndicator, {
|
|
1634
|
-
classNames: "p-1",
|
|
1635
|
-
preset,
|
|
1636
|
-
error,
|
|
1637
|
-
processing: streaming
|
|
1638
|
-
}), /* @__PURE__ */ React11.createElement(ChatEditor, {
|
|
1639
|
-
ref: editorRef,
|
|
1640
|
-
autoFocus: true,
|
|
1641
|
-
lineWrapping: true,
|
|
1642
|
-
classNames: "col-span-2 pt-0.5",
|
|
1643
|
-
placeholder: placeholder ?? t("prompt.placeholder"),
|
|
1644
|
-
extensions,
|
|
1645
|
-
onSubmit: handleSubmit
|
|
1646
|
-
})), db && settings && /* @__PURE__ */ React11.createElement("div", {
|
|
1647
|
-
role: "none",
|
|
1648
|
-
className: "flex items-center overflow-hidden"
|
|
1649
|
-
}, /* @__PURE__ */ React11.createElement(ChatOptions, {
|
|
1650
|
-
db,
|
|
1651
|
-
blueprintRegistry: processor.blueprintRegistry,
|
|
1652
|
-
context: processor.context,
|
|
1653
|
-
preset,
|
|
1654
|
-
presets,
|
|
1655
|
-
onPresetChange
|
|
1656
|
-
}), /* @__PURE__ */ React11.createElement("div", {
|
|
1657
|
-
role: "none",
|
|
1658
|
-
className: "flex grow overflow-x-auto scrollbar-none"
|
|
1659
|
-
}, /* @__PURE__ */ React11.createElement(ChatReferences, {
|
|
1660
|
-
db,
|
|
1661
|
-
context: processor.context
|
|
1662
|
-
})), /* @__PURE__ */ React11.createElement(ChatActions, {
|
|
1663
|
-
classNames: "col-span-2",
|
|
1664
|
-
microphone: true,
|
|
1665
|
-
recording,
|
|
1666
|
-
processing: streaming,
|
|
1667
|
-
onEvent: handleEvent
|
|
1668
|
-
}, online !== void 0 && /* @__PURE__ */ React11.createElement(Input2.Root, null, /* @__PURE__ */ React11.createElement(Input2.Label, {
|
|
1669
|
-
srOnly: true
|
|
1670
|
-
}, t("online-switch.label")), /* @__PURE__ */ React11.createElement(Input2.Switch, {
|
|
1671
|
-
classNames: "mx-2",
|
|
1672
|
-
checked: online,
|
|
1673
|
-
onCheckedChange: onOnlineChange
|
|
1674
|
-
})))));
|
|
1675
1746
|
};
|
|
1676
|
-
|
|
1747
|
+
ChatPrompt2.displayName = CHAT_PROMPT_NAME;
|
|
1677
1748
|
var Chat = {
|
|
1678
1749
|
Root: ChatRoot,
|
|
1679
1750
|
Toolbar: ChatToolbar,
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1751
|
+
Content: ChatContent,
|
|
1752
|
+
Prompt: ChatPrompt2,
|
|
1753
|
+
Status: ChatStatus,
|
|
1754
|
+
Thread: ChatThread2
|
|
1683
1755
|
};
|
|
1684
1756
|
|
|
1685
1757
|
// src/components/ProcessTree/ProcessTree.tsx
|
|
1686
1758
|
import * as Match from "effect/Match";
|
|
1687
|
-
import
|
|
1759
|
+
import * as Option5 from "effect/Option";
|
|
1760
|
+
import React14 from "react";
|
|
1688
1761
|
import { Process } from "@dxos/functions-runtime";
|
|
1689
|
-
import { Icon as Icon2, ScrollArea, Treegrid } from "@dxos/react-ui";
|
|
1690
|
-
import { composable as composable2, composableProps as composableProps2, mx as
|
|
1691
|
-
|
|
1692
|
-
|
|
1762
|
+
import { Icon as Icon2, IconButton as IconButton4, ScrollArea, Tooltip as Tooltip2, Treegrid } from "@dxos/react-ui";
|
|
1763
|
+
import { composable as composable2, composableProps as composableProps2, mx as mx7 } from "@dxos/ui-theme";
|
|
1764
|
+
import { Unit as Unit2 } from "@dxos/util";
|
|
1765
|
+
var ProcessTree = composable2(({ processes, onProcessSelect, onProcessTerminate, ...props }, forwardedRef) => {
|
|
1766
|
+
const sortedProcesses = [
|
|
1693
1767
|
...processes.filter((process) => [
|
|
1694
1768
|
Process.State.RUNNING,
|
|
1695
1769
|
Process.State.HYBERNATING
|
|
@@ -1701,43 +1775,65 @@ var ProcessTree = composable2(({ processes, onProcessSelect, ...props }, forward
|
|
|
1701
1775
|
Process.State.SUCCEEDED,
|
|
1702
1776
|
Process.State.FAILED,
|
|
1703
1777
|
Process.State.TERMINATED
|
|
1704
|
-
].includes(process.state))
|
|
1705
|
-
]
|
|
1706
|
-
|
|
1778
|
+
].includes(process.state))
|
|
1779
|
+
].sort((a, b) => {
|
|
1780
|
+
const aCompletedAt = Option5.getOrElse(a.completedAt, () => Infinity);
|
|
1781
|
+
const bCompletedAt = Option5.getOrElse(b.completedAt, () => Infinity);
|
|
1782
|
+
return bCompletedAt - aCompletedAt;
|
|
1783
|
+
});
|
|
1784
|
+
return /* @__PURE__ */ React14.createElement(ScrollArea.Root, {
|
|
1707
1785
|
...composableProps2(props, {
|
|
1708
1786
|
classNames: "dx-expander"
|
|
1709
1787
|
}),
|
|
1710
1788
|
thin: true,
|
|
1711
1789
|
ref: forwardedRef
|
|
1712
|
-
}, /* @__PURE__ */
|
|
1790
|
+
}, /* @__PURE__ */ React14.createElement(ScrollArea.Viewport, null, /* @__PURE__ */ React14.createElement(Treegrid.Root, {
|
|
1713
1791
|
gridTemplateColumns: "1fr"
|
|
1714
|
-
},
|
|
1715
|
-
|
|
1716
|
-
return /* @__PURE__ */ React12.createElement(Treegrid.Row, {
|
|
1792
|
+
}, sortedProcesses.filter((process) => process.parentPid === null).map((process) => {
|
|
1793
|
+
return /* @__PURE__ */ React14.createElement(Treegrid.Row, {
|
|
1717
1794
|
key: process.pid.toString(),
|
|
1718
1795
|
id: process.pid.toString(),
|
|
1719
1796
|
parentOf: process.parentPid?.toString()
|
|
1720
|
-
}, /* @__PURE__ */
|
|
1797
|
+
}, /* @__PURE__ */ React14.createElement(Treegrid.Cell, {
|
|
1721
1798
|
indent: true,
|
|
1722
|
-
classNames: "
|
|
1799
|
+
classNames: mx7("grid grid-cols-[min-content_1fr_min-content_min-content] items-center gap-1 min-w-0", onProcessSelect && "dx-hover"),
|
|
1723
1800
|
onClick: () => onProcessSelect?.(process)
|
|
1724
|
-
}, /* @__PURE__ */
|
|
1801
|
+
}, /* @__PURE__ */ React14.createElement(Tooltip2.Trigger, {
|
|
1802
|
+
className: "p-1",
|
|
1803
|
+
content: process.state.toString()
|
|
1804
|
+
}, /* @__PURE__ */ React14.createElement(Icon2, {
|
|
1725
1805
|
size: 4,
|
|
1726
|
-
classNames:
|
|
1806
|
+
classNames: mx7(process.state === Process.State.RUNNING && "animate-spin", process.state === Process.State.FAILED && "text-error-text", process.state === Process.State.SUCCEEDED && "text-success-text"),
|
|
1727
1807
|
icon: Match.value(process.state).pipe(Match.when(Process.State.RUNNING, () => "ph--spinner-gap--regular"), Match.when(Process.State.SUCCEEDED, () => "ph--check-circle--regular"), Match.when(Process.State.FAILED, () => "ph--warning--regular"), Match.when(Process.State.HYBERNATING, () => "ph--spinner--regular"), Match.when(Process.State.IDLE, () => "ph--hourglass--regular"), Match.when(Process.State.TERMINATING, () => "ph--x-circle--regular"), Match.when(Process.State.TERMINATED, () => "ph--x-circle--regular"), Match.orElse(() => "ph--spinner-gap--regular"))
|
|
1728
|
-
}), /* @__PURE__ */
|
|
1808
|
+
})), /* @__PURE__ */ React14.createElement("div", {
|
|
1729
1809
|
role: "none",
|
|
1730
1810
|
className: "flex items-center gap-2 text-xs overflow-hidden"
|
|
1731
|
-
}, /* @__PURE__ */
|
|
1732
|
-
className: "truncate text-description"
|
|
1733
|
-
}, process.params.name)))
|
|
1811
|
+
}, /* @__PURE__ */ React14.createElement("span", {
|
|
1812
|
+
className: "truncate text-description select-none"
|
|
1813
|
+
}, process.params.name ?? process.pid.toString())), [
|
|
1814
|
+
Process.State.FAILED,
|
|
1815
|
+
Process.State.SUCCEEDED
|
|
1816
|
+
].includes(process.state) && /* @__PURE__ */ React14.createElement("div", {
|
|
1817
|
+
className: "text-xs text-description tabular-nums"
|
|
1818
|
+
}, Unit2.Millisecond(process.metrics.wallTime).toString()) || /* @__PURE__ */ React14.createElement("div", null), onProcessTerminate && /* @__PURE__ */ React14.createElement(IconButton4, {
|
|
1819
|
+
classNames: "min-h-0 p-1",
|
|
1820
|
+
icon: "ph--x--regular",
|
|
1821
|
+
iconOnly: true,
|
|
1822
|
+
variant: "ghost",
|
|
1823
|
+
size: 4,
|
|
1824
|
+
label: "Actions",
|
|
1825
|
+
onClick: (event) => {
|
|
1826
|
+
event.stopPropagation();
|
|
1827
|
+
onProcessTerminate?.(process);
|
|
1828
|
+
}
|
|
1829
|
+
})));
|
|
1734
1830
|
}))));
|
|
1735
1831
|
});
|
|
1736
1832
|
|
|
1737
1833
|
// src/components/TemplateEditor/TemplateEditor.tsx
|
|
1738
1834
|
import { defaultHighlightStyle, syntaxHighlighting } from "@codemirror/language";
|
|
1739
1835
|
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
1740
|
-
import
|
|
1836
|
+
import React15 from "react";
|
|
1741
1837
|
import { createDocAccessor } from "@dxos/echo-db";
|
|
1742
1838
|
import { useThemeContext, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
1743
1839
|
import { useTextEditor } from "@dxos/react-ui-editor";
|
|
@@ -1749,8 +1845,8 @@ import { meta as meta7 } from "#meta";
|
|
|
1749
1845
|
// src/components/TemplateEditor/extensions/handlebars-extension.ts
|
|
1750
1846
|
import { autocompletion, completionKeymap } from "@codemirror/autocomplete";
|
|
1751
1847
|
import { RangeSetBuilder } from "@codemirror/state";
|
|
1752
|
-
import { Decoration, ViewPlugin, WidgetType as
|
|
1753
|
-
import { Domino as
|
|
1848
|
+
import { Decoration, ViewPlugin, WidgetType as WidgetType7, keymap } from "@codemirror/view";
|
|
1849
|
+
import { Domino as Domino7, mx as mx8 } from "@dxos/ui";
|
|
1754
1850
|
var handlebars = (_ = {}) => {
|
|
1755
1851
|
return [
|
|
1756
1852
|
handlebarsHighlightPlugin,
|
|
@@ -1762,7 +1858,7 @@ var handlebars = (_ = {}) => {
|
|
|
1762
1858
|
handlebarsCompletions
|
|
1763
1859
|
]
|
|
1764
1860
|
}),
|
|
1765
|
-
|
|
1861
|
+
keymap.of(completionKeymap)
|
|
1766
1862
|
];
|
|
1767
1863
|
};
|
|
1768
1864
|
var regex = {
|
|
@@ -1822,7 +1918,7 @@ var handlebarsHighlightPlugin = ViewPlugin.fromClass(class {
|
|
|
1822
1918
|
from: start,
|
|
1823
1919
|
to: end,
|
|
1824
1920
|
decoration: Decoration.mark({
|
|
1825
|
-
class:
|
|
1921
|
+
class: mx8("dx-tag--blue", tagPadding)
|
|
1826
1922
|
})
|
|
1827
1923
|
});
|
|
1828
1924
|
}
|
|
@@ -1893,7 +1989,7 @@ var handlebarsHighlightPlugin = ViewPlugin.fromClass(class {
|
|
|
1893
1989
|
}, {
|
|
1894
1990
|
decorations: (v) => v.decorations
|
|
1895
1991
|
});
|
|
1896
|
-
var DXNWidget = class extends
|
|
1992
|
+
var DXNWidget = class extends WidgetType7 {
|
|
1897
1993
|
_identifier;
|
|
1898
1994
|
constructor(_identifier) {
|
|
1899
1995
|
super(), this._identifier = _identifier;
|
|
@@ -1913,7 +2009,7 @@ var DXNWidget = class extends WidgetType8 {
|
|
|
1913
2009
|
}
|
|
1914
2010
|
return part;
|
|
1915
2011
|
}).join(":");
|
|
1916
|
-
return
|
|
2012
|
+
return Domino7.of("span").classNames(mx8("font-mono dx-tag--blue", tagPadding)).text(text).root;
|
|
1917
2013
|
}
|
|
1918
2014
|
};
|
|
1919
2015
|
var variables = [
|
|
@@ -2007,16 +2103,16 @@ var TemplateEditor = composable3(({ classNames, id, template, lineNumbers = true
|
|
|
2007
2103
|
const { t } = useTranslation7(meta7.id);
|
|
2008
2104
|
const { themeMode } = useThemeContext();
|
|
2009
2105
|
const { parentRef } = useTextEditor(() => {
|
|
2010
|
-
const
|
|
2011
|
-
if (!
|
|
2106
|
+
const target = template.source?.target;
|
|
2107
|
+
if (!target) {
|
|
2012
2108
|
return {};
|
|
2013
2109
|
}
|
|
2014
2110
|
return {
|
|
2015
|
-
initialValue:
|
|
2111
|
+
initialValue: target.content ?? "",
|
|
2016
2112
|
extensions: [
|
|
2017
2113
|
createDataExtensions({
|
|
2018
2114
|
id,
|
|
2019
|
-
text: createDocAccessor(
|
|
2115
|
+
text: createDocAccessor(target, [
|
|
2020
2116
|
"content"
|
|
2021
2117
|
])
|
|
2022
2118
|
}),
|
|
@@ -2043,7 +2139,7 @@ var TemplateEditor = composable3(({ classNames, id, template, lineNumbers = true
|
|
|
2043
2139
|
template.source?.target,
|
|
2044
2140
|
lineNumbers
|
|
2045
2141
|
]);
|
|
2046
|
-
return /* @__PURE__ */
|
|
2142
|
+
return /* @__PURE__ */ React15.createElement("div", {
|
|
2047
2143
|
...composableProps3(props, {
|
|
2048
2144
|
role: "none",
|
|
2049
2145
|
classNames: [
|
|
@@ -2056,21 +2152,21 @@ var TemplateEditor = composable3(({ classNames, id, template, lineNumbers = true
|
|
|
2056
2152
|
});
|
|
2057
2153
|
|
|
2058
2154
|
// src/components/Toolbox/Toolbox.tsx
|
|
2059
|
-
import
|
|
2155
|
+
import React16, { Fragment, useEffect as useEffect7, useState as useState8 } from "react";
|
|
2156
|
+
import { Operation } from "@dxos/compute";
|
|
2060
2157
|
import { log as log2 } from "@dxos/log";
|
|
2061
|
-
import { Operation } from "@dxos/operation";
|
|
2062
2158
|
import { Filter as Filter3, useQuery as useQuery3 } from "@dxos/react-client/echo";
|
|
2063
2159
|
import { ScrollArea as ScrollArea2 } from "@dxos/react-ui";
|
|
2064
|
-
import { composable as composable4, composableProps as composableProps4, mx as
|
|
2065
|
-
import { ServiceType
|
|
2160
|
+
import { composable as composable4, composableProps as composableProps4, mx as mx9 } from "@dxos/ui-theme";
|
|
2161
|
+
import { ServiceType } from "#types";
|
|
2066
2162
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/Toolbox/Toolbox.tsx";
|
|
2067
2163
|
var Toolbox = composable4(({ functions, services, blueprints, activeBlueprints, ...props }, forwardedRef) => {
|
|
2068
|
-
return /* @__PURE__ */
|
|
2164
|
+
return /* @__PURE__ */ React16.createElement(ScrollArea2.Root, {
|
|
2069
2165
|
...composableProps4(props),
|
|
2070
2166
|
thin: true,
|
|
2071
2167
|
orientation: "vertical",
|
|
2072
2168
|
ref: forwardedRef
|
|
2073
|
-
}, /* @__PURE__ */
|
|
2169
|
+
}, /* @__PURE__ */ React16.createElement(ScrollArea2.Viewport, null, blueprints && blueprints.length > 0 && /* @__PURE__ */ React16.createElement(Section, {
|
|
2074
2170
|
title: "Blueprints",
|
|
2075
2171
|
items: blueprints.map(({ name, description, tools }) => ({
|
|
2076
2172
|
name,
|
|
@@ -2079,7 +2175,7 @@ var Toolbox = composable4(({ functions, services, blueprints, activeBlueprints,
|
|
|
2079
2175
|
name: `\u2219 ${safeToolId(toolId)}`
|
|
2080
2176
|
}))
|
|
2081
2177
|
}))
|
|
2082
|
-
}), activeBlueprints && activeBlueprints.length > 0 && /* @__PURE__ */
|
|
2178
|
+
}), activeBlueprints && activeBlueprints.length > 0 && /* @__PURE__ */ React16.createElement(Section, {
|
|
2083
2179
|
title: "Blueprints",
|
|
2084
2180
|
items: activeBlueprints.map(({ target }) => ({
|
|
2085
2181
|
name: target?.name ?? "",
|
|
@@ -2088,13 +2184,13 @@ var Toolbox = composable4(({ functions, services, blueprints, activeBlueprints,
|
|
|
2088
2184
|
name: `\u2219 ${safeToolId(toolId)}`
|
|
2089
2185
|
}))
|
|
2090
2186
|
}))
|
|
2091
|
-
}), services && services.length > 0 && /* @__PURE__ */
|
|
2187
|
+
}), services && services.length > 0 && /* @__PURE__ */ React16.createElement(Section, {
|
|
2092
2188
|
title: "Services",
|
|
2093
2189
|
items: services.map(({ service: { serviceId, name, description } }) => ({
|
|
2094
2190
|
name: name ?? serviceId,
|
|
2095
2191
|
description
|
|
2096
2192
|
}))
|
|
2097
|
-
}), functions && functions.length > 0 && /* @__PURE__ */
|
|
2193
|
+
}), functions && functions.length > 0 && /* @__PURE__ */ React16.createElement(Section, {
|
|
2098
2194
|
title: "Functions",
|
|
2099
2195
|
items: functions.map(({ name, description }) => ({
|
|
2100
2196
|
name,
|
|
@@ -2106,47 +2202,42 @@ Toolbox.displayName = "Toolbox";
|
|
|
2106
2202
|
var Section = ({ title, items, striped }) => {
|
|
2107
2203
|
const stripeClassNames = "odd:bg-neutral-50 dark:odd:bg-neutral-800";
|
|
2108
2204
|
const gridClassNames = "grid grid-cols-[8rem_1fr]";
|
|
2109
|
-
const subGridClassNames =
|
|
2110
|
-
return /* @__PURE__ */
|
|
2205
|
+
const subGridClassNames = mx9("col-span-full grid grid-cols-subgrid text-xs px-2", striped && stripeClassNames);
|
|
2206
|
+
return /* @__PURE__ */ React16.createElement("div", null, /* @__PURE__ */ React16.createElement("h1", {
|
|
2111
2207
|
className: "px-2 text-sm"
|
|
2112
|
-
}, title), /* @__PURE__ */
|
|
2208
|
+
}, title), /* @__PURE__ */ React16.createElement("div", {
|
|
2113
2209
|
className: gridClassNames
|
|
2114
|
-
}, items.map(({ name, description, subitems }, i) => /* @__PURE__ */
|
|
2210
|
+
}, items.map(({ name, description, subitems }, i) => /* @__PURE__ */ React16.createElement(Fragment, {
|
|
2115
2211
|
key: i
|
|
2116
|
-
}, name && /* @__PURE__ */
|
|
2212
|
+
}, name && /* @__PURE__ */ React16.createElement("div", {
|
|
2117
2213
|
className: subGridClassNames
|
|
2118
|
-
}, /* @__PURE__ */
|
|
2214
|
+
}, /* @__PURE__ */ React16.createElement("div", {
|
|
2119
2215
|
className: "truncate text-primary-500"
|
|
2120
|
-
}, name), /* @__PURE__ */
|
|
2216
|
+
}, name), /* @__PURE__ */ React16.createElement("div", {
|
|
2121
2217
|
className: "line-clamp-2"
|
|
2122
|
-
}, description)), subitems?.map(({ name: name2, description: description2 }, i2) => /* @__PURE__ */
|
|
2218
|
+
}, description)), subitems?.map(({ name: name2, description: description2 }, i2) => /* @__PURE__ */ React16.createElement("div", {
|
|
2123
2219
|
key: i2,
|
|
2124
|
-
className:
|
|
2125
|
-
}, /* @__PURE__ */
|
|
2220
|
+
className: mx9(subGridClassNames, striped && stripeClassNames)
|
|
2221
|
+
}, /* @__PURE__ */ React16.createElement("div", {
|
|
2126
2222
|
className: "truncate"
|
|
2127
|
-
}, name2), /* @__PURE__ */
|
|
2223
|
+
}, name2), /* @__PURE__ */ React16.createElement("div", {
|
|
2128
2224
|
className: "line-clamp-3 text-subdued"
|
|
2129
2225
|
}, description2)))))));
|
|
2130
2226
|
};
|
|
2131
2227
|
var ToolboxPanel = ({ classNames, db, processor }) => {
|
|
2132
|
-
const services = useQuery3(db, Filter3.type(
|
|
2133
|
-
const [serviceTools, setServiceTools] =
|
|
2134
|
-
|
|
2228
|
+
const services = useQuery3(db, Filter3.type(ServiceType));
|
|
2229
|
+
const [serviceTools, setServiceTools] = useState8([]);
|
|
2230
|
+
useEffect7(() => {
|
|
2135
2231
|
log2("creating service tools...", {
|
|
2136
2232
|
services: services.length
|
|
2137
|
-
}, {
|
|
2138
|
-
F: __dxlog_file2,
|
|
2139
|
-
L: 122,
|
|
2140
|
-
S: void 0,
|
|
2141
|
-
C: (f, a) => f(...a)
|
|
2142
|
-
});
|
|
2233
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 80, S: void 0 });
|
|
2143
2234
|
queueMicrotask(async () => {
|
|
2144
2235
|
});
|
|
2145
2236
|
}, [
|
|
2146
2237
|
services
|
|
2147
2238
|
]);
|
|
2148
2239
|
const functions = useQuery3(db, Filter3.type(Operation.PersistentOperation));
|
|
2149
|
-
return /* @__PURE__ */
|
|
2240
|
+
return /* @__PURE__ */ React16.createElement(Toolbox, {
|
|
2150
2241
|
classNames,
|
|
2151
2242
|
blueprints: processor?.context.getBlueprints(),
|
|
2152
2243
|
services: serviceTools,
|
|
@@ -2158,28 +2249,28 @@ var safeToolId = (name) => {
|
|
|
2158
2249
|
};
|
|
2159
2250
|
|
|
2160
2251
|
// src/components/index.ts
|
|
2161
|
-
var AssistantSettings = lazy(() => import("./AssistantSettings-
|
|
2252
|
+
var AssistantSettings = lazy(() => import("./AssistantSettings-GG52BLKS.mjs"));
|
|
2162
2253
|
|
|
2163
2254
|
// src/hooks/useBlueprintRegistry.ts
|
|
2164
|
-
import { useCallback as
|
|
2255
|
+
import { useCallback as useCallback6, useEffect as useEffect8, useMemo as useMemo6, useState as useState9 } from "react";
|
|
2165
2256
|
import { useCapabilities } from "@dxos/app-framework/ui";
|
|
2166
2257
|
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
2167
|
-
import { Blueprint } from "@dxos/
|
|
2258
|
+
import { Blueprint } from "@dxos/compute";
|
|
2168
2259
|
import { Filter as Filter4, Obj as Obj4, Ref } from "@dxos/echo";
|
|
2169
2260
|
import { useQuery as useQuery4 } from "@dxos/react-client/echo";
|
|
2170
2261
|
import { distinctBy } from "@dxos/util";
|
|
2171
2262
|
var useBlueprintRegistry = () => {
|
|
2172
2263
|
const blueprintDefinitions = useCapabilities(AppCapabilities.BlueprintDefinition);
|
|
2173
|
-
return
|
|
2264
|
+
return useMemo6(() => new Blueprint.Registry(blueprintDefinitions.map((blueprint) => blueprint.make())), [
|
|
2174
2265
|
blueprintDefinitions
|
|
2175
2266
|
]);
|
|
2176
2267
|
};
|
|
2177
2268
|
var useBlueprints2 = ({ blueprintRegistry, db }) => {
|
|
2178
|
-
const staticBlueprints =
|
|
2269
|
+
const staticBlueprints = useMemo6(() => blueprintRegistry?.query() ?? [], [
|
|
2179
2270
|
blueprintRegistry
|
|
2180
2271
|
]);
|
|
2181
2272
|
const spaceBlueprints = useQuery4(db, Filter4.type(Blueprint.Blueprint));
|
|
2182
|
-
return
|
|
2273
|
+
return useMemo6(() => {
|
|
2183
2274
|
const blueprints = distinctBy([
|
|
2184
2275
|
...staticBlueprints,
|
|
2185
2276
|
...spaceBlueprints
|
|
@@ -2192,8 +2283,8 @@ var useBlueprints2 = ({ blueprintRegistry, db }) => {
|
|
|
2192
2283
|
]);
|
|
2193
2284
|
};
|
|
2194
2285
|
var useActiveBlueprints2 = ({ context }) => {
|
|
2195
|
-
const [active, setActive] =
|
|
2196
|
-
|
|
2286
|
+
const [active, setActive] = useState9(/* @__PURE__ */ new Map());
|
|
2287
|
+
useEffect8(() => {
|
|
2197
2288
|
if (!context) {
|
|
2198
2289
|
setActive(/* @__PURE__ */ new Map());
|
|
2199
2290
|
return;
|
|
@@ -2213,7 +2304,7 @@ var useActiveBlueprints2 = ({ context }) => {
|
|
|
2213
2304
|
return active;
|
|
2214
2305
|
};
|
|
2215
2306
|
var useBlueprintHandlers2 = ({ db, context, blueprintRegistry }) => {
|
|
2216
|
-
const onUpdateBlueprint =
|
|
2307
|
+
const onUpdateBlueprint = useCallback6(async (key, checked) => {
|
|
2217
2308
|
if (!context || !blueprintRegistry) {
|
|
2218
2309
|
return;
|
|
2219
2310
|
}
|
|
@@ -2249,10 +2340,58 @@ var useBlueprintHandlers2 = ({ db, context, blueprintRegistry }) => {
|
|
|
2249
2340
|
};
|
|
2250
2341
|
};
|
|
2251
2342
|
|
|
2343
|
+
// src/hooks/useChatKeymap.ts
|
|
2344
|
+
import { Prec } from "@codemirror/state";
|
|
2345
|
+
import { keymap as keymap2 } from "@codemirror/view";
|
|
2346
|
+
import { useMemo as useMemo7 } from "react";
|
|
2347
|
+
import { isTruthy } from "@dxos/util";
|
|
2348
|
+
var useChatKeymapExtensions3 = ({ event }) => {
|
|
2349
|
+
return useMemo7(() => {
|
|
2350
|
+
return [
|
|
2351
|
+
Prec.highest(keymap2.of([
|
|
2352
|
+
{
|
|
2353
|
+
key: "Mod-ArrowUp",
|
|
2354
|
+
preventDefault: true,
|
|
2355
|
+
run: () => {
|
|
2356
|
+
event.emit({
|
|
2357
|
+
type: "nav-previous"
|
|
2358
|
+
});
|
|
2359
|
+
return true;
|
|
2360
|
+
},
|
|
2361
|
+
shift: () => {
|
|
2362
|
+
event.emit({
|
|
2363
|
+
type: "thread-open"
|
|
2364
|
+
});
|
|
2365
|
+
return true;
|
|
2366
|
+
}
|
|
2367
|
+
},
|
|
2368
|
+
{
|
|
2369
|
+
key: "Mod-ArrowDown",
|
|
2370
|
+
preventDefault: true,
|
|
2371
|
+
run: () => {
|
|
2372
|
+
event.emit({
|
|
2373
|
+
type: "nav-next"
|
|
2374
|
+
});
|
|
2375
|
+
return true;
|
|
2376
|
+
},
|
|
2377
|
+
shift: () => {
|
|
2378
|
+
event.emit({
|
|
2379
|
+
type: "thread-close"
|
|
2380
|
+
});
|
|
2381
|
+
return true;
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
]))
|
|
2385
|
+
].filter(isTruthy);
|
|
2386
|
+
}, [
|
|
2387
|
+
event
|
|
2388
|
+
]);
|
|
2389
|
+
};
|
|
2390
|
+
|
|
2252
2391
|
// src/hooks/useChatProcessor.ts
|
|
2253
2392
|
import { RegistryContext } from "@effect-atom/atom-react";
|
|
2254
2393
|
import * as Effect2 from "effect/Effect";
|
|
2255
|
-
import { useContext, useMemo as
|
|
2394
|
+
import { useContext, useMemo as useMemo8, useState as useState10 } from "react";
|
|
2256
2395
|
import { AiSession } from "@dxos/assistant";
|
|
2257
2396
|
import { Ref as Ref2 } from "@dxos/echo";
|
|
2258
2397
|
import { createFeedServiceLayer } from "@dxos/echo-db";
|
|
@@ -2317,15 +2456,16 @@ var AiServicePresets = [
|
|
|
2317
2456
|
import { Atom, Registry } from "@effect-atom/atom-react";
|
|
2318
2457
|
import * as Effect from "effect/Effect";
|
|
2319
2458
|
import * as Fiber from "effect/Fiber";
|
|
2320
|
-
import * as
|
|
2459
|
+
import * as Option6 from "effect/Option";
|
|
2321
2460
|
import * as Stream from "effect/Stream";
|
|
2322
2461
|
import { DEFAULT_EDGE_MODEL } from "@dxos/ai";
|
|
2323
|
-
import { AiContextService, createSystemPrompt, formatSystemPrompt,
|
|
2462
|
+
import { AiContextService, createSystemPrompt, formatSystemPrompt, PartialBlock, ToolExecutionServices } from "@dxos/assistant";
|
|
2463
|
+
import { Trace } from "@dxos/compute";
|
|
2464
|
+
import { Operation as Operation2 } from "@dxos/compute";
|
|
2324
2465
|
import { Obj as Obj5 } from "@dxos/echo";
|
|
2325
2466
|
import { runAndForwardErrors, unwrapExit } from "@dxos/effect";
|
|
2326
|
-
import {
|
|
2467
|
+
import { AgentService } from "@dxos/functions-runtime";
|
|
2327
2468
|
import { log as log3 } from "@dxos/log";
|
|
2328
|
-
import { Operation as Operation2 } from "@dxos/operation";
|
|
2329
2469
|
import { Message as Message2 } from "@dxos/types";
|
|
2330
2470
|
var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/processor/processor.ts";
|
|
2331
2471
|
var defaultOptions2 = {
|
|
@@ -2358,7 +2498,7 @@ var AiChatProcessor = class {
|
|
|
2358
2498
|
...get(this.#streaming)
|
|
2359
2499
|
]);
|
|
2360
2500
|
/** Last error. */
|
|
2361
|
-
error = Atom.make(
|
|
2501
|
+
error = Atom.make(Option6.none());
|
|
2362
2502
|
constructor(_conversation, _runtime, _feed, _options = defaultOptions2) {
|
|
2363
2503
|
this._conversation = _conversation;
|
|
2364
2504
|
this._runtime = _runtime;
|
|
@@ -2407,18 +2547,13 @@ var AiChatProcessor = class {
|
|
|
2407
2547
|
}
|
|
2408
2548
|
try {
|
|
2409
2549
|
this.#lastRequest = requestProp;
|
|
2410
|
-
this.#registry.set(this.error,
|
|
2550
|
+
this.#registry.set(this.error, Option6.none());
|
|
2411
2551
|
this.#registry.set(this.active, true);
|
|
2412
2552
|
const effect = Effect.gen(this, function* () {
|
|
2413
2553
|
log3.info("init agent session", {
|
|
2414
2554
|
feed: Obj5.getDXN(this._feed).toString(),
|
|
2415
2555
|
model: this._options.model
|
|
2416
|
-
}, {
|
|
2417
|
-
F: __dxlog_file3,
|
|
2418
|
-
L: 166,
|
|
2419
|
-
S: this,
|
|
2420
|
-
C: (f, a) => f(...a)
|
|
2421
|
-
});
|
|
2556
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 95, S: this });
|
|
2422
2557
|
const session = yield* AgentService.getSession(this._feed, {
|
|
2423
2558
|
model: this._options.model
|
|
2424
2559
|
});
|
|
@@ -2432,26 +2567,11 @@ var AiChatProcessor = class {
|
|
|
2432
2567
|
})), Effect.fork);
|
|
2433
2568
|
log3("chat processor submitting prompt", {
|
|
2434
2569
|
length: requestProp.message.length
|
|
2435
|
-
}, {
|
|
2436
|
-
F: __dxlog_file3,
|
|
2437
|
-
L: 182,
|
|
2438
|
-
S: this,
|
|
2439
|
-
C: (f, a) => f(...a)
|
|
2440
|
-
});
|
|
2570
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 110, S: this });
|
|
2441
2571
|
yield* session.submitPrompt(requestProp.message);
|
|
2442
|
-
log3("chat processor submitPrompt returned, waiting for agent", {}, {
|
|
2443
|
-
F: __dxlog_file3,
|
|
2444
|
-
L: 184,
|
|
2445
|
-
S: this,
|
|
2446
|
-
C: (f, a) => f(...a)
|
|
2447
|
-
});
|
|
2572
|
+
log3("chat processor submitPrompt returned, waiting for agent", {}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 114, S: this });
|
|
2448
2573
|
yield* session.waitForCompletion();
|
|
2449
|
-
log3.info("session complete", void 0, {
|
|
2450
|
-
F: __dxlog_file3,
|
|
2451
|
-
L: 186,
|
|
2452
|
-
S: this,
|
|
2453
|
-
C: (f, a) => f(...a)
|
|
2454
|
-
});
|
|
2574
|
+
log3.info("session complete", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 116, S: this });
|
|
2455
2575
|
this.#flushStreaming();
|
|
2456
2576
|
yield* this.#maybeUpdateChatName();
|
|
2457
2577
|
});
|
|
@@ -2464,28 +2584,18 @@ var AiChatProcessor = class {
|
|
|
2464
2584
|
}
|
|
2465
2585
|
throw err;
|
|
2466
2586
|
}
|
|
2467
|
-
this.#registry.set(this.error,
|
|
2587
|
+
this.#registry.set(this.error, Option6.none());
|
|
2468
2588
|
this.#lastRequest = void 0;
|
|
2469
2589
|
this.#requestFiber = void 0;
|
|
2470
2590
|
} catch (err) {
|
|
2471
2591
|
log3.error("request failed", {
|
|
2472
2592
|
error: err
|
|
2473
|
-
}, {
|
|
2474
|
-
|
|
2475
|
-
L: 208,
|
|
2476
|
-
S: this,
|
|
2477
|
-
C: (f, a) => f(...a)
|
|
2478
|
-
});
|
|
2479
|
-
this.#registry.set(this.error, Option4.some(new Error("AI service error", {
|
|
2593
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 133, S: this });
|
|
2594
|
+
this.#registry.set(this.error, Option6.some(new Error("AI service error", {
|
|
2480
2595
|
cause: err
|
|
2481
2596
|
})));
|
|
2482
2597
|
} finally {
|
|
2483
|
-
log3.info("setting active to false", void 0, {
|
|
2484
|
-
F: __dxlog_file3,
|
|
2485
|
-
L: 211,
|
|
2486
|
-
S: this,
|
|
2487
|
-
C: (f, a) => f(...a)
|
|
2488
|
-
});
|
|
2598
|
+
log3.info("setting active to false", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 140, S: this });
|
|
2489
2599
|
this.#registry.set(this.active, false);
|
|
2490
2600
|
this.#requestFiber = void 0;
|
|
2491
2601
|
}
|
|
@@ -2599,12 +2709,7 @@ var AiChatProcessor = class {
|
|
|
2599
2709
|
log3.info("scheduling chat name update", {
|
|
2600
2710
|
hasName: !!chat.name,
|
|
2601
2711
|
chance
|
|
2602
|
-
}, {
|
|
2603
|
-
F: __dxlog_file3,
|
|
2604
|
-
L: 318,
|
|
2605
|
-
S: this,
|
|
2606
|
-
C: (f, a) => f(...a)
|
|
2607
|
-
});
|
|
2712
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 246, S: this });
|
|
2608
2713
|
return Operation2.schedule(UpdateChatName, {
|
|
2609
2714
|
chat
|
|
2610
2715
|
});
|
|
@@ -2615,7 +2720,7 @@ var AiChatProcessor = class {
|
|
|
2615
2720
|
var __dxlog_file4 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/hooks/useChatProcessor.ts";
|
|
2616
2721
|
var useChatProcessor = ({ space, chat, preset, runtime: runtime3, blueprintRegistry, settings }) => {
|
|
2617
2722
|
const observableRegistry = useContext(RegistryContext);
|
|
2618
|
-
const [session, setSession] =
|
|
2723
|
+
const [session, setSession] = useState10();
|
|
2619
2724
|
useAsyncEffect(async () => {
|
|
2620
2725
|
if (!space || !chat) {
|
|
2621
2726
|
return;
|
|
@@ -2642,7 +2747,7 @@ var useChatProcessor = ({ space, chat, preset, runtime: runtime3, blueprintRegis
|
|
|
2642
2747
|
chat?.feed.target
|
|
2643
2748
|
]);
|
|
2644
2749
|
const feed = chat?.feed.target;
|
|
2645
|
-
const processor =
|
|
2750
|
+
const processor = useMemo8(() => {
|
|
2646
2751
|
if (!runtime3 || !session || !chat || !feed) {
|
|
2647
2752
|
return void 0;
|
|
2648
2753
|
}
|
|
@@ -2650,12 +2755,7 @@ var useChatProcessor = ({ space, chat, preset, runtime: runtime3, blueprintRegis
|
|
|
2650
2755
|
preset,
|
|
2651
2756
|
model: preset?.model,
|
|
2652
2757
|
settings
|
|
2653
|
-
}, {
|
|
2654
|
-
F: __dxlog_file4,
|
|
2655
|
-
L: 80,
|
|
2656
|
-
S: void 0,
|
|
2657
|
-
C: (f, a) => f(...a)
|
|
2658
|
-
});
|
|
2758
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file4, L: 49, S: void 0 });
|
|
2659
2759
|
return new AiChatProcessor(session, runtime3, feed, {
|
|
2660
2760
|
chat: chat ? Ref2.make(chat) : void 0,
|
|
2661
2761
|
observableRegistry,
|
|
@@ -2673,7 +2773,7 @@ var useChatProcessor = ({ space, chat, preset, runtime: runtime3, blueprintRegis
|
|
|
2673
2773
|
};
|
|
2674
2774
|
|
|
2675
2775
|
// src/hooks/useChatServices.ts
|
|
2676
|
-
import { useMemo as
|
|
2776
|
+
import { useMemo as useMemo9 } from "react";
|
|
2677
2777
|
import { useCapability } from "@dxos/app-framework/ui";
|
|
2678
2778
|
import { getPersonalSpace } from "@dxos/app-toolkit";
|
|
2679
2779
|
import { AutomationCapabilities } from "@dxos/plugin-automation/types";
|
|
@@ -2682,7 +2782,7 @@ var useChatServices = ({ id }) => {
|
|
|
2682
2782
|
const client = useClient();
|
|
2683
2783
|
id ??= getPersonalSpace(client)?.id;
|
|
2684
2784
|
const runtimeResolver = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
2685
|
-
return
|
|
2785
|
+
return useMemo9(() => !id ? void 0 : runtimeResolver.getRuntime(id), [
|
|
2686
2786
|
id
|
|
2687
2787
|
]);
|
|
2688
2788
|
};
|
|
@@ -2690,7 +2790,7 @@ var useChatServices = ({ id }) => {
|
|
|
2690
2790
|
// src/hooks/useChatToolbarActions.ts
|
|
2691
2791
|
import { Atom as Atom2 } from "@effect-atom/atom-react";
|
|
2692
2792
|
import * as Effect3 from "effect/Effect";
|
|
2693
|
-
import { useMemo as
|
|
2793
|
+
import { useMemo as useMemo10 } from "react";
|
|
2694
2794
|
import { useOperationInvoker } from "@dxos/app-framework/ui";
|
|
2695
2795
|
import { Chat as Chat2 } from "@dxos/assistant-toolkit";
|
|
2696
2796
|
import { Filter as Filter5, Obj as Obj6, Query } from "@dxos/echo";
|
|
@@ -2707,7 +2807,7 @@ var useChatToolbarActions2 = ({ chat, companionTo }) => {
|
|
|
2707
2807
|
const { db } = useChatContext2("useChatToolbarActions");
|
|
2708
2808
|
const query = companionTo ? Query.select(Filter5.id(companionTo.id)).targetOf(Chat2.CompanionTo).source() : Query.select(Filter5.nothing());
|
|
2709
2809
|
const chats = useQuery5(db, query);
|
|
2710
|
-
return useMenuActions(
|
|
2810
|
+
return useMenuActions(useMemo10(() => {
|
|
2711
2811
|
return Atom2.make(() => {
|
|
2712
2812
|
const builder = MenuBuilder.make().root({
|
|
2713
2813
|
label: [
|
|
@@ -2727,15 +2827,7 @@ var useChatToolbarActions2 = ({ chat, companionTo }) => {
|
|
|
2727
2827
|
type: "new",
|
|
2728
2828
|
disabled: !companionTo
|
|
2729
2829
|
}, () => {
|
|
2730
|
-
invariant(companionTo, void 0, {
|
|
2731
|
-
F: __dxlog_file5,
|
|
2732
|
-
L: 53,
|
|
2733
|
-
S: void 0,
|
|
2734
|
-
A: [
|
|
2735
|
-
"companionTo",
|
|
2736
|
-
""
|
|
2737
|
-
]
|
|
2738
|
-
});
|
|
2830
|
+
invariant(companionTo, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 44, S: void 0, A: ["companionTo", ""] });
|
|
2739
2831
|
return invoke(AssistantOperation.SetCurrentChat, {
|
|
2740
2832
|
companionTo,
|
|
2741
2833
|
chat: void 0
|
|
@@ -2751,15 +2843,7 @@ var useChatToolbarActions2 = ({ chat, companionTo }) => {
|
|
|
2751
2843
|
type: "rename",
|
|
2752
2844
|
disabled: !chat
|
|
2753
2845
|
}, () => Effect3.gen(function* () {
|
|
2754
|
-
invariant(chat, void 0, {
|
|
2755
|
-
F: __dxlog_file5,
|
|
2756
|
-
L: 70,
|
|
2757
|
-
S: this,
|
|
2758
|
-
A: [
|
|
2759
|
-
"chat",
|
|
2760
|
-
""
|
|
2761
|
-
]
|
|
2762
|
-
});
|
|
2846
|
+
invariant(chat, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 60, S: this, A: ["chat", ""] });
|
|
2763
2847
|
yield* invoke(AssistantOperation.UpdateChatName, {
|
|
2764
2848
|
chat
|
|
2765
2849
|
});
|
|
@@ -2796,15 +2880,7 @@ var useChatToolbarActions2 = ({ chat, companionTo }) => {
|
|
|
2796
2880
|
}
|
|
2797
2881
|
]
|
|
2798
2882
|
}, () => Effect3.gen(function* () {
|
|
2799
|
-
invariant(companionTo, void 0, {
|
|
2800
|
-
F: __dxlog_file5,
|
|
2801
|
-
L: 106,
|
|
2802
|
-
S: this,
|
|
2803
|
-
A: [
|
|
2804
|
-
"companionTo",
|
|
2805
|
-
""
|
|
2806
|
-
]
|
|
2807
|
-
});
|
|
2883
|
+
invariant(companionTo, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 97, S: this, A: ["companionTo", ""] });
|
|
2808
2884
|
yield* invoke(AssistantOperation.SetCurrentChat, {
|
|
2809
2885
|
companionTo,
|
|
2810
2886
|
chat: chat2
|
|
@@ -2827,14 +2903,14 @@ var useChatToolbarActions2 = ({ chat, companionTo }) => {
|
|
|
2827
2903
|
// src/hooks/useContextBinder.ts
|
|
2828
2904
|
import { RegistryContext as RegistryContext2 } from "@effect-atom/atom-react";
|
|
2829
2905
|
import * as Effect4 from "effect/Effect";
|
|
2830
|
-
import { useContext as useContext2, useState as
|
|
2906
|
+
import { useContext as useContext2, useState as useState11 } from "react";
|
|
2831
2907
|
import { AiContextBinder } from "@dxos/assistant";
|
|
2832
2908
|
import { createFeedServiceLayer as createFeedServiceLayer2 } from "@dxos/echo-db";
|
|
2833
2909
|
import { runAndForwardErrors as runAndForwardErrors4 } from "@dxos/effect";
|
|
2834
2910
|
import { useAsyncEffect as useAsyncEffect2 } from "@dxos/react-ui";
|
|
2835
2911
|
var useContextBinder = (space, feed) => {
|
|
2836
2912
|
const registry = useContext2(RegistryContext2);
|
|
2837
|
-
const [binder, setBinder] =
|
|
2913
|
+
const [binder, setBinder] = useState11();
|
|
2838
2914
|
useAsyncEffect2(async () => {
|
|
2839
2915
|
setBinder(void 0);
|
|
2840
2916
|
if (!space || !feed) {
|
|
@@ -2860,12 +2936,12 @@ var useContextBinder = (space, feed) => {
|
|
|
2860
2936
|
};
|
|
2861
2937
|
|
|
2862
2938
|
// src/hooks/useContextObjects.ts
|
|
2863
|
-
import { Atom as Atom3, useAtomValue as
|
|
2864
|
-
import { useCallback as
|
|
2939
|
+
import { Atom as Atom3, useAtomValue as useAtomValue3 } from "@effect-atom/atom-react";
|
|
2940
|
+
import { useCallback as useCallback7 } from "react";
|
|
2865
2941
|
var emptyObjectsAtom = Atom3.make([]);
|
|
2866
2942
|
var useContextObjects3 = ({ db, context }) => {
|
|
2867
|
-
const objects =
|
|
2868
|
-
const handleUpdateObject =
|
|
2943
|
+
const objects = useAtomValue3(context?.objects ?? emptyObjectsAtom);
|
|
2944
|
+
const handleUpdateObject = useCallback7(async (dxn, checked) => {
|
|
2869
2945
|
if (!db || !context) {
|
|
2870
2946
|
return;
|
|
2871
2947
|
}
|
|
@@ -2894,13 +2970,43 @@ var useContextObjects3 = ({ db, context }) => {
|
|
|
2894
2970
|
};
|
|
2895
2971
|
};
|
|
2896
2972
|
|
|
2973
|
+
// src/hooks/useDebug.ts
|
|
2974
|
+
import { useCallback as useCallback8 } from "react";
|
|
2975
|
+
import { trim } from "@dxos/util";
|
|
2976
|
+
var useDebug2 = ({ processor }) => {
|
|
2977
|
+
return useCallback8(async () => {
|
|
2978
|
+
const objects = processor.context.getObjects();
|
|
2979
|
+
const blueprints = processor.context.getBlueprints();
|
|
2980
|
+
const system = await processor.getSystemPrompt();
|
|
2981
|
+
const tools = await processor.getTools() ?? {};
|
|
2982
|
+
console.group("Chat", {
|
|
2983
|
+
objects,
|
|
2984
|
+
blueprints
|
|
2985
|
+
});
|
|
2986
|
+
try {
|
|
2987
|
+
console.log(trim`
|
|
2988
|
+
System Prompt:
|
|
2989
|
+
${system}
|
|
2990
|
+
`);
|
|
2991
|
+
console.log(trim`
|
|
2992
|
+
Tools:
|
|
2993
|
+
${Object.values(tools).map((tool) => JSON.stringify(tool, null, 2)).join("\n")}
|
|
2994
|
+
`);
|
|
2995
|
+
} finally {
|
|
2996
|
+
console.groupEnd();
|
|
2997
|
+
}
|
|
2998
|
+
}, [
|
|
2999
|
+
processor
|
|
3000
|
+
]);
|
|
3001
|
+
};
|
|
3002
|
+
|
|
2897
3003
|
// src/hooks/useFilteredTypes.ts
|
|
2898
|
-
import * as
|
|
2899
|
-
import { useEffect as
|
|
3004
|
+
import * as Option7 from "effect/Option";
|
|
3005
|
+
import { useEffect as useEffect9, useState as useState12 } from "react";
|
|
2900
3006
|
import { EntityKind, SystemTypeAnnotation, getTypeAnnotation } from "@dxos/echo/internal";
|
|
2901
3007
|
var useFilteredTypes2 = (db) => {
|
|
2902
|
-
const [types, setTypes] =
|
|
2903
|
-
|
|
3008
|
+
const [types, setTypes] = useState12([]);
|
|
3009
|
+
useEffect9(() => {
|
|
2904
3010
|
if (!db) {
|
|
2905
3011
|
return;
|
|
2906
3012
|
}
|
|
@@ -2910,7 +3016,7 @@ var useFilteredTypes2 = (db) => {
|
|
|
2910
3016
|
"runtime"
|
|
2911
3017
|
]
|
|
2912
3018
|
}).subscribe((query) => {
|
|
2913
|
-
const types2 = Array.from(new Set(query.results.filter((schema) => getTypeAnnotation(schema)?.kind !== EntityKind.Relation).filter((schema) => !SystemTypeAnnotation.get(schema).pipe(
|
|
3019
|
+
const types2 = Array.from(new Set(query.results.filter((schema) => getTypeAnnotation(schema)?.kind !== EntityKind.Relation).filter((schema) => !SystemTypeAnnotation.get(schema).pipe(Option7.getOrElse(() => false)))));
|
|
2914
3020
|
setTypes(types2);
|
|
2915
3021
|
}, {
|
|
2916
3022
|
fire: true
|
|
@@ -2922,11 +3028,11 @@ var useFilteredTypes2 = (db) => {
|
|
|
2922
3028
|
};
|
|
2923
3029
|
|
|
2924
3030
|
// src/hooks/useFlush.ts
|
|
2925
|
-
import { useCallback as
|
|
3031
|
+
import { useCallback as useCallback9, useRef as useRef4, useState as useState13 } from "react";
|
|
2926
3032
|
var useFlush = (space) => {
|
|
2927
|
-
const [state, setState] =
|
|
2928
|
-
const resetTimer =
|
|
2929
|
-
const handleFlush =
|
|
3033
|
+
const [state, setState] = useState13("idle");
|
|
3034
|
+
const resetTimer = useRef4(null);
|
|
3035
|
+
const handleFlush = useCallback9(() => {
|
|
2930
3036
|
if (!space) {
|
|
2931
3037
|
return;
|
|
2932
3038
|
}
|
|
@@ -2952,9 +3058,9 @@ var useFlush = (space) => {
|
|
|
2952
3058
|
};
|
|
2953
3059
|
|
|
2954
3060
|
// src/hooks/useOnline.ts
|
|
2955
|
-
import { useState as
|
|
3061
|
+
import { useState as useState14 } from "react";
|
|
2956
3062
|
var useOnline = () => {
|
|
2957
|
-
const [online, setOnline] =
|
|
3063
|
+
const [online, setOnline] = useState14(true);
|
|
2958
3064
|
return [
|
|
2959
3065
|
online,
|
|
2960
3066
|
setOnline
|
|
@@ -2962,24 +3068,24 @@ var useOnline = () => {
|
|
|
2962
3068
|
};
|
|
2963
3069
|
|
|
2964
3070
|
// src/hooks/usePresets.ts
|
|
2965
|
-
import { useCallback as
|
|
3071
|
+
import { useCallback as useCallback10, useEffect as useEffect10, useMemo as useMemo11, useState as useState15 } from "react";
|
|
2966
3072
|
var usePresets = (online) => {
|
|
2967
|
-
const [preset, setPreset] =
|
|
2968
|
-
const presets =
|
|
3073
|
+
const [preset, setPreset] = useState15();
|
|
3074
|
+
const presets = useMemo11(() => AiServicePresets.filter((preset2) => online === (preset2.provider === "dxos-remote")), [
|
|
2969
3075
|
online
|
|
2970
3076
|
]);
|
|
2971
|
-
const presetOptions =
|
|
3077
|
+
const presetOptions = useMemo11(() => presets.map(({ id, model, label }) => ({
|
|
2972
3078
|
id,
|
|
2973
3079
|
label: label ?? model
|
|
2974
3080
|
})), [
|
|
2975
3081
|
presets
|
|
2976
3082
|
]);
|
|
2977
|
-
|
|
3083
|
+
useEffect10(() => {
|
|
2978
3084
|
setPreset(presets[0]);
|
|
2979
3085
|
}, [
|
|
2980
3086
|
presets
|
|
2981
3087
|
]);
|
|
2982
|
-
const handlePresetChange =
|
|
3088
|
+
const handlePresetChange = useCallback10((id) => {
|
|
2983
3089
|
const preset2 = presets.find((preset3) => preset3.id === id);
|
|
2984
3090
|
if (preset2) {
|
|
2985
3091
|
setPreset(preset2);
|
|
@@ -2995,10 +3101,10 @@ var usePresets = (online) => {
|
|
|
2995
3101
|
};
|
|
2996
3102
|
|
|
2997
3103
|
// src/hooks/useReferencesProvider.ts
|
|
2998
|
-
import { useMemo as
|
|
3104
|
+
import { useMemo as useMemo12 } from "react";
|
|
2999
3105
|
import { Filter as Filter6, Obj as Obj7 } from "@dxos/echo";
|
|
3000
3106
|
var useReferencesProvider = (space) => {
|
|
3001
|
-
return
|
|
3107
|
+
return useMemo12(() => {
|
|
3002
3108
|
if (!space) {
|
|
3003
3109
|
return void 0;
|
|
3004
3110
|
}
|
|
@@ -3043,214 +3149,41 @@ var meta9 = {
|
|
|
3043
3149
|
var ASSISTANT_DIALOG = `${meta9.id}.assistant.dialog`;
|
|
3044
3150
|
var ASSISTANT_COMPANION_VARIANT = "assistant-chat";
|
|
3045
3151
|
|
|
3046
|
-
// src/translations.ts
|
|
3047
|
-
import { Chat as Chat3, Agent, McpServer as McpServer2 } from "@dxos/assistant-toolkit";
|
|
3048
|
-
import { Blueprint as Blueprint2, Prompt } from "@dxos/blueprints";
|
|
3049
|
-
import { Sequence } from "@dxos/conductor";
|
|
3050
|
-
import { Type as Type2 } from "@dxos/echo";
|
|
3051
|
-
import { translations as componentsTranslations } from "@dxos/react-ui-components";
|
|
3052
|
-
import { translations as formTranslations } from "@dxos/react-ui-form";
|
|
3053
|
-
import { meta as meta10 } from "#meta";
|
|
3054
|
-
var translations = [
|
|
3055
|
-
...componentsTranslations,
|
|
3056
|
-
...formTranslations,
|
|
3057
|
-
{
|
|
3058
|
-
"en-US": {
|
|
3059
|
-
// TODO(burdon): From assistant.
|
|
3060
|
-
[Blueprint2.Blueprint.typename]: {
|
|
3061
|
-
"typename.label": "Blueprint",
|
|
3062
|
-
"typename.label_zero": "Blueprints",
|
|
3063
|
-
"typename.label_one": "Blueprint",
|
|
3064
|
-
"typename.label_other": "Blueprints",
|
|
3065
|
-
"object-name.placeholder": "New blueprint",
|
|
3066
|
-
"add-object.label": "Add blueprint",
|
|
3067
|
-
"rename-object.label": "Rename blueprint",
|
|
3068
|
-
"delete-object.label": "Delete blueprint",
|
|
3069
|
-
"object-deleted.label": "Blueprint deleted"
|
|
3070
|
-
},
|
|
3071
|
-
[Type2.getTypename(Prompt.Prompt)]: {
|
|
3072
|
-
"typename.label": "Prompt",
|
|
3073
|
-
"typename.label_zero": "Prompts",
|
|
3074
|
-
"typename.label_one": "Prompt",
|
|
3075
|
-
"typename.label_other": "Prompts",
|
|
3076
|
-
"object-name.placeholder": "New prompt",
|
|
3077
|
-
"add-object.label": "Add prompt",
|
|
3078
|
-
"rename-object.label": "Rename prompt",
|
|
3079
|
-
"delete-object.label": "Delete prompt",
|
|
3080
|
-
"object-deleted.label": "Prompt deleted"
|
|
3081
|
-
},
|
|
3082
|
-
// TODO(burdon): From conductor.
|
|
3083
|
-
[Sequence.typename]: {
|
|
3084
|
-
"typename.label": "Sequence",
|
|
3085
|
-
"typename.label_zero": "Sequences",
|
|
3086
|
-
"typename.label_one": "Sequence",
|
|
3087
|
-
"typename.label_other": "Sequences",
|
|
3088
|
-
"object-name.placeholder": "New sequence",
|
|
3089
|
-
"add-object.label": "Add sequence",
|
|
3090
|
-
"rename-object.label": "Rename sequence",
|
|
3091
|
-
"delete-object.label": "Delete sequence",
|
|
3092
|
-
"object-deleted.label": "Sequence deleted"
|
|
3093
|
-
},
|
|
3094
|
-
[Chat3.Chat.typename]: {
|
|
3095
|
-
"typename.label": "AI Chat",
|
|
3096
|
-
"object-name.placeholder": "New AI Chat",
|
|
3097
|
-
"add-object.label": "Add AI chat",
|
|
3098
|
-
"rename-object.label": "Rename AI Chat",
|
|
3099
|
-
"delete-object.label": "Delete AI Chat",
|
|
3100
|
-
"object-deleted.label": "AI Chat deleted"
|
|
3101
|
-
},
|
|
3102
|
-
[McpServer2.McpServer.typename]: {
|
|
3103
|
-
"typename.label": "MCP Server",
|
|
3104
|
-
"typename.label_zero": "MCP Servers",
|
|
3105
|
-
"typename.label_one": "MCP Server",
|
|
3106
|
-
"typename.label_other": "MCP Servers"
|
|
3107
|
-
},
|
|
3108
|
-
[Agent.Agent.typename]: {
|
|
3109
|
-
"typename.label": "Agent",
|
|
3110
|
-
"typename.label_zero": "Agents",
|
|
3111
|
-
"typename.label_one": "Agent",
|
|
3112
|
-
"typename.label_other": "Agents",
|
|
3113
|
-
"object-name.placeholder": "New agent",
|
|
3114
|
-
"add-object.label": "Add agent",
|
|
3115
|
-
"rename-object.label": "Rename agent",
|
|
3116
|
-
"delete-object.label": "Delete agent",
|
|
3117
|
-
"object-deleted.label": "Agent deleted"
|
|
3118
|
-
},
|
|
3119
|
-
// TODO(burdon): Reconcile with react-ui-chat.
|
|
3120
|
-
[meta10.id]: {
|
|
3121
|
-
"templates.label": "Templates",
|
|
3122
|
-
"open-ambient-chat.label": "Open Assistant",
|
|
3123
|
-
"assistant-chat.label": "Assistant",
|
|
3124
|
-
"plugin.name": "Assistant",
|
|
3125
|
-
"settings.title": "Assistant settings",
|
|
3126
|
-
"object.placeholder": "New prompt",
|
|
3127
|
-
"create-object.label": "Create prompt",
|
|
3128
|
-
"create-trigger.label": "Create trigger",
|
|
3129
|
-
"create-stack-section.label": "Create prompt",
|
|
3130
|
-
"command.placeholder": "Enter slash command...",
|
|
3131
|
-
"template.placeholder": "Enter template...",
|
|
3132
|
-
"value.placeholder": "Enter value...",
|
|
3133
|
-
"prompt-rules.label": "Prompt Rules",
|
|
3134
|
-
"typename.placeholder": "Enter typename of objects which this template is for",
|
|
3135
|
-
"description.placeholder": "Enter description of when this template should be used",
|
|
3136
|
-
"select-preset-template.placeholder": "Select preset",
|
|
3137
|
-
"service-registry.label": "Service Registry",
|
|
3138
|
-
"type-filter.placeholder": "Type",
|
|
3139
|
-
"any-type-filter.label": "Any",
|
|
3140
|
-
"no-blueprint.message": "No active blueprints",
|
|
3141
|
-
"tool-call.label": "Calling",
|
|
3142
|
-
"tool-result.label": "Success",
|
|
3143
|
-
"tool-error.label": "Tool call failed",
|
|
3144
|
-
"invocations.label": "Invocations",
|
|
3145
|
-
"trace.label": "Trace",
|
|
3146
|
-
"assistant-dialog.title": "Assistant",
|
|
3147
|
-
"open-assistant.label": "Open assistant",
|
|
3148
|
-
"reset-blueprints.label": "Reset blueprints",
|
|
3149
|
-
"no-results.message": "No results",
|
|
3150
|
-
"cancel.button": "Cancel",
|
|
3151
|
-
"save.button": "Save",
|
|
3152
|
-
"new-thread.button": "New Chat",
|
|
3153
|
-
"rename-thread.button": "Rename Chat",
|
|
3154
|
-
"chat-history.label": "Chat History",
|
|
3155
|
-
"chat-update-name.label": "Update AI Chat name",
|
|
3156
|
-
"toolkit.label": "Toolkit",
|
|
3157
|
-
"stats.label": "Stats",
|
|
3158
|
-
"summary.label": "Summary",
|
|
3159
|
-
"thinking.label": "Thinking",
|
|
3160
|
-
"search.placeholder": "Search...",
|
|
3161
|
-
"prompt.placeholder": "Enter question or command...",
|
|
3162
|
-
"context-objects.button": "Add to context",
|
|
3163
|
-
"context-settings.button": "Chat settings",
|
|
3164
|
-
"microphone.button": "Click to speak",
|
|
3165
|
-
"cancel-processing.button": "Stop processing",
|
|
3166
|
-
"blueprints-in-context.title": "Blueprints",
|
|
3167
|
-
"objects-in-context.title": "Content",
|
|
3168
|
-
"remove-object-in-context.label": "Remove document",
|
|
3169
|
-
"chat-model.title": "Models",
|
|
3170
|
-
"mcp-servers.title": "MCP",
|
|
3171
|
-
"mcp-server-add.label": "Add MCP server",
|
|
3172
|
-
"mcp-server-remove.label": "Remove MCP server",
|
|
3173
|
-
"mcp-server-name.label": "Server name",
|
|
3174
|
-
"mcp-server-name.placeholder": "Name",
|
|
3175
|
-
"mcp-server-url.label": "Server URL",
|
|
3176
|
-
"mcp-server-url.placeholder": "https://...",
|
|
3177
|
-
"mcp-server-protocol.label": "Protocol",
|
|
3178
|
-
"mcp-server-api-key.label": "API key",
|
|
3179
|
-
"mcp-server-api-key.placeholder": "API key (optional)",
|
|
3180
|
-
"debug.button": "Debug",
|
|
3181
|
-
"online-switch.label": "Online",
|
|
3182
|
-
"run-prompt.label": "Run prompt",
|
|
3183
|
-
"typename.label": "Typename",
|
|
3184
|
-
"branch-thread.menu": "Branch chat",
|
|
3185
|
-
"chat-toolbar.title": "Chat toolbar",
|
|
3186
|
-
"settings.default.label": "Default",
|
|
3187
|
-
"settings.custom-prompts.label": "Use custom prompts",
|
|
3188
|
-
"settings.custom-prompts.description": "Allow the assistant to use custom prompts defined in your spaces.",
|
|
3189
|
-
"settings.llm-provider.label": "LLM provider",
|
|
3190
|
-
"settings.llm-provider.description": "Select which language model service to use for AI responses.",
|
|
3191
|
-
"settings.edge-llm-model.label": "Remote language model",
|
|
3192
|
-
"settings.edge-llm-model.description": "Choose the remote language model used for AI requests.",
|
|
3193
|
-
"settings.ollama-llm-model.label": "Ollama language model",
|
|
3194
|
-
"settings.ollama-llm-model.description": "Choose the locally hosted Ollama model for AI requests.",
|
|
3195
|
-
"settings.default-llm-model.label": "Default language model",
|
|
3196
|
-
// Trigger status
|
|
3197
|
-
"trigger-status-disabled.label": "Triggers disabled",
|
|
3198
|
-
"trigger-status-idle.label": "Triggers idle",
|
|
3199
|
-
"trigger-status-edge.label": "Triggers will run on EDGE",
|
|
3200
|
-
"trigger-status-running.label": "Trigger running",
|
|
3201
|
-
"trigger-status-error.label": "Trigger error",
|
|
3202
|
-
"trigger-runtime.label": "Auto trigger execution",
|
|
3203
|
-
"trigger-last-invocation.label": "Last run",
|
|
3204
|
-
"trigger-duration.label": "Duration",
|
|
3205
|
-
// AgentArticle.
|
|
3206
|
-
"project-empty-spec.message": "Open the Properties companion to configure the agent.",
|
|
3207
|
-
"project-empty-spec.description": "Open the Assistant companion to interact with the agent.",
|
|
3208
|
-
"artifacts.label": "Artifacts",
|
|
3209
|
-
"input-queue.label": "Inputs",
|
|
3210
|
-
// AgentProperties.
|
|
3211
|
-
"instructions.label": "Instructions",
|
|
3212
|
-
"instructions.placeholder": "Enter instructions, goals, and constraints for the assistant.",
|
|
3213
|
-
"reset-history.button": "Reset",
|
|
3214
|
-
"subscriptions.label": "Subscriptions"
|
|
3215
|
-
}
|
|
3216
|
-
}
|
|
3217
|
-
}
|
|
3218
|
-
];
|
|
3219
|
-
|
|
3220
3152
|
// src/AssistantPlugin.tsx
|
|
3221
3153
|
import * as Effect5 from "effect/Effect";
|
|
3222
|
-
import * as
|
|
3154
|
+
import * as Option8 from "effect/Option";
|
|
3223
3155
|
import { ActivationEvent, ActivationEvents, Capability, Plugin } from "@dxos/app-framework";
|
|
3224
3156
|
import { AppActivationEvents, AppPlugin } from "@dxos/app-toolkit";
|
|
3225
3157
|
import { ContextBinding } from "@dxos/assistant";
|
|
3226
|
-
import { Agent
|
|
3227
|
-
import { Blueprint as
|
|
3228
|
-
import {
|
|
3229
|
-
import {
|
|
3230
|
-
import {
|
|
3158
|
+
import { Agent, AgentBlueprint, Chat as Chat3, McpServer as McpServer2, Memory, Plan } from "@dxos/assistant-toolkit";
|
|
3159
|
+
import { Blueprint as Blueprint2, Routine } from "@dxos/compute";
|
|
3160
|
+
import { Operation as Operation3 } from "@dxos/compute";
|
|
3161
|
+
import { Sequence } from "@dxos/conductor";
|
|
3162
|
+
import { Annotation as Annotation3, Feed, Obj as Obj8, Type as Type2 } from "@dxos/echo";
|
|
3231
3163
|
import { AutomationCapabilities as AutomationCapabilities2 } from "@dxos/plugin-automation/types";
|
|
3232
3164
|
import { ClientEvents } from "@dxos/plugin-client/types";
|
|
3233
3165
|
import { DeckEvents } from "@dxos/plugin-deck/types";
|
|
3234
|
-
import { MarkdownEvents } from "@dxos/plugin-markdown";
|
|
3166
|
+
import { MarkdownEvents } from "@dxos/plugin-markdown/types";
|
|
3235
3167
|
import { SpaceOperation } from "@dxos/plugin-space/operations";
|
|
3236
3168
|
import { SpaceCapabilities, SpaceEvents } from "@dxos/plugin-space/types";
|
|
3237
3169
|
import { Text } from "@dxos/schema";
|
|
3238
3170
|
import { HasSubject, Message as Message3 } from "@dxos/types";
|
|
3239
3171
|
import { AiService, AppGraphBuilder, AssistantState, BlueprintDefinition, CompanionChatProvisioner, EdgeModelResolver, LocalModelResolver, MarkdownExtension, Migrations, OperationHandler, ReactSurface, Settings, Toolkit } from "#capabilities";
|
|
3240
|
-
import { meta as
|
|
3172
|
+
import { meta as meta10 } from "#meta";
|
|
3241
3173
|
import { AssistantOperation as AssistantOperation2 } from "#operations";
|
|
3242
|
-
import {
|
|
3243
|
-
|
|
3174
|
+
import { translations } from "#translations";
|
|
3175
|
+
import { AssistantEvents } from "#types";
|
|
3176
|
+
var AssistantPlugin = Plugin.define(meta10).pipe(AppPlugin.addAppGraphModule({
|
|
3244
3177
|
activate: AppGraphBuilder
|
|
3245
3178
|
}), AppPlugin.addBlueprintDefinitionModule({
|
|
3246
3179
|
activate: BlueprintDefinition
|
|
3247
3180
|
}), AppPlugin.addMetadataModule({
|
|
3248
3181
|
metadata: [
|
|
3249
3182
|
{
|
|
3250
|
-
id:
|
|
3183
|
+
id: Type2.getTypename(Chat3.Chat),
|
|
3251
3184
|
metadata: {
|
|
3252
|
-
icon: Annotation3.IconAnnotation.get(
|
|
3253
|
-
iconHue: Annotation3.IconAnnotation.get(
|
|
3185
|
+
icon: Annotation3.IconAnnotation.get(Chat3.Chat).pipe(Option8.getOrThrow).icon,
|
|
3186
|
+
iconHue: Annotation3.IconAnnotation.get(Chat3.Chat).pipe(Option8.getOrThrow).hue ?? "white",
|
|
3254
3187
|
createObject: (props, options) => Effect5.gen(function* () {
|
|
3255
3188
|
const { object } = yield* Operation3.invoke(AssistantOperation2.CreateChat, {
|
|
3256
3189
|
db: options.db,
|
|
@@ -3266,13 +3199,13 @@ var AssistantPlugin = Plugin.define(meta11).pipe(AppPlugin.addAppGraphModule({
|
|
|
3266
3199
|
}
|
|
3267
3200
|
},
|
|
3268
3201
|
{
|
|
3269
|
-
id:
|
|
3202
|
+
id: Type2.getTypename(Blueprint2.Blueprint),
|
|
3270
3203
|
metadata: {
|
|
3271
|
-
icon: Annotation3.IconAnnotation.get(
|
|
3272
|
-
iconHue: Annotation3.IconAnnotation.get(
|
|
3204
|
+
icon: Annotation3.IconAnnotation.get(Blueprint2.Blueprint).pipe(Option8.getOrThrow).icon,
|
|
3205
|
+
iconHue: Annotation3.IconAnnotation.get(Blueprint2.Blueprint).pipe(Option8.getOrThrow).hue ?? "white",
|
|
3273
3206
|
inputSchema: AssistantOperation2.BlueprintForm,
|
|
3274
3207
|
createObject: (props, options) => Effect5.gen(function* () {
|
|
3275
|
-
const object =
|
|
3208
|
+
const object = Blueprint2.make(props);
|
|
3276
3209
|
return yield* Operation3.invoke(SpaceOperation.AddObject, {
|
|
3277
3210
|
object,
|
|
3278
3211
|
target: options.target,
|
|
@@ -3283,12 +3216,12 @@ var AssistantPlugin = Plugin.define(meta11).pipe(AppPlugin.addAppGraphModule({
|
|
|
3283
3216
|
}
|
|
3284
3217
|
},
|
|
3285
3218
|
{
|
|
3286
|
-
id:
|
|
3219
|
+
id: Type2.getTypename(Routine.Routine),
|
|
3287
3220
|
metadata: {
|
|
3288
|
-
icon: Annotation3.IconAnnotation.get(
|
|
3289
|
-
iconHue: Annotation3.IconAnnotation.get(
|
|
3221
|
+
icon: Annotation3.IconAnnotation.get(Routine.Routine).pipe(Option8.getOrThrow).icon,
|
|
3222
|
+
iconHue: Annotation3.IconAnnotation.get(Routine.Routine).pipe(Option8.getOrThrow).hue ?? "white",
|
|
3290
3223
|
createObject: (props, options) => Effect5.gen(function* () {
|
|
3291
|
-
const object =
|
|
3224
|
+
const object = Routine.make(props);
|
|
3292
3225
|
return yield* Operation3.invoke(SpaceOperation.AddObject, {
|
|
3293
3226
|
object,
|
|
3294
3227
|
target: options.target,
|
|
@@ -3299,12 +3232,12 @@ var AssistantPlugin = Plugin.define(meta11).pipe(AppPlugin.addAppGraphModule({
|
|
|
3299
3232
|
}
|
|
3300
3233
|
},
|
|
3301
3234
|
{
|
|
3302
|
-
id:
|
|
3235
|
+
id: Type2.getTypename(Sequence),
|
|
3303
3236
|
metadata: {
|
|
3304
|
-
icon: Annotation3.IconAnnotation.get(
|
|
3305
|
-
iconHue: Annotation3.IconAnnotation.get(
|
|
3237
|
+
icon: Annotation3.IconAnnotation.get(Sequence).pipe(Option8.getOrThrow).icon,
|
|
3238
|
+
iconHue: Annotation3.IconAnnotation.get(Sequence).pipe(Option8.getOrThrow).hue ?? "white",
|
|
3306
3239
|
createObject: (props, options) => Effect5.gen(function* () {
|
|
3307
|
-
const object = Obj8.make(
|
|
3240
|
+
const object = Obj8.make(Sequence, props);
|
|
3308
3241
|
return yield* Operation3.invoke(SpaceOperation.AddObject, {
|
|
3309
3242
|
object,
|
|
3310
3243
|
target: options.target,
|
|
@@ -3315,12 +3248,12 @@ var AssistantPlugin = Plugin.define(meta11).pipe(AppPlugin.addAppGraphModule({
|
|
|
3315
3248
|
}
|
|
3316
3249
|
},
|
|
3317
3250
|
{
|
|
3318
|
-
id:
|
|
3251
|
+
id: Type2.getTypename(Agent.Agent),
|
|
3319
3252
|
metadata: {
|
|
3320
|
-
icon: Annotation3.IconAnnotation.get(
|
|
3321
|
-
iconHue: Annotation3.IconAnnotation.get(
|
|
3253
|
+
icon: Annotation3.IconAnnotation.get(Agent.Agent).pipe(Option8.getOrThrow).icon,
|
|
3254
|
+
iconHue: Annotation3.IconAnnotation.get(Agent.Agent).pipe(Option8.getOrThrow).hue ?? "white",
|
|
3322
3255
|
createObject: (props, options) => Effect5.gen(function* () {
|
|
3323
|
-
const object = yield*
|
|
3256
|
+
const object = yield* Agent.makeInitialized({
|
|
3324
3257
|
name: "",
|
|
3325
3258
|
instructions: ""
|
|
3326
3259
|
}, AgentBlueprint.make()).pipe(withComputeRuntime(options.db.spaceId));
|
|
@@ -3338,19 +3271,18 @@ var AssistantPlugin = Plugin.define(meta11).pipe(AppPlugin.addAppGraphModule({
|
|
|
3338
3271
|
activate: OperationHandler
|
|
3339
3272
|
}), AppPlugin.addSchemaModule({
|
|
3340
3273
|
schema: [
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3274
|
+
Chat3.Chat,
|
|
3275
|
+
Chat3.CompanionTo,
|
|
3276
|
+
Blueprint2.Blueprint,
|
|
3344
3277
|
ContextBinding,
|
|
3345
3278
|
Feed.Feed,
|
|
3346
3279
|
HasSubject.HasSubject,
|
|
3347
3280
|
Message3.Message,
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
McpServer3.McpServer,
|
|
3281
|
+
Routine.Routine,
|
|
3282
|
+
Agent.Agent,
|
|
3283
|
+
McpServer2.McpServer,
|
|
3352
3284
|
Plan.Plan,
|
|
3353
|
-
|
|
3285
|
+
Sequence,
|
|
3354
3286
|
Memory.Memory,
|
|
3355
3287
|
Text.Text
|
|
3356
3288
|
]
|
|
@@ -3378,14 +3310,14 @@ var AssistantPlugin = Plugin.define(meta11).pipe(AppPlugin.addAppGraphModule({
|
|
|
3378
3310
|
activatesOn: SpaceEvents.SpaceCreated,
|
|
3379
3311
|
activate: () => Effect5.succeed(Capability.contributes(SpaceCapabilities.OnCreateSpace, (params) => Operation3.invoke(AssistantOperation2.OnCreateSpace, params)))
|
|
3380
3312
|
}), Plugin.addModule({
|
|
3381
|
-
activatesOn:
|
|
3313
|
+
activatesOn: AssistantEvents.SetupAiServiceProviders,
|
|
3382
3314
|
activate: EdgeModelResolver
|
|
3383
3315
|
}), Plugin.addModule({
|
|
3384
|
-
activatesOn:
|
|
3316
|
+
activatesOn: AssistantEvents.SetupAiServiceProviders,
|
|
3385
3317
|
activate: LocalModelResolver
|
|
3386
3318
|
}), Plugin.addModule({
|
|
3387
3319
|
firesBeforeActivation: [
|
|
3388
|
-
|
|
3320
|
+
AssistantEvents.SetupAiServiceProviders
|
|
3389
3321
|
],
|
|
3390
3322
|
// TODO(dmaretskyi): This should activate lazily when the AI chat is used.
|
|
3391
3323
|
activatesOn: ActivationEvents.Startup,
|
|
@@ -3409,34 +3341,26 @@ var withComputeRuntime = (spaceId) => (effect) => Effect5.gen(function* () {
|
|
|
3409
3341
|
export {
|
|
3410
3342
|
ASSISTANT_COMPANION_VARIANT,
|
|
3411
3343
|
ASSISTANT_DIALOG,
|
|
3412
|
-
ApiAuthorization,
|
|
3413
|
-
Assistant_exports as Assistant,
|
|
3414
|
-
blueprint_default as AssistantBlueprint,
|
|
3415
|
-
AssistantCapabilities,
|
|
3416
|
-
AssistantEvents,
|
|
3417
3344
|
AssistantPlugin,
|
|
3418
3345
|
AssistantSettings,
|
|
3419
3346
|
Chat,
|
|
3420
|
-
ChatContextProvider,
|
|
3421
|
-
LLM_PROVIDERS,
|
|
3422
3347
|
ProcessTree,
|
|
3423
|
-
ServiceType,
|
|
3424
3348
|
TemplateEditor,
|
|
3425
3349
|
Toolbox,
|
|
3426
3350
|
ToolboxPanel,
|
|
3427
|
-
categoryIcons,
|
|
3428
3351
|
meta9 as meta,
|
|
3429
|
-
translations,
|
|
3430
3352
|
useActiveBlueprints2 as useActiveBlueprints,
|
|
3431
3353
|
useBlueprintHandlers2 as useBlueprintHandlers,
|
|
3432
3354
|
useBlueprintRegistry,
|
|
3433
3355
|
useBlueprints2 as useBlueprints,
|
|
3434
3356
|
useChatContext,
|
|
3357
|
+
useChatKeymapExtensions3 as useChatKeymapExtensions,
|
|
3435
3358
|
useChatProcessor,
|
|
3436
3359
|
useChatServices,
|
|
3437
3360
|
useChatToolbarActions2 as useChatToolbarActions,
|
|
3438
3361
|
useContextBinder,
|
|
3439
3362
|
useContextObjects3 as useContextObjects,
|
|
3363
|
+
useDebug2 as useDebug,
|
|
3440
3364
|
useFilteredTypes2 as useFilteredTypes,
|
|
3441
3365
|
useFlush,
|
|
3442
3366
|
useOnline,
|