@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,126 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Rx } from '@effect-rx/rx-react';
|
|
6
|
+
import { Effect } from 'effect';
|
|
7
|
+
import { useMemo } from 'react';
|
|
8
|
+
|
|
9
|
+
import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
10
|
+
import { Filter, Obj, Query } from '@dxos/echo';
|
|
11
|
+
import { invariant } from '@dxos/invariant';
|
|
12
|
+
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
13
|
+
import { getSpace, useQuery } from '@dxos/react-client/echo';
|
|
14
|
+
import { MenuBuilder, useMenuActions } from '@dxos/react-ui-menu';
|
|
15
|
+
|
|
16
|
+
import { meta } from '../../meta';
|
|
17
|
+
import { Assistant, AssistantAction } from '../../types';
|
|
18
|
+
|
|
19
|
+
export type ChatToolbarActionsProps = {
|
|
20
|
+
chat: Assistant.Chat;
|
|
21
|
+
companionTo?: Obj.Any;
|
|
22
|
+
onReset?: () => void;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const useChatToolbarActions = ({ chat, companionTo, onReset }: ChatToolbarActionsProps) => {
|
|
26
|
+
const { dispatch } = useIntentDispatcher();
|
|
27
|
+
const space = getSpace(chat);
|
|
28
|
+
const query = companionTo
|
|
29
|
+
? Query.select(Filter.ids(companionTo.id)).targetOf(Assistant.CompanionTo).source()
|
|
30
|
+
: Query.select(Filter.nothing());
|
|
31
|
+
// TODO(wittjosiah): Query in react vs query in rx?
|
|
32
|
+
const chats = useQuery(space, query);
|
|
33
|
+
|
|
34
|
+
return useMenuActions(
|
|
35
|
+
useMemo(
|
|
36
|
+
() =>
|
|
37
|
+
Rx.make(() => {
|
|
38
|
+
const builder = MenuBuilder.make()
|
|
39
|
+
.root({
|
|
40
|
+
label: ['chat toolbar title', { ns: meta.id }],
|
|
41
|
+
})
|
|
42
|
+
.action(
|
|
43
|
+
'new',
|
|
44
|
+
{
|
|
45
|
+
label: ['button new thread', { ns: meta.id }],
|
|
46
|
+
icon: 'ph--plus--regular',
|
|
47
|
+
type: 'new',
|
|
48
|
+
},
|
|
49
|
+
() =>
|
|
50
|
+
Effect.gen(function* () {
|
|
51
|
+
invariant(space);
|
|
52
|
+
const { object } = yield* dispatch(createIntent(AssistantAction.CreateChat, { space }));
|
|
53
|
+
yield* dispatch(createIntent(SpaceAction.AddObject, { object, target: space, hidden: true }));
|
|
54
|
+
if (companionTo) {
|
|
55
|
+
yield* dispatch(
|
|
56
|
+
createIntent(SpaceAction.AddRelation, {
|
|
57
|
+
space,
|
|
58
|
+
schema: Assistant.CompanionTo,
|
|
59
|
+
source: object,
|
|
60
|
+
target: companionTo,
|
|
61
|
+
}),
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
yield* dispatch(createIntent(AssistantAction.SetCurrentChat, { companionTo, chat: object }));
|
|
65
|
+
}
|
|
66
|
+
}).pipe(Effect.runPromise),
|
|
67
|
+
)
|
|
68
|
+
.action(
|
|
69
|
+
'branch',
|
|
70
|
+
{
|
|
71
|
+
label: ['button branch thread', { ns: meta.id }],
|
|
72
|
+
icon: 'ph--git-branch--regular',
|
|
73
|
+
type: 'branch',
|
|
74
|
+
disabled: true,
|
|
75
|
+
},
|
|
76
|
+
() => {},
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
if (chats.length > 0) {
|
|
80
|
+
builder.group(
|
|
81
|
+
'chats',
|
|
82
|
+
{
|
|
83
|
+
label: ['chat history label', { ns: meta.id }],
|
|
84
|
+
icon: 'ph--clock-counter-clockwise--regular',
|
|
85
|
+
selectCardinality: 'single',
|
|
86
|
+
variant: 'dropdownMenu',
|
|
87
|
+
},
|
|
88
|
+
(builder) => {
|
|
89
|
+
chats
|
|
90
|
+
// TODO(wittjosiah): This should be the default sort order.
|
|
91
|
+
.toSorted((a, b) => a.id.localeCompare(b.id))
|
|
92
|
+
.forEach((chat) => {
|
|
93
|
+
builder.action(
|
|
94
|
+
chat.id,
|
|
95
|
+
{
|
|
96
|
+
label: Obj.getLabel(chat) ?? ['object name placeholder', { ns: Assistant.Chat.typename }],
|
|
97
|
+
},
|
|
98
|
+
() =>
|
|
99
|
+
Effect.gen(function* () {
|
|
100
|
+
invariant(companionTo);
|
|
101
|
+
yield* dispatch(createIntent(AssistantAction.SetCurrentChat, { companionTo, chat }));
|
|
102
|
+
}).pipe(Effect.runPromise),
|
|
103
|
+
);
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (onReset) {
|
|
110
|
+
builder.action(
|
|
111
|
+
'reset',
|
|
112
|
+
{
|
|
113
|
+
label: ['button reset', { ns: meta.id }],
|
|
114
|
+
icon: 'ph--trash--regular',
|
|
115
|
+
type: 'reset',
|
|
116
|
+
},
|
|
117
|
+
onReset,
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return builder.build();
|
|
122
|
+
}),
|
|
123
|
+
[chats],
|
|
124
|
+
),
|
|
125
|
+
);
|
|
126
|
+
};
|
|
@@ -4,10 +4,10 @@
|
|
|
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 from 'react';
|
|
9
9
|
|
|
10
|
-
import { IntentPlugin,
|
|
10
|
+
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
11
11
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
12
|
import { capabilities } from '@dxos/assistant-testing';
|
|
13
13
|
import { ChessPlugin } from '@dxos/plugin-chess';
|
|
@@ -17,29 +17,23 @@ import { SpacePlugin } from '@dxos/plugin-space';
|
|
|
17
17
|
import { TablePlugin } from '@dxos/plugin-table';
|
|
18
18
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
19
19
|
|
|
20
|
-
import { Toolbox, type ToolboxProps } from './Toolbox';
|
|
21
20
|
import { translations } from '../../translations';
|
|
22
21
|
|
|
22
|
+
import { Toolbox, type ToolboxProps } from './Toolbox';
|
|
23
|
+
|
|
23
24
|
const DefaultStory = (props: ToolboxProps) => {
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<Toolbox
|
|
27
|
-
{...props}
|
|
28
|
-
artifacts={artifactDefinitions}
|
|
29
|
-
classNames='w-[30rem] h-[15rem] rounded-sm border border-separator py-1'
|
|
30
|
-
/>
|
|
31
|
-
);
|
|
25
|
+
return <Toolbox {...props} classNames='w-[30rem] h-[15rem] rounded-sm border border-separator py-1' />;
|
|
32
26
|
};
|
|
33
27
|
|
|
34
|
-
const meta
|
|
28
|
+
const meta = {
|
|
35
29
|
title: 'plugins/plugin-assistant/Toolbox',
|
|
36
|
-
component: Toolbox,
|
|
30
|
+
component: Toolbox as any,
|
|
37
31
|
render: DefaultStory,
|
|
38
32
|
decorators: [
|
|
39
33
|
withPluginManager({
|
|
40
34
|
plugins: [
|
|
41
35
|
ClientPlugin({
|
|
42
|
-
onClientInitialized: async (
|
|
36
|
+
onClientInitialized: async ({ client }) => {
|
|
43
37
|
await client.halo.createIdentity();
|
|
44
38
|
},
|
|
45
39
|
}),
|
|
@@ -59,10 +53,10 @@ const meta: Meta<typeof Toolbox> = {
|
|
|
59
53
|
layout: 'centered',
|
|
60
54
|
translations,
|
|
61
55
|
},
|
|
62
|
-
}
|
|
56
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
63
57
|
|
|
64
58
|
export default meta;
|
|
65
59
|
|
|
66
|
-
type Story =
|
|
60
|
+
type Story = StoryObj<typeof meta>;
|
|
67
61
|
|
|
68
62
|
export const Default: Story = {};
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { type FC, Fragment, useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { parseToolName, type Tool } from '@dxos/ai';
|
|
8
|
-
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
9
|
-
import { type ArtifactDefinition } from '@dxos/blueprints';
|
|
10
7
|
import { type Blueprint } from '@dxos/blueprints';
|
|
11
8
|
import { type Ref } from '@dxos/echo';
|
|
12
9
|
import { FunctionType } from '@dxos/functions';
|
|
@@ -16,29 +13,19 @@ import { type ThemedClassName } from '@dxos/react-ui';
|
|
|
16
13
|
import { useTranslation } from '@dxos/react-ui';
|
|
17
14
|
import { mx } from '@dxos/react-ui-theme';
|
|
18
15
|
|
|
19
|
-
import { type ChatProcessor } from '../../hooks';
|
|
20
16
|
import { meta } from '../../meta';
|
|
21
|
-
import {
|
|
17
|
+
import { type AiChatProcessor } from '../../processor';
|
|
22
18
|
import { ServiceType } from '../../types';
|
|
23
19
|
|
|
24
20
|
export type ToolboxProps = ThemedClassName<{
|
|
25
|
-
|
|
26
|
-
artifacts?: ArtifactDefinition[];
|
|
27
|
-
services?: { service: ServiceType; tools: Tool[] }[];
|
|
21
|
+
services?: { service: ServiceType }[];
|
|
28
22
|
functions?: FunctionType[];
|
|
23
|
+
// TODO(burdon): Combine into single array.
|
|
24
|
+
blueprints?: readonly Ref.Ref<Blueprint.Blueprint>[];
|
|
29
25
|
activeBlueprints?: readonly Ref.Ref<Blueprint.Blueprint>[];
|
|
30
|
-
striped?: boolean;
|
|
31
26
|
}>;
|
|
32
27
|
|
|
33
|
-
export const Toolbox = ({
|
|
34
|
-
classNames,
|
|
35
|
-
artifacts,
|
|
36
|
-
functions,
|
|
37
|
-
services,
|
|
38
|
-
blueprints,
|
|
39
|
-
activeBlueprints,
|
|
40
|
-
striped,
|
|
41
|
-
}: ToolboxProps) => {
|
|
28
|
+
export const Toolbox = ({ classNames, functions, services, blueprints, activeBlueprints }: ToolboxProps) => {
|
|
42
29
|
const { t } = useTranslation(meta.id);
|
|
43
30
|
|
|
44
31
|
return (
|
|
@@ -49,7 +36,7 @@ export const Toolbox = ({
|
|
|
49
36
|
items={blueprints.map(({ target }) => ({
|
|
50
37
|
name: target?.name ?? '',
|
|
51
38
|
description: target?.description ?? '',
|
|
52
|
-
subitems: target?.tools.map((toolId) => ({ name: `∙ ${
|
|
39
|
+
subitems: target?.tools.map((toolId) => ({ name: `∙ ${safeToolId(toolId)}` })),
|
|
53
40
|
}))}
|
|
54
41
|
/>
|
|
55
42
|
)}
|
|
@@ -60,18 +47,7 @@ export const Toolbox = ({
|
|
|
60
47
|
items={activeBlueprints.map(({ target }) => ({
|
|
61
48
|
name: target?.name ?? '',
|
|
62
49
|
description: target?.description ?? '',
|
|
63
|
-
subitems: target?.tools.map((toolId) => ({ name: `∙ ${
|
|
64
|
-
}))}
|
|
65
|
-
/>
|
|
66
|
-
)}
|
|
67
|
-
|
|
68
|
-
{artifacts && artifacts.length > 0 && (
|
|
69
|
-
<Section
|
|
70
|
-
title='Artifacts'
|
|
71
|
-
items={artifacts.map(({ name, description, tools }) => ({
|
|
72
|
-
name,
|
|
73
|
-
description,
|
|
74
|
-
subitems: tools.map(({ name, description }) => ({ name: `∙ ${parseToolName(name)}`, description })),
|
|
50
|
+
subitems: target?.tools.map((toolId) => ({ name: `∙ ${safeToolId(toolId)}` })),
|
|
75
51
|
}))}
|
|
76
52
|
/>
|
|
77
53
|
)}
|
|
@@ -79,10 +55,10 @@ export const Toolbox = ({
|
|
|
79
55
|
{services && services.length > 0 && (
|
|
80
56
|
<Section
|
|
81
57
|
title='Services'
|
|
82
|
-
items={services.map(({ service: { serviceId, name, description }
|
|
58
|
+
items={services.map(({ service: { serviceId, name, description } }) => ({
|
|
83
59
|
name: name ?? serviceId,
|
|
84
60
|
description,
|
|
85
|
-
subitems: tools.map(({ name, description }) => ({ name: `∙ ${name}`, description })),
|
|
61
|
+
// subitems: tools.map(({ name, description }) => ({ name: `∙ ${name}`, description })),
|
|
86
62
|
}))}
|
|
87
63
|
/>
|
|
88
64
|
)}
|
|
@@ -90,12 +66,6 @@ export const Toolbox = ({
|
|
|
90
66
|
{functions && functions.length > 0 && (
|
|
91
67
|
<Section title='Functions' items={functions.map(({ name, description }) => ({ name, description }))} />
|
|
92
68
|
)}
|
|
93
|
-
|
|
94
|
-
{!blueprints?.length &&
|
|
95
|
-
!activeBlueprints?.length &&
|
|
96
|
-
!artifacts?.length &&
|
|
97
|
-
!services?.length &&
|
|
98
|
-
!functions?.length && <div>{t('no tools')}</div>}
|
|
99
69
|
</div>
|
|
100
70
|
);
|
|
101
71
|
};
|
|
@@ -136,24 +106,21 @@ const Section: FC<{
|
|
|
136
106
|
|
|
137
107
|
export type ToolboxContainerProps = ThemedClassName<{
|
|
138
108
|
space?: Space;
|
|
139
|
-
processor?:
|
|
109
|
+
processor?: AiChatProcessor;
|
|
140
110
|
}>;
|
|
141
111
|
|
|
142
112
|
export const ToolboxContainer = ({ classNames, space, processor }: ToolboxContainerProps) => {
|
|
143
|
-
// Plugin artifacts.
|
|
144
|
-
const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
|
|
145
|
-
|
|
146
113
|
// Registered services.
|
|
147
114
|
const services = useQuery(space, Filter.type(ServiceType));
|
|
148
|
-
const [serviceTools, setServiceTools] = useState<{ service: ServiceType
|
|
115
|
+
const [serviceTools, setServiceTools] = useState<{ service: ServiceType }[]>([]);
|
|
149
116
|
useEffect(() => {
|
|
150
117
|
log('creating service tools...', { services: services.length });
|
|
151
118
|
queueMicrotask(async () => {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
)
|
|
155
|
-
|
|
156
|
-
setServiceTools(tools);
|
|
119
|
+
// TODO(burdon): Fix.
|
|
120
|
+
// const tools = await Promise.all(
|
|
121
|
+
// services.map(async (service) => ({ service, tools: await createToolsFromService(service) })),
|
|
122
|
+
// );
|
|
123
|
+
// setServiceTools(tools);
|
|
157
124
|
});
|
|
158
125
|
}, [services]);
|
|
159
126
|
|
|
@@ -164,9 +131,12 @@ export const ToolboxContainer = ({ classNames, space, processor }: ToolboxContai
|
|
|
164
131
|
<Toolbox
|
|
165
132
|
classNames={classNames}
|
|
166
133
|
blueprints={processor?.context.blueprints.value}
|
|
167
|
-
artifacts={artifactDefinitions}
|
|
168
134
|
services={serviceTools}
|
|
169
135
|
functions={functions}
|
|
170
136
|
/>
|
|
171
137
|
);
|
|
172
138
|
};
|
|
139
|
+
|
|
140
|
+
const safeToolId = (name: string) => {
|
|
141
|
+
return name.split('_').pop();
|
|
142
|
+
};
|
package/src/components/index.ts
CHANGED
|
@@ -6,15 +6,14 @@ import { lazy } from 'react';
|
|
|
6
6
|
|
|
7
7
|
export * from './AssistantSettings';
|
|
8
8
|
export * from './Chat';
|
|
9
|
+
export * from './ChatProgress';
|
|
9
10
|
export * from './PromptSettings';
|
|
10
11
|
export * from './TemplateEditor';
|
|
12
|
+
export * from './Toolbar';
|
|
11
13
|
export * from './Toolbox';
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// https://github.com/microsoft/fluentui/issues/34020
|
|
16
|
-
|
|
15
|
+
export const BlueprintContainer = lazy(() => import('./BlueprintContainer'));
|
|
16
|
+
export const ChatCompanion = lazy(() => import('./ChatCompanion'));
|
|
17
17
|
export const ChatContainer = lazy(() => import('./ChatContainer'));
|
|
18
18
|
export const ChatDialog = lazy(() => import('./ChatDialog'));
|
|
19
19
|
export const SequenceContainer = lazy(() => import('./SequenceContainer'));
|
|
20
|
-
export const TemplateContainer = lazy(() => import('./TemplateContainer'));
|
package/src/events.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { defineEvent } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
7
|
import { meta } from './meta';
|
|
8
8
|
|
|
9
9
|
export namespace AssistantEvents {
|
|
10
|
-
export const
|
|
10
|
+
export const SetupAiServiceProviders = defineEvent(`${meta.id}/event/setup-ai-service-providers`);
|
|
11
11
|
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { AgentStatus } from '@dxos/ai';
|
|
6
|
+
import { Obj, type Ref } from '@dxos/echo';
|
|
7
|
+
import { MESSAGE_PROPERTY_TOOL_CALL_ID } from '@dxos/functions';
|
|
8
|
+
import { type ObjectId } from '@dxos/keys';
|
|
9
|
+
import { LogLevel } from '@dxos/log';
|
|
10
|
+
import { type Commit } from '@dxos/react-ui-components';
|
|
11
|
+
import { ContentBlock, DataType } from '@dxos/schema';
|
|
12
|
+
import { isNotFalsy } from '@dxos/util';
|
|
13
|
+
|
|
14
|
+
// TODO(burdon): Move to assistant.
|
|
15
|
+
|
|
16
|
+
// TODO(burdon): Add colors?
|
|
17
|
+
enum IconType {
|
|
18
|
+
// General status.
|
|
19
|
+
SUCCESS = 'ph--check-circle--regular',
|
|
20
|
+
WARNING = 'ph--warning-circle--regular',
|
|
21
|
+
ERROR = 'ph--x-circle--regular',
|
|
22
|
+
FLAG = 'ph--flag--regular',
|
|
23
|
+
ROCKET = 'ph--rocket--regular',
|
|
24
|
+
TIMER = 'ph--timer--regular',
|
|
25
|
+
|
|
26
|
+
// Interactions.
|
|
27
|
+
USER = 'ph--user--regular',
|
|
28
|
+
USER_INTERACTION = 'ph--user-sound--regular',
|
|
29
|
+
AGENT = 'ph--robot--regular',
|
|
30
|
+
THINKING = 'ph--brain--regular',
|
|
31
|
+
LINK = 'ph--link--regular',
|
|
32
|
+
TOOL = 'ph--wrench--regular',
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Models the execution graph based on a stream of events.
|
|
37
|
+
*/
|
|
38
|
+
export class ExecutionGraph {
|
|
39
|
+
// TODO(dmaretskyi): Evolve the internal state to support chats, functions, circuit workflows, etc.
|
|
40
|
+
private _commits: Commit[] = [];
|
|
41
|
+
private _branchNames = new Set<string>();
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Adds events to the graph.
|
|
45
|
+
*/
|
|
46
|
+
addEvents(events: Obj.Any[]) {
|
|
47
|
+
for (const event of events) {
|
|
48
|
+
if (Obj.instanceOf(DataType.Message, event)) {
|
|
49
|
+
const messageCommits = messageToCommit(event);
|
|
50
|
+
this._commits.push(...messageCommits);
|
|
51
|
+
messageCommits.map((c) => c.branch).forEach((branch) => this._branchNames.add(branch));
|
|
52
|
+
} else if (Obj.instanceOf(AgentStatus, event)) {
|
|
53
|
+
const branch = getBranchName({ parentMessage: event.parentMessage, toolCallId: event.toolCallId });
|
|
54
|
+
this._branchNames.add(branch);
|
|
55
|
+
this._commits.push({
|
|
56
|
+
id: event.id,
|
|
57
|
+
branch,
|
|
58
|
+
message: event.message,
|
|
59
|
+
icon: IconType.FLAG,
|
|
60
|
+
parents:
|
|
61
|
+
event.parentMessage && event.toolCallId
|
|
62
|
+
? [getToolCallId(event.parentMessage, event.toolCallId)]
|
|
63
|
+
: undefined, // TODO(burdon): Fix.
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Returns the current state of the graph.
|
|
71
|
+
*/
|
|
72
|
+
getGraph(lastRequest = false): { branches: string[]; commits: Commit[] } {
|
|
73
|
+
const idx = lastRequest ? this._commits.findLastIndex((c) => c.tags?.includes('user')) : -1;
|
|
74
|
+
const commits = idx === -1 ? this._commits : this._commits.slice(idx);
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
branches: Array.from(this._branchNames),
|
|
78
|
+
commits: commits,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// TODO(burdon): Pass in AiToolProvider.
|
|
84
|
+
const messageToCommit = (message: DataType.Message): Commit[] => {
|
|
85
|
+
return message.blocks
|
|
86
|
+
.map((block, idx) => {
|
|
87
|
+
const branch = getMessageBranch(message);
|
|
88
|
+
const parent = getParentId(message);
|
|
89
|
+
const parents = parent ? [parent] : [];
|
|
90
|
+
switch (block._tag) {
|
|
91
|
+
case 'text':
|
|
92
|
+
if (!block.text.trim().length) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
id: getGenericBlockId(message.id, idx),
|
|
97
|
+
branch,
|
|
98
|
+
parents,
|
|
99
|
+
...(message.sender.role === 'user'
|
|
100
|
+
? {
|
|
101
|
+
icon: IconType.USER,
|
|
102
|
+
tags: ['user'],
|
|
103
|
+
message: 'Processing request...',
|
|
104
|
+
}
|
|
105
|
+
: {
|
|
106
|
+
icon: IconType.AGENT,
|
|
107
|
+
message: `Response (${block.text.split(' ').length} words)`,
|
|
108
|
+
}),
|
|
109
|
+
} satisfies Commit;
|
|
110
|
+
case 'toolCall':
|
|
111
|
+
return {
|
|
112
|
+
id: getToolCallId(message.id, block.toolCallId),
|
|
113
|
+
branch,
|
|
114
|
+
parents,
|
|
115
|
+
icon: IconType.TOOL,
|
|
116
|
+
level: LogLevel.INFO,
|
|
117
|
+
// TODO(burdon): Lookup tool name/description?
|
|
118
|
+
message: `Calling tool (${block.name})`,
|
|
119
|
+
} satisfies Commit;
|
|
120
|
+
case 'toolResult':
|
|
121
|
+
return {
|
|
122
|
+
id: getToolResultId(message.id, block.toolCallId),
|
|
123
|
+
branch,
|
|
124
|
+
parents,
|
|
125
|
+
icon: block.error ? IconType.ERROR : IconType.SUCCESS,
|
|
126
|
+
level: block.error ? LogLevel.ERROR : LogLevel.INFO,
|
|
127
|
+
message: block.error ? 'Tool error: ' + block.error : 'Tool call succeeded',
|
|
128
|
+
} satisfies Commit;
|
|
129
|
+
case 'summary':
|
|
130
|
+
return {
|
|
131
|
+
id: getGenericBlockId(message.id, idx),
|
|
132
|
+
branch,
|
|
133
|
+
parents,
|
|
134
|
+
icon: IconType.ROCKET,
|
|
135
|
+
level: LogLevel.INFO,
|
|
136
|
+
message: ContentBlock.createSummaryMessage(block),
|
|
137
|
+
} satisfies Commit;
|
|
138
|
+
case 'status':
|
|
139
|
+
return {
|
|
140
|
+
id: getGenericBlockId(message.id, idx),
|
|
141
|
+
branch,
|
|
142
|
+
parents,
|
|
143
|
+
message: block.statusText,
|
|
144
|
+
level: LogLevel.INFO,
|
|
145
|
+
icon: IconType.FLAG,
|
|
146
|
+
} satisfies Commit;
|
|
147
|
+
case 'reasoning':
|
|
148
|
+
return {
|
|
149
|
+
id: getGenericBlockId(message.id, idx),
|
|
150
|
+
branch,
|
|
151
|
+
parents,
|
|
152
|
+
message: block.reasoningText ?? 'Thinking...',
|
|
153
|
+
icon: IconType.THINKING,
|
|
154
|
+
} satisfies Commit;
|
|
155
|
+
case 'reference':
|
|
156
|
+
return {
|
|
157
|
+
id: getGenericBlockId(message.id, idx),
|
|
158
|
+
branch,
|
|
159
|
+
parents,
|
|
160
|
+
icon: IconType.LINK,
|
|
161
|
+
message: stringifyRef(block.reference),
|
|
162
|
+
} satisfies Commit;
|
|
163
|
+
default:
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
})
|
|
167
|
+
.filter(isNotFalsy);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const getToolCallId = (messageId: ObjectId, toolCallId: string) => `${messageId}_toolCall_${toolCallId}`;
|
|
171
|
+
|
|
172
|
+
const getToolResultId = (messageId: ObjectId, toolCallId: string) => `${messageId}_toolResult_${toolCallId}`;
|
|
173
|
+
|
|
174
|
+
const getGenericBlockId = (messageId: ObjectId, idx: number) => `${messageId}_block_${idx}`;
|
|
175
|
+
|
|
176
|
+
const getBranchName = (options: { parentMessage?: ObjectId; toolCallId?: string }) => {
|
|
177
|
+
if (options.parentMessage && options.toolCallId) {
|
|
178
|
+
return `${options.parentMessage}_${options.toolCallId}`;
|
|
179
|
+
} else if (options.parentMessage) {
|
|
180
|
+
return options.parentMessage;
|
|
181
|
+
} else {
|
|
182
|
+
return 'main';
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const getMessageBranch = (message: DataType.Message) => {
|
|
187
|
+
return getBranchName({
|
|
188
|
+
parentMessage: message.parentMessage,
|
|
189
|
+
toolCallId: message.properties?.[MESSAGE_PROPERTY_TOOL_CALL_ID],
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const getParentId = (message: DataType.Message) => {
|
|
194
|
+
if (message.parentMessage && message.properties?.[MESSAGE_PROPERTY_TOOL_CALL_ID]) {
|
|
195
|
+
return getToolCallId(message.parentMessage, message.properties[MESSAGE_PROPERTY_TOOL_CALL_ID]);
|
|
196
|
+
} else {
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const stringifyRef = (ref: Ref.Any) => {
|
|
202
|
+
if (ref.target) {
|
|
203
|
+
return stringifyObject(ref.target);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return ref.dxn.asEchoDXN()?.echoId ?? ref.dxn.asQueueDXN()?.objectId ?? '';
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const stringifyObject = (obj: Obj.Any) => {
|
|
210
|
+
return Obj.getLabel(obj) ?? Obj.getTypename(obj) ?? obj.id;
|
|
211
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Effect, Schema } from 'effect';
|
|
6
|
+
|
|
7
|
+
import { defineFunction } from '@dxos/functions';
|
|
8
|
+
import { log } from '@dxos/log';
|
|
9
|
+
|
|
10
|
+
export default defineFunction({
|
|
11
|
+
name: 'dxos.org/function/assistant-analysis',
|
|
12
|
+
description: 'Enter analysis analysis mode.',
|
|
13
|
+
inputSchema: Schema.Struct({
|
|
14
|
+
enable: Schema.Boolean.annotations({ description: 'Enable or disable analysis mode.' }),
|
|
15
|
+
}),
|
|
16
|
+
outputSchema: Schema.Void,
|
|
17
|
+
handler: Effect.fn(function* ({ context, data: { enable } }) {
|
|
18
|
+
log.info('analysis mode', { space: context.space?.id, enable });
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Effect, Schema } from 'effect';
|
|
6
|
+
|
|
7
|
+
import { Filter, Obj, Query } from '@dxos/echo';
|
|
8
|
+
import { DatabaseService, defineFunction } from '@dxos/functions';
|
|
9
|
+
import { trim } from '@dxos/util';
|
|
10
|
+
|
|
11
|
+
// TODO(burdon): Factor out to space plugin.
|
|
12
|
+
export default defineFunction({
|
|
13
|
+
name: 'dxos.org/function/assistant/list',
|
|
14
|
+
description:
|
|
15
|
+
// TODO(wittjosiah): Find a better way to prompt for looking up typenames before querying with them.
|
|
16
|
+
trim`
|
|
17
|
+
Lists the objects of the given type.
|
|
18
|
+
Check the list-schemas tool for available types before calling this function.
|
|
19
|
+
`,
|
|
20
|
+
inputSchema: Schema.Struct({
|
|
21
|
+
typename: Schema.String.annotations({
|
|
22
|
+
description: 'The typename of the objects to list.',
|
|
23
|
+
}),
|
|
24
|
+
}),
|
|
25
|
+
outputSchema: Schema.Struct({
|
|
26
|
+
results: Schema.Array(
|
|
27
|
+
Schema.Struct({
|
|
28
|
+
dxn: Schema.String.annotations({ description: 'The DXN of the object.' }),
|
|
29
|
+
label: Schema.optional(Schema.String.annotations({ description: 'The label of the object.' })),
|
|
30
|
+
}),
|
|
31
|
+
),
|
|
32
|
+
}),
|
|
33
|
+
handler: Effect.fn(function* ({ data: { typename } }) {
|
|
34
|
+
// TODO(wittjosiah): Typename query is not working for dynamic schemas.
|
|
35
|
+
const [schema] = yield* DatabaseService.runSchemaQuery({ typename });
|
|
36
|
+
const filter = schema ? Filter.type(schema) : Filter.typename(typename);
|
|
37
|
+
|
|
38
|
+
const { objects } = yield* DatabaseService.runQuery(Query.select(filter));
|
|
39
|
+
const results = objects.map((object) => ({
|
|
40
|
+
dxn: Obj.getDXN(object).toString(),
|
|
41
|
+
label: Obj.getLabel(object),
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
return { results };
|
|
45
|
+
}),
|
|
46
|
+
});
|