@dxos/plugin-assistant 0.10.0 → 0.11.1
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/PLUGIN.mdl +3 -28
- package/dist/lib/AssistantPlugin.mjs +2 -0
- package/dist/lib/AssistantPlugin.node.mjs +55 -0
- package/dist/lib/AssistantPlugin.node.mjs.map +1 -0
- package/dist/lib/AssistantPlugin.workerd.mjs +43 -0
- package/dist/lib/AssistantPlugin.workerd.mjs.map +1 -0
- package/dist/lib/capabilities.mjs +24 -0
- package/dist/lib/capabilities.mjs.map +1 -0
- package/dist/lib/chunk-AgentArticle.mjs +52 -0
- package/dist/lib/chunk-AgentArticle.mjs.map +1 -0
- package/dist/lib/chunk-AgentProperties.mjs +35 -0
- package/dist/lib/chunk-AgentProperties.mjs.map +1 -0
- package/dist/lib/chunk-AssistantPlugin.mjs +88 -0
- package/dist/lib/chunk-AssistantPlugin.mjs.map +1 -0
- package/dist/lib/chunk-AssistantSettings.mjs +285 -0
- package/dist/lib/chunk-AssistantSettings.mjs.map +1 -0
- package/dist/lib/chunk-ChatArticle.mjs +121 -0
- package/dist/lib/chunk-ChatArticle.mjs.map +1 -0
- package/dist/lib/chunk-ChatCompanion.mjs +116 -0
- package/dist/lib/chunk-ChatCompanion.mjs.map +1 -0
- package/dist/lib/chunk-ChatDialog.mjs +73 -0
- package/dist/lib/chunk-ChatDialog.mjs.map +1 -0
- package/dist/lib/chunk-IntegrationPrompt.mjs +73 -0
- package/dist/lib/chunk-IntegrationPrompt.mjs.map +1 -0
- package/dist/lib/chunk-SpaceHomePrompt.mjs +104 -0
- package/dist/lib/chunk-SpaceHomePrompt.mjs.map +1 -0
- package/dist/lib/chunk-SpaceHomeSuggestions.mjs +60 -0
- package/dist/lib/chunk-SpaceHomeSuggestions.mjs.map +1 -0
- package/dist/lib/chunk-TracePanel.mjs +127 -0
- package/dist/lib/chunk-TracePanel.mjs.map +1 -0
- package/dist/lib/chunk-TracePanel2.mjs +7 -0
- package/dist/lib/chunk-TracePanel2.mjs.map +1 -0
- package/dist/lib/chunk-TriggerStatus.mjs +72 -0
- package/dist/lib/chunk-TriggerStatus.mjs.map +1 -0
- package/dist/lib/chunk-agent-hydrator.mjs +22 -0
- package/dist/lib/chunk-agent-hydrator.mjs.map +1 -0
- package/dist/lib/chunk-agent-service.mjs +21 -0
- package/dist/lib/chunk-agent-service.mjs.map +1 -0
- package/dist/lib/{neutral/ai-context-LIKJYMIN.mjs → chunk-ai-context.mjs} +8 -12
- package/dist/lib/chunk-ai-context.mjs.map +1 -0
- package/dist/lib/chunk-ai-service.mjs +27 -0
- package/dist/lib/chunk-ai-service.mjs.map +1 -0
- package/dist/lib/chunk-app-graph-builder.mjs +179 -0
- package/dist/lib/chunk-app-graph-builder.mjs.map +1 -0
- package/dist/lib/chunk-automation-templates.mjs +99 -0
- package/dist/lib/chunk-automation-templates.mjs.map +1 -0
- package/dist/lib/chunk-companion-chat-provisioner.mjs +123 -0
- package/dist/lib/chunk-companion-chat-provisioner.mjs.map +1 -0
- package/dist/lib/chunk-connector.mjs +60 -0
- package/dist/lib/chunk-connector.mjs.map +1 -0
- package/dist/lib/chunk-constants.mjs +9 -0
- package/dist/lib/chunk-constants.mjs.map +1 -0
- package/dist/lib/chunk-context.mjs +7 -0
- package/dist/lib/chunk-context.mjs.map +1 -0
- package/dist/lib/chunk-create-chat.mjs +53 -0
- package/dist/lib/chunk-create-chat.mjs.map +1 -0
- package/dist/lib/chunk-create-object.mjs +70 -0
- package/dist/lib/chunk-create-object.mjs.map +1 -0
- package/dist/lib/chunk-edge-model-resolver.mjs +64 -0
- package/dist/lib/chunk-edge-model-resolver.mjs.map +1 -0
- package/dist/lib/chunk-ensure-companion-chat.mjs +49 -0
- package/dist/lib/chunk-ensure-companion-chat.mjs.map +1 -0
- package/dist/lib/chunk-extensions.mjs +78 -0
- package/dist/lib/chunk-extensions.mjs.map +1 -0
- package/dist/lib/chunk-fork-chat.mjs +83 -0
- package/dist/lib/chunk-fork-chat.mjs.map +1 -0
- package/dist/lib/chunk-generate-home-suggestions.mjs +71 -0
- package/dist/lib/chunk-generate-home-suggestions.mjs.map +1 -0
- package/dist/lib/chunk-local-model-resolver.mjs +25 -0
- package/dist/lib/chunk-local-model-resolver.mjs.map +1 -0
- package/dist/lib/chunk-markdown-extension.mjs +27 -0
- package/dist/lib/chunk-markdown-extension.mjs.map +1 -0
- package/dist/lib/{neutral/chunk-L7AR4VTA.mjs → chunk-meta.mjs} +20 -25
- package/dist/lib/chunk-meta.mjs.map +1 -0
- package/dist/lib/chunk-operation-handler.mjs +13 -0
- package/dist/lib/chunk-operation-handler.mjs.map +1 -0
- package/dist/lib/chunk-paths.mjs +8 -0
- package/dist/lib/chunk-paths.mjs.map +1 -0
- package/dist/lib/chunk-processor.mjs +432 -0
- package/dist/lib/chunk-processor.mjs.map +1 -0
- package/dist/lib/chunk-react-surface.mjs +177 -0
- package/dist/lib/chunk-react-surface.mjs.map +1 -0
- package/dist/lib/chunk-run-prompt-in-new-chat.mjs +96 -0
- package/dist/lib/chunk-run-prompt-in-new-chat.mjs.map +1 -0
- package/dist/lib/chunk-set-current-chat.mjs +43 -0
- package/dist/lib/chunk-set-current-chat.mjs.map +1 -0
- package/dist/lib/chunk-settings.mjs +23 -0
- package/dist/lib/chunk-settings.mjs.map +1 -0
- package/dist/lib/chunk-skill-definition.mjs +42 -0
- package/dist/lib/chunk-skill-definition.mjs.map +1 -0
- package/dist/lib/chunk-skills.mjs +19 -0
- package/dist/lib/chunk-skills.mjs.map +1 -0
- package/dist/lib/chunk-state.mjs +32 -0
- package/dist/lib/chunk-state.mjs.map +1 -0
- package/dist/lib/chunk-toggle-trace-panel-debug.mjs +18 -0
- package/dist/lib/chunk-toggle-trace-panel-debug.mjs.map +1 -0
- package/dist/lib/chunk-toolkit.mjs +12 -0
- package/dist/lib/chunk-toolkit.mjs.map +1 -0
- package/dist/lib/chunk-types.mjs +332 -0
- package/dist/lib/chunk-types.mjs.map +1 -0
- package/dist/lib/chunk-update-chat-name.mjs +63 -0
- package/dist/lib/chunk-update-chat-name.mjs.map +1 -0
- package/dist/lib/components.mjs +2616 -0
- package/dist/lib/components.mjs.map +1 -0
- package/dist/lib/containers.mjs +17 -0
- package/dist/lib/containers.mjs.map +1 -0
- package/dist/lib/execution-graph.mjs +961 -0
- package/dist/lib/execution-graph.mjs.map +1 -0
- package/dist/lib/extensions.mjs +2 -0
- package/dist/lib/hooks.mjs +674 -0
- package/dist/lib/hooks.mjs.map +1 -0
- package/dist/lib/index.mjs +5 -0
- package/dist/lib/meta.mjs +2 -0
- package/dist/lib/operations.mjs +7 -0
- package/dist/lib/operations.mjs.map +1 -0
- package/dist/lib/plugin.mjs +9 -0
- package/dist/lib/plugin.mjs.map +1 -0
- package/dist/lib/plugin.workerd.mjs +2 -0
- package/dist/lib/skills.mjs +2 -0
- package/dist/lib/testing.mjs +2 -0
- package/dist/lib/translations.mjs +207 -0
- package/dist/lib/translations.mjs.map +1 -0
- package/dist/lib/types.mjs +2 -0
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/AssistantPlugin.node.d.ts.map +1 -1
- package/dist/types/src/AssistantPlugin.workerd.d.ts.map +1 -1
- package/dist/types/src/capabilities/AssistantSurfaces.d.ts +22 -0
- package/dist/types/src/capabilities/AssistantSurfaces.d.ts.map +1 -0
- package/dist/types/src/capabilities/agent-hydrator.d.ts +1 -1
- package/dist/types/src/capabilities/agent-service.d.ts +1 -1
- package/dist/types/src/capabilities/agent-service.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-context.d.ts +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +12 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/automation-templates.d.ts +1 -1
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts +1 -1
- package/dist/types/src/capabilities/connector.d.ts +1 -1
- package/dist/types/src/capabilities/create-object.d.ts +1 -1
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +0 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown-extension.d.ts +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/capabilities/skill-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/standalone-chats-query.test.d.ts +2 -0
- package/dist/types/src/capabilities/standalone-chats-query.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts +1 -1
- package/dist/types/src/components/AgentProperties/AgentProperties.d.ts +4 -1
- package/dist/types/src/components/AgentProperties/AgentProperties.d.ts.map +1 -1
- package/dist/types/src/components/AgentProperties/AgentProperties.stories.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +21 -8
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/{Chat.stories.d.ts → Error.stories.d.ts} +1 -1
- package/dist/types/src/components/Chat/Error.stories.d.ts.map +1 -0
- package/dist/types/src/components/Chat/context.d.ts +8 -0
- package/dist/types/src/components/Chat/context.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +5 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/Chat/thread.d.ts +42 -0
- package/dist/types/src/components/Chat/thread.d.ts.map +1 -0
- package/dist/types/src/components/Chat/thread.test.d.ts +2 -0
- package/dist/types/src/components/Chat/thread.test.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatPrompt.d.ts +5 -3
- package/dist/types/src/components/ChatPrompt/ChatPrompt.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +0 -1
- 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 +8 -3
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +30 -2
- 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/index.d.ts +1 -0
- package/dist/types/src/components/ChatThread/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/sync/index.d.ts +3 -0
- package/dist/types/src/components/ChatThread/sync/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/{sync.d.ts → sync/sync.d.ts} +46 -2
- package/dist/types/src/components/ChatThread/sync/sync.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync/sync.test.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync/tool-widget-state.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync/tool-widget-state.test.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/BranchWidget.d.ts +15 -0
- package/dist/types/src/components/ChatThread/widgets/BranchWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/BranchWidget.stories.d.ts +21 -0
- package/dist/types/src/components/ChatThread/widgets/BranchWidget.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/BranchWidget.test.d.ts +2 -0
- package/dist/types/src/components/ChatThread/widgets/BranchWidget.test.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/ReferenceWidget.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/ToolWidget.d.ts +1 -2
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/defaults.d.ts +6 -0
- package/dist/types/src/components/ChatThread/widgets/defaults.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/format-time.d.ts +2 -0
- package/dist/types/src/components/ChatThread/widgets/format-time.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/index.d.ts +4 -1
- package/dist/types/src/components/ChatThread/widgets/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/is-tool-message.d.ts +3 -0
- package/dist/types/src/components/ChatThread/widgets/is-tool-message.d.ts.map +1 -0
- package/dist/types/src/components/ConnectorAuthMenu/ConnectorAuthMenu.d.ts +16 -0
- package/dist/types/src/components/ConnectorAuthMenu/ConnectorAuthMenu.d.ts.map +1 -0
- package/dist/types/src/components/ConnectorAuthMenu/ConnectorAuthMenu.stories.d.ts +210 -0
- package/dist/types/src/components/ConnectorAuthMenu/ConnectorAuthMenu.stories.d.ts.map +1 -0
- package/dist/types/src/components/ConnectorAuthMenu/index.d.ts +2 -0
- package/dist/types/src/components/ConnectorAuthMenu/index.d.ts.map +1 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts +1 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts.map +1 -1
- package/dist/types/src/components/TaskList/TaskList.d.ts +9 -11
- package/dist/types/src/components/TaskList/TaskList.d.ts.map +1 -1
- package/dist/types/src/components/TaskList/TaskList.stories.d.ts +3 -4
- package/dist/types/src/components/TaskList/TaskList.stories.d.ts.map +1 -1
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +1 -2
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/ToolBlock/index.d.ts +1 -0
- package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -1
- package/dist/types/src/components/ToolBlock/is-tool-message.d.ts +3 -0
- package/dist/types/src/components/ToolBlock/is-tool-message.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/AgentArticle/AgentArticle.d.ts +5 -2
- 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 +4 -1
- package/dist/types/src/containers/AgentProperties/AgentProperties.d.ts.map +1 -1
- package/dist/types/src/containers/AssistantSettings/AssistantSettings.d.ts +4 -1
- package/dist/types/src/containers/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/containers/AssistantSettings/AssistantSettings.stories.d.ts +4 -1
- package/dist/types/src/containers/AssistantSettings/AssistantSettings.stories.d.ts.map +1 -1
- package/dist/types/src/containers/AssistantSettings/OllamaModels.d.ts +4 -6
- package/dist/types/src/containers/AssistantSettings/OllamaModels.d.ts.map +1 -1
- package/dist/types/src/containers/ChatArticle/ChatArticle.d.ts.map +1 -1
- package/dist/types/src/containers/ChatArticle/ChatArticle.stories.d.ts +22 -1
- package/dist/types/src/containers/ChatArticle/ChatArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts.map +1 -1
- package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts +4 -1
- package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/containers/IntegrationPrompt/IntegrationPrompt.d.ts +4 -7
- package/dist/types/src/containers/IntegrationPrompt/IntegrationPrompt.d.ts.map +1 -1
- package/dist/types/src/containers/SpaceHomePrompt/SpaceHomePrompt.d.ts +4 -9
- package/dist/types/src/containers/SpaceHomePrompt/SpaceHomePrompt.d.ts.map +1 -1
- package/dist/types/src/containers/SpaceHomeSuggestions/SpaceHomeSuggestions.d.ts +5 -7
- package/dist/types/src/containers/SpaceHomeSuggestions/SpaceHomeSuggestions.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts +1 -1
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts.map +1 -1
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts +15 -1
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +0 -1
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/execution-graph/execution-graph.d.ts +12 -1
- package/dist/types/src/execution-graph/execution-graph.d.ts.map +1 -1
- package/dist/types/src/execution-graph/index.d.ts +1 -1
- package/dist/types/src/execution-graph/index.d.ts.map +1 -1
- package/dist/types/src/execution-graph/pending-block-status.d.ts.map +1 -1
- package/dist/types/src/execution-graph/span-tree.d.ts +17 -0
- package/dist/types/src/execution-graph/span-tree.d.ts.map +1 -1
- package/dist/types/src/feed-logger.d.ts +1 -1
- package/dist/types/src/feed-logger.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextObjects.d.ts +1 -1
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -1
- package/dist/types/src/hooks/useSelectionContext.d.ts +13 -0
- package/dist/types/src/hooks/useSelectionContext.d.ts.map +1 -0
- package/dist/types/src/hooks/useSelectionContext.test.d.ts +2 -0
- package/dist/types/src/hooks/useSelectionContext.test.d.ts.map +1 -0
- package/dist/types/src/hooks/useTraceMessages.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +1 -0
- package/dist/types/src/processor/index.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +5 -2
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/processor/prompt.d.ts +18 -0
- package/dist/types/src/processor/prompt.d.ts.map +1 -0
- package/dist/types/src/processor/prompt.test.d.ts +2 -0
- package/dist/types/src/processor/prompt.test.d.ts.map +1 -0
- package/dist/types/src/processor/streaming.node.test.d.ts +2 -0
- package/dist/types/src/processor/streaming.node.test.d.ts.map +1 -0
- package/dist/types/src/skills/assistant/skill.d.ts.map +1 -1
- package/dist/types/src/templates/scaffold.d.ts +1 -1
- package/dist/types/src/templates/scaffold.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/AssistantCapabilities.d.ts +1 -1
- package/dist/types/src/types/AssistantCapabilities.d.ts.map +1 -1
- package/dist/types/src/types/AssistantOperation.d.ts +2 -13
- package/dist/types/src/types/AssistantOperation.d.ts.map +1 -1
- package/dist/types/src/types/ChatSurface.d.ts +2 -2
- package/dist/types/src/types/ChatSurface.d.ts.map +1 -1
- package/dist/types/src/types/Ollama.d.ts +1 -1
- package/dist/types/src/types/Ollama.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dx.config.ts +1 -0
- package/package.json +106 -105
- package/src/AssistantPlugin.node.ts +1 -2
- package/src/AssistantPlugin.test.ts +60 -62
- package/src/AssistantPlugin.ts +1 -10
- package/src/AssistantPlugin.workerd.ts +1 -2
- package/src/capabilities/AssistantSurfaces.tsx +86 -0
- package/src/capabilities/agent-service.ts +1 -1
- package/src/capabilities/app-graph-builder.ts +31 -17
- package/src/capabilities/companion-chat-provisioner.ts +12 -11
- package/src/capabilities/connector.ts +3 -3
- package/src/capabilities/edge-model-resolver.ts +5 -2
- package/src/capabilities/index.ts +0 -2
- package/src/capabilities/react-surface.ts +135 -0
- package/src/capabilities/skill-definition.ts +4 -0
- package/src/capabilities/standalone-chats-query.test.ts +51 -0
- package/src/capabilities/state.ts +1 -1
- package/src/components/AgentProperties/AgentProperties.stories.tsx +6 -7
- package/src/components/AgentProperties/AgentProperties.tsx +37 -30
- package/src/components/Chat/Chat.tsx +275 -59
- package/src/components/Chat/{Chat.stories.tsx → Error.stories.tsx} +1 -1
- package/src/components/Chat/context.ts +8 -0
- package/src/components/Chat/events.ts +5 -0
- package/src/components/Chat/thread.test.ts +127 -0
- package/src/components/Chat/thread.ts +87 -0
- package/src/components/ChatPrompt/ChatActions.tsx +8 -8
- package/src/components/ChatPrompt/ChatMcpErrors.tsx +2 -2
- package/src/components/ChatPrompt/ChatOptions.stories.tsx +2 -1
- package/src/components/ChatPrompt/ChatOptions.tsx +5 -5
- package/src/components/ChatPrompt/ChatPrompt.tsx +33 -6
- package/src/components/ChatPrompt/index.ts +0 -1
- package/src/components/ChatThread/Anchor.stories.tsx +2 -1
- package/src/components/ChatThread/ChatThread.stories.tsx +99 -4
- package/src/components/ChatThread/ChatThread.tsx +34 -6
- package/src/components/ChatThread/Link.tsx +1 -0
- package/src/components/ChatThread/index.ts +2 -0
- package/src/components/ChatThread/registry.tsx +28 -4
- package/src/components/ChatThread/sync/index.ts +6 -0
- package/src/components/ChatThread/{sync.test.ts → sync/sync.test.ts} +167 -7
- package/src/components/ChatThread/{sync.ts → sync/sync.ts} +97 -3
- package/src/components/ChatThread/{tool-widget-state.ts → sync/tool-widget-state.ts} +1 -3
- package/src/components/ChatThread/widgets/BranchWidget.stories.tsx +83 -0
- package/src/components/ChatThread/widgets/BranchWidget.test.ts +55 -0
- package/src/components/ChatThread/widgets/BranchWidget.tsx +61 -0
- package/src/components/ChatThread/widgets/FallbackWidget.tsx +2 -2
- package/src/components/ChatThread/widgets/ReasoningWidget.ts +1 -1
- package/src/components/ChatThread/widgets/ReferenceWidget.ts +1 -6
- package/src/components/ChatThread/widgets/SuggestionWidget.ts +12 -3
- package/src/components/ChatThread/widgets/SummaryWidget.tsx +1 -1
- package/src/components/ChatThread/widgets/ToolWidget.tsx +15 -9
- package/src/components/ChatThread/widgets/defaults.ts +7 -1
- package/src/components/ChatThread/widgets/format-time.ts +45 -0
- package/src/components/ChatThread/widgets/index.ts +4 -1
- package/src/components/ChatThread/widgets/is-tool-message.ts +13 -0
- package/src/components/ConnectorAuthMenu/ConnectorAuthMenu.stories.tsx +177 -0
- package/src/components/ConnectorAuthMenu/ConnectorAuthMenu.tsx +82 -0
- package/src/components/ConnectorAuthMenu/index.ts +5 -0
- package/src/components/ProcessTree/ProcessTree.stories.tsx +1 -1
- package/src/components/TaskList/TaskList.stories.tsx +19 -26
- package/src/components/TaskList/TaskList.tsx +32 -104
- package/src/components/ToolBlock/ToolBlock.tsx +1 -5
- package/src/components/ToolBlock/index.ts +1 -0
- package/src/components/ToolBlock/is-tool-message.ts +13 -0
- package/src/components/Toolbox/Toolbox.tsx +1 -1
- package/src/components/index.ts +1 -0
- package/src/containers/AgentArticle/AgentArticle.stories.tsx +18 -11
- package/src/containers/AgentArticle/AgentArticle.tsx +27 -151
- package/src/containers/AgentProperties/AgentProperties.tsx +21 -17
- package/src/containers/AssistantSettings/AssistantSettings.tsx +2 -0
- package/src/containers/AssistantSettings/OllamaModels.tsx +6 -4
- package/src/containers/ChatArticle/ChatArticle.stories.tsx +200 -27
- package/src/containers/ChatArticle/ChatArticle.tsx +25 -5
- package/src/containers/ChatCompanion/ChatCompanion.tsx +45 -10
- package/src/containers/ChatDialog/ChatDialog.tsx +4 -1
- package/src/containers/IntegrationPrompt/IntegrationPrompt.tsx +9 -6
- package/src/containers/SpaceHomePrompt/SpaceHomePrompt.tsx +2 -0
- package/src/containers/SpaceHomeSuggestions/SpaceHomeSuggestions.tsx +40 -39
- package/src/containers/TracePanel/TracePanel.stories.tsx +9 -4
- package/src/containers/TracePanel/TracePanel.tsx +22 -6
- package/src/containers/TriggerStatus/TriggerStatus.tsx +9 -16
- package/src/containers/index.ts +0 -1
- package/src/execution-graph/SPEC.md +60 -2
- package/src/execution-graph/execution-graph.ts +15 -2
- package/src/execution-graph/index.ts +1 -0
- package/src/execution-graph/pending-block-status.ts +3 -2
- package/src/execution-graph/span-tree.test.ts +87 -1
- package/src/execution-graph/span-tree.ts +95 -0
- package/src/feed-logger.ts +6 -6
- package/src/hooks/index.ts +1 -1
- package/src/hooks/useChatProcessor.ts +2 -1
- package/src/hooks/useChatToolbarActions.ts +22 -19
- package/src/hooks/useContextObjects.ts +9 -3
- package/src/hooks/useSelectionContext.test.ts +93 -0
- package/src/hooks/useSelectionContext.ts +72 -0
- package/src/hooks/useSkillRegistry.ts +1 -1
- package/src/hooks/useTraceMessages.ts +5 -3
- package/src/operations/create-chat.ts +2 -2
- package/src/operations/fork-chat.ts +2 -2
- package/src/operations/generate-home-suggestions.test.ts +2 -2
- package/src/operations/index.ts +0 -1
- package/src/operations/prompt.node.test.ts +1 -1
- package/src/paths.ts +3 -3
- package/src/processor/index.ts +1 -0
- package/src/processor/processor.node.test.ts +1 -1
- package/src/processor/processor.ts +33 -5
- package/src/processor/prompt.test.ts +37 -0
- package/src/processor/prompt.ts +42 -0
- package/src/processor/streaming.node.test.ts +196 -0
- package/src/skills/assistant/skill.node.test.ts +2 -2
- package/src/skills/assistant/skill.ts +3 -5
- package/src/templates/routine-templates.test.ts +1 -2
- package/src/templates/scaffold.ts +3 -3
- package/src/testing/data/trace-timeline-multiple.dx.json +1 -1
- package/src/testing/data/trace-timeline-remote.dx.json +1 -1
- package/src/testing/data/trace-timeline.dx.json +1 -2
- package/src/testing/trace-timeline.node.test.ts +3 -3
- package/src/translations.ts +11 -10
- package/src/types/AssistantCapabilities.ts +1 -1
- package/src/types/AssistantOperation.ts +8 -31
- package/src/types/ChatSurface.ts +3 -3
- package/src/types/Ollama.ts +1 -1
- package/dist/lib/neutral/AgentArticle-GV6EEW3I.mjs +0 -161
- package/dist/lib/neutral/AgentArticle-GV6EEW3I.mjs.map +0 -7
- package/dist/lib/neutral/AgentProperties-LFTEYJ54.mjs +0 -40
- package/dist/lib/neutral/AgentProperties-LFTEYJ54.mjs.map +0 -7
- package/dist/lib/neutral/AssistantPlugin.mjs +0 -10
- package/dist/lib/neutral/AssistantPlugin.mjs.map +0 -7
- package/dist/lib/neutral/AssistantPlugin.node.mjs +0 -72
- package/dist/lib/neutral/AssistantPlugin.node.mjs.map +0 -7
- package/dist/lib/neutral/AssistantPlugin.workerd.mjs +0 -13
- package/dist/lib/neutral/AssistantPlugin.workerd.mjs.map +0 -7
- package/dist/lib/neutral/AssistantSettings-3N5M5VCN.mjs +0 -302
- package/dist/lib/neutral/AssistantSettings-3N5M5VCN.mjs.map +0 -7
- package/dist/lib/neutral/ChatArticle-OO7GGEFW.mjs +0 -8
- package/dist/lib/neutral/ChatArticle-OO7GGEFW.mjs.map +0 -7
- package/dist/lib/neutral/ChatCompanion-GIFJRY6I.mjs +0 -128
- package/dist/lib/neutral/ChatCompanion-GIFJRY6I.mjs.map +0 -7
- package/dist/lib/neutral/ChatDialog-5MXN4MXS.mjs +0 -74
- package/dist/lib/neutral/ChatDialog-5MXN4MXS.mjs.map +0 -7
- package/dist/lib/neutral/IntegrationPrompt-2HJQFYJE.mjs +0 -72
- package/dist/lib/neutral/IntegrationPrompt-2HJQFYJE.mjs.map +0 -7
- package/dist/lib/neutral/PlanArticle-VPK2IYWU.mjs +0 -34
- package/dist/lib/neutral/PlanArticle-VPK2IYWU.mjs.map +0 -7
- package/dist/lib/neutral/SpaceHomePrompt-ISAB76LD.mjs +0 -114
- package/dist/lib/neutral/SpaceHomePrompt-ISAB76LD.mjs.map +0 -7
- package/dist/lib/neutral/SpaceHomeSuggestions-IDH77QQR.mjs +0 -63
- package/dist/lib/neutral/SpaceHomeSuggestions-IDH77QQR.mjs.map +0 -7
- package/dist/lib/neutral/TracePanel-JKNWADJ4.mjs +0 -12
- package/dist/lib/neutral/TracePanel-JKNWADJ4.mjs.map +0 -7
- package/dist/lib/neutral/TriggerStatus-FURRBHYA.mjs +0 -95
- package/dist/lib/neutral/TriggerStatus-FURRBHYA.mjs.map +0 -7
- package/dist/lib/neutral/agent-hydrator-OBO3RHLO.mjs +0 -23
- package/dist/lib/neutral/agent-hydrator-OBO3RHLO.mjs.map +0 -7
- package/dist/lib/neutral/agent-service-XFJ4VQMT.mjs +0 -32
- package/dist/lib/neutral/agent-service-XFJ4VQMT.mjs.map +0 -7
- package/dist/lib/neutral/ai-context-LIKJYMIN.mjs.map +0 -7
- package/dist/lib/neutral/ai-service-DM6YXWUC.mjs +0 -44
- package/dist/lib/neutral/ai-service-DM6YXWUC.mjs.map +0 -7
- package/dist/lib/neutral/app-graph-builder-OPVOEQY7.mjs +0 -249
- package/dist/lib/neutral/app-graph-builder-OPVOEQY7.mjs.map +0 -7
- package/dist/lib/neutral/automation-templates-MADJLXGJ.mjs +0 -97
- package/dist/lib/neutral/automation-templates-MADJLXGJ.mjs.map +0 -7
- package/dist/lib/neutral/capabilities/index.mjs +0 -47
- package/dist/lib/neutral/capabilities/index.mjs.map +0 -7
- package/dist/lib/neutral/chunk-5IHQ52KJ.mjs +0 -9
- package/dist/lib/neutral/chunk-5IHQ52KJ.mjs.map +0 -7
- package/dist/lib/neutral/chunk-6Q4OBGIK.mjs +0 -420
- package/dist/lib/neutral/chunk-6Q4OBGIK.mjs.map +0 -7
- package/dist/lib/neutral/chunk-BXI2R4OO.mjs +0 -410
- package/dist/lib/neutral/chunk-BXI2R4OO.mjs.map +0 -7
- package/dist/lib/neutral/chunk-CMPLPDYE.mjs +0 -30
- package/dist/lib/neutral/chunk-CMPLPDYE.mjs.map +0 -7
- package/dist/lib/neutral/chunk-GPHT3HYS.mjs +0 -8
- package/dist/lib/neutral/chunk-GPHT3HYS.mjs.map +0 -7
- package/dist/lib/neutral/chunk-HKLSFB5I.mjs +0 -90
- package/dist/lib/neutral/chunk-HKLSFB5I.mjs.map +0 -7
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
- package/dist/lib/neutral/chunk-L7AR4VTA.mjs.map +0 -7
- package/dist/lib/neutral/chunk-LS72HWMM.mjs +0 -42
- package/dist/lib/neutral/chunk-LS72HWMM.mjs.map +0 -7
- package/dist/lib/neutral/chunk-OZWZGIV2.mjs +0 -12
- package/dist/lib/neutral/chunk-OZWZGIV2.mjs.map +0 -7
- package/dist/lib/neutral/chunk-QOKLFHUS.mjs +0 -13
- package/dist/lib/neutral/chunk-QOKLFHUS.mjs.map +0 -7
- package/dist/lib/neutral/chunk-SCTHQVIJ.mjs +0 -155
- package/dist/lib/neutral/chunk-SCTHQVIJ.mjs.map +0 -7
- package/dist/lib/neutral/chunk-U4LTLBAX.mjs +0 -56
- package/dist/lib/neutral/chunk-U4LTLBAX.mjs.map +0 -7
- package/dist/lib/neutral/chunk-UPKFUZ6V.mjs +0 -115
- package/dist/lib/neutral/chunk-UPKFUZ6V.mjs.map +0 -7
- package/dist/lib/neutral/chunk-V2Y4XE3O.mjs +0 -12
- package/dist/lib/neutral/chunk-V2Y4XE3O.mjs.map +0 -7
- package/dist/lib/neutral/chunk-VTK5R4H3.mjs +0 -9
- package/dist/lib/neutral/chunk-VTK5R4H3.mjs.map +0 -7
- package/dist/lib/neutral/chunk-XVGEJWJX.mjs +0 -133
- package/dist/lib/neutral/chunk-XVGEJWJX.mjs.map +0 -7
- package/dist/lib/neutral/companion-chat-provisioner-IQV5VIVE.mjs +0 -126
- package/dist/lib/neutral/companion-chat-provisioner-IQV5VIVE.mjs.map +0 -7
- package/dist/lib/neutral/components/index.mjs +0 -2527
- package/dist/lib/neutral/components/index.mjs.map +0 -7
- package/dist/lib/neutral/connector-ITLLTBPZ.mjs +0 -70
- package/dist/lib/neutral/connector-ITLLTBPZ.mjs.map +0 -7
- package/dist/lib/neutral/containers/index.mjs +0 -31
- package/dist/lib/neutral/containers/index.mjs.map +0 -7
- package/dist/lib/neutral/create-chat-YGVZZYGP.mjs +0 -56
- package/dist/lib/neutral/create-chat-YGVZZYGP.mjs.map +0 -7
- package/dist/lib/neutral/create-object-5PAEJ6KM.mjs +0 -76
- package/dist/lib/neutral/create-object-5PAEJ6KM.mjs.map +0 -7
- package/dist/lib/neutral/edge-model-resolver-WDJWDZTT.mjs +0 -55
- package/dist/lib/neutral/edge-model-resolver-WDJWDZTT.mjs.map +0 -7
- package/dist/lib/neutral/ensure-companion-chat-AMOF3C66.mjs +0 -58
- package/dist/lib/neutral/ensure-companion-chat-AMOF3C66.mjs.map +0 -7
- package/dist/lib/neutral/execution-graph/index.mjs +0 -977
- package/dist/lib/neutral/execution-graph/index.mjs.map +0 -7
- package/dist/lib/neutral/extensions/index.mjs +0 -8
- package/dist/lib/neutral/extensions/index.mjs.map +0 -7
- package/dist/lib/neutral/fork-chat-RMAAYYQF.mjs +0 -92
- package/dist/lib/neutral/fork-chat-RMAAYYQF.mjs.map +0 -7
- package/dist/lib/neutral/generate-home-suggestions-6MM2XWPV.mjs +0 -93
- package/dist/lib/neutral/generate-home-suggestions-6MM2XWPV.mjs.map +0 -7
- package/dist/lib/neutral/hooks/index.mjs +0 -877
- package/dist/lib/neutral/hooks/index.mjs.map +0 -7
- package/dist/lib/neutral/index.mjs +0 -42
- package/dist/lib/neutral/index.mjs.map +0 -7
- package/dist/lib/neutral/local-model-resolver-I2BENFFS.mjs +0 -24
- package/dist/lib/neutral/local-model-resolver-I2BENFFS.mjs.map +0 -7
- package/dist/lib/neutral/markdown-extension-R4TKDTIF.mjs +0 -41
- package/dist/lib/neutral/markdown-extension-R4TKDTIF.mjs.map +0 -7
- package/dist/lib/neutral/meta.json +0 -1
- package/dist/lib/neutral/meta.mjs +0 -12
- package/dist/lib/neutral/meta.mjs.map +0 -7
- package/dist/lib/neutral/migrations-7DEMVBOG.mjs +0 -28
- package/dist/lib/neutral/migrations-7DEMVBOG.mjs.map +0 -7
- package/dist/lib/neutral/navigation-resolver-PYGP2DAW.mjs +0 -18
- package/dist/lib/neutral/navigation-resolver-PYGP2DAW.mjs.map +0 -7
- package/dist/lib/neutral/operation-handler-2LEN45GP.mjs +0 -8
- package/dist/lib/neutral/operation-handler-2LEN45GP.mjs.map +0 -7
- package/dist/lib/neutral/operations/index.mjs +0 -8
- package/dist/lib/neutral/operations/index.mjs.map +0 -7
- package/dist/lib/neutral/plugin.mjs +0 -16
- package/dist/lib/neutral/plugin.mjs.map +0 -7
- package/dist/lib/neutral/plugin.workerd.mjs +0 -13
- package/dist/lib/neutral/plugin.workerd.mjs.map +0 -7
- package/dist/lib/neutral/react-surface-HEJEK44F.mjs +0 -171
- package/dist/lib/neutral/react-surface-HEJEK44F.mjs.map +0 -7
- package/dist/lib/neutral/resolve-navigation-targets-PBQ3OLUE.mjs +0 -28
- package/dist/lib/neutral/resolve-navigation-targets-PBQ3OLUE.mjs.map +0 -7
- package/dist/lib/neutral/run-prompt-in-new-chat-RNUJE2FM.mjs +0 -102
- package/dist/lib/neutral/run-prompt-in-new-chat-RNUJE2FM.mjs.map +0 -7
- package/dist/lib/neutral/set-current-chat-VWBPSIMZ.mjs +0 -48
- package/dist/lib/neutral/set-current-chat-VWBPSIMZ.mjs.map +0 -7
- package/dist/lib/neutral/settings-7Q3RITIT.mjs +0 -28
- package/dist/lib/neutral/settings-7Q3RITIT.mjs.map +0 -7
- package/dist/lib/neutral/skill-definition-553MQRTR.mjs +0 -8
- package/dist/lib/neutral/skill-definition-553MQRTR.mjs.map +0 -7
- package/dist/lib/neutral/skills/index.mjs +0 -8
- package/dist/lib/neutral/skills/index.mjs.map +0 -7
- package/dist/lib/neutral/state-4LGAKSSD.mjs +0 -34
- package/dist/lib/neutral/state-4LGAKSSD.mjs.map +0 -7
- package/dist/lib/neutral/testing.mjs +0 -8
- package/dist/lib/neutral/testing.mjs.map +0 -7
- package/dist/lib/neutral/toggle-trace-panel-debug-JGTB6KVJ.mjs +0 -21
- package/dist/lib/neutral/toggle-trace-panel-debug-JGTB6KVJ.mjs.map +0 -7
- package/dist/lib/neutral/toolkit-ETWLG5NT.mjs +0 -8
- package/dist/lib/neutral/toolkit-ETWLG5NT.mjs.map +0 -7
- package/dist/lib/neutral/translations.mjs +0 -217
- package/dist/lib/neutral/translations.mjs.map +0 -7
- package/dist/lib/neutral/types/index.mjs +0 -24
- package/dist/lib/neutral/types/index.mjs.map +0 -7
- package/dist/lib/neutral/update-chat-name-IJJELRR6.mjs +0 -61
- package/dist/lib/neutral/update-chat-name-IJJELRR6.mjs.map +0 -7
- package/dist/types/src/capabilities/migrations.d.ts +0 -5
- package/dist/types/src/capabilities/migrations.d.ts.map +0 -1
- package/dist/types/src/capabilities/navigation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/navigation-resolver.d.ts.map +0 -1
- package/dist/types/src/components/Chat/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +0 -10
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/sync.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/sync.test.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/tool-widget-state.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/tool-widget-state.test.d.ts.map +0 -1
- package/dist/types/src/containers/PlanArticle/PlanArticle.d.ts +0 -6
- package/dist/types/src/containers/PlanArticle/PlanArticle.d.ts.map +0 -1
- package/dist/types/src/containers/PlanArticle/index.d.ts +0 -2
- package/dist/types/src/containers/PlanArticle/index.d.ts.map +0 -1
- package/dist/types/src/hooks/useFlush.d.ts +0 -6
- package/dist/types/src/hooks/useFlush.d.ts.map +0 -1
- package/dist/types/src/operations/resolve-navigation-targets.d.ts +0 -5
- package/dist/types/src/operations/resolve-navigation-targets.d.ts.map +0 -1
- package/src/AssistantPlugin.conversations.json +0 -1
- package/src/capabilities/migrations.ts +0 -28
- package/src/capabilities/navigation-resolver.ts +0 -20
- package/src/capabilities/react-surface.tsx +0 -177
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +0 -42
- package/src/components/ChatThread/DEBUG.md +0 -64
- package/src/containers/PlanArticle/PlanArticle.tsx +0 -37
- package/src/containers/PlanArticle/index.ts +0 -5
- package/src/hooks/useFlush.ts +0 -35
- package/src/operations/resolve-navigation-targets.ts +0 -44
- /package/dist/types/src/components/ChatThread/{sync.test.d.ts → sync/sync.test.d.ts} +0 -0
- /package/dist/types/src/components/ChatThread/{tool-widget-state.d.ts → sync/tool-widget-state.d.ts} +0 -0
- /package/dist/types/src/components/ChatThread/{tool-widget-state.test.d.ts → sync/tool-widget-state.test.d.ts} +0 -0
- /package/src/components/ChatThread/{tool-widget-state.test.ts → sync/tool-widget-state.test.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-processor.mjs","names":[],"sources":["../../src/processor/presets.ts","../../src/util/error-cause.ts","../../src/processor/prompt.ts","../../src/processor/processor.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Model, Provider } from '@dxos/ai';\nimport { DXN } from '@dxos/keys';\n\n/**\n * A chat preset: a model offered for a provider, with a display label. Derived from the {@link Model}\n * catalog — see {@link presetsForProvider}.\n */\nexport type AiServicePreset = {\n id: string;\n provider: DXN.DXN;\n model: DXN.DXN;\n /** Provider-specific back-end name (e.g. an Ollama pull tag); used to match installed models. */\n backend: string;\n label: string;\n};\n\n/** Presets for a provider: every model the provider serves (the catalog filtered by provider). */\nexport const presetsForProvider = (provider: DXN.DXN): AiServicePreset[] =>\n Model.forProvider(provider).map((model) => ({\n id: model.id,\n provider,\n model: model.id,\n backend: model.backend,\n label: model.label,\n }));\n\n/**\n * Reconcile a stored provider DXN with the runtime: map the bundled sidecar (`built-in`) and an\n * external server (`ollama`) onto whichever is actually available — they are environment-exclusive\n * (the sidecar exists only on desktop). Defaults to `edge` when unset or unparseable.\n */\nexport const resolveProvider = (provider: string | undefined, hasBuiltIn: boolean): DXN.DXN => {\n const resolved = (provider ? DXN.tryMake(provider) : undefined) ?? Provider.edge.id;\n if (resolved === Provider.ollama.id && hasBuiltIn) {\n return Provider.builtIn.id;\n }\n if (resolved === Provider.builtIn.id && !hasBuiltIn) {\n return Provider.ollama.id;\n }\n return resolved;\n};\n\n/** The {@link Settings.modelDefaults} key for a provider (`built-in` shares the `ollama` key). */\nexport const defaultsKeyForProvider = (provider: DXN.DXN): 'edge' | 'ollama' | 'lmstudio' =>\n provider === Provider.edge.id ? 'edge' : provider === Provider.lmStudio.id ? 'lmstudio' : 'ollama';\n","//\n// Copyright 2026 DXOS.org\n//\n\n/** Walk an error's `cause` chain and return the first value matching `predicate`. */\nexport const findInCause = <T>(error: unknown, predicate: (value: unknown) => value is T): T | undefined => {\n let current: unknown = error;\n // Guard against self-referential / cyclic `cause` chains so traversal always terminates.\n const visited = new Set<unknown>();\n while (current) {\n if (visited.has(current)) {\n break;\n }\n visited.add(current);\n if (predicate(current)) {\n return current;\n }\n current = current instanceof Error ? current.cause : undefined;\n }\n return undefined;\n};\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport { ContentBlock } from '@dxos/types';\nimport { trim } from '@dxos/util';\n\n/** Ephemeral, per-request context captured at submit time (not part of the durable chat state). */\nexport type ProcessorRequestContext = {\n selection?: {\n /** Anchor strings (`\"${from}:${to}\"` cursor pairs) the text was resolved from; enables future in-place actions. */\n anchors: string[];\n text: string;\n };\n};\n\n/**\n * Prompt content for a request: the bare message, or — when the request carries selection context —\n * a synthetic block (system-generated user-turn content, hidden from the summary view) ahead of it.\n */\nexport const createPromptContent = (request: {\n message: string;\n context?: ProcessorRequestContext;\n}): string | ContentBlock.Any[] => {\n const selection = request.context?.selection;\n if (!selection?.text.length) {\n return request.message;\n }\n\n return [\n ContentBlock.Text.make({\n disposition: 'synthetic',\n text: trim`\n The user's current selection in the document they are viewing:\n <selection>\n ${selection.text}\n </selection>\n `,\n }),\n ContentBlock.Text.make({ text: request.message }),\n ];\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom, Registry as AtomRegistry } from '@effect-atom/atom';\nimport * as AiError from '@effect/ai/AiError';\nimport * as Cause from 'effect/Cause';\nimport * as Effect from 'effect/Effect';\nimport * as Exit from 'effect/Exit';\nimport * as Fiber from 'effect/Fiber';\nimport * as Layer from 'effect/Layer';\nimport * as Option from 'effect/Option';\nimport * as Stream from 'effect/Stream';\n\nimport { type AiService, Model, type OpaqueToolkit } from '@dxos/ai';\nimport { Capabilities } from '@dxos/app-framework';\nimport {\n AiContext,\n AiSession,\n Harness,\n McpServerError,\n PartialBlock,\n ToolExecutionServices,\n createSystemPrompt,\n formatSystemPrompt,\n} from '@dxos/assistant';\nimport { type Chat } from '@dxos/assistant-toolkit';\nimport {\n AgentService,\n type Credential,\n type Instructions,\n Operation,\n type ServiceNotAvailableError,\n Trace,\n} from '@dxos/compute';\nimport { Database, Feed, Obj, Ref, type Registry } from '@dxos/echo';\nimport { UsageQuotaExceededError } from '@dxos/edge-client';\nimport { EffectEx } from '@dxos/effect';\nimport { DXN } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport { Message } from '@dxos/types';\n\nimport { AssistantOperation } from '#types';\n\nimport { findInCause } from '../util/error-cause';\nimport { type ProcessorRequestContext, createPromptContent } from './prompt';\n\n/**\n * @deprecated Services type for the old direct-conversation processor path.\n * Retained for backward compatibility with CLI and update-name.\n */\nexport type AiChatServices =\n | Credential.CredentialsService\n | Database.Service\n | AiService.AiService\n | Trace.TraceService;\n\n/**\n * Space-scoped services materialised by the layer passed into\n * {@link AiChatProcessor}. Mirrors the tag list that\n * {@link useChatProcessor} passes to {@link ServiceResolver.provide}.\n */\nexport type SpaceServices =\n | Database.Service\n | Credential.CredentialsService\n | AiService.AiService\n | AgentService.AgentService\n | Registry.Service\n | OpaqueToolkit.OpaqueToolkitProvider;\n\nexport type AiChatProcessorOptions = {\n model?: DXN.DXN;\n // The selected provider, carried with the model so the agent process resolves the (provider, id)\n // pair — the catalog's shared model ids are ambiguous without it.\n provider?: DXN.DXN;\n modelRegistry?: Model.Registry;\n registry?: Registry.Registry;\n observableRegistry?: AtomRegistry.Registry;\n /**\n * For tracing.\n */\n chat?: Ref.Ref<Chat.Chat>;\n system?: string;\n};\n\nconst defaultOptions: Partial<AiChatProcessorOptions> = {\n model: Model.DEFAULT_EDGE,\n};\n\nexport type ProcessorRequestOptions = {};\n\nexport type ProcessorRequest = {\n message: string;\n /** Ephemeral context (e.g. companion-document selection) captured at submit time. */\n context?: ProcessorRequestContext;\n options?: ProcessorRequestOptions;\n};\n\n/** User-facing message shown when an AI request is rejected for exceeding the account usage quota (HTTP 429). */\nconst QUOTA_EXCEEDED_MESSAGE = 'You have reached your AI usage limit for this period.';\n\n/** An actionable next-step a chat error surfaces in its toast; the label key is resolved by the chat UI. */\nexport type ChatErrorAction = { readonly labelKey: string };\n\n/**\n * Display error for an over-quota (HTTP 429) rejection. Declares an {@link action} so the chat toast can\n * offer a usage-dashboard link declaratively — the UI renders whatever action an error declares rather\n * than branching on the error type.\n */\nexport class AiUsageQuotaError extends Error {\n readonly action: ChatErrorAction = { labelKey: 'view-usage.label' };\n}\n\n/**\n * Matches an over-quota rejection (EDGE responds 429) in error text. The typed\n * {@link UsageQuotaExceededError} is wrapped deep in the cause chain and does not survive the\n * agent-process boundary — the failure is rendered to a string via `Cause.pretty`, which drops\n * nested causes — so detection also relies on the HTTP 429 that `@effect/ai`'s\n * {@link AiError.HttpResponseError} embeds in its message (e.g. \"... (429 POST ...\").\n */\nconst QUOTA_PATTERN = /\\b429\\b|rate.?limit|too many requests|usage quota|quota exceeded/i;\n\n/** Whether an error denotes an over-quota (HTTP 429) rejection, detected by typed status or message text. */\nconst isQuotaError = (err: unknown): boolean => {\n if (AiError.isAiError(err)) {\n if (err._tag === 'HttpResponseError' && err.response.status === 429) {\n return true;\n }\n return QUOTA_PATTERN.test(err.description ?? err.message);\n }\n return typeof err === 'string' && QUOTA_PATTERN.test(err);\n};\n\n/**\n * Maps a failure from the agent fiber to an error suitable for display.\n * An over-quota (HTTP 429) rejection is surfaced as an actionable usage-limit message; the typed\n * {@link UsageQuotaExceededError} only survives on the direct path, so {@link isQuotaError} also\n * recognizes the stringified 429 the chat receives across the agent-process boundary.\n * Other {@link AiError}s originate from the AI service and are actionable by the user\n * (e.g., \"model 'x' not found\", \"Connection refused\"), so their detail is propagated.\n * Any other failure is treated as an internal/unexpected error and reported generically\n * to avoid leaking implementation detail.\n */\nexport const parseError = (err: unknown): Error => {\n const quotaError = findInCause(err, UsageQuotaExceededError.is);\n if (quotaError || isQuotaError(err)) {\n return new AiUsageQuotaError(quotaError?.message?.trim() || QUOTA_EXCEEDED_MESSAGE, { cause: err });\n }\n\n let message: string | undefined;\n if (AiError.isAiError(err)) {\n message = err.description?.trim() || err.message;\n } else if (typeof err === 'string') {\n // TODO(burdon): This is brittle.\n // UnknownError: ChatCompletionsClient.streamText: model 'gemma3:27b' not found\n const [, model] = err.match(/model\\s+'([^']+)'\\s+not\\s+found/i) || [];\n if (model) {\n message = `The model is not available: ${model}`;\n }\n }\n\n if (!message) {\n message = 'An unexpected error occurred.';\n }\n\n return new Error(message, { cause: err });\n};\n\n/**\n * Handles interactions with the AI service.\n * Uses AgentService to spawn a process-backed agent and subscribes to ephemeral trace events for streaming.\n */\nexport class AiChatProcessor {\n readonly #registry: AtomRegistry.Registry;\n\n /** Pending messages (finalized, non-streaming). */\n readonly #pending = Atom.make<Message.Message[]>([]);\n\n /** Currently streaming messages (from ephemeral trace events). */\n readonly #streaming = Atom.make<Message.Message[]>([]);\n\n /** Set of message IDs that have been finalized (non-pending delivered via ephemeral). */\n readonly #finalizedIds = new Set<string>();\n\n /** Currently active request fiber. */\n #requestFiber: Fiber.RuntimeFiber<void, unknown> | undefined;\n\n /** Last request (for retries). */\n #lastRequest: ProcessorRequest | undefined;\n\n /** Streaming state. */\n public readonly streaming = Atom.make<boolean>((get) => get(this.#streaming).length > 0);\n\n /** Active state. */\n public readonly active = Atom.make(false);\n\n /** Array of Messages (incl. the current message being streamed). */\n public readonly messages = Atom.make<Message.Message[]>((get) => [...get(this.#pending), ...get(this.#streaming)]);\n\n /** Last error. */\n public readonly error = Atom.make<Option.Option<Error>>(Option.none());\n\n /**\n * MCP server connection errors observed during the most recent request.\n * Misconfigured/unreachable servers are dropped from the toolkit so the chat\n * keeps working; the entries here let the UI display which servers failed.\n */\n public readonly mcpErrors = Atom.make<readonly Trace.PayloadType<typeof McpServerError>[]>([]);\n\n constructor(\n private readonly _conversation: AiSession.Session,\n private readonly _runtime: Capabilities.ProcessManagerRuntime,\n private readonly _feed: Feed.Feed,\n /**\n * Pre-built layer that materialises {@link SpaceServices}. Built via\n * {@link ServiceResolver.provide} with the {@link ServiceResolver} already\n * supplied (hence `RIn = never`); the {@link ServiceNotAvailableError}\n * error channel surfaces when a tag is not available for the space.\n * Provided to every effect run by the processor so the underlying\n * {@link ProcessManagerRuntime} has access to space-affinity services.\n */\n private readonly _spaceLayer: Layer.Layer<SpaceServices, ServiceNotAvailableError, never>,\n private readonly _options: AiChatProcessorOptions = defaultOptions,\n ) {\n this.#registry = this._options.observableRegistry ?? AtomRegistry.make();\n if (this._options.model && !this._options.system) {\n const capabilities = this._options.modelRegistry?.getCapabilities(this._options.model) ?? {};\n this._options.system = createSystemPrompt(capabilities);\n }\n }\n\n get context(): AiContext.Binder {\n return this._conversation.context;\n }\n\n get conversation() {\n return this._conversation;\n }\n\n get registry() {\n return this._options.registry;\n }\n\n get system(): string {\n return this._options.system ?? '';\n }\n\n async getTools(): Promise<Record<string, any>> {\n return this._runtime.runPromise(\n Effect.provide(this._conversation.getTools(), ToolExecutionServices).pipe(Effect.provide(this._spaceLayer)),\n );\n }\n\n async getSystemPrompt(): Promise<string> {\n return this._runtime.runPromise(\n Effect.gen(this, function* () {\n const skills = this.context.getSkills();\n const objects = this.context.getObjects();\n const instructions = yield* this.#getInstructions();\n // Tier A only: system-prompt formatting runs operations that read the conversation context;\n // the live-host Tier B control surface is not reachable from this fiber.\n const runtime = yield* Effect.runtime<Database.Service>();\n return yield* formatSystemPrompt({ system: this._options.system, skills, objects, instructions }).pipe(\n Effect.provideService(\n Harness.HarnessService,\n Harness.fromBinder({ feed: this._feed, runtime, binder: this.context }),\n ),\n );\n }).pipe(Effect.provide(this._spaceLayer), Effect.orDie),\n );\n }\n\n /**\n * Resolves the chat's steering instructions, if any. The session is feed-centric and cannot reach\n * its chat, so the ref is resolved here and handed down.\n */\n #getInstructions(): Effect.Effect<Instructions.Instructions[], never, Database.Service> {\n return Effect.gen(this, function* () {\n const instructionsRef = this._options.chat?.target?.instructions;\n if (!instructionsRef) {\n return [];\n }\n\n const instructions = yield* Database.load(instructionsRef).pipe(Effect.orElseSucceed(() => undefined));\n return instructions ? [instructions] : [];\n });\n }\n\n /**\n * Initiates a new request via AgentService.\n */\n async request(requestProp: ProcessorRequest): Promise<void> {\n if (this.#requestFiber) {\n await this.cancel();\n }\n\n try {\n this.#lastRequest = requestProp;\n this.#registry.set(this.error, Option.none());\n this.#registry.set(this.mcpErrors, []);\n this.#registry.set(this.active, true);\n\n const effect = Effect.gen(this, function* () {\n // NOTE: Gets or creates a session for the feed.\n log.info('init agent session', {\n feed: Obj.getURI(this._feed),\n model: this._options.model,\n provider: this._options.provider,\n });\n const session = yield* AgentService.getSession(this._feed, {\n model: this._options.model,\n provider: this._options.provider,\n instructions: this._options.chat?.target?.instructions,\n });\n const ephemeralStream = session.subscribeEphemeral();\n yield* ephemeralStream.pipe(\n Stream.runForEach((message) =>\n Effect.sync(() => {\n for (const event of message.events) {\n if (Trace.isOfType(PartialBlock, event)) {\n this.#handleEphemeralMessage(event.data);\n } else if (Trace.isOfType(McpServerError, event)) {\n this.#handleMcpError(event.data);\n }\n }\n }),\n ),\n Effect.fork,\n );\n\n log('chat processor submitting prompt', { length: requestProp.message.length });\n yield* session.submitPrompt(createPromptContent(requestProp));\n log('chat processor submitPrompt returned, waiting for agent', {});\n\n // On the first message (no name yet), schedule rename immediately so it\n // runs concurrently with the AI response rather than waiting for completion.\n if (!this._options.chat?.target?.name) {\n yield* this.#updateChatName(requestProp.message);\n }\n\n yield* session.waitForCompletion();\n log.info('session complete');\n\n this.#flushStreaming();\n });\n\n this.#requestFiber = this._runtime.runFork(effect.pipe(Effect.provide(this._spaceLayer)));\n\n // Inspect the fiber's exit so the underlying failure (e.g. \"model 'x' not found\") is\n // preserved as a clean Error rather than an opaque FiberFailure.\n const exit = await this._runtime.runPromise(Fiber.await(this.#requestFiber));\n if (Exit.isFailure(exit)) {\n if (Cause.isInterruptedOnly(exit.cause)) {\n this.#discardStreaming();\n return;\n }\n\n throw EffectEx.causeToError(exit.cause);\n }\n\n this.#registry.set(this.error, Option.none());\n this.#lastRequest = undefined;\n this.#requestFiber = undefined;\n } catch (err) {\n // `EffectEx.causeToError` above unwraps the fiber failure into the underlying error (e.g. an AiError\n // carrying \"model 'x' not found\"); `parseError` decides what to surface to the user.\n log.error('request failed', { error: err });\n this.#registry.set(this.error, Option.some(parseError(err)));\n } finally {\n log.info('setting active to false');\n this.#registry.set(this.active, false);\n this.#requestFiber = undefined;\n }\n }\n\n /**\n * Cancels the current request.\n */\n async cancel(): Promise<void> {\n await EffectEx.runAndForwardErrors(\n Effect.gen(this, function* () {\n log.info('cancelling request', { fiber: this.#requestFiber });\n if (this.#requestFiber) {\n yield* Fiber.interrupt(this.#requestFiber);\n }\n const session = yield* AgentService.getSession(this._feed);\n yield* session.terminate();\n }).pipe(Effect.provide(this._spaceLayer)),\n );\n\n this.#requestFiber = undefined;\n this.#discardStreaming();\n this.#registry.set(this.active, false);\n }\n\n /**\n * Retry last failed request.\n */\n async retry(): Promise<void> {\n if (this.#lastRequest) {\n return this.request(this.#lastRequest);\n }\n }\n\n /**\n * Clears the recorded MCP server errors (e.g. after the user dismisses the warning banner).\n */\n dismissMcpErrors(): void {\n this.#registry.set(this.mcpErrors, []);\n }\n\n /**\n * Update the current chat's name.\n */\n async updateName(chat: Chat.Chat): Promise<void> {\n const spaceId = Obj.getDatabase(chat)?.spaceId;\n if (!spaceId) {\n return;\n }\n EffectEx.unwrapExit(\n await this._runtime.runPromiseExit(\n Operation.invoke(AssistantOperation.UpdateChatName, { chat }, { spaceId }).pipe(\n Effect.provide(this._spaceLayer),\n ),\n ),\n );\n }\n\n /**\n * Handles an ephemeral message from the agent process.\n * Both pending and completed blocks arrive here. Completed blocks are deduped\n * against messages already written to the feed queue to handle the race between\n * ephemeral delivery and feed replication.\n */\n #handleEphemeralMessage(event: Trace.PayloadType<typeof PartialBlock>) {\n const isPending = event.block.pending;\n const message = Obj.make(Message.Message, {\n id: event.messageId,\n created: new Date().toISOString(),\n sender: { role: event.role },\n blocks: [event.block],\n });\n\n if (isPending) {\n if (this.#finalizedIds.has(event.messageId)) {\n return;\n }\n this.#registry.update(this.#streaming, (streaming) => {\n const idx = streaming.findIndex((existing) => existing.id === event.messageId);\n if (idx >= 0) {\n const updated = [...streaming];\n updated[idx] = message;\n return updated;\n }\n return [...streaming, message];\n });\n } else {\n this.#finalizedIds.add(event.messageId);\n this.#registry.update(this.#streaming, (streaming) => streaming.filter((existing) => existing.id !== message.id));\n this.#registry.update(this.#pending, (pending) => {\n if (pending.some((existing) => existing.id === message.id)) {\n return pending;\n }\n return [...pending, message];\n });\n }\n }\n\n /**\n * Records a per-server MCP failure, deduped by url+protocol so repeat misconfigurations\n * across turns do not spam the UI.\n */\n #handleMcpError(event: Trace.PayloadType<typeof McpServerError>) {\n log.warn('MCP server error', event);\n this.#registry.update(this.mcpErrors, (errors) => {\n if (errors.some((existing) => existing.url === event.url && existing.protocol === event.protocol)) {\n return errors;\n }\n return [...errors, event];\n });\n }\n\n /**\n * Drop in-flight streaming messages (cancel/interrupt — partial blocks are discarded).\n */\n #discardStreaming() {\n this.#registry.set(this.#streaming, []);\n this.#finalizedIds.clear();\n }\n\n /**\n * Move remaining streaming messages to pending (called when agent completes).\n */\n #flushStreaming() {\n const remaining = this.#registry.get(this.#streaming);\n if (remaining.length > 0) {\n this.#registry.update(this.#pending, (pending) => [...pending, ...remaining]);\n this.#registry.set(this.#streaming, []);\n }\n this.#finalizedIds.clear();\n }\n\n /**\n * Schedule a chat name update as a detached (fire-and-forget) operation.\n * Called automatically on the first message; can also be invoked manually via the toolbar.\n */\n #updateChatName(prompt?: string): Effect.Effect<void, never, Operation.Service> {\n const chat = this._options.chat?.target;\n if (!chat) {\n return Effect.void;\n }\n\n const spaceId = Obj.getDatabase(chat)?.spaceId;\n if (!spaceId) {\n return Effect.void;\n }\n\n log.info('scheduling chat name update');\n return Operation.schedule(AssistantOperation.UpdateChatName, { chat, prompt }, { spaceId });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,sBAAsB,aACjC,MAAM,YAAY,QAAQ,CAAC,CAAC,KAAK,WAAW;CAC1C,IAAI,MAAM;CACV;CACA,OAAO,MAAM;CACb,SAAS,MAAM;CACf,OAAO,MAAM;AACf,EAAE;;;;;;AAOJ,IAAa,mBAAmB,UAA8B,eAAiC;CAC7F,MAAM,YAAY,WAAW,IAAI,QAAQ,QAAQ,IAAI,KAAA,MAAc,SAAS,KAAK;CACjF,IAAI,aAAa,SAAS,OAAO,MAAM,YACrC,OAAO,SAAS,QAAQ;CAE1B,IAAI,aAAa,SAAS,QAAQ,MAAM,CAAC,YACvC,OAAO,SAAS,OAAO;CAEzB,OAAO;AACT;;AAGA,IAAa,0BAA0B,aACrC,aAAa,SAAS,KAAK,KAAK,SAAS,aAAa,SAAS,SAAS,KAAK,aAAa;;;;AC3C5F,IAAa,eAAkB,OAAgB,cAA6D;CAC1G,IAAI,UAAmB;CAEvB,MAAM,0BAAU,IAAI,IAAa;CACjC,OAAO,SAAS;EACd,IAAI,QAAQ,IAAI,OAAO,GACrB;EAEF,QAAQ,IAAI,OAAO;EACnB,IAAI,UAAU,OAAO,GACnB,OAAO;EAET,UAAU,mBAAmB,QAAQ,QAAQ,QAAQ,KAAA;CAC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Y,WAAW;GAChD,IAAI,OAAO,MAAM,aAAa,SAAS,QAAQ,MAAM,OAAO,SAAS,aAAa,MAAM,QAAQ,GAC9F,OAAO;GAET,OAAO,CAAC,GAAG,QAAQ,KAAK;EAC1B,CAAC;CACH;;;;CAKA,oBAAoB;EAClB,KAAK,UAAU,IAAI,KAAK,YAAY,CAAC,CAAC;EACtC,KAAK,cAAc,MAAM;CAC3B;;;;CAKA,kBAAkB;EAChB,MAAM,YAAY,KAAK,UAAU,IAAI,KAAK,UAAU;EACpD,IAAI,UAAU,SAAS,GAAG;GACxB,KAAK,UAAU,OAAO,KAAK,WAAW,YAAY,CAAC,GAAG,SAAS,GAAG,SAAS,CAAC;GAC5E,KAAK,UAAU,IAAI,KAAK,YAAY,CAAC,CAAC;EACxC;EACA,KAAK,cAAc,MAAM;CAC3B;;;;;CAMA,gBAAgB,QAAgE;EAC9E,MAAM,OAAO,KAAK,SAAS,MAAM;EACjC,IAAI,CAAC,MACH,OAAO,OAAO;EAGhB,MAAM,UAAU,IAAI,YAAY,IAAI,CAAC,EAAE;EACvC,IAAI,CAAC,SACH,OAAO,OAAO;EAGhB,IAAI,KAAK,+BAA4B,KAAA,GAAA;GAAA,YAAA;GAAA,GAAA;GAAA,GAAA;GAAA,GAAA;EAAA,CAAC;EACtC,OAAO,UAAU,SAAS,mBAAmB,gBAAgB;GAAE;GAAM;EAAO,GAAG,EAAE,QAAQ,CAAC;CAC5F;AACF"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { Instructions } from "@dxos/compute";
|
|
2
|
+
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
3
|
+
import { Position } from "@dxos/util";
|
|
4
|
+
import { Agent, Chat } from "@dxos/assistant-toolkit";
|
|
5
|
+
import { Feed, Obj } from "@dxos/echo";
|
|
6
|
+
import { ASSISTANT_COMPANION_VARIANT, ASSISTANT_DIALOG, meta } from "#meta";
|
|
7
|
+
import { Sequence } from "@dxos/conductor";
|
|
8
|
+
import { ChatSurface } from "#types";
|
|
9
|
+
import * as Effect from "effect/Effect";
|
|
10
|
+
import { useEffect } from "react";
|
|
11
|
+
import { Panel } from "@dxos/react-ui";
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
import { log } from "@dxos/log";
|
|
14
|
+
import { Surface, useSettingsState } from "@dxos/app-framework/ui";
|
|
15
|
+
import { getSpace } from "@dxos/client/echo";
|
|
16
|
+
import { SpaceHomeContent, SpaceHomePinBottom } from "@dxos/plugin-space";
|
|
17
|
+
import { AppSurface, useActiveSpace, useHomeVisibility } from "@dxos/app-toolkit/ui";
|
|
18
|
+
import { AgentArticle, AgentProperties, AssistantSettings, ChatArticle, ChatCompanion, ChatDialog, IntegrationPrompt, SpaceHomePrompt, SpaceHomeSuggestions, TracePanel, TriggerStatus } from "#containers";
|
|
19
|
+
import { InvocationTraceContainer } from "@dxos/devtools";
|
|
20
|
+
//#region src/capabilities/AssistantSurfaces.tsx
|
|
21
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/capabilities/AssistantSurfaces.tsx";
|
|
22
|
+
var AssistantSettingsSurface = ({ subject }) => {
|
|
23
|
+
const { settings, updateSettings } = useSettingsState(subject.atom);
|
|
24
|
+
return /* @__PURE__ */ jsx(AssistantSettings, {
|
|
25
|
+
settings,
|
|
26
|
+
onSettingsChange: updateSettings
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
/** Suggestions are dismissible per space, so visibility is durable UI state rather than surface data. */
|
|
30
|
+
var SpaceHomeSuggestionsSurface = ({ space }) => {
|
|
31
|
+
const { visible, hide } = useHomeVisibility(space, "spaceHomeSuggestions");
|
|
32
|
+
return visible ? /* @__PURE__ */ jsx(SpaceHomeSuggestions, {
|
|
33
|
+
space,
|
|
34
|
+
onClose: hide
|
|
35
|
+
}) : null;
|
|
36
|
+
};
|
|
37
|
+
/** Resolves the space's invocation-trace feed for the companion's subject. */
|
|
38
|
+
var InvocationsSurface = ({ role, companionTo }) => {
|
|
39
|
+
const space = getSpace(companionTo);
|
|
40
|
+
const feed = space?.properties.invocationTraceFeed?.target;
|
|
41
|
+
const feedDXN = feed ? Feed.getFeedUri(feed) : void 0;
|
|
42
|
+
const target = Obj.instanceOf(Instructions.Instructions, companionTo) ? void 0 : companionTo;
|
|
43
|
+
return /* @__PURE__ */ jsx(Panel.Root, {
|
|
44
|
+
role,
|
|
45
|
+
classNames: "dx-document",
|
|
46
|
+
children: /* @__PURE__ */ jsx(Panel.Content, {
|
|
47
|
+
asChild: true,
|
|
48
|
+
children: /* @__PURE__ */ jsx(InvocationTraceContainer, {
|
|
49
|
+
db: space?.db,
|
|
50
|
+
feedDXN,
|
|
51
|
+
target,
|
|
52
|
+
detailAxis: "block"
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
var TracePanelSurface = () => {
|
|
58
|
+
const space = useActiveSpace();
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
log("trace panel surface", {
|
|
61
|
+
hasSpace: Boolean(space),
|
|
62
|
+
spaceId: space?.id
|
|
63
|
+
}, {
|
|
64
|
+
"~LogMeta": "~LogMeta",
|
|
65
|
+
F: __dxlog_file,
|
|
66
|
+
L: 69,
|
|
67
|
+
S: void 0
|
|
68
|
+
});
|
|
69
|
+
}, [space?.id]);
|
|
70
|
+
if (!space) return null;
|
|
71
|
+
return /* @__PURE__ */ jsx(TracePanel, { space });
|
|
72
|
+
};
|
|
73
|
+
var TriggerStatusSurface = () => {
|
|
74
|
+
const space = useActiveSpace();
|
|
75
|
+
if (!space) return null;
|
|
76
|
+
return /* @__PURE__ */ jsx(TriggerStatus, {
|
|
77
|
+
role: "status-indicator",
|
|
78
|
+
space
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/capabilities/react-surface.ts
|
|
83
|
+
var react_surface_default = Capability.makeModule(() => Effect.succeed(Capability.contributes(Capabilities.ReactSurface, [
|
|
84
|
+
Surface.create({
|
|
85
|
+
id: "pluginSettings",
|
|
86
|
+
filter: AppSurface.settings(AppSurface.Article, meta.profile.key),
|
|
87
|
+
component: AssistantSettingsSurface,
|
|
88
|
+
props: ({ data: { subject } }) => ({ subject })
|
|
89
|
+
}),
|
|
90
|
+
Surface.create({
|
|
91
|
+
id: "spaceHomePrompt",
|
|
92
|
+
filter: Surface.makeFilter(SpaceHomePinBottom),
|
|
93
|
+
component: SpaceHomePrompt,
|
|
94
|
+
props: ({ data: { space } }) => ({ space })
|
|
95
|
+
}),
|
|
96
|
+
Surface.create({
|
|
97
|
+
id: "spaceHomeSuggestions",
|
|
98
|
+
filter: Surface.makeFilter(SpaceHomeContent),
|
|
99
|
+
position: Position.last,
|
|
100
|
+
component: SpaceHomeSuggestionsSurface,
|
|
101
|
+
props: ({ data: { space } }) => ({ space })
|
|
102
|
+
}),
|
|
103
|
+
Surface.create({
|
|
104
|
+
id: "chat",
|
|
105
|
+
filter: AppSurface.object(AppSurface.Article, Chat.Chat, (data) => data.variant !== ASSISTANT_COMPANION_VARIANT),
|
|
106
|
+
component: ChatArticle,
|
|
107
|
+
props: ({ role, ref, data: { subject, attendableId } }) => ({
|
|
108
|
+
role,
|
|
109
|
+
subject,
|
|
110
|
+
attendableId,
|
|
111
|
+
ref
|
|
112
|
+
})
|
|
113
|
+
}),
|
|
114
|
+
Surface.create({
|
|
115
|
+
id: "agent",
|
|
116
|
+
filter: AppSurface.object(AppSurface.Article, Agent.Agent),
|
|
117
|
+
component: AgentArticle,
|
|
118
|
+
props: ({ role, data: { subject, attendableId } }) => ({
|
|
119
|
+
role,
|
|
120
|
+
subject,
|
|
121
|
+
attendableId
|
|
122
|
+
})
|
|
123
|
+
}),
|
|
124
|
+
Surface.create({
|
|
125
|
+
id: "objectProperties",
|
|
126
|
+
filter: AppSurface.object(AppSurface.ObjectProperties, Agent.Agent),
|
|
127
|
+
component: AgentProperties,
|
|
128
|
+
props: ({ data: { subject } }) => ({ subject })
|
|
129
|
+
}),
|
|
130
|
+
Surface.create({
|
|
131
|
+
id: "companionChat",
|
|
132
|
+
filter: Surface.makeFilter(AppSurface.Article, (data) => Obj.isObject(data.companionTo) && (Obj.instanceOf(Chat.Chat, data.subject) || data.subject === null)),
|
|
133
|
+
component: ChatCompanion,
|
|
134
|
+
props: ({ role, ref, data: { subject, attendableId, companionTo } }) => ({
|
|
135
|
+
role,
|
|
136
|
+
subject,
|
|
137
|
+
attendableId,
|
|
138
|
+
companionTo,
|
|
139
|
+
ref
|
|
140
|
+
})
|
|
141
|
+
}),
|
|
142
|
+
Surface.create({
|
|
143
|
+
id: "companionInvocations",
|
|
144
|
+
filter: AppSurface.allOf(AppSurface.literal(AppSurface.Article, "invocations"), AppSurface.oneOf(AppSurface.companion(AppSurface.Article, Sequence.Sequence), AppSurface.companion(AppSurface.Article, Instructions.Instructions))),
|
|
145
|
+
component: InvocationsSurface,
|
|
146
|
+
props: ({ role, data: { companionTo } }) => ({
|
|
147
|
+
role,
|
|
148
|
+
companionTo
|
|
149
|
+
})
|
|
150
|
+
}),
|
|
151
|
+
Surface.create({
|
|
152
|
+
id: ASSISTANT_DIALOG,
|
|
153
|
+
filter: AppSurface.component(AppSurface.Dialog, ASSISTANT_DIALOG),
|
|
154
|
+
component: ChatDialog,
|
|
155
|
+
props: ({ data: { props } }) => ({ ...props })
|
|
156
|
+
}),
|
|
157
|
+
Surface.create({
|
|
158
|
+
id: "trace",
|
|
159
|
+
filter: Surface.makeFilter(AppSurface.deckCompanion("trace")),
|
|
160
|
+
component: TracePanelSurface
|
|
161
|
+
}),
|
|
162
|
+
Surface.create({
|
|
163
|
+
id: "integrationPrompt",
|
|
164
|
+
filter: Surface.makeFilter(ChatSurface, (data) => data.role === "integration-prompt"),
|
|
165
|
+
component: IntegrationPrompt,
|
|
166
|
+
props: ({ data }) => ({ service: typeof data.data?.service === "string" ? data.data.service : void 0 })
|
|
167
|
+
}),
|
|
168
|
+
Surface.create({
|
|
169
|
+
id: "triggerStatus",
|
|
170
|
+
filter: Surface.makeFilter(AppSurface.StatusIndicator),
|
|
171
|
+
component: TriggerStatusSurface
|
|
172
|
+
})
|
|
173
|
+
])));
|
|
174
|
+
//#endregion
|
|
175
|
+
export { react_surface_default as default };
|
|
176
|
+
|
|
177
|
+
//# sourceMappingURL=chunk-react-surface.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-react-surface.mjs","names":[],"sources":["../../src/capabilities/AssistantSurfaces.tsx","../../src/capabilities/react-surface.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\n// Surface components that cannot be expressed as a `props` mapper, because they call hooks or compose.\n\nimport React, { useEffect } from 'react';\n\nimport { useSettingsState } from '@dxos/app-framework/ui';\nimport { type AppCapabilities } from '@dxos/app-toolkit';\nimport { useActiveSpace, useHomeVisibility } from '@dxos/app-toolkit/ui';\nimport { getSpace } from '@dxos/client/echo';\nimport { Instructions } from '@dxos/compute';\nimport { InvocationTraceContainer } from '@dxos/devtools';\nimport { Feed, Obj } from '@dxos/echo';\nimport { log } from '@dxos/log';\nimport { type Space } from '@dxos/react-client/echo';\nimport { Panel } from '@dxos/react-ui';\n\nimport { AssistantSettings, SpaceHomeSuggestions, TracePanel, TriggerStatus } from '#containers';\nimport { type Assistant } from '#types';\n\nexport type AssistantSettingsSurfaceProps = {\n subject: AppCapabilities.Settings;\n};\n\nexport const AssistantSettingsSurface = ({ subject }: AssistantSettingsSurfaceProps) => {\n const { settings, updateSettings } = useSettingsState<Assistant.Settings>(subject.atom);\n\n return <AssistantSettings settings={settings} onSettingsChange={updateSettings} />;\n};\n\nexport type SpaceHomeSuggestionsSurfaceProps = {\n space: Space;\n};\n\n/** Suggestions are dismissible per space, so visibility is durable UI state rather than surface data. */\nexport const SpaceHomeSuggestionsSurface = ({ space }: SpaceHomeSuggestionsSurfaceProps) => {\n const { visible, hide } = useHomeVisibility(space, 'spaceHomeSuggestions');\n\n return visible ? <SpaceHomeSuggestions space={space} onClose={hide} /> : null;\n};\n\nexport type InvocationsSurfaceProps = {\n role: string;\n companionTo: Obj.Unknown;\n};\n\n/** Resolves the space's invocation-trace feed for the companion's subject. */\nexport const InvocationsSurface = ({ role, companionTo }: InvocationsSurfaceProps) => {\n const space = getSpace(companionTo);\n const feed = space?.properties.invocationTraceFeed?.target;\n const feedDXN = feed ? Feed.getFeedUri(feed) : undefined;\n // TODO(wittjosiah): Support invocation filtering for prompts.\n const target = Obj.instanceOf(Instructions.Instructions, companionTo) ? undefined : companionTo;\n\n return (\n <Panel.Root role={role} classNames='dx-document'>\n <Panel.Content asChild>\n <InvocationTraceContainer db={space?.db} feedDXN={feedDXN} target={target} detailAxis='block' />\n </Panel.Content>\n </Panel.Root>\n );\n};\n\nexport const TracePanelSurface = () => {\n const space = useActiveSpace();\n useEffect(() => {\n log('trace panel surface', { hasSpace: Boolean(space), spaceId: space?.id });\n }, [space?.id]);\n\n if (!space) {\n return null;\n }\n\n return <TracePanel space={space} />;\n};\n\nexport const TriggerStatusSurface = () => {\n const space = useActiveSpace();\n if (!space) {\n return null;\n }\n\n return <TriggerStatus role='status-indicator' space={space} />;\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport { type ComponentProps } from 'react';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { Surface } from '@dxos/app-framework/ui';\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { Agent, Chat } from '@dxos/assistant-toolkit';\nimport { Instructions } from '@dxos/compute';\nimport { Sequence } from '@dxos/conductor';\nimport { Obj } from '@dxos/echo';\nimport { SpaceHomeContent, SpaceHomePinBottom } from '@dxos/plugin-space';\nimport { Position } from '@dxos/util';\n\nimport {\n AgentArticle,\n AgentProperties,\n ChatArticle,\n ChatCompanion,\n ChatDialog,\n IntegrationPrompt,\n SpaceHomePrompt,\n} from '#containers';\nimport { ASSISTANT_COMPANION_VARIANT, ASSISTANT_DIALOG, meta } from '#meta';\nimport { ChatSurface } from '#types';\n\nimport {\n AssistantSettingsSurface,\n InvocationsSurface,\n SpaceHomeSuggestionsSurface,\n TracePanelSurface,\n TriggerStatusSurface,\n} from './AssistantSurfaces';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(Capabilities.ReactSurface, [\n Surface.create({\n id: 'pluginSettings',\n filter: AppSurface.settings(AppSurface.Article, meta.profile.key),\n component: AssistantSettingsSurface,\n props: ({ data: { subject } }) => ({ subject }),\n }),\n Surface.create({\n id: 'spaceHomePrompt',\n filter: Surface.makeFilter(SpaceHomePinBottom),\n component: SpaceHomePrompt,\n props: ({ data: { space } }) => ({ space }),\n }),\n Surface.create({\n id: 'spaceHomeSuggestions',\n filter: Surface.makeFilter(SpaceHomeContent),\n position: Position.last,\n component: SpaceHomeSuggestionsSurface,\n props: ({ data: { space } }) => ({ space }),\n }),\n Surface.create({\n id: 'chat',\n filter: AppSurface.object(\n AppSurface.Article,\n Chat.Chat,\n (data) => data.variant !== ASSISTANT_COMPANION_VARIANT,\n ),\n component: ChatArticle,\n props: ({ role, ref, data: { subject, attendableId } }) => ({ role, subject, attendableId, ref }),\n }),\n Surface.create({\n id: 'agent',\n filter: AppSurface.object(AppSurface.Article, Agent.Agent),\n component: AgentArticle,\n props: ({ role, data: { subject, attendableId } }) => ({ role, subject, attendableId }),\n }),\n Surface.create({\n id: 'objectProperties',\n filter: AppSurface.object(AppSurface.ObjectProperties, Agent.Agent),\n component: AgentProperties,\n props: ({ data: { subject } }) => ({ subject }),\n }),\n Surface.create({\n id: 'companionChat',\n filter: Surface.makeFilter(\n AppSurface.Article,\n (data) =>\n Obj.isObject(data.companionTo) && (Obj.instanceOf(Chat.Chat, data.subject) || data.subject === null),\n ),\n component: ChatCompanion,\n props: ({ role, ref, data: { subject, attendableId, companionTo } }) => ({\n role,\n subject,\n attendableId,\n companionTo,\n ref,\n }),\n }),\n Surface.create({\n id: 'companionInvocations',\n filter: AppSurface.allOf(\n AppSurface.literal(AppSurface.Article, 'invocations'),\n AppSurface.oneOf(\n AppSurface.companion(AppSurface.Article, Sequence.Sequence),\n AppSurface.companion(AppSurface.Article, Instructions.Instructions),\n ),\n ),\n component: InvocationsSurface,\n props: ({ role, data: { companionTo } }) => ({ role, companionTo }),\n }),\n Surface.create({\n id: ASSISTANT_DIALOG,\n filter: AppSurface.component<ComponentProps<typeof ChatDialog>>(AppSurface.Dialog, ASSISTANT_DIALOG),\n component: ChatDialog,\n props: ({ data: { props } }) => ({ ...props }),\n }),\n Surface.create({\n id: 'trace',\n filter: Surface.makeFilter(AppSurface.deckCompanion('trace')),\n component: TracePanelSurface,\n }),\n Surface.create({\n id: 'integrationPrompt',\n filter: Surface.makeFilter(ChatSurface, (data) => data.role === 'integration-prompt'),\n component: IntegrationPrompt,\n // `data.data` is model-supplied JSON (untyped); narrow `service` before use.\n props: ({ data }) => ({ service: typeof data.data?.service === 'string' ? data.data.service : undefined }),\n }),\n Surface.create({\n id: 'triggerStatus',\n filter: Surface.makeFilter(AppSurface.StatusIndicator),\n component: TriggerStatusSurface,\n }),\n ]),\n ),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0BA,IAAa,4BAA4B,EAAE,cAA6C;CACtF,MAAM,EAAE,UAAU,mBAAmB,iBAAqC,QAAQ,IAAI;CAEtF,OAAO,oBAAC,mBAAD;EAA6B;EAAU,kBAAkB;CAAiB,CAAA;AACnF;;AAOA,IAAa,+BAA+B,EAAE,YAA8C;CAC1F,MAAM,EAAE,SAAS,SAAS,kBAAkB,OAAO,sBAAsB;CAEzE,OAAO,UAAU,oBAAC,sBAAD;EAA6B;EAAO,SAAS;CAAO,CAAA,IAAI;AAC3E;;AAQA,IAAa,sBAAsB,EAAE,MAAM,kBAA2C;CACpF,MAAM,QAAQ,SAAS,WAAW;CAClC,MAAM,OAAO,OAAO,WAAW,qBAAqB;CACpD,MAAM,UAAU,OAAO,KAAK,WAAW,IAAI,IAAI,KAAA;CAE/C,MAAM,SAAS,IAAI,WAAW,aAAa,cAAc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C;CACD,QAAQ,OAAO;EACb,IAAI;EACJ,QAAQ,QAAQ,WAAW,WAAW,cAAc,OAAO,CAAC;EAC5D,WAAW;CACb,CAAC;CACD,QAAQ,OAAO;EACb,IAAI;EACJ,QAAQ,QAAQ,WAAW,cAAc,SAAS,KAAK,SAAS,oBAAoB;EACpF,WAAW;EAEX,QAAQ,EAAE,YAAY,EAAE,SAAS,OAAO,KAAK,MAAM,YAAY,WAAW,KAAK,KAAK,UAAU,KAAA,EAAU;CAC1G,CAAC;CACD,QAAQ,OAAO;EACb,IAAI;EACJ,QAAQ,QAAQ,WAAW,WAAW,eAAe;EACrD,WAAW;CACb,CAAC;AACH,CAAC,CACH,CACF"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { t as getChatPath } from "./chunk-paths.mjs";
|
|
2
|
+
import { LayoutOperation } from "@dxos/app-toolkit";
|
|
3
|
+
import { AiContext } from "@dxos/assistant";
|
|
4
|
+
import { Instructions, Operation, Skill, Template } from "@dxos/compute";
|
|
5
|
+
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
6
|
+
import { RunInstructions } from "@dxos/assistant-toolkit";
|
|
7
|
+
import { Database, Filter, Obj, Ref } from "@dxos/echo";
|
|
8
|
+
import { Text } from "@dxos/schema";
|
|
9
|
+
import { AssistantCapabilities, AssistantOperation } from "#types";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import { log } from "@dxos/log";
|
|
12
|
+
import { invariant } from "@dxos/invariant";
|
|
13
|
+
import { ClientCapabilities } from "@dxos/plugin-client";
|
|
14
|
+
import { RoutineOperation } from "@dxos/plugin-routine/types";
|
|
15
|
+
//#region src/operations/run-prompt-in-new-chat.ts
|
|
16
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/operations/run-prompt-in-new-chat.ts";
|
|
17
|
+
var handler = RoutineOperation.RunPromptInNewChat.pipe(Operation.withHandler(Effect.fnUntraced(function* ({ db, instructions, objects, skills, background }) {
|
|
18
|
+
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
19
|
+
const { object: chat } = yield* Operation.invoke(AssistantOperation.CreateChat, { db });
|
|
20
|
+
if (objects && objects.length > 0 || skills && skills.length > 0) {
|
|
21
|
+
const feedTarget = yield* Database.load(chat.feed);
|
|
22
|
+
const space = (yield* Capability.get(ClientCapabilities.Client)).spaces.get(db.spaceId);
|
|
23
|
+
invariant(space, "Space not found.", {
|
|
24
|
+
"~LogMeta": "~LogMeta",
|
|
25
|
+
F: __dxlog_file,
|
|
26
|
+
L: 35,
|
|
27
|
+
S: this,
|
|
28
|
+
A: ["space", "'Space not found.'"]
|
|
29
|
+
});
|
|
30
|
+
const runtime = yield* Effect.runtime().pipe(Effect.provide(Database.layer(space.db)));
|
|
31
|
+
const binder = new AiContext.Binder({
|
|
32
|
+
feed: feedTarget,
|
|
33
|
+
runtime,
|
|
34
|
+
registry
|
|
35
|
+
});
|
|
36
|
+
yield* Effect.promise(() => binder.use(async (b) => {
|
|
37
|
+
const bindingProps = {};
|
|
38
|
+
if (objects && objects.length > 0) bindingProps.objects = objects.map((obj) => Ref.make(obj));
|
|
39
|
+
if (skills && skills.length > 0) {
|
|
40
|
+
const matchedSkills = (await db.query(Filter.type(Skill.Skill)).run()).filter((skill) => {
|
|
41
|
+
const skillKey = Obj.getMeta(skill).key;
|
|
42
|
+
return skillKey !== void 0 && skills.includes(skillKey);
|
|
43
|
+
});
|
|
44
|
+
if (matchedSkills.length > 0) bindingProps.skills = matchedSkills.map((skill) => Ref.make(skill));
|
|
45
|
+
}
|
|
46
|
+
await b.bind(bindingProps);
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
if (background) {
|
|
50
|
+
const instructionsRef = typeof instructions === "string" ? Ref.make(Instructions.make({
|
|
51
|
+
text: instructions,
|
|
52
|
+
skills: []
|
|
53
|
+
})) : instructions;
|
|
54
|
+
yield* Database.flush();
|
|
55
|
+
yield* Operation.invoke(RunInstructions, {
|
|
56
|
+
instructions: instructionsRef,
|
|
57
|
+
input: {},
|
|
58
|
+
chat: Ref.make(chat)
|
|
59
|
+
}, { spaceId: db.spaceId }).pipe(Effect.catchAll((error) => {
|
|
60
|
+
log.catch(error, void 0, {
|
|
61
|
+
"~LogMeta": "~LogMeta",
|
|
62
|
+
F: __dxlog_file,
|
|
63
|
+
L: 83,
|
|
64
|
+
S: this
|
|
65
|
+
});
|
|
66
|
+
return Effect.void;
|
|
67
|
+
}));
|
|
68
|
+
return { object: chat };
|
|
69
|
+
}
|
|
70
|
+
const chatPath = getChatPath(db.spaceId, chat.id);
|
|
71
|
+
const pendingPromptText = typeof instructions === "string" ? instructions : yield* Effect.gen(function* () {
|
|
72
|
+
const instructionsObj = yield* Effect.promise(() => instructions.load());
|
|
73
|
+
const source = yield* Effect.promise(() => instructionsObj.text.load());
|
|
74
|
+
invariant(Obj.instanceOf(Text.Text, source), "Prompt text must be Text.", {
|
|
75
|
+
"~LogMeta": "~LogMeta",
|
|
76
|
+
F: __dxlog_file,
|
|
77
|
+
L: 97,
|
|
78
|
+
S: this,
|
|
79
|
+
A: ["Obj.instanceOf(Text.Text, source)", "'Prompt text must be Text.'"]
|
|
80
|
+
});
|
|
81
|
+
return Template.process(source.content ?? "");
|
|
82
|
+
});
|
|
83
|
+
yield* Capabilities.updateAtomValue(AssistantCapabilities.State, (current) => ({
|
|
84
|
+
...current,
|
|
85
|
+
pendingPrompts: {
|
|
86
|
+
...current.pendingPrompts,
|
|
87
|
+
[chatPath]: pendingPromptText
|
|
88
|
+
}
|
|
89
|
+
}));
|
|
90
|
+
yield* Operation.invoke(LayoutOperation.Open, { subject: [chatPath] });
|
|
91
|
+
return { object: chat };
|
|
92
|
+
}, (effect, { db }) => effect.pipe(Effect.provide(Database.layer(db))))));
|
|
93
|
+
//#endregion
|
|
94
|
+
export { handler as default };
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=chunk-run-prompt-in-new-chat.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-run-prompt-in-new-chat.mjs","names":[],"sources":["../../src/operations/run-prompt-in-new-chat.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { LayoutOperation } from '@dxos/app-toolkit';\nimport { AiContext } from '@dxos/assistant';\nimport { RunInstructions } from '@dxos/assistant-toolkit';\nimport { Instructions, Operation, Skill, Template } from '@dxos/compute';\nimport { Database, Filter, Obj, Ref } from '@dxos/echo';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\nimport { ClientCapabilities } from '@dxos/plugin-client';\nimport { RoutineOperation } from '@dxos/plugin-routine/types';\nimport { Text } from '@dxos/schema';\n\nimport { AssistantCapabilities, AssistantOperation } from '#types';\n\nimport { getChatPath } from '../paths';\n\nconst handler: Operation.WithHandler<typeof RoutineOperation.RunPromptInNewChat> =\n RoutineOperation.RunPromptInNewChat.pipe(\n Operation.withHandler(\n Effect.fnUntraced(\n function* ({ db, instructions, objects, skills, background }) {\n const registry = yield* Capability.get(Capabilities.AtomRegistry);\n const { object: chat } = yield* Operation.invoke(AssistantOperation.CreateChat, { db });\n\n if ((objects && objects.length > 0) || (skills && skills.length > 0)) {\n const feedTarget = yield* Database.load(chat.feed);\n const client = yield* Capability.get(ClientCapabilities.Client);\n const space = client.spaces.get(db.spaceId);\n invariant(space, 'Space not found.');\n const runtime = yield* Effect.runtime<Database.Service>().pipe(Effect.provide(Database.layer(space.db)));\n const binder = new AiContext.Binder({ feed: feedTarget, runtime, registry });\n yield* Effect.promise(() =>\n binder.use(async (b: AiContext.Binder) => {\n const bindingProps: Parameters<AiContext.Binder['bind']>[0] = {};\n\n if (objects && objects.length > 0) {\n bindingProps.objects = objects.map((obj) => Ref.make(obj));\n }\n\n if (skills && skills.length > 0) {\n const allSkills = await db.query(Filter.type(Skill.Skill)).run();\n const matchedSkills = allSkills.filter((skill) => {\n const skillKey = Obj.getMeta(skill).key;\n return skillKey !== undefined && skills.includes(skillKey);\n });\n if (matchedSkills.length > 0) {\n bindingProps.skills = matchedSkills.map((skill) => Ref.make(skill));\n }\n }\n\n await b.bind(bindingProps);\n }),\n );\n }\n\n if (background) {\n const instructionsRef =\n typeof instructions === 'string'\n ? Ref.make(\n Instructions.make({\n text: instructions,\n skills: [],\n }),\n )\n : instructions;\n yield* Database.flush();\n yield* Operation.invoke(\n RunInstructions,\n {\n instructions: instructionsRef,\n input: {},\n chat: Ref.make(chat),\n },\n { spaceId: db.spaceId },\n ).pipe(\n Effect.catchAll((error) => {\n log.catch(error);\n return Effect.void;\n }),\n );\n return { object: chat };\n }\n\n const chatPath = getChatPath(db.spaceId, chat.id);\n const pendingPromptText =\n typeof instructions === 'string'\n ? instructions\n : yield* Effect.gen(function* () {\n const instructionsObj = yield* Effect.promise(() => instructions.load());\n const source = yield* Effect.promise(() => instructionsObj.text.load());\n invariant(Obj.instanceOf(Text.Text, source), 'Prompt text must be Text.');\n return Template.process(source.content ?? '');\n });\n yield* Capabilities.updateAtomValue(AssistantCapabilities.State, (current) => ({\n ...current,\n pendingPrompts: { ...current.pendingPrompts, [chatPath]: pendingPromptText },\n }));\n yield* Operation.invoke(LayoutOperation.Open, { subject: [chatPath] });\n return { object: chat };\n },\n (effect, { db }) => effect.pipe(Effect.provide(Database.layer(db))),\n ),\n ),\n );\n\nexport default handler;\n"],"mappings":";;;;;;;;;;;;;;;;AAsBA,IAAM,UACJ,iBAAiB,mBAAmB,KAClC,UAAU,YACR,OAAO,WACL,WAAW,EAAE,IAAI,cAAc,SAAS,QAAQ,cAAc;CAC5D,MAAM,WAAW,OAAO,WAAW,IAAI,aAAa,YAAY;CAChE,MAAM,EAAE,QAAQ,SAAS,OAAO,UAAU,OAAO,mBAAmB,YAAY,EAAE,GAAG,CAAC;CAEtF,IAAK,WAAW,QAAQ,SAAS,KAAO,UAAU,OAAO,SAAS,GAAI;EACpE,MAAM,aAAa,OAAO,SAAS,KAAK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AAS,GAAG,QAAQ,CACxB,CAAC,CAAC,KACA,OAAO,UAAU,UAAU;GACzB,IAAI,MAAM,OAAI,KAAA,GAAA;IAAA,YAAA;IAAA,GAAA;IAAA,GAAA;IAAA,GAAA;GAAA,CAAC;GACf,OAAO,OAAO;EAChB,CAAC,CACH;EACA,OAAO,EAAE,QAAQ,KAAK;CACxB;CAEA,MAAM,WAAW,YAAY,GAAG,SAAS,KAAK,EAAE;CAChD,MAAM,oBACJ,OAAO,iBAAiB,WACpB,eACA,OAAO,OAAO,IAAI,aAAa;EAC7B,MAAM,kBAAkB,OAAO,OAAO,cAAc,aAAa,KAAK,CAAC;EACvE,MAAM,SAAS,OAAO,OAAO,cAAc,gBAAgB,KAAK,KAAK,CAAC;EACtE,UAAU,IAAI,WAAW,KAAK,MAAM,MAAM,GAAG,6BAA0B;GAAA,YAAA;GAAA,GAAA;GAAA,GAAA;GAAA,GAAA;GAAA,GAAA,CAAA,qCAAA,6BAAA;EAAA,CAAC;EACxE,OAAO,SAAS,QAAQ,OAAO,WAAW,EAAE;CAC9C,CAAC;CACP,OAAO,aAAa,gBAAgB,sBAAsB,QAAQ,aAAa;EAC7E,GAAG;EACH,gBAAgB;GAAE,GAAG,QAAQ;IAAiB,WAAW;EAAkB;CAC7E,EAAE;CACF,OAAO,UAAU,OAAO,gBAAgB,MAAM,EAAE,SAAS,CAAC,QAAQ,EAAE,CAAC;CACrE,OAAO,EAAE,QAAQ,KAAK;AACxB,IACC,QAAQ,EAAE,SAAS,OAAO,KAAK,OAAO,QAAQ,SAAS,MAAM,EAAE,CAAC,CAAC,CACpE,CACF,CACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Operation } from "@dxos/compute";
|
|
2
|
+
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
3
|
+
import { Obj } from "@dxos/echo";
|
|
4
|
+
import { AssistantCapabilities, AssistantOperation } from "#types";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
//#region src/operations/set-current-chat.ts
|
|
7
|
+
var handler = AssistantOperation.SetCurrentChat.pipe(Operation.withHandler(Effect.fnUntraced(function* ({ companionTo, chat }) {
|
|
8
|
+
const companionToId = Obj.getURI(companionTo);
|
|
9
|
+
if (chat) {
|
|
10
|
+
const chatId = Obj.getURI(chat);
|
|
11
|
+
yield* Capabilities.updateAtomValue(AssistantCapabilities.State, (current) => ({
|
|
12
|
+
...current,
|
|
13
|
+
currentChat: {
|
|
14
|
+
...current.currentChat,
|
|
15
|
+
[companionToId]: chatId
|
|
16
|
+
}
|
|
17
|
+
}));
|
|
18
|
+
} else {
|
|
19
|
+
const operationInvoker = yield* Capability.get(Capabilities.OperationInvoker);
|
|
20
|
+
const db = Obj.getDatabase(companionTo);
|
|
21
|
+
if (db) {
|
|
22
|
+
const { data } = yield* Effect.promise(() => operationInvoker.invokePromise(AssistantOperation.CreateChat, {
|
|
23
|
+
db,
|
|
24
|
+
addToSpace: false
|
|
25
|
+
}));
|
|
26
|
+
if (data?.object) yield* Capabilities.updateAtomValue(AssistantCapabilities.CompanionChatCache, (current) => ({
|
|
27
|
+
...current,
|
|
28
|
+
[companionToId]: data.object
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
yield* Capabilities.updateAtomValue(AssistantCapabilities.State, (current) => ({
|
|
32
|
+
...current,
|
|
33
|
+
currentChat: {
|
|
34
|
+
...current.currentChat,
|
|
35
|
+
[companionToId]: void 0
|
|
36
|
+
}
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
})));
|
|
40
|
+
//#endregion
|
|
41
|
+
export { handler as default };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=chunk-set-current-chat.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-set-current-chat.mjs","names":[],"sources":["../../src/operations/set-current-chat.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { Operation } from '@dxos/compute';\nimport { Obj } from '@dxos/echo';\n\nimport { AssistantCapabilities, AssistantOperation } from '#types';\n\nconst handler: Operation.WithHandler<typeof AssistantOperation.SetCurrentChat> = AssistantOperation.SetCurrentChat.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ companionTo, chat }) {\n const companionToId = Obj.getURI(companionTo);\n\n if (chat) {\n const chatId = Obj.getURI(chat);\n yield* Capabilities.updateAtomValue(AssistantCapabilities.State, (current) => ({\n ...current,\n currentChat: { ...current.currentChat, [companionToId]: chatId },\n }));\n } else {\n // New thread: create a transient chat and cache it so the graph connector\n // can resolve it immediately via the cache fallback tier.\n const operationInvoker = yield* Capability.get(Capabilities.OperationInvoker);\n const db = Obj.getDatabase(companionTo);\n if (db) {\n const { data } = yield* Effect.promise(() =>\n operationInvoker.invokePromise(AssistantOperation.CreateChat, { db, addToSpace: false }),\n );\n if (data?.object) {\n yield* Capabilities.updateAtomValue(AssistantCapabilities.CompanionChatCache, (current) => ({\n ...current,\n [companionToId]: data.object,\n }));\n }\n }\n yield* Capabilities.updateAtomValue(AssistantCapabilities.State, (current) => ({\n ...current,\n currentChat: { ...current.currentChat, [companionToId]: undefined },\n }));\n }\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;;AAYA,IAAM,UAA2E,mBAAmB,eAAe,KACjH,UAAU,YACR,OAAO,WAAW,WAAW,EAAE,aAAa,QAAQ;CAClD,MAAM,gBAAgB,IAAI,OAAO,WAAW;CAE5C,IAAI,MAAM;EACR,MAAM,SAAS,IAAI,OAAO,IAAI;EAC9B,OAAO,aAAa,gBAAgB,sBAAsB,QAAQ,aAAa;GAC7E,GAAG;GACH,aAAa;IAAE,GAAG,QAAQ;KAAc,gBAAgB;GAAO;EACjE,EAAE;CACJ,OAAO;EAGL,MAAM,mBAAmB,OAAO,WAAW,IAAI,aAAa,gBAAgB;EAC5E,MAAM,KAAK,IAAI,YAAY,WAAW;EACtC,IAAI,IAAI;GACN,MAAM,EAAE,SAAS,OAAO,OAAO,cAC7B,iBAAiB,cAAc,mBAAmB,YAAY;IAAE;IAAI,YAAY;GAAM,CAAC,CACzF;GACA,IAAI,MAAM,QACR,OAAO,aAAa,gBAAgB,sBAAsB,qBAAqB,aAAa;IAC1F,GAAG;KACF,gBAAgB,KAAK;GACxB,EAAE;EAEN;EACA,OAAO,aAAa,gBAAgB,sBAAsB,QAAQ,aAAa;GAC7E,GAAG;GACH,aAAa;IAAE,GAAG,QAAQ;KAAc,gBAAgB,KAAA;GAAU;EACpE,EAAE;CACJ;AACF,CAAC,CACH,CACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
2
|
+
import { Capability } from "@dxos/app-framework";
|
|
3
|
+
import { createKvsStore } from "@dxos/effect";
|
|
4
|
+
import { meta } from "#meta";
|
|
5
|
+
import { Assistant, AssistantCapabilities } from "#types";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
//#region src/capabilities/settings.ts
|
|
8
|
+
var settings_default = Capability.makeModule(() => Effect.sync(() => {
|
|
9
|
+
const settingsAtom = createKvsStore({
|
|
10
|
+
key: meta.profile.key,
|
|
11
|
+
schema: Assistant.Settings,
|
|
12
|
+
defaultValue: () => ({})
|
|
13
|
+
});
|
|
14
|
+
return [Capability.contributes(AssistantCapabilities.Settings, settingsAtom), Capability.contributes(AppCapabilities.Settings, {
|
|
15
|
+
prefix: meta.profile.key,
|
|
16
|
+
schema: Assistant.Settings,
|
|
17
|
+
atom: settingsAtom
|
|
18
|
+
})];
|
|
19
|
+
}));
|
|
20
|
+
//#endregion
|
|
21
|
+
export { settings_default as default };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=chunk-settings.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-settings.mjs","names":[],"sources":["../../src/capabilities/settings.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\nimport { createKvsStore } from '@dxos/effect';\n\nimport { meta } from '#meta';\nimport { Assistant, AssistantCapabilities } from '#types';\n\nexport default Capability.makeModule(() =>\n Effect.sync(() => {\n const settingsAtom = createKvsStore({\n key: meta.profile.key,\n schema: Assistant.Settings,\n defaultValue: () => ({}),\n });\n\n return [\n Capability.contributes(AssistantCapabilities.Settings, settingsAtom),\n Capability.contributes(AppCapabilities.Settings, {\n prefix: meta.profile.key,\n schema: Assistant.Settings,\n atom: settingsAtom,\n }),\n ];\n }),\n);\n"],"mappings":";;;;;;;AAaA,IAAA,mBAAe,WAAW,iBACxB,OAAO,WAAW;CAChB,MAAM,eAAe,eAAe;EAClC,KAAK,KAAK,QAAQ;EAClB,QAAQ,UAAU;EAClB,qBAAqB,CAAC;CACxB,CAAC;CAED,OAAO,CACL,WAAW,YAAY,sBAAsB,UAAU,YAAY,GACnE,WAAW,YAAY,gBAAgB,UAAU;EAC/C,QAAQ,KAAK,QAAQ;EACrB,QAAQ,UAAU;EAClB,MAAM;CACR,CAAC,CACH;AACF,CAAC,CACH"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { u as __exportAll } from "./chunk-types.mjs";
|
|
2
|
+
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
3
|
+
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
4
|
+
import { AgentHandlers, AgentSkill, AgentSkillHandlers, AgentWizardHandlers, AgentWizardSkill, AlarmHandlers, AlarmSkill, AutomationSkill, BrowserSkill, ConnectorsSkill, DatabaseHandlers, DatabaseSkill, DelegationHandlers, DelegationSkill, DiscordSkill, LinearSkill, MemorySkill, PlanningHandlers, PlanningSkill, ProjectHandlers, ProjectSkill, SkillManagerHandlers, SkillManagerSkill, WebSearchHandlers, WebSearchSkill, makeDelegationStrategy } from "@dxos/assistant-toolkit";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
import { RoutineCapabilities } from "@dxos/plugin-routine";
|
|
7
|
+
import { AssistantSkill } from "#skills";
|
|
8
|
+
//#region src/capabilities/skill-definition.ts
|
|
9
|
+
var skill_definition_exports = /* @__PURE__ */ __exportAll({ default: () => skillDefinition });
|
|
10
|
+
var skillDefinition = () => Effect.succeed([
|
|
11
|
+
Capability.contributes(AppCapabilities.SkillDefinition, AssistantSkill),
|
|
12
|
+
Capability.contributes(AppCapabilities.SkillDefinition, BrowserSkill),
|
|
13
|
+
Capability.contributes(AppCapabilities.SkillDefinition, ConnectorsSkill),
|
|
14
|
+
Capability.contributes(AppCapabilities.SkillDefinition, DatabaseSkill),
|
|
15
|
+
Capability.contributes(AppCapabilities.SkillDefinition, WebSearchSkill),
|
|
16
|
+
Capability.contributes(AppCapabilities.SkillDefinition, DiscordSkill),
|
|
17
|
+
Capability.contributes(AppCapabilities.SkillDefinition, LinearSkill),
|
|
18
|
+
Capability.contributes(AppCapabilities.SkillDefinition, AgentSkill),
|
|
19
|
+
Capability.contributes(AppCapabilities.SkillDefinition, PlanningSkill),
|
|
20
|
+
Capability.contributes(AppCapabilities.SkillDefinition, MemorySkill),
|
|
21
|
+
Capability.contributes(AppCapabilities.SkillDefinition, AutomationSkill),
|
|
22
|
+
Capability.contributes(AppCapabilities.SkillDefinition, SkillManagerSkill),
|
|
23
|
+
Capability.contributes(AppCapabilities.SkillDefinition, AgentWizardSkill),
|
|
24
|
+
Capability.contributes(AppCapabilities.SkillDefinition, DelegationSkill),
|
|
25
|
+
Capability.contributes(AppCapabilities.SkillDefinition, AlarmSkill),
|
|
26
|
+
Capability.contributes(AppCapabilities.SkillDefinition, ProjectSkill),
|
|
27
|
+
Capability.contributes(Capabilities.OperationHandler, AgentHandlers),
|
|
28
|
+
Capability.contributes(Capabilities.OperationHandler, AgentSkillHandlers),
|
|
29
|
+
Capability.contributes(Capabilities.OperationHandler, SkillManagerHandlers),
|
|
30
|
+
Capability.contributes(Capabilities.OperationHandler, DatabaseHandlers),
|
|
31
|
+
Capability.contributes(Capabilities.OperationHandler, WebSearchHandlers),
|
|
32
|
+
Capability.contributes(Capabilities.OperationHandler, AgentWizardHandlers),
|
|
33
|
+
Capability.contributes(Capabilities.OperationHandler, DelegationHandlers),
|
|
34
|
+
Capability.contributes(Capabilities.OperationHandler, PlanningHandlers),
|
|
35
|
+
Capability.contributes(Capabilities.OperationHandler, AlarmHandlers),
|
|
36
|
+
Capability.contributes(Capabilities.OperationHandler, ProjectHandlers),
|
|
37
|
+
Capability.contributes(RoutineCapabilities.AgentDelegationStrategy, makeDelegationStrategy())
|
|
38
|
+
]);
|
|
39
|
+
//#endregion
|
|
40
|
+
export { skill_definition_exports as n, skillDefinition as t };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=chunk-skill-definition.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-skill-definition.mjs","names":[],"sources":["../../src/capabilities/skill-definition.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\nimport {\n AgentHandlers,\n AgentSkill,\n AgentSkillHandlers,\n AgentWizardHandlers,\n AgentWizardSkill,\n AlarmHandlers,\n AlarmSkill,\n AutomationSkill,\n BrowserSkill,\n ConnectorsSkill,\n DatabaseHandlers,\n DatabaseSkill,\n DelegationHandlers,\n DelegationSkill,\n DiscordSkill,\n LinearSkill,\n MemorySkill,\n PlanningHandlers,\n PlanningSkill,\n ProjectHandlers,\n ProjectSkill,\n SkillManagerHandlers,\n SkillManagerSkill,\n WebSearchHandlers,\n WebSearchSkill,\n makeDelegationStrategy,\n} from '@dxos/assistant-toolkit';\nimport { RoutineCapabilities } from '@dxos/plugin-routine';\n\nimport { AssistantSkill } from '#skills';\n\nconst skillDefinition = () =>\n Effect.succeed([\n Capability.contributes(AppCapabilities.SkillDefinition, AssistantSkill),\n Capability.contributes(AppCapabilities.SkillDefinition, BrowserSkill),\n Capability.contributes(AppCapabilities.SkillDefinition, ConnectorsSkill),\n Capability.contributes(AppCapabilities.SkillDefinition, DatabaseSkill),\n Capability.contributes(AppCapabilities.SkillDefinition, WebSearchSkill),\n Capability.contributes(AppCapabilities.SkillDefinition, DiscordSkill),\n Capability.contributes(AppCapabilities.SkillDefinition, LinearSkill),\n Capability.contributes(AppCapabilities.SkillDefinition, AgentSkill),\n Capability.contributes(AppCapabilities.SkillDefinition, PlanningSkill),\n Capability.contributes(AppCapabilities.SkillDefinition, MemorySkill),\n Capability.contributes(AppCapabilities.SkillDefinition, AutomationSkill),\n Capability.contributes(AppCapabilities.SkillDefinition, SkillManagerSkill),\n Capability.contributes(AppCapabilities.SkillDefinition, AgentWizardSkill),\n Capability.contributes(AppCapabilities.SkillDefinition, DelegationSkill),\n Capability.contributes(AppCapabilities.SkillDefinition, AlarmSkill),\n Capability.contributes(AppCapabilities.SkillDefinition, ProjectSkill),\n\n Capability.contributes(Capabilities.OperationHandler, AgentHandlers),\n Capability.contributes(Capabilities.OperationHandler, AgentSkillHandlers),\n Capability.contributes(Capabilities.OperationHandler, SkillManagerHandlers),\n Capability.contributes(Capabilities.OperationHandler, DatabaseHandlers),\n Capability.contributes(Capabilities.OperationHandler, WebSearchHandlers),\n Capability.contributes(Capabilities.OperationHandler, AgentWizardHandlers),\n Capability.contributes(Capabilities.OperationHandler, DelegationHandlers),\n Capability.contributes(Capabilities.OperationHandler, PlanningHandlers),\n Capability.contributes(Capabilities.OperationHandler, AlarmHandlers),\n Capability.contributes(Capabilities.OperationHandler, ProjectHandlers),\n\n // Run the conversational agent as a supervisor: delegate in-progress plan tasks to sub-agents\n // and fold their results back into the conversation (consumed by the AgentService LayerSpec).\n Capability.contributes(RoutineCapabilities.AgentDelegationStrategy, makeDelegationStrategy()),\n ]);\n\nexport default skillDefinition;\n"],"mappings":";;;;;;;;;AAwCA,IAAM,wBACJ,OAA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ates } from "@dxos/assistant";
|
|
3
|
+
import { Skill } from "@dxos/compute";
|
|
4
|
+
//#region src/skills/assistant/skill.ts
|
|
5
|
+
var SKILL_KEY = "org.dxos.skill.assistant";
|
|
6
|
+
var make = () => Skill.make({
|
|
7
|
+
key: SKILL_KEY,
|
|
8
|
+
name: "Assistant",
|
|
9
|
+
tools: Skill.toolDefinitions({ operations: [LayoutOperation.Open, NavigationOperation.ResolveNavigationTargets] }),
|
|
10
|
+
instructions: templates.system
|
|
11
|
+
});
|
|
12
|
+
var skill = {
|
|
13
|
+
key: SKILL_KEY,
|
|
14
|
+
make
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { skill as t };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=chunk-skills.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-skills.mjs","names":[],"sources":["../../src/skills/assistant/skill.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport { LayoutOperation, NavigationOperation } from '@dxos/app-toolkit';\nimport { templates } from '@dxos/assistant';\nimport { Skill } from '@dxos/compute';\n\nconst SKILL_KEY = 'org.dxos.skill.assistant';\n\nconst make = () =>\n Skill.make({\n key: SKILL_KEY,\n name: 'Assistant',\n tools: Skill.toolDefinitions({\n // TODO(wittjosiah): LayoutOperation.Open requires Capability.Service which is only available\n // via the compute-runtime layer (plugin-routine). Once Capability.Service is propagated\n // through the process operation runtime, this will work without the compute-runtime dependency.\n operations: [LayoutOperation.Open, NavigationOperation.ResolveNavigationTargets],\n }),\n instructions: templates.system,\n });\n\nconst skill: Skill.Definition = {\n key: SKILL_KEY,\n make,\n};\n\nexport default skill;\n"],"mappings":";;;;AAQA,IAAM,YAAY;AAElB,IAAM,aACJ,MAAM,KAAK;CACT,KAAK;CACL,MAAM;CACN,OAAO,MAAM,gBAAgB,EAI3B,YAAY,CAAC,gBAAgB,MAAM,oBAAoB,wBAAwB,EACjF,CAAC;CACD,cAAc,UAAU;AAC1B,CAAC;AAEH,IAAM,QAA0B;CAC9B,KAAK;CACL;AACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Capability } from "@dxos/app-framework";
|
|
2
|
+
import { createKvsStore } from "@dxos/effect";
|
|
3
|
+
import { meta } from "#meta";
|
|
4
|
+
import { Atom } from "@effect-atom/atom";
|
|
5
|
+
import { AssistantCapabilities } from "#types";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
//#region src/capabilities/state.ts
|
|
8
|
+
var state_default = Capability.makeModule(() => Effect.sync(() => {
|
|
9
|
+
const stateAtom = createKvsStore({
|
|
10
|
+
key: meta.profile.key,
|
|
11
|
+
schema: AssistantCapabilities.StateSchema,
|
|
12
|
+
defaultValue: () => ({
|
|
13
|
+
currentChat: {},
|
|
14
|
+
pendingPrompts: {}
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
const companionChatCacheAtom = Atom.make({}).pipe(Atom.keepAlive);
|
|
18
|
+
const homeSuggestionsCacheAtom = createKvsStore({
|
|
19
|
+
key: `${meta.profile.key}.home-suggestions`,
|
|
20
|
+
schema: AssistantCapabilities.HomeSuggestionsCacheSchema,
|
|
21
|
+
defaultValue: () => ({})
|
|
22
|
+
});
|
|
23
|
+
return [
|
|
24
|
+
Capability.contributes(AssistantCapabilities.State, stateAtom),
|
|
25
|
+
Capability.contributes(AssistantCapabilities.CompanionChatCache, companionChatCacheAtom),
|
|
26
|
+
Capability.contributes(AssistantCapabilities.HomeSuggestionsCache, homeSuggestionsCacheAtom)
|
|
27
|
+
];
|
|
28
|
+
}));
|
|
29
|
+
//#endregion
|
|
30
|
+
export { state_default as default };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=chunk-state.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-state.mjs","names":[],"sources":["../../src/capabilities/state.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom';\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { type Obj } from '@dxos/echo';\nimport { createKvsStore } from '@dxos/effect';\n\nimport { meta } from '#meta';\nimport { AssistantCapabilities } from '#types';\n\nexport default Capability.makeModule(() =>\n Effect.sync(() => {\n // NOTE: This needs to be a chat object rather than a string id to avoid a query race.\n // TODO(wittjosiah): Handle serialization and hydration for this so it can be cached.\n const stateAtom = createKvsStore({\n key: meta.profile.key,\n schema: AssistantCapabilities.StateSchema,\n defaultValue: () => ({\n currentChat: {},\n pendingPrompts: {},\n }),\n });\n\n const companionChatCacheAtom = Atom.make<Record<string, Obj.Unknown | undefined>>({}).pipe(Atom.keepAlive);\n\n const homeSuggestionsCacheAtom = createKvsStore({\n key: `${meta.profile.key}.home-suggestions`,\n schema: AssistantCapabilities.HomeSuggestionsCacheSchema,\n defaultValue: () => ({}),\n });\n\n return [\n Capability.contributes(AssistantCapabilities.State, stateAtom),\n Capability.contributes(AssistantCapabilities.CompanionChatCache, companionChatCacheAtom),\n Capability.contributes(AssistantCapabilities.HomeSuggestionsCache, homeSuggestionsCacheAtom),\n ];\n }),\n);\n"],"mappings":";;;;;;;AAcA,IAAA,gBAAe,WAAW,iBACxB,OAAO,WAAW;CAGhB,MAAM,YAAY,eAAe;EAC/B,KAAK,KAAK,QAAQ;EAClB,QAAQ,sBAAsB;EAC9B,qBAAqB;GACnB,aAAa,CAAC;GACd,gBAAgB,CAAC;EACnB;CACF,CAAC;CAED,MAAM,yBAAyB,KAAK,KAA8C,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS;CAEzG,MAAM,2BAA2B,eAAe;EAC9C,KAAK,GAAG,KAAK,QAAQ,IAAI;EACzB,QAAQ,sBAAsB;EAC9B,qBAAqB,CAAC;CACxB,CAAC;CAED,OAAO;EACL,WAAW,YAAY,sBAAsB,OAAO,SAAS;EAC7D,WAAW,YAAY,sBAAsB,oBAAoB,sBAAsB;EACvF,WAAW,YAAY,sBAAsB,sBAAsB,wBAAwB;CAC7F;AACF,CAAC,CACH"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Operation } from "@dxos/compute";
|
|
2
|
+
import { Capabilities } from "@dxos/app-framework";
|
|
3
|
+
import { AssistantCapabilities, AssistantOperation } from "#types";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
//#region src/operations/toggle-trace-panel-debug.ts
|
|
6
|
+
var handler = AssistantOperation.ToggleTracePanelDebug.pipe(Operation.withHandler(Effect.fnUntraced(function* (input) {
|
|
7
|
+
const current = yield* Capabilities.getAtomValue(AssistantCapabilities.Settings);
|
|
8
|
+
const next = input.state ?? !current.tracePanelDebug;
|
|
9
|
+
yield* Capabilities.updateAtomValue(AssistantCapabilities.Settings, (settings) => ({
|
|
10
|
+
...settings,
|
|
11
|
+
tracePanelDebug: next
|
|
12
|
+
}));
|
|
13
|
+
return next;
|
|
14
|
+
})));
|
|
15
|
+
//#endregion
|
|
16
|
+
export { handler as default };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=chunk-toggle-trace-panel-debug.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-toggle-trace-panel-debug.mjs","names":[],"sources":["../../src/operations/toggle-trace-panel-debug.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities } from '@dxos/app-framework';\nimport { Operation } from '@dxos/compute';\n\nimport { AssistantCapabilities, AssistantOperation } from '#types';\n\nconst handler: Operation.WithHandler<typeof AssistantOperation.ToggleTracePanelDebug> =\n AssistantOperation.ToggleTracePanelDebug.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* (input) {\n const current = yield* Capabilities.getAtomValue(AssistantCapabilities.Settings);\n const next = input.state ?? !current.tracePanelDebug;\n yield* Capabilities.updateAtomValue(AssistantCapabilities.Settings, (settings) => ({\n ...settings,\n tracePanelDebug: next,\n }));\n return next;\n }),\n ),\n );\n\nexport default handler;\n"],"mappings":";;;;;AAWA,IAAM,UACJ,mBAAmB,sBAAsB,KACvC,UAAU,YACR,OAAO,WAAW,WAAW,OAAO;CAClC,MAAM,UAAU,OAAO,aAAa,aAAa,sBAAsB,QAAQ;CAC/E,MAAM,OAAO,MAAM,SAAS,CAAC,QAAQ;CACrC,OAAO,aAAa,gBAAgB,sBAAsB,WAAW,cAAc;EACjF,GAAG;EACH,iBAAiB;CACnB,EAAE;CACF,OAAO;AACT,CAAC,CACH,CACF"}
|