@dxos/plugin-assistant 0.8.4-main.abd8ff62ef → 0.8.4-main.bc2380dfbc
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/neutral/AgentArticle-5XDDEXMP.mjs +169 -0
- package/dist/lib/neutral/AgentArticle-5XDDEXMP.mjs.map +7 -0
- package/dist/lib/neutral/AgentProperties-CNH4JMDZ.mjs +100 -0
- package/dist/lib/neutral/AgentProperties-CNH4JMDZ.mjs.map +7 -0
- package/dist/lib/neutral/AssistantPlugin.mjs +10 -0
- package/dist/lib/neutral/AssistantPlugin.node.mjs +46 -0
- package/dist/lib/neutral/AssistantPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/AssistantPlugin.workerd.mjs +40 -0
- package/dist/lib/neutral/AssistantPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/BlueprintArticle-U7LUBFOS.mjs +27 -0
- package/dist/lib/neutral/BlueprintArticle-U7LUBFOS.mjs.map +7 -0
- package/dist/lib/neutral/ChatArticle-WVAFZPVI.mjs +8 -0
- package/dist/lib/neutral/ChatCompanion-DFRMRUK3.mjs +133 -0
- package/dist/lib/neutral/ChatCompanion-DFRMRUK3.mjs.map +7 -0
- package/dist/lib/neutral/ChatDialog-QKZLG7SQ.mjs +72 -0
- package/dist/lib/neutral/ChatDialog-QKZLG7SQ.mjs.map +7 -0
- package/dist/lib/neutral/PlanArticle-TS5ULWYS.mjs +28 -0
- package/dist/lib/neutral/PlanArticle-TS5ULWYS.mjs.map +7 -0
- package/dist/lib/neutral/RoutineArticle-H7ECM7AH.mjs +116 -0
- package/dist/lib/neutral/RoutineArticle-H7ECM7AH.mjs.map +7 -0
- package/dist/lib/neutral/RoutineList-CLDXGQUD.mjs +48 -0
- package/dist/lib/neutral/RoutineList-CLDXGQUD.mjs.map +7 -0
- package/dist/lib/neutral/TracePanel-C77SPEIS.mjs +672 -0
- package/dist/lib/neutral/TracePanel-C77SPEIS.mjs.map +7 -0
- package/dist/lib/neutral/TriggerStatus-WTFYUIG5.mjs +92 -0
- package/dist/lib/neutral/TriggerStatus-WTFYUIG5.mjs.map +7 -0
- package/dist/lib/neutral/ai-service-GJXMI5OI.mjs +22 -0
- package/dist/lib/neutral/ai-service-GJXMI5OI.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-5QBICPYP.mjs +200 -0
- package/dist/lib/neutral/app-graph-builder-5QBICPYP.mjs.map +7 -0
- package/dist/lib/neutral/blueprint-definition-VXJYQ5AE.mjs +32 -0
- package/dist/lib/neutral/blueprint-definition-VXJYQ5AE.mjs.map +7 -0
- package/dist/lib/neutral/blueprints/index.mjs +8 -0
- package/dist/lib/neutral/capabilities/index.mjs +35 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-3FIV362Z.mjs +8 -0
- package/dist/lib/neutral/chunk-3FIV362Z.mjs.map +7 -0
- package/dist/lib/neutral/chunk-4CQZCMRP.mjs +25 -0
- package/dist/lib/neutral/chunk-4CQZCMRP.mjs.map +7 -0
- package/dist/lib/{browser/blueprints/index.mjs → neutral/chunk-5H6UJHLF.mjs} +4 -5
- package/dist/lib/neutral/chunk-5H6UJHLF.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ITJX2YZZ.mjs +98 -0
- package/dist/lib/neutral/chunk-ITJX2YZZ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-IZQWGJNG.mjs +380 -0
- package/dist/lib/neutral/chunk-IZQWGJNG.mjs.map +7 -0
- package/dist/lib/neutral/chunk-SLIPV6NN.mjs +106 -0
- package/dist/lib/neutral/chunk-SLIPV6NN.mjs.map +7 -0
- package/dist/lib/neutral/companion-chat-provisioner-2Y6PRSDK.mjs +116 -0
- package/dist/lib/neutral/companion-chat-provisioner-2Y6PRSDK.mjs.map +7 -0
- package/dist/lib/{browser/chunk-VK53MITK.mjs → neutral/components/index.mjs} +139 -141
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +29 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/{browser/create-chat-E2ZLVTLP.mjs → neutral/create-chat-QQZURUBW.mjs} +10 -12
- package/dist/lib/neutral/create-chat-QQZURUBW.mjs.map +7 -0
- package/dist/lib/neutral/create-object-UZCJCPWM.mjs +93 -0
- package/dist/lib/neutral/create-object-UZCJCPWM.mjs.map +7 -0
- package/dist/lib/neutral/edge-model-resolver-XDNBZ3US.mjs +21 -0
- package/dist/lib/neutral/edge-model-resolver-XDNBZ3US.mjs.map +7 -0
- package/dist/lib/{browser/ensure-companion-chat-7GDMXSQW.mjs → neutral/ensure-companion-chat-5S4LZM2H.mjs} +9 -16
- package/dist/lib/neutral/ensure-companion-chat-5S4LZM2H.mjs.map +7 -0
- package/dist/lib/{browser/chunk-M55MBYG7.mjs → neutral/hooks/index.mjs} +106 -111
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +32 -0
- package/dist/lib/neutral/local-model-resolver-I2BENFFS.mjs +24 -0
- package/dist/lib/neutral/local-model-resolver-I2BENFFS.mjs.map +7 -0
- package/dist/lib/neutral/markdown-KTBFOMFM.mjs +110 -0
- package/dist/lib/neutral/markdown-KTBFOMFM.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +12 -0
- package/dist/lib/neutral/migrations-7DEMVBOG.mjs +28 -0
- package/dist/lib/neutral/migrations-7DEMVBOG.mjs.map +7 -0
- package/dist/lib/{browser/on-create-space-4J3KTNAJ.mjs → neutral/on-create-space-Q2R7OSP6.mjs} +4 -7
- package/dist/lib/neutral/on-create-space-Q2R7OSP6.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-SF36MOB5.mjs +13 -0
- package/dist/lib/neutral/operation-handler-SF36MOB5.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-T4R65UJU.mjs +174 -0
- package/dist/lib/neutral/react-surface-T4R65UJU.mjs.map +7 -0
- package/dist/lib/{browser/resolve-navigation-targets-3ZPQE6SZ.mjs → neutral/resolve-navigation-targets-VXBSWV5L.mjs} +3 -5
- package/dist/lib/neutral/resolve-navigation-targets-VXBSWV5L.mjs.map +7 -0
- package/dist/lib/{browser/run-prompt-in-new-chat-AA3KPBDN.mjs → neutral/run-prompt-in-new-chat-VJXXZ6SI.mjs} +16 -19
- package/dist/lib/neutral/run-prompt-in-new-chat-VJXXZ6SI.mjs.map +7 -0
- package/dist/lib/{browser/set-current-chat-P4VHI3YF.mjs → neutral/set-current-chat-ZFDCYK5I.mjs} +4 -10
- package/dist/lib/neutral/set-current-chat-ZFDCYK5I.mjs.map +7 -0
- package/dist/lib/neutral/settings-W4BLWQ53.mjs +28 -0
- package/dist/lib/neutral/settings-W4BLWQ53.mjs.map +7 -0
- package/dist/lib/neutral/state-H3G7QCU6.mjs +28 -0
- package/dist/lib/neutral/state-H3G7QCU6.mjs.map +7 -0
- package/dist/lib/neutral/testing.mjs +8 -0
- package/dist/lib/neutral/toggle-trace-panel-debug-JGTB6KVJ.mjs +21 -0
- package/dist/lib/neutral/toggle-trace-panel-debug-JGTB6KVJ.mjs.map +7 -0
- package/dist/lib/neutral/toolkit-GVWXPDLJ.mjs +14 -0
- package/dist/lib/neutral/toolkit-GVWXPDLJ.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/translations.mjs +5 -2
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +20 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/lib/{browser/update-chat-name-VWKNUON7.mjs → neutral/update-chat-name-ENXRUMDJ.mjs} +3 -5
- package/dist/lib/neutral/update-chat-name-ENXRUMDJ.mjs.map +7 -0
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/AssistantPlugin.node.d.ts.map +1 -1
- package/dist/types/src/AssistantPlugin.workerd.d.ts +4 -0
- package/dist/types/src/AssistantPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts.map +1 -1
- package/dist/types/src/capabilities/create-object.d.ts +31 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +27 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts +1 -1
- package/dist/types/src/capabilities/migrations.d.ts +2 -1
- package/dist/types/src/capabilities/migrations.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +11 -5
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +2 -2
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +2 -2
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +2 -3
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/StatusWidget.d.ts +2 -15
- package/dist/types/src/components/ChatThread/widgets/StatusWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/SummaryWidget.d.ts.map +1 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts.map +1 -1
- package/dist/types/src/components/TaskList/TaskList.d.ts +10 -0
- package/dist/types/src/components/TaskList/TaskList.d.ts.map +1 -0
- package/dist/types/src/components/TaskList/TaskList.stories.d.ts +16 -0
- package/dist/types/src/components/TaskList/TaskList.stories.d.ts.map +1 -0
- package/dist/types/src/components/TaskList/index.d.ts +2 -0
- package/dist/types/src/components/TaskList/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +1 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/AgentArticle/AgentArticle.d.ts.map +1 -1
- package/dist/types/src/containers/{ChatContainer/ChatContainer.d.ts → ChatArticle/ChatArticle.d.ts} +3 -3
- package/dist/types/src/containers/ChatArticle/ChatArticle.d.ts.map +1 -0
- package/dist/types/src/containers/ChatArticle/index.d.ts +2 -0
- package/dist/types/src/containers/ChatArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts.map +1 -1
- package/dist/types/src/containers/PlanArticle/PlanArticle.d.ts +6 -0
- package/dist/types/src/containers/PlanArticle/PlanArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PlanArticle/index.d.ts +2 -0
- package/dist/types/src/containers/PlanArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts.map +1 -1
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.stories.d.ts +15 -0
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/execution-graph.d.ts +11 -2
- package/dist/types/src/containers/TracePanel/execution-graph.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/span-tree.d.ts +73 -0
- package/dist/types/src/containers/TracePanel/span-tree.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/span-tree.test.d.ts +2 -0
- package/dist/types/src/containers/TracePanel/span-tree.test.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +4 -3
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/feed-logger.d.ts +13 -0
- package/dist/types/src/feed-logger.d.ts.map +1 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +3 -3
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextBinder.d.ts +2 -2
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextObjects.d.ts +2 -2
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/create-chat.d.ts +2 -2
- package/dist/types/src/operations/create-chat.d.ts.map +1 -1
- package/dist/types/src/operations/ensure-companion-chat.d.ts +2 -2
- package/dist/types/src/operations/ensure-companion-chat.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +0 -1
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/on-create-space.d.ts +2 -2
- package/dist/types/src/operations/on-create-space.d.ts.map +1 -1
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts +2 -2
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts.map +1 -1
- package/dist/types/src/operations/set-current-chat.d.ts +2 -2
- package/dist/types/src/operations/set-current-chat.d.ts.map +1 -1
- package/dist/types/src/operations/toggle-trace-panel-debug.d.ts +5 -0
- package/dist/types/src/operations/toggle-trace-panel-debug.d.ts.map +1 -0
- package/dist/types/src/operations/update-chat-name.d.ts +2 -2
- package/dist/types/src/operations/update-chat-name.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +11 -11
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +2 -3
- package/dist/types/src/testing/test-generator.d.ts.map +1 -1
- package/dist/types/src/testing/test-sequence.d.ts +3 -3
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts +2 -0
- package/dist/types/src/testing.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +1 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantCapabilities.d.ts +30 -0
- package/dist/types/src/types/AssistantCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/AssistantEvents.d.ts +3 -0
- package/dist/types/src/types/AssistantEvents.d.ts.map +1 -0
- package/dist/types/src/{operations/definitions.d.ts → types/AssistantOperation.d.ts} +10 -6
- package/dist/types/src/types/AssistantOperation.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +1 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +3 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util/suggestions.d.ts +9 -0
- package/dist/types/src/util/suggestions.d.ts.map +1 -0
- package/dist/types/src/util/suggestions.test.d.ts +2 -0
- package/dist/types/src/util/suggestions.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +152 -128
- package/src/AssistantPlugin.node.ts +7 -88
- package/src/AssistantPlugin.test.ts +3 -3
- package/src/AssistantPlugin.ts +126 -0
- package/src/AssistantPlugin.workerd.ts +41 -0
- package/src/blueprints/assistant/blueprint.ts +1 -1
- package/src/capabilities/app-graph-builder.ts +48 -9
- package/src/capabilities/companion-chat-provisioner.ts +4 -5
- package/src/capabilities/create-object.ts +107 -0
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/markdown.ts +2 -2
- package/src/capabilities/migrations.ts +3 -3
- package/src/capabilities/react-surface.tsx +15 -7
- package/src/components/Chat/Chat.tsx +35 -5
- package/src/components/ChatPrompt/ChatMcpErrors.tsx +1 -1
- package/src/components/ChatPrompt/ChatOptions.stories.tsx +4 -4
- package/src/components/ChatPrompt/ChatOptions.tsx +12 -11
- package/src/components/ChatPrompt/ChatPrompt.tsx +3 -3
- package/src/components/ChatPrompt/ChatReferences.tsx +3 -3
- package/src/components/ChatPrompt/ChatStatus.tsx +1 -1
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +1 -1
- package/src/components/ChatThread/Anchor.stories.tsx +3 -3
- package/src/components/ChatThread/ChatThread.stories.tsx +25 -29
- package/src/components/ChatThread/ChatThread.tsx +1 -1
- package/src/components/ChatThread/registry.tsx +8 -4
- package/src/components/ChatThread/sync.test.ts +4 -6
- package/src/components/ChatThread/widgets/ReasoningWidget.ts +2 -2
- package/src/components/ChatThread/widgets/StatusWidget.ts +3 -83
- package/src/components/ChatThread/widgets/SummaryWidget.tsx +1 -3
- package/src/components/ProcessTree/ProcessTree.tsx +2 -1
- package/src/components/TaskList/TaskList.stories.tsx +44 -0
- package/src/components/TaskList/TaskList.tsx +45 -0
- package/src/{cli → components/TaskList}/index.ts +1 -1
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +1 -1
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +2 -6
- package/src/components/TemplateEditor/TemplateForm.tsx +48 -69
- package/src/components/Toolbox/Toolbox.stories.tsx +4 -4
- package/src/components/Toolbox/Toolbox.tsx +2 -2
- package/src/components/index.ts +1 -0
- package/src/containers/AgentArticle/AgentArticle.stories.tsx +7 -7
- package/src/containers/AgentArticle/AgentArticle.tsx +11 -7
- package/src/containers/AgentProperties/AgentProperties.stories.tsx +4 -4
- package/src/containers/AgentProperties/AgentProperties.tsx +4 -4
- package/src/containers/{ChatContainer/ChatContainer.tsx → ChatArticle/ChatArticle.tsx} +11 -9
- package/src/containers/ChatArticle/index.ts +5 -0
- package/src/containers/ChatCompanion/ChatCompanion.tsx +20 -29
- package/src/containers/PlanArticle/PlanArticle.tsx +33 -0
- package/src/containers/PlanArticle/index.ts +5 -0
- package/src/containers/RoutineArticle/RoutineArticle.stories.tsx +75 -0
- package/src/containers/RoutineArticle/RoutineArticle.tsx +74 -24
- package/src/containers/RoutineList/RoutineList.stories.tsx +3 -3
- package/src/containers/RoutineList/RoutineList.tsx +3 -3
- package/src/containers/TracePanel/TracePanel.stories.tsx +33 -26
- package/src/containers/TracePanel/TracePanel.tsx +72 -33
- package/src/containers/TracePanel/dxn-extractor.ts +7 -7
- package/src/containers/TracePanel/execution-graph.test.ts +218 -213
- package/src/containers/TracePanel/execution-graph.ts +316 -271
- package/src/containers/TracePanel/span-tree.test.ts +166 -0
- package/src/containers/TracePanel/span-tree.ts +214 -0
- package/src/containers/index.ts +4 -3
- package/src/{queue-logger.ts → feed-logger.ts} +37 -27
- package/src/hooks/useBlueprintRegistry.ts +12 -6
- package/src/hooks/useChatProcessor.ts +3 -3
- package/src/hooks/useChatServices.ts +1 -1
- package/src/hooks/useChatToolbarActions.ts +86 -88
- package/src/hooks/useContextBinder.ts +4 -4
- package/src/hooks/useContextObjects.ts +2 -2
- package/src/index.ts +2 -9
- package/src/operations/create-chat.ts +16 -11
- package/src/operations/ensure-companion-chat.ts +47 -45
- package/src/operations/index.ts +1 -2
- package/src/operations/on-create-space.ts +3 -3
- package/src/operations/prompt.test.ts +5 -5
- package/src/operations/resolve-navigation-targets.ts +2 -2
- package/src/operations/run-prompt-in-new-chat.ts +85 -84
- package/src/operations/set-current-chat.ts +3 -4
- package/src/operations/toggle-trace-panel-debug.ts +27 -0
- package/src/operations/update-chat-name.ts +2 -2
- package/src/plugin.ts +11 -0
- package/src/processor/processor.test.ts +1 -1
- package/src/processor/processor.ts +15 -15
- package/src/testing/test-generator.test.ts +41 -52
- package/src/testing/test-generator.ts +174 -189
- package/src/testing/test-sequence.ts +3 -3
- package/src/testing/trace-timeline.conversations.json +1 -1
- package/src/testing/trace-timeline.test.ts +3 -5
- package/src/testing.ts +7 -0
- package/src/translations.ts +5 -2
- package/src/types/Assistant.ts +2 -1
- package/src/types/AssistantCapabilities.ts +35 -0
- package/src/types/AssistantEvents.ts +11 -0
- package/src/{operations/definitions.ts → types/AssistantOperation.ts} +15 -0
- package/src/types/Settings.ts +6 -0
- package/src/types/index.ts +5 -2
- package/src/util/suggestions.test.ts +52 -0
- package/src/util/suggestions.ts +42 -0
- package/dist/lib/browser/blueprints/index.mjs.map +0 -7
- package/dist/lib/browser/chunk-DVOOFAWU.mjs +0 -175
- package/dist/lib/browser/chunk-DVOOFAWU.mjs.map +0 -7
- package/dist/lib/browser/chunk-M55MBYG7.mjs.map +0 -7
- package/dist/lib/browser/chunk-SEMCG4ZK.mjs +0 -195
- package/dist/lib/browser/chunk-SEMCG4ZK.mjs.map +0 -7
- package/dist/lib/browser/chunk-VK53MITK.mjs.map +0 -7
- package/dist/lib/browser/cli/index.mjs +0 -73
- package/dist/lib/browser/cli/index.mjs.map +0 -7
- package/dist/lib/browser/components/index.mjs +0 -20
- package/dist/lib/browser/create-chat-E2ZLVTLP.mjs.map +0 -7
- package/dist/lib/browser/ensure-companion-chat-7GDMXSQW.mjs.map +0 -7
- package/dist/lib/browser/hooks/index.mjs +0 -39
- package/dist/lib/browser/index.mjs +0 -84
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/on-create-space-4J3KTNAJ.mjs.map +0 -7
- package/dist/lib/browser/operations/index.mjs +0 -13
- package/dist/lib/browser/operations/index.mjs.map +0 -7
- package/dist/lib/browser/resolve-navigation-targets-3ZPQE6SZ.mjs.map +0 -7
- package/dist/lib/browser/run-prompt-in-new-chat-AA3KPBDN.mjs.map +0 -7
- package/dist/lib/browser/set-current-chat-P4VHI3YF.mjs.map +0 -7
- package/dist/lib/browser/translations.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -18
- package/dist/lib/browser/update-chat-name-VWKNUON7.mjs.map +0 -7
- package/dist/lib/node-esm/AssistantSettings-23A5IMHS.mjs +0 -41
- package/dist/lib/node-esm/AssistantSettings-23A5IMHS.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -32
- package/dist/lib/node-esm/blueprints/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FWC3ZGPH.mjs +0 -933
- package/dist/lib/node-esm/chunk-FWC3ZGPH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-JKEB3NFZ.mjs +0 -2302
- package/dist/lib/node-esm/chunk-JKEB3NFZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MBDVPB4V.mjs +0 -176
- package/dist/lib/node-esm/chunk-MBDVPB4V.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XAFVSEUJ.mjs +0 -196
- package/dist/lib/node-esm/chunk-XAFVSEUJ.mjs.map +0 -7
- package/dist/lib/node-esm/cli/index.mjs +0 -74
- package/dist/lib/node-esm/cli/index.mjs.map +0 -7
- package/dist/lib/node-esm/components/index.mjs +0 -21
- package/dist/lib/node-esm/create-chat-UQQ3542N.mjs +0 -74
- package/dist/lib/node-esm/create-chat-UQQ3542N.mjs.map +0 -7
- package/dist/lib/node-esm/ensure-companion-chat-LVCPD4DJ.mjs +0 -66
- package/dist/lib/node-esm/ensure-companion-chat-LVCPD4DJ.mjs.map +0 -7
- package/dist/lib/node-esm/hooks/index.mjs +0 -40
- package/dist/lib/node-esm/index.mjs +0 -85
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/on-create-space-M63UBTTT.mjs +0 -23
- package/dist/lib/node-esm/on-create-space-M63UBTTT.mjs.map +0 -7
- package/dist/lib/node-esm/operations/index.mjs +0 -14
- package/dist/lib/node-esm/operations/index.mjs.map +0 -7
- package/dist/lib/node-esm/resolve-navigation-targets-HO77CAFT.mjs +0 -23
- package/dist/lib/node-esm/resolve-navigation-targets-HO77CAFT.mjs.map +0 -7
- package/dist/lib/node-esm/run-prompt-in-new-chat-RIRYYYPK.mjs +0 -107
- package/dist/lib/node-esm/run-prompt-in-new-chat-RIRYYYPK.mjs.map +0 -7
- package/dist/lib/node-esm/set-current-chat-Z7GJ52VX.mjs +0 -55
- package/dist/lib/node-esm/set-current-chat-Z7GJ52VX.mjs.map +0 -7
- package/dist/lib/node-esm/translations.mjs +0 -173
- package/dist/lib/node-esm/translations.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -19
- package/dist/lib/node-esm/update-chat-name-GV4HX32Z.mjs +0 -57
- package/dist/lib/node-esm/update-chat-name-GV4HX32Z.mjs.map +0 -7
- package/dist/types/src/cli/index.d.ts +0 -2
- package/dist/types/src/cli/index.d.ts.map +0 -1
- package/dist/types/src/cli/plugin.d.ts +0 -10
- package/dist/types/src/cli/plugin.d.ts.map +0 -1
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/containers/ChatContainer/index.d.ts +0 -2
- package/dist/types/src/containers/ChatContainer/index.d.ts.map +0 -1
- package/dist/types/src/operations/definitions.d.ts.map +0 -1
- package/dist/types/src/queue-logger.d.ts +0 -11
- package/dist/types/src/queue-logger.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -32
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/dist/types/src/types/events.d.ts +0 -5
- package/dist/types/src/types/events.d.ts.map +0 -1
- package/src/AssistantPlugin.tsx +0 -238
- package/src/cli/plugin.ts +0 -83
- package/src/containers/ChatContainer/index.ts +0 -5
- package/src/types/capabilities.ts +0 -35
- package/src/types/events.ts +0 -11
- /package/dist/lib/{browser/chunk-J5LGTIGS.mjs.map → neutral/AssistantPlugin.mjs.map} +0 -0
- /package/dist/lib/{browser → neutral}/AssistantSettings-GG52BLKS.mjs +0 -0
- /package/dist/lib/{browser → neutral}/AssistantSettings-GG52BLKS.mjs.map +0 -0
- /package/dist/lib/{browser/components/index.mjs.map → neutral/ChatArticle-WVAFZPVI.mjs.map} +0 -0
- /package/dist/lib/{browser/hooks → neutral/blueprints}/index.mjs.map +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{browser/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/components → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/chunk-HSLMI22Q.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/hooks → neutral/operations}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/types/index.mjs.map → neutral/testing.mjs.map} +0 -0
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Atom } from '@effect-atom/atom-react';
|
|
6
5
|
import * as Effect from 'effect/Effect';
|
|
7
|
-
import { useMemo } from 'react';
|
|
8
6
|
|
|
9
7
|
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
10
8
|
import { Chat } from '@dxos/assistant-toolkit';
|
|
@@ -12,11 +10,11 @@ import { Filter, Obj, Query } from '@dxos/echo';
|
|
|
12
10
|
import { runAndForwardErrors } from '@dxos/effect';
|
|
13
11
|
import { invariant } from '@dxos/invariant';
|
|
14
12
|
import { useQuery } from '@dxos/react-client/echo';
|
|
15
|
-
import { MenuBuilder,
|
|
13
|
+
import { MenuBuilder, useMenuBuilder } from '@dxos/react-ui-menu';
|
|
16
14
|
|
|
17
15
|
import { useChatContext } from '#components';
|
|
18
16
|
import { meta } from '#meta';
|
|
19
|
-
import { AssistantOperation } from '#
|
|
17
|
+
import { AssistantOperation } from '#types';
|
|
20
18
|
|
|
21
19
|
export type ChatToolbarActionsProps = {
|
|
22
20
|
chat?: Chat.Chat;
|
|
@@ -33,90 +31,90 @@ export const useChatToolbarActions = ({ chat, companionTo }: ChatToolbarActionsP
|
|
|
33
31
|
// TODO(wittjosiah): Query in react vs query in atom?
|
|
34
32
|
const chats = useQuery(db, query);
|
|
35
33
|
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return Atom.make(() => {
|
|
40
|
-
const builder = MenuBuilder.make()
|
|
41
|
-
.root({
|
|
42
|
-
label: ['chat-toolbar.title', { ns: meta.id }],
|
|
43
|
-
})
|
|
44
|
-
.action(
|
|
45
|
-
'new',
|
|
46
|
-
{
|
|
47
|
-
label: ['new-thread.button', { ns: meta.id }],
|
|
48
|
-
icon: 'ph--plus--regular',
|
|
49
|
-
type: 'new',
|
|
50
|
-
disabled: !companionTo,
|
|
51
|
-
},
|
|
52
|
-
() => {
|
|
53
|
-
invariant(companionTo);
|
|
54
|
-
return invoke(AssistantOperation.SetCurrentChat, {
|
|
55
|
-
companionTo,
|
|
56
|
-
chat: undefined,
|
|
57
|
-
}).pipe(runAndForwardErrors);
|
|
58
|
-
},
|
|
59
|
-
)
|
|
60
|
-
.action(
|
|
61
|
-
'rename',
|
|
62
|
-
{
|
|
63
|
-
label: ['rename-thread.button', { ns: meta.id }],
|
|
64
|
-
icon: 'ph--magic-wand--regular',
|
|
65
|
-
type: 'rename',
|
|
66
|
-
disabled: !chat,
|
|
67
|
-
},
|
|
68
|
-
() =>
|
|
69
|
-
Effect.gen(function* () {
|
|
70
|
-
invariant(chat);
|
|
71
|
-
yield* invoke(AssistantOperation.UpdateChatName, { chat });
|
|
72
|
-
}).pipe(runAndForwardErrors),
|
|
73
|
-
)
|
|
74
|
-
.action(
|
|
75
|
-
'branch',
|
|
76
|
-
{
|
|
77
|
-
label: ['branch-thread.menu', { ns: meta.id }],
|
|
78
|
-
icon: 'ph--git-branch--regular',
|
|
79
|
-
type: 'branch',
|
|
80
|
-
disabled: true,
|
|
81
|
-
},
|
|
82
|
-
() => {},
|
|
83
|
-
);
|
|
34
|
+
// Stable projection of chat identity + label so the menu rebuilds when a chat is renamed
|
|
35
|
+
// (same count, same ids → without this the history labels go stale).
|
|
36
|
+
const chatsVersion = chats.map((chat) => `${chat.id}:${Obj.getLabel(chat) ?? ''}`).join('|');
|
|
84
37
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
38
|
+
// Stable references in deps avoid circular reference issues.
|
|
39
|
+
return useMenuBuilder(() => {
|
|
40
|
+
const builder = MenuBuilder.make()
|
|
41
|
+
.root({
|
|
42
|
+
label: ['chat-toolbar.title', { ns: meta.id }],
|
|
43
|
+
})
|
|
44
|
+
.action(
|
|
45
|
+
'new',
|
|
46
|
+
{
|
|
47
|
+
label: ['new-thread.button', { ns: meta.id }],
|
|
48
|
+
icon: 'ph--plus--regular',
|
|
49
|
+
type: 'new',
|
|
50
|
+
disabled: !companionTo,
|
|
51
|
+
},
|
|
52
|
+
() => {
|
|
53
|
+
invariant(companionTo);
|
|
54
|
+
return invoke(AssistantOperation.SetCurrentChat, {
|
|
55
|
+
companionTo,
|
|
56
|
+
chat: undefined,
|
|
57
|
+
}).pipe(runAndForwardErrors);
|
|
58
|
+
},
|
|
59
|
+
)
|
|
60
|
+
.action(
|
|
61
|
+
'rename',
|
|
62
|
+
{
|
|
63
|
+
label: ['rename-thread.button', { ns: meta.id }],
|
|
64
|
+
icon: 'ph--magic-wand--regular',
|
|
65
|
+
type: 'rename',
|
|
66
|
+
disabled: !chat,
|
|
67
|
+
},
|
|
68
|
+
() =>
|
|
69
|
+
Effect.gen(function* () {
|
|
70
|
+
invariant(chat);
|
|
71
|
+
yield* invoke(AssistantOperation.UpdateChatName, { chat });
|
|
72
|
+
}).pipe(runAndForwardErrors),
|
|
73
|
+
)
|
|
74
|
+
.action(
|
|
75
|
+
'branch',
|
|
76
|
+
{
|
|
77
|
+
label: ['branch-thread.menu', { ns: meta.id }],
|
|
78
|
+
icon: 'ph--git-branch--regular',
|
|
79
|
+
type: 'branch',
|
|
80
|
+
disabled: true,
|
|
81
|
+
},
|
|
82
|
+
() => {},
|
|
83
|
+
);
|
|
117
84
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
85
|
+
if (chats.length > 0) {
|
|
86
|
+
builder.group(
|
|
87
|
+
'chats',
|
|
88
|
+
{
|
|
89
|
+
label: ['chat-history.label', { ns: meta.id }],
|
|
90
|
+
icon: 'ph--clock-counter-clockwise--regular',
|
|
91
|
+
selectCardinality: 'single',
|
|
92
|
+
variant: 'dropdownMenu',
|
|
93
|
+
},
|
|
94
|
+
(builder) => {
|
|
95
|
+
chats
|
|
96
|
+
// TODO(wittjosiah): This should be the default sort order.
|
|
97
|
+
.toSorted((a, b) => a.id.localeCompare(b.id))
|
|
98
|
+
.forEach((chat) => {
|
|
99
|
+
builder.action(
|
|
100
|
+
chat.id,
|
|
101
|
+
{
|
|
102
|
+
label: Obj.getLabel(chat) ?? ['object-name.placeholder', { ns: Chat.Chat.typename }],
|
|
103
|
+
},
|
|
104
|
+
() =>
|
|
105
|
+
Effect.gen(function* () {
|
|
106
|
+
invariant(companionTo);
|
|
107
|
+
yield* invoke(AssistantOperation.SetCurrentChat, {
|
|
108
|
+
companionTo,
|
|
109
|
+
chat,
|
|
110
|
+
});
|
|
111
|
+
}).pipe(runAndForwardErrors),
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return builder.build();
|
|
119
|
+
}, [chatsVersion, db?.spaceId, companionTo?.id, chat?.id, invoke]);
|
|
122
120
|
};
|
|
@@ -6,7 +6,7 @@ import { type Registry, RegistryContext } from '@effect-atom/atom-react';
|
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import { useContext, useState } from 'react';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { AiContext } from '@dxos/assistant';
|
|
10
10
|
import { Feed } from '@dxos/echo';
|
|
11
11
|
import { createFeedServiceLayer } from '@dxos/echo-db';
|
|
12
12
|
import { runAndForwardErrors } from '@dxos/effect';
|
|
@@ -16,9 +16,9 @@ import { useAsyncEffect } from '@dxos/react-ui';
|
|
|
16
16
|
export const useContextBinder = (
|
|
17
17
|
space: Space | undefined,
|
|
18
18
|
feed: Feed.Feed | undefined,
|
|
19
|
-
):
|
|
19
|
+
): AiContext.Binder | undefined => {
|
|
20
20
|
const registry = useContext(RegistryContext) as Registry.Registry;
|
|
21
|
-
const [binder, setBinder] = useState<
|
|
21
|
+
const [binder, setBinder] = useState<AiContext.Binder>();
|
|
22
22
|
|
|
23
23
|
useAsyncEffect(async () => {
|
|
24
24
|
setBinder(undefined);
|
|
@@ -30,7 +30,7 @@ export const useContextBinder = (
|
|
|
30
30
|
const runtime = await runAndForwardErrors(
|
|
31
31
|
Effect.runtime<Feed.FeedService>().pipe(Effect.provide(feedServiceLayer)),
|
|
32
32
|
);
|
|
33
|
-
const binder = new
|
|
33
|
+
const binder = new AiContext.Binder({ feed, runtime, registry });
|
|
34
34
|
await binder.open();
|
|
35
35
|
setBinder(binder);
|
|
36
36
|
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
import { Atom, useAtomValue } from '@effect-atom/atom-react';
|
|
6
6
|
import { useCallback } from 'react';
|
|
7
7
|
|
|
8
|
-
import { type
|
|
8
|
+
import { type AiContext } from '@dxos/assistant';
|
|
9
9
|
import { type DXN, type Database, type Obj } from '@dxos/echo';
|
|
10
10
|
|
|
11
11
|
export type UseContextObjectsProps = {
|
|
12
12
|
db?: Database.Database;
|
|
13
|
-
context?:
|
|
13
|
+
context?: AiContext.Binder;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export type UseContextObjects = {
|
package/src/index.ts
CHANGED
|
@@ -2,13 +2,6 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { meta } from './meta';
|
|
8
|
-
|
|
9
|
-
export const AssistantPlugin = Plugin.lazy(meta, () => import('#plugin'));
|
|
10
|
-
|
|
5
|
+
export * from './blueprints';
|
|
11
6
|
export * from './meta';
|
|
12
|
-
|
|
13
|
-
export * from './components';
|
|
14
|
-
export * from './hooks';
|
|
7
|
+
export * from './types';
|
|
@@ -5,19 +5,18 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
-
import {
|
|
8
|
+
import { AiContext } from '@dxos/assistant';
|
|
9
9
|
import { Chat, DatabaseBlueprint, AgentWizardBlueprint } from '@dxos/assistant-toolkit';
|
|
10
10
|
import { Blueprint, Operation } from '@dxos/compute';
|
|
11
11
|
import { Feed, Filter, Obj, Ref } from '@dxos/echo';
|
|
12
12
|
import { createFeedServiceLayer } from '@dxos/echo-db';
|
|
13
13
|
import { invariant } from '@dxos/invariant';
|
|
14
|
-
import { ClientCapabilities } from '@dxos/plugin-client
|
|
14
|
+
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
15
15
|
|
|
16
16
|
import { AssistantBlueprint } from '#blueprints';
|
|
17
|
+
import { AssistantOperation } from '#types';
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const handler: Operation.WithHandler<typeof CreateChat> = CreateChat.pipe(
|
|
19
|
+
const handler: Operation.WithHandler<typeof AssistantOperation.CreateChat> = AssistantOperation.CreateChat.pipe(
|
|
21
20
|
Operation.withHandler(
|
|
22
21
|
Effect.fnUntraced(function* ({ db, name, addToSpace = true }) {
|
|
23
22
|
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
@@ -34,22 +33,28 @@ const handler: Operation.WithHandler<typeof CreateChat> = CreateChat.pipe(
|
|
|
34
33
|
// TODO(wittjosiah): This should be a space-level setting.
|
|
35
34
|
// TODO(burdon): Clone when activated. Copy-on-write for template.
|
|
36
35
|
const blueprints = yield* Effect.promise(() => db.query(Filter.type(Blueprint.Blueprint)).run());
|
|
37
|
-
let defaultAssistantBlueprint = blueprints.find(
|
|
36
|
+
let defaultAssistantBlueprint = blueprints.find(
|
|
37
|
+
(blueprint) => Obj.getMeta(blueprint).key === AssistantBlueprint.key,
|
|
38
|
+
);
|
|
38
39
|
if (!defaultAssistantBlueprint) {
|
|
39
40
|
defaultAssistantBlueprint = db.add(AssistantBlueprint.make());
|
|
40
41
|
}
|
|
41
|
-
let defaultDatabaseBlueprint = blueprints.find(
|
|
42
|
+
let defaultDatabaseBlueprint = blueprints.find(
|
|
43
|
+
(blueprint) => Obj.getMeta(blueprint).key === DatabaseBlueprint.key,
|
|
44
|
+
);
|
|
42
45
|
if (!defaultDatabaseBlueprint) {
|
|
43
46
|
defaultDatabaseBlueprint = db.add(DatabaseBlueprint.make());
|
|
44
47
|
}
|
|
45
|
-
let defaultAgentWizardBlueprint = blueprints.find(
|
|
48
|
+
let defaultAgentWizardBlueprint = blueprints.find(
|
|
49
|
+
(blueprint) => Obj.getMeta(blueprint).key === AgentWizardBlueprint.key,
|
|
50
|
+
);
|
|
46
51
|
if (!defaultAgentWizardBlueprint) {
|
|
47
52
|
defaultAgentWizardBlueprint = db.add(AgentWizardBlueprint.make());
|
|
48
53
|
}
|
|
49
54
|
// Dynamic import to avoid circular dependency with the barrel that also exports BlueprintManagerHandlers.
|
|
50
55
|
const { BlueprintManagerBlueprint } = yield* Effect.promise(() => import('@dxos/assistant-toolkit'));
|
|
51
56
|
let defaultBlueprintManagerBlueprint = blueprints.find(
|
|
52
|
-
(blueprint) => blueprint.key === BlueprintManagerBlueprint.key,
|
|
57
|
+
(blueprint) => Obj.getMeta(blueprint).key === BlueprintManagerBlueprint.key,
|
|
53
58
|
);
|
|
54
59
|
if (!defaultBlueprintManagerBlueprint) {
|
|
55
60
|
defaultBlueprintManagerBlueprint = db.add(BlueprintManagerBlueprint.make());
|
|
@@ -57,9 +62,9 @@ const handler: Operation.WithHandler<typeof CreateChat> = CreateChat.pipe(
|
|
|
57
62
|
|
|
58
63
|
const feedServiceLayer = createFeedServiceLayer(space.queues);
|
|
59
64
|
const runtime = yield* Effect.runtime<Feed.FeedService>().pipe(Effect.provide(feedServiceLayer));
|
|
60
|
-
const binder = new
|
|
65
|
+
const binder = new AiContext.Binder({ feed, runtime, registry });
|
|
61
66
|
yield* Effect.promise(() =>
|
|
62
|
-
binder.use((b:
|
|
67
|
+
binder.use((b: AiContext.Binder) =>
|
|
63
68
|
b.bind({
|
|
64
69
|
blueprints: [
|
|
65
70
|
Ref.make(defaultAssistantBlueprint!),
|
|
@@ -9,53 +9,55 @@ import { Chat } from '@dxos/assistant-toolkit';
|
|
|
9
9
|
import { Operation } from '@dxos/compute';
|
|
10
10
|
import { Filter, Obj, Query } from '@dxos/echo';
|
|
11
11
|
|
|
12
|
-
import { AssistantCapabilities } from '
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
import { AssistantCapabilities, AssistantOperation } from '#types';
|
|
13
|
+
|
|
14
|
+
const handler: Operation.WithHandler<typeof AssistantOperation.EnsureCompanionChat> =
|
|
15
|
+
AssistantOperation.EnsureCompanionChat.pipe(
|
|
16
|
+
Operation.withHandler(
|
|
17
|
+
Effect.fnUntraced(function* ({ db, companionTo }) {
|
|
18
|
+
const operationInvoker = yield* Capability.get(Capabilities.OperationInvoker);
|
|
19
|
+
const companionDXN = Obj.getDXN(companionTo).toString();
|
|
20
|
+
|
|
21
|
+
// 1. Look for an existing persisted companion chat in the space.
|
|
22
|
+
const existingChats = yield* Effect.promise(() =>
|
|
23
|
+
db.query(Query.select(Filter.id(companionTo.id)).targetOf(Chat.CompanionTo).source()).run(),
|
|
24
|
+
);
|
|
25
|
+
if (existingChats.length > 0) {
|
|
26
|
+
const chat = existingChats.at(-1) as Chat.Chat;
|
|
27
|
+
// Cache the persisted chat so the graph connector can resolve it immediately
|
|
28
|
+
// via the cache fallback, without waiting for AtomObj.make(ref) to hydrate.
|
|
29
|
+
yield* Capabilities.updateAtomValue(AssistantCapabilities.CompanionChatCache, (current) => ({
|
|
30
|
+
...current,
|
|
31
|
+
[companionDXN]: chat,
|
|
32
|
+
}));
|
|
33
|
+
yield* Effect.promise(() =>
|
|
34
|
+
operationInvoker.invokePromise(AssistantOperation.SetCurrentChat, { companionTo, chat }),
|
|
35
|
+
);
|
|
36
|
+
return { chat, persisted: true };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// 2. Return cached transient chat for this companion if present.
|
|
40
|
+
const cache = yield* Capabilities.getAtomValue(AssistantCapabilities.CompanionChatCache);
|
|
41
|
+
const cached = cache[companionDXN] as Chat.Chat | undefined;
|
|
42
|
+
if (cached) {
|
|
43
|
+
return { chat: cached, persisted: false };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 3. Create a new transient chat, cache it, and return it without persisting.
|
|
47
|
+
const { data } = yield* Effect.promise(() =>
|
|
48
|
+
operationInvoker.invokePromise(AssistantOperation.CreateChat, { db, addToSpace: false }),
|
|
49
|
+
);
|
|
50
|
+
if (!data?.object) {
|
|
51
|
+
return yield* Effect.fail(new Error('CreateChat did not return a chat object'));
|
|
52
|
+
}
|
|
53
|
+
const chat = data.object;
|
|
29
54
|
yield* Capabilities.updateAtomValue(AssistantCapabilities.CompanionChatCache, (current) => ({
|
|
30
55
|
...current,
|
|
31
|
-
[
|
|
56
|
+
[companionDXN]: chat,
|
|
32
57
|
}));
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// 2. Return cached transient chat for this companion if present.
|
|
38
|
-
const cache = yield* Capabilities.getAtomValue(AssistantCapabilities.CompanionChatCache);
|
|
39
|
-
const cached = cache[companionDxn] as Chat.Chat | undefined;
|
|
40
|
-
if (cached) {
|
|
41
|
-
return { chat: cached, persisted: false };
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// 3. Create a new transient chat, cache it, and return it without persisting.
|
|
45
|
-
const { data } = yield* Effect.promise(() =>
|
|
46
|
-
operationInvoker.invokePromise(CreateChat, { db, addToSpace: false }),
|
|
47
|
-
);
|
|
48
|
-
if (!data?.object) {
|
|
49
|
-
return yield* Effect.fail(new Error('CreateChat did not return a chat object'));
|
|
50
|
-
}
|
|
51
|
-
const chat = data.object;
|
|
52
|
-
yield* Capabilities.updateAtomValue(AssistantCapabilities.CompanionChatCache, (current) => ({
|
|
53
|
-
...current,
|
|
54
|
-
[companionDxn]: chat,
|
|
55
|
-
}));
|
|
56
|
-
return { chat, persisted: false };
|
|
57
|
-
}),
|
|
58
|
-
),
|
|
59
|
-
);
|
|
58
|
+
return { chat, persisted: false };
|
|
59
|
+
}),
|
|
60
|
+
),
|
|
61
|
+
);
|
|
60
62
|
|
|
61
63
|
export default handler;
|
package/src/operations/index.ts
CHANGED
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import { OperationHandlerSet } from '@dxos/compute';
|
|
6
6
|
|
|
7
|
-
export * as AssistantOperation from './definitions';
|
|
8
|
-
|
|
9
7
|
export const AssistantOperationHandlerSet = OperationHandlerSet.lazy(
|
|
10
8
|
() => import('./create-chat'),
|
|
11
9
|
() => import('./ensure-companion-chat'),
|
|
@@ -13,5 +11,6 @@ export const AssistantOperationHandlerSet = OperationHandlerSet.lazy(
|
|
|
13
11
|
() => import('./resolve-navigation-targets'),
|
|
14
12
|
() => import('./run-prompt-in-new-chat'),
|
|
15
13
|
() => import('./set-current-chat'),
|
|
14
|
+
() => import('./toggle-trace-panel-debug'),
|
|
16
15
|
() => import('./update-chat-name'),
|
|
17
16
|
);
|
|
@@ -7,15 +7,15 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
import { AgentPrompt } from '@dxos/assistant-toolkit';
|
|
8
8
|
import { Operation } from '@dxos/compute';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { AssistantOperation } from '#types';
|
|
11
11
|
|
|
12
|
-
const handler: Operation.WithHandler<typeof OnCreateSpace> = OnCreateSpace.pipe(
|
|
12
|
+
const handler: Operation.WithHandler<typeof AssistantOperation.OnCreateSpace> = AssistantOperation.OnCreateSpace.pipe(
|
|
13
13
|
Operation.withHandler(
|
|
14
14
|
Effect.fnUntraced(function* ({ space }) {
|
|
15
15
|
// TODO(wittjosiah): Remove once function registry is avaiable.
|
|
16
16
|
space.db.add(Operation.serialize(AgentPrompt));
|
|
17
17
|
|
|
18
|
-
const { object: chat } = yield* Operation.invoke(CreateChat, { db: space.db });
|
|
18
|
+
const { object: chat } = yield* Operation.invoke(AssistantOperation.CreateChat, { db: space.db });
|
|
19
19
|
space.db.add(chat);
|
|
20
20
|
}),
|
|
21
21
|
),
|
|
@@ -11,15 +11,15 @@ import { Routine, Operation } from '@dxos/compute';
|
|
|
11
11
|
import { Database, Feed, Filter, Ref } from '@dxos/echo';
|
|
12
12
|
import { runAndForwardErrors } from '@dxos/effect';
|
|
13
13
|
import { ObjectId } from '@dxos/keys';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
14
|
+
import { AutomationCapabilities } from '@dxos/plugin-automation';
|
|
15
|
+
import { AutomationPlugin } from '@dxos/plugin-automation/plugin';
|
|
16
|
+
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
17
|
+
import { ClientPlugin } from '@dxos/plugin-client/plugin';
|
|
17
18
|
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
18
|
-
import { ClientCapabilities } from '@dxos/plugin-client/types';
|
|
19
19
|
import { createComposerTestApp } from '@dxos/plugin-testing/harness';
|
|
20
20
|
import { Message } from '@dxos/types';
|
|
21
21
|
|
|
22
|
-
import { AssistantPlugin } from '
|
|
22
|
+
import { AssistantPlugin } from '#plugin';
|
|
23
23
|
|
|
24
24
|
ObjectId.dangerouslyDisableRandomness();
|
|
25
25
|
|
|
@@ -8,9 +8,9 @@ import { Capability } from '@dxos/app-framework';
|
|
|
8
8
|
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
9
|
import { Operation } from '@dxos/compute';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { AssistantOperation } from '#types';
|
|
12
12
|
|
|
13
|
-
export default ResolveNavigationTargets.pipe(
|
|
13
|
+
export default AssistantOperation.ResolveNavigationTargets.pipe(
|
|
14
14
|
Operation.withHandler(
|
|
15
15
|
Effect.fn(function* ({ query }) {
|
|
16
16
|
const capabilities = yield* Capability.Service;
|