@dxos/plugin-assistant 0.8.4-main.f9ba587 → 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-6ZGGH5T4.mjs → BlueprintContainer-H7H4BQ2C.mjs} +10 -9
- package/dist/lib/browser/BlueprintContainer-H7H4BQ2C.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-6XNB5NEI.mjs → ChatContainer-OUVSX5V5.mjs} +36 -17
- package/dist/lib/browser/ChatContainer-OUVSX5V5.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-IMWPRXTO.mjs → ChatDialog-P4FLEOHG.mjs} +22 -10
- package/dist/lib/browser/ChatDialog-P4FLEOHG.mjs.map +7 -0
- package/dist/lib/browser/SequenceContainer-627OQ557.mjs +163 -0
- 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-UJ5NHRGK.mjs → app-graph-builder-AVHHQ3KV.mjs} +16 -73
- 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-44HZKIAW.mjs → chunk-NZDCKQ6W.mjs} +32 -30
- package/dist/lib/browser/chunk-NZDCKQ6W.mjs.map +7 -0
- package/dist/lib/browser/{chunk-NTBGTFTV.mjs → chunk-QB7OVS6Z.mjs} +3 -2
- package/dist/lib/browser/chunk-QB7OVS6Z.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TQ3QW3HJ.mjs → chunk-VEBVAHNM.mjs} +1041 -882
- 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 +116 -88
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/intent-resolver-MVOIEJXZ.mjs +81 -0
- 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-TMF7JJA4.mjs → react-surface-4HXS3YLT.mjs} +52 -45
- package/dist/lib/browser/react-surface-4HXS3YLT.mjs.map +7 -0
- package/dist/lib/browser/{settings-N4HEXADL.mjs → settings-G2EZXMWT.mjs} +5 -4
- package/dist/lib/{node-esm/settings-WQ76EG6O.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 +6 -13
- package/dist/lib/node-esm/{TemplateContainer-6KRNEMVE.mjs → BlueprintContainer-VH4EE4CM.mjs} +10 -9
- package/dist/lib/node-esm/BlueprintContainer-VH4EE4CM.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-VOLG7J6N.mjs → ChatContainer-D5FABDNE.mjs} +36 -17
- package/dist/lib/node-esm/ChatContainer-D5FABDNE.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-B2XNUNRM.mjs → ChatDialog-NKWVXHJP.mjs} +22 -10
- package/dist/lib/node-esm/ChatDialog-NKWVXHJP.mjs.map +7 -0
- package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs +164 -0
- 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-MEQ5CYNI.mjs → app-graph-builder-RMOUJMMG.mjs} +16 -73
- 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-D3HTVK5D.mjs → chunk-3SOC5GOP.mjs} +1041 -882
- 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-VESVUAOS.mjs → chunk-GAWXJ7K5.mjs} +32 -30
- 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-RD755HN3.mjs +245 -0
- package/dist/lib/node-esm/chunk-RD755HN3.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-E6V2RUQ2.mjs → chunk-X6AANUHZ.mjs} +3 -2
- 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 +116 -88
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/intent-resolver-DTDNCX3C.mjs +82 -0
- 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-6XL6SWL2.mjs → react-surface-V6JNEZVO.mjs} +52 -45
- package/dist/lib/node-esm/react-surface-V6JNEZVO.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-WQ76EG6O.mjs → settings-AIP5FOJG.mjs} +5 -4
- package/dist/lib/{browser/settings-N4HEXADL.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 +6 -13
- 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 +8 -3
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- 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 +6 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
- 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 +16 -13
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +30 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -0
- package/dist/types/src/components/Chat/index.d.ts +1 -0
- package/dist/types/src/components/Chat/index.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/ChatActions.d.ts +6 -5
- package/dist/types/src/components/ChatPrompt/ChatActions.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/ChatPresets.d.ts +11 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.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/ChatStatusIndicator.d.ts +2 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +2 -2
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +10 -10
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +6 -12
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +54 -60
- 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 +4 -3
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/reducer.d.ts +4 -4
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +1 -1
- package/dist/types/src/components/PromptSettings.d.ts +2 -2
- package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
- package/dist/types/src/components/SequenceContainer.d.ts +1 -2
- 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 +4 -3
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +2 -2
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +5 -4
- 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 +6 -9
- 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 +4 -3
- 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 +34 -44
- 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 +8 -4
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/presets.d.ts +13 -0
- package/dist/types/src/hooks/presets.d.ts.map +1 -0
- 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 +9 -18
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +13 -0
- package/dist/types/src/hooks/useChatServices.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 +7 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -0
- 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/index.d.ts +1 -1
- package/dist/types/src/parser/index.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 +87 -18
- 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 +25 -13
- 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 -2
- 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 +83 -73
- package/src/AssistantPlugin.tsx +61 -41
- package/src/capabilities/ai-service.ts +28 -0
- package/src/capabilities/app-graph-builder.ts +9 -92
- package/src/capabilities/blueprint-definition.ts +32 -0
- package/src/capabilities/capabilities.ts +11 -3
- package/src/capabilities/edge-model-resolver.ts +29 -0
- package/src/capabilities/index.ts +6 -3
- package/src/capabilities/intent-resolver.ts +39 -11
- package/src/capabilities/react-surface.tsx +35 -27
- 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 +148 -95
- package/src/components/Chat/events.ts +50 -0
- package/src/components/Chat/index.ts +2 -0
- package/src/components/ChatContainer.tsx +39 -15
- package/src/components/ChatDialog.tsx +10 -7
- package/src/components/ChatPrompt/ChatActions.tsx +15 -20
- package/src/components/ChatPrompt/ChatOptions.tsx +59 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +28 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +11 -8
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +17 -4
- package/src/components/ChatPrompt/index.ts +2 -3
- package/src/components/ChatThread/ChatMessage.tsx +192 -148
- package/src/components/ChatThread/ChatThread.stories.tsx +221 -109
- package/src/components/ChatThread/ChatThread.tsx +12 -23
- package/src/components/ChatThread/Link.tsx +39 -0
- package/src/components/ChatThread/ToolBlock.tsx +41 -27
- package/src/components/ChatThread/reducer.ts +14 -14
- package/src/components/PromptSettings.tsx +41 -43
- package/src/components/SequenceContainer.tsx +32 -38
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +3 -2
- package/src/components/SequenceEditor/SequenceEditor.tsx +1 -1
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +37 -35
- package/src/components/TemplateEditor/TemplateEditor.tsx +39 -23
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +23 -16
- package/src/components/TemplateEditor/TemplateForm.tsx +50 -55
- 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 +7 -13
- package/src/components/Toolbox/Toolbox.tsx +21 -42
- 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 +167 -188
- package/src/hooks/errors.ts +8 -0
- package/src/hooks/index.ts +8 -4
- package/src/hooks/presets.ts +53 -0
- package/src/hooks/useBlueprintRegistry.ts +79 -0
- package/src/hooks/useChatProcessor.ts +81 -0
- package/src/hooks/useChatServices.ts +72 -0
- package/src/hooks/useOnline.ts +10 -0
- package/src/hooks/usePresets.ts +45 -0
- package/src/hooks/{useContextProvider.ts → useReferencesProvider.ts} +18 -22
- package/src/hooks/useResolveRef.ts +33 -0
- package/src/parser/filter-generator.ts +6 -13
- package/src/parser/index.ts +1 -1
- package/src/parser/query-parser.ts +1 -1
- package/src/queue-logger.ts +5 -5
- package/src/stories/Chat.stories.tsx +246 -198
- 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 +9 -4
- package/src/testing/test-sequence.ts +18 -20
- package/src/tools/function.ts +4 -1
- package/src/tools/openapi.test.ts +10 -8
- package/src/tools/openapi.ts +4 -1
- package/src/translations.ts +29 -13
- 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 -2
- package/dist/lib/browser/ChatContainer-6XNB5NEI.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-IMWPRXTO.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-6XOYB2RN.mjs +0 -322
- package/dist/lib/browser/SequenceContainer-6XOYB2RN.mjs.map +0 -7
- package/dist/lib/browser/TemplateContainer-6ZGGH5T4.mjs.map +0 -7
- package/dist/lib/browser/ai-client-ML7OQWAO.mjs +0 -39
- package/dist/lib/browser/ai-client-ML7OQWAO.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-UJ5NHRGK.mjs.map +0 -7
- package/dist/lib/browser/chunk-44HZKIAW.mjs.map +0 -7
- package/dist/lib/browser/chunk-NTBGTFTV.mjs.map +0 -7
- package/dist/lib/browser/chunk-OZL4OHTU.mjs +0 -157
- package/dist/lib/browser/chunk-OZL4OHTU.mjs.map +0 -7
- package/dist/lib/browser/chunk-TQ3QW3HJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-TU7UUGWQ.mjs +0 -203
- package/dist/lib/browser/chunk-TU7UUGWQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-WPZ4UANI.mjs +0 -16
- package/dist/lib/browser/chunk-WPZ4UANI.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-LEAPB55Q.mjs +0 -42
- package/dist/lib/browser/intent-resolver-LEAPB55Q.mjs.map +0 -7
- package/dist/lib/browser/react-surface-TMF7JJA4.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-VOLG7J6N.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-B2XNUNRM.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-WWG6IMN3.mjs +0 -323
- package/dist/lib/node-esm/SequenceContainer-WWG6IMN3.mjs.map +0 -7
- package/dist/lib/node-esm/TemplateContainer-6KRNEMVE.mjs.map +0 -7
- package/dist/lib/node-esm/ai-client-2FQ434CT.mjs +0 -40
- package/dist/lib/node-esm/ai-client-2FQ434CT.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-MEQ5CYNI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-D3HTVK5D.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-E6V2RUQ2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HVMVHP4R.mjs +0 -158
- package/dist/lib/node-esm/chunk-HVMVHP4R.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HXKRKIN2.mjs +0 -18
- package/dist/lib/node-esm/chunk-HXKRKIN2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VESVUAOS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YYUVTTVK.mjs +0 -204
- package/dist/lib/node-esm/chunk-YYUVTTVK.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-4ULF3F7U.mjs +0 -43
- package/dist/lib/node-esm/intent-resolver-4ULF3F7U.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-6XL6SWL2.mjs.map +0 -7
- package/dist/types/src/capabilities/ai-client.d.ts +0 -5
- package/dist/types/src/capabilities/ai-client.d.ts.map +0 -1
- 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/ChatPrompt/events.d.ts +0 -17
- package/dist/types/src/components/ChatPrompt/events.d.ts.map +0 -1
- package/dist/types/src/components/TemplateContainer.d.ts +0 -9
- 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 -4
- package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
- package/dist/types/src/hooks/useContextProvider.d.ts +0 -23
- package/dist/types/src/hooks/useContextProvider.d.ts.map +0 -1
- package/dist/types/src/hooks/useServiceContainer.d.ts +0 -8
- package/dist/types/src/hooks/useServiceContainer.d.ts.map +0 -1
- package/dist/types/src/hooks/useTextInputEvents.d.ts +0 -13
- package/dist/types/src/hooks/useTextInputEvents.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -71
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/dist/types/src/types/template.d.ts +0 -56
- package/dist/types/src/types/template.d.ts.map +0 -1
- package/src/capabilities/ai-client.ts +0 -39
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
- package/src/components/ChatPrompt/events.ts +0 -12
- package/src/components/TemplateContainer.tsx +0 -25
- package/src/hooks/chat-processor.test.ts +0 -15
- package/src/hooks/useBlueprints.ts +0 -31
- package/src/hooks/useChatProcessor.tsx +0 -142
- package/src/hooks/useServiceContainer.ts +0 -42
- package/src/hooks/useTextInputEvents.ts +0 -49
- package/src/types/schema.ts +0 -86
- package/src/types/template.ts +0 -66
|
@@ -2,63 +2,61 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import React, { type ChangeEvent, useCallback } from 'react';
|
|
5
|
+
import React from 'react';
|
|
7
6
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { type Template } from '@dxos/blueprints';
|
|
8
|
+
import { Toolbar, useTranslation } from '@dxos/react-ui';
|
|
10
9
|
|
|
11
10
|
import { meta } from '../meta';
|
|
12
|
-
import { TemplateKinds, type TemplateType, type TemplateKindSchema } from '../types';
|
|
13
11
|
|
|
14
|
-
export const PromptSettings = ({ template }: { template:
|
|
12
|
+
export const PromptSettings = ({ template }: { template: Template.Template }) => {
|
|
15
13
|
const { t } = useTranslation(meta.id);
|
|
16
14
|
|
|
17
|
-
const handleKindChange = useCallback(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
// const handleKindChange = useCallback(
|
|
16
|
+
// (value: string) => {
|
|
17
|
+
// const kind = Match.type<string>().pipe(
|
|
18
|
+
// Match.withReturnType<Schema.Schema.Type<typeof Template.Template>>(),
|
|
19
|
+
// Match.when('always', () => ({ include: 'always' })),
|
|
20
|
+
// Match.when('schema-matching', () => ({ include: 'schema-matching', typename: '' })),
|
|
21
|
+
// Match.when('automatically', () => ({ include: 'automatically', description: '' })),
|
|
22
|
+
// Match.orElse(() => ({ include: 'manual' })),
|
|
23
|
+
// )(value);
|
|
24
|
+
//
|
|
25
|
+
// template.kind = kind;
|
|
26
|
+
// },
|
|
27
|
+
// [template],
|
|
28
|
+
// );
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
template.kind.typename = event.target.value;
|
|
36
|
-
}
|
|
37
|
-
}, 300),
|
|
38
|
-
[template.kind.include],
|
|
39
|
-
);
|
|
30
|
+
// const handleTypenameChange = useCallback(
|
|
31
|
+
// debounce((event: ChangeEvent<HTMLInputElement>) => {
|
|
32
|
+
// if (template.kind.include === 'schema-matching') {
|
|
33
|
+
// template.kind.typename = event.target.value;
|
|
34
|
+
// }
|
|
35
|
+
// }, 300),
|
|
36
|
+
// [template.kind.include],
|
|
37
|
+
// );
|
|
40
38
|
|
|
41
|
-
const handleDescriptionChange = useCallback(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
);
|
|
39
|
+
// const handleDescriptionChange = useCallback(
|
|
40
|
+
// debounce((event: ChangeEvent<HTMLInputElement>) => {
|
|
41
|
+
// if (template.kind.include === 'automatically') {
|
|
42
|
+
// template.kind.description = event.target.value;
|
|
43
|
+
// }
|
|
44
|
+
// }, 300),
|
|
45
|
+
// [template.kind.include],
|
|
46
|
+
// );
|
|
49
47
|
|
|
50
48
|
return (
|
|
51
49
|
<div className='flex flex-col gap-4'>
|
|
52
50
|
<h2>{t('prompt rules label')}</h2>
|
|
53
51
|
<Toolbar.Root>
|
|
54
|
-
<Select.Root value={template.kind.include} onValueChange={handleKindChange}>
|
|
52
|
+
{/* <Select.Root value={template.kind.include} onValueChange={handleKindChange}>
|
|
55
53
|
<Toolbar.Button asChild>
|
|
56
54
|
<Select.TriggerButton />
|
|
57
55
|
</Toolbar.Button>
|
|
58
56
|
<Select.Portal>
|
|
59
57
|
<Select.Content>
|
|
60
58
|
<Select.Viewport>
|
|
61
|
-
{
|
|
59
|
+
{Template.Kinds.map((kind) => (
|
|
62
60
|
<Select.Option key={kind} value={kind}>
|
|
63
61
|
{kind}
|
|
64
62
|
</Select.Option>
|
|
@@ -66,8 +64,8 @@ export const PromptSettings = ({ template }: { template: TemplateType }) => {
|
|
|
66
64
|
</Select.Viewport>
|
|
67
65
|
</Select.Content>
|
|
68
66
|
</Select.Portal>
|
|
69
|
-
</Select.Root>
|
|
70
|
-
{template.kind.include === 'schema-matching' && (
|
|
67
|
+
</Select.Root> */}
|
|
68
|
+
{/* {template.kind.include === 'schema-matching' && (
|
|
71
69
|
<Input.Root>
|
|
72
70
|
<Input.TextInput
|
|
73
71
|
placeholder={t('typename placeholder')}
|
|
@@ -75,8 +73,8 @@ export const PromptSettings = ({ template }: { template: TemplateType }) => {
|
|
|
75
73
|
onChange={handleTypenameChange}
|
|
76
74
|
/>
|
|
77
75
|
</Input.Root>
|
|
78
|
-
)}
|
|
79
|
-
{template.kind.include === 'automatically' && (
|
|
76
|
+
)} */}
|
|
77
|
+
{/* {template.kind.include === 'automatically' && (
|
|
80
78
|
<Input.Root>
|
|
81
79
|
<Input.TextInput
|
|
82
80
|
placeholder={t('description placeholder')}
|
|
@@ -84,7 +82,7 @@ export const PromptSettings = ({ template }: { template: TemplateType }) => {
|
|
|
84
82
|
onChange={handleDescriptionChange}
|
|
85
83
|
/>
|
|
86
84
|
</Input.Root>
|
|
87
|
-
)}
|
|
85
|
+
)} */}
|
|
88
86
|
</Toolbar.Root>
|
|
89
87
|
</div>
|
|
90
88
|
);
|
|
@@ -7,19 +7,16 @@ import JSON5 from 'json5';
|
|
|
7
7
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
8
8
|
|
|
9
9
|
import { ToolRegistry } from '@dxos/ai';
|
|
10
|
-
import { useCapability } from '@dxos/app-framework';
|
|
11
|
-
import { createLocalSearchTool, createExaTool, createGraphWriterTool } from '@dxos/assistant';
|
|
12
10
|
import { getSpace } from '@dxos/client/echo';
|
|
13
|
-
import { type Sequence, type SequenceDefinition
|
|
14
|
-
import {
|
|
11
|
+
import { type Sequence, type SequenceDefinition } from '@dxos/conductor';
|
|
12
|
+
import { Key } from '@dxos/echo';
|
|
15
13
|
import { Toolbar, useTranslation } from '@dxos/react-ui';
|
|
16
|
-
import {
|
|
17
|
-
import { StackItem
|
|
14
|
+
import { useSelectionManager } from '@dxos/react-ui-attention';
|
|
15
|
+
import { StackItem } from '@dxos/react-ui-stack';
|
|
18
16
|
|
|
19
|
-
import { SequenceEditor } from './SequenceEditor';
|
|
20
|
-
import { AssistantCapabilities } from '../capabilities';
|
|
21
17
|
import { meta } from '../meta';
|
|
22
|
-
|
|
18
|
+
|
|
19
|
+
import { SequenceEditor } from './SequenceEditor';
|
|
23
20
|
|
|
24
21
|
// TODO(burdon): Move to config.
|
|
25
22
|
export const EXA_API_KEY = '9c7e17ff-0c85-4cd5-827a-8b489f139e03';
|
|
@@ -35,9 +32,8 @@ const parseSequence = (text: string): SequenceDefinition | undefined => {
|
|
|
35
32
|
}
|
|
36
33
|
};
|
|
37
34
|
|
|
38
|
-
export const SequenceContainer = ({
|
|
35
|
+
export const SequenceContainer = ({ sequence }: { sequence: Sequence }) => {
|
|
39
36
|
const { t } = useTranslation(meta.id);
|
|
40
|
-
const aiClient = useCapability(AssistantCapabilities.AiClient);
|
|
41
37
|
const selectionManager = useSelectionManager();
|
|
42
38
|
const [definition, setDefinition] = useState<SequenceDefinition>();
|
|
43
39
|
useEffect(() => {
|
|
@@ -56,19 +52,20 @@ export const SequenceContainer = ({ role, sequence }: Pick<StackItemContentProps
|
|
|
56
52
|
}
|
|
57
53
|
|
|
58
54
|
// TODO(burdon): How should the queue be created?
|
|
59
|
-
|
|
55
|
+
// eslint-disable-next-line no-unused-vars
|
|
56
|
+
const _queue = space.queues.create();
|
|
60
57
|
|
|
61
58
|
return new ToolRegistry([
|
|
62
|
-
createExaTool({ apiKey: EXA_API_KEY }),
|
|
63
|
-
createLocalSearchTool(space.db, queue),
|
|
64
|
-
createGraphWriterTool({
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}),
|
|
59
|
+
// createExaTool({ apiKey: EXA_API_KEY }),
|
|
60
|
+
// createLocalSearchTool(space.db, queue),
|
|
61
|
+
// createGraphWriterTool({
|
|
62
|
+
// db: space.db,
|
|
63
|
+
// queue,
|
|
64
|
+
// schema: [], // TODO(burdon): Get schema from client/sequence?
|
|
65
|
+
// onDone: async (objects) => {
|
|
66
|
+
// await queue.append(objects);
|
|
67
|
+
// },
|
|
68
|
+
// }),
|
|
72
69
|
]);
|
|
73
70
|
}, [sequence]);
|
|
74
71
|
|
|
@@ -109,24 +106,21 @@ export const SequenceContainer = ({ role, sequence }: Pick<StackItemContentProps
|
|
|
109
106
|
const handleSave = useCallback(() => formatAndSave(), [formatAndSave]);
|
|
110
107
|
|
|
111
108
|
const handleRun = useCallback(async () => {
|
|
112
|
-
if (!aiClient?.value || !toolRegistry) {
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const machine = new SequenceMachine(toolRegistry, sequence).setLogger(new QueueLogger(sequence));
|
|
125
|
-
await machine.runToCompletion({ aiClient: aiClient.value, input });
|
|
126
|
-
}, [aiClient.value, sequence, formatAndSave, selectionManager, toolRegistry]);
|
|
109
|
+
// if (!aiClient?.value || !toolRegistry) {
|
|
110
|
+
// return;
|
|
111
|
+
// }
|
|
112
|
+
// formatAndSave();
|
|
113
|
+
// // Get input from selection.
|
|
114
|
+
// const input = Array.from(getSelectionSet(selectionManager)).map((id) => DXN.fromLocalObjectId(id));
|
|
115
|
+
// if (!input.length) {
|
|
116
|
+
// return;
|
|
117
|
+
// }
|
|
118
|
+
// const machine = new SequenceMachine(toolRegistry, sequence).setLogger(new QueueLogger(sequence));
|
|
119
|
+
// await machine.runToCompletion({ aiClient: aiClient.value, input });
|
|
120
|
+
}, [sequence, formatAndSave, selectionManager, toolRegistry]);
|
|
127
121
|
|
|
128
122
|
return (
|
|
129
|
-
<StackItem.Content
|
|
123
|
+
<StackItem.Content toolbar>
|
|
130
124
|
<Toolbar.Root>
|
|
131
125
|
<Toolbar.Button onClick={handleSave}>{t('button save')}</Toolbar.Button>
|
|
132
126
|
<Toolbar.Button onClick={handleRun}>{t('button run')}</Toolbar.Button>
|
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
|
|
9
9
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
10
10
|
|
|
11
|
-
import { SequenceEditor } from './SequenceEditor';
|
|
12
11
|
import { RESEARCH_SEQUENCE_DEFINITION } from '../../testing';
|
|
13
12
|
import { translations } from '../../translations';
|
|
14
13
|
|
|
14
|
+
import { SequenceEditor } from './SequenceEditor';
|
|
15
|
+
|
|
15
16
|
const meta: Meta<typeof SequenceEditor> = {
|
|
16
17
|
title: 'plugins/plugin-assistant/SequenceEditor',
|
|
17
18
|
component: SequenceEditor,
|
|
@@ -6,7 +6,7 @@ import React, { forwardRef, useImperativeHandle } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { SequenceDefinition } from '@dxos/conductor';
|
|
8
8
|
import { Type } from '@dxos/echo';
|
|
9
|
-
import {
|
|
9
|
+
import { type ThemedClassName, useThemeContext } from '@dxos/react-ui';
|
|
10
10
|
import {
|
|
11
11
|
type EditorView,
|
|
12
12
|
createBasicExtensions,
|
|
@@ -7,45 +7,47 @@ import '@dxos-theme';
|
|
|
7
7
|
import { type Meta } from '@storybook/react-vite';
|
|
8
8
|
import React, { useState } from 'react';
|
|
9
9
|
|
|
10
|
-
import { createSystemPrompt } from '@dxos/
|
|
11
|
-
import {
|
|
10
|
+
import { createSystemPrompt } from '@dxos/assistant';
|
|
11
|
+
import { Blueprint, Template } from '@dxos/blueprints';
|
|
12
12
|
import { useClient } from '@dxos/react-client';
|
|
13
13
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
14
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
14
|
+
import { ColumnContainer, withLayout, withTheme } from '@dxos/storybook-utils';
|
|
15
|
+
import { trim } from '@dxos/util';
|
|
15
16
|
|
|
16
|
-
import { TemplateEditor, type TemplateEditorProps } from './TemplateEditor';
|
|
17
17
|
import { translations } from '../../translations';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const DefaultStory = ({
|
|
18
|
+
|
|
19
|
+
import { TemplateEditor, type TemplateEditorProps } from './TemplateEditor';
|
|
20
|
+
|
|
21
|
+
const TEMPLATE = trim`
|
|
22
|
+
{{! System Prompt }}
|
|
23
|
+
|
|
24
|
+
You are a machine that is an expert chess player.
|
|
25
|
+
The move history of the current game is: {{history}}
|
|
26
|
+
If asked to suggest a move explain why it is a good move.
|
|
27
|
+
|
|
28
|
+
{{#each artifacts}}
|
|
29
|
+
- {{this}}
|
|
30
|
+
{{/each}}
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
{{input}}
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
const DefaultStory = ({ source }: TemplateEditorProps & { source: string }) => {
|
|
38
38
|
const client = useClient();
|
|
39
|
-
const [
|
|
39
|
+
const [blueprint] = useState(() => {
|
|
40
40
|
const space = client.spaces.default;
|
|
41
|
-
return space.db.add(
|
|
41
|
+
return space.db.add(
|
|
42
|
+
Blueprint.make({
|
|
43
|
+
key: 'example.com/blueprint/test',
|
|
44
|
+
name: 'Test',
|
|
45
|
+
instructions: Template.make({ source }),
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
42
48
|
});
|
|
43
49
|
|
|
44
|
-
return
|
|
45
|
-
<div role='none' className='flex w-[50rem] overflow-hidden border-x border-separator'>
|
|
46
|
-
<TemplateEditor template={template} />
|
|
47
|
-
</div>
|
|
48
|
-
);
|
|
50
|
+
return <TemplateEditor id={blueprint.id} template={blueprint.instructions} />;
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
const meta: Meta<typeof DefaultStory> = {
|
|
@@ -56,9 +58,9 @@ const meta: Meta<typeof DefaultStory> = {
|
|
|
56
58
|
withClientProvider({
|
|
57
59
|
createIdentity: true,
|
|
58
60
|
createSpace: true,
|
|
59
|
-
types: [
|
|
61
|
+
types: [Template.Template],
|
|
60
62
|
}),
|
|
61
|
-
withLayout({ fullscreen: true,
|
|
63
|
+
withLayout({ fullscreen: true, Container: ColumnContainer }),
|
|
62
64
|
withTheme,
|
|
63
65
|
],
|
|
64
66
|
parameters: {
|
|
@@ -72,12 +74,12 @@ type Story = Meta<typeof DefaultStory>;
|
|
|
72
74
|
|
|
73
75
|
export const Default: Story = {
|
|
74
76
|
args: {
|
|
75
|
-
|
|
77
|
+
source: TEMPLATE,
|
|
76
78
|
},
|
|
77
79
|
};
|
|
78
80
|
|
|
79
81
|
export const System: Story = {
|
|
80
82
|
args: {
|
|
81
|
-
|
|
83
|
+
source: createSystemPrompt({}),
|
|
82
84
|
},
|
|
83
85
|
};
|
|
@@ -7,8 +7,9 @@ import { styleTags, tags } from '@lezer/highlight';
|
|
|
7
7
|
import { handlebarsLanguage } from '@xiechao/codemirror-lang-handlebars';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
|
+
import { type Template } from '@dxos/blueprints';
|
|
10
11
|
import { createDocAccessor } from '@dxos/react-client/echo';
|
|
11
|
-
import { useThemeContext, useTranslation
|
|
12
|
+
import { type ThemedClassName, useThemeContext, useTranslation } from '@dxos/react-ui';
|
|
12
13
|
import {
|
|
13
14
|
createBasicExtensions,
|
|
14
15
|
createDataExtensions,
|
|
@@ -16,9 +17,9 @@ import {
|
|
|
16
17
|
useTextEditor,
|
|
17
18
|
} from '@dxos/react-ui-editor';
|
|
18
19
|
import { mx } from '@dxos/react-ui-theme';
|
|
20
|
+
import { isNotFalsy } from '@dxos/util';
|
|
19
21
|
|
|
20
22
|
import { meta } from '../../meta';
|
|
21
|
-
import { type TemplateType } from '../../types';
|
|
22
23
|
|
|
23
24
|
handlebarsLanguage.configure({
|
|
24
25
|
props: [
|
|
@@ -29,48 +30,63 @@ handlebarsLanguage.configure({
|
|
|
29
30
|
});
|
|
30
31
|
|
|
31
32
|
export type TemplateEditorProps = ThemedClassName<{
|
|
32
|
-
|
|
33
|
+
id: string;
|
|
34
|
+
template: Template.Template;
|
|
33
35
|
}>;
|
|
34
36
|
|
|
35
|
-
export const TemplateEditor = ({ classNames, template }: TemplateEditorProps) => {
|
|
37
|
+
export const TemplateEditor = ({ id, classNames, template }: TemplateEditorProps) => {
|
|
36
38
|
const { t } = useTranslation(meta.id);
|
|
37
39
|
const { themeMode } = useThemeContext();
|
|
38
|
-
const { parentRef } = useTextEditor(
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
const { parentRef } = useTextEditor(() => {
|
|
41
|
+
const text = template.source?.target;
|
|
42
|
+
return {
|
|
43
|
+
initialValue: text?.content ?? '',
|
|
41
44
|
extensions: [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
text &&
|
|
46
|
+
createDataExtensions({
|
|
47
|
+
id,
|
|
48
|
+
text: createDocAccessor(text, ['content']),
|
|
49
|
+
}),
|
|
46
50
|
createBasicExtensions({
|
|
47
51
|
bracketMatching: false,
|
|
52
|
+
lineNumbers: true,
|
|
48
53
|
lineWrapping: true,
|
|
54
|
+
monospace: true,
|
|
49
55
|
placeholder: t('template placeholder'),
|
|
50
56
|
}),
|
|
51
57
|
createThemeExtensions({
|
|
52
58
|
themeMode,
|
|
53
|
-
slots: {
|
|
54
|
-
content: { className: '!p-3' },
|
|
55
|
-
},
|
|
56
59
|
}),
|
|
57
60
|
|
|
58
61
|
// https://github.com/xiechao/lang-handlebars
|
|
59
62
|
new LanguageSupport(handlebarsLanguage, syntaxHighlighting(handlebarsHighlightStyle)),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
);
|
|
63
|
+
// createMarkdownExtensions({}),
|
|
64
|
+
].filter(isNotFalsy),
|
|
65
|
+
};
|
|
66
|
+
}, [themeMode, template.source?.target]);
|
|
64
67
|
|
|
65
|
-
return <div ref={parentRef} className={mx(classNames)} />;
|
|
68
|
+
return <div ref={parentRef} className={mx('h-full overflow-hidden', classNames)} />;
|
|
66
69
|
};
|
|
67
70
|
|
|
68
71
|
/**
|
|
69
72
|
* https://github.com/xiechao/lang-handlebars/blob/direct/src/highlight.js
|
|
70
73
|
*/
|
|
71
74
|
export const handlebarsHighlightStyle = HighlightStyle.define([
|
|
72
|
-
{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
{
|
|
76
|
+
// Braces.
|
|
77
|
+
tag: tags.tagName,
|
|
78
|
+
class: 'text-redText',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
tag: tags.variableName,
|
|
82
|
+
class: 'text-blueText',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
tag: tags.keyword,
|
|
86
|
+
class: 'text-greenText',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
tag: tags.comment,
|
|
90
|
+
class: 'text-subdued',
|
|
91
|
+
},
|
|
76
92
|
]);
|
|
@@ -7,35 +7,42 @@ import '@dxos-theme';
|
|
|
7
7
|
import { type Meta } from '@storybook/react-vite';
|
|
8
8
|
import React, { useState } from 'react';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { Blueprint, Template } from '@dxos/blueprints';
|
|
11
11
|
import { useClient } from '@dxos/react-client';
|
|
12
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
13
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
14
|
+
import { trim } from '@dxos/util';
|
|
14
15
|
|
|
15
|
-
import { TemplateForm } from './TemplateForm';
|
|
16
16
|
import { translations } from '../../translations';
|
|
17
|
-
import { TemplateType } from '../../types';
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
import { TemplateForm } from './TemplateForm';
|
|
19
|
+
|
|
20
|
+
const TEMPLATE = trim`
|
|
21
|
+
You are a machine that is an expert chess player.
|
|
22
|
+
The move history of the current game is: {{history}}
|
|
23
|
+
If asked to suggest a move explain why it is a good move.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
{{input}},
|
|
28
|
+
`;
|
|
28
29
|
|
|
29
30
|
const DefaultStory = () => {
|
|
30
31
|
const client = useClient();
|
|
31
|
-
const [
|
|
32
|
+
const [blueprint] = useState(() => {
|
|
32
33
|
const space = client.spaces.default;
|
|
33
|
-
return space.db.add(
|
|
34
|
+
return space.db.add(
|
|
35
|
+
Blueprint.make({
|
|
36
|
+
key: 'example.com/blueprint/test',
|
|
37
|
+
name: 'Test',
|
|
38
|
+
instructions: Template.make({ source: TEMPLATE }),
|
|
39
|
+
}),
|
|
40
|
+
);
|
|
34
41
|
});
|
|
35
42
|
|
|
36
43
|
return (
|
|
37
44
|
<div role='none' className='flex w-[40rem] border border-separator overflow-hidden'>
|
|
38
|
-
<TemplateForm template={
|
|
45
|
+
<TemplateForm id={blueprint.id} template={blueprint.instructions} />
|
|
39
46
|
</div>
|
|
40
47
|
);
|
|
41
48
|
};
|
|
@@ -48,7 +55,7 @@ const meta: Meta<typeof TemplateForm> = {
|
|
|
48
55
|
withClientProvider({
|
|
49
56
|
createIdentity: true,
|
|
50
57
|
createSpace: true,
|
|
51
|
-
types: [
|
|
58
|
+
types: [Template.Template],
|
|
52
59
|
}),
|
|
53
60
|
withLayout({ fullscreen: true, classNames: 'flex justify-center' }),
|
|
54
61
|
withTheme,
|