@dxos/plugin-assistant 0.8.4-staging.60fe92afc8 → 0.9.1-main.c7dcc2e112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/neutral/{AgentArticle-K7XM46OQ.mjs → AgentArticle-2BEPWUMN.mjs} +9 -7
- package/dist/lib/neutral/AgentArticle-2BEPWUMN.mjs.map +7 -0
- package/dist/lib/neutral/AssistantPlugin.mjs +1 -1
- package/dist/lib/neutral/{AssistantSettings-GG52BLKS.mjs → AssistantSettings-7ALY4BMS.mjs} +3 -3
- package/dist/lib/neutral/AssistantSettings-7ALY4BMS.mjs.map +7 -0
- package/dist/lib/neutral/{ChatArticle-VNVZCDUR.mjs → ChatArticle-KT46SUFU.mjs} +2 -2
- package/dist/lib/neutral/{ChatCompanion-LBUHYWQG.mjs → ChatCompanion-YHC43RYQ.mjs} +4 -4
- package/dist/lib/neutral/ChatCompanion-YHC43RYQ.mjs.map +7 -0
- package/dist/lib/neutral/{ChatDialog-DCA6FLOV.mjs → ChatDialog-YZDZLIQA.mjs} +5 -4
- package/dist/lib/neutral/ChatDialog-YZDZLIQA.mjs.map +7 -0
- package/dist/lib/neutral/{PlanArticle-TS5ULWYS.mjs → PlanArticle-VPK2IYWU.mjs} +8 -2
- package/dist/lib/neutral/PlanArticle-VPK2IYWU.mjs.map +7 -0
- package/dist/lib/neutral/{RoutineArticle-5NYXHRG6.mjs → RoutineArticle-FK5BXQN5.mjs} +3 -3
- package/dist/lib/neutral/RoutineArticle-FK5BXQN5.mjs.map +7 -0
- package/dist/lib/neutral/SpaceHomePrompt-HTWQKLGI.mjs +113 -0
- package/dist/lib/neutral/SpaceHomePrompt-HTWQKLGI.mjs.map +7 -0
- package/dist/lib/neutral/SpaceHomeSuggestions-6G4E7GNJ.mjs +50 -0
- package/dist/lib/neutral/SpaceHomeSuggestions-6G4E7GNJ.mjs.map +7 -0
- package/dist/lib/neutral/TracePanel-T552TAOH.mjs +12 -0
- package/dist/lib/neutral/TracePanel-T552TAOH.mjs.map +7 -0
- package/dist/lib/neutral/{TriggerStatus-X7Y5JFZJ.mjs → TriggerStatus-RBOHHDOK.mjs} +3 -3
- package/dist/lib/neutral/TriggerStatus-RBOHHDOK.mjs.map +7 -0
- package/dist/lib/neutral/{agent-service-WCAP5MLI.mjs → agent-service-WV5CSHAG.mjs} +4 -2
- package/dist/lib/neutral/{agent-service-WCAP5MLI.mjs.map → agent-service-WV5CSHAG.mjs.map} +3 -3
- package/dist/lib/neutral/{app-graph-builder-WUFHQH3Y.mjs → app-graph-builder-PTSRZXRN.mjs} +13 -13
- package/dist/lib/neutral/app-graph-builder-PTSRZXRN.mjs.map +7 -0
- package/dist/lib/neutral/{blueprint-definition-MH2QLYQH.mjs → blueprint-definition-2XPYI35X.mjs} +4 -3
- package/dist/lib/neutral/blueprint-definition-2XPYI35X.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +8 -8
- package/dist/lib/neutral/capabilities/index.mjs.map +2 -2
- package/dist/lib/neutral/{chunk-HLANPOBA.mjs → chunk-35EL65O4.mjs} +3 -3
- package/dist/lib/neutral/chunk-35EL65O4.mjs.map +7 -0
- package/dist/lib/neutral/chunk-54W7N6M6.mjs +445 -0
- package/dist/lib/neutral/chunk-54W7N6M6.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-YXRGZYYH.mjs → chunk-5KB2WRI2.mjs} +6 -6
- package/dist/lib/neutral/chunk-5KB2WRI2.mjs.map +7 -0
- package/dist/lib/neutral/{TracePanel-KTZJ6JNR.mjs → chunk-5LKNH7FD.mjs} +5 -20
- package/dist/lib/neutral/chunk-5LKNH7FD.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-SMFJD7BP.mjs → chunk-7FQT4XMI.mjs} +2 -2
- package/dist/lib/neutral/{chunk-RKVVK3R3.mjs → chunk-H77JTXAN.mjs} +17 -9
- package/dist/lib/neutral/chunk-H77JTXAN.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-QAZMOFPI.mjs → chunk-IQZJ5TTM.mjs} +4 -4
- package/dist/lib/neutral/chunk-IQZJ5TTM.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ZNDQVYUN.mjs +53 -0
- package/dist/lib/neutral/chunk-ZNDQVYUN.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +296 -109
- package/dist/lib/neutral/components/index.mjs.map +3 -3
- package/dist/lib/neutral/containers/index.mjs +12 -8
- package/dist/lib/neutral/containers/index.mjs.map +3 -3
- package/dist/lib/neutral/{create-chat-SGGQ6HVN.mjs → create-chat-Z3FNA6OJ.mjs} +2 -2
- package/dist/lib/neutral/{create-chat-SGGQ6HVN.mjs.map → create-chat-Z3FNA6OJ.mjs.map} +2 -2
- package/dist/lib/neutral/{create-object-U2SOFZLR.mjs → create-object-BJUDDKQQ.mjs} +2 -2
- package/dist/lib/neutral/execution-graph/index.mjs +156 -0
- package/dist/lib/neutral/execution-graph/index.mjs.map +4 -4
- package/dist/lib/neutral/{fork-chat-34KEF4ZJ.mjs → fork-chat-UYXYT6BT.mjs} +4 -4
- package/dist/lib/neutral/fork-chat-UYXYT6BT.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +233 -438
- package/dist/lib/neutral/hooks/index.mjs.map +4 -4
- package/dist/lib/neutral/index.mjs +3 -3
- package/dist/lib/neutral/markdown-extension-IJ5RQMQ4.mjs +126 -0
- package/dist/lib/neutral/markdown-extension-IJ5RQMQ4.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/meta.mjs +1 -1
- package/dist/lib/neutral/operations/index.mjs +1 -1
- package/dist/lib/neutral/plugin.mjs +2 -2
- package/dist/lib/neutral/{react-surface-XRTBW5OJ.mjs → react-surface-ES7UHZ65.mjs} +29 -17
- package/dist/lib/neutral/react-surface-ES7UHZ65.mjs.map +7 -0
- package/dist/lib/neutral/{run-prompt-in-new-chat-D5IIE2C7.mjs → run-prompt-in-new-chat-NIAGCKQV.mjs} +11 -8
- package/dist/lib/neutral/run-prompt-in-new-chat-NIAGCKQV.mjs.map +7 -0
- package/dist/lib/neutral/{settings-W4BLWQ53.mjs → settings-7Q3RITIT.mjs} +3 -3
- package/dist/lib/neutral/{settings-W4BLWQ53.mjs.map → settings-7Q3RITIT.mjs.map} +3 -3
- package/dist/lib/neutral/{state-H3G7QCU6.mjs → state-XO2UYSSG.mjs} +2 -2
- package/dist/lib/neutral/{state-H3G7QCU6.mjs.map → state-XO2UYSSG.mjs.map} +3 -3
- package/dist/lib/neutral/testing.mjs +1 -1
- package/dist/lib/neutral/translations.mjs +18 -11
- package/dist/lib/neutral/translations.mjs.map +3 -3
- package/dist/lib/neutral/types/index.mjs +1 -1
- package/dist/types/dx.config.d.ts +28 -0
- package/dist/types/dx.config.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +17 -57
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +6 -3
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.stories.d.ts +32 -0
- package/dist/types/src/components/Chat/Chat.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts +6 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts.map +1 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts +1 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts.map +1 -1
- package/dist/types/src/components/TaskList/TaskList.d.ts +8 -0
- package/dist/types/src/components/TaskList/TaskList.d.ts.map +1 -1
- package/dist/types/src/components/TaskList/TaskList.stories.d.ts +3 -0
- package/dist/types/src/components/TaskList/TaskList.stories.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/ChatArticle/ChatArticle.d.ts +2 -2
- package/dist/types/src/containers/ChatArticle/ChatArticle.d.ts.map +1 -1
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts +2 -2
- package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/containers/PlanArticle/PlanArticle.d.ts.map +1 -1
- package/dist/types/src/containers/SpaceHomePrompt/SpaceHomePrompt.d.ts +15 -0
- package/dist/types/src/containers/SpaceHomePrompt/SpaceHomePrompt.d.ts.map +1 -0
- package/dist/types/src/containers/SpaceHomePrompt/index.d.ts +2 -0
- package/dist/types/src/containers/SpaceHomePrompt/index.d.ts.map +1 -0
- package/dist/types/src/containers/SpaceHomeSuggestions/SpaceHomeSuggestions.d.ts +13 -0
- package/dist/types/src/containers/SpaceHomeSuggestions/SpaceHomeSuggestions.d.ts.map +1 -0
- package/dist/types/src/containers/SpaceHomeSuggestions/index.d.ts +2 -0
- package/dist/types/src/containers/SpaceHomeSuggestions/index.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +2 -0
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/execution-graph/execution-graph.d.ts +18 -0
- package/dist/types/src/execution-graph/execution-graph.d.ts.map +1 -1
- package/dist/types/src/execution-graph/index.d.ts +2 -1
- package/dist/types/src/execution-graph/index.d.ts.map +1 -1
- package/dist/types/src/execution-graph/pending-block-status.d.ts +26 -0
- package/dist/types/src/execution-graph/pending-block-status.d.ts.map +1 -0
- package/dist/types/src/execution-graph/pending-block-status.test.d.ts +2 -0
- package/dist/types/src/execution-graph/pending-block-status.test.d.ts.map +1 -0
- package/dist/types/src/extensions/prompt-extension.d.ts +1 -1
- package/dist/types/src/extensions/prompt-extension.d.ts.map +1 -1
- package/dist/types/src/feed-logger.d.ts +3 -2
- package/dist/types/src/feed-logger.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +2 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useProcessEphemeralStatus.d.ts +10 -0
- package/dist/types/src/hooks/useProcessEphemeralStatus.d.ts.map +1 -0
- package/dist/types/src/hooks/useTraceMessages.d.ts +12 -0
- package/dist/types/src/hooks/useTraceMessages.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +28 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts.map +1 -1
- package/dist/types/src/paths.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +23 -0
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +1 -1
- package/dist/types/src/types/AssistantCapabilities.d.ts.map +1 -1
- package/dist/types/src/types/AssistantEvents.d.ts.map +1 -1
- package/dist/types/src/types/AssistantOperation.d.ts +7 -7
- package/dist/types/src/util/error-cause.d.ts +3 -0
- package/dist/types/src/util/error-cause.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dx.config.ts +38 -0
- package/package.json +71 -70
- package/src/AssistantPlugin.conversations.json +1 -1
- package/src/AssistantPlugin.test.ts +1 -1
- package/src/AssistantPlugin.ts +2 -2
- package/src/capabilities/agent-service.ts +5 -1
- package/src/capabilities/app-graph-builder.ts +15 -20
- package/src/capabilities/blueprint-definition.ts +2 -0
- package/src/capabilities/index.ts +1 -7
- package/src/capabilities/markdown-extension.ts +5 -1
- package/src/capabilities/react-surface.tsx +38 -23
- package/src/capabilities/settings.ts +2 -2
- package/src/capabilities/state.ts +1 -1
- package/src/components/AgentProperties/AgentProperties.tsx +1 -1
- package/src/components/AssistantSettings/AssistantSettings.tsx +2 -2
- package/src/components/Chat/Chat.stories.tsx +94 -0
- package/src/components/Chat/Chat.tsx +39 -6
- package/src/components/ChatPrompt/ChatActions.tsx +4 -2
- package/src/components/ChatPrompt/ChatMcpErrors.tsx +1 -1
- package/src/components/ChatPrompt/ChatOptions.tsx +26 -29
- package/src/components/ChatPrompt/ChatPrompt.tsx +1 -1
- package/src/components/ChatPrompt/ChatReferences.tsx +1 -1
- package/src/components/ChatThread/Anchor.stories.tsx +1 -1
- package/src/components/ChatThread/ChatThread.stories.tsx +1 -1
- package/src/components/ChatThread/DEBUG.md +23 -0
- package/src/components/ChatThread/widgets/SummaryWidget.tsx +1 -1
- package/src/components/ChatThread/widgets/ToolWidget.tsx +1 -1
- package/src/components/ProcessTree/ProcessTree.stories.tsx +7 -0
- package/src/components/ProcessTree/ProcessTree.tsx +191 -88
- package/src/components/TaskList/TaskList.stories.tsx +23 -2
- package/src/components/TaskList/TaskList.tsx +122 -28
- package/src/components/TemplateEditor/TemplateEditor.tsx +1 -1
- package/src/components/TemplateEditor/TemplateForm.tsx +1 -1
- package/src/components/ToolBlock/ToolBlock.tsx +1 -1
- package/src/components/index.ts +1 -0
- package/src/containers/AgentArticle/AgentArticle.stories.tsx +4 -4
- package/src/containers/AgentArticle/AgentArticle.tsx +9 -9
- package/src/containers/ChatArticle/ChatArticle.tsx +18 -10
- package/src/containers/ChatCompanion/ChatCompanion.tsx +2 -2
- package/src/containers/ChatDialog/ChatDialog.tsx +5 -3
- package/src/containers/PlanArticle/PlanArticle.tsx +5 -1
- package/src/containers/RoutineArticle/RoutineArticle.tsx +2 -2
- package/src/containers/SpaceHomePrompt/SpaceHomePrompt.tsx +105 -0
- package/src/containers/SpaceHomePrompt/index.ts +5 -0
- package/src/containers/SpaceHomeSuggestions/SpaceHomeSuggestions.tsx +69 -0
- package/src/containers/SpaceHomeSuggestions/index.ts +5 -0
- package/src/containers/TracePanel/TracePanel.tsx +3 -30
- package/src/containers/TriggerStatus/TriggerStatus.tsx +2 -2
- package/src/containers/index.ts +2 -0
- package/src/execution-graph/execution-graph.ts +130 -0
- package/src/execution-graph/index.ts +10 -0
- package/src/execution-graph/pending-block-status.test.ts +114 -0
- package/src/execution-graph/pending-block-status.ts +88 -0
- package/src/execution-graph/sub-agent-delegation.test.ts +16 -1
- package/src/extensions/prompt-extension.ts +102 -73
- package/src/feed-logger.ts +21 -19
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useChatProcessor.ts +1 -1
- package/src/hooks/useChatServices.ts +2 -2
- package/src/hooks/useChatToolbarActions.ts +5 -5
- package/src/hooks/useContextBinder.ts +1 -1
- package/src/hooks/useProcessEphemeralStatus.ts +192 -0
- package/src/hooks/useTraceMessages.ts +41 -0
- package/src/meta.ts +3 -31
- package/src/operations/create-chat.ts +1 -1
- package/src/operations/fork-chat.ts +3 -3
- package/src/operations/run-prompt-in-new-chat.ts +5 -3
- package/src/paths.ts +2 -2
- package/src/processor/processor.node.test.ts +71 -1
- package/src/processor/processor.ts +58 -2
- 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 +0 -1
- package/src/translations.ts +18 -10
- package/src/types/AssistantCapabilities.ts +3 -3
- package/src/types/AssistantEvents.ts +1 -1
- package/src/types/AssistantOperation.ts +1 -1
- package/src/util/error-cause.ts +21 -0
- package/dist/lib/neutral/AgentArticle-K7XM46OQ.mjs.map +0 -7
- package/dist/lib/neutral/AssistantSettings-GG52BLKS.mjs.map +0 -7
- package/dist/lib/neutral/ChatCompanion-LBUHYWQG.mjs.map +0 -7
- package/dist/lib/neutral/ChatDialog-DCA6FLOV.mjs.map +0 -7
- package/dist/lib/neutral/PlanArticle-TS5ULWYS.mjs.map +0 -7
- package/dist/lib/neutral/RoutineArticle-5NYXHRG6.mjs.map +0 -7
- package/dist/lib/neutral/TracePanel-KTZJ6JNR.mjs.map +0 -7
- package/dist/lib/neutral/TriggerStatus-X7Y5JFZJ.mjs.map +0 -7
- package/dist/lib/neutral/app-graph-builder-WUFHQH3Y.mjs.map +0 -7
- package/dist/lib/neutral/blueprint-definition-MH2QLYQH.mjs.map +0 -7
- package/dist/lib/neutral/chunk-HLANPOBA.mjs.map +0 -7
- package/dist/lib/neutral/chunk-QAZMOFPI.mjs.map +0 -7
- package/dist/lib/neutral/chunk-RKVVK3R3.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-XYHPOGTK.mjs +0 -43
- package/dist/lib/neutral/chunk-XYHPOGTK.mjs.map +0 -7
- package/dist/lib/neutral/chunk-YXRGZYYH.mjs.map +0 -7
- package/dist/lib/neutral/fork-chat-34KEF4ZJ.mjs.map +0 -7
- package/dist/lib/neutral/markdown-extension-YMIFDMYF.mjs +0 -110
- package/dist/lib/neutral/markdown-extension-YMIFDMYF.mjs.map +0 -7
- package/dist/lib/neutral/react-surface-XRTBW5OJ.mjs.map +0 -7
- package/dist/lib/neutral/run-prompt-in-new-chat-D5IIE2C7.mjs.map +0 -7
- package/src/testing/trace-timeline.node.conversations.json +0 -1
- /package/dist/lib/neutral/{ChatArticle-VNVZCDUR.mjs.map → ChatArticle-KT46SUFU.mjs.map} +0 -0
- /package/dist/lib/neutral/{chunk-SMFJD7BP.mjs.map → chunk-7FQT4XMI.mjs.map} +0 -0
- /package/dist/lib/neutral/{create-object-U2SOFZLR.mjs.map → create-object-BJUDDKQQ.mjs.map} +0 -0
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
-
|
|
3
1
|
// src/containers/TracePanel/TracePanel.tsx
|
|
4
2
|
import { Atom } from "@effect-atom/atom";
|
|
5
3
|
import { useAtomValue } from "@effect-atom/atom-react";
|
|
@@ -10,9 +8,7 @@ import React, { useCallback, useDeferredValue, useEffect, useMemo, useState } fr
|
|
|
10
8
|
import { Capabilities } from "@dxos/app-framework";
|
|
11
9
|
import { useCapability, useAtomCapability, useOperationInvoker } from "@dxos/app-framework/ui";
|
|
12
10
|
import { LayoutOperation } from "@dxos/app-toolkit";
|
|
13
|
-
import { Process
|
|
14
|
-
import { Filter, Query } from "@dxos/echo";
|
|
15
|
-
import { FeedTraceSink } from "@dxos/functions-runtime";
|
|
11
|
+
import { Process } from "@dxos/compute";
|
|
16
12
|
import { EID } from "@dxos/keys";
|
|
17
13
|
import { ScrollContainer } from "@dxos/react-ui";
|
|
18
14
|
import { composable, composableProps } from "@dxos/react-ui";
|
|
@@ -22,6 +18,7 @@ import { Syntax } from "@dxos/react-ui-syntax-highlighter";
|
|
|
22
18
|
import { mx } from "@dxos/ui-theme";
|
|
23
19
|
import { ProcessTree } from "#components";
|
|
24
20
|
import { buildExecutionGraph } from "#execution-graph";
|
|
21
|
+
import { useTraceMessages, getTraceMessagesAtom } from "#hooks";
|
|
25
22
|
import { AssistantCapabilities } from "#types";
|
|
26
23
|
var TracePanel = composable(({ space, attendableId, onProcessTerminate, ...props }, forwardedRef) => {
|
|
27
24
|
const attentionAttrs = useAttentionAttributes(attendableId);
|
|
@@ -122,16 +119,6 @@ var useExecutionGraph = (space, { eventLimit } = {}) => {
|
|
|
122
119
|
]);
|
|
123
120
|
return useAtomValue(atom);
|
|
124
121
|
};
|
|
125
|
-
var getTraceMessagesAtom = (space) => pipe(space.db.query(FeedTraceSink.query).atom, Atom.map((feeds) => (
|
|
126
|
-
// TODO(dmaretskyi): This should be possible in a single query with properly working limit(1) and feed > feed contents traversal.
|
|
127
|
-
space.db.query(feeds.length > 0 ? Query.type(Trace.Message).from(feeds[0]) : Query.select(Filter.nothing())).atom
|
|
128
|
-
)), (atom) => Atom.make((get) => get(get(atom))));
|
|
129
|
-
var useTraceMessages = (space) => {
|
|
130
|
-
const atom = useMemo(() => getTraceMessagesAtom(space), [
|
|
131
|
-
space
|
|
132
|
-
]);
|
|
133
|
-
return useAtomValue(atom);
|
|
134
|
-
};
|
|
135
122
|
var getExecutionGraph = (space, processesAtom, { eventLimit = 100 } = {}) => {
|
|
136
123
|
const traceMessages = getTraceMessagesAtom(space);
|
|
137
124
|
const activeProcesses = pipe(processesAtom, Atom.debounce(Duration.millis(500)), Atom.map((processes) => (
|
|
@@ -153,15 +140,13 @@ var ProcessTreeContainer = ({ onProcessSelect, onProcessTerminate }) => {
|
|
|
153
140
|
const processesDeferred = useDeferredValue(processes);
|
|
154
141
|
return /* @__PURE__ */ React.createElement(ProcessTree, {
|
|
155
142
|
processes: processesDeferred,
|
|
143
|
+
depth: 3,
|
|
156
144
|
onProcessSelect,
|
|
157
145
|
onProcessTerminate
|
|
158
146
|
});
|
|
159
147
|
};
|
|
160
148
|
|
|
161
|
-
// src/containers/TracePanel/index.ts
|
|
162
|
-
var TracePanel_default = TracePanel;
|
|
163
149
|
export {
|
|
164
|
-
TracePanel
|
|
165
|
-
TracePanel_default as default
|
|
150
|
+
TracePanel
|
|
166
151
|
};
|
|
167
|
-
//# sourceMappingURL=
|
|
152
|
+
//# sourceMappingURL=chunk-5LKNH7FD.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/containers/TracePanel/TracePanel.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom';\nimport { useAtomValue } from '@effect-atom/atom-react';\nimport * as Data from 'effect/Data';\nimport * as Duration from 'effect/Duration';\nimport { pipe } from 'effect/Function';\nimport React, { useCallback, useDeferredValue, useEffect, useMemo, useState } from 'react';\n\nimport { Capabilities } from '@dxos/app-framework';\nimport { useCapability, useAtomCapability, useOperationInvoker } from '@dxos/app-framework/ui';\nimport { LayoutOperation } from '@dxos/app-toolkit';\nimport { type AppSurface } from '@dxos/app-toolkit/ui';\nimport { Process } from '@dxos/compute';\nimport { EID } from '@dxos/keys';\nimport { type Space } from '@dxos/react-client/echo';\nimport { ScrollContainer } from '@dxos/react-ui';\nimport { composable, composableProps } from '@dxos/react-ui';\nimport { useAttentionAttributes } from '@dxos/react-ui-attention';\nimport { Timeline, type Commit } from '@dxos/react-ui-components';\nimport { Syntax } from '@dxos/react-ui-syntax-highlighter';\nimport { mx } from '@dxos/ui-theme';\n\nimport { ProcessTree, ProcessTreeProps } from '#components';\nimport { buildExecutionGraph, type ExecutionGraph } from '#execution-graph';\nimport { useTraceMessages, getTraceMessagesAtom } from '#hooks';\nimport { AssistantCapabilities } from '#types';\n\nexport type TracePanelProps = AppSurface.SpaceArticleProps<Pick<ProcessTreeProps, 'onProcessTerminate'>>;\n\nexport const TracePanel = composable<HTMLDivElement, TracePanelProps>(\n ({ space, attendableId, onProcessTerminate, ...props }, forwardedRef) => {\n const attentionAttrs = useAttentionAttributes(attendableId);\n const { invokePromise } = useOperationInvoker();\n const settings = useAtomCapability(AssistantCapabilities.Settings);\n const tracePanelDebug = settings.tracePanelDebug ?? false;\n\n // `useDeferredValue` batches update bursts, works together with `React.memo`.\n // See the comment in `ProcessTreeContainer` for more details.\n const { branches, commits, spanTree, details } = useDeferredValue(useExecutionGraph(space));\n\n // Debug hatch (dev builds only): expose the raw trace messages (the exact `buildExecutionGraph`\n // input) so a real trace can be captured as a test fixture. While the TracePanel is mounted, run\n // `dxosDumpTrace()` in the console — it copies the serialized `Trace.Message[]` to the clipboard\n // (and logs it). Gated on `import.meta.env.DEV` so it's stripped from production builds.\n const traceMessages = useTraceMessages(space);\n useEffect(() => {\n if (!import.meta.env.DEV) {\n return;\n }\n // Attach a debug hatch to the global object (a genuine global-augmentation boundary).\n const debugGlobal = globalThis as typeof globalThis & { dxosDumpTrace?: () => string };\n debugGlobal.dxosDumpTrace = () => {\n const data = traceMessages.map((message) => ({\n meta: message.meta,\n isEphemeral: message.isEphemeral,\n events: message.events,\n }));\n const json = JSON.stringify(data, null, 2);\n // eslint-disable-next-line no-console\n console.log(json);\n void navigator.clipboard?.writeText(json);\n return `dxosDumpTrace: ${data.length} message(s) copied to clipboard`;\n };\n return () => {\n delete debugGlobal.dxosDumpTrace;\n };\n }, [traceMessages]);\n\n const [selectedCommit, setSelectedCommit] = useState<Commit | undefined>();\n const handleCommitSelect = useCallback(\n (commit: Commit | undefined) => {\n setSelectedCommit(commit);\n if (commit?.link) {\n const echoUri = EID.tryParse(commit.link);\n const spaceId = echoUri ? EID.getSpaceId(echoUri) : undefined;\n const objectId = echoUri ? EID.getEntityId(echoUri) : undefined;\n if (spaceId && objectId) {\n // TODO(dmaretskyi): Navigates, but fails to open.\n void invokePromise(LayoutOperation.Open, {\n subject: [`${spaceId}:${objectId}`],\n });\n }\n }\n },\n [invokePromise, setSelectedCommit],\n );\n\n // Select current branch.\n const [currentBranch, setCurrentBranch] = useState<string | null>(null);\n const handleProcessSelect = useCallback(\n (process: Process.Info) => {\n const branch = branches.find((branch) => branch === process.pid.toString());\n if (branch) {\n setCurrentBranch(branch);\n }\n },\n [branches],\n );\n\n return (\n <div\n {...composableProps(props, {\n ...attentionAttrs,\n classNames: mx(\n 'h-full grid divide-y divide-separator',\n !tracePanelDebug && selectedCommit\n ? 'grid-rows-[minmax(0,160px)_1fr_minmax(0,206px)]'\n : 'grid-rows-[minmax(0,160px)_1fr]',\n ),\n })}\n ref={forwardedRef}\n >\n <ProcessTreeContainer onProcessSelect={handleProcessSelect} onProcessTerminate={onProcessTerminate} />\n\n <ScrollContainer.Root pin>\n <ScrollContainer.Content thin>\n <ScrollContainer.Fade />\n <ScrollContainer.Viewport>\n {tracePanelDebug ? (\n <Syntax.Root data={spanTree}>\n <Syntax.Content>\n <Syntax.Viewport>\n <Syntax.Code className='text-xs' />\n </Syntax.Viewport>\n </Syntax.Content>\n </Syntax.Root>\n ) : (\n <Timeline\n compact\n commits={commits}\n branches={branches}\n currentBranch={currentBranch}\n onSelect={handleCommitSelect}\n />\n )}\n </ScrollContainer.Viewport>\n <ScrollContainer.ScrollDownButton />\n </ScrollContainer.Content>\n </ScrollContainer.Root>\n\n {!tracePanelDebug && selectedCommit && (\n <Syntax.Root data={details[selectedCommit.id] ?? selectedCommit}>\n <Syntax.Content>\n <Syntax.Viewport>\n <Syntax.Code className='text-xs' />\n </Syntax.Viewport>\n </Syntax.Content>\n </Syntax.Root>\n )}\n </div>\n );\n },\n);\n\n// Stable ref.\nconst atomEmpty = Atom.make(() => [] as const);\n\ntype UseExecutionGraphOptions = {\n eventLimit?: number;\n};\n\nconst useExecutionGraph = (space: Space, { eventLimit }: UseExecutionGraphOptions = {}): ExecutionGraph => {\n const monitor = useCapability(Capabilities.ProcessMonitor);\n const processesAtom = monitor?.processTreeAtom ?? atomEmpty;\n\n const atom = useMemo(\n () => getExecutionGraph(space, processesAtom, { eventLimit }),\n [space, processesAtom, eventLimit],\n );\n\n return useAtomValue(atom);\n};\n\nconst getExecutionGraph = (\n space: Space,\n processesAtom: Atom.Atom<readonly Process.Info[]>,\n { eventLimit = 100 }: UseExecutionGraphOptions = {},\n): Atom.Atom<ExecutionGraph> => {\n const traceMessages = getTraceMessagesAtom(space);\n\n const activeProcesses = pipe(\n processesAtom,\n Atom.debounce(Duration.millis(500)),\n Atom.map((processes) =>\n // `Data.array` does structural comparison on the array elements.\n Data.array(\n processes\n .filter((process) => process.state === Process.State.RUNNING || process.state === Process.State.HYBERNATING)\n .map(Data.struct),\n ),\n ),\n );\n\n return Atom.make((get) =>\n buildExecutionGraph({\n traceMessages: get(traceMessages),\n activeProcesses: get(activeProcesses),\n eventLimit,\n }),\n );\n};\nTracePanel.displayName = 'TracePanel';\n\n// Isolate `ProcessTree` updates from the rest of the panel.\n// TODO(dmaretskyi): Currently not useful since `useExecutionGraph` also pulls in the updates.\nconst ProcessTreeContainer = ({\n onProcessSelect,\n onProcessTerminate,\n}: Pick<ProcessTreeProps, 'onProcessSelect' | 'onProcessTerminate'>) => {\n const monitor = useCapability(Capabilities.ProcessMonitor);\n const processes = useAtomValue(\n useMemo(() => monitor?.processTreeAtom.pipe(Atom.debounce(Duration.millis(500))) ?? atomEmpty, [monitor]),\n );\n\n // `processes` updates in bursts (about 14 updates per navigation).\n // `useDeferredValue` will debounce update propagation, returning stale value for short periods.\n // NOTE: `ProcessTree` MUST use `React.memo`, otherwise this will not work.\n const processesDeferred = useDeferredValue(processes);\n return (\n <ProcessTree\n processes={processesDeferred}\n depth={3}\n onProcessSelect={onProcessSelect}\n onProcessTerminate={onProcessTerminate}\n />\n );\n};\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,YAAY;AACrB,SAASC,oBAAoB;AAC7B,YAAYC,UAAU;AACtB,YAAYC,cAAc;AAC1B,SAASC,YAAY;AACrB,OAAOC,SAASC,aAAaC,kBAAkBC,WAAWC,SAASC,gBAAgB;AAEnF,SAASC,oBAAoB;AAC7B,SAASC,eAAeC,mBAAmBC,2BAA2B;AACtE,SAASC,uBAAuB;AAEhC,SAASC,eAAe;AACxB,SAASC,WAAW;AAEpB,SAASC,uBAAuB;AAChC,SAASC,YAAYC,uBAAuB;AAC5C,SAASC,8BAA8B;AACvC,SAASC,gBAA6B;AACtC,SAASC,cAAc;AACvB,SAASC,UAAU;AAEnB,SAASC,mBAAqC;AAC9C,SAASC,2BAAgD;AACzD,SAASC,kBAAkBC,4BAA4B;AACvD,SAASC,6BAA6B;AAI/B,IAAMC,aAAaX,WACxB,CAAC,EAAEY,OAAOC,cAAcC,oBAAoB,GAAGC,MAAAA,GAASC,iBAAAA;AACtD,QAAMC,iBAAiBf,uBAAuBW,YAAAA;AAC9C,QAAM,EAAEK,cAAa,IAAKvB,oBAAAA;AAC1B,QAAMwB,WAAWzB,kBAAkBgB,sBAAsBU,QAAQ;AACjE,QAAMC,kBAAkBF,SAASE,mBAAmB;AAIpD,QAAM,EAAEC,UAAUC,SAASC,UAAUC,QAAO,IAAKrC,iBAAiBsC,kBAAkBd,KAAAA,CAAAA;AAMpF,QAAMe,gBAAgBnB,iBAAiBI,KAAAA;AACvCvB,YAAU,MAAA;AACR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;IAAOgF;IAAeH;GAAW;AAGpC,SAAO3G,aAAagH,IAAAA;AACtB;AAEA,IAAMC,oBAAoB,CACxBnF,OACAgF,eACA,EAAEH,aAAa,IAAG,IAA+B,CAAC,MAAC;AAEnD,QAAM9D,gBAAgBlB,qBAAqBG,KAAAA;AAE3C,QAAMoF,kBAAkB/G,KACtB2G,eACA/G,KAAKoH,SAAkBC,gBAAO,GAAA,CAAA,GAC9BrH,KAAKqD,IAAI,CAACiE;;IAEHC,WACHD,UACGE,OAAO,CAACpC,YAAYA,QAAQqC,UAAUzG,QAAQ0G,MAAMC,WAAWvC,QAAQqC,UAAUzG,QAAQ0G,MAAME,WAAW,EAC1GvE,IAASwE,WAAM,CAAA;GAAA,CAAA;AAKxB,SAAO7H,KAAK2G,KAAK,CAACmB,QAChBpG,oBAAoB;IAClBoB,eAAegF,IAAIhF,aAAAA;IACnBqE,iBAAiBW,IAAIX,eAAAA;IACrBP;EACF,CAAA,CAAA;AAEJ;AACA9E,WAAWiG,cAAc;AAIzB,IAAMnC,uBAAuB,CAAC,EAC5BC,iBACA5D,mBAAkB,MAC+C;AACjE,QAAM4E,UAAUjG,cAAcD,aAAamG,cAAc;AACzD,QAAMQ,YAAYrH,aAChBQ,QAAQ,MAAMoG,SAASG,gBAAgB5G,KAAKJ,KAAKoH,SAAkBC,gBAAO,GAAA,CAAA,CAAA,KAAUX,WAAW;IAACG;GAAQ,CAAA;AAM1G,QAAMmB,oBAAoBzH,iBAAiB+G,SAAAA;AAC3C,SACE,sBAAA,cAAC7F,aAAAA;IACC6F,WAAWU;IACXC,OAAO;IACPpC;IACA5D;;AAGN;",
|
|
6
|
+
"names": ["Atom", "useAtomValue", "Data", "Duration", "pipe", "React", "useCallback", "useDeferredValue", "useEffect", "useMemo", "useState", "Capabilities", "useCapability", "useAtomCapability", "useOperationInvoker", "LayoutOperation", "Process", "EID", "ScrollContainer", "composable", "composableProps", "useAttentionAttributes", "Timeline", "Syntax", "mx", "ProcessTree", "buildExecutionGraph", "useTraceMessages", "getTraceMessagesAtom", "AssistantCapabilities", "TracePanel", "space", "attendableId", "onProcessTerminate", "props", "forwardedRef", "attentionAttrs", "invokePromise", "settings", "Settings", "tracePanelDebug", "branches", "commits", "spanTree", "details", "useExecutionGraph", "traceMessages", "env", "DEV", "debugGlobal", "globalThis", "dxosDumpTrace", "data", "map", "message", "meta", "isEphemeral", "events", "json", "JSON", "stringify", "console", "log", "navigator", "clipboard", "writeText", "length", "selectedCommit", "setSelectedCommit", "handleCommitSelect", "commit", "link", "echoUri", "tryParse", "spaceId", "getSpaceId", "undefined", "objectId", "getEntityId", "Open", "subject", "currentBranch", "setCurrentBranch", "handleProcessSelect", "process", "branch", "find", "pid", "toString", "div", "classNames", "ref", "ProcessTreeContainer", "onProcessSelect", "Root", "pin", "Content", "thin", "Fade", "Viewport", "Code", "className", "compact", "onSelect", "ScrollDownButton", "id", "atomEmpty", "make", "eventLimit", "monitor", "ProcessMonitor", "processesAtom", "processTreeAtom", "atom", "getExecutionGraph", "activeProcesses", "debounce", "millis", "processes", "array", "filter", "state", "State", "RUNNING", "HYBERNATING", "struct", "get", "displayName", "processesDeferred", "depth"]
|
|
7
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/operations/index.ts
|
|
2
2
|
import { OperationHandlerSet } from "@dxos/compute";
|
|
3
|
-
var AssistantOperationHandlerSet = OperationHandlerSet.lazy(() => import("./create-chat-
|
|
3
|
+
var AssistantOperationHandlerSet = OperationHandlerSet.lazy(() => import("./create-chat-Z3FNA6OJ.mjs"), () => import("./ensure-companion-chat-AMOF3C66.mjs"), () => import("./fork-chat-UYXYT6BT.mjs"), () => import("./resolve-navigation-targets-ZHIMMH7L.mjs"), () => import("./run-prompt-in-new-chat-NIAGCKQV.mjs"), () => import("./set-current-chat-VWBPSIMZ.mjs"), () => import("./toggle-trace-panel-debug-JGTB6KVJ.mjs"), () => import("./update-chat-name-Y7JWIP64.mjs"));
|
|
4
4
|
|
|
5
5
|
export {
|
|
6
6
|
AssistantOperationHandlerSet
|
|
7
7
|
};
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-7FQT4XMI.mjs.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// src/containers/ChatArticle/ChatArticle.tsx
|
|
2
|
-
import React, { forwardRef, useEffect, useRef } from "react";
|
|
2
|
+
import React, { forwardRef, useCallback, useEffect, useRef } from "react";
|
|
3
3
|
import { Capabilities } from "@dxos/app-framework";
|
|
4
|
-
import { useAtomCapability, useCapability } from "@dxos/app-framework/ui";
|
|
4
|
+
import { useAtomCapability, useCapability, useOperationInvoker } from "@dxos/app-framework/ui";
|
|
5
5
|
import { getSpace } from "@dxos/client/echo";
|
|
6
|
-
import {
|
|
6
|
+
import { ClientOperation } from "@dxos/plugin-client";
|
|
7
|
+
import { useObject, useRegistry } from "@dxos/react-client/echo";
|
|
7
8
|
import { Panel } from "@dxos/react-ui";
|
|
8
9
|
import { Chat as ChatComponent } from "#components";
|
|
9
10
|
import { useChatProcessor, useChatServices, useOnline, usePresets } from "#hooks";
|
|
@@ -27,6 +28,14 @@ var ChatArticle = /* @__PURE__ */ forwardRef(({ role, attendableId, subject: cha
|
|
|
27
28
|
registry,
|
|
28
29
|
settings
|
|
29
30
|
});
|
|
31
|
+
const [chatViewType] = useObject(chat, "viewType");
|
|
32
|
+
const viewType = chatViewType ?? settings.chatView;
|
|
33
|
+
const { invokePromise } = useOperationInvoker();
|
|
34
|
+
const handleViewUsage = useCallback(() => {
|
|
35
|
+
void invokePromise(ClientOperation.OpenUsage, void 0);
|
|
36
|
+
}, [
|
|
37
|
+
invokePromise
|
|
38
|
+
]);
|
|
30
39
|
const pendingSubmitted = useRef(false);
|
|
31
40
|
useEffect(() => {
|
|
32
41
|
pendingSubmitted.current = false;
|
|
@@ -58,14 +67,12 @@ var ChatArticle = /* @__PURE__ */ forwardRef(({ role, attendableId, subject: cha
|
|
|
58
67
|
atomRegistry,
|
|
59
68
|
stateAtom
|
|
60
69
|
]);
|
|
61
|
-
const feedTarget = chat?.feed.target;
|
|
62
|
-
const view = chat?.view ?? settings.chatView;
|
|
63
70
|
if (!processor) {
|
|
64
71
|
return null;
|
|
65
72
|
}
|
|
66
73
|
return /* @__PURE__ */ React.createElement(ChatComponent.Root, {
|
|
67
74
|
chat,
|
|
68
|
-
feed:
|
|
75
|
+
feed: chat?.feed.target,
|
|
69
76
|
db: space?.db,
|
|
70
77
|
processor,
|
|
71
78
|
onEvent,
|
|
@@ -82,8 +89,9 @@ var ChatArticle = /* @__PURE__ */ forwardRef(({ role, attendableId, subject: cha
|
|
|
82
89
|
})), /* @__PURE__ */ React.createElement(Panel.Content, null, /* @__PURE__ */ React.createElement(ChatComponent.Content, null, /* @__PURE__ */ React.createElement("div", {
|
|
83
90
|
className: "dx-container relative"
|
|
84
91
|
}, /* @__PURE__ */ React.createElement(ChatComponent.Thread, {
|
|
85
|
-
viewType
|
|
86
|
-
|
|
92
|
+
viewType,
|
|
93
|
+
onViewUsage: handleViewUsage
|
|
94
|
+
}), viewType !== "summary" && /* @__PURE__ */ React.createElement("div", {
|
|
87
95
|
className: "absolute bottom-2 left-0 right-0"
|
|
88
96
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
89
97
|
className: "dx-document px-4"
|
|
@@ -107,4 +115,4 @@ var ChatArticle = /* @__PURE__ */ forwardRef(({ role, attendableId, subject: cha
|
|
|
107
115
|
export {
|
|
108
116
|
ChatArticle
|
|
109
117
|
};
|
|
110
|
-
//# sourceMappingURL=chunk-
|
|
118
|
+
//# sourceMappingURL=chunk-H77JTXAN.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/containers/ChatArticle/ChatArticle.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { forwardRef, useCallback, useEffect, useRef } from 'react';\n\nimport { Capabilities } from '@dxos/app-framework';\nimport { useAtomCapability, useCapability, useOperationInvoker } from '@dxos/app-framework/ui';\nimport { type AppSurface } from '@dxos/app-toolkit/ui';\nimport { getSpace } from '@dxos/client/echo';\nimport { type Obj } from '@dxos/echo';\nimport { ClientOperation } from '@dxos/plugin-client';\nimport { useObject, useRegistry } from '@dxos/react-client/echo';\nimport { Panel } from '@dxos/react-ui';\n\nimport { Chat as ChatComponent, type ChatRootProps } from '#components';\nimport { useChatProcessor, useChatServices, useOnline, usePresets } from '#hooks';\nimport { type Assistant, AssistantCapabilities, type ChatType } from '#types';\n\nexport type ChatArticleProps = AppSurface.ObjectSectionProps<ChatType.Chat> & {\n companionTo?: Obj.Unknown;\n} & Pick<ChatRootProps, 'onEvent' | 'onSubmit'>;\n\nexport const ChatArticle = forwardRef<HTMLDivElement, ChatArticleProps>(\n ({ role, attendableId, subject: chat, companionTo, onEvent, onSubmit }, forwardedRef) => {\n const registry = useRegistry();\n const settings = useAtomCapability(AssistantCapabilities.Settings);\n const atomRegistry = useCapability(Capabilities.AtomRegistry);\n const stateAtom = useCapability(AssistantCapabilities.State);\n // Transient (pre-submit) chats have no database; fall back to the companion's space.\n const space = getSpace(chat) ?? getSpace(companionTo);\n const runtime = useChatServices({ id: space?.id });\n\n const [online, setOnline] = useOnline();\n const { preset, ...chatProps } = usePresets(online);\n const processor = useChatProcessor({ space, chat, preset, runtime, registry, settings });\n\n // Subscribe to the view type via `useObject` so the thread re-renders when ChatOptions changes it;\n // a direct `chat.viewType` read in render does not establish a reactive dependency.\n const [chatViewType] = useObject(chat, 'viewType');\n const viewType = (chatViewType as Assistant.ChatView | undefined) ?? settings.chatView;\n\n const { invokePromise } = useOperationInvoker();\n const handleViewUsage = useCallback(() => {\n void invokePromise(ClientOperation.OpenUsage, undefined);\n }, [invokePromise]);\n\n // Reset the one-shot guard when the target conversation changes, so a pending prompt for a new\n // `attendableId` is still auto-submitted within the same mount.\n const pendingSubmitted = useRef(false);\n useEffect(() => {\n pendingSubmitted.current = false;\n }, [attendableId]);\n\n useEffect(() => {\n if (!processor || !attendableId || pendingSubmitted.current) {\n return;\n }\n\n const state = atomRegistry.get(stateAtom);\n const pendingPrompt = state.pendingPrompts[attendableId];\n if (pendingPrompt) {\n pendingSubmitted.current = true;\n atomRegistry.update(stateAtom, (current) => {\n const { [attendableId]: _, ...rest } = current.pendingPrompts;\n return { ...current, pendingPrompts: rest };\n });\n\n void processor.request({ message: pendingPrompt });\n }\n }, [processor, attendableId, atomRegistry, stateAtom]);\n\n if (!processor) {\n return null;\n }\n\n return (\n <ChatComponent.Root\n chat={chat}\n feed={chat?.feed.target}\n db={space?.db}\n processor={processor}\n onEvent={onEvent}\n onSubmit={onSubmit}\n >\n <Panel.Root role={role} ref={forwardedRef}>\n <Panel.Toolbar className='bg-toolbar-surface'>\n <ChatComponent.Toolbar classNames='dx-document' attendableId={attendableId} companionTo={companionTo} />\n </Panel.Toolbar>\n <Panel.Content>\n <ChatComponent.Content>\n <div className='dx-container relative'>\n <ChatComponent.Thread viewType={viewType} onViewUsage={handleViewUsage} />\n {viewType !== 'summary' && (\n <div className='absolute bottom-2 left-0 right-0'>\n <div className='dx-document px-4'>\n <ChatComponent.Status classNames='px-3 rounded-sm bg-group-surface' />\n </div>\n </div>\n )}\n </div>\n <div className='dx-document px-4 pb-4'>\n <div className='flex flex-col items-center py-2 overflow-hidden'>\n <ChatComponent.TaskList classNames='max-h-[120px] border border-separator rounded-sm text-description' />\n </div>\n <ChatComponent.Prompt\n {...chatProps}\n outline\n preset={preset?.id}\n online={online}\n onOnlineChange={setOnline}\n />\n </div>\n </ChatComponent.Content>\n </Panel.Content>\n </Panel.Root>\n </ChatComponent.Root>\n );\n },\n);\n"],
|
|
5
|
+
"mappings": ";AAIA,OAAOA,SAASC,YAAYC,aAAaC,WAAWC,cAAc;AAElE,SAASC,oBAAoB;AAC7B,SAASC,mBAAmBC,eAAeC,2BAA2B;AAEtE,SAASC,gBAAgB;AAEzB,SAASC,uBAAuB;AAChC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QA,QAAQH;IAChBC;IACAuC,gBAAgBtC;;AAQhC,CAAA;",
|
|
6
|
+
"names": ["React", "forwardRef", "useCallback", "useEffect", "useRef", "Capabilities", "useAtomCapability", "useCapability", "useOperationInvoker", "getSpace", "ClientOperation", "useObject", "useRegistry", "Panel", "Chat", "ChatComponent", "useChatProcessor", "useChatServices", "useOnline", "usePresets", "AssistantCapabilities", "ChatArticle", "role", "attendableId", "subject", "chat", "companionTo", "onEvent", "onSubmit", "forwardedRef", "registry", "settings", "Settings", "atomRegistry", "AtomRegistry", "stateAtom", "State", "space", "runtime", "id", "online", "setOnline", "preset", "chatProps", "processor", "chatViewType", "viewType", "chatView", "invokePromise", "handleViewUsage", "OpenUsage", "undefined", "pendingSubmitted", "current", "state", "get", "pendingPrompt", "pendingPrompts", "update", "_", "rest", "request", "message", "Root", "feed", "target", "db", "ref", "Toolbar", "className", "classNames", "Content", "div", "Thread", "onViewUsage", "Status", "TaskList", "Prompt", "outline", "onOnlineChange"]
|
|
7
|
+
}
|
|
@@ -16,11 +16,11 @@ import { meta } from "#meta";
|
|
|
16
16
|
import { translations } from "#translations";
|
|
17
17
|
import { AssistantEvents } from "#types";
|
|
18
18
|
|
|
19
|
-
// raw-loader:/__w/dxos/dxos/packages/plugins/plugin-assistant/PLUGIN.mdl
|
|
19
|
+
// raw-loader:/__w/dxos/dxos/packages/plugins/plugin-assistant/PLUGIN.mdl
|
|
20
20
|
var PLUGIN_default = '---\nid: org.dxos.plugin.assistant\nname: AssistantPlugin\nversion: 0.1.0\n---\n\nAn AI assistant plugin for DXOS Composer that provides conversational AI, blueprint-driven automation,\nmulti-provider LLM support, and deep ECHO integration.\n\n## Extensions\n\nThe following extension dialects are used in this document.\nEach extension is defined in the Appendix or resolved via its URI.\n\n| Term | URI |\n|-------------|-------------------------------|\n| `type` | `org.dxos.mdl.type@1.0` |\n| `feat` | `org.dxos.mdl.feat@1.0` |\n| `test` | `org.dxos.mdl.test@1.0` |\n| `component` | `org.dxos.mdl.component@1.0` |\n| `op` | `org.dxos.mdl.op@1.0` |\n\n## Types\n\n```mdl\ntype ModelProvider\n literals: edge | ollama | lmstudio\n```\n\n```mdl\ntype ChatView\n literals: normal | summary | thinking | debug\n```\n\n```mdl\ntype ModelDefaults\n fields:\n edge?: string\n ollama?: string\n lmstudio?: string\n```\n\n```mdl\ntype Settings\n fields:\n customPrompts?: boolean\n chatView?: ChatView\n modelProvider?: ModelProvider\n modelDefaults?: ModelDefaults\n tracePanelDebug?: boolean\n```\n\n```mdl\ntype Chat\n fields:\n id: string\n name?: string\n messages: Message[]\n```\n\n```mdl\ntype Message\n fields:\n id: string\n role: user | assistant | system\n content: string\n timestamp: string\n```\n\n```mdl\ntype NavigationTarget\n fields:\n path: string\n label: string\n type: string\n```\n\n```mdl\ntype BlueprintForm\n fields:\n key: string\n name: string\n description?: string\n```\n\n## Components\n\n```mdl\ncomponent ChatPanel\n desc: Main conversational interface for interacting with the AI assistant.\n props:\n chat: Chat\n companionTo?: Obj\n state:\n messages: Message[]\n pending: boolean\n view: ChatView\n slots:\n toolbar?: ReactNode\n empty?: ReactNode\n actions:\n sendMessage(content: string)\n clearHistory()\n switchView(view: ChatView)\n emits:\n onMessage(message: Message)\n layout: |\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 [toolbar slot] \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 \u2502\n \u2502 message list \u2502\n \u2502 [empty slot] \u2502\n \u2502 \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 input + send \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n```mdl\ncomponent TracePanel\n desc: Displays the execution trace of an AI operation as a commit graph or raw JSON.\n props:\n chat: Chat\n state:\n debug: boolean\n actions:\n toggleDebug()\n layout: |\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 trace / span tree \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n```mdl\ncomponent AssistantSettings\n desc: Settings panel for configuring the AI model provider, model defaults, and chat view.\n props:\n settings: Settings\n emits:\n onChange(settings: Settings)\n```\n\n## Operations\n\n```mdl\nop CreateChat\n desc: Creates a new Chat object and optionally adds it to the active space.\n input:\n db: Database\n name?: string\n addToSpace?: boolean\n output: Chat\n effects: [echo:write]\n```\n\n```mdl\nop UpdateChatName\n desc: Automatically derives and updates the name of a chat using the AI service.\n input:\n chat: Chat\n output: void\n effects: [echo:write, ai:infer]\n```\n\n```mdl\nop SetCurrentChat\n desc: Associates a primary object with a specific companion chat in session state.\n input:\n companionTo: Obj\n chat?: Chat\n output: void\n```\n\n```mdl\nop RunPromptInNewChat\n desc: Creates a new chat, binds context objects and blueprints, then runs a prompt.\n input:\n db: Database\n objects?: Obj[]\n blueprints?: string[]\n prompt: string | RoutineRef\n background?: boolean\n output: Chat\n effects: [echo:write, ai:infer]\n note: |\n When background is true, the prompt runs via the compute runtime without\n opening the chat UI. The returned Chat can be used to track progress.\n```\n\n```mdl\nop EnsureCompanionChat\n desc: Returns the companion chat for an object, creating one if none exists.\n input:\n db: Database\n companionTo: Obj\n output:\n chat: Chat\n persisted: boolean\n effects: [echo:write]\n```\n\n```mdl\nop ResolveNavigationTargets\n desc: Returns navigation paths for objects in the active space, optionally filtered by DXN.\n input:\n query?:\n dxn?: DXN\n output:\n targets: NavigationTarget[]\n```\n\n```mdl\nop OnCreateSpace\n desc: Provisions initial assistant objects when a new space is created.\n input:\n space: Space\n rootCollection: Collection\n output: void\n effects: [echo:write]\n```\n\n```mdl\nop ToggleTracePanelDebug\n desc: Toggles the trace panel between commit-graph and raw JSON debug view.\n input:\n state?: boolean\n output: boolean\n```\n\n## Features\n\n```mdl\nfeat F-1: AI Chat\n\n req F-1.1: User can create a new Chat object in any space.\n req F-1.2: User can type a message and receive a streamed AI response.\n req F-1.3: Chat history is persisted to ECHO and replicated to all peers.\n req F-1.4:\n when: chat has enough messages\n then: chat name is automatically derived from the conversation\n```\n\n```mdl\nfeat F-2: Companion Chat\n\n req F-2.1:\n when: user opens an object that supports companions\n then: a companion chat panel is shown alongside the object\n req F-2.2:\n when: companion chat does not yet exist\n then: op:EnsureCompanionChat creates one and optionally persists it\n req F-2.3:\n when: user sends a message in the companion chat\n then: the primary object is automatically bound as AI context\n```\n\n```mdl\nfeat F-3: Blueprint System\n\n req F-3.1: Blueprints define named AI configurations (instructions, tools, model).\n req F-3.2: Built-in blueprints include: Assistant, Browser, Database, WebSearch, Discord, Linear, Agent, Planning, Memory, Automation, BlueprintManager, AgentWizard.\n req F-3.3:\n when: user selects a blueprint for a chat\n then: chat uses that blueprint\'s instructions and tool set\n req F-3.4: op:RunPromptInNewChat accepts blueprint keys to bind before sending the prompt.\n```\n\n```mdl\nfeat F-4: Multi-Provider LLM\n\n req F-4.1: Supported providers: DXOS Edge (remote), Ollama (local), LM Studio (local).\n req F-4.2: User can configure the active provider and per-provider default model in Settings.\n req F-4.3:\n when: the active provider is unavailable\n then: AiService falls back to the next registered resolver\n```\n\n```mdl\nfeat F-5: Tool Execution\n\n req F-5.1: The assistant blueprint exposes LayoutOperation.Open and ResolveNavigationTargets as tools.\n req F-5.2: Web search tool is registered via WebSearchToolkit.\n req F-5.3:\n when: AI invokes a tool during a conversation\n then: operation is dispatched via the compute runtime and result returned to the model\n```\n\n```mdl\nfeat F-6: ECHO Integration\n\n req F-6.1: Chat, CompanionTo, Blueprint, Feed, Message, Memory, Plan, Routine, Agent, McpServer, and Sequence schemas are registered with ECHO.\n req F-6.2:\n when: a new space is created\n then: op:OnCreateSpace provisions default assistant objects\n req F-6.3: AiContext.Binding schema supports binding ECHO objects as named context variables in a conversation.\n```\n\n```mdl\nfeat F-7: Execution Trace\n\n req F-7.1: Every AI operation produces a structured span tree captured in the TracePanel.\n req F-7.2: User can toggle between commit-graph and raw JSON views via op:ToggleTracePanelDebug.\n```\n\n## Acceptance\n\n```mdl\ntest T-1: Create chat and send message\n given: a space is open and the assistant plugin is active\n when: user creates a new Chat and sends "Hello"\n then:\n - Chat object appears in the space\n - AI response is appended to Chat.messages\n - Chat is persisted to ECHO\n```\n\n```mdl\ntest T-2: Companion chat provisioning\n given: user opens a document with no companion chat\n when: companion panel initializes\n then:\n - op:EnsureCompanionChat creates a new Chat\n - persisted === false until user sends a message\n```\n\n```mdl\ntest T-3: Blueprint binding\n given: a chat exists\n when: user binds the "WebSearch" blueprint key\n then:\n - blueprint instructions are applied to the next AI request\n - web search tool is available in the tool list\n```\n\n```mdl\ntest T-4: Model provider switch\n given: assistant settings are open\n when: user switches provider from edge to ollama\n then:\n - Settings.modelProvider === ollama\n - next AI request is routed to the Ollama resolver\n```\n\n```mdl\ntest T-5: Run prompt in background\n given: a database and a prompt string are available\n when: op:RunPromptInNewChat is called with background: true\n then:\n - a new Chat is created and returned\n - the prompt runs via compute runtime without opening the UI\n```\n\n```mdl\ntest T-6: Navigation target resolution\n given: active space contains documents and collections\n when: op:ResolveNavigationTargets is called with no query\n then:\n - returned targets include paths for all top-level navigable objects\n - each target has a non-empty label and type\n```\n\n```mdl\ntest T-7: Trace panel debug toggle\n given: trace panel is showing commit-graph view\n when: op:ToggleTracePanelDebug is invoked with no argument\n then:\n - tracePanelDebug setting flips to true\n - trace panel switches to raw JSON view\n```\n\n---\n\n## Appendix: Extension Definitions\n\nExtension block types used in this document are defined below using\nthe core `ext` primitive \u2014 the only construct the base language provides.\n\n```mdl\next type\n uri: org.dxos.mdl.type@1.0\n desc: A named data structure with typed fields and optional literals.\n fields:\n desc?: Prose\n fields?: FieldMap\n literals?: UnionList\n extends?: TypeRef[]\n```\n\n```mdl\next feat\n uri: org.dxos.mdl.feat@1.0\n desc: A named feature grouping one or more requirements.\n fields:\n desc?: Prose\n req: RequirementList\n nesting: self\n```\n\n```mdl\next test\n uri: org.dxos.mdl.test@1.0\n desc: An acceptance scenario expressed as given / when / then steps.\n fields:\n given?: Step | Step[]\n when?: Step | Step[]\n then: Step | Step[]\n tags?: TagList\n```\n\n```mdl\next component\n uri: org.dxos.mdl.component@1.0\n desc: A UI component with props, internal state, slots, actions, and events.\n fields:\n desc?: Prose\n props?: FieldMap\n state?: FieldMap\n slots?: FieldMap\n actions?: ActionMap\n emits?: EventMap\n layout?: CodeBlock\n```\n\n```mdl\next op\n uri: org.dxos.mdl.op@1.0\n desc: |\n A named operation with typed inputs, outputs, and declared errors.\n Pure ops have no effects or requires. Effectful ops declare both.\n fields:\n desc?: Prose\n input?: FieldMap\n output?: TypeExpr\n errors?: ErrorMap\n effects?: EffectList\n requires?: ServiceList\n note?: Prose\n```\n';
|
|
21
21
|
|
|
22
22
|
// src/AssistantPlugin.ts
|
|
23
|
-
var StateReady = AppActivationEvents.createStateEvent(meta.
|
|
23
|
+
var StateReady = AppActivationEvents.createStateEvent(meta.profile.key);
|
|
24
24
|
var AssistantPlugin = Plugin.define(meta).pipe(AppPlugin.addAppGraphModule({
|
|
25
25
|
activate: AppGraphBuilder
|
|
26
26
|
}), AppPlugin.addBlueprintDefinitionModule({
|
|
@@ -115,7 +115,7 @@ var AssistantPlugin = Plugin.define(meta).pipe(AppPlugin.addAppGraphModule({
|
|
|
115
115
|
activate: IntegrationProvider
|
|
116
116
|
}), AppPlugin.addPluginAssetModule({
|
|
117
117
|
asset: {
|
|
118
|
-
pluginId: meta.
|
|
118
|
+
pluginId: meta.profile.key,
|
|
119
119
|
path: "PLUGIN.mdl",
|
|
120
120
|
content: PLUGIN_default,
|
|
121
121
|
mimeType: "application/x-mdl"
|
|
@@ -127,4 +127,4 @@ export {
|
|
|
127
127
|
AssistantPlugin,
|
|
128
128
|
AssistantPlugin_default
|
|
129
129
|
};
|
|
130
|
-
//# sourceMappingURL=chunk-
|
|
130
|
+
//# sourceMappingURL=chunk-IQZJ5TTM.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/AssistantPlugin.ts", "raw-loader:/__w/dxos/dxos/packages/plugins/plugin-assistant/PLUGIN.mdl"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { ActivationEvent, ActivationEvents, Capability, Plugin } from '@dxos/app-framework';\nimport { AppActivationEvents, AppPlugin } from '@dxos/app-toolkit';\nimport { AiContext } from '@dxos/assistant';\nimport { Agent, Chat, McpServer, Memory, Plan } from '@dxos/assistant-toolkit';\nimport { Blueprint, Routine } from '@dxos/compute';\nimport { Sequence } from '@dxos/conductor';\nimport { Feed } from '@dxos/echo';\nimport { ClientEvents } from '@dxos/plugin-client';\nimport { DeckEvents } from '@dxos/plugin-deck';\nimport { MarkdownEvents } from '@dxos/plugin-markdown';\nimport { Text } from '@dxos/schema';\nimport { HasSubject, Message } from '@dxos/types';\n\nimport {\n AgentHydrator,\n AgentRuntime,\n AiContext as AiContextCapability,\n AiService,\n IntegrationProvider,\n AppGraphBuilder,\n AutomationTemplates,\n AssistantState,\n BlueprintDefinition,\n CompanionChatProvisioner,\n CreateObject,\n EdgeModelResolver,\n LocalModelResolver,\n MarkdownExtension,\n Migrations,\n OperationHandler,\n ReactSurface,\n Settings,\n Toolkit,\n} from '#capabilities';\nimport { meta } from '#meta';\nimport { translations } from '#translations';\nimport { AssistantEvents, type AssistantPluginOptions } from '#types';\n\n// eslint-disable-next-line import/no-relative-packages\nimport pluginSpec from '../PLUGIN.mdl?raw';\n\nconst StateReady = AppActivationEvents.createStateEvent(meta.profile.key);\n\nexport const AssistantPlugin = Plugin.define<AssistantPluginOptions | void>(meta)\n .pipe(\n AppPlugin.addAppGraphModule({ activate: AppGraphBuilder }),\n AppPlugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),\n AppPlugin.addCreateObjectModule({ activate: CreateObject }),\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addSchemaModule({\n schema: [\n Chat.Chat,\n Chat.CompanionTo,\n Blueprint.Blueprint,\n AiContext.Binding,\n Feed.Feed,\n HasSubject.HasSubject,\n Message.Message,\n Routine.Routine,\n Agent.Agent,\n McpServer.McpServer,\n Plan.Plan,\n Sequence.Sequence,\n Memory.Memory,\n Text.Text,\n ],\n }),\n AppPlugin.addSettingsModule({ activate: Settings }),\n AppPlugin.addSurfaceModule({\n activate: ReactSurface,\n firesBeforeActivation: [AppActivationEvents.SetupArtifactDefinition],\n }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.addModule({\n id: 'automation-templates',\n activatesOn: AppActivationEvents.SetupSchema,\n activate: AutomationTemplates,\n }),\n Plugin.addModule({\n id: 'markdown',\n activatesOn: MarkdownEvents.SetupExtensions,\n activate: MarkdownExtension,\n }),\n Plugin.addModule({\n // TODO(wittjosiah): Does not integrate with settings store.\n // Should this be a different event?\n // Should settings store be renamed to be more generic?\n activatesOn: AppActivationEvents.SetupSettings,\n firesAfterActivation: [StateReady],\n activate: AssistantState,\n }),\n Plugin.addModule({\n activatesOn: AssistantEvents.SetupAiServiceProviders,\n activate: EdgeModelResolver,\n }),\n Plugin.addModule({\n activatesOn: AssistantEvents.SetupAiServiceProviders,\n activate: LocalModelResolver,\n }),\n Plugin.addModule((options) => ({\n id: Capability.getModuleTag(AiService),\n firesBeforeActivation: [AssistantEvents.SetupAiServiceProviders],\n // TODO(dmaretskyi): This should activate lazily when the AI chat is used.\n activatesOn: ActivationEvents.SetupProcessManager,\n activate: () => AiService(options),\n })),\n Plugin.addModule({\n // Process-affinity `AiContext.Service` LayerSpec — needed so operations\n // dispatched as their own processes (e.g. via `Operation.invoke` from\n // `AiSession.createRequest` or `TriggerDispatcher`) can resolve\n // conversation-scoped services without an inline `Effect.provideService`\n // upstream. See `capabilities/ai-context.ts` for the rationale.\n activatesOn: ActivationEvents.SetupProcessManager,\n activate: AiContextCapability,\n }),\n Plugin.addModule({\n activatesOn: ActivationEvents.SetupProcessManager,\n activate: AgentRuntime,\n }),\n )\n .pipe(\n Plugin.addModule({\n // TODO(wittjosiah): Use a different event.\n activatesOn: ActivationEvents.Startup,\n activate: Toolkit,\n }),\n Plugin.addModule({\n activatesOn: ActivationEvents.ProcessManagerReady,\n activate: AgentHydrator,\n }),\n Plugin.addModule({\n activatesOn: ActivationEvent.allOf(\n ActivationEvents.ProcessManagerReady,\n AppActivationEvents.AppGraphReady,\n DeckEvents.StateReady,\n StateReady,\n ),\n activate: CompanionChatProvisioner,\n }),\n Plugin.addModule({\n activatesOn: ClientEvents.SetupMigration,\n activate: Migrations,\n }),\n Plugin.addModule({\n activatesOn: AppActivationEvents.SetupIntegrationProviders,\n activate: IntegrationProvider,\n }),\n AppPlugin.addPluginAssetModule({\n asset: { pluginId: meta.profile.key, path: 'PLUGIN.mdl', content: pluginSpec, mimeType: 'application/x-mdl' },\n }),\n Plugin.make,\n );\n\nexport default AssistantPlugin;\n", "---\nid: org.dxos.plugin.assistant\nname: AssistantPlugin\nversion: 0.1.0\n---\n\nAn AI assistant plugin for DXOS Composer that provides conversational AI, blueprint-driven automation,\nmulti-provider LLM support, and deep ECHO integration.\n\n## Extensions\n\nThe following extension dialects are used in this document.\nEach extension is defined in the Appendix or resolved via its URI.\n\n| Term | URI |\n|-------------|-------------------------------|\n| `type` | `org.dxos.mdl.type@1.0` |\n| `feat` | `org.dxos.mdl.feat@1.0` |\n| `test` | `org.dxos.mdl.test@1.0` |\n| `component` | `org.dxos.mdl.component@1.0` |\n| `op` | `org.dxos.mdl.op@1.0` |\n\n## Types\n\n```mdl\ntype ModelProvider\n literals: edge | ollama | lmstudio\n```\n\n```mdl\ntype ChatView\n literals: normal | summary | thinking | debug\n```\n\n```mdl\ntype ModelDefaults\n fields:\n edge?: string\n ollama?: string\n lmstudio?: string\n```\n\n```mdl\ntype Settings\n fields:\n customPrompts?: boolean\n chatView?: ChatView\n modelProvider?: ModelProvider\n modelDefaults?: ModelDefaults\n tracePanelDebug?: boolean\n```\n\n```mdl\ntype Chat\n fields:\n id: string\n name?: string\n messages: Message[]\n```\n\n```mdl\ntype Message\n fields:\n id: string\n role: user | assistant | system\n content: string\n timestamp: string\n```\n\n```mdl\ntype NavigationTarget\n fields:\n path: string\n label: string\n type: string\n```\n\n```mdl\ntype BlueprintForm\n fields:\n key: string\n name: string\n description?: string\n```\n\n## Components\n\n```mdl\ncomponent ChatPanel\n desc: Main conversational interface for interacting with the AI assistant.\n props:\n chat: Chat\n companionTo?: Obj\n state:\n messages: Message[]\n pending: boolean\n view: ChatView\n slots:\n toolbar?: ReactNode\n empty?: ReactNode\n actions:\n sendMessage(content: string)\n clearHistory()\n switchView(view: ChatView)\n emits:\n onMessage(message: Message)\n layout: |\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 [toolbar slot] \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 \u2502\n \u2502 message list \u2502\n \u2502 [empty slot] \u2502\n \u2502 \u2502\n \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 input + send \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n```mdl\ncomponent TracePanel\n desc: Displays the execution trace of an AI operation as a commit graph or raw JSON.\n props:\n chat: Chat\n state:\n debug: boolean\n actions:\n toggleDebug()\n layout: |\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 trace / span tree \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n```mdl\ncomponent AssistantSettings\n desc: Settings panel for configuring the AI model provider, model defaults, and chat view.\n props:\n settings: Settings\n emits:\n onChange(settings: Settings)\n```\n\n## Operations\n\n```mdl\nop CreateChat\n desc: Creates a new Chat object and optionally adds it to the active space.\n input:\n db: Database\n name?: string\n addToSpace?: boolean\n output: Chat\n effects: [echo:write]\n```\n\n```mdl\nop UpdateChatName\n desc: Automatically derives and updates the name of a chat using the AI service.\n input:\n chat: Chat\n output: void\n effects: [echo:write, ai:infer]\n```\n\n```mdl\nop SetCurrentChat\n desc: Associates a primary object with a specific companion chat in session state.\n input:\n companionTo: Obj\n chat?: Chat\n output: void\n```\n\n```mdl\nop RunPromptInNewChat\n desc: Creates a new chat, binds context objects and blueprints, then runs a prompt.\n input:\n db: Database\n objects?: Obj[]\n blueprints?: string[]\n prompt: string | RoutineRef\n background?: boolean\n output: Chat\n effects: [echo:write, ai:infer]\n note: |\n When background is true, the prompt runs via the compute runtime without\n opening the chat UI. The returned Chat can be used to track progress.\n```\n\n```mdl\nop EnsureCompanionChat\n desc: Returns the companion chat for an object, creating one if none exists.\n input:\n db: Database\n companionTo: Obj\n output:\n chat: Chat\n persisted: boolean\n effects: [echo:write]\n```\n\n```mdl\nop ResolveNavigationTargets\n desc: Returns navigation paths for objects in the active space, optionally filtered by DXN.\n input:\n query?:\n dxn?: DXN\n output:\n targets: NavigationTarget[]\n```\n\n```mdl\nop OnCreateSpace\n desc: Provisions initial assistant objects when a new space is created.\n input:\n space: Space\n rootCollection: Collection\n output: void\n effects: [echo:write]\n```\n\n```mdl\nop ToggleTracePanelDebug\n desc: Toggles the trace panel between commit-graph and raw JSON debug view.\n input:\n state?: boolean\n output: boolean\n```\n\n## Features\n\n```mdl\nfeat F-1: AI Chat\n\n req F-1.1: User can create a new Chat object in any space.\n req F-1.2: User can type a message and receive a streamed AI response.\n req F-1.3: Chat history is persisted to ECHO and replicated to all peers.\n req F-1.4:\n when: chat has enough messages\n then: chat name is automatically derived from the conversation\n```\n\n```mdl\nfeat F-2: Companion Chat\n\n req F-2.1:\n when: user opens an object that supports companions\n then: a companion chat panel is shown alongside the object\n req F-2.2:\n when: companion chat does not yet exist\n then: op:EnsureCompanionChat creates one and optionally persists it\n req F-2.3:\n when: user sends a message in the companion chat\n then: the primary object is automatically bound as AI context\n```\n\n```mdl\nfeat F-3: Blueprint System\n\n req F-3.1: Blueprints define named AI configurations (instructions, tools, model).\n req F-3.2: Built-in blueprints include: Assistant, Browser, Database, WebSearch, Discord, Linear, Agent, Planning, Memory, Automation, BlueprintManager, AgentWizard.\n req F-3.3:\n when: user selects a blueprint for a chat\n then: chat uses that blueprint's instructions and tool set\n req F-3.4: op:RunPromptInNewChat accepts blueprint keys to bind before sending the prompt.\n```\n\n```mdl\nfeat F-4: Multi-Provider LLM\n\n req F-4.1: Supported providers: DXOS Edge (remote), Ollama (local), LM Studio (local).\n req F-4.2: User can configure the active provider and per-provider default model in Settings.\n req F-4.3:\n when: the active provider is unavailable\n then: AiService falls back to the next registered resolver\n```\n\n```mdl\nfeat F-5: Tool Execution\n\n req F-5.1: The assistant blueprint exposes LayoutOperation.Open and ResolveNavigationTargets as tools.\n req F-5.2: Web search tool is registered via WebSearchToolkit.\n req F-5.3:\n when: AI invokes a tool during a conversation\n then: operation is dispatched via the compute runtime and result returned to the model\n```\n\n```mdl\nfeat F-6: ECHO Integration\n\n req F-6.1: Chat, CompanionTo, Blueprint, Feed, Message, Memory, Plan, Routine, Agent, McpServer, and Sequence schemas are registered with ECHO.\n req F-6.2:\n when: a new space is created\n then: op:OnCreateSpace provisions default assistant objects\n req F-6.3: AiContext.Binding schema supports binding ECHO objects as named context variables in a conversation.\n```\n\n```mdl\nfeat F-7: Execution Trace\n\n req F-7.1: Every AI operation produces a structured span tree captured in the TracePanel.\n req F-7.2: User can toggle between commit-graph and raw JSON views via op:ToggleTracePanelDebug.\n```\n\n## Acceptance\n\n```mdl\ntest T-1: Create chat and send message\n given: a space is open and the assistant plugin is active\n when: user creates a new Chat and sends \"Hello\"\n then:\n - Chat object appears in the space\n - AI response is appended to Chat.messages\n - Chat is persisted to ECHO\n```\n\n```mdl\ntest T-2: Companion chat provisioning\n given: user opens a document with no companion chat\n when: companion panel initializes\n then:\n - op:EnsureCompanionChat creates a new Chat\n - persisted === false until user sends a message\n```\n\n```mdl\ntest T-3: Blueprint binding\n given: a chat exists\n when: user binds the \"WebSearch\" blueprint key\n then:\n - blueprint instructions are applied to the next AI request\n - web search tool is available in the tool list\n```\n\n```mdl\ntest T-4: Model provider switch\n given: assistant settings are open\n when: user switches provider from edge to ollama\n then:\n - Settings.modelProvider === ollama\n - next AI request is routed to the Ollama resolver\n```\n\n```mdl\ntest T-5: Run prompt in background\n given: a database and a prompt string are available\n when: op:RunPromptInNewChat is called with background: true\n then:\n - a new Chat is created and returned\n - the prompt runs via compute runtime without opening the UI\n```\n\n```mdl\ntest T-6: Navigation target resolution\n given: active space contains documents and collections\n when: op:ResolveNavigationTargets is called with no query\n then:\n - returned targets include paths for all top-level navigable objects\n - each target has a non-empty label and type\n```\n\n```mdl\ntest T-7: Trace panel debug toggle\n given: trace panel is showing commit-graph view\n when: op:ToggleTracePanelDebug is invoked with no argument\n then:\n - tracePanelDebug setting flips to true\n - trace panel switches to raw JSON view\n```\n\n---\n\n## Appendix: Extension Definitions\n\nExtension block types used in this document are defined below using\nthe core `ext` primitive \u2014 the only construct the base language provides.\n\n```mdl\next type\n uri: org.dxos.mdl.type@1.0\n desc: A named data structure with typed fields and optional literals.\n fields:\n desc?: Prose\n fields?: FieldMap\n literals?: UnionList\n extends?: TypeRef[]\n```\n\n```mdl\next feat\n uri: org.dxos.mdl.feat@1.0\n desc: A named feature grouping one or more requirements.\n fields:\n desc?: Prose\n req: RequirementList\n nesting: self\n```\n\n```mdl\next test\n uri: org.dxos.mdl.test@1.0\n desc: An acceptance scenario expressed as given / when / then steps.\n fields:\n given?: Step | Step[]\n when?: Step | Step[]\n then: Step | Step[]\n tags?: TagList\n```\n\n```mdl\next component\n uri: org.dxos.mdl.component@1.0\n desc: A UI component with props, internal state, slots, actions, and events.\n fields:\n desc?: Prose\n props?: FieldMap\n state?: FieldMap\n slots?: FieldMap\n actions?: ActionMap\n emits?: EventMap\n layout?: CodeBlock\n```\n\n```mdl\next op\n uri: org.dxos.mdl.op@1.0\n desc: |\n A named operation with typed inputs, outputs, and declared errors.\n Pure ops have no effects or requires. Effectful ops declare both.\n fields:\n desc?: Prose\n input?: FieldMap\n output?: TypeExpr\n errors?: ErrorMap\n effects?: EffectList\n requires?: ServiceList\n note?: Prose\n```\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,iBAAiBC,kBAAkBC,YAAYC,cAAc;AACtE,SAASC,qBAAqBC,iBAAiB;AAC/C,SAASC,iBAAiB;AAC1B,SAASC,OAAOC,MAAMC,WAAWC,QAAQC,YAAY;AACrD,SAASC,WAAWC,eA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AAOkF,IAAI;AAGf,IAAA,0BAAenF;",
|
|
6
|
+
"names": ["ActivationEvent", "ActivationEvents", "Capability", "Plugin", "AppActivationEvents", "AppPlugin", "AiContext", "Agent", "Chat", "McpServer", "Memory", "Plan", "Blueprint", "Routine", "Sequence", "Feed", "ClientEvents", "DeckEvents", "MarkdownEvents", "Text", "HasSubject", "Message", "AgentHydrator", "AgentRuntime", "AiContextCapability", "AiService", "IntegrationProvider", "AppGraphBuilder", "AutomationTemplates", "AssistantState", "BlueprintDefinition", "CompanionChatProvisioner", "CreateObject", "EdgeModelResolver", "LocalModelResolver", "MarkdownExtension", "Migrations", "OperationHandler", "ReactSurface", "Settings", "Toolkit", "meta", "translations", "AssistantEvents", "StateReady", "AppActivationEvents", "createStateEvent", "meta", "profile", "key", "AssistantPlugin", "Plugin", "define", "pipe", "AppPlugin", "addAppGraphModule", "activate", "AppGraphBuilder", "addBlueprintDefinitionModule", "BlueprintDefinition", "addCreateObjectModule", "CreateObject", "addOperationHandlerModule", "OperationHandler", "addSchemaModule", "schema", "Chat", "CompanionTo", "Blueprint", "AiContext", "Binding", "Feed", "HasSubject", "Message", "Routine", "Agent", "McpServer", "Plan", "Sequence", "Memory", "Text", "addSettingsModule", "Settings", "addSurfaceModule", "ReactSurface", "firesBeforeActivation", "SetupArtifactDefinition", "addTranslationsModule", "translations", "addModule", "id", "activatesOn", "SetupSchema", "AutomationTemplates", "MarkdownEvents", "SetupExtensions", "MarkdownExtension", "SetupSettings", "firesAfterActivation", "AssistantState", "AssistantEvents", "SetupAiServiceProviders", "EdgeModelResolver", "LocalModelResolver", "options", "Capability", "getModuleTag", "AiService", "ActivationEvents", "SetupProcessManager", "AiContextCapability", "AgentRuntime", "Startup", "Toolkit", "ProcessManagerReady", "AgentHydrator", "ActivationEvent", "allOf", "AppGraphReady", "DeckEvents", "CompanionChatProvisioner", "ClientEvents", "SetupMigration", "Migrations", "SetupIntegrationProviders", "IntegrationProvider", "addPluginAssetModule", "asset", "pluginId", "path", "content", "pluginSpec", "mimeType", "make"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// src/meta.ts
|
|
2
|
+
import { Plugin } from "@dxos/app-framework";
|
|
3
|
+
import { DXN } from "@dxos/keys";
|
|
4
|
+
|
|
5
|
+
// dx.config.ts
|
|
6
|
+
import { Config2 } from "@dxos/app-framework/config";
|
|
7
|
+
import { trim } from "@dxos/util";
|
|
8
|
+
var dx_config_default = Config2.make({
|
|
9
|
+
plugin: {
|
|
10
|
+
key: "org.dxos.plugin.assistant",
|
|
11
|
+
name: "Assistant",
|
|
12
|
+
author: "DXOS",
|
|
13
|
+
description: trim`
|
|
14
|
+
AssistantPlugin brings a conversational AI assistant into DXOS Composer, letting users chat naturally
|
|
15
|
+
with objects in their spaces. Every Chat is a first-class ECHO object — messages are persisted,
|
|
16
|
+
replicated across peers in real time, and can be bound to any document or collection as a companion
|
|
17
|
+
panel that appears alongside the primary view.
|
|
18
|
+
|
|
19
|
+
AI capabilities are delivered through a flexible multi-provider model layer. Users can route requests
|
|
20
|
+
to the DXOS Edge service, a locally running Ollama instance, or LM Studio, and switch providers at
|
|
21
|
+
any time in Settings. Each provider can be configured with a preferred model, and the runtime
|
|
22
|
+
automatically falls back when a provider is unavailable.
|
|
23
|
+
|
|
24
|
+
Blueprints give every chat a specialised identity. Built-in blueprints cover general assistance,
|
|
25
|
+
web browsing, database interaction, web search, Discord and Linear integration, autonomous agents,
|
|
26
|
+
planning, memory, automation, and a wizard for authoring new blueprints. Binding a blueprint
|
|
27
|
+
changes the system instructions and the tool set exposed to the model in a single step.
|
|
28
|
+
|
|
29
|
+
Tool execution runs through the DXOS compute runtime so every AI action — opening a document,
|
|
30
|
+
searching the web, querying a database — produces a structured execution trace. The optional
|
|
31
|
+
TracePanel visualises that trace as a commit graph or raw JSON, giving developers full observability
|
|
32
|
+
into what the model did and why.
|
|
33
|
+
`,
|
|
34
|
+
icon: {
|
|
35
|
+
key: "ph--sparkle--regular",
|
|
36
|
+
hue: "sky"
|
|
37
|
+
},
|
|
38
|
+
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-assistant",
|
|
39
|
+
spec: "PLUGIN.mdl"
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// src/meta.ts
|
|
44
|
+
var meta = Plugin.getMetaFromConfig(dx_config_default);
|
|
45
|
+
var ASSISTANT_DIALOG = DXN.make(`${meta.profile.key}.assistantDialog`);
|
|
46
|
+
var ASSISTANT_COMPANION_VARIANT = "assistant-chat";
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
meta,
|
|
50
|
+
ASSISTANT_DIALOG,
|
|
51
|
+
ASSISTANT_COMPANION_VARIANT
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=chunk-ZNDQVYUN.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts", "../../../dx.config.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { DXN } from '@dxos/keys';\n\nimport config from '../dx.config';\n\nexport const meta = Plugin.getMetaFromConfig(config);\n\nexport const ASSISTANT_DIALOG = DXN.make(`${meta.profile.key}.assistantDialog`);\n\n/** Companion variant identifier for the assistant chat panel. */\nexport const ASSISTANT_COMPANION_VARIANT = 'assistant-chat';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Config2 } from '@dxos/app-framework/config';\nimport { trim } from '@dxos/util';\n\nexport default Config2.make({\n plugin: {\n key: 'org.dxos.plugin.assistant',\n name: 'Assistant',\n author: 'DXOS',\n description: trim`\n AssistantPlugin brings a conversational AI assistant into DXOS Composer, letting users chat naturally\n with objects in their spaces. Every Chat is a first-class ECHO object — messages are persisted,\n replicated across peers in real time, and can be bound to any document or collection as a companion\n panel that appears alongside the primary view.\n\n AI capabilities are delivered through a flexible multi-provider model layer. Users can route requests\n to the DXOS Edge service, a locally running Ollama instance, or LM Studio, and switch providers at\n any time in Settings. Each provider can be configured with a preferred model, and the runtime\n automatically falls back when a provider is unavailable.\n\n Blueprints give every chat a specialised identity. Built-in blueprints cover general assistance,\n web browsing, database interaction, web search, Discord and Linear integration, autonomous agents,\n planning, memory, automation, and a wizard for authoring new blueprints. Binding a blueprint\n changes the system instructions and the tool set exposed to the model in a single step.\n\n Tool execution runs through the DXOS compute runtime so every AI action — opening a document,\n searching the web, querying a database — produces a structured execution trace. The optional\n TracePanel visualises that trace as a commit graph or raw JSON, giving developers full observability\n into what the model did and why.\n `,\n icon: { key: 'ph--sparkle--regular', hue: 'sky' },\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-assistant',\n spec: 'PLUGIN.mdl',\n },\n});\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,cAAc;AACvB,SAASC,WAAW;;;ACDpB,SAASC,eAAe;AACxB,SAASC,YAAY;AAErB,IAAA,oBAAeD,QAAQE,KAAK;EAC1BC,QAAQ;IACNC,KAAK;IACLC,MAAM;IACNC,QAAQ;IACRC,aAAaN;;;;;;;;;;;;;;;;;;;;;IAqBbO,MAAM;MAAEJ,KAAK;MAAwBK,KAAK;IAAM;IAChDC,QAAQ;IACRC,MAAM;EACR;AACF,CAAA;;;AD5BO,IAAMC,OAAOC,OAAOC,kBAAkBC,iBAAAA;AAEtC,IAAMC,mBAAmBC,IAAIC,KAAK,GAAGN,KAAKO,QAAQC,GAAG,kBAAkB;AAGvE,IAAMC,8BAA8B;",
|
|
6
|
+
"names": ["Plugin", "DXN", "Config2", "trim", "make", "plugin", "key", "name", "author", "description", "icon", "hue", "source", "spec", "meta", "Plugin", "getMetaFromConfig", "config", "ASSISTANT_DIALOG", "DXN", "make", "profile", "key", "ASSISTANT_COMPANION_VARIANT"]
|
|
7
|
+
}
|