@dxos/plugin-assistant 0.8.4-main.c1de068 → 0.8.4-main.fd6878d
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-H7H4BQ2C.mjs} +11 -9
- package/dist/lib/browser/BlueprintContainer-H7H4BQ2C.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-M3IHQLRS.mjs → ChatContainer-OUVSX5V5.mjs} +35 -13
- package/dist/lib/browser/ChatContainer-OUVSX5V5.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-X6VN6QZI.mjs → ChatDialog-P4FLEOHG.mjs} +21 -7
- package/dist/lib/browser/ChatDialog-P4FLEOHG.mjs.map +7 -0
- package/dist/lib/browser/{SequenceContainer-3UDVKWPA.mjs → SequenceContainer-627OQ557.mjs} +3 -2
- package/dist/lib/browser/SequenceContainer-627OQ557.mjs.map +7 -0
- package/dist/lib/browser/ai-service-7KJ5LXBT.mjs +22 -0
- package/dist/lib/browser/ai-service-7KJ5LXBT.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-JTXBKE7O.mjs → app-graph-builder-AVHHQ3KV.mjs} +17 -74
- package/dist/lib/browser/app-graph-builder-AVHHQ3KV.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs +146 -0
- package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs.map +7 -0
- package/dist/lib/browser/chunk-BRLHDHOF.mjs +244 -0
- package/dist/lib/browser/chunk-BRLHDHOF.mjs.map +7 -0
- package/dist/lib/browser/chunk-HRLMD35M.mjs +191 -0
- package/dist/lib/browser/chunk-HRLMD35M.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-LKP65RPA.mjs +20 -0
- package/dist/lib/browser/{chunk-FDCJSQYF.mjs.map → chunk-LKP65RPA.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-AEAEKWOC.mjs → chunk-NZDCKQ6W.mjs} +12 -21
- package/dist/lib/browser/chunk-NZDCKQ6W.mjs.map +7 -0
- package/dist/lib/browser/chunk-QB7OVS6Z.mjs +16 -0
- package/dist/lib/browser/chunk-QB7OVS6Z.mjs.map +7 -0
- package/dist/lib/browser/{chunk-OWY4CUQY.mjs → chunk-VEBVAHNM.mjs} +799 -813
- package/dist/lib/browser/chunk-VEBVAHNM.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs +24 -0
- package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +96 -51
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-5RMMCMXG.mjs → intent-resolver-MVOIEJXZ.mjs} +33 -12
- package/dist/lib/browser/intent-resolver-MVOIEJXZ.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-66VY37YQ.mjs → react-surface-4HXS3YLT.mjs} +45 -32
- package/dist/lib/browser/react-surface-4HXS3YLT.mjs.map +7 -0
- package/dist/lib/browser/{settings-2DGP3UTS.mjs → settings-G2EZXMWT.mjs} +6 -5
- package/dist/lib/{node-esm/settings-47RYZOU4.mjs.map → browser/settings-G2EZXMWT.mjs.map} +1 -1
- package/dist/lib/browser/toolkit-IW4FBLLB.mjs +105 -0
- package/dist/lib/browser/toolkit-IW4FBLLB.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -4
- package/dist/lib/node-esm/{TemplateContainer-A3NAQCZE.mjs → BlueprintContainer-VH4EE4CM.mjs} +11 -9
- package/dist/lib/node-esm/BlueprintContainer-VH4EE4CM.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-VZT74PO2.mjs → ChatContainer-D5FABDNE.mjs} +35 -13
- package/dist/lib/node-esm/ChatContainer-D5FABDNE.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-RJ6FDX4Q.mjs → ChatDialog-NKWVXHJP.mjs} +21 -7
- package/dist/lib/node-esm/ChatDialog-NKWVXHJP.mjs.map +7 -0
- package/dist/lib/node-esm/{SequenceContainer-RQQH5XOC.mjs → SequenceContainer-EQ5NP2PG.mjs} +3 -2
- package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-LDD32477.mjs +23 -0
- package/dist/lib/node-esm/ai-service-LDD32477.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-OWSOXFTD.mjs → app-graph-builder-RMOUJMMG.mjs} +17 -74
- package/dist/lib/node-esm/app-graph-builder-RMOUJMMG.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs +147 -0
- package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-SENTQAEO.mjs → chunk-3SOC5GOP.mjs} +799 -813
- package/dist/lib/node-esm/chunk-3SOC5GOP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-F7RXCX5Y.mjs +192 -0
- package/dist/lib/node-esm/chunk-F7RXCX5Y.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-2XL6MNPE.mjs → chunk-GAWXJ7K5.mjs} +12 -21
- package/dist/lib/node-esm/chunk-GAWXJ7K5.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-KOC6ESG7.mjs +22 -0
- package/dist/lib/node-esm/{chunk-QN2H2EHV.mjs.map → chunk-KOC6ESG7.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-RD755HN3.mjs +245 -0
- package/dist/lib/node-esm/chunk-RD755HN3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-X6AANUHZ.mjs +17 -0
- package/dist/lib/node-esm/chunk-X6AANUHZ.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs +25 -0
- package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +96 -51
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-YPPYELY3.mjs → intent-resolver-DTDNCX3C.mjs} +33 -12
- package/dist/lib/node-esm/intent-resolver-DTDNCX3C.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-RJMRBR2M.mjs → react-surface-V6JNEZVO.mjs} +45 -32
- package/dist/lib/node-esm/react-surface-V6JNEZVO.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-47RYZOU4.mjs → settings-AIP5FOJG.mjs} +6 -5
- package/dist/lib/{browser/settings-2DGP3UTS.mjs.map → node-esm/settings-AIP5FOJG.mjs.map} +1 -1
- package/dist/lib/node-esm/toolkit-2VNUL77B.mjs +106 -0
- package/dist/lib/node-esm/toolkit-2VNUL77B.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.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +11 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +5 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts +5 -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 +6 -8
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer.d.ts +5 -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/ChatPrompt/ChatOptions.d.ts +13 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +3 -3
- package/dist/types/src/components/ChatPrompt/ChatReferences.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 +4 -3
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +2 -2
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +33 -48
- 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.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 +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/types/src/components/Timeline/Timeline.d.ts +24 -0
- package/dist/types/src/components/Timeline/Timeline.d.ts.map +1 -0
- package/dist/types/src/components/Timeline/Timeline.stories.d.ts +9 -0
- package/dist/types/src/components/Timeline/Timeline.stories.d.ts.map +1 -0
- package/dist/types/src/components/Timeline/index.d.ts +2 -0
- package/dist/types/src/components/Timeline/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +4 -7
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +1 -2
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -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/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/chat-processor.d.ts +28 -42
- package/dist/types/src/hooks/chat-processor.d.ts.map +1 -1
- package/dist/types/src/hooks/errors.d.ts +4 -0
- package/dist/types/src/hooks/errors.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +5 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/presets.d.ts +2 -2
- package/dist/types/src/hooks/presets.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +21 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +7 -14
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +3 -4
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- 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/stories/Chat.stories.d.ts +68 -49
- package/dist/types/src/stories/Chat.stories.d.ts.map +1 -1
- package/dist/types/src/stories/components/BlueprintContainer.d.ts +5 -0
- package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/ChatContainer.d.ts +5 -0
- package/dist/types/src/stories/components/ChatContainer.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 +5 -0
- package/dist/types/src/stories/components/LoggingContainer.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 +5 -0
- package/dist/types/src/stories/components/TasksContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/index.d.ts +8 -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/hooks/index.d.ts +3 -0
- package/dist/types/src/stories/hooks/index.d.ts.map +1 -0
- package/dist/types/src/stories/hooks/useFlush.d.ts +6 -0
- package/dist/types/src/stories/hooks/useFlush.d.ts.map +1 -0
- package/dist/types/src/stories/hooks/useMatcherExtension.d.ts +3 -0
- package/dist/types/src/stories/hooks/useMatcherExtension.d.ts.map +1 -0
- package/dist/types/src/stories/testing/data.d.ts +142 -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 +26 -0
- package/dist/types/src/stories/testing/testing.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.map +1 -1
- package/dist/types/src/tools/function.d.ts.map +1 -1
- package/dist/types/src/tools/openapi.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +6 -10
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +40 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -0
- package/dist/types/src/types/AssistantAction.d.ts +90 -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 -6
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +81 -75
- package/src/AssistantPlugin.tsx +59 -12
- package/src/capabilities/ai-service.ts +28 -0
- package/src/capabilities/app-graph-builder.ts +9 -93
- package/src/capabilities/blueprint-definition.ts +32 -0
- package/src/capabilities/capabilities.ts +22 -0
- package/src/capabilities/edge-model-resolver.ts +29 -0
- package/src/capabilities/index.ts +6 -0
- package/src/capabilities/intent-resolver.ts +24 -9
- package/src/capabilities/react-surface.tsx +29 -22
- package/src/capabilities/toolkit.ts +106 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +1 -1
- package/src/components/BlueprintContainer.tsx +24 -0
- package/src/components/Chat/Chat.tsx +77 -64
- package/src/components/ChatContainer.tsx +37 -13
- package/src/components/ChatDialog.tsx +9 -5
- package/src/components/ChatPrompt/ChatOptions.tsx +59 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +11 -9
- package/src/components/ChatPrompt/index.ts +1 -1
- package/src/components/ChatThread/ChatMessage.tsx +132 -118
- package/src/components/ChatThread/ChatThread.stories.tsx +220 -103
- package/src/components/ChatThread/ChatThread.tsx +2 -2
- package/src/components/ChatThread/Link.tsx +39 -0
- package/src/components/ChatThread/ToolBlock.tsx +20 -16
- package/src/components/SequenceContainer.tsx +2 -1
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +3 -2
- package/src/components/SequenceEditor/SequenceEditor.tsx +1 -1
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +12 -5
- package/src/components/TemplateEditor/TemplateEditor.tsx +15 -12
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +12 -5
- package/src/components/TemplateEditor/TemplateForm.tsx +5 -3
- package/src/components/Timeline/Timeline.stories.tsx +53 -0
- package/src/components/Timeline/Timeline.tsx +159 -0
- package/src/components/Timeline/index.ts +5 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +6 -12
- package/src/components/Toolbox/Toolbox.tsx +16 -40
- package/src/components/index.ts +2 -5
- package/src/events.ts +2 -2
- package/src/functions/analysis.ts +20 -0
- package/src/functions/index.ts +7 -0
- package/src/functions/list.ts +42 -0
- package/src/functions/load.ts +43 -0
- package/src/hooks/chat-processor.ts +123 -177
- package/src/hooks/errors.ts +8 -0
- package/src/hooks/index.ts +5 -1
- package/src/hooks/presets.ts +6 -5
- package/src/hooks/useBlueprintRegistry.ts +79 -0
- package/src/hooks/useChatProcessor.ts +21 -83
- package/src/hooks/useChatServices.ts +35 -54
- package/src/hooks/useOnline.ts +10 -0
- package/src/hooks/usePresets.ts +45 -0
- package/src/hooks/useReferencesProvider.ts +11 -9
- package/src/hooks/useResolveRef.ts +33 -0
- package/src/parser/filter-generator.ts +6 -13
- package/src/parser/query-parser.ts +1 -1
- package/src/queue-logger.ts +5 -5
- package/src/stories/Chat.stories.tsx +238 -299
- package/src/stories/components/BlueprintContainer.tsx +34 -0
- package/src/stories/components/ChatContainer.tsx +80 -0
- package/src/stories/components/GraphContainer.tsx +118 -0
- package/src/stories/components/LoggingContainer.tsx +22 -0
- package/src/stories/components/SurfaceContainer.tsx +62 -0
- package/src/stories/components/TasksContainer.tsx +51 -0
- package/src/stories/components/index.ts +12 -0
- package/src/stories/components/types.ts +11 -0
- package/src/stories/hooks/index.ts +6 -0
- package/src/stories/hooks/useFlush.ts +35 -0
- package/src/stories/hooks/useMatcherExtension.ts +45 -0
- package/src/stories/testing/data.ts +130 -0
- package/src/stories/testing/index.ts +6 -0
- package/src/stories/testing/testing.tsx +162 -0
- package/src/testing/test-functions.ts +8 -3
- package/src/testing/test-sequence.ts +1 -1
- package/src/tools/function.ts +4 -1
- package/src/tools/openapi.test.ts +7 -5
- package/src/tools/openapi.ts +4 -1
- package/src/translations.ts +8 -10
- package/src/types/Assistant.ts +59 -0
- package/src/types/AssistantAction.ts +54 -0
- package/src/types/defs.ts +5 -0
- package/src/types/index.ts +4 -1
- 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.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.map +0 -7
- package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs.map +0 -7
- 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.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.map +0 -7
- package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs.map +0 -7
- 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/TemplateContainer.d.ts +0 -8
- package/dist/types/src/components/TemplateContainer.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/useBlueprints.d.ts +0 -9
- package/dist/types/src/hooks/useBlueprints.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/TemplateContainer.tsx +0 -24
- package/src/hooks/chat-processor.test.ts +0 -16
- package/src/hooks/useBlueprints.ts +0 -57
- package/src/types/schema.ts +0 -95
|
@@ -2,40 +2,64 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useEffect } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, useCapability } from '@dxos/app-framework';
|
|
8
|
-
import { type AssociatedArtifact } from '@dxos/blueprints';
|
|
9
8
|
import { getSpace } from '@dxos/client/echo';
|
|
10
9
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
10
|
+
import { type MaybePromise } from '@dxos/util';
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
|
|
12
|
+
import {
|
|
13
|
+
type AiChatProcessor,
|
|
14
|
+
useBlueprintRegistry,
|
|
15
|
+
useChatProcessor,
|
|
16
|
+
useChatServices,
|
|
17
|
+
useOnline,
|
|
18
|
+
usePresets,
|
|
19
|
+
} from '../hooks';
|
|
14
20
|
import { meta } from '../meta';
|
|
15
21
|
import { type Assistant } from '../types';
|
|
16
22
|
|
|
23
|
+
import { Chat } from './Chat';
|
|
24
|
+
|
|
17
25
|
export type ChatContainerProps = {
|
|
18
|
-
role: string;
|
|
19
26
|
chat: Assistant.Chat;
|
|
20
|
-
|
|
27
|
+
role?: string;
|
|
28
|
+
onProcessorReady?: (processor: AiChatProcessor) => MaybePromise<void>;
|
|
21
29
|
};
|
|
22
30
|
|
|
23
|
-
export const ChatContainer = ({
|
|
31
|
+
export const ChatContainer = ({ chat, onProcessorReady }: ChatContainerProps) => {
|
|
24
32
|
const space = getSpace(chat);
|
|
25
33
|
const settings = useCapability(Capabilities.SettingsStore).getStore<Assistant.Settings>(meta.id)?.value;
|
|
26
34
|
const services = useChatServices({ space });
|
|
27
|
-
const
|
|
28
|
-
|
|
35
|
+
const [online, setOnline] = useOnline();
|
|
36
|
+
const { preset, ...chatProps } = usePresets(online);
|
|
37
|
+
const blueprintRegistry = useBlueprintRegistry();
|
|
38
|
+
const processor = useChatProcessor({ space, chat, preset, services, blueprintRegistry, settings });
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (processor && onProcessorReady) {
|
|
42
|
+
const timeout = setTimeout(() => onProcessorReady(processor));
|
|
43
|
+
return () => clearTimeout(timeout);
|
|
44
|
+
}
|
|
45
|
+
}, [processor, onProcessorReady]);
|
|
46
|
+
|
|
47
|
+
if (!chat || !processor) {
|
|
29
48
|
return null;
|
|
30
49
|
}
|
|
31
50
|
|
|
32
|
-
// TODO(burdon): Add attention attributes.
|
|
33
51
|
return (
|
|
34
52
|
<StackItem.Content classNames='container-max-width'>
|
|
35
|
-
<Chat.Root chat={chat} processor={processor}
|
|
53
|
+
<Chat.Root chat={chat} processor={processor}>
|
|
36
54
|
<Chat.Thread />
|
|
37
|
-
<div className='
|
|
38
|
-
<Chat.Prompt
|
|
55
|
+
<div className='p-2'>
|
|
56
|
+
<Chat.Prompt
|
|
57
|
+
{...chatProps}
|
|
58
|
+
classNames='p-2 border border-transparent rounded-md'
|
|
59
|
+
preset={preset?.id}
|
|
60
|
+
online={online}
|
|
61
|
+
onChangeOnline={setOnline}
|
|
62
|
+
/>
|
|
39
63
|
</div>
|
|
40
64
|
</Chat.Root>
|
|
41
65
|
</StackItem.Content>
|
|
@@ -4,16 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Capabilities, useCapability } from '@dxos/app-framework';
|
|
8
8
|
import { getSpace } from '@dxos/client/echo';
|
|
9
9
|
import { useTranslation } from '@dxos/react-ui';
|
|
10
10
|
import { ChatDialog as NativeChatDialog } from '@dxos/react-ui-chat';
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
import { useChatProcessor, useChatServices } from '../hooks';
|
|
12
|
+
import { useBlueprintRegistry, useChatProcessor, useChatServices, useOnline, usePresets } from '../hooks';
|
|
14
13
|
import { meta } from '../meta';
|
|
15
14
|
import { type Assistant } from '../types';
|
|
16
15
|
|
|
16
|
+
import { Chat, type ChatRootProps } from './Chat';
|
|
17
|
+
|
|
17
18
|
export type ChatDialogProps = {
|
|
18
19
|
chat?: Assistant.Chat;
|
|
19
20
|
};
|
|
@@ -24,7 +25,10 @@ export const ChatDialog = ({ chat }: ChatDialogProps) => {
|
|
|
24
25
|
const space = getSpace(chat);
|
|
25
26
|
const settings = useCapability(Capabilities.SettingsStore).getStore<Assistant.Settings>(meta.id)?.value;
|
|
26
27
|
const services = useChatServices({ space });
|
|
27
|
-
const
|
|
28
|
+
const [online, setOnline] = useOnline();
|
|
29
|
+
const { preset, ...chatProps } = usePresets(online);
|
|
30
|
+
const blueprintRegistry = useBlueprintRegistry();
|
|
31
|
+
const processor = useChatProcessor({ space, chat, preset, services, blueprintRegistry, settings });
|
|
28
32
|
|
|
29
33
|
// TODO(burdon): Refocus when open.
|
|
30
34
|
const [open, setOpen] = useState(true);
|
|
@@ -54,7 +58,7 @@ export const ChatDialog = ({ chat }: ChatDialogProps) => {
|
|
|
54
58
|
<Chat.Thread />
|
|
55
59
|
</NativeChatDialog.Content>
|
|
56
60
|
<NativeChatDialog.Footer>
|
|
57
|
-
<Chat.Prompt expandable />
|
|
61
|
+
<Chat.Prompt {...chatProps} preset={preset?.id} online={online} onChangeOnline={setOnline} expandable />
|
|
58
62
|
</NativeChatDialog.Footer>
|
|
59
63
|
</NativeChatDialog.Root>
|
|
60
64
|
</Chat.Root>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type AiContextBinder } from '@dxos/assistant';
|
|
8
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
9
|
+
import { DropdownMenu, Icon, IconButton, useTranslation } from '@dxos/react-ui';
|
|
10
|
+
|
|
11
|
+
import { useBlueprints } from '../../hooks';
|
|
12
|
+
import { meta } from '../../meta';
|
|
13
|
+
|
|
14
|
+
export type ChatOptionsProps = {
|
|
15
|
+
context?: AiContextBinder;
|
|
16
|
+
blueprintRegistry?: Blueprint.Registry;
|
|
17
|
+
onUpdateBlueprint?: (key: string, isActive: boolean) => void;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Manages the runtime context for the chat.
|
|
22
|
+
*/
|
|
23
|
+
// TODO(burdon): Refactor this as a Dialog (and move the object selector here also).
|
|
24
|
+
export const ChatOptions = ({ context, blueprintRegistry, onUpdateBlueprint }: ChatOptionsProps) => {
|
|
25
|
+
const { t } = useTranslation(meta.id);
|
|
26
|
+
|
|
27
|
+
// TODO(burdon): Possibly constrain query as registry grows.
|
|
28
|
+
const blueprints = useMemo(() => blueprintRegistry?.query() ?? [], [blueprintRegistry]);
|
|
29
|
+
|
|
30
|
+
const activeBlueprints = useBlueprints({ context });
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<DropdownMenu.Root>
|
|
34
|
+
<DropdownMenu.Trigger asChild>
|
|
35
|
+
<IconButton icon='ph--plus--regular' variant='ghost' size={5} iconOnly label={t('button add blueprint')} />
|
|
36
|
+
</DropdownMenu.Trigger>
|
|
37
|
+
<DropdownMenu.Portal>
|
|
38
|
+
<DropdownMenu.Content side='left'>
|
|
39
|
+
<DropdownMenu.Viewport>
|
|
40
|
+
{blueprints.map((blueprint) => (
|
|
41
|
+
<DropdownMenu.CheckboxItem
|
|
42
|
+
key={blueprint.key}
|
|
43
|
+
checked={activeBlueprints?.get(blueprint.key) !== undefined}
|
|
44
|
+
onCheckedChange={(checked) => onUpdateBlueprint?.(blueprint.key, !!checked)}
|
|
45
|
+
classNames='gap-2'
|
|
46
|
+
>
|
|
47
|
+
<div className='flex-1 min-is-0'>{blueprint.name}</div>
|
|
48
|
+
<DropdownMenu.ItemIndicator asChild>
|
|
49
|
+
<Icon icon='ph--check--regular' size={4} />
|
|
50
|
+
</DropdownMenu.ItemIndicator>
|
|
51
|
+
</DropdownMenu.CheckboxItem>
|
|
52
|
+
))}
|
|
53
|
+
</DropdownMenu.Viewport>
|
|
54
|
+
<DropdownMenu.Arrow />
|
|
55
|
+
</DropdownMenu.Content>
|
|
56
|
+
</DropdownMenu.Portal>
|
|
57
|
+
</DropdownMenu.Root>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type AiContextBinder } from '@dxos/assistant';
|
|
8
8
|
import { type Space } from '@dxos/client/echo';
|
|
9
9
|
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
10
10
|
import { type ThemedClassName, useAsyncState, useTranslation } from '@dxos/react-ui';
|
|
@@ -16,26 +16,28 @@ import { meta } from '../../meta';
|
|
|
16
16
|
|
|
17
17
|
export type ChatReferencesProps = ThemedClassName<{
|
|
18
18
|
space: Space;
|
|
19
|
-
context:
|
|
20
|
-
onUpdate?: (
|
|
19
|
+
context: AiContextBinder;
|
|
20
|
+
onUpdate?: (dxns: string[]) => void;
|
|
21
21
|
}>;
|
|
22
22
|
|
|
23
23
|
export const ChatReferences = ({ classNames, space, context, onUpdate }: ChatReferencesProps) => {
|
|
24
|
-
const { t
|
|
24
|
+
const { t } = useTranslation(meta.id);
|
|
25
25
|
|
|
26
26
|
const [items] = useAsyncState<TagPickerItemData[]>(async () => {
|
|
27
27
|
const objects = await Ref.Array.loadAll(context.objects.value ?? []);
|
|
28
|
-
return objects
|
|
28
|
+
return objects
|
|
29
|
+
.filter(isNonNullable)
|
|
30
|
+
.map((obj) => ({ id: Obj.getDXN(obj).toString(), label: Obj.getLabel(obj) ?? Obj.getTypename(obj) ?? obj.id }));
|
|
29
31
|
}, [context]);
|
|
30
32
|
|
|
31
33
|
const handleSearch = useCallback<NonNullable<TagPickerOptions['onSearch']>>(
|
|
32
|
-
(text,
|
|
34
|
+
(text, dxns) => {
|
|
33
35
|
// TODO(burdon): Filter by Item tag (e.g., exclude "contacts") and Query by object label.
|
|
34
36
|
// TODO(burdon): Change to Filter.text().
|
|
35
37
|
const objects = space.db.query(Filter.everything()).runSync();
|
|
36
38
|
return objects
|
|
37
|
-
.map(({ object }) => ({ id: object.
|
|
38
|
-
.filter(({ id, label }) => !
|
|
39
|
+
.map(({ object }) => ({ id: Obj.getDXN(object).toString(), label: Obj.getLabel(object) ?? '' }))
|
|
40
|
+
.filter(({ id, label }) => !dxns.includes(id) && label.toLocaleLowerCase().includes(text.toLocaleLowerCase()));
|
|
39
41
|
},
|
|
40
42
|
[space],
|
|
41
43
|
);
|
|
@@ -44,7 +46,7 @@ export const ChatReferences = ({ classNames, space, context, onUpdate }: ChatRef
|
|
|
44
46
|
<TagPicker
|
|
45
47
|
classNames={mx('h-[1.75rem] text-sm', classNames)}
|
|
46
48
|
mode='multi-select'
|
|
47
|
-
|
|
49
|
+
placeholder={t('context objects placeholder')}
|
|
48
50
|
items={items}
|
|
49
51
|
onSearch={handleSearch}
|
|
50
52
|
onUpdate={onUpdate}
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { type FC, Fragment, type PropsWithChildren } from 'react';
|
|
6
6
|
|
|
7
7
|
import { type Tool } from '@dxos/ai';
|
|
8
|
-
import { Surface } from '@dxos/app-framework';
|
|
8
|
+
import { ErrorBoundary, Surface } from '@dxos/app-framework';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
9
10
|
import { invariant } from '@dxos/invariant';
|
|
11
|
+
import { DXN, DXN_ECHO_REGEXP } from '@dxos/keys';
|
|
10
12
|
import { type Space } from '@dxos/react-client/echo';
|
|
11
|
-
import { Button,
|
|
13
|
+
import { Button, IconButton, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
12
14
|
import {
|
|
13
15
|
MarkdownViewer,
|
|
14
16
|
ToggleContainer as NativeToggleContainer,
|
|
@@ -18,35 +20,39 @@ import { mx } from '@dxos/react-ui-theme';
|
|
|
18
20
|
import { type ContentBlock, type DataType } from '@dxos/schema';
|
|
19
21
|
import { safeParseJson } from '@dxos/util';
|
|
20
22
|
|
|
21
|
-
import { Json, ToolBlock, isToolMessage } from './ToolBlock';
|
|
22
|
-
import { type ChatProcessor } from '../../hooks';
|
|
23
23
|
import { meta } from '../../meta';
|
|
24
24
|
import { type ChatEvent } from '../Chat';
|
|
25
|
-
import {
|
|
25
|
+
import { Toolbox } from '../Toolbox';
|
|
26
|
+
|
|
27
|
+
import { ObjectLink } from './Link';
|
|
28
|
+
import { Json, ToolBlock, isToolMessage } from './ToolBlock';
|
|
29
|
+
|
|
30
|
+
const panelClasses = 'flex flex-col is-full bg-activeSurface rounded-sm';
|
|
31
|
+
const marginClasses = 'pie-4 pis-4';
|
|
32
|
+
const paddingClasses = 'pis-2 pie-2 pbs-0.5 pbe-0.5';
|
|
26
33
|
|
|
27
34
|
export type ChatMessageProps = ThemedClassName<{
|
|
28
35
|
debug?: boolean;
|
|
29
36
|
space?: Space;
|
|
30
37
|
message: DataType.Message;
|
|
31
|
-
// TODO(burdon): Move to context.
|
|
32
|
-
processor?: ChatProcessor;
|
|
33
38
|
tools?: Tool[];
|
|
34
39
|
onEvent?: (event: ChatEvent) => void;
|
|
40
|
+
onDelete?: () => void;
|
|
35
41
|
}>;
|
|
36
42
|
|
|
37
|
-
export const ChatMessage = ({ classNames, debug, space, message,
|
|
43
|
+
export const ChatMessage = ({ classNames, debug, space, message, tools, onEvent, onDelete }: ChatMessageProps) => {
|
|
38
44
|
const { t } = useTranslation(meta.id);
|
|
39
45
|
const {
|
|
40
46
|
sender: { role },
|
|
41
47
|
blocks,
|
|
42
48
|
} = message;
|
|
43
49
|
|
|
44
|
-
// TODO(burdon):
|
|
50
|
+
// TODO(burdon): Consolidate tools upstream?
|
|
45
51
|
if (isToolMessage(message)) {
|
|
46
52
|
return (
|
|
47
|
-
<
|
|
53
|
+
<MessageItem classNames={mx(classNames, 'animate-[fadeIn_0.5s]')}>
|
|
48
54
|
<ToolBlock classNames={panelClasses} message={message} tools={tools} />
|
|
49
|
-
</
|
|
55
|
+
</MessageItem>
|
|
50
56
|
);
|
|
51
57
|
}
|
|
52
58
|
|
|
@@ -64,16 +70,18 @@ export const ChatMessage = ({ classNames, debug, space, message, processor, tool
|
|
|
64
70
|
return null;
|
|
65
71
|
}
|
|
66
72
|
|
|
67
|
-
const Component:
|
|
73
|
+
const Component: ContentBlockComponent = components[block._tag] ?? components.default!;
|
|
68
74
|
if (!Component) {
|
|
69
75
|
return null;
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
return (
|
|
73
79
|
<Fragment key={idx}>
|
|
74
|
-
<
|
|
75
|
-
<
|
|
76
|
-
|
|
80
|
+
<MessageItem classNames={classNames} user={block._tag === 'text' && role === 'user'}>
|
|
81
|
+
<ErrorBoundary data={block}>
|
|
82
|
+
<Component space={space} block={block} onEvent={onEvent} />
|
|
83
|
+
</ErrorBoundary>
|
|
84
|
+
</MessageItem>
|
|
77
85
|
{debug && (
|
|
78
86
|
<div className={mx('flex justify-end text-subdued', marginClasses)}>
|
|
79
87
|
<pre className='text-xs'>{JSON.stringify({ block: block._tag })}</pre>
|
|
@@ -82,64 +90,116 @@ export const ChatMessage = ({ classNames, debug, space, message, processor, tool
|
|
|
82
90
|
</Fragment>
|
|
83
91
|
);
|
|
84
92
|
})}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
|
|
94
|
+
{onDelete && (
|
|
95
|
+
<div className={mx('flex justify-end pbs-2 pbe-2 opacity-50 hover:opacity-100', marginClasses)}>
|
|
96
|
+
<IconButton
|
|
97
|
+
classNames='animate-[fadeIn_0.5s]'
|
|
98
|
+
icon='ph--trash--regular'
|
|
99
|
+
iconOnly
|
|
100
|
+
label={t('button delete message')}
|
|
101
|
+
onClick={() => onDelete()}
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
)}
|
|
94
105
|
</>
|
|
95
106
|
);
|
|
96
107
|
};
|
|
97
108
|
|
|
98
|
-
type
|
|
109
|
+
type ContentBlockProps = {
|
|
99
110
|
space?: Space;
|
|
100
111
|
block: ContentBlock.Any;
|
|
101
|
-
/** @deprecated Replace with context */
|
|
102
|
-
processor?: ChatProcessor;
|
|
103
112
|
onEvent?: (event: ChatEvent) => void;
|
|
104
113
|
};
|
|
105
114
|
|
|
106
|
-
type
|
|
115
|
+
type ContentBlockComponent = FC<ContentBlockProps>;
|
|
107
116
|
|
|
108
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Components for rendering content blocks.
|
|
119
|
+
*/
|
|
120
|
+
const components: Partial<Record<ContentBlock.Any['_tag'] | 'default', ContentBlockComponent>> = {
|
|
109
121
|
//
|
|
110
122
|
// Text
|
|
111
123
|
//
|
|
112
|
-
['text' as const]: ({ block }) => {
|
|
124
|
+
['text' as const]: ({ space, block }) => {
|
|
113
125
|
invariant(block._tag === 'text');
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
126
|
+
return (
|
|
127
|
+
<MarkdownViewer
|
|
128
|
+
content={preprocessTextContent(block.text)}
|
|
129
|
+
components={{
|
|
130
|
+
a: ({ node: { properties }, children, href, ...props }) => {
|
|
131
|
+
if (space && typeof properties?.href === 'string' && properties?.href?.startsWith('dxn')) {
|
|
132
|
+
try {
|
|
133
|
+
// TODO(burdon): Check valid length (since serialized).
|
|
134
|
+
const dxn = DXN.parse(properties.href);
|
|
135
|
+
return <ObjectLink space={space} dxn={dxn} />;
|
|
136
|
+
} catch {}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// TODO(burdon): Can we revert to the default handler?
|
|
140
|
+
return (
|
|
141
|
+
<a
|
|
142
|
+
href={href}
|
|
143
|
+
className='text-primary-500 hover:text-primary-500' // TODO(burdon): Token.
|
|
144
|
+
target='_blank'
|
|
145
|
+
rel='noopener noreferrer'
|
|
146
|
+
{...props}
|
|
147
|
+
>
|
|
148
|
+
{children}
|
|
149
|
+
</a>
|
|
150
|
+
);
|
|
151
|
+
},
|
|
152
|
+
}}
|
|
153
|
+
/>
|
|
154
|
+
);
|
|
155
|
+
},
|
|
119
156
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
157
|
+
//
|
|
158
|
+
// Suggest
|
|
159
|
+
//
|
|
160
|
+
['suggest' as const]: ({ block, onEvent }) => {
|
|
161
|
+
const { t } = useTranslation(meta.id);
|
|
162
|
+
invariant(block._tag === 'suggest');
|
|
163
|
+
return (
|
|
164
|
+
<IconButton
|
|
165
|
+
icon='ph--lightning--regular'
|
|
166
|
+
label={block.text}
|
|
167
|
+
title={t('button suggest')}
|
|
168
|
+
onClick={() => onEvent?.({ type: 'submit', text: block.text })}
|
|
169
|
+
/>
|
|
170
|
+
);
|
|
171
|
+
},
|
|
127
172
|
|
|
173
|
+
//
|
|
174
|
+
// Select
|
|
175
|
+
//
|
|
176
|
+
['select' as const]: ({ block, onEvent }) => {
|
|
177
|
+
const { t } = useTranslation(meta.id);
|
|
178
|
+
invariant(block._tag === 'select');
|
|
128
179
|
return (
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
180
|
+
<div className='flex flex-wrap gap-1'>
|
|
181
|
+
{block.options.map((option, idx) => (
|
|
182
|
+
<Button
|
|
183
|
+
classNames={'animate-[fadeIn_0.5s] rounded-sm text-sm'}
|
|
184
|
+
key={idx}
|
|
185
|
+
onClick={() => onEvent?.({ type: 'submit', text: option })}
|
|
186
|
+
title={t('button select option')}
|
|
187
|
+
>
|
|
188
|
+
{option}
|
|
189
|
+
</Button>
|
|
190
|
+
))}
|
|
191
|
+
</div>
|
|
192
|
+
);
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
//
|
|
196
|
+
// Toolkit
|
|
197
|
+
//
|
|
198
|
+
['toolkit' as const]: ({ block }) => {
|
|
199
|
+
invariant(block._tag === 'toolkit');
|
|
200
|
+
return (
|
|
201
|
+
<ToggleContainer title='Toolbox' classNames={panelClasses} defaultOpen>
|
|
202
|
+
<Toolbox classNames={marginClasses} />
|
|
143
203
|
</ToggleContainer>
|
|
144
204
|
);
|
|
145
205
|
},
|
|
@@ -147,42 +207,11 @@ const components: Partial<Record<ContentBlock.Any['_tag'] | 'default', BlockComp
|
|
|
147
207
|
//
|
|
148
208
|
// JSON
|
|
149
209
|
//
|
|
150
|
-
['json' as const]: ({
|
|
210
|
+
['json' as const]: ({ block, onEvent }) => {
|
|
151
211
|
invariant(block._tag === 'json');
|
|
152
212
|
|
|
213
|
+
// TODO(burdon): Disposition is deprecated.
|
|
153
214
|
switch (block.disposition) {
|
|
154
|
-
case 'tool_list': {
|
|
155
|
-
return (
|
|
156
|
-
<ToggleContainer title={titles[block.disposition]} defaultOpen={true}>
|
|
157
|
-
<ToolboxContainer space={space} processor={processor} classNames='pbe-2' />
|
|
158
|
-
</ToggleContainer>
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
case 'suggest': {
|
|
163
|
-
const { text = '' }: { text: string } = safeParseJson(block.data ?? '{}') ?? ({} as any);
|
|
164
|
-
return (
|
|
165
|
-
<IconButton icon='ph--lightning--regular' label={text} onClick={() => onEvent?.({ type: 'submit', text })} />
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
case 'select': {
|
|
170
|
-
const { options = [] }: { options: string[] } = safeParseJson(block.data ?? '{}') ?? ({} as any);
|
|
171
|
-
return (
|
|
172
|
-
<div className='flex flex-wrap gap-1'>
|
|
173
|
-
{options.map((text, idx) => (
|
|
174
|
-
<Button
|
|
175
|
-
classNames={'animate-[fadeIn_0.5s] rounded-sm text-sm'}
|
|
176
|
-
key={idx}
|
|
177
|
-
onClick={() => onEvent?.({ type: 'submit', text })}
|
|
178
|
-
>
|
|
179
|
-
{text}
|
|
180
|
-
</Button>
|
|
181
|
-
))}
|
|
182
|
-
</div>
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
215
|
case 'graph': {
|
|
187
216
|
return (
|
|
188
217
|
<div className='flex flex-wrap gap-1'>
|
|
@@ -204,9 +233,8 @@ const components: Partial<Record<ContentBlock.Any['_tag'] | 'default', BlockComp
|
|
|
204
233
|
}
|
|
205
234
|
|
|
206
235
|
default: {
|
|
207
|
-
const title = block.disposition ? titles[block.disposition] : undefined;
|
|
208
236
|
return (
|
|
209
|
-
<ToggleContainer title={
|
|
237
|
+
<ToggleContainer title={block.disposition ?? block._tag}>
|
|
210
238
|
<Json data={safeParseJson(block.data ?? block)} />
|
|
211
239
|
</ToggleContainer>
|
|
212
240
|
);
|
|
@@ -215,41 +243,21 @@ const components: Partial<Record<ContentBlock.Any['_tag'] | 'default', BlockComp
|
|
|
215
243
|
},
|
|
216
244
|
|
|
217
245
|
//
|
|
218
|
-
//
|
|
246
|
+
// Fallback
|
|
219
247
|
//
|
|
220
248
|
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
249
|
return (
|
|
229
|
-
<ToggleContainer title={
|
|
250
|
+
<ToggleContainer title={block._tag}>
|
|
230
251
|
<Json data={block} />
|
|
231
252
|
</ToggleContainer>
|
|
232
253
|
);
|
|
233
254
|
},
|
|
234
255
|
};
|
|
235
256
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
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',
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
const systemDispositions: string[] = ['cot', 'artifact-update'];
|
|
247
|
-
|
|
248
|
-
const panelClasses = 'flex flex-col is-full bg-activeSurface rounded-sm';
|
|
249
|
-
const marginClasses = 'pie-4 pis-4';
|
|
250
|
-
const paddingClasses = 'pis-2 pie-2 pbs-0.5 pbe-0.5';
|
|
251
|
-
|
|
252
|
-
const MessageContainer = ({ classNames, children, user }: ThemedClassName<PropsWithChildren<{ user?: boolean }>>) => {
|
|
257
|
+
/**
|
|
258
|
+
* Wrapper for each message.
|
|
259
|
+
*/
|
|
260
|
+
const MessageItem = ({ classNames, children, user }: ThemedClassName<PropsWithChildren<{ user?: boolean }>>) => {
|
|
253
261
|
if (!children) {
|
|
254
262
|
return null;
|
|
255
263
|
}
|
|
@@ -266,3 +274,9 @@ const MessageContainer = ({ classNames, children, user }: ThemedClassName<PropsW
|
|
|
266
274
|
const ToggleContainer = (props: ToggleContainerProps) => {
|
|
267
275
|
return <NativeToggleContainer {...props} classNames={mx(panelClasses, props.classNames)} />;
|
|
268
276
|
};
|
|
277
|
+
|
|
278
|
+
export const renderObjectLink = (obj: Obj.Any) => `[${Obj.getLabel(obj)}](${Obj.getDXN(obj).toString()})`;
|
|
279
|
+
|
|
280
|
+
// TODO(burdon): Move to parser.
|
|
281
|
+
const preprocessTextContent = (content: string) =>
|
|
282
|
+
content.replaceAll(new RegExp(DXN_ECHO_REGEXP, 'g'), (_, dxn) => `<${dxn}>`);
|