@dxos/plugin-assistant 0.8.4-main.c1de068 → 0.8.4-main.e098934
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/browser/{TemplateContainer-RPJ2LBOB.mjs → BlueprintContainer-BFNN6K46.mjs} +11 -9
- package/dist/lib/browser/BlueprintContainer-BFNN6K46.mjs.map +7 -0
- package/dist/lib/browser/ChatCompanion-DOVN34C7.mjs +126 -0
- package/dist/lib/browser/ChatCompanion-DOVN34C7.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-M3IHQLRS.mjs → ChatContainer-XIVJTCC2.mjs} +34 -13
- package/dist/lib/browser/ChatContainer-XIVJTCC2.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-X6VN6QZI.mjs → ChatDialog-EJJMK3WL.mjs} +28 -12
- package/dist/lib/browser/ChatDialog-EJJMK3WL.mjs.map +7 -0
- package/dist/lib/browser/{SequenceContainer-3UDVKWPA.mjs → SequenceContainer-TF5QNXYM.mjs} +5 -17
- package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs.map +7 -0
- package/dist/lib/browser/ai-service-YC2EQPHA.mjs +22 -0
- package/dist/lib/browser/ai-service-YC2EQPHA.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-JTXBKE7O.mjs → app-graph-builder-3C43MLCD.mjs} +26 -96
- package/dist/lib/browser/app-graph-builder-3C43MLCD.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-VHFSRTEJ.mjs +12 -0
- package/dist/lib/browser/blueprint-definition-VHFSRTEJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-C4Q2RYQM.mjs +1974 -0
- package/dist/lib/browser/chunk-C4Q2RYQM.mjs.map +7 -0
- package/dist/lib/browser/chunk-EZUSNS2J.mjs +19 -0
- package/dist/lib/browser/chunk-EZUSNS2J.mjs.map +7 -0
- package/dist/lib/browser/chunk-GLWD66TA.mjs +161 -0
- package/dist/lib/browser/chunk-GLWD66TA.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-O4LUJEDV.mjs +20 -0
- package/dist/lib/browser/{chunk-FDCJSQYF.mjs.map → chunk-O4LUJEDV.mjs.map} +2 -2
- package/dist/lib/browser/chunk-PQI3MGDN.mjs +169 -0
- package/dist/lib/browser/chunk-PQI3MGDN.mjs.map +7 -0
- package/dist/lib/browser/chunk-QD4UUISH.mjs +299 -0
- package/dist/lib/browser/chunk-QD4UUISH.mjs.map +7 -0
- package/dist/lib/browser/chunk-R6LRGW3I.mjs +216 -0
- package/dist/lib/browser/chunk-R6LRGW3I.mjs.map +7 -0
- package/dist/lib/browser/chunk-SMIVXXAI.mjs +202 -0
- package/dist/lib/browser/chunk-SMIVXXAI.mjs.map +7 -0
- package/dist/lib/browser/compute-runtime-X6IREJN3.mjs +155 -0
- package/dist/lib/browser/compute-runtime-X6IREJN3.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-JNEB355N.mjs +22 -0
- package/dist/lib/browser/edge-model-resolver-JNEB355N.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +167 -68
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-I6M3ZDAS.mjs +112 -0
- package/dist/lib/browser/intent-resolver-I6M3ZDAS.mjs.map +7 -0
- package/dist/lib/browser/local-model-resolver-EUXSRZ7X.mjs +21 -0
- package/dist/lib/browser/local-model-resolver-EUXSRZ7X.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-E4NAGB6R.mjs +109 -0
- package/dist/lib/browser/react-surface-E4NAGB6R.mjs.map +7 -0
- package/dist/lib/browser/{settings-2DGP3UTS.mjs → settings-36V3VUMW.mjs} +6 -5
- package/dist/lib/{node-esm/settings-47RYZOU4.mjs.map → browser/settings-36V3VUMW.mjs.map} +1 -1
- package/dist/lib/browser/state-AINRYS5W.mjs +21 -0
- package/dist/lib/browser/state-AINRYS5W.mjs.map +7 -0
- package/dist/lib/browser/toolkit-MPUS3U64.mjs +191 -0
- package/dist/lib/browser/toolkit-MPUS3U64.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -4
- package/dist/lib/node-esm/{TemplateContainer-A3NAQCZE.mjs → BlueprintContainer-X4MRBKDR.mjs} +11 -9
- package/dist/lib/node-esm/BlueprintContainer-X4MRBKDR.mjs.map +7 -0
- package/dist/lib/node-esm/ChatCompanion-ICWYVPRD.mjs +127 -0
- package/dist/lib/node-esm/ChatCompanion-ICWYVPRD.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-VZT74PO2.mjs → ChatContainer-LMMMQD4K.mjs} +34 -13
- package/dist/lib/node-esm/ChatContainer-LMMMQD4K.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-RJ6FDX4Q.mjs → ChatDialog-UUE3F7BT.mjs} +28 -12
- package/dist/lib/node-esm/ChatDialog-UUE3F7BT.mjs.map +7 -0
- package/dist/lib/node-esm/{SequenceContainer-RQQH5XOC.mjs → SequenceContainer-UXOVZPZO.mjs} +5 -17
- package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-XUMZVFCK.mjs +23 -0
- package/dist/lib/node-esm/ai-service-XUMZVFCK.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-OWSOXFTD.mjs → app-graph-builder-NM3JDLQ2.mjs} +26 -96
- package/dist/lib/node-esm/app-graph-builder-NM3JDLQ2.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-4E6XTLVN.mjs +13 -0
- package/dist/lib/node-esm/blueprint-definition-4E6XTLVN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4WLFSXZG.mjs +170 -0
- package/dist/lib/node-esm/chunk-4WLFSXZG.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7YOGZI66.mjs +203 -0
- package/dist/lib/node-esm/chunk-7YOGZI66.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-LVTG5JTW.mjs +217 -0
- package/dist/lib/node-esm/chunk-LVTG5JTW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QG2KT3AT.mjs +163 -0
- package/dist/lib/node-esm/chunk-QG2KT3AT.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-V44ZG7CU.mjs +1975 -0
- package/dist/lib/node-esm/chunk-V44ZG7CU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-VFY2JG62.mjs +22 -0
- package/dist/lib/node-esm/{chunk-QN2H2EHV.mjs.map → chunk-VFY2JG62.mjs.map} +2 -2
- package/dist/lib/node-esm/chunk-XD4CDA4R.mjs +20 -0
- package/dist/lib/node-esm/chunk-XD4CDA4R.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YU62ZWJN.mjs +300 -0
- package/dist/lib/node-esm/chunk-YU62ZWJN.mjs.map +7 -0
- package/dist/lib/node-esm/compute-runtime-NRHLLTSC.mjs +156 -0
- package/dist/lib/node-esm/compute-runtime-NRHLLTSC.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-UE5TLLJZ.mjs +23 -0
- package/dist/lib/node-esm/edge-model-resolver-UE5TLLJZ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +167 -68
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-VIINHFMT.mjs +113 -0
- package/dist/lib/node-esm/intent-resolver-VIINHFMT.mjs.map +7 -0
- package/dist/lib/node-esm/local-model-resolver-JBEFVVZA.mjs +22 -0
- package/dist/lib/node-esm/local-model-resolver-JBEFVVZA.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-5WQLRTCH.mjs +110 -0
- package/dist/lib/node-esm/react-surface-5WQLRTCH.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-47RYZOU4.mjs → settings-7ZCZ6AS5.mjs} +6 -5
- package/dist/lib/{browser/settings-2DGP3UTS.mjs.map → node-esm/settings-7ZCZ6AS5.mjs.map} +1 -1
- package/dist/lib/node-esm/state-EQS5KP6M.mjs +22 -0
- package/dist/lib/node-esm/state-EQS5KP6M.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-PKVYDZ4H.mjs +192 -0
- package/dist/lib/node-esm/toolkit-PKVYDZ4H.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +7 -4
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts +5 -0
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +7 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +32 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-runtime.d.ts +5 -0
- package/dist/types/src/capabilities/compute-runtime.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +12 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +10 -0
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/capabilities/state.d.ts +4 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit.d.ts +4 -0
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/BlueprintContainer.d.ts +8 -0
- package/dist/types/src/components/BlueprintContainer.d.ts.map +1 -0
- package/dist/types/src/components/Chat/Chat.d.ts +20 -17
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +5 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts +13 -0
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +4 -4
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +7 -0
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
- package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
- package/dist/types/src/components/ChatProgress/index.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 +20 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +4 -5
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +10 -7
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +115 -74
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/reducers.d.ts +40 -0
- package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/registry.d.ts +11 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.d.ts +36 -0
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts +2 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts.map +1 -0
- package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
- package/dist/types/src/components/SequenceContainer.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +261 -2
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -6
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +261 -6
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +2 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +258 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts +12 -0
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +19 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts +2 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/index.d.ts +3 -0
- package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +5 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/index.d.ts +2 -0
- package/dist/types/src/components/Toolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +11 -0
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +4 -9
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +262 -4
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +5 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/execution-graph/execution-graph.d.ts +21 -0
- package/dist/types/src/execution-graph/execution-graph.d.ts.map +1 -0
- package/dist/types/src/execution-graph/index.d.ts +2 -0
- package/dist/types/src/execution-graph/index.d.ts.map +1 -0
- package/dist/types/src/functions/analysis.d.ts +5 -0
- package/dist/types/src/functions/analysis.d.ts.map +1 -0
- package/dist/types/src/functions/index.d.ts +4 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/list.d.ts +10 -0
- package/dist/types/src/functions/list.d.ts.map +1 -0
- package/dist/types/src/functions/load.d.ts +8 -0
- package/dist/types/src/functions/load.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +9 -3
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +24 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +8 -21
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +5 -6
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +8 -0
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextBinder.d.ts +4 -0
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
- package/dist/types/src/hooks/useExecutionGraph.d.ts +6 -0
- package/dist/types/src/hooks/useExecutionGraph.d.ts.map +1 -0
- package/dist/types/src/hooks/useFlush.d.ts +6 -0
- package/dist/types/src/hooks/useFlush.d.ts.map +1 -0
- package/dist/types/src/hooks/useItemTypes.d.ts +4 -0
- package/dist/types/src/hooks/useItemTypes.d.ts.map +1 -0
- package/dist/types/src/hooks/useOnline.d.ts +3 -0
- package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
- package/dist/types/src/hooks/usePresets.d.ts +7 -0
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +3 -0
- package/dist/types/src/processor/index.d.ts.map +1 -0
- package/dist/types/src/{hooks → processor}/presets.d.ts +2 -2
- package/dist/types/src/processor/presets.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +73 -0
- package/dist/types/src/processor/processor.d.ts.map +1 -0
- package/dist/types/src/processor/processor.test.d.ts +2 -0
- package/dist/types/src/processor/processor.test.d.ts.map +1 -0
- package/dist/types/src/stories/Chat.stories.d.ts +26 -245
- package/dist/types/src/stories/Chat.stories.d.ts.map +1 -1
- package/dist/types/src/stories/components/BlueprintContainer.d.ts +4 -0
- package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/ChatContainer.d.ts +4 -0
- package/dist/types/src/stories/components/ChatContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/ChessContainer.d.ts +4 -0
- package/dist/types/src/stories/components/ChessContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/CommentsContainer.d.ts +4 -0
- package/dist/types/src/stories/components/CommentsContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/DebugCard.d.ts +8 -0
- package/dist/types/src/stories/components/DebugCard.d.ts.map +1 -0
- package/dist/types/src/stories/components/GraphContainer.d.ts +6 -0
- package/dist/types/src/stories/components/GraphContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/InvocationsContainer.d.ts +4 -0
- package/dist/types/src/stories/components/InvocationsContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/LoggingContainer.d.ts +7 -0
- package/dist/types/src/stories/components/LoggingContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/MessageContainer.d.ts +4 -0
- package/dist/types/src/stories/components/MessageContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/PromptContainer.d.ts +6 -0
- package/dist/types/src/stories/components/PromptContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/ResearchInputStack.d.ts +4 -0
- package/dist/types/src/stories/components/ResearchInputStack.d.ts.map +1 -0
- package/dist/types/src/stories/components/ResearchOutputStack.d.ts +4 -0
- package/dist/types/src/stories/components/ResearchOutputStack.d.ts.map +1 -0
- package/dist/types/src/stories/components/TasksContainer.d.ts +4 -0
- package/dist/types/src/stories/components/TasksContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/TokenManagerContainer.d.ts +3 -0
- package/dist/types/src/stories/components/TokenManagerContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/TriggersContainer.d.ts +14 -0
- package/dist/types/src/stories/components/TriggersContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/index.d.ts +16 -0
- package/dist/types/src/stories/components/index.d.ts.map +1 -0
- package/dist/types/src/stories/components/types.d.ts +7 -0
- package/dist/types/src/stories/components/types.d.ts.map +1 -0
- package/dist/types/src/stories/testing/data.d.ts +9 -0
- package/dist/types/src/stories/testing/data.d.ts.map +1 -0
- package/dist/types/src/stories/testing/index.d.ts +3 -0
- package/dist/types/src/stories/testing/index.d.ts.map +1 -0
- package/dist/types/src/stories/testing/schema.d.ts +7 -0
- package/dist/types/src/stories/testing/schema.d.ts.map +1 -0
- package/dist/types/src/stories/testing/testing.d.ts +48 -0
- package/dist/types/src/stories/testing/testing.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +3 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-data.d.ts +14 -0
- package/dist/types/src/testing/test-data.d.ts.map +1 -0
- package/dist/types/src/testing/test-functions.d.ts +5 -2
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +7 -0
- package/dist/types/src/testing/test-generator.d.ts.map +1 -0
- package/dist/types/src/testing/test-sequence.d.ts +0 -4
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +29 -22
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +42 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -0
- package/dist/types/src/types/AssistantAction.d.ts +107 -0
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
- package/dist/types/src/types/defs.d.ts +2 -0
- package/dist/types/src/types/defs.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +6 -3
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +106 -82
- package/src/AssistantPlugin.tsx +83 -12
- package/src/capabilities/ai-service.ts +28 -0
- package/src/capabilities/app-graph-builder.ts +43 -134
- package/src/capabilities/blueprint-definition.ts +58 -0
- package/src/capabilities/capabilities.ts +71 -0
- package/src/capabilities/compute-runtime.ts +124 -0
- package/src/capabilities/edge-model-resolver.ts +27 -0
- package/src/capabilities/index.ts +10 -0
- package/src/capabilities/intent-resolver.ts +50 -14
- package/src/capabilities/local-model-resolver.ts +32 -0
- package/src/capabilities/react-surface.tsx +17 -64
- package/src/capabilities/state.ts +20 -0
- package/src/capabilities/toolkit.ts +163 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +83 -76
- package/src/components/BlueprintContainer.tsx +24 -0
- package/src/components/Chat/Chat.tsx +175 -174
- package/src/components/Chat/events.ts +7 -0
- package/src/components/ChatCompanion.tsx +111 -0
- package/src/components/ChatContainer.tsx +19 -13
- package/src/components/ChatDialog.tsx +18 -14
- package/src/components/ChatProgress/ChatProgress.tsx +68 -0
- package/src/components/ChatProgress/index.ts +5 -0
- package/src/components/ChatPrompt/ChatActions.tsx +10 -24
- package/src/components/ChatPrompt/ChatOptions.tsx +233 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +31 -36
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
- package/src/components/ChatPrompt/index.ts +1 -1
- package/src/components/ChatThread/ChatThread.stories.tsx +97 -110
- package/src/components/ChatThread/ChatThread.tsx +65 -29
- package/src/components/ChatThread/Link.tsx +26 -0
- package/src/components/ChatThread/reducers.ts +151 -0
- package/src/components/ChatThread/registry.tsx +189 -0
- package/src/components/ChatThread/sync.test.ts +81 -0
- package/src/components/ChatThread/sync.ts +113 -0
- package/src/components/PromptSettings.tsx +1 -0
- package/src/components/SequenceContainer.tsx +27 -28
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +5 -4
- package/src/components/SequenceEditor/SequenceEditor.tsx +1 -1
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +27 -14
- package/src/components/TemplateEditor/TemplateEditor.tsx +20 -51
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +15 -8
- package/src/components/TemplateEditor/TemplateForm.tsx +6 -3
- package/src/components/TemplateEditor/handlebars-extension.ts +165 -0
- package/src/components/ToolBlock/ToolBlock.tsx +152 -0
- package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
- package/src/components/ToolBlock/index.ts +6 -0
- package/src/components/Toolbar/Toolbar.tsx +21 -0
- package/src/components/Toolbar/index.ts +5 -0
- package/src/components/Toolbar/useChatToolbarActions.ts +126 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +10 -16
- package/src/components/Toolbox/Toolbox.tsx +21 -51
- package/src/components/index.ts +4 -5
- package/src/events.ts +2 -2
- package/src/execution-graph/execution-graph.ts +211 -0
- package/src/execution-graph/index.ts +5 -0
- package/src/functions/analysis.ts +20 -0
- package/src/functions/index.ts +7 -0
- package/src/functions/list.ts +46 -0
- package/src/functions/load.ts +42 -0
- package/src/hooks/index.ts +9 -4
- package/src/hooks/useBlueprintRegistry.ts +80 -0
- package/src/hooks/useChatProcessor.ts +21 -98
- package/src/hooks/useChatServices.ts +28 -71
- package/src/hooks/useComputeRuntimeCallback.ts +25 -0
- package/src/hooks/useContextBinder.ts +18 -0
- package/src/hooks/useContextObjects.ts +58 -0
- package/src/hooks/useExecutionGraph.ts +20 -0
- package/src/hooks/useFlush.ts +35 -0
- package/src/hooks/useItemTypes.ts +37 -0
- package/src/hooks/useOnline.ts +10 -0
- package/src/hooks/usePresets.ts +44 -0
- package/src/hooks/useReferencesProvider.ts +11 -9
- package/src/meta.ts +1 -1
- package/src/processor/index.ts +6 -0
- package/src/{hooks → processor}/presets.ts +14 -6
- package/src/processor/processor.test.ts +77 -0
- package/src/processor/processor.ts +302 -0
- package/src/queue-logger.ts +10 -10
- package/src/stories/Chat.stories.tsx +594 -315
- package/src/stories/components/BlueprintContainer.tsx +34 -0
- package/src/stories/components/ChatContainer.tsx +74 -0
- package/src/stories/components/ChessContainer.tsx +17 -0
- package/src/stories/components/CommentsContainer.tsx +25 -0
- package/src/stories/components/DebugCard.tsx +61 -0
- package/src/stories/components/GraphContainer.tsx +119 -0
- package/src/stories/components/InvocationsContainer.tsx +17 -0
- package/src/stories/components/LoggingContainer.tsx +33 -0
- package/src/stories/components/MessageContainer.tsx +22 -0
- package/src/stories/components/PromptContainer.tsx +52 -0
- package/src/stories/components/ResearchInputStack.tsx +30 -0
- package/src/stories/components/ResearchOutputStack.tsx +29 -0
- package/src/stories/components/TasksContainer.tsx +49 -0
- package/src/stories/components/TokenManagerContainer.tsx +14 -0
- package/src/stories/components/TriggersContainer.tsx +75 -0
- package/src/stories/components/index.ts +20 -0
- package/src/stories/components/types.ts +11 -0
- package/src/stories/testing/data.ts +142 -0
- package/src/stories/testing/index.ts +6 -0
- package/src/stories/testing/schema.ts +17 -0
- package/src/stories/testing/testing.tsx +279 -0
- package/src/testing/index.ts +3 -1
- package/src/testing/test-data.ts +245 -0
- package/src/testing/test-functions.ts +8 -3
- package/src/testing/test-generator.ts +257 -0
- package/src/testing/test-sequence.ts +2 -27
- package/src/translations.ts +32 -22
- package/src/types/Assistant.ts +61 -0
- package/src/types/AssistantAction.ts +62 -0
- package/src/types/defs.ts +5 -0
- package/src/types/index.ts +4 -1
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/ChatContainer-M3IHQLRS.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-X6VN6QZI.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
- package/dist/lib/browser/TemplateContainer-RPJ2LBOB.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-JTXBKE7O.mjs.map +0 -7
- package/dist/lib/browser/chunk-AEAEKWOC.mjs +0 -98
- package/dist/lib/browser/chunk-AEAEKWOC.mjs.map +0 -7
- package/dist/lib/browser/chunk-EQDW6BYQ.mjs +0 -108
- package/dist/lib/browser/chunk-EQDW6BYQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
- package/dist/lib/browser/chunk-JQBVLTM5.mjs +0 -158
- package/dist/lib/browser/chunk-JQBVLTM5.mjs.map +0 -7
- package/dist/lib/browser/chunk-OWY4CUQY.mjs +0 -2245
- package/dist/lib/browser/chunk-OWY4CUQY.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs +0 -60
- package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs.map +0 -7
- package/dist/lib/browser/react-surface-66VY37YQ.mjs +0 -150
- package/dist/lib/browser/react-surface-66VY37YQ.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-VZT74PO2.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-RJ6FDX4Q.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
- package/dist/lib/node-esm/TemplateContainer-A3NAQCZE.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-OWSOXFTD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2XL6MNPE.mjs +0 -99
- package/dist/lib/node-esm/chunk-2XL6MNPE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BISJDTBK.mjs +0 -159
- package/dist/lib/node-esm/chunk-BISJDTBK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-E33DNNDW.mjs +0 -109
- package/dist/lib/node-esm/chunk-E33DNNDW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
- package/dist/lib/node-esm/chunk-SENTQAEO.mjs +0 -2246
- package/dist/lib/node-esm/chunk-SENTQAEO.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs +0 -61
- package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs +0 -151
- package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs.map +0 -7
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -17
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +0 -19
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
- package/dist/types/src/components/TemplateContainer.d.ts +0 -8
- package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.d.ts +0 -86
- package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
- package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/presets.d.ts.map +0 -1
- package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
- package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.d.ts +0 -4
- package/dist/types/src/parser/filter-generator.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.test.d.ts +0 -2
- package/dist/types/src/parser/filter-generator.test.d.ts.map +0 -1
- package/dist/types/src/parser/index.d.ts +0 -4
- package/dist/types/src/parser/index.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.d.ts +0 -15
- package/dist/types/src/parser/query-parser.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.test.d.ts +0 -2
- package/dist/types/src/parser/query-parser.test.d.ts.map +0 -1
- package/dist/types/src/parser/types.d.ts +0 -24
- package/dist/types/src/parser/types.d.ts.map +0 -1
- package/dist/types/src/tools/function.d.ts +0 -5
- package/dist/types/src/tools/function.d.ts.map +0 -1
- package/dist/types/src/tools/index.d.ts +0 -3
- package/dist/types/src/tools/index.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.d.ts +0 -10
- package/dist/types/src/tools/openapi.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.test.d.ts +0 -2
- package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -88
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
- package/src/components/ChatThread/ChatMessage.tsx +0 -268
- package/src/components/ChatThread/ToolBlock.tsx +0 -121
- package/src/components/ChatThread/reducer.ts +0 -52
- package/src/components/TemplateContainer.tsx +0 -24
- package/src/hooks/chat-processor.test.ts +0 -16
- package/src/hooks/chat-processor.ts +0 -314
- package/src/hooks/useBlueprints.ts +0 -57
- package/src/parser/filter-generator.test.ts +0 -32
- package/src/parser/filter-generator.ts +0 -81
- package/src/parser/index.ts +0 -7
- package/src/parser/query-parser.test.ts +0 -139
- package/src/parser/query-parser.ts +0 -199
- package/src/parser/types.ts +0 -34
- package/src/shims.d.ts +0 -8
- package/src/tools/function.ts +0 -46
- package/src/tools/index.ts +0 -6
- package/src/tools/openapi.test.ts +0 -217
- package/src/tools/openapi.ts +0 -338
- package/src/types/schema.ts +0 -95
- package/src/typings.d.ts +0 -9
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { log } from '@dxos/log';
|
|
8
|
+
import {
|
|
9
|
+
PromptWidget,
|
|
10
|
+
ReferenceWidget,
|
|
11
|
+
SelectWidget,
|
|
12
|
+
SuggestionWidget,
|
|
13
|
+
SummaryWidget,
|
|
14
|
+
ToggleContainer,
|
|
15
|
+
} from '@dxos/react-ui-components';
|
|
16
|
+
import { type XmlWidgetProps, type XmlWidgetRegistry } from '@dxos/react-ui-editor';
|
|
17
|
+
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
18
|
+
import { ContentBlock, type DataType } from '@dxos/schema';
|
|
19
|
+
|
|
20
|
+
import { ToolBlock } from '../ToolBlock';
|
|
21
|
+
|
|
22
|
+
import { type BlockRenderer, type MessageThreadContext } from './sync';
|
|
23
|
+
|
|
24
|
+
const Fallback = ({ _tag, ...props }: XmlWidgetProps<MessageThreadContext>) => {
|
|
25
|
+
return (
|
|
26
|
+
<ToggleContainer.Root classNames='rounded-sm'>
|
|
27
|
+
<ToggleContainer.Header classNames='bg-groupSurface'>{_tag}</ToggleContainer.Header>
|
|
28
|
+
<ToggleContainer.Content classNames='bg-modalSurface'>
|
|
29
|
+
<Json classNames='!p-2 text-sm' data={props} />
|
|
30
|
+
</ToggleContainer.Content>
|
|
31
|
+
</ToggleContainer.Root>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const getTextChild = (children: any[]): string | null => {
|
|
36
|
+
const child = children?.[0];
|
|
37
|
+
return typeof child === 'string' ? child : null;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Custom XML tags registry.
|
|
42
|
+
*/
|
|
43
|
+
export const componentRegistry: XmlWidgetRegistry = {
|
|
44
|
+
//
|
|
45
|
+
// Widgets
|
|
46
|
+
//
|
|
47
|
+
|
|
48
|
+
['prompt' as const]: {
|
|
49
|
+
block: true,
|
|
50
|
+
factory: (props) => {
|
|
51
|
+
const text = getTextChild(props.children);
|
|
52
|
+
return text ? new PromptWidget(text) : null;
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
['reference' as const]: {
|
|
56
|
+
block: false,
|
|
57
|
+
factory: (props) => {
|
|
58
|
+
const text = getTextChild(props.children);
|
|
59
|
+
return text && props.ref ? new ReferenceWidget(text, props.ref) : null;
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
['select' as const]: {
|
|
63
|
+
block: true,
|
|
64
|
+
factory: (props) => {
|
|
65
|
+
const options = props.children
|
|
66
|
+
?.map((option: any) => option._tag === 'option' && getTextChild(option.children))
|
|
67
|
+
.filter(Boolean);
|
|
68
|
+
return options?.length ? new SelectWidget(options) : null;
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
['suggestion' as const]: {
|
|
72
|
+
block: true,
|
|
73
|
+
factory: (props) => {
|
|
74
|
+
const text = getTextChild(props.children);
|
|
75
|
+
return text ? new SuggestionWidget(text) : null;
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
['summary' as const]: {
|
|
79
|
+
block: true,
|
|
80
|
+
factory: (props) => {
|
|
81
|
+
const text = getTextChild(props.children);
|
|
82
|
+
return text ? new SummaryWidget(text) : null;
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
//
|
|
87
|
+
// React
|
|
88
|
+
//
|
|
89
|
+
|
|
90
|
+
['toolCall' as const]: {
|
|
91
|
+
block: true,
|
|
92
|
+
Component: ToolBlock,
|
|
93
|
+
},
|
|
94
|
+
['toolResult' as const]: {
|
|
95
|
+
block: true,
|
|
96
|
+
Component: Fallback,
|
|
97
|
+
},
|
|
98
|
+
['toolkit' as const]: {
|
|
99
|
+
block: true,
|
|
100
|
+
Component: Fallback,
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
//
|
|
104
|
+
// Fallback
|
|
105
|
+
//
|
|
106
|
+
|
|
107
|
+
['json' as const]: {
|
|
108
|
+
block: true,
|
|
109
|
+
Component: Fallback,
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Convert block to markdown.
|
|
115
|
+
*/
|
|
116
|
+
export const blockToMarkdown: BlockRenderer = (
|
|
117
|
+
context: MessageThreadContext,
|
|
118
|
+
message: DataType.Message,
|
|
119
|
+
block: ContentBlock.Any,
|
|
120
|
+
) => {
|
|
121
|
+
let str = _blockToMarkdown(context, message, block);
|
|
122
|
+
if (str && !block.pending) {
|
|
123
|
+
return (str += '\n');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return str;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const _blockToMarkdown = (context: MessageThreadContext, message: DataType.Message, block: ContentBlock.Any) => {
|
|
130
|
+
log('blockToMarkdown', { block: JSON.stringify(block) });
|
|
131
|
+
switch (block._tag) {
|
|
132
|
+
case 'text': {
|
|
133
|
+
if (message.sender.role === 'user') {
|
|
134
|
+
return `\n<prompt>${block.text}</prompt>\n`;
|
|
135
|
+
} else {
|
|
136
|
+
const text = block.text.trim();
|
|
137
|
+
if (text.length > 0) {
|
|
138
|
+
return text;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
case 'suggestion': {
|
|
145
|
+
if (block.pending) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
return `<suggestion>${block.text}</suggestion>`;
|
|
149
|
+
}
|
|
150
|
+
case 'select': {
|
|
151
|
+
if (block.pending || block.options.length === 0) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return `<select>${block.options.map((option) => `<option>${option}</option>`).join('')}</select>`;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// TODO(burdon): Need label.
|
|
159
|
+
case 'reference': {
|
|
160
|
+
return `<reference ref="${block.reference.dxn.toString()}">Ref</reference>`;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// case 'toolkit': {
|
|
164
|
+
// return `<toolkit />`;
|
|
165
|
+
// }
|
|
166
|
+
|
|
167
|
+
case 'toolCall': {
|
|
168
|
+
context.updateWidget(block.toolCallId, {
|
|
169
|
+
blocks: [block],
|
|
170
|
+
});
|
|
171
|
+
return `<toolCall id="${block.toolCallId}" />`;
|
|
172
|
+
}
|
|
173
|
+
case 'toolResult': {
|
|
174
|
+
context.updateWidget(block.toolCallId, ({ blocks = [] }: { blocks: ContentBlock.Any[] }) => ({
|
|
175
|
+
blocks: [...blocks, block],
|
|
176
|
+
}));
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
case 'summary': {
|
|
181
|
+
return `<summary>${ContentBlock.createSummaryMessage(block)}</summary>`;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// TODO(burdon): Need stable ID.
|
|
185
|
+
default: {
|
|
186
|
+
return `<json id="${message.id}">\n${JSON.stringify(block)}\n</json>`;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { EditorView } from '@codemirror/view';
|
|
6
|
+
import { describe, it } from '@effect/vitest';
|
|
7
|
+
import { Effect } from 'effect';
|
|
8
|
+
|
|
9
|
+
import { type ContentBlock } from '@dxos/schema';
|
|
10
|
+
|
|
11
|
+
import { createMessage } from '../../testing';
|
|
12
|
+
|
|
13
|
+
import { blockToMarkdown } from './registry';
|
|
14
|
+
import { MessageSyncer, type TextModel } from './sync';
|
|
15
|
+
|
|
16
|
+
class TestDocument implements TextModel {
|
|
17
|
+
private readonly _view = new EditorView({ extensions: [] });
|
|
18
|
+
|
|
19
|
+
get content() {
|
|
20
|
+
return this._view.state.doc.toString();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async reset(text: string) {
|
|
24
|
+
this._view.dispatch({ changes: { from: 0, to: this._view.state.doc.length, insert: text } });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async append(text: string) {
|
|
28
|
+
this._view.dispatch({ changes: { from: this._view.state.doc.length, insert: text } });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
updateWidget(_id: string, _value: any) {}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
describe('reducers', () => {
|
|
35
|
+
it.effect(
|
|
36
|
+
'basic sync',
|
|
37
|
+
Effect.fn(function* ({ expect }) {
|
|
38
|
+
const doc = new TestDocument();
|
|
39
|
+
const syncer = new MessageSyncer(doc, blockToMarkdown);
|
|
40
|
+
|
|
41
|
+
const messages = [
|
|
42
|
+
createMessage('user', [{ _tag: 'text', text: 'Hello' }]),
|
|
43
|
+
createMessage('assistant', [{ _tag: 'text', text: 'Hi there!' }]),
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
syncer.sync(messages);
|
|
47
|
+
expect(doc.content).toEqual(['\n<prompt>Hello</prompt>\n', 'Hi there!', ''].join('\n'));
|
|
48
|
+
|
|
49
|
+
messages[1].blocks.push({ _tag: 'text', text: 'How can I help?' });
|
|
50
|
+
syncer.sync(messages);
|
|
51
|
+
expect(doc.content).toEqual(['\n<prompt>Hello</prompt>\n', 'Hi there!', 'How can I help?', ''].join('\n'));
|
|
52
|
+
}),
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
it.effect(
|
|
56
|
+
'sync with partial updates',
|
|
57
|
+
Effect.fn(function* ({ expect }) {
|
|
58
|
+
const doc = new TestDocument();
|
|
59
|
+
const syncer = new MessageSyncer(doc, blockToMarkdown);
|
|
60
|
+
|
|
61
|
+
const messages = [
|
|
62
|
+
createMessage('user', [{ _tag: 'text', text: 'Hello' }]),
|
|
63
|
+
createMessage('assistant', [{ _tag: 'text', text: 'Hi there!', pending: true }]),
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
syncer.sync(messages);
|
|
67
|
+
expect(doc.content).toEqual(['\n<prompt>Hello</prompt>\n', 'Hi there!'].join('\n'));
|
|
68
|
+
|
|
69
|
+
const block = messages[1].blocks[0] as ContentBlock.Text;
|
|
70
|
+
block.text = 'Hi there! How are you?';
|
|
71
|
+
block.pending = false;
|
|
72
|
+
syncer.sync(messages);
|
|
73
|
+
|
|
74
|
+
messages[1].blocks.push({ _tag: 'text', text: 'How can I help?' });
|
|
75
|
+
syncer.sync(messages);
|
|
76
|
+
expect(doc.content).toEqual(
|
|
77
|
+
['\n<prompt>Hello</prompt>\n', 'Hi there! How are you?', 'How can I help?', ''].join('\n'),
|
|
78
|
+
);
|
|
79
|
+
}),
|
|
80
|
+
);
|
|
81
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { log } from '@dxos/log';
|
|
6
|
+
import { type MarkdownStreamController } from '@dxos/react-ui-components';
|
|
7
|
+
import { type XmlWidgetStateManager } from '@dxos/react-ui-editor';
|
|
8
|
+
import { type ContentBlock, type DataType } from '@dxos/schema';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Update document.
|
|
12
|
+
*/
|
|
13
|
+
export type TextModel = Pick<MarkdownStreamController, 'reset' | 'append' | 'updateWidget'>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Thread context passed to renderer.
|
|
17
|
+
*/
|
|
18
|
+
export class MessageThreadContext implements Pick<MarkdownStreamController, 'updateWidget'> {
|
|
19
|
+
constructor(private readonly _widgetState?: XmlWidgetStateManager) {}
|
|
20
|
+
|
|
21
|
+
updateWidget<T>(id: string, value: T) {
|
|
22
|
+
this._widgetState?.updateWidget(id, value);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Renders a block to markdown.
|
|
28
|
+
*/
|
|
29
|
+
export type BlockRenderer = (
|
|
30
|
+
context: MessageThreadContext,
|
|
31
|
+
message: DataType.Message,
|
|
32
|
+
block: ContentBlock.Any,
|
|
33
|
+
) => string | undefined;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Syncs messages with the editor.
|
|
37
|
+
*/
|
|
38
|
+
export class MessageSyncer {
|
|
39
|
+
private _initialMessageId?: string;
|
|
40
|
+
private _currentMessageIndex = 0;
|
|
41
|
+
private _currentBlockIndex = 0;
|
|
42
|
+
private _currentBlockContent?: string;
|
|
43
|
+
|
|
44
|
+
private readonly _context: MessageThreadContext;
|
|
45
|
+
|
|
46
|
+
constructor(
|
|
47
|
+
private readonly _model: TextModel,
|
|
48
|
+
private readonly _blockRenderer: BlockRenderer,
|
|
49
|
+
) {
|
|
50
|
+
this._context = new MessageThreadContext(this._model);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get context() {
|
|
54
|
+
return this._context;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
reset() {
|
|
58
|
+
log('reset');
|
|
59
|
+
this._initialMessageId = undefined;
|
|
60
|
+
this._currentMessageIndex = 0;
|
|
61
|
+
this._currentBlockIndex = 0;
|
|
62
|
+
this._currentBlockContent = undefined;
|
|
63
|
+
void this._model.reset('');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
sync(messages: DataType.Message[]) {
|
|
67
|
+
log('sync', {
|
|
68
|
+
messages: messages.map((m) => m.blocks.length),
|
|
69
|
+
currentMessageIndex: this._currentMessageIndex,
|
|
70
|
+
currentBlockIndex: this._currentBlockIndex,
|
|
71
|
+
currentBlockContent: this._currentBlockContent,
|
|
72
|
+
});
|
|
73
|
+
if (this._initialMessageId !== messages[0]?.id) {
|
|
74
|
+
this.reset();
|
|
75
|
+
this._initialMessageId = messages[0]?.id;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
let i = this._currentMessageIndex;
|
|
79
|
+
for (const message of messages.slice(this._currentMessageIndex)) {
|
|
80
|
+
if (i > this._currentMessageIndex) {
|
|
81
|
+
this._currentBlockIndex = 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
this._currentMessageIndex = i;
|
|
85
|
+
let j = this._currentBlockIndex;
|
|
86
|
+
for (const block of message.blocks.slice(this._currentBlockIndex)) {
|
|
87
|
+
this._currentBlockIndex = j;
|
|
88
|
+
const currentBlockContent = this._blockRenderer(this._context, message, block);
|
|
89
|
+
if (currentBlockContent) {
|
|
90
|
+
let content: string = '';
|
|
91
|
+
if (this._currentBlockContent && currentBlockContent.startsWith(this._currentBlockContent)) {
|
|
92
|
+
content = currentBlockContent.slice(this._currentBlockContent.length);
|
|
93
|
+
} else {
|
|
94
|
+
content = currentBlockContent;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
void this._model.append(content);
|
|
98
|
+
this._currentBlockContent = currentBlockContent;
|
|
99
|
+
log('append', { message: i, block: j, content });
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (block.pending) {
|
|
103
|
+
return;
|
|
104
|
+
} else {
|
|
105
|
+
this._currentBlockContent = undefined;
|
|
106
|
+
this._currentBlockIndex++;
|
|
107
|
+
}
|
|
108
|
+
j++;
|
|
109
|
+
}
|
|
110
|
+
i++;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -4,19 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
import { type EditorView } from '@codemirror/view';
|
|
6
6
|
import JSON5 from 'json5';
|
|
7
|
-
import React, { useCallback, useEffect,
|
|
7
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
8
8
|
|
|
9
|
-
import { ToolRegistry } from '@dxos/ai';
|
|
10
|
-
import { getSpace } from '@dxos/client/echo';
|
|
11
9
|
import { type Sequence, type SequenceDefinition } from '@dxos/conductor';
|
|
12
10
|
import { Key } from '@dxos/echo';
|
|
13
11
|
import { Toolbar, useTranslation } from '@dxos/react-ui';
|
|
14
12
|
import { useSelectionManager } from '@dxos/react-ui-attention';
|
|
15
13
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
16
14
|
|
|
17
|
-
import { SequenceEditor } from './SequenceEditor';
|
|
18
15
|
import { meta } from '../meta';
|
|
19
16
|
|
|
17
|
+
import { SequenceEditor } from './SequenceEditor';
|
|
18
|
+
|
|
20
19
|
// TODO(burdon): Move to config.
|
|
21
20
|
export const EXA_API_KEY = '9c7e17ff-0c85-4cd5-827a-8b489f139e03';
|
|
22
21
|
|
|
@@ -44,29 +43,29 @@ export const SequenceContainer = ({ sequence }: { sequence: Sequence }) => {
|
|
|
44
43
|
const editorRef = useRef<EditorView | undefined>(undefined);
|
|
45
44
|
|
|
46
45
|
// TODO(burdon): Factor out.
|
|
47
|
-
const toolRegistry = useMemo(() => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}, [sequence]);
|
|
46
|
+
// const toolRegistry = useMemo(() => {
|
|
47
|
+
// const space = getSpace(sequence);
|
|
48
|
+
// if (!space) {
|
|
49
|
+
// return;
|
|
50
|
+
// }
|
|
51
|
+
|
|
52
|
+
// // TODO(burdon): How should the queue be created?
|
|
53
|
+
// // eslint-disable-next-line no-unused-vars
|
|
54
|
+
// const _queue = space.queues.create();
|
|
55
|
+
|
|
56
|
+
// return new ToolRegistry([
|
|
57
|
+
// // createExaTool({ apiKey: EXA_API_KEY }),
|
|
58
|
+
// // createLocalSearchTool(space.db, queue),
|
|
59
|
+
// // createGraphWriterTool({
|
|
60
|
+
// // db: space.db,
|
|
61
|
+
// // queue,
|
|
62
|
+
// // schema: [], // TODO(burdon): Get schema from client/sequence?
|
|
63
|
+
// // onDone: async (objects) => {
|
|
64
|
+
// // await queue.append(objects);
|
|
65
|
+
// // },
|
|
66
|
+
// // }),
|
|
67
|
+
// ]);
|
|
68
|
+
// }, [sequence]);
|
|
70
69
|
|
|
71
70
|
const formatAndSave = useCallback((): SequenceDefinition | undefined => {
|
|
72
71
|
if (!sequence) {
|
|
@@ -116,7 +115,7 @@ export const SequenceContainer = ({ sequence }: { sequence: Sequence }) => {
|
|
|
116
115
|
// }
|
|
117
116
|
// const machine = new SequenceMachine(toolRegistry, sequence).setLogger(new QueueLogger(sequence));
|
|
118
117
|
// await machine.runToCompletion({ aiClient: aiClient.value, input });
|
|
119
|
-
}, [sequence, formatAndSave, selectionManager
|
|
118
|
+
}, [sequence, formatAndSave, selectionManager]);
|
|
120
119
|
|
|
121
120
|
return (
|
|
122
121
|
<StackItem.Content toolbar>
|
|
@@ -4,22 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
|
|
9
9
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
10
10
|
|
|
11
|
-
import { SequenceEditor } from './SequenceEditor';
|
|
12
11
|
import { RESEARCH_SEQUENCE_DEFINITION } from '../../testing';
|
|
13
12
|
import { translations } from '../../translations';
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
import { SequenceEditor } from './SequenceEditor';
|
|
15
|
+
|
|
16
|
+
const meta = {
|
|
16
17
|
title: 'plugins/plugin-assistant/SequenceEditor',
|
|
17
18
|
component: SequenceEditor,
|
|
18
19
|
decorators: [withTheme, withLayout({ fullscreen: true, classNames: 'mli-auto max-is-[50rem] justify-center' })],
|
|
19
20
|
parameters: {
|
|
20
21
|
translations,
|
|
21
22
|
},
|
|
22
|
-
}
|
|
23
|
+
} satisfies Meta<typeof SequenceEditor>;
|
|
23
24
|
|
|
24
25
|
export default meta;
|
|
25
26
|
|
|
@@ -6,7 +6,7 @@ import React, { forwardRef, useImperativeHandle } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { SequenceDefinition } from '@dxos/conductor';
|
|
8
8
|
import { Type } from '@dxos/echo';
|
|
9
|
-
import {
|
|
9
|
+
import { type ThemedClassName, useThemeContext } from '@dxos/react-ui';
|
|
10
10
|
import {
|
|
11
11
|
type EditorView,
|
|
12
12
|
createBasicExtensions,
|
|
@@ -4,24 +4,25 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
import React, { useState } from 'react';
|
|
9
9
|
|
|
10
10
|
import { createSystemPrompt } from '@dxos/assistant';
|
|
11
|
-
import { Template } from '@dxos/blueprints';
|
|
11
|
+
import { Blueprint, Template } from '@dxos/blueprints';
|
|
12
12
|
import { useClient } from '@dxos/react-client';
|
|
13
13
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
14
|
-
import {
|
|
14
|
+
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
15
15
|
import { trim } from '@dxos/util';
|
|
16
16
|
|
|
17
|
-
import { TemplateEditor, type TemplateEditorProps } from './TemplateEditor';
|
|
18
17
|
import { translations } from '../../translations';
|
|
19
18
|
|
|
19
|
+
import { TemplateEditor, type TemplateEditorProps } from './TemplateEditor';
|
|
20
|
+
|
|
20
21
|
const TEMPLATE = trim`
|
|
21
22
|
{{! System Prompt }}
|
|
22
23
|
|
|
23
24
|
You are a machine that is an expert chess player.
|
|
24
|
-
The move history of the current game is: {{history}}
|
|
25
|
+
The move history of the current game is: {{history}}.
|
|
25
26
|
If asked to suggest a move explain why it is a good move.
|
|
26
27
|
|
|
27
28
|
{{#each artifacts}}
|
|
@@ -35,35 +36,47 @@ const TEMPLATE = trim`
|
|
|
35
36
|
|
|
36
37
|
const DefaultStory = ({ source }: TemplateEditorProps & { source: string }) => {
|
|
37
38
|
const client = useClient();
|
|
38
|
-
const [
|
|
39
|
+
const [blueprint] = useState(() => {
|
|
39
40
|
const space = client.spaces.default;
|
|
40
|
-
return space.db.add(
|
|
41
|
+
return space.db.add(
|
|
42
|
+
Blueprint.make({
|
|
43
|
+
key: 'example.com/blueprint/test',
|
|
44
|
+
name: 'Test',
|
|
45
|
+
instructions: Template.make({ source }),
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
41
48
|
});
|
|
42
49
|
|
|
43
|
-
return
|
|
50
|
+
return (
|
|
51
|
+
<TemplateEditor
|
|
52
|
+
classNames='bg-baseSurface max-is-prose is-full'
|
|
53
|
+
id={blueprint.id}
|
|
54
|
+
template={blueprint.instructions}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
44
57
|
};
|
|
45
58
|
|
|
46
|
-
const meta
|
|
59
|
+
const meta = {
|
|
47
60
|
title: 'plugins/plugin-assistant/TemplateEditor',
|
|
48
|
-
component: TemplateEditor,
|
|
61
|
+
component: TemplateEditor as any,
|
|
49
62
|
render: DefaultStory,
|
|
50
63
|
decorators: [
|
|
51
64
|
withClientProvider({
|
|
65
|
+
types: [Blueprint.Blueprint],
|
|
52
66
|
createIdentity: true,
|
|
53
67
|
createSpace: true,
|
|
54
|
-
types: [Template.Template],
|
|
55
68
|
}),
|
|
56
|
-
withLayout({ fullscreen: true,
|
|
69
|
+
withLayout({ fullscreen: true, classNames: 'justify-center bg-deckSurface' }),
|
|
57
70
|
withTheme,
|
|
58
71
|
],
|
|
59
72
|
parameters: {
|
|
60
73
|
translations,
|
|
61
74
|
},
|
|
62
|
-
}
|
|
75
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
63
76
|
|
|
64
77
|
export default meta;
|
|
65
78
|
|
|
66
|
-
type Story =
|
|
79
|
+
type Story = StoryObj<typeof meta>;
|
|
67
80
|
|
|
68
81
|
export const Default: Story = {
|
|
69
82
|
args: {
|