@dxos/plugin-assistant 0.10.0 → 0.11.0
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
|
@@ -2,10 +2,19 @@
|
|
|
2
2
|
// Copyright 2026 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import * as Option from 'effect/Option';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
5
8
|
import { AgentRequestBegin, AgentRequestEnd } from '@dxos/assistant';
|
|
6
9
|
import { Trace } from '@dxos/compute';
|
|
7
10
|
import { EID } from '@dxos/keys';
|
|
8
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Default duration a span may sit open with no new events before it's considered abandoned
|
|
14
|
+
* (the runtime crashed, lost connectivity, or otherwise never wrote the closing event).
|
|
15
|
+
*/
|
|
16
|
+
export const DEFAULT_SPAN_TIMEOUT_MS = 20 * 60 * 1_000;
|
|
17
|
+
|
|
9
18
|
/**
|
|
10
19
|
* Synthetic id assigned to the root span.
|
|
11
20
|
* The root is a virtual container for top-level spans (those without a parent in the captured trace).
|
|
@@ -93,6 +102,20 @@ export interface BuildSpanTreeOptions {
|
|
|
93
102
|
* and collapse them onto the root branch.
|
|
94
103
|
*/
|
|
95
104
|
eventLimit?: number;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Duration a span may sit open with no new events before it's force-closed with a synthetic
|
|
108
|
+
* end event. Only takes effect when `now` is also provided. Defaults to
|
|
109
|
+
* `DEFAULT_SPAN_TIMEOUT_MS`.
|
|
110
|
+
*/
|
|
111
|
+
spanTimeoutMs?: number;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Reference time used to detect abandoned spans. Force-closing is skipped entirely when this
|
|
115
|
+
* is omitted, so callers that don't pass it (tests, deterministic snapshots) keep the prior
|
|
116
|
+
* behavior of leaving unterminated spans open regardless of their fixture timestamps.
|
|
117
|
+
*/
|
|
118
|
+
now?: number;
|
|
96
119
|
}
|
|
97
120
|
|
|
98
121
|
/**
|
|
@@ -133,6 +156,12 @@ export const buildSpanTree = (messages: readonly Trace.Message[], options: Build
|
|
|
133
156
|
// a sibling's released lane instead of forking off its parent.
|
|
134
157
|
const lastSpanByPid = new Map<string, MutableSpan>();
|
|
135
158
|
|
|
159
|
+
// Every span ever opened, including ones later superseded by a same-pid begin event before
|
|
160
|
+
// getting an end event (§15 "interleaved same-pid begin/end pairs"). `openSpans` only tracks
|
|
161
|
+
// the *current* span per pid, so a superseded span — which will never receive an end event —
|
|
162
|
+
// would otherwise be unreachable by the timeout sweep below.
|
|
163
|
+
const allSpans: MutableSpan[] = [];
|
|
164
|
+
|
|
136
165
|
let spanCounter = 0;
|
|
137
166
|
const allocSpanId = (pid: string): string => {
|
|
138
167
|
const id = `${pid}#${spanCounter}`;
|
|
@@ -165,6 +194,7 @@ export const buildSpanTree = (messages: readonly Trace.Message[], options: Build
|
|
|
165
194
|
span.events.push(event);
|
|
166
195
|
noteTimestamp(span, event.timestamp);
|
|
167
196
|
parent.children.push(span);
|
|
197
|
+
allSpans.push(span);
|
|
168
198
|
// The new span supersedes any previously-open span for this pid.
|
|
169
199
|
openSpans.set(pid, span);
|
|
170
200
|
lastSpanByPid.set(pid, span);
|
|
@@ -196,6 +226,29 @@ export const buildSpanTree = (messages: readonly Trace.Message[], options: Build
|
|
|
196
226
|
}
|
|
197
227
|
}
|
|
198
228
|
|
|
229
|
+
// Force-close spans the runtime never reported the end of (crash, dropped connection, etc.) —
|
|
230
|
+
// otherwise they stay open forever and the UI renders them as stuck mid-flight. Walks every
|
|
231
|
+
// span ever opened (not just `openSpans`) so a span superseded by a later same-pid begin event
|
|
232
|
+
// — which never receives its own end event — is force-closed too. Skipped when `now` isn't
|
|
233
|
+
// supplied so callers that don't care about wall-clock staleness are unaffected.
|
|
234
|
+
if (options.now !== undefined) {
|
|
235
|
+
const now = options.now;
|
|
236
|
+
const spanTimeoutMs = options.spanTimeoutMs ?? DEFAULT_SPAN_TIMEOUT_MS;
|
|
237
|
+
for (const span of allSpans) {
|
|
238
|
+
const lastEvent = span.events[span.events.length - 1]!;
|
|
239
|
+
if (isSpanEndEvent(lastEvent)) {
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
const timeoutAt = lastEvent.timestamp + spanTimeoutMs;
|
|
243
|
+
if (now < timeoutAt) {
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
const endEvent = makeTimeoutEndEvent(span, timeoutAt);
|
|
247
|
+
span.events.push(endEvent);
|
|
248
|
+
noteTimestamp(span, endEvent.timestamp);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
199
252
|
// Sort children chronologically for deterministic output.
|
|
200
253
|
const sortChildren = (span: MutableSpan): void => {
|
|
201
254
|
span.children.sort((a, b) => a.firstTimestamp - b.firstTimestamp);
|
|
@@ -208,6 +261,48 @@ export const buildSpanTree = (messages: readonly Trace.Message[], options: Build
|
|
|
208
261
|
return freezeSpan(root);
|
|
209
262
|
};
|
|
210
263
|
|
|
264
|
+
/**
|
|
265
|
+
* Message stamped on synthetic end events produced when a span times out.
|
|
266
|
+
*/
|
|
267
|
+
const SPAN_TIMEOUT_MESSAGE = 'No end event was recorded for this span; it was closed after a timeout.';
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Synthesizes the end event that closes an abandoned span, matching the event type its begin
|
|
271
|
+
* event opened it with (`OperationStart` → `OperationEnd`, `AgentRequestBegin` → `AgentRequestEnd`).
|
|
272
|
+
*/
|
|
273
|
+
const makeTimeoutEndEvent = (span: MutableSpan, timestamp: number): Trace.FlatEvent => {
|
|
274
|
+
const beginEvent = span.events[0]!;
|
|
275
|
+
if (beginEvent.type === AgentRequestBegin.key) {
|
|
276
|
+
return {
|
|
277
|
+
type: AgentRequestEnd.key,
|
|
278
|
+
timestamp,
|
|
279
|
+
meta: beginEvent.meta,
|
|
280
|
+
isEphemeral: false,
|
|
281
|
+
data: { status: 'interrupted', error: SPAN_TIMEOUT_MESSAGE },
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// `beginEvent.data` is unvalidated wire data; decode defensively rather than trusting its shape.
|
|
286
|
+
const fallback: Schema.Schema.Type<typeof Trace.OperationStart.schema> = { key: 'unknown' };
|
|
287
|
+
const beginData = Option.getOrElse(
|
|
288
|
+
Schema.decodeUnknownOption(Trace.OperationStart.schema)(beginEvent.data),
|
|
289
|
+
() => fallback,
|
|
290
|
+
);
|
|
291
|
+
return {
|
|
292
|
+
type: Trace.OperationEnd.key,
|
|
293
|
+
timestamp,
|
|
294
|
+
meta: beginEvent.meta,
|
|
295
|
+
isEphemeral: false,
|
|
296
|
+
data: {
|
|
297
|
+
key: beginData.key,
|
|
298
|
+
name: beginData.name,
|
|
299
|
+
icon: beginData.icon,
|
|
300
|
+
outcome: 'failure',
|
|
301
|
+
error: SPAN_TIMEOUT_MESSAGE,
|
|
302
|
+
},
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
|
|
211
306
|
/**
|
|
212
307
|
* Caps the number of non-boundary events while retaining every span boundary event.
|
|
213
308
|
*
|
package/src/feed-logger.ts
CHANGED
|
@@ -6,16 +6,16 @@ import * as Effect from 'effect/Effect';
|
|
|
6
6
|
import * as Layer from 'effect/Layer';
|
|
7
7
|
|
|
8
8
|
import { type Space, getSpace } from '@dxos/client/echo';
|
|
9
|
+
import { InvocationTraceEndEvent, InvocationTraceEventType, InvocationTraceStartEvent } from '@dxos/compute-runtime';
|
|
10
|
+
import { TraceEvent } from '@dxos/compute-runtime';
|
|
11
|
+
import { InvocationOutcome } from '@dxos/compute-runtime';
|
|
9
12
|
import { Sequence, type SequenceEvent, type SequenceLogger } from '@dxos/conductor';
|
|
10
13
|
import { Database, Feed, Obj, Ref } from '@dxos/echo';
|
|
11
14
|
import { EffectEx } from '@dxos/effect';
|
|
12
|
-
import { InvocationTraceEndEvent, InvocationTraceEventType, InvocationTraceStartEvent } from '@dxos/functions-runtime';
|
|
13
|
-
import { TraceEvent } from '@dxos/functions-runtime';
|
|
14
|
-
import { InvocationOutcome } from '@dxos/functions-runtime';
|
|
15
15
|
import { invariant } from '@dxos/invariant';
|
|
16
16
|
import { type EntityId } from '@dxos/keys';
|
|
17
17
|
|
|
18
|
-
export class
|
|
18
|
+
export class FeedLogger implements SequenceLogger {
|
|
19
19
|
private _space: Space;
|
|
20
20
|
private _invocationTraceFeed: Feed.Feed;
|
|
21
21
|
private _feedServiceLayer: Layer.Layer<Database.Service>;
|
|
@@ -34,11 +34,11 @@ export class QueueLogger implements SequenceLogger {
|
|
|
34
34
|
// A feed reference exists; ensure its target is loaded. If not, fail loudly
|
|
35
35
|
// rather than silently creating a new feed and orphaning existing traces.
|
|
36
36
|
invariant(existingFeedRef.target, 'invocationTraceFeed reference is not yet loaded');
|
|
37
|
-
invariant(Feed.
|
|
37
|
+
invariant(Feed.getFeedUri(existingFeedRef.target), 'invocationTraceFeed has no feed URI');
|
|
38
38
|
this._invocationTraceFeed = existingFeedRef.target;
|
|
39
39
|
} else {
|
|
40
40
|
const feed = space.db.add(Feed.make({ namespace: 'trace' }));
|
|
41
|
-
invariant(Feed.
|
|
41
|
+
invariant(Feed.getFeedUri(feed), 'New invocationTraceFeed has no feed URI');
|
|
42
42
|
Obj.update(this._space.properties, (obj) => {
|
|
43
43
|
obj.invocationTraceFeed = Ref.make(feed);
|
|
44
44
|
});
|
package/src/hooks/index.ts
CHANGED
|
@@ -12,9 +12,9 @@ export * from './useContextBinder';
|
|
|
12
12
|
export * from './useContextObjects';
|
|
13
13
|
export { useDebug } from './useDebug';
|
|
14
14
|
export * from './useFilteredTypes';
|
|
15
|
-
export * from './useFlush';
|
|
16
15
|
export * from './usePresets';
|
|
17
16
|
export * from './useReferencesProvider';
|
|
17
|
+
export * from './useSelectionContext';
|
|
18
18
|
export * from './useTraceMessages';
|
|
19
19
|
export * from './useHomeSuggestions';
|
|
20
20
|
export * from './useProcessEphemeralStatus';
|
|
@@ -14,9 +14,10 @@ import { AiSession } from '@dxos/assistant';
|
|
|
14
14
|
import { type Chat } from '@dxos/assistant-toolkit';
|
|
15
15
|
import { AgentService, Credential, ServiceResolver } from '@dxos/compute';
|
|
16
16
|
import { Database, Obj, Ref, Registry } from '@dxos/echo';
|
|
17
|
+
import { useObject } from '@dxos/echo-react';
|
|
17
18
|
import { EffectEx } from '@dxos/effect';
|
|
18
19
|
import { log } from '@dxos/log';
|
|
19
|
-
import { type Space
|
|
20
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
20
21
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
21
22
|
|
|
22
23
|
import { type Assistant } from '#types';
|
|
@@ -33,17 +33,17 @@ export const useChatToolbarActions = ({ chat, companionTo }: ChatToolbarActionsP
|
|
|
33
33
|
? get(db.query(Query.select(Filter.id(companionTo.id)).targetOf(Chat.CompanionTo).source()).atom)
|
|
34
34
|
: [];
|
|
35
35
|
|
|
36
|
-
const builder = MenuBuilder.make()
|
|
37
|
-
.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
const builder = MenuBuilder.make().root({
|
|
37
|
+
label: ['chat-toolbar.title', { ns: meta.profile.key }],
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
if (companionTo) {
|
|
41
|
+
builder.action(
|
|
41
42
|
'new',
|
|
42
43
|
{
|
|
43
44
|
label: ['new-thread.button', { ns: meta.profile.key }],
|
|
44
45
|
icon: 'ph--plus--regular',
|
|
45
46
|
type: 'new',
|
|
46
|
-
disabled: !companionTo,
|
|
47
47
|
},
|
|
48
48
|
() => {
|
|
49
49
|
invariant(companionTo);
|
|
@@ -52,33 +52,36 @@ export const useChatToolbarActions = ({ chat, companionTo }: ChatToolbarActionsP
|
|
|
52
52
|
chat: undefined,
|
|
53
53
|
}).pipe(EffectEx.runAndForwardErrors);
|
|
54
54
|
},
|
|
55
|
-
)
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
builder
|
|
56
59
|
.action(
|
|
57
|
-
'
|
|
60
|
+
'branch',
|
|
58
61
|
{
|
|
59
|
-
label: ['
|
|
60
|
-
icon: 'ph--
|
|
61
|
-
type: '
|
|
62
|
-
disabled: !chat,
|
|
62
|
+
label: ['branch-thread.menu', { ns: meta.profile.key }],
|
|
63
|
+
icon: 'ph--git-branch--regular',
|
|
64
|
+
type: 'branch',
|
|
65
|
+
disabled: !chat || !db,
|
|
63
66
|
},
|
|
64
67
|
() =>
|
|
65
68
|
Effect.gen(function* () {
|
|
66
69
|
invariant(chat);
|
|
67
|
-
yield* invoke(AssistantOperation.
|
|
70
|
+
yield* invoke(AssistantOperation.ForkChat, { chat, companionTo }, { spaceId: db?.spaceId });
|
|
68
71
|
}).pipe(EffectEx.runAndForwardErrors),
|
|
69
72
|
)
|
|
70
73
|
.action(
|
|
71
|
-
'
|
|
74
|
+
'rename',
|
|
72
75
|
{
|
|
73
|
-
label: ['
|
|
74
|
-
icon: 'ph--
|
|
75
|
-
type: '
|
|
76
|
-
disabled: !chat
|
|
76
|
+
label: ['rename-thread.button', { ns: meta.profile.key }],
|
|
77
|
+
icon: 'ph--magic-wand--regular',
|
|
78
|
+
type: 'rename',
|
|
79
|
+
disabled: !chat,
|
|
77
80
|
},
|
|
78
81
|
() =>
|
|
79
82
|
Effect.gen(function* () {
|
|
80
83
|
invariant(chat);
|
|
81
|
-
yield* invoke(AssistantOperation.
|
|
84
|
+
yield* invoke(AssistantOperation.UpdateChatName, { chat }, { spaceId: db?.spaceId });
|
|
82
85
|
}).pipe(EffectEx.runAndForwardErrors),
|
|
83
86
|
);
|
|
84
87
|
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Atom, useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
-
import { useCallback } from 'react';
|
|
6
|
+
import { useCallback, useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
import { type AiContext } from '@dxos/assistant';
|
|
9
|
-
import {
|
|
9
|
+
import { Chat } from '@dxos/assistant-toolkit';
|
|
10
|
+
import { type Database, Obj } from '@dxos/echo';
|
|
10
11
|
import { type URI } from '@dxos/keys';
|
|
11
12
|
|
|
12
13
|
export type UseContextObjectsProps = {
|
|
@@ -25,7 +26,12 @@ const emptyObjectsAtom = Atom.make<Obj.Unknown[]>([]);
|
|
|
25
26
|
* Create reactive map of active object references (by DXN string).
|
|
26
27
|
*/
|
|
27
28
|
export const useContextObjects = ({ db, context }: UseContextObjectsProps): UseContextObjects => {
|
|
28
|
-
const
|
|
29
|
+
const boundObjects = useAtomValue(context?.objects ?? emptyObjectsAtom);
|
|
30
|
+
// The session's own chat is bound into its context so the agent harness can resolve it
|
|
31
|
+
// (`get-context` requires a bound chat to read the plan when no agent is present); it is not a
|
|
32
|
+
// user-added reference, so exclude it from the UI. Mirrors the `!Obj.instanceOf(Chat.Chat, …)`
|
|
33
|
+
// filter applied when copying context objects in `assistant-toolkit` `Agent`.
|
|
34
|
+
const objects = useMemo(() => boundObjects.filter((object) => !Obj.instanceOf(Chat.Chat, object)), [boundObjects]);
|
|
29
35
|
|
|
30
36
|
const handleUpdateObject = useCallback<UseContextObjects['onUpdateObject']>(
|
|
31
37
|
async (dxn: URI.URI, checked: boolean) => {
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { Obj } from '@dxos/echo';
|
|
8
|
+
import { Expando } from '@dxos/schema';
|
|
9
|
+
|
|
10
|
+
import { getSelectionContext } from './useSelectionContext';
|
|
11
|
+
|
|
12
|
+
describe('getSelectionContext', () => {
|
|
13
|
+
const object = Obj.make(Expando.Expando, { content: 'hello brave world' });
|
|
14
|
+
const typename = Obj.getTypename(object);
|
|
15
|
+
const resolver = {
|
|
16
|
+
key: typename ?? '',
|
|
17
|
+
getText: (_obj: unknown, anchor: string) => (anchor === 'a:b' ? 'brave' : undefined),
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
test('resolves selection ranges to text via the typename resolver', ({ expect }) => {
|
|
21
|
+
const context = getSelectionContext({
|
|
22
|
+
object,
|
|
23
|
+
selection: { mode: 'multi-range', ranges: [{ from: 'a', to: 'b' }] },
|
|
24
|
+
resolvers: [resolver],
|
|
25
|
+
});
|
|
26
|
+
expect(context?.selection?.text).toBe('brave');
|
|
27
|
+
expect(context?.selection?.anchors).toEqual(['a:b']);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test('returns undefined without a matching resolver', ({ expect }) => {
|
|
31
|
+
const context = getSelectionContext({
|
|
32
|
+
object,
|
|
33
|
+
selection: { mode: 'multi-range', ranges: [{ from: 'a', to: 'b' }] },
|
|
34
|
+
resolvers: [],
|
|
35
|
+
});
|
|
36
|
+
expect(context).toBeUndefined();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('returns undefined when nothing resolves', ({ expect }) => {
|
|
40
|
+
const context = getSelectionContext({
|
|
41
|
+
object,
|
|
42
|
+
selection: { mode: 'multi-range', ranges: [{ from: 'x', to: 'y' }] },
|
|
43
|
+
resolvers: [resolver],
|
|
44
|
+
});
|
|
45
|
+
expect(context).toBeUndefined();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('returns undefined for an empty selection', ({ expect }) => {
|
|
49
|
+
expect(getSelectionContext({ object, selection: undefined, resolvers: [resolver] })).toBeUndefined();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('skips a range whose cursor throws and keeps the ranges that resolve', ({ expect }) => {
|
|
53
|
+
const throwingResolver = {
|
|
54
|
+
key: typename ?? '',
|
|
55
|
+
getText: (_obj: unknown, anchor: string) => {
|
|
56
|
+
if (anchor === 'stale:cursor') {
|
|
57
|
+
throw new Error('unparseable cursor');
|
|
58
|
+
}
|
|
59
|
+
return anchor === 'a:b' ? 'brave' : undefined;
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const context = getSelectionContext({
|
|
64
|
+
object,
|
|
65
|
+
selection: {
|
|
66
|
+
mode: 'multi-range',
|
|
67
|
+
ranges: [
|
|
68
|
+
{ from: 'stale', to: 'cursor' },
|
|
69
|
+
{ from: 'a', to: 'b' },
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
resolvers: [throwingResolver],
|
|
73
|
+
});
|
|
74
|
+
expect(context?.selection?.text).toBe('brave');
|
|
75
|
+
expect(context?.selection?.anchors).toEqual(['a:b']);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('drops an unresolvable range from anchors so anchors stay aligned with text', ({ expect }) => {
|
|
79
|
+
const context = getSelectionContext({
|
|
80
|
+
object,
|
|
81
|
+
selection: {
|
|
82
|
+
mode: 'multi-range',
|
|
83
|
+
ranges: [
|
|
84
|
+
{ from: 'x', to: 'y' },
|
|
85
|
+
{ from: 'a', to: 'b' },
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
resolvers: [resolver],
|
|
89
|
+
});
|
|
90
|
+
expect(context?.selection?.text).toBe('brave');
|
|
91
|
+
expect(context?.selection?.anchors).toEqual(['a:b']);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
import { useCapabilities } from '@dxos/app-framework/ui';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
11
|
+
import { Selection } from '@dxos/react-ui-attention';
|
|
12
|
+
|
|
13
|
+
import { type ProcessorRequestContext } from '../processor';
|
|
14
|
+
|
|
15
|
+
/** Resolve `object`'s selection to text via the AnchorResolver contributed for its typename. */
|
|
16
|
+
export const getSelectionContext = ({
|
|
17
|
+
object,
|
|
18
|
+
selection,
|
|
19
|
+
resolvers,
|
|
20
|
+
}: {
|
|
21
|
+
object: Obj.Unknown;
|
|
22
|
+
selection: Selection.Selection | undefined;
|
|
23
|
+
resolvers: readonly AppCapabilities.AnchorResolver[];
|
|
24
|
+
}): ProcessorRequestContext | undefined => {
|
|
25
|
+
const typename = Obj.getTypename(object);
|
|
26
|
+
const resolver = typename ? resolvers.find((candidate) => candidate.key === typename) : undefined;
|
|
27
|
+
if (!resolver) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// A stale cursor throws in Automerge; a bad range must not abort the submit.
|
|
32
|
+
const resolveAnchorText = (anchor: string): string | undefined => {
|
|
33
|
+
try {
|
|
34
|
+
return resolver.getText(object, anchor);
|
|
35
|
+
} catch {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Anchors and text stay pairwise-aligned: a range that fails to resolve is dropped from both.
|
|
41
|
+
const resolved = Selection.toAnchors(selection).flatMap((anchor) => {
|
|
42
|
+
const text = resolveAnchorText(anchor);
|
|
43
|
+
return text != null && text.length > 0 ? [{ anchor, text }] : [];
|
|
44
|
+
});
|
|
45
|
+
if (resolved.length === 0) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
selection: {
|
|
51
|
+
anchors: resolved.map(({ anchor }) => anchor),
|
|
52
|
+
text: resolved.map(({ text }) => text).join('\n…\n'),
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** Submit-time provider of the companion object's current selection as request context. */
|
|
58
|
+
export const useSelectionContext = (
|
|
59
|
+
companionTo: Obj.Unknown | undefined,
|
|
60
|
+
): (() => ProcessorRequestContext | undefined) => {
|
|
61
|
+
// getAll-style lookup: absent capabilities yield empty arrays so non-companion chats stay inert.
|
|
62
|
+
const [viewState] = useCapabilities(AttentionCapabilities.ViewState);
|
|
63
|
+
const resolvers = useCapabilities(AppCapabilities.AnchorResolver);
|
|
64
|
+
|
|
65
|
+
return useCallback(() => {
|
|
66
|
+
if (!companionTo || !viewState) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
const selection = viewState.get(Selection.aspect, Obj.getURI(companionTo));
|
|
70
|
+
return getSelectionContext({ object: companionTo, selection, resolvers });
|
|
71
|
+
}, [companionTo, viewState, resolvers]);
|
|
72
|
+
};
|
|
@@ -7,7 +7,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
|
7
7
|
import { type AiContext } from '@dxos/assistant';
|
|
8
8
|
import { Skill } from '@dxos/compute';
|
|
9
9
|
import { type Database, Filter, Obj, Ref, type Registry } from '@dxos/echo';
|
|
10
|
-
import { useQuery } from '@dxos/react
|
|
10
|
+
import { useQuery } from '@dxos/echo-react';
|
|
11
11
|
import { distinctBy } from '@dxos/util';
|
|
12
12
|
|
|
13
13
|
export const useSkills = ({ registry, db }: { registry?: Registry.Registry; db?: Database.Database }) => {
|
|
@@ -8,8 +8,8 @@ import { pipe } from 'effect/Function';
|
|
|
8
8
|
import { useMemo } from 'react';
|
|
9
9
|
|
|
10
10
|
import { Trace } from '@dxos/compute';
|
|
11
|
+
import { FeedTraceSink } from '@dxos/compute-runtime';
|
|
11
12
|
import { Filter, Query } from '@dxos/echo';
|
|
12
|
-
import { FeedTraceSink } from '@dxos/functions-runtime';
|
|
13
13
|
import { type Space } from '@dxos/react-client/echo';
|
|
14
14
|
|
|
15
15
|
const atomEmpty = Atom.make(() => [] as const);
|
|
@@ -22,10 +22,12 @@ export const getTraceMessagesAtom = (space: Space): Atom.Atom<readonly Trace.Mes
|
|
|
22
22
|
space.db.query(FeedTraceSink.query).atom,
|
|
23
23
|
Atom.map(
|
|
24
24
|
(feeds) =>
|
|
25
|
-
//
|
|
25
|
+
// Query across ALL trace feeds: writers race on feed creation (the edge's indexer-backed
|
|
26
|
+
// lookup can miss a not-yet-indexed feed and create a duplicate), so a space may hold
|
|
27
|
+
// several trace feeds — reading only one would silently drop the others' events.
|
|
26
28
|
space.db.query(
|
|
27
29
|
feeds.length > 0
|
|
28
|
-
? Query.type(Trace.Message).from(feeds
|
|
30
|
+
? Query.type(Trace.Message).from([...feeds])
|
|
29
31
|
: (Query.select(Filter.nothing()) as Query.Query<never>),
|
|
30
32
|
).atom,
|
|
31
33
|
),
|
|
@@ -17,13 +17,13 @@ import { AssistantOperation } from '#types';
|
|
|
17
17
|
|
|
18
18
|
const handler: Operation.WithHandler<typeof AssistantOperation.CreateChat> = AssistantOperation.CreateChat.pipe(
|
|
19
19
|
Operation.withHandler(
|
|
20
|
-
Effect.fnUntraced(function* ({ db, name, addToSpace = true }) {
|
|
20
|
+
Effect.fnUntraced(function* ({ db, name, instructions, addToSpace = true }) {
|
|
21
21
|
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
22
22
|
const client = yield* Capability.get(ClientCapabilities.Client);
|
|
23
23
|
const space = client.spaces.get(db.spaceId);
|
|
24
24
|
invariant(space, 'Space not found');
|
|
25
25
|
const feed = space.db.add(Feed.make());
|
|
26
|
-
const chat = Chat.make({ name, feed: Ref.make(feed) });
|
|
26
|
+
const chat = Chat.make({ name, feed: Ref.make(feed), instructions });
|
|
27
27
|
Obj.setParent(feed, chat);
|
|
28
28
|
if (addToSpace) {
|
|
29
29
|
space.db.add(chat);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
-
import {
|
|
8
|
+
import { GraphPath, LayoutOperation } from '@dxos/app-toolkit';
|
|
9
9
|
import { AiContext, SessionLink } from '@dxos/assistant';
|
|
10
10
|
import { Chat } from '@dxos/assistant-toolkit';
|
|
11
11
|
import { Operation } from '@dxos/compute';
|
|
@@ -95,7 +95,7 @@ const handler: Operation.WithHandler<typeof AssistantOperation.ForkChat> = Assis
|
|
|
95
95
|
);
|
|
96
96
|
} else {
|
|
97
97
|
// Navigate to the forked chat as a standalone plank.
|
|
98
|
-
const chatPath =
|
|
98
|
+
const chatPath = GraphPath.getObjectPathFromObject(newChat);
|
|
99
99
|
yield* Operation.invoke(LayoutOperation.Open, { subject: [chatPath] });
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
// Copyright 2026 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Atom, Registry } from '@effect-atom/atom
|
|
5
|
+
import { Atom, Registry } from '@effect-atom/atom';
|
|
6
6
|
import { describe, expect, it } from '@effect/vitest';
|
|
7
7
|
import * as Effect from 'effect/Effect';
|
|
8
8
|
import * as Layer from 'effect/Layer';
|
|
9
9
|
|
|
10
|
+
import { AssistantTestLayer } from '@dxos/agent-runtime/testing';
|
|
10
11
|
import { Capabilities, Capability, CapabilityManager } from '@dxos/app-framework';
|
|
11
12
|
import { Operation } from '@dxos/compute';
|
|
12
13
|
import { Database } from '@dxos/echo';
|
|
13
14
|
import { TestHelpers } from '@dxos/effect/testing';
|
|
14
|
-
import { AssistantTestLayer } from '@dxos/functions-runtime/testing';
|
|
15
15
|
import { EntityId } from '@dxos/keys';
|
|
16
16
|
|
|
17
17
|
import { AssistantCapabilities, AssistantOperation } from '#types';
|
package/src/operations/index.ts
CHANGED
|
@@ -9,7 +9,6 @@ export const AssistantOperationHandlerSet = OperationHandlerSet.lazy(
|
|
|
9
9
|
() => import('./ensure-companion-chat'),
|
|
10
10
|
() => import('./fork-chat'),
|
|
11
11
|
() => import('./generate-home-suggestions'),
|
|
12
|
-
() => import('./resolve-navigation-targets'),
|
|
13
12
|
() => import('./run-prompt-in-new-chat'),
|
|
14
13
|
() => import('./set-current-chat'),
|
|
15
14
|
() => import('./toggle-trace-panel-debug'),
|
|
@@ -27,7 +27,7 @@ describe('Agent prompt (composer plugin harness)', () => {
|
|
|
27
27
|
// Requires reachable edge AI (see repo DX_EDGE_AI_SERVICE_URL); not memoized like AssistantTestLayer tests.
|
|
28
28
|
test(
|
|
29
29
|
'chat mode appends assistant messages to the chat queue',
|
|
30
|
-
{ tags: ['
|
|
30
|
+
{ tags: ['manual'], timeout: 60_000 },
|
|
31
31
|
async ({ expect }) => {
|
|
32
32
|
await using harness = await createComposerTestApp({
|
|
33
33
|
plugins: [ClientPlugin({}), AssistantPlugin(), RoutinePlugin()],
|
package/src/paths.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { GraphPath } from '@dxos/app-toolkit';
|
|
6
6
|
import { Chat } from '@dxos/assistant-toolkit';
|
|
7
7
|
|
|
8
|
-
const { getSectionPath: getChatsPath, getObjectPath: getChatPath } =
|
|
9
|
-
groupId:
|
|
8
|
+
const { getSectionPath: getChatsPath, getObjectPath: getChatPath } = GraphPath.createTypeSectionPaths(Chat.Chat, {
|
|
9
|
+
groupId: GraphPath.GroupSegments.ai,
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
export { getChatPath, getChatsPath };
|
package/src/processor/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ import * as ManagedRuntime from 'effect/ManagedRuntime';
|
|
|
10
10
|
import * as Option from 'effect/Option';
|
|
11
11
|
import { test } from 'vitest';
|
|
12
12
|
|
|
13
|
+
import { AssistantTestLayer } from '@dxos/agent-runtime/testing';
|
|
13
14
|
import { Capabilities } from '@dxos/app-framework';
|
|
14
15
|
import { AiSession } from '@dxos/assistant';
|
|
15
16
|
import { Chat } from '@dxos/assistant-toolkit';
|
|
@@ -17,7 +18,6 @@ import { Database, Feed } from '@dxos/echo';
|
|
|
17
18
|
import { UsageQuotaExceededError } from '@dxos/edge-client';
|
|
18
19
|
import { EffectEx } from '@dxos/effect';
|
|
19
20
|
import { TestHelpers } from '@dxos/effect/testing';
|
|
20
|
-
import { AssistantTestLayer } from '@dxos/functions-runtime/testing';
|
|
21
21
|
|
|
22
22
|
import { AiChatProcessor, AiUsageQuotaError, parseError } from './processor';
|
|
23
23
|
|