@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
package/src/meta.ts
CHANGED
|
@@ -4,40 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import { Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { DXN } from '@dxos/keys';
|
|
7
|
-
import { trim } from '@dxos/util';
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
key: DXN.make('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.
|
|
8
|
+
import config from '../dx.config';
|
|
18
9
|
|
|
19
|
-
|
|
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.
|
|
10
|
+
export const meta = Plugin.getMetaFromConfig(config);
|
|
23
11
|
|
|
24
|
-
|
|
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: 'ph--sparkle--regular',
|
|
35
|
-
iconHue: 'sky',
|
|
36
|
-
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-assistant',
|
|
37
|
-
spec: 'PLUGIN.mdl',
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
export const ASSISTANT_DIALOG = DXN.make(`${meta.id}.assistantDialog`);
|
|
12
|
+
export const ASSISTANT_DIALOG = DXN.make(`${meta.profile.key}.assistantDialog`);
|
|
41
13
|
|
|
42
14
|
/** Companion variant identifier for the assistant chat panel. */
|
|
43
15
|
export const ASSISTANT_COMPANION_VARIANT = 'assistant-chat';
|
|
@@ -33,7 +33,7 @@ const handler: Operation.WithHandler<typeof AssistantOperation.CreateChat> = Ass
|
|
|
33
33
|
// Dynamic import to avoid circular dependency with the barrel that also exports BlueprintManagerHandlers.
|
|
34
34
|
const { BlueprintManagerBlueprint } = yield* Effect.promise(() => import('@dxos/assistant-toolkit'));
|
|
35
35
|
|
|
36
|
-
const feedServiceLayer = createFeedServiceLayer(space.
|
|
36
|
+
const feedServiceLayer = createFeedServiceLayer(space.db);
|
|
37
37
|
const runtime = yield* Effect.runtime<Feed.FeedService>().pipe(Effect.provide(feedServiceLayer));
|
|
38
38
|
const binder = new AiContext.Binder({ feed, runtime, registry });
|
|
39
39
|
|
|
@@ -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 { Paths, 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';
|
|
@@ -29,7 +29,7 @@ const handler: Operation.WithHandler<typeof AssistantOperation.ForkChat> = Assis
|
|
|
29
29
|
const space = client.spaces.get(db.spaceId);
|
|
30
30
|
invariant(space, 'Space not found.');
|
|
31
31
|
|
|
32
|
-
const feedServiceLayer = createFeedServiceLayer(space.
|
|
32
|
+
const feedServiceLayer = createFeedServiceLayer(space.db);
|
|
33
33
|
|
|
34
34
|
const messages = yield* Feed.runQuery(sourceFeed, Filter.type(Message.Message)).pipe(
|
|
35
35
|
Effect.provide(feedServiceLayer),
|
|
@@ -100,7 +100,7 @@ const handler: Operation.WithHandler<typeof AssistantOperation.ForkChat> = Assis
|
|
|
100
100
|
);
|
|
101
101
|
} else {
|
|
102
102
|
// Navigate to the forked chat as a standalone plank.
|
|
103
|
-
const chatPath = getObjectPathFromObject(newChat);
|
|
103
|
+
const chatPath = Paths.getObjectPathFromObject(newChat);
|
|
104
104
|
yield* Operation.invoke(LayoutOperation.Open, { subject: [chatPath] });
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -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 { LayoutOperation } from '@dxos/app-toolkit';
|
|
9
9
|
import { AiContext } from '@dxos/assistant';
|
|
10
10
|
import { AgentPrompt } from '@dxos/assistant-toolkit';
|
|
11
11
|
import { Blueprint, Operation, Routine, Template } from '@dxos/compute';
|
|
@@ -18,6 +18,8 @@ import { Text } from '@dxos/schema';
|
|
|
18
18
|
|
|
19
19
|
import { AssistantCapabilities, AssistantOperation } from '#types';
|
|
20
20
|
|
|
21
|
+
import { getChatPath } from '../paths';
|
|
22
|
+
|
|
21
23
|
const handler: Operation.WithHandler<typeof AssistantOperation.RunPromptInNewChat> =
|
|
22
24
|
AssistantOperation.RunPromptInNewChat.pipe(
|
|
23
25
|
Operation.withHandler(
|
|
@@ -32,7 +34,7 @@ const handler: Operation.WithHandler<typeof AssistantOperation.RunPromptInNewCha
|
|
|
32
34
|
const client = yield* Capability.get(ClientCapabilities.Client);
|
|
33
35
|
const space = client.spaces.get(db.spaceId);
|
|
34
36
|
invariant(space, 'Space not found.');
|
|
35
|
-
const feedServiceLayer = createFeedServiceLayer(space.
|
|
37
|
+
const feedServiceLayer = createFeedServiceLayer(space.db);
|
|
36
38
|
const runtime = yield* Effect.runtime<Feed.FeedService>().pipe(Effect.provide(feedServiceLayer));
|
|
37
39
|
const binder = new AiContext.Binder({ feed: feedTarget, runtime, registry });
|
|
38
40
|
yield* Effect.promise(() =>
|
|
@@ -88,7 +90,7 @@ const handler: Operation.WithHandler<typeof AssistantOperation.RunPromptInNewCha
|
|
|
88
90
|
return { object: chat };
|
|
89
91
|
}
|
|
90
92
|
|
|
91
|
-
const chatPath =
|
|
93
|
+
const chatPath = getChatPath(db.spaceId, chat.id);
|
|
92
94
|
const pendingPromptText =
|
|
93
95
|
typeof prompt === 'string'
|
|
94
96
|
? prompt
|
package/src/paths.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Paths } from '@dxos/app-toolkit';
|
|
6
6
|
import { Chat } from '@dxos/assistant-toolkit';
|
|
7
7
|
|
|
8
|
-
const { getSectionPath: getChatsPath, getObjectPath: getChatPath } = createTypeSectionPaths(Chat.Chat);
|
|
8
|
+
const { getSectionPath: getChatsPath, getObjectPath: getChatPath } = Paths.createTypeSectionPaths(Chat.Chat);
|
|
9
9
|
|
|
10
10
|
export { getChatsPath, getChatPath };
|
|
@@ -2,20 +2,24 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import * as AiError from '@effect/ai/AiError';
|
|
5
6
|
import { describe, it } from '@effect/vitest';
|
|
6
7
|
import * as Effect from 'effect/Effect';
|
|
7
8
|
import * as Layer from 'effect/Layer';
|
|
8
9
|
import * as ManagedRuntime from 'effect/ManagedRuntime';
|
|
10
|
+
import * as Option from 'effect/Option';
|
|
11
|
+
import { test } from 'vitest';
|
|
9
12
|
|
|
10
13
|
import { Capabilities } from '@dxos/app-framework';
|
|
11
14
|
import { AiSession } from '@dxos/assistant';
|
|
12
15
|
import { Chat } from '@dxos/assistant-toolkit';
|
|
13
16
|
import { Database, Feed } from '@dxos/echo';
|
|
17
|
+
import { UsageQuotaExceededError } from '@dxos/edge-client';
|
|
14
18
|
import { EffectEx } from '@dxos/effect';
|
|
15
19
|
import { TestHelpers } from '@dxos/effect/testing';
|
|
16
20
|
import { AssistantTestLayer } from '@dxos/functions-runtime/testing';
|
|
17
21
|
|
|
18
|
-
import { AiChatProcessor } from './processor';
|
|
22
|
+
import { AiChatProcessor, AiUsageQuotaError, parseError } from './processor';
|
|
19
23
|
|
|
20
24
|
const TestLayer = AssistantTestLayer({ tracing: 'noop', types: [Chat.Chat, Feed.Feed] });
|
|
21
25
|
|
|
@@ -38,3 +42,69 @@ describe('Chat processor', () => {
|
|
|
38
42
|
),
|
|
39
43
|
);
|
|
40
44
|
});
|
|
45
|
+
|
|
46
|
+
describe('parseError', () => {
|
|
47
|
+
const QUOTA_MESSAGE = 'You have reached your AI usage limit for this period.';
|
|
48
|
+
|
|
49
|
+
// The agent runs in a separate process; on failure the cause is rendered to a string via
|
|
50
|
+
// `Cause.pretty` (which drops nested causes) before it reaches parseError. EDGE rejects an
|
|
51
|
+
// over-quota request with 429, which `@effect/ai` surfaces as an HttpResponseError whose message
|
|
52
|
+
// embeds the status — this is the exact string the chat receives.
|
|
53
|
+
test('detects an EDGE 429 in the pretty-printed process failure (string)', ({ expect }) => {
|
|
54
|
+
const err =
|
|
55
|
+
'HttpResponseError: StatusCode: An HTTP response error occurred. (429 POST http://edge.internal/v1/messages)\nResponse Body: {"error":{"message":"You have exceeded your usage quota."}}';
|
|
56
|
+
const result = parseError(err);
|
|
57
|
+
expect(result.message).toBe(QUOTA_MESSAGE);
|
|
58
|
+
// Tagged so the chat toast can offer a usage-dashboard link for this case only.
|
|
59
|
+
expect(result).toBeInstanceOf(AiUsageQuotaError);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('detects a typed 429 HttpResponseError by status (direct path)', ({ expect }) => {
|
|
63
|
+
const err = new AiError.HttpResponseError({
|
|
64
|
+
module: 'AnthropicClient',
|
|
65
|
+
method: 'streamText',
|
|
66
|
+
reason: 'StatusCode',
|
|
67
|
+
request: {
|
|
68
|
+
method: 'POST',
|
|
69
|
+
url: 'http://edge.internal/v1/messages',
|
|
70
|
+
urlParams: [],
|
|
71
|
+
hash: Option.none(),
|
|
72
|
+
headers: {},
|
|
73
|
+
},
|
|
74
|
+
response: { status: 429, headers: {} },
|
|
75
|
+
body: JSON.stringify({ error: { message: 'You have exceeded your usage quota.' } }),
|
|
76
|
+
});
|
|
77
|
+
expect(parseError(err).message).toBe(QUOTA_MESSAGE);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test('surfaces a live UsageQuotaExceededError message from the cause chain (direct path)', ({ expect }) => {
|
|
81
|
+
const err = new Error('request failed', {
|
|
82
|
+
cause: new UsageQuotaExceededError({ message: 'You have exceeded your usage quota.' }),
|
|
83
|
+
});
|
|
84
|
+
expect(parseError(err).message).toBe('You have exceeded your usage quota.');
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('preserves the original error as the cause', ({ expect }) => {
|
|
88
|
+
const err = 'HttpResponseError: StatusCode: ... (429 POST http://edge.internal/v1/messages)';
|
|
89
|
+
expect(parseError(err).cause).toBe(err);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
test('still surfaces the unavailable model from a string', ({ expect }) => {
|
|
93
|
+
const err = "UnknownError: ChatCompletionsClient.streamText: model 'gemma3:27b' not found";
|
|
94
|
+
expect(parseError(err).message).toBe('The model is not available: gemma3:27b');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test('passes through a non-quota AiError description', ({ expect }) => {
|
|
98
|
+
const err = new AiError.UnknownError({
|
|
99
|
+
module: 'ChatCompletionsClient',
|
|
100
|
+
method: 'streamText',
|
|
101
|
+
description: 'Connection refused',
|
|
102
|
+
});
|
|
103
|
+
expect(parseError(err).message).toBe('Connection refused');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test('falls back to a generic message for unrecognized errors', ({ expect }) => {
|
|
107
|
+
expect(parseError('something unexpected blew up').message).toBe('An unexpected error occurred.');
|
|
108
|
+
expect(parseError(new Error('boom')).message).toBe('An unexpected error occurred.');
|
|
109
|
+
});
|
|
110
|
+
});
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
import { type Chat } from '@dxos/assistant-toolkit';
|
|
27
27
|
import { type Credential, Operation, type ServiceNotAvailableError, Trace } from '@dxos/compute';
|
|
28
28
|
import { type Database, Feed, Obj, Ref, type Registry } from '@dxos/echo';
|
|
29
|
+
import { UsageQuotaExceededError } from '@dxos/edge-client';
|
|
29
30
|
import { EffectEx } from '@dxos/effect';
|
|
30
31
|
import { AgentService } from '@dxos/functions-runtime';
|
|
31
32
|
import { log } from '@dxos/log';
|
|
@@ -33,6 +34,8 @@ import { Message } from '@dxos/types';
|
|
|
33
34
|
|
|
34
35
|
import { AssistantOperation } from '#types';
|
|
35
36
|
|
|
37
|
+
import { findInCause } from '../util/error-cause';
|
|
38
|
+
|
|
36
39
|
/**
|
|
37
40
|
* @deprecated Services type for the old direct-conversation processor path.
|
|
38
41
|
* Retained for backward compatibility with CLI and update-name.
|
|
@@ -80,14 +83,57 @@ export type ProcessorRequest = {
|
|
|
80
83
|
options?: ProcessorRequestOptions;
|
|
81
84
|
};
|
|
82
85
|
|
|
86
|
+
/** User-facing message shown when an AI request is rejected for exceeding the account usage quota (HTTP 429). */
|
|
87
|
+
const QUOTA_EXCEEDED_MESSAGE = 'You have reached your AI usage limit for this period.';
|
|
88
|
+
|
|
89
|
+
/** An actionable next-step a chat error surfaces in its toast; the label key is resolved by the chat UI. */
|
|
90
|
+
export type ChatErrorAction = { readonly labelKey: string };
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Display error for an over-quota (HTTP 429) rejection. Declares an {@link action} so the chat toast can
|
|
94
|
+
* offer a usage-dashboard link declaratively — the UI renders whatever action an error declares rather
|
|
95
|
+
* than branching on the error type.
|
|
96
|
+
*/
|
|
97
|
+
export class AiUsageQuotaError extends Error {
|
|
98
|
+
readonly action: ChatErrorAction = { labelKey: 'view-usage.label' };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Matches an over-quota rejection (EDGE responds 429) in error text. The typed
|
|
103
|
+
* {@link UsageQuotaExceededError} is wrapped deep in the cause chain and does not survive the
|
|
104
|
+
* agent-process boundary — the failure is rendered to a string via `Cause.pretty`, which drops
|
|
105
|
+
* nested causes — so detection also relies on the HTTP 429 that `@effect/ai`'s
|
|
106
|
+
* {@link AiError.HttpResponseError} embeds in its message (e.g. "... (429 POST ...)").
|
|
107
|
+
*/
|
|
108
|
+
const QUOTA_PATTERN = /\b429\b|rate.?limit|too many requests|usage quota|quota exceeded/i;
|
|
109
|
+
|
|
110
|
+
/** Whether an error denotes an over-quota (HTTP 429) rejection, detected by typed status or message text. */
|
|
111
|
+
const isQuotaError = (err: unknown): boolean => {
|
|
112
|
+
if (AiError.isAiError(err)) {
|
|
113
|
+
if (err._tag === 'HttpResponseError' && err.response.status === 429) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
return QUOTA_PATTERN.test(err.description ?? err.message);
|
|
117
|
+
}
|
|
118
|
+
return typeof err === 'string' && QUOTA_PATTERN.test(err);
|
|
119
|
+
};
|
|
120
|
+
|
|
83
121
|
/**
|
|
84
122
|
* Maps a failure from the agent fiber to an error suitable for display.
|
|
85
|
-
*
|
|
123
|
+
* An over-quota (HTTP 429) rejection is surfaced as an actionable usage-limit message; the typed
|
|
124
|
+
* {@link UsageQuotaExceededError} only survives on the direct path, so {@link isQuotaError} also
|
|
125
|
+
* recognizes the stringified 429 the chat receives across the agent-process boundary.
|
|
126
|
+
* Other {@link AiError}s originate from the AI service and are actionable by the user
|
|
86
127
|
* (e.g., "model 'x' not found", "Connection refused"), so their detail is propagated.
|
|
87
128
|
* Any other failure is treated as an internal/unexpected error and reported generically
|
|
88
129
|
* to avoid leaking implementation detail.
|
|
89
130
|
*/
|
|
90
|
-
const parseError = (err: unknown): Error => {
|
|
131
|
+
export const parseError = (err: unknown): Error => {
|
|
132
|
+
const quotaError = findInCause(err, UsageQuotaExceededError.is);
|
|
133
|
+
if (quotaError || isQuotaError(err)) {
|
|
134
|
+
return new AiUsageQuotaError(quotaError?.message?.trim() || QUOTA_EXCEEDED_MESSAGE, { cause: err });
|
|
135
|
+
}
|
|
136
|
+
|
|
91
137
|
let message: string | undefined;
|
|
92
138
|
if (AiError.isAiError(err)) {
|
|
93
139
|
message = err.description?.trim() || err.message;
|
|
@@ -263,6 +309,7 @@ export class AiChatProcessor {
|
|
|
263
309
|
const exit = await this._runtime.runPromise(Fiber.await(this.#requestFiber));
|
|
264
310
|
if (Exit.isFailure(exit)) {
|
|
265
311
|
if (Cause.isInterruptedOnly(exit.cause)) {
|
|
312
|
+
this.#discardStreaming();
|
|
266
313
|
return;
|
|
267
314
|
}
|
|
268
315
|
|
|
@@ -300,6 +347,7 @@ export class AiChatProcessor {
|
|
|
300
347
|
);
|
|
301
348
|
|
|
302
349
|
this.#requestFiber = undefined;
|
|
350
|
+
this.#discardStreaming();
|
|
303
351
|
this.#registry.set(this.active, false);
|
|
304
352
|
}
|
|
305
353
|
|
|
@@ -390,6 +438,14 @@ export class AiChatProcessor {
|
|
|
390
438
|
});
|
|
391
439
|
}
|
|
392
440
|
|
|
441
|
+
/**
|
|
442
|
+
* Drop in-flight streaming messages (cancel/interrupt — partial blocks are discarded).
|
|
443
|
+
*/
|
|
444
|
+
#discardStreaming() {
|
|
445
|
+
this.#registry.set(this.#streaming, []);
|
|
446
|
+
this.#finalizedIds.clear();
|
|
447
|
+
}
|
|
448
|
+
|
|
393
449
|
/**
|
|
394
450
|
* Move remaining streaming messages to pending (called when agent completes).
|
|
395
451
|
*/
|