@dxos/plugin-assistant 0.8.4-main.2e9d522 → 0.8.4-main.5ea62a8
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-OWUSKPRK.mjs} +11 -9
- package/dist/lib/browser/BlueprintContainer-OWUSKPRK.mjs.map +7 -0
- package/dist/lib/browser/ChatCompanion-FRCVSLPP.mjs +126 -0
- package/dist/lib/browser/ChatCompanion-FRCVSLPP.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-M3IHQLRS.mjs → ChatContainer-YBJBIVUZ.mjs} +34 -13
- package/dist/lib/browser/ChatContainer-YBJBIVUZ.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-X6VN6QZI.mjs → ChatDialog-MTPJLEHM.mjs} +26 -9
- package/dist/lib/browser/ChatDialog-MTPJLEHM.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-NRZPTUHO.mjs +22 -0
- package/dist/lib/browser/ai-service-NRZPTUHO.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-JTXBKE7O.mjs → app-graph-builder-7AAWTWGA.mjs} +26 -96
- package/dist/lib/browser/app-graph-builder-7AAWTWGA.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-CRZPIA5A.mjs +12 -0
- package/dist/lib/browser/blueprint-definition-CRZPIA5A.mjs.map +7 -0
- package/dist/lib/browser/chunk-6QMISAU6.mjs +167 -0
- package/dist/lib/browser/chunk-6QMISAU6.mjs.map +7 -0
- package/dist/lib/browser/chunk-CFXXQM25.mjs +182 -0
- package/dist/lib/browser/chunk-CFXXQM25.mjs.map +7 -0
- package/dist/lib/browser/chunk-IJAJRAR7.mjs +18 -0
- package/dist/lib/browser/chunk-IJAJRAR7.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-OYFQS7JM.mjs +157 -0
- package/dist/lib/browser/chunk-OYFQS7JM.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/chunk-V5H5CCZA.mjs +218 -0
- package/dist/lib/browser/chunk-V5H5CCZA.mjs.map +7 -0
- package/dist/lib/browser/chunk-XL557TXF.mjs +2332 -0
- package/dist/lib/browser/chunk-XL557TXF.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-E5M3CC46.mjs +22 -0
- package/dist/lib/browser/edge-model-resolver-E5M3CC46.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +154 -67
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-BQO5SVGI.mjs +112 -0
- package/dist/lib/browser/intent-resolver-BQO5SVGI.mjs.map +7 -0
- package/dist/lib/browser/local-model-resolver-VZ5WZQIC.mjs +21 -0
- package/dist/lib/browser/local-model-resolver-VZ5WZQIC.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-VNCD2H7C.mjs +109 -0
- package/dist/lib/browser/react-surface-VNCD2H7C.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-D5IVKNYG.mjs +21 -0
- package/dist/lib/browser/state-D5IVKNYG.mjs.map +7 -0
- package/dist/lib/browser/toolkit-Y5OYX5PO.mjs +191 -0
- package/dist/lib/browser/toolkit-Y5OYX5PO.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -4
- package/dist/lib/node-esm/{TemplateContainer-A3NAQCZE.mjs → BlueprintContainer-UFVWCRN6.mjs} +11 -9
- package/dist/lib/node-esm/BlueprintContainer-UFVWCRN6.mjs.map +7 -0
- package/dist/lib/node-esm/ChatCompanion-ZNRZEKH5.mjs +127 -0
- package/dist/lib/node-esm/ChatCompanion-ZNRZEKH5.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-VZT74PO2.mjs → ChatContainer-TUCITJJW.mjs} +34 -13
- package/dist/lib/node-esm/ChatContainer-TUCITJJW.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-RJ6FDX4Q.mjs → ChatDialog-JLM7RDZQ.mjs} +26 -9
- package/dist/lib/node-esm/ChatDialog-JLM7RDZQ.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-UDEPIPTO.mjs +23 -0
- package/dist/lib/node-esm/ai-service-UDEPIPTO.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-OWSOXFTD.mjs → app-graph-builder-PNAFQUYT.mjs} +26 -96
- package/dist/lib/node-esm/app-graph-builder-PNAFQUYT.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-275J3XL2.mjs +13 -0
- package/dist/lib/node-esm/blueprint-definition-275J3XL2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-2X6VEO32.mjs +2333 -0
- package/dist/lib/node-esm/chunk-2X6VEO32.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-CAQKGW3B.mjs +159 -0
- package/dist/lib/node-esm/chunk-CAQKGW3B.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-FNZJJL7G.mjs +183 -0
- package/dist/lib/node-esm/chunk-FNZJJL7G.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-RLBN4RNR.mjs +168 -0
- package/dist/lib/node-esm/chunk-RLBN4RNR.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UWUUZQWJ.mjs +219 -0
- package/dist/lib/node-esm/chunk-UWUUZQWJ.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-YPXEA46Q.mjs +19 -0
- package/dist/lib/node-esm/chunk-YPXEA46Q.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-SZHDLXCT.mjs +23 -0
- package/dist/lib/node-esm/edge-model-resolver-SZHDLXCT.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +154 -67
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-FIS3T5KP.mjs +113 -0
- package/dist/lib/node-esm/intent-resolver-FIS3T5KP.mjs.map +7 -0
- package/dist/lib/node-esm/local-model-resolver-2KCBKMYA.mjs +22 -0
- package/dist/lib/node-esm/local-model-resolver-2KCBKMYA.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-4NLRKNBU.mjs +110 -0
- package/dist/lib/node-esm/react-surface-4NLRKNBU.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-4VLKPLW3.mjs +22 -0
- package/dist/lib/node-esm/state-4VLKPLW3.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs +192 -0
- package/dist/lib/node-esm/toolkit-2F2OL6WB.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 +19 -0
- package/dist/types/src/capabilities/capabilities.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 +11 -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 +19 -16
- 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/ChatMessage.d.ts +21 -5
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +4 -4
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +108 -72
- 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/ToolBlock.d.ts +12 -12
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +1 -1
- 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/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 +257 -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 +257 -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 +254 -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/Toolbar/Toolbar.d.ts +4 -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 +258 -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 +10 -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 +7 -20
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +4 -5
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- 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 +7 -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/useMatcherExtension.d.ts +3 -0
- package/dist/types/src/hooks/useMatcherExtension.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/hooks/useResolveRef.d.ts +4 -0
- package/dist/types/src/hooks/useResolveRef.d.ts.map +1 -0
- package/dist/types/src/parser/filter-generator.d.ts.map +1 -1
- package/dist/types/src/parser/query-parser.d.ts.map +1 -1
- package/dist/types/src/parser/types.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 +80 -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 +23 -246
- 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/CommentsContainer.d.ts +4 -0
- package/dist/types/src/stories/components/CommentsContainer.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/LoggingContainer.d.ts +4 -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/SurfaceContainer.d.ts +8 -0
- package/dist/types/src/stories/components/SurfaceContainer.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/index.d.ts +11 -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 +5 -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/testing.d.ts +44 -0
- package/dist/types/src/stories/testing/testing.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-data.d.ts +4 -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-sequence.d.ts +0 -4
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +27 -21
- 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 +9 -6
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +97 -77
- package/src/AssistantPlugin.tsx +74 -12
- package/src/capabilities/ai-service.ts +28 -0
- package/src/capabilities/app-graph-builder.ts +43 -134
- package/src/capabilities/blueprint-definition.ts +42 -0
- package/src/capabilities/capabilities.ts +31 -0
- package/src/capabilities/edge-model-resolver.ts +27 -0
- package/src/capabilities/index.ts +9 -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 +171 -165
- 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 +11 -7
- 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/ChatMessage.tsx +214 -148
- package/src/components/ChatThread/ChatThread.stories.tsx +244 -104
- package/src/components/ChatThread/ChatThread.tsx +44 -22
- package/src/components/ChatThread/Link.tsx +23 -0
- package/src/components/ChatThread/ToolBlock.tsx +103 -77
- package/src/components/ChatThread/reducers.ts +151 -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/Toolbar/Toolbar.tsx +20 -0
- package/src/components/Toolbar/index.ts +5 -0
- package/src/components/Toolbar/useChatToolbarActions.ts +125 -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 +43 -0
- package/src/hooks/index.ts +10 -4
- package/src/hooks/useBlueprintRegistry.ts +80 -0
- package/src/hooks/useChatProcessor.ts +20 -97
- package/src/hooks/useChatServices.ts +34 -61
- 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/useMatcherExtension.ts +45 -0
- package/src/hooks/useOnline.ts +10 -0
- package/src/hooks/usePresets.ts +44 -0
- package/src/hooks/useReferencesProvider.ts +11 -9
- package/src/hooks/useResolveRef.ts +33 -0
- package/src/meta.ts +1 -1
- package/src/parser/filter-generator.ts +8 -13
- package/src/parser/query-parser.ts +1 -1
- package/src/parser/types.ts +2 -0
- 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 +304 -0
- package/src/queue-logger.ts +5 -5
- package/src/stories/Chat.stories.tsx +389 -298
- package/src/stories/components/BlueprintContainer.tsx +32 -0
- package/src/stories/components/ChatContainer.tsx +57 -0
- package/src/stories/components/CommentsContainer.tsx +25 -0
- package/src/stories/components/GraphContainer.tsx +118 -0
- package/src/stories/components/LoggingContainer.tsx +21 -0
- package/src/stories/components/MessageContainer.tsx +27 -0
- package/src/stories/components/SurfaceContainer.tsx +52 -0
- package/src/stories/components/TasksContainer.tsx +49 -0
- package/src/stories/components/TokenManagerContainer.tsx +14 -0
- package/src/stories/components/index.ts +15 -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/testing.tsx +254 -0
- package/src/testing/index.ts +2 -1
- package/src/testing/test-data.ts +109 -0
- package/src/testing/test-functions.ts +8 -3
- package/src/testing/test-sequence.ts +2 -27
- package/src/translations.ts +31 -21
- 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/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/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/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/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
|
@@ -2,187 +2,234 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { type FC, Fragment, type PropsWithChildren, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { ErrorBoundary, Surface } from '@dxos/app-framework';
|
|
8
|
+
import { resolveRef } from '@dxos/client';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
9
10
|
import { invariant } from '@dxos/invariant';
|
|
11
|
+
import { DXN, DXN_ECHO_REGEXP } from '@dxos/keys';
|
|
12
|
+
import { useClient } from '@dxos/react-client';
|
|
10
13
|
import { type Space } from '@dxos/react-client/echo';
|
|
11
|
-
import { Button,
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
ToggleContainer as NativeToggleContainer,
|
|
15
|
-
type ToggleContainerProps,
|
|
16
|
-
} from '@dxos/react-ui-components';
|
|
14
|
+
import { Button, IconButton, Link, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
15
|
+
import { MarkdownViewer, ToggleContainer } from '@dxos/react-ui-components';
|
|
16
|
+
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
17
17
|
import { mx } from '@dxos/react-ui-theme';
|
|
18
|
-
import {
|
|
18
|
+
import { ContentBlock, type DataType } from '@dxos/schema';
|
|
19
19
|
import { safeParseJson } from '@dxos/util';
|
|
20
20
|
|
|
21
|
-
import { Json, ToolBlock, isToolMessage } from './ToolBlock';
|
|
22
|
-
import { type ChatProcessor } from '../../hooks';
|
|
23
21
|
import { meta } from '../../meta';
|
|
24
22
|
import { type ChatEvent } from '../Chat';
|
|
25
|
-
import {
|
|
23
|
+
import { Toolbox } from '../Toolbox';
|
|
24
|
+
|
|
25
|
+
import { ObjectLink } from './Link';
|
|
26
|
+
import { type AiToolProvider, ToolBlock, isToolMessage } from './ToolBlock';
|
|
27
|
+
|
|
28
|
+
export const styles = {
|
|
29
|
+
margin: 'pie-4 pis-4',
|
|
30
|
+
padding: 'pis-2 pie-2 pbs-0.5 pbe-0.5',
|
|
31
|
+
panel: 'is-full rounded-sm',
|
|
32
|
+
panelHeader: 'bg-groupSurface',
|
|
33
|
+
panelContent: 'bg-modalSurface',
|
|
34
|
+
json: '!p-1 text-xs bg-transparent',
|
|
35
|
+
};
|
|
26
36
|
|
|
27
37
|
export type ChatMessageProps = ThemedClassName<{
|
|
28
38
|
debug?: boolean;
|
|
29
39
|
space?: Space;
|
|
30
40
|
message: DataType.Message;
|
|
31
|
-
|
|
32
|
-
processor?: ChatProcessor;
|
|
33
|
-
tools?: Tool[];
|
|
41
|
+
toolProvider?: AiToolProvider;
|
|
34
42
|
onEvent?: (event: ChatEvent) => void;
|
|
43
|
+
onDelete?: () => void;
|
|
35
44
|
}>;
|
|
36
45
|
|
|
37
|
-
export const ChatMessage = ({
|
|
46
|
+
export const ChatMessage = ({
|
|
47
|
+
classNames,
|
|
48
|
+
debug,
|
|
49
|
+
space,
|
|
50
|
+
message,
|
|
51
|
+
toolProvider,
|
|
52
|
+
onEvent,
|
|
53
|
+
onDelete,
|
|
54
|
+
}: ChatMessageProps) => {
|
|
38
55
|
const { t } = useTranslation(meta.id);
|
|
39
56
|
const {
|
|
40
57
|
sender: { role },
|
|
41
58
|
blocks,
|
|
42
59
|
} = message;
|
|
43
60
|
|
|
44
|
-
|
|
45
|
-
if (isToolMessage(message)) {
|
|
61
|
+
if (!debug && toolProvider && isToolMessage(message)) {
|
|
46
62
|
return (
|
|
47
|
-
<
|
|
48
|
-
<ToolBlock
|
|
49
|
-
</
|
|
63
|
+
<MessageItem classNames={[styles.margin, 'animate-[fadeIn_0.5s]']}>
|
|
64
|
+
<ToolBlock message={message} toolProvider={toolProvider} />
|
|
65
|
+
</MessageItem>
|
|
50
66
|
);
|
|
51
67
|
}
|
|
52
68
|
|
|
53
69
|
return (
|
|
54
70
|
<>
|
|
55
|
-
{debug && (
|
|
56
|
-
<div className={mx('flex justify-end text-subdued', marginClasses)}>
|
|
57
|
-
<pre className='text-xs'>{JSON.stringify({ created: message.created })}</pre>
|
|
58
|
-
</div>
|
|
59
|
-
)}
|
|
60
|
-
|
|
61
71
|
{blocks.map((block, idx) => {
|
|
62
72
|
// TODO(burdon): Filter empty messages.
|
|
63
73
|
if (block._tag === 'text' && block.text.replaceAll(/\s+/g, '').length === 0) {
|
|
64
74
|
return null;
|
|
65
75
|
}
|
|
66
76
|
|
|
67
|
-
const Component:
|
|
77
|
+
const Component: ContentBlockComponent = components[block._tag] ?? components.default!;
|
|
68
78
|
if (!Component) {
|
|
69
79
|
return null;
|
|
70
80
|
}
|
|
71
81
|
|
|
72
82
|
return (
|
|
73
|
-
<
|
|
74
|
-
<
|
|
75
|
-
<Component space={space}
|
|
76
|
-
</
|
|
77
|
-
|
|
78
|
-
<div className={mx('flex justify-end text-subdued', marginClasses)}>
|
|
79
|
-
<pre className='text-xs'>{JSON.stringify({ block: block._tag })}</pre>
|
|
80
|
-
</div>
|
|
81
|
-
)}
|
|
82
|
-
</Fragment>
|
|
83
|
+
<MessageItem key={idx} classNames={classNames} user={block._tag === 'text' && role === 'user'}>
|
|
84
|
+
<ErrorBoundary data={block}>
|
|
85
|
+
<Component space={space} block={block} onEvent={onEvent} />
|
|
86
|
+
</ErrorBoundary>
|
|
87
|
+
</MessageItem>
|
|
83
88
|
);
|
|
84
89
|
})}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
|
|
91
|
+
{onDelete && (
|
|
92
|
+
<div className={mx('flex justify-end pbs-2 pbe-2 opacity-50 hover:opacity-100', styles.margin)}>
|
|
93
|
+
<IconButton
|
|
94
|
+
classNames='animate-[fadeIn_0.5s]'
|
|
95
|
+
icon='ph--trash--regular'
|
|
96
|
+
iconOnly
|
|
97
|
+
label={t('button delete message')}
|
|
98
|
+
onClick={() => onDelete()}
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
101
|
+
)}
|
|
94
102
|
</>
|
|
95
103
|
);
|
|
96
104
|
};
|
|
97
105
|
|
|
98
|
-
type
|
|
106
|
+
type ContentBlockProps = {
|
|
99
107
|
space?: Space;
|
|
100
108
|
block: ContentBlock.Any;
|
|
101
|
-
/** @deprecated Replace with context */
|
|
102
|
-
processor?: ChatProcessor;
|
|
103
109
|
onEvent?: (event: ChatEvent) => void;
|
|
104
110
|
};
|
|
105
111
|
|
|
106
|
-
type
|
|
112
|
+
type ContentBlockComponent = FC<ContentBlockProps>;
|
|
107
113
|
|
|
108
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Components for rendering content blocks.
|
|
116
|
+
*/
|
|
117
|
+
const components: Partial<Record<ContentBlock.Any['_tag'] | 'default', ContentBlockComponent>> = {
|
|
109
118
|
//
|
|
110
119
|
// Text
|
|
111
120
|
//
|
|
112
|
-
['text' as const]: ({ block }) => {
|
|
121
|
+
['text' as const]: ({ space, block }) => {
|
|
113
122
|
invariant(block._tag === 'text');
|
|
114
|
-
// const [open, setOpen] = useState(block.disposition === 'cot' && block.pending);
|
|
115
|
-
const title = block.disposition ? titles[block.disposition] : undefined;
|
|
116
|
-
if (!title) {
|
|
117
|
-
return <MarkdownViewer content={block.text} />;
|
|
118
|
-
}
|
|
119
123
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
return (
|
|
125
|
+
<MarkdownViewer
|
|
126
|
+
content={preprocessTextContent(block.text)}
|
|
127
|
+
components={{
|
|
128
|
+
a: ({ node: { properties }, children, href, ...props }) => {
|
|
129
|
+
if (space && typeof properties?.href === 'string' && properties?.href?.startsWith('dxn')) {
|
|
130
|
+
try {
|
|
131
|
+
// TODO(burdon): Check valid length (since serialized).
|
|
132
|
+
const dxn = DXN.parse(properties.href);
|
|
133
|
+
return <ObjectLink space={space} dxn={dxn} />;
|
|
134
|
+
} catch {}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// TODO(burdon): Can we revert to the default handler?
|
|
138
|
+
return (
|
|
139
|
+
<Link href={href} target='_blank' rel='noopener noreferrer' {...props}>
|
|
140
|
+
{children}
|
|
141
|
+
</Link>
|
|
142
|
+
);
|
|
143
|
+
},
|
|
144
|
+
img: ({ node: { properties } }) => {
|
|
145
|
+
const client = useClient();
|
|
146
|
+
if (space && typeof properties?.src === 'string' && properties?.src?.startsWith('dxn')) {
|
|
147
|
+
try {
|
|
148
|
+
const dxn = DXN.parse(properties?.src);
|
|
149
|
+
const subject = resolveRef(client, dxn, space);
|
|
150
|
+
const data = useMemo(() => ({ subject }), [subject]);
|
|
151
|
+
return <Surface role='card--transclusion' data={data} limit={1} />;
|
|
152
|
+
} catch {}
|
|
153
|
+
}
|
|
154
|
+
return <img {...properties} />;
|
|
155
|
+
},
|
|
156
|
+
}}
|
|
157
|
+
/>
|
|
158
|
+
);
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
//
|
|
162
|
+
// Suggest
|
|
163
|
+
//
|
|
164
|
+
['suggestion' as const]: ({ block, onEvent }) => {
|
|
165
|
+
invariant(block._tag === 'suggestion');
|
|
127
166
|
|
|
128
167
|
return (
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
<Icon icon={'ph--circle-notch--regular'} classNames='text-subdued animate-spin' size={4} />
|
|
136
|
-
) : undefined
|
|
137
|
-
}
|
|
138
|
-
>
|
|
139
|
-
<MarkdownViewer
|
|
140
|
-
content={block.text}
|
|
141
|
-
classNames={['pbe-2', systemDispositions.includes(block.disposition ?? '') && 'text-sm text-subdued']}
|
|
142
|
-
/>
|
|
143
|
-
</ToggleContainer>
|
|
168
|
+
<IconButton
|
|
169
|
+
icon='ph--lightning--regular'
|
|
170
|
+
label={block.text}
|
|
171
|
+
classNames='text-description'
|
|
172
|
+
onClick={() => onEvent?.({ type: 'submit', text: block.text })}
|
|
173
|
+
/>
|
|
144
174
|
);
|
|
145
175
|
},
|
|
146
176
|
|
|
147
177
|
//
|
|
148
|
-
//
|
|
178
|
+
// Select
|
|
149
179
|
//
|
|
150
|
-
['
|
|
151
|
-
invariant(block._tag === '
|
|
180
|
+
['select' as const]: ({ block, onEvent }) => {
|
|
181
|
+
invariant(block._tag === 'select');
|
|
152
182
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
<
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
183
|
+
return (
|
|
184
|
+
<div className='flex flex-wrap gap-1'>
|
|
185
|
+
{block.options.map((option, idx) => (
|
|
186
|
+
<Button
|
|
187
|
+
classNames={'animate-[fadeIn_0.5s] rounded-sm text-sm'}
|
|
188
|
+
key={idx}
|
|
189
|
+
onClick={() => onEvent?.({ type: 'submit', text: option })}
|
|
190
|
+
>
|
|
191
|
+
{option}
|
|
192
|
+
</Button>
|
|
193
|
+
))}
|
|
194
|
+
</div>
|
|
195
|
+
);
|
|
196
|
+
},
|
|
161
197
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
198
|
+
//
|
|
199
|
+
// Toolkit
|
|
200
|
+
//
|
|
201
|
+
['toolkit' as const]: ({ block }) => {
|
|
202
|
+
invariant(block._tag === 'toolkit');
|
|
168
203
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
204
|
+
const { t } = useTranslation(meta.id);
|
|
205
|
+
return (
|
|
206
|
+
<ToggleContainer.Root classNames={styles.panel} defaultOpen>
|
|
207
|
+
<ToggleContainer.Header classNames={styles.panelHeader} title={t('toolkit label')} />
|
|
208
|
+
<ToggleContainer.Content classNames={styles.panelContent}>
|
|
209
|
+
<Toolbox />
|
|
210
|
+
</ToggleContainer.Content>
|
|
211
|
+
</ToggleContainer.Root>
|
|
212
|
+
);
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
//
|
|
216
|
+
// Summary
|
|
217
|
+
//
|
|
218
|
+
['summary' as const]: ({ block }) => {
|
|
219
|
+
invariant(block._tag === 'summary');
|
|
220
|
+
|
|
221
|
+
const summary = ContentBlock.createSummaryMessage(block, false);
|
|
222
|
+
return <div className='text-sm text-subdued'>{summary}</div>;
|
|
223
|
+
},
|
|
224
|
+
|
|
225
|
+
//
|
|
226
|
+
// JSON
|
|
227
|
+
//
|
|
228
|
+
['json' as const]: ({ block, onEvent }) => {
|
|
229
|
+
invariant(block._tag === 'json');
|
|
185
230
|
|
|
231
|
+
// TODO(burdon): Disposition is deprecated.
|
|
232
|
+
switch (block.disposition) {
|
|
186
233
|
case 'graph': {
|
|
187
234
|
return (
|
|
188
235
|
<div className='flex flex-wrap gap-1'>
|
|
@@ -204,65 +251,84 @@ const components: Partial<Record<ContentBlock.Any['_tag'] | 'default', BlockComp
|
|
|
204
251
|
}
|
|
205
252
|
|
|
206
253
|
default: {
|
|
207
|
-
const title = block.disposition ? titles[block.disposition] : undefined;
|
|
208
254
|
return (
|
|
209
|
-
<ToggleContainer
|
|
210
|
-
<
|
|
211
|
-
|
|
255
|
+
<ToggleContainer.Root classNames={styles.panel}>
|
|
256
|
+
<ToggleContainer.Header classNames={styles.panelHeader} title={block.disposition ?? block._tag} />
|
|
257
|
+
<ToggleContainer.Content classNames={styles.panelContent}>
|
|
258
|
+
<Json data={safeParseJson(block.data ?? block)} classNames={styles.json} />
|
|
259
|
+
</ToggleContainer.Content>
|
|
260
|
+
</ToggleContainer.Root>
|
|
212
261
|
);
|
|
213
262
|
}
|
|
214
263
|
}
|
|
215
264
|
},
|
|
216
265
|
|
|
217
266
|
//
|
|
218
|
-
//
|
|
267
|
+
// Fallback
|
|
219
268
|
//
|
|
220
269
|
default: ({ block }) => {
|
|
221
|
-
let title = titles[block._tag];
|
|
222
|
-
if (block._tag === 'toolCall') {
|
|
223
|
-
title = `Tool [${block.name}]`; // TODO(burdon): Get label from tool.
|
|
224
|
-
} else {
|
|
225
|
-
title = block._tag;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
270
|
return (
|
|
229
|
-
<ToggleContainer
|
|
230
|
-
<
|
|
231
|
-
|
|
271
|
+
<ToggleContainer.Root classNames={styles.panel}>
|
|
272
|
+
<ToggleContainer.Header classNames={styles.panelHeader} title={block._tag} />
|
|
273
|
+
<ToggleContainer.Content classNames={styles.panelContent}>
|
|
274
|
+
<Json data={block} classNames={styles.json} />
|
|
275
|
+
</ToggleContainer.Content>
|
|
276
|
+
</ToggleContainer.Root>
|
|
232
277
|
);
|
|
233
278
|
},
|
|
234
279
|
};
|
|
235
280
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
['cot' as const]: 'Chain of thought',
|
|
239
|
-
['artifact' as const]: 'Artifact',
|
|
240
|
-
['tool_use' as const]: 'Tool request',
|
|
241
|
-
['tool_result' as const]: 'Tool result',
|
|
242
|
-
['tool_list' as const]: 'Tools',
|
|
243
|
-
['artifact-update' as const]: 'Artifact(s) changed',
|
|
281
|
+
export type ChatErrorProps = Pick<ChatMessageProps, 'onEvent'> & {
|
|
282
|
+
error: Error;
|
|
244
283
|
};
|
|
245
284
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
const
|
|
250
|
-
const
|
|
285
|
+
/**
|
|
286
|
+
* Error message with retry.
|
|
287
|
+
*/
|
|
288
|
+
export const ChatError = ({ error, onEvent }: ChatErrorProps) => {
|
|
289
|
+
const { t } = useTranslation(meta.id);
|
|
290
|
+
return (
|
|
291
|
+
<>
|
|
292
|
+
<MessageItem>
|
|
293
|
+
<ToggleContainer.Root classNames={styles.panel}>
|
|
294
|
+
<ToggleContainer.Header classNames={styles.panelHeader} title={error.message || t('error label')} />
|
|
295
|
+
<ToggleContainer.Content classNames={styles.panelContent}>{String(error.cause)}</ToggleContainer.Content>
|
|
296
|
+
</ToggleContainer.Root>
|
|
297
|
+
</MessageItem>
|
|
298
|
+
<MessageItem>
|
|
299
|
+
<IconButton
|
|
300
|
+
classNames='bg-errorSurface text-errorSurfaceText'
|
|
301
|
+
icon='ph--lightning--regular'
|
|
302
|
+
label={t('button retry')}
|
|
303
|
+
onClick={() => onEvent?.({ type: 'retry' })}
|
|
304
|
+
/>
|
|
305
|
+
</MessageItem>
|
|
306
|
+
</>
|
|
307
|
+
);
|
|
308
|
+
};
|
|
251
309
|
|
|
252
|
-
|
|
310
|
+
/**
|
|
311
|
+
* Wrapper for each message.
|
|
312
|
+
*/
|
|
313
|
+
const MessageItem = ({ classNames, children, user }: ThemedClassName<PropsWithChildren<{ user?: boolean }>>) => {
|
|
253
314
|
if (!children) {
|
|
254
315
|
return null;
|
|
255
316
|
}
|
|
256
317
|
|
|
257
318
|
return (
|
|
258
|
-
<div role='list-item' className={mx('flex is-full', user && 'justify-end',
|
|
259
|
-
<div
|
|
319
|
+
<div role='list-item' className={mx('flex is-full', user && 'justify-end', styles.margin, classNames)}>
|
|
320
|
+
<div
|
|
321
|
+
className={mx(user ? ['bg-[--user-fill] text-white dark:text-black rounded-sm', styles.padding] : 'is-full')}
|
|
322
|
+
>
|
|
260
323
|
{children}
|
|
261
324
|
</div>
|
|
262
325
|
</div>
|
|
263
326
|
);
|
|
264
327
|
};
|
|
265
328
|
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
|
|
329
|
+
export const renderObjectLink = (obj: Obj.Any, transclusion?: boolean) =>
|
|
330
|
+
`${transclusion ? '!' : ''}[${Obj.getLabel(obj)}](${Obj.getDXN(obj).toString()})`;
|
|
331
|
+
|
|
332
|
+
// TODO(burdon): Move to parser.
|
|
333
|
+
const preprocessTextContent = (content: string) =>
|
|
334
|
+
content.replaceAll(new RegExp(DXN_ECHO_REGEXP, 'g'), (_, dxn) => `<${dxn}>`);
|