@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
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Signal, batch, computed, signal } from '@preact/signals-core';
|
|
6
|
-
import { Effect, type Layer } from 'effect';
|
|
7
|
-
|
|
8
|
-
import { AiService, DEFAULT_EDGE_MODEL, type ExecutableTool, type GenerateRequest } from '@dxos/ai';
|
|
9
|
-
import { type PromiseIntentDispatcher } from '@dxos/app-framework';
|
|
10
|
-
import { type AiSession, ArtifactDiffResolver, type ContextBinder, type Conversation } from '@dxos/assistant';
|
|
11
|
-
import { type ArtifactDefinition, type Blueprint } from '@dxos/blueprints';
|
|
12
|
-
import { Context } from '@dxos/context';
|
|
13
|
-
import { Obj } from '@dxos/echo';
|
|
14
|
-
import { runAndForwardErrors } from '@dxos/effect';
|
|
15
|
-
import { log } from '@dxos/log';
|
|
16
|
-
import { Filter, type Space, getVersion } from '@dxos/react-client/echo';
|
|
17
|
-
import { DataType } from '@dxos/schema';
|
|
18
|
-
|
|
19
|
-
import type { ChatServices } from './useChatServices';
|
|
20
|
-
|
|
21
|
-
// TODO(burdon): Factor out.
|
|
22
|
-
declare global {
|
|
23
|
-
interface ToolContextExtensions {
|
|
24
|
-
space?: Space;
|
|
25
|
-
dispatch?: PromiseIntentDispatcher;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
type RequestOptions = {
|
|
30
|
-
// Empty for now.
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type ChatProcessorOptions = {
|
|
34
|
-
// TODO(burdon): Change to AiToolkit.
|
|
35
|
-
tools?: readonly ExecutableTool[];
|
|
36
|
-
blueprintRegistry?: Blueprint.Registry;
|
|
37
|
-
|
|
38
|
-
// TODO(dmaretskyi): Remove.
|
|
39
|
-
artifacts?: readonly ArtifactDefinition[];
|
|
40
|
-
extensions?: ToolContextExtensions;
|
|
41
|
-
// TODO(burdon): Remove systemPrompt -- should come from blueprint.
|
|
42
|
-
} & Pick<GenerateRequest, 'model' | 'systemPrompt'>;
|
|
43
|
-
|
|
44
|
-
const defaultOptions: Partial<ChatProcessorOptions> = {
|
|
45
|
-
model: DEFAULT_EDGE_MODEL,
|
|
46
|
-
systemPrompt: 'you are a helpful assistant',
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Handles interactions with the AI service.
|
|
51
|
-
* Maintains a queue of messages and handles streaming responses from the AI service.
|
|
52
|
-
* Executes tools based on AI responses.
|
|
53
|
-
* Supports cancellation of in-progress requests.
|
|
54
|
-
*/
|
|
55
|
-
// TODO(burdon): Rename ChatContext?
|
|
56
|
-
export class ChatProcessor {
|
|
57
|
-
/**
|
|
58
|
-
* Pending messages (incl. the current user request).
|
|
59
|
-
* @reactive
|
|
60
|
-
*/
|
|
61
|
-
private readonly _pending: Signal<DataType.Message[]> = signal([]);
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Current streaming message (from the AI service).
|
|
65
|
-
* @reactive
|
|
66
|
-
*/
|
|
67
|
-
private readonly _streaming: Signal<DataType.Message | undefined> = signal(undefined);
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Streaming state.
|
|
71
|
-
* @reactive
|
|
72
|
-
*/
|
|
73
|
-
public readonly streaming: Signal<boolean> = computed(() => this._streaming.value !== undefined);
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Last error.
|
|
77
|
-
* @reactive
|
|
78
|
-
*/
|
|
79
|
-
public readonly error: Signal<Error | undefined> = signal(undefined);
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Array of Messages (incl. the current message being streamed).
|
|
83
|
-
* @reactive
|
|
84
|
-
*/
|
|
85
|
-
public readonly messages: Signal<DataType.Message[]> = computed(() => {
|
|
86
|
-
const messages = [...this._pending.value];
|
|
87
|
-
if (this._streaming.value) {
|
|
88
|
-
// TODO(dmaretskyi): Replace with Obj.clone.
|
|
89
|
-
// NOTE: We have to clone the message here so that react will re-render.
|
|
90
|
-
messages.push(Obj.make(DataType.Message, this._streaming.value));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return messages;
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
// TODO(burdon): Replace with Toolkit.
|
|
97
|
-
private _tools?: ExecutableTool[];
|
|
98
|
-
|
|
99
|
-
/** Current session. */
|
|
100
|
-
private _session: AiSession | undefined = undefined;
|
|
101
|
-
|
|
102
|
-
constructor(
|
|
103
|
-
// TODO(dmaretskyi): Replace this with effect's ManagedRuntime wrapping this layer.
|
|
104
|
-
private readonly _services: Layer.Layer<ChatServices>,
|
|
105
|
-
private readonly _conversation: Conversation,
|
|
106
|
-
private readonly _options: ChatProcessorOptions = defaultOptions,
|
|
107
|
-
) {
|
|
108
|
-
this._tools = [...(_options.tools ?? [])];
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
get conversation() {
|
|
112
|
-
return this._conversation;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
get context(): ContextBinder {
|
|
116
|
-
return this._conversation.context;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
get blueprintRegistry() {
|
|
120
|
-
return this._options.blueprintRegistry;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
get tools() {
|
|
124
|
-
return this._tools;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* @deprecated Replace with blueprints
|
|
129
|
-
*/
|
|
130
|
-
setTools(tools: ExecutableTool[]): void {
|
|
131
|
-
this._tools = tools;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Make GPT request.
|
|
136
|
-
*/
|
|
137
|
-
async request(message: string, options: RequestOptions = {}): Promise<DataType.Message[]> {
|
|
138
|
-
await using ctx = Context.default(); // Auto-disposed at the end of this block.
|
|
139
|
-
|
|
140
|
-
this._conversation.onBegin.on(ctx, (session) => {
|
|
141
|
-
log.info('onBegin', { session, isDisposed: ctx.disposed });
|
|
142
|
-
|
|
143
|
-
this._session = session;
|
|
144
|
-
ctx.onDispose(() => {
|
|
145
|
-
log.info('onDispose', { session, isDisposed: ctx.disposed });
|
|
146
|
-
if (this._session === session) {
|
|
147
|
-
this._session = undefined;
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
// User message.
|
|
152
|
-
session.userMessage.on((message) => {
|
|
153
|
-
log.info('userMessage', { message });
|
|
154
|
-
this._pending.value = [...this._pending.value, message];
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
// Message complete.
|
|
158
|
-
session.message.on((message) => {
|
|
159
|
-
batch(() => {
|
|
160
|
-
this._pending.value = [...this._pending.value, message];
|
|
161
|
-
this._streaming.value = undefined;
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
// Streaming update (happens before message complete).
|
|
166
|
-
session.update.on((block) => {
|
|
167
|
-
batch(() => {
|
|
168
|
-
if (!this._streaming.value) {
|
|
169
|
-
// TODO(burdon): Hack to create temp message; better for session to send initial partial object?
|
|
170
|
-
this._streaming.value = Obj.make(DataType.Message, {
|
|
171
|
-
created: new Date().toISOString(),
|
|
172
|
-
sender: { role: 'assistant' },
|
|
173
|
-
blocks: [block],
|
|
174
|
-
});
|
|
175
|
-
} else if (this._streaming.value.blocks.at(-1)?.pending === true) {
|
|
176
|
-
this._streaming.value.blocks[this._streaming.value.blocks.length - 1] = block;
|
|
177
|
-
} else {
|
|
178
|
-
this._streaming.value.blocks.push(block);
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
session.block.on((block) => {
|
|
184
|
-
if (!this._streaming.value) {
|
|
185
|
-
// TODO(burdon): Hack to create temp message; better for session to send initial partial object?
|
|
186
|
-
this._streaming.value = Obj.make(DataType.Message, {
|
|
187
|
-
created: new Date().toISOString(),
|
|
188
|
-
sender: { role: 'assistant' },
|
|
189
|
-
blocks: [block],
|
|
190
|
-
});
|
|
191
|
-
} else if (this._streaming.value.blocks.at(-1)?.pending === true) {
|
|
192
|
-
this._streaming.value.blocks[this._streaming.value.blocks.length - 1] = block;
|
|
193
|
-
} else {
|
|
194
|
-
this._streaming.value.blocks.push(block);
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
// TODO(dmaretskyi): Handle tool status reports.
|
|
199
|
-
// session.toolStatusReport.on(({ message, status }) => {
|
|
200
|
-
// const msg = this._pending.peek().find((m) => m.id === message.id);
|
|
201
|
-
// const toolUse = msg?.content.find((block) => block.type === 'tool_use');
|
|
202
|
-
// if (!toolUse) {
|
|
203
|
-
// return;
|
|
204
|
-
// }
|
|
205
|
-
|
|
206
|
-
// const block = msg?.content.find(
|
|
207
|
-
// (block): block is ToolUseContentBlock => block.type === 'tool_use' && block.id === toolUse.id,
|
|
208
|
-
// );
|
|
209
|
-
// if (block) {
|
|
210
|
-
// this._pending.value = this._pending.value.map((m) => {
|
|
211
|
-
// if (m.id === message.id) {
|
|
212
|
-
// return {
|
|
213
|
-
// ...m,
|
|
214
|
-
// content: m.content.map((block) =>
|
|
215
|
-
// block.type === 'tool_use' && block.id === toolUse.id ? { ...block, currentStatus: status } : block,
|
|
216
|
-
// ),
|
|
217
|
-
// };
|
|
218
|
-
// }
|
|
219
|
-
|
|
220
|
-
// return m;
|
|
221
|
-
// });
|
|
222
|
-
// } else {
|
|
223
|
-
// log.warn('no block for status report');
|
|
224
|
-
// }
|
|
225
|
-
// });
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
try {
|
|
229
|
-
const messages = await runAndForwardErrors(
|
|
230
|
-
this._conversation
|
|
231
|
-
.run({
|
|
232
|
-
prompt: message,
|
|
233
|
-
// TODO(burdon): Construct from blueprints?
|
|
234
|
-
systemPrompt: this._options.systemPrompt,
|
|
235
|
-
})
|
|
236
|
-
.pipe(
|
|
237
|
-
//
|
|
238
|
-
Effect.provide(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL)),
|
|
239
|
-
// TODO(dmaretskyi): Move ArtifactDiffResolver upstream.
|
|
240
|
-
Effect.provideService(ArtifactDiffResolver, this._artifactDiffResolver),
|
|
241
|
-
Effect.provide(this._services),
|
|
242
|
-
Effect.tapErrorCause((cause) => {
|
|
243
|
-
log.error('error', { cause });
|
|
244
|
-
return Effect.void;
|
|
245
|
-
}),
|
|
246
|
-
),
|
|
247
|
-
);
|
|
248
|
-
|
|
249
|
-
log('completed', { messages });
|
|
250
|
-
} catch (err) {
|
|
251
|
-
log.catch(err);
|
|
252
|
-
if (err instanceof Error && err.message.includes('Overloaded')) {
|
|
253
|
-
this.error.value = new AiServiceOverloadedError('AI service overloaded', { cause: err });
|
|
254
|
-
} else {
|
|
255
|
-
this.error.value = new Error('AI service error', { cause: err });
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return this._reset();
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Cancel pending requests.
|
|
264
|
-
* @returns Pending requests (incl. the request message).
|
|
265
|
-
*/
|
|
266
|
-
async cancel(): Promise<DataType.Message[]> {
|
|
267
|
-
log.info('cancelling...');
|
|
268
|
-
|
|
269
|
-
// TODO(dmaretskyi): Conversation should handle aborting.
|
|
270
|
-
this._session?.abort();
|
|
271
|
-
return this._reset();
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
private async _reset(): Promise<DataType.Message[]> {
|
|
275
|
-
const messages = this._pending.value;
|
|
276
|
-
batch(() => {
|
|
277
|
-
this._pending.value = [];
|
|
278
|
-
this._streaming.value = undefined;
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
return messages;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
private _artifactDiffResolver: ArtifactDiffResolver.Service = {
|
|
285
|
-
resolve: async (artifacts) => {
|
|
286
|
-
const space = this._options.extensions?.space;
|
|
287
|
-
if (!space) {
|
|
288
|
-
return new Map();
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
const versions = new Map();
|
|
292
|
-
await Promise.all(
|
|
293
|
-
artifacts.map(async (artifact) => {
|
|
294
|
-
const {
|
|
295
|
-
objects: [object],
|
|
296
|
-
} = await space.db.query(Filter.ids(artifact.id)).run();
|
|
297
|
-
if (!object) {
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
versions.set(artifact.id, {
|
|
301
|
-
version: getVersion(object),
|
|
302
|
-
diff: `Current state: ${JSON.stringify(object)}`,
|
|
303
|
-
});
|
|
304
|
-
}),
|
|
305
|
-
);
|
|
306
|
-
return versions;
|
|
307
|
-
},
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// TODO(wittjosiah): Move to ai-service-client.
|
|
312
|
-
export class AiServiceOverloadedError extends Error {
|
|
313
|
-
code = 'AI_SERVICE_OVERLOADED';
|
|
314
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { effect } from '@preact/signals-react';
|
|
6
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
7
|
-
|
|
8
|
-
import { type ContextBinder } from '@dxos/assistant';
|
|
9
|
-
import { Blueprint } from '@dxos/blueprints';
|
|
10
|
-
import { type Space } from '@dxos/client/echo';
|
|
11
|
-
import { Obj, Ref } from '@dxos/echo';
|
|
12
|
-
import { log } from '@dxos/log';
|
|
13
|
-
import { isNonNullable } from '@dxos/util';
|
|
14
|
-
|
|
15
|
-
export type UpdateCallback = (key: string, active: boolean) => void;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Get collection of active blueprints based on the context.
|
|
19
|
-
*/
|
|
20
|
-
export const useBlueprints = (
|
|
21
|
-
space: Space,
|
|
22
|
-
context: ContextBinder,
|
|
23
|
-
blueprintRegistry?: Blueprint.Registry,
|
|
24
|
-
): [Blueprint.Blueprint[], UpdateCallback] => {
|
|
25
|
-
const [blueprints, setBlueprints] = useState<Blueprint.Blueprint[]>([]);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
let t: NodeJS.Timeout;
|
|
28
|
-
effect(() => {
|
|
29
|
-
const refs = [...(context.blueprints.value ?? [])];
|
|
30
|
-
t = setTimeout(async () => {
|
|
31
|
-
const blueprints = (await Ref.Array.loadAll(refs)).filter(isNonNullable);
|
|
32
|
-
setBlueprints(blueprints);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
return () => clearTimeout(t);
|
|
37
|
-
}, [context]);
|
|
38
|
-
|
|
39
|
-
const handleUpdate = useCallback<UpdateCallback>(
|
|
40
|
-
(key: string, active: boolean) => {
|
|
41
|
-
log.info('update', { key, active });
|
|
42
|
-
if (active) {
|
|
43
|
-
// TODO(burdon): Check if already in space.
|
|
44
|
-
const blueprint = blueprintRegistry?.getByKey(key);
|
|
45
|
-
if (blueprint) {
|
|
46
|
-
// TODO(dmaretskyi): This should be done by Obj.clone.
|
|
47
|
-
const { id: _id, ...data } = blueprint;
|
|
48
|
-
const obj = space.db.add(Obj.make(Blueprint.Blueprint, data));
|
|
49
|
-
void context.bind({ blueprints: [Ref.make(obj)] });
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
[space, context],
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
return [blueprints, handleUpdate] as const;
|
|
57
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { describe, test } from 'vitest';
|
|
6
|
-
|
|
7
|
-
import { Filter } from '@dxos/echo';
|
|
8
|
-
|
|
9
|
-
import { createFilter } from './filter-generator';
|
|
10
|
-
import { QueryParser } from './query-parser';
|
|
11
|
-
|
|
12
|
-
describe('FilterGenerator', () => {
|
|
13
|
-
test('simple queries', ({ expect }) => {
|
|
14
|
-
const parser = new QueryParser('type:example.com/type/Person');
|
|
15
|
-
const ast = parser.parse();
|
|
16
|
-
expect(ast).toEqual({
|
|
17
|
-
type: 'binary',
|
|
18
|
-
operator: 'EQ',
|
|
19
|
-
left: {
|
|
20
|
-
type: 'identifier',
|
|
21
|
-
name: 'type',
|
|
22
|
-
},
|
|
23
|
-
right: {
|
|
24
|
-
type: 'literal',
|
|
25
|
-
value: 'example.com/type/Person',
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const filter = createFilter(ast);
|
|
30
|
-
expect(filter).toEqual(Filter.typename('example.com/type/Person'));
|
|
31
|
-
});
|
|
32
|
-
});
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Filter } from '@dxos/echo';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
type BinaryExpression,
|
|
9
|
-
type Expression,
|
|
10
|
-
type Identifier,
|
|
11
|
-
type Literal,
|
|
12
|
-
type RelationalOperator,
|
|
13
|
-
type UnaryExpression,
|
|
14
|
-
} from './types';
|
|
15
|
-
|
|
16
|
-
const relationalOperators: Record<RelationalOperator, (value: any) => Filter<any>> = {
|
|
17
|
-
EQ: Filter.eq,
|
|
18
|
-
LT: Filter.lt,
|
|
19
|
-
GT: Filter.gt,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const specialPredicates: Record<string, (value: string) => Filter<any>> = {
|
|
23
|
-
['type' as const]: Filter.typename,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const createFilter = (ast: Expression): Filter<any> => {
|
|
27
|
-
switch (ast.type) {
|
|
28
|
-
case 'binary': {
|
|
29
|
-
const { operator, left, right } = ast as BinaryExpression;
|
|
30
|
-
|
|
31
|
-
// Handle logical operators.
|
|
32
|
-
if (operator === 'AND') {
|
|
33
|
-
return Filter.and(createFilter(left), createFilter(right));
|
|
34
|
-
}
|
|
35
|
-
if (operator === 'OR') {
|
|
36
|
-
return Filter.or(createFilter(left), createFilter(right));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Handle special predicates (e.g., "type:Person")
|
|
40
|
-
const predicateName = (left as Identifier).name;
|
|
41
|
-
const specialFilter = specialPredicates[predicateName];
|
|
42
|
-
if (specialFilter) {
|
|
43
|
-
return specialFilter((right as Literal).value);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Handle relational operators
|
|
47
|
-
const filterFn = relationalOperators[operator as RelationalOperator];
|
|
48
|
-
if (filterFn) {
|
|
49
|
-
return filterFn((right as Literal).value);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
throw new Error(`Unsupported operator: ${operator}`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
case 'unary': {
|
|
56
|
-
const { operator, argument } = ast as UnaryExpression;
|
|
57
|
-
if (operator === 'NOT') {
|
|
58
|
-
return Filter.not(createFilter(argument));
|
|
59
|
-
}
|
|
60
|
-
throw new Error(`Unsupported unary operator: ${operator}`);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
case 'identifier': {
|
|
64
|
-
const { name } = ast as Identifier;
|
|
65
|
-
return Filter._props({ [name]: true });
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
case 'literal': {
|
|
69
|
-
const { value } = ast as Literal;
|
|
70
|
-
// Handle special '*' value for empty input.
|
|
71
|
-
if (value === '*') {
|
|
72
|
-
return Filter.everything();
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return Filter.eq(value);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
default:
|
|
79
|
-
throw new Error(`Unsupported expression type: ${(ast as any).type}`);
|
|
80
|
-
}
|
|
81
|
-
};
|
package/src/parser/index.ts
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { describe, test } from 'vitest';
|
|
6
|
-
|
|
7
|
-
import { QueryParser } from './query-parser';
|
|
8
|
-
|
|
9
|
-
describe('QueryParser', () => {
|
|
10
|
-
test('empty', ({ expect }) => {
|
|
11
|
-
const parser = new QueryParser('');
|
|
12
|
-
expect(parser.parse()).toEqual({
|
|
13
|
-
type: 'literal',
|
|
14
|
-
value: '*',
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
test('invalid queries', ({ expect }) => {
|
|
19
|
-
const cases = [
|
|
20
|
-
//
|
|
21
|
-
'!',
|
|
22
|
-
'X:',
|
|
23
|
-
':Y',
|
|
24
|
-
'X;Y',
|
|
25
|
-
'x==100',
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
for (const query of cases) {
|
|
29
|
-
const parser = new QueryParser(query);
|
|
30
|
-
expect(() => parser.parse()).toThrow();
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test('valid queries', ({ expect }) => {
|
|
35
|
-
const cases = [
|
|
36
|
-
//
|
|
37
|
-
'',
|
|
38
|
-
'type:Person',
|
|
39
|
-
'$title = "foo"',
|
|
40
|
-
'(type:Person OR type:Organization) AND $title = "DXOS" AND $ts < TODAY',
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
for (const query of cases) {
|
|
44
|
-
const parser = new QueryParser(query);
|
|
45
|
-
expect(parser.parse()).to.exist;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
test('simple queries', ({ expect }) => {
|
|
50
|
-
const cases = [
|
|
51
|
-
{
|
|
52
|
-
query: 'type:Person',
|
|
53
|
-
ast: {
|
|
54
|
-
type: 'binary',
|
|
55
|
-
operator: 'EQ',
|
|
56
|
-
left: { type: 'identifier', name: 'type' },
|
|
57
|
-
right: { type: 'literal', value: 'Person' },
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
query: '$title = "DXOS"',
|
|
62
|
-
ast: {
|
|
63
|
-
type: 'binary',
|
|
64
|
-
operator: 'EQ',
|
|
65
|
-
left: { type: 'identifier', name: '$title' },
|
|
66
|
-
right: { type: 'literal', value: 'DXOS' },
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
query: '(type:Person OR type:Organization) AND $title = "DXOS" AND $ts < TODAY',
|
|
71
|
-
ast: {
|
|
72
|
-
left: {
|
|
73
|
-
left: {
|
|
74
|
-
left: {
|
|
75
|
-
left: {
|
|
76
|
-
name: 'type',
|
|
77
|
-
type: 'identifier',
|
|
78
|
-
},
|
|
79
|
-
operator: 'EQ',
|
|
80
|
-
right: {
|
|
81
|
-
type: 'literal',
|
|
82
|
-
value: 'Person',
|
|
83
|
-
},
|
|
84
|
-
type: 'binary',
|
|
85
|
-
},
|
|
86
|
-
operator: 'OR',
|
|
87
|
-
right: {
|
|
88
|
-
left: {
|
|
89
|
-
name: 'type',
|
|
90
|
-
type: 'identifier',
|
|
91
|
-
},
|
|
92
|
-
operator: 'EQ',
|
|
93
|
-
right: {
|
|
94
|
-
type: 'literal',
|
|
95
|
-
value: 'Organization',
|
|
96
|
-
},
|
|
97
|
-
type: 'binary',
|
|
98
|
-
},
|
|
99
|
-
type: 'binary',
|
|
100
|
-
},
|
|
101
|
-
operator: 'AND',
|
|
102
|
-
right: {
|
|
103
|
-
left: {
|
|
104
|
-
name: '$title',
|
|
105
|
-
type: 'identifier',
|
|
106
|
-
},
|
|
107
|
-
operator: 'EQ',
|
|
108
|
-
right: {
|
|
109
|
-
type: 'literal',
|
|
110
|
-
value: 'DXOS',
|
|
111
|
-
},
|
|
112
|
-
type: 'binary',
|
|
113
|
-
},
|
|
114
|
-
type: 'binary',
|
|
115
|
-
},
|
|
116
|
-
operator: 'AND',
|
|
117
|
-
right: {
|
|
118
|
-
left: {
|
|
119
|
-
name: '$ts',
|
|
120
|
-
type: 'identifier',
|
|
121
|
-
},
|
|
122
|
-
operator: 'LT',
|
|
123
|
-
right: {
|
|
124
|
-
type: 'literal',
|
|
125
|
-
value: 'TODAY',
|
|
126
|
-
},
|
|
127
|
-
type: 'binary',
|
|
128
|
-
},
|
|
129
|
-
type: 'binary',
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
];
|
|
133
|
-
|
|
134
|
-
for (const { query, ast } of cases) {
|
|
135
|
-
const parser = new QueryParser(query);
|
|
136
|
-
expect(parser.parse()).toEqual(ast);
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
});
|