@dxos/plugin-assistant 0.8.4-main.5acf9ea → 0.8.4-main.66e292d
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/BlueprintArticle-BWSLH6LG.mjs +36 -0
- package/dist/lib/browser/BlueprintArticle-BWSLH6LG.mjs.map +7 -0
- package/dist/lib/browser/ChatCompanion-OSZZZSWV.mjs +158 -0
- package/dist/lib/browser/ChatCompanion-OSZZZSWV.mjs.map +7 -0
- package/dist/lib/browser/ChatContainer-2W6FNSJD.mjs +77 -0
- package/dist/lib/browser/ChatContainer-2W6FNSJD.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-ZVLXFHEY.mjs → ChatDialog-XQ3KDYWE.mjs} +30 -12
- package/dist/lib/browser/ChatDialog-XQ3KDYWE.mjs.map +7 -0
- package/dist/lib/browser/PromptArticle-Q7JYGFQV.mjs +59 -0
- package/dist/lib/browser/PromptArticle-Q7JYGFQV.mjs.map +7 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs +19 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-LM6GVHQO.mjs +199 -0
- package/dist/lib/browser/app-graph-builder-LM6GVHQO.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-VBEOXNBS.mjs +12 -0
- package/dist/lib/browser/blueprint-definition-VBEOXNBS.mjs.map +7 -0
- package/dist/lib/browser/chunk-2BOE3OTW.mjs +262 -0
- package/dist/lib/browser/chunk-2BOE3OTW.mjs.map +7 -0
- package/dist/lib/browser/chunk-5JZRYQZL.mjs +229 -0
- package/dist/lib/browser/chunk-5JZRYQZL.mjs.map +7 -0
- package/dist/lib/browser/chunk-7ZJIXQ2Y.mjs +335 -0
- package/dist/lib/browser/chunk-7ZJIXQ2Y.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-LRE4VEZV.mjs +16 -0
- package/dist/lib/browser/chunk-LRE4VEZV.mjs.map +7 -0
- package/dist/lib/browser/chunk-NC2QNMBF.mjs +176 -0
- package/dist/lib/browser/chunk-NC2QNMBF.mjs.map +7 -0
- package/dist/lib/browser/chunk-PWSTPQUY.mjs +1929 -0
- package/dist/lib/browser/chunk-PWSTPQUY.mjs.map +7 -0
- package/dist/lib/browser/chunk-WBG5PTSX.mjs +23 -0
- package/dist/lib/browser/chunk-WBG5PTSX.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs +18 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +221 -107
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-EEYS2GJF.mjs +143 -0
- package/dist/lib/browser/intent-resolver-EEYS2GJF.mjs.map +7 -0
- package/dist/lib/browser/local-model-resolver-34MVHRKD.mjs +17 -0
- package/dist/lib/browser/local-model-resolver-34MVHRKD.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-ECKZNDSU.mjs +98 -0
- package/dist/lib/browser/react-surface-ECKZNDSU.mjs.map +7 -0
- package/dist/lib/browser/repair-3MZXLUHO.mjs +44 -0
- package/dist/lib/browser/repair-3MZXLUHO.mjs.map +7 -0
- package/dist/lib/browser/{settings-5GTTCVGD.mjs → settings-HD5WA24I.mjs} +8 -7
- package/dist/lib/{node-esm/settings-J2EXEM5H.mjs.map → browser/settings-HD5WA24I.mjs.map} +1 -1
- package/dist/lib/browser/state-GG7Z3NB7.mjs +25 -0
- package/dist/lib/browser/state-GG7Z3NB7.mjs.map +7 -0
- package/dist/lib/browser/toolkit-VYDAWNE4.mjs +17 -0
- package/dist/lib/browser/toolkit-VYDAWNE4.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -4
- package/dist/lib/node-esm/BlueprintArticle-R2XYBRCK.mjs +37 -0
- package/dist/lib/node-esm/BlueprintArticle-R2XYBRCK.mjs.map +7 -0
- package/dist/lib/node-esm/ChatCompanion-IUMU7WRQ.mjs +159 -0
- package/dist/lib/node-esm/ChatCompanion-IUMU7WRQ.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-W3W6FWV3.mjs → ChatContainer-CTUNUEU3.mjs} +38 -15
- package/dist/lib/node-esm/ChatContainer-CTUNUEU3.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-QW4JRKVO.mjs → ChatDialog-X42ASXQD.mjs} +30 -12
- package/dist/lib/node-esm/ChatDialog-X42ASXQD.mjs.map +7 -0
- package/dist/lib/node-esm/PromptArticle-IV7O5UZ3.mjs +60 -0
- package/dist/lib/node-esm/PromptArticle-IV7O5UZ3.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs +20 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-6XUAGTRS.mjs +200 -0
- package/dist/lib/node-esm/app-graph-builder-6XUAGTRS.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-RDCLLIQH.mjs +13 -0
- package/dist/lib/node-esm/blueprint-definition-RDCLLIQH.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-25GMMNY5.mjs +178 -0
- package/dist/lib/node-esm/chunk-25GMMNY5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-3Q22TTXW.mjs +264 -0
- package/dist/lib/node-esm/chunk-3Q22TTXW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CKW4IYLY.mjs +336 -0
- package/dist/lib/node-esm/chunk-CKW4IYLY.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-E4JSYCWZ.mjs +230 -0
- package/dist/lib/node-esm/chunk-E4JSYCWZ.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-WE6KTH72.mjs +25 -0
- package/dist/lib/node-esm/chunk-WE6KTH72.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YWFWT57N.mjs +17 -0
- package/dist/lib/node-esm/chunk-YWFWT57N.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-Z37USO4K.mjs +1930 -0
- package/dist/lib/node-esm/chunk-Z37USO4K.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs +19 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +221 -107
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-4SRYLDK5.mjs +144 -0
- package/dist/lib/node-esm/intent-resolver-4SRYLDK5.mjs.map +7 -0
- package/dist/lib/node-esm/local-model-resolver-TP2NTSAX.mjs +18 -0
- package/dist/lib/node-esm/local-model-resolver-TP2NTSAX.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-NLIG5VAI.mjs +99 -0
- package/dist/lib/node-esm/react-surface-NLIG5VAI.mjs.map +7 -0
- package/dist/lib/node-esm/repair-RER5H7Y6.mjs +45 -0
- package/dist/lib/node-esm/repair-RER5H7Y6.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-J2EXEM5H.mjs → settings-YJQVKHH5.mjs} +8 -7
- package/dist/lib/{browser/settings-5GTTCVGD.mjs.map → node-esm/settings-YJQVKHH5.mjs.map} +1 -1
- package/dist/lib/node-esm/state-FSUHFMDM.mjs +26 -0
- package/dist/lib/node-esm/state-FSUHFMDM.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-HFJZLVIR.mjs +18 -0
- package/dist/lib/node-esm/toolkit-HFJZLVIR.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +7 -4
- package/dist/types/src/AssistantPlugin.d.ts +1 -1
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts +4 -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 +10 -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 +12 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +10 -0
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/repair.d.ts +4 -0
- package/dist/types/src/capabilities/repair.d.ts.map +1 -0
- 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/BlueprintArticle.d.ts +7 -0
- package/dist/types/src/components/BlueprintArticle.d.ts.map +1 -0
- package/dist/types/src/components/Chat/Chat.d.ts +35 -21
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +9 -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 +9 -6
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +7 -0
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
- package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
- package/dist/types/src/components/ChatProgress/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +20 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +4 -5
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +12 -10
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +196 -55
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/reducers.d.ts +40 -0
- package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/registry.d.ts +11 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.d.ts +42 -0
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts +2 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts.map +1 -0
- package/dist/types/src/components/PromptArticle.d.ts +7 -0
- package/dist/types/src/components/PromptArticle.d.ts.map +1 -0
- 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 +317 -7
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +314 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts +12 -0
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts +3 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts +8 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +21 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts +2 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/index.d.ts +3 -0
- package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +6 -11
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +318 -5
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -6
- 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/object-list.d.ts +10 -0
- package/dist/types/src/functions/object-list.d.ts.map +1 -0
- package/dist/types/src/functions/object-load.d.ts +8 -0
- package/dist/types/src/functions/object-load.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +8 -3
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +25 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +8 -19
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +5 -6
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts +8 -0
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextBinder.d.ts +4 -0
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
- package/dist/types/src/hooks/useFilteredTypes.d.ts +4 -0
- package/dist/types/src/hooks/useFilteredTypes.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/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/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +4 -0
- package/dist/types/src/processor/index.d.ts.map +1 -0
- package/dist/types/src/{hooks → processor}/presets.d.ts +3 -3
- package/dist/types/src/processor/presets.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +74 -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/processor/update-name.d.ts +10 -0
- package/dist/types/src/processor/update-name.d.ts.map +1 -0
- package/dist/types/src/queue-logger.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +7 -0
- package/dist/types/src/testing/test-generator.d.ts.map +1 -0
- package/dist/types/src/testing/test-sequence.d.ts +0 -4
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts +2 -2
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +262 -28
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +45 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -0
- package/dist/types/src/types/AssistantAction.d.ts +129 -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 +135 -85
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +100 -97
- package/src/AssistantPlugin.tsx +151 -111
- package/src/capabilities/ai-service.ts +27 -0
- package/src/capabilities/app-graph-builder.ts +101 -60
- package/src/capabilities/blueprint-definition.ts +66 -0
- package/src/capabilities/capabilities.ts +17 -0
- package/src/capabilities/edge-model-resolver.ts +25 -0
- package/src/capabilities/index.ts +10 -0
- package/src/capabilities/intent-resolver.ts +89 -26
- package/src/capabilities/local-model-resolver.ts +30 -0
- package/src/capabilities/react-surface.tsx +24 -75
- package/src/capabilities/repair.ts +49 -0
- package/src/capabilities/state.ts +22 -0
- package/src/capabilities/toolkit.ts +17 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +83 -76
- package/src/components/BlueprintArticle.tsx +29 -0
- package/src/components/Chat/Chat.tsx +260 -217
- package/src/components/Chat/events.ts +13 -0
- package/src/components/ChatCompanion.tsx +155 -0
- package/src/components/ChatContainer.tsx +36 -20
- package/src/components/ChatDialog.tsx +25 -14
- package/src/components/ChatProgress/ChatProgress.tsx +67 -0
- package/src/components/{SequenceEditor → ChatProgress}/index.ts +1 -1
- package/src/components/ChatPrompt/ChatActions.tsx +10 -26
- package/src/components/ChatPrompt/ChatOptions.tsx +234 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +31 -36
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
- package/src/components/ChatPrompt/index.ts +1 -1
- package/src/components/ChatThread/ChatThread.stories.tsx +120 -115
- package/src/components/ChatThread/ChatThread.tsx +65 -35
- package/src/components/ChatThread/Link.tsx +26 -0
- package/src/components/ChatThread/reducers.ts +151 -0
- package/src/components/ChatThread/registry.tsx +174 -0
- package/src/components/ChatThread/sync.test.ts +89 -0
- package/src/components/ChatThread/sync.ts +148 -0
- package/src/components/ChatThread/testing/thread.md +37 -0
- package/src/components/PromptArticle.tsx +51 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +38 -17
- package/src/components/TemplateEditor/TemplateEditor.tsx +30 -54
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +16 -11
- package/src/components/TemplateEditor/TemplateForm.tsx +5 -3
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +269 -0
- package/src/components/TemplateEditor/extensions/index.ts +6 -0
- package/src/components/TemplateEditor/extensions/xml-extension.ts +64 -0
- package/src/components/ToolBlock/ToolBlock.tsx +143 -0
- package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
- package/src/components/ToolBlock/index.ts +6 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +14 -23
- package/src/components/Toolbox/Toolbox.tsx +25 -55
- package/src/components/index.ts +3 -7
- package/src/events.ts +2 -2
- package/src/functions/analysis.ts +22 -0
- package/src/functions/index.ts +7 -0
- package/src/functions/object-list.ts +48 -0
- package/src/functions/object-load.ts +45 -0
- package/src/hooks/index.ts +8 -4
- package/src/hooks/useBlueprintRegistry.ts +95 -0
- package/src/hooks/useChatProcessor.ts +35 -104
- package/src/hooks/useChatServices.ts +33 -49
- package/src/hooks/useChatToolbarActions.ts +122 -0
- package/src/hooks/useContextBinder.ts +30 -0
- package/src/hooks/useContextObjects.ts +58 -0
- package/src/hooks/useFilteredTypes.ts +38 -0
- package/src/hooks/useFlush.ts +35 -0
- package/src/hooks/useOnline.ts +10 -0
- package/src/hooks/usePresets.ts +44 -0
- package/src/hooks/useReferencesProvider.ts +13 -10
- package/src/index.ts +2 -0
- package/src/meta.ts +9 -6
- package/src/processor/index.ts +7 -0
- package/src/{hooks → processor}/presets.ts +16 -8
- package/src/processor/processor.test.ts +71 -0
- package/src/processor/processor.ts +277 -0
- package/src/processor/update-name.ts +56 -0
- package/src/queue-logger.ts +13 -17
- package/src/testing/index.ts +1 -1
- package/src/testing/test-generator.ts +261 -0
- package/src/testing/test-sequence.ts +2 -27
- package/src/testing/test-services.ts +2 -8
- package/src/translations.ts +49 -18
- package/src/types/Assistant.ts +63 -0
- package/src/types/AssistantAction.ts +79 -0
- package/src/types/defs.ts +5 -0
- package/src/types/index.ts +4 -1
- package/src/types/service.ts +17 -9
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/BlueprintContainer-IZ4AK5EO.mjs +0 -28
- package/dist/lib/browser/BlueprintContainer-IZ4AK5EO.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-RP3QEXYX.mjs +0 -54
- package/dist/lib/browser/ChatContainer-RP3QEXYX.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-ZVLXFHEY.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs +0 -162
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-XSEOKJLG.mjs +0 -164
- package/dist/lib/browser/app-graph-builder-XSEOKJLG.mjs.map +0 -7
- package/dist/lib/browser/chunk-63GG6U6D.mjs +0 -2226
- package/dist/lib/browser/chunk-63GG6U6D.mjs.map +0 -7
- package/dist/lib/browser/chunk-7W7LHTRH.mjs +0 -171
- package/dist/lib/browser/chunk-7W7LHTRH.mjs.map +0 -7
- package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
- package/dist/lib/browser/chunk-FDCJSQYF.mjs.map +0 -7
- package/dist/lib/browser/chunk-KFXSBNZR.mjs +0 -89
- package/dist/lib/browser/chunk-KFXSBNZR.mjs.map +0 -7
- package/dist/lib/browser/chunk-LERGF5YG.mjs +0 -108
- package/dist/lib/browser/chunk-LERGF5YG.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs +0 -75
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3GYEHQRP.mjs +0 -150
- package/dist/lib/browser/react-surface-3GYEHQRP.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-RGTMNLNX.mjs +0 -29
- package/dist/lib/node-esm/BlueprintContainer-RGTMNLNX.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-W3W6FWV3.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-QW4JRKVO.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs +0 -163
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-PANCJUHV.mjs +0 -165
- package/dist/lib/node-esm/app-graph-builder-PANCJUHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs +0 -2227
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MS3PJARN.mjs +0 -109
- package/dist/lib/node-esm/chunk-MS3PJARN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs +0 -90
- package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs +0 -172
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs +0 -76
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs +0 -151
- package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs.map +0 -7
- package/dist/types/src/capability-definitions.d.ts +0 -7
- package/dist/types/src/capability-definitions.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintContainer.d.ts +0 -8
- package/dist/types/src/components/BlueprintContainer.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/ChatThread/ChatMessage.d.ts +0 -17
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +0 -19
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
- package/dist/types/src/components/PromptSettings.d.ts +0 -6
- package/dist/types/src/components/PromptSettings.d.ts.map +0 -1
- package/dist/types/src/components/SequenceContainer.d.ts +0 -8
- package/dist/types/src/components/SequenceContainer.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +0 -13
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +0 -8
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/index.d.ts +0 -2
- package/dist/types/src/components/SequenceEditor/index.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.d.ts +0 -86
- package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
- package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/presets.d.ts.map +0 -1
- package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
- package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.d.ts +0 -4
- package/dist/types/src/parser/filter-generator.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.test.d.ts +0 -2
- package/dist/types/src/parser/filter-generator.test.d.ts.map +0 -1
- package/dist/types/src/parser/index.d.ts +0 -4
- package/dist/types/src/parser/index.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.d.ts +0 -15
- package/dist/types/src/parser/query-parser.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.test.d.ts +0 -2
- package/dist/types/src/parser/query-parser.test.d.ts.map +0 -1
- package/dist/types/src/parser/types.d.ts +0 -24
- package/dist/types/src/parser/types.d.ts.map +0 -1
- package/dist/types/src/stories/Chat.stories.d.ts +0 -207
- package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -3
- package/dist/types/src/testing/test-functions.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 -120
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capability-definitions.ts +0 -15
- package/src/components/BlueprintContainer.tsx +0 -24
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
- package/src/components/ChatThread/ChatMessage.tsx +0 -268
- package/src/components/ChatThread/ToolBlock.tsx +0 -121
- package/src/components/ChatThread/reducer.ts +0 -52
- package/src/components/PromptSettings.tsx +0 -89
- package/src/components/SequenceContainer.tsx +0 -132
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -32
- package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
- package/src/hooks/chat-processor.test.ts +0 -16
- package/src/hooks/chat-processor.ts +0 -314
- package/src/hooks/useBlueprints.ts +0 -57
- package/src/parser/filter-generator.test.ts +0 -32
- package/src/parser/filter-generator.ts +0 -81
- package/src/parser/index.ts +0 -7
- package/src/parser/query-parser.test.ts +0 -139
- package/src/parser/query-parser.ts +0 -199
- package/src/parser/types.ts +0 -34
- package/src/shims.d.ts +0 -8
- package/src/stories/Chat.stories.tsx +0 -371
- package/src/testing/test-functions.ts +0 -11
- 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 -108
- package/src/typings.d.ts +0 -9
|
@@ -2,34 +2,43 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { createSystemPrompt } from '@dxos/assistant';
|
|
11
9
|
import { Blueprint, Template } from '@dxos/blueprints';
|
|
12
10
|
import { useClient } from '@dxos/react-client';
|
|
13
11
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
14
|
-
import {
|
|
12
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
15
13
|
import { trim } from '@dxos/util';
|
|
16
14
|
|
|
17
|
-
import { TemplateEditor, type TemplateEditorProps } from './TemplateEditor';
|
|
18
15
|
import { translations } from '../../translations';
|
|
19
16
|
|
|
17
|
+
import { TemplateEditor, type TemplateEditorProps } from './TemplateEditor';
|
|
18
|
+
|
|
19
|
+
const FENCE = '```';
|
|
20
|
+
|
|
20
21
|
const TEMPLATE = trim`
|
|
21
22
|
{{! System Prompt }}
|
|
22
23
|
|
|
23
|
-
You are
|
|
24
|
-
The move history of the current game is: {{history}}
|
|
24
|
+
You are an expert chess player.
|
|
25
|
+
The move history of the current game is: {{history}}.
|
|
25
26
|
If asked to suggest a move explain why it is a good move.
|
|
26
27
|
|
|
27
28
|
{{#each artifacts}}
|
|
28
|
-
|
|
29
|
+
{{this}}
|
|
29
30
|
{{/each}}
|
|
30
31
|
|
|
32
|
+
Reponse in the format: <suggestion>SUGGESTION</suggestion>
|
|
33
|
+
|
|
34
|
+
@dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M
|
|
35
|
+
|
|
31
36
|
---
|
|
32
37
|
|
|
38
|
+
${FENCE}ts
|
|
39
|
+
const x = 100;
|
|
40
|
+
${FENCE}
|
|
41
|
+
|
|
33
42
|
{{input}}
|
|
34
43
|
`;
|
|
35
44
|
|
|
@@ -37,33 +46,45 @@ const DefaultStory = ({ source }: TemplateEditorProps & { source: string }) => {
|
|
|
37
46
|
const client = useClient();
|
|
38
47
|
const [blueprint] = useState(() => {
|
|
39
48
|
const space = client.spaces.default;
|
|
40
|
-
return space.db.add(
|
|
49
|
+
return space.db.add(
|
|
50
|
+
Blueprint.make({
|
|
51
|
+
key: 'example.com/blueprint/test',
|
|
52
|
+
name: 'Test',
|
|
53
|
+
instructions: Template.make({ source }),
|
|
54
|
+
}),
|
|
55
|
+
);
|
|
41
56
|
});
|
|
42
57
|
|
|
43
|
-
return
|
|
58
|
+
return (
|
|
59
|
+
<TemplateEditor
|
|
60
|
+
classNames='bg-baseSurface max-is-prose is-full'
|
|
61
|
+
id={blueprint.id}
|
|
62
|
+
template={blueprint.instructions}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
44
65
|
};
|
|
45
66
|
|
|
46
|
-
const meta
|
|
67
|
+
const meta = {
|
|
47
68
|
title: 'plugins/plugin-assistant/TemplateEditor',
|
|
48
|
-
component: TemplateEditor,
|
|
69
|
+
component: TemplateEditor as any,
|
|
49
70
|
render: DefaultStory,
|
|
50
71
|
decorators: [
|
|
72
|
+
withTheme,
|
|
73
|
+
withLayout({ container: 'column' }),
|
|
51
74
|
withClientProvider({
|
|
75
|
+
types: [Blueprint.Blueprint],
|
|
52
76
|
createIdentity: true,
|
|
53
77
|
createSpace: true,
|
|
54
|
-
types: [Template.Template],
|
|
55
78
|
}),
|
|
56
|
-
withLayout({ fullscreen: true, Container: ColumnContainer }),
|
|
57
|
-
withTheme,
|
|
58
79
|
],
|
|
59
80
|
parameters: {
|
|
60
81
|
translations,
|
|
61
82
|
},
|
|
62
|
-
}
|
|
83
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
63
84
|
|
|
64
85
|
export default meta;
|
|
65
86
|
|
|
66
|
-
type Story =
|
|
87
|
+
type Story = StoryObj<typeof meta>;
|
|
67
88
|
|
|
68
89
|
export const Default: Story = {
|
|
69
90
|
args: {
|
|
@@ -2,90 +2,66 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { styleTags, tags } from '@lezer/highlight';
|
|
7
|
-
import { handlebarsLanguage } from '@xiechao/codemirror-lang-handlebars';
|
|
5
|
+
import { defaultHighlightStyle, syntaxHighlighting } from '@codemirror/language';
|
|
8
6
|
import React from 'react';
|
|
9
7
|
|
|
10
8
|
import { type Template } from '@dxos/blueprints';
|
|
11
|
-
import { createDocAccessor } from '@dxos/
|
|
12
|
-
import { useThemeContext, useTranslation
|
|
9
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
10
|
+
import { type ThemedClassName, useThemeContext, useTranslation } from '@dxos/react-ui';
|
|
13
11
|
import {
|
|
14
12
|
createBasicExtensions,
|
|
15
13
|
createDataExtensions,
|
|
14
|
+
createMarkdownExtensions,
|
|
16
15
|
createThemeExtensions,
|
|
16
|
+
decorateMarkdown,
|
|
17
17
|
useTextEditor,
|
|
18
18
|
} from '@dxos/react-ui-editor';
|
|
19
19
|
import { mx } from '@dxos/react-ui-theme';
|
|
20
|
-
import {
|
|
20
|
+
import { isNonNullable } from '@dxos/util';
|
|
21
21
|
|
|
22
22
|
import { meta } from '../../meta';
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
props: [
|
|
26
|
-
styleTags({
|
|
27
|
-
'---': tags.lineComment,
|
|
28
|
-
}),
|
|
29
|
-
],
|
|
30
|
-
});
|
|
24
|
+
import { handlebars, xmlDecorator } from './extensions';
|
|
31
25
|
|
|
32
26
|
export type TemplateEditorProps = ThemedClassName<{
|
|
33
27
|
id: string;
|
|
34
28
|
template: Template.Template;
|
|
29
|
+
lineNumbers?: boolean;
|
|
35
30
|
}>;
|
|
36
31
|
|
|
37
|
-
export const TemplateEditor = ({ id, classNames, template }: TemplateEditorProps) => {
|
|
32
|
+
export const TemplateEditor = ({ id, classNames, template, lineNumbers = true }: TemplateEditorProps) => {
|
|
38
33
|
const { t } = useTranslation(meta.id);
|
|
39
34
|
const { themeMode } = useThemeContext();
|
|
40
35
|
const { parentRef } = useTextEditor(() => {
|
|
41
36
|
const text = template.source?.target;
|
|
37
|
+
if (!text) {
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
40
|
+
|
|
42
41
|
return {
|
|
43
|
-
initialValue: text
|
|
42
|
+
initialValue: text.content ?? '',
|
|
44
43
|
extensions: [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}),
|
|
44
|
+
createDataExtensions({
|
|
45
|
+
id,
|
|
46
|
+
text: createDocAccessor(text, ['content']),
|
|
47
|
+
}),
|
|
50
48
|
createBasicExtensions({
|
|
51
49
|
bracketMatching: false,
|
|
52
|
-
lineNumbers
|
|
50
|
+
lineNumbers,
|
|
53
51
|
lineWrapping: true,
|
|
54
|
-
monospace: true,
|
|
55
52
|
placeholder: t('template placeholder'),
|
|
56
53
|
}),
|
|
57
|
-
createThemeExtensions({
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
createThemeExtensions({ themeMode, slots: { content: { className: '!pie-4' } } }),
|
|
55
|
+
createMarkdownExtensions(),
|
|
56
|
+
decorateMarkdown(),
|
|
57
|
+
handlebars(),
|
|
58
|
+
// xml(),
|
|
59
|
+
// NOTE: Since we're using markdown only HTML nodes are parsed.
|
|
60
|
+
xmlDecorator(),
|
|
61
|
+
syntaxHighlighting(defaultHighlightStyle),
|
|
62
|
+
].filter(isNonNullable),
|
|
64
63
|
};
|
|
65
|
-
}, [themeMode, template.source?.target]);
|
|
64
|
+
}, [themeMode, template.source?.target, lineNumbers]);
|
|
66
65
|
|
|
67
|
-
return <div ref={parentRef} className={mx('
|
|
66
|
+
return <div ref={parentRef} className={mx('bs-full overflow-hidden', classNames)} />;
|
|
68
67
|
};
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* https://github.com/xiechao/lang-handlebars/blob/direct/src/highlight.js
|
|
72
|
-
*/
|
|
73
|
-
export const handlebarsHighlightStyle = HighlightStyle.define([
|
|
74
|
-
{
|
|
75
|
-
// Braces.
|
|
76
|
-
tag: tags.tagName,
|
|
77
|
-
class: 'text-redText',
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
tag: tags.variableName,
|
|
81
|
-
class: 'text-blueText',
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
tag: tags.keyword,
|
|
85
|
-
class: 'text-greenText',
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
tag: tags.comment,
|
|
89
|
-
class: 'text-subdued',
|
|
90
|
-
},
|
|
91
|
-
]);
|
|
@@ -2,20 +2,19 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta } from '@storybook/react-vite';
|
|
8
6
|
import React, { useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { Blueprint, Template } from '@dxos/blueprints';
|
|
11
9
|
import { useClient } from '@dxos/react-client';
|
|
12
10
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
|
-
import { withLayout, withTheme } from '@dxos/
|
|
11
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
14
12
|
import { trim } from '@dxos/util';
|
|
15
13
|
|
|
16
|
-
import { TemplateForm } from './TemplateForm';
|
|
17
14
|
import { translations } from '../../translations';
|
|
18
15
|
|
|
16
|
+
import { TemplateForm } from './TemplateForm';
|
|
17
|
+
|
|
19
18
|
const TEMPLATE = trim`
|
|
20
19
|
You are a machine that is an expert chess player.
|
|
21
20
|
The move history of the current game is: {{history}}
|
|
@@ -30,33 +29,39 @@ const DefaultStory = () => {
|
|
|
30
29
|
const client = useClient();
|
|
31
30
|
const [blueprint] = useState(() => {
|
|
32
31
|
const space = client.spaces.default;
|
|
33
|
-
return space.db.add(
|
|
32
|
+
return space.db.add(
|
|
33
|
+
Blueprint.make({
|
|
34
|
+
key: 'example.com/blueprint/test',
|
|
35
|
+
name: 'Test',
|
|
36
|
+
instructions: Template.make({ source: TEMPLATE }),
|
|
37
|
+
}),
|
|
38
|
+
);
|
|
34
39
|
});
|
|
35
40
|
|
|
36
41
|
return (
|
|
37
|
-
<div role='none' className='flex
|
|
42
|
+
<div role='none' className='flex is-[40rem] border border-separator overflow-hidden'>
|
|
38
43
|
<TemplateForm id={blueprint.id} template={blueprint.instructions} />
|
|
39
44
|
</div>
|
|
40
45
|
);
|
|
41
46
|
};
|
|
42
47
|
|
|
43
|
-
const meta
|
|
48
|
+
const meta = {
|
|
44
49
|
title: 'plugins/plugin-assistant/TemplateForm',
|
|
45
50
|
component: TemplateForm,
|
|
46
51
|
render: DefaultStory,
|
|
47
52
|
decorators: [
|
|
53
|
+
withTheme,
|
|
54
|
+
withLayout({ container: 'column' }),
|
|
48
55
|
withClientProvider({
|
|
56
|
+
types: [Blueprint.Blueprint],
|
|
49
57
|
createIdentity: true,
|
|
50
58
|
createSpace: true,
|
|
51
|
-
types: [Template.Template],
|
|
52
59
|
}),
|
|
53
|
-
withLayout({ fullscreen: true, classNames: 'flex justify-center' }),
|
|
54
|
-
withTheme,
|
|
55
60
|
],
|
|
56
61
|
parameters: {
|
|
57
62
|
translations,
|
|
58
63
|
},
|
|
59
|
-
}
|
|
64
|
+
} satisfies Meta<typeof TemplateForm>;
|
|
60
65
|
|
|
61
66
|
export default meta;
|
|
62
67
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import type * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { Fragment, useEffect } from 'react';
|
|
7
7
|
|
|
8
8
|
import { type Template } from '@dxos/blueprints';
|
|
@@ -10,9 +10,10 @@ import { Input, Select, useTranslation } from '@dxos/react-ui';
|
|
|
10
10
|
import { attentionSurface, groupBorder, mx } from '@dxos/react-ui-theme';
|
|
11
11
|
import { isNonNullable } from '@dxos/util';
|
|
12
12
|
|
|
13
|
-
import { TemplateEditor } from './TemplateEditor';
|
|
14
13
|
import { meta } from '../../meta';
|
|
15
14
|
|
|
15
|
+
import { TemplateEditor } from './TemplateEditor';
|
|
16
|
+
|
|
16
17
|
export type TemplateFormProps = {
|
|
17
18
|
id: string;
|
|
18
19
|
template: Template.Template;
|
|
@@ -25,7 +26,7 @@ export const TemplateForm = ({ id, template, commandEditable = true }: TemplateF
|
|
|
25
26
|
usePromptInputs(template);
|
|
26
27
|
|
|
27
28
|
return (
|
|
28
|
-
<div className={mx('flex flex-col
|
|
29
|
+
<div className={mx('flex flex-col is-full overflow-hidden gap-4', groupBorder)}>
|
|
29
30
|
{/* {commandEditable && (
|
|
30
31
|
<div className='flex items-center pl-4'>
|
|
31
32
|
<span className='text-neutral-500'>/</span>
|
|
@@ -67,6 +68,7 @@ export const TemplateForm = ({ id, template, commandEditable = true }: TemplateF
|
|
|
67
68
|
</Select.Option>
|
|
68
69
|
))}
|
|
69
70
|
</Select.Viewport>
|
|
71
|
+
<Select.Arrow />
|
|
70
72
|
</Select.Content>
|
|
71
73
|
</Select.Portal>
|
|
72
74
|
</Select.Root>
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
type CompletionContext,
|
|
7
|
+
type CompletionResult,
|
|
8
|
+
autocompletion,
|
|
9
|
+
completionKeymap,
|
|
10
|
+
} from '@codemirror/autocomplete';
|
|
11
|
+
import { type Extension, RangeSetBuilder } from '@codemirror/state';
|
|
12
|
+
import {
|
|
13
|
+
Decoration,
|
|
14
|
+
type DecorationSet,
|
|
15
|
+
type EditorView,
|
|
16
|
+
ViewPlugin,
|
|
17
|
+
type ViewUpdate,
|
|
18
|
+
WidgetType,
|
|
19
|
+
keymap,
|
|
20
|
+
} from '@codemirror/view';
|
|
21
|
+
|
|
22
|
+
import { Domino } from '@dxos/react-ui';
|
|
23
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
24
|
+
|
|
25
|
+
export type HandlebarsOptions = {};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Simple Handlebars plugin for CodeMirror.
|
|
29
|
+
* Supports:
|
|
30
|
+
* - Comments: {{! comment }}
|
|
31
|
+
* - Commands: {{#command}} {{/command}}
|
|
32
|
+
* - Variables: {{var}}
|
|
33
|
+
* - Commands with variables: {{#each items}} {{/each}}
|
|
34
|
+
*/
|
|
35
|
+
export const handlebars = (_: HandlebarsOptions = {}): Extension => {
|
|
36
|
+
return [
|
|
37
|
+
handlebarsHighlightPlugin,
|
|
38
|
+
autocompletion({
|
|
39
|
+
activateOnTyping: true,
|
|
40
|
+
aboveCursor: true,
|
|
41
|
+
closeOnBlur: true,
|
|
42
|
+
override: [handlebarsCompletions],
|
|
43
|
+
}),
|
|
44
|
+
keymap.of(completionKeymap),
|
|
45
|
+
];
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const regex = {
|
|
49
|
+
// {{! comment }}
|
|
50
|
+
comment: /\{\{!\s*[^}]*\}\}/g,
|
|
51
|
+
|
|
52
|
+
// {{var}}
|
|
53
|
+
brackets: /\{\{[^}]*\}\}/g,
|
|
54
|
+
|
|
55
|
+
// {{#command}} {{/command}}
|
|
56
|
+
command: /\{\{[#/]([^}]+)\}\}/g,
|
|
57
|
+
|
|
58
|
+
// {{var}}
|
|
59
|
+
var: /\{\{(?!\s*!)(\w[^}]*)\}\}/g,
|
|
60
|
+
|
|
61
|
+
// @dxn:queue:data:xxx
|
|
62
|
+
dxn: /@?dxn:[\w@:]+/g,
|
|
63
|
+
|
|
64
|
+
// dxos.org/type/xxx
|
|
65
|
+
url: /[\w.-]+\.[\w.-]+\/[\w/]+/g,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const tagPadding = 'mli-0.5 pli-1 rounded-sm';
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* ViewPlugin that decorates Handlebars syntax.
|
|
72
|
+
*/
|
|
73
|
+
const handlebarsHighlightPlugin = ViewPlugin.fromClass(
|
|
74
|
+
class {
|
|
75
|
+
decorations: DecorationSet;
|
|
76
|
+
|
|
77
|
+
constructor(view: EditorView) {
|
|
78
|
+
this.decorations = this.buildDecorations(view);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
update(update: ViewUpdate) {
|
|
82
|
+
if (update.docChanged || update.viewportChanged || update.selectionSet) {
|
|
83
|
+
this.decorations = this.buildDecorations(update.view);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// NOTE: Decorations may clash with other extensions (e.g., markdown).
|
|
88
|
+
buildDecorations(view: EditorView) {
|
|
89
|
+
const selection = view.state.selection.main;
|
|
90
|
+
const decorations: Array<{ from: number; to: number; decoration: Decoration }> = [];
|
|
91
|
+
|
|
92
|
+
for (const { from, to } of view.visibleRanges) {
|
|
93
|
+
const text = view.state.doc.sliceString(from, to);
|
|
94
|
+
|
|
95
|
+
// Match DXN.
|
|
96
|
+
{
|
|
97
|
+
let match;
|
|
98
|
+
while ((match = regex.dxn.exec(text)) !== null) {
|
|
99
|
+
const start = from + match.index;
|
|
100
|
+
const end = start + match[0].length;
|
|
101
|
+
// Only show widget if selection doesn't overlap with the match range.
|
|
102
|
+
const overlaps = selection.to > start && selection.from <= end;
|
|
103
|
+
if (!overlaps) {
|
|
104
|
+
decorations.push({
|
|
105
|
+
from: start,
|
|
106
|
+
to: end,
|
|
107
|
+
decoration: Decoration.widget({
|
|
108
|
+
widget: new DXNWidget(match[0]),
|
|
109
|
+
}),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Match URLs.
|
|
116
|
+
{
|
|
117
|
+
let match;
|
|
118
|
+
while ((match = regex.url.exec(text)) !== null) {
|
|
119
|
+
const start = from + match.index;
|
|
120
|
+
const end = start + match[0].length;
|
|
121
|
+
decorations.push({
|
|
122
|
+
from: start,
|
|
123
|
+
to: end,
|
|
124
|
+
decoration: Decoration.mark({ class: mx('dx-tag--blue', tagPadding) }),
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Match brackets: {{ and }}.
|
|
130
|
+
{
|
|
131
|
+
let match;
|
|
132
|
+
while ((match = regex.brackets.exec(text)) !== null) {
|
|
133
|
+
const start = from + match.index;
|
|
134
|
+
const end = start + match[0].length;
|
|
135
|
+
decorations.push({
|
|
136
|
+
from: start,
|
|
137
|
+
to: end,
|
|
138
|
+
decoration: Decoration.mark({ class: 'text-subdued' }),
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Match commands: {{#command}} and {{/command}}.
|
|
144
|
+
{
|
|
145
|
+
let match;
|
|
146
|
+
while ((match = regex.command.exec(text)) !== null) {
|
|
147
|
+
const start = from + match.index + 2;
|
|
148
|
+
let end = start + match[0].length - 4;
|
|
149
|
+
const text = view.state.doc.sliceString(start, end);
|
|
150
|
+
const parts = text.split(/\s+/);
|
|
151
|
+
if (parts.length > 1) {
|
|
152
|
+
const idx = start + parts[0].length;
|
|
153
|
+
decorations.push({
|
|
154
|
+
from: idx,
|
|
155
|
+
to: end,
|
|
156
|
+
decoration: Decoration.mark({ class: 'text-greenText' }),
|
|
157
|
+
});
|
|
158
|
+
end = idx;
|
|
159
|
+
}
|
|
160
|
+
decorations.push({
|
|
161
|
+
from: start,
|
|
162
|
+
to: end,
|
|
163
|
+
decoration: Decoration.mark({ class: 'text-blueText' }),
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Match variables: {{var}}.
|
|
169
|
+
{
|
|
170
|
+
let match;
|
|
171
|
+
while ((match = regex.var.exec(text)) !== null) {
|
|
172
|
+
const start = from + match.index + 2;
|
|
173
|
+
const end = start + match[0].length - 4;
|
|
174
|
+
decorations.push({
|
|
175
|
+
from: start,
|
|
176
|
+
to: end,
|
|
177
|
+
decoration: Decoration.mark({ class: 'text-greenText' }),
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Sort decorations by position to satisfy RangeSetBuilder requirements.
|
|
184
|
+
decorations.sort((a, b) => a.from - b.from || a.to - b.to);
|
|
185
|
+
|
|
186
|
+
// Add sorted decorations to builder.
|
|
187
|
+
const builder = new RangeSetBuilder<Decoration>();
|
|
188
|
+
for (const { from, to, decoration } of decorations) {
|
|
189
|
+
builder.add(from, to, decoration);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return builder.finish();
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
decorations: (v) => v.decorations,
|
|
197
|
+
},
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
class DXNWidget extends WidgetType {
|
|
201
|
+
constructor(private readonly _identifier: string) {
|
|
202
|
+
super();
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
override ignoreEvent() {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
override eq(other: this) {
|
|
210
|
+
return this._identifier === other._identifier;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
override toDOM() {
|
|
214
|
+
const text = this._identifier
|
|
215
|
+
.split(':')
|
|
216
|
+
.map((part) => {
|
|
217
|
+
const len = 16;
|
|
218
|
+
const plen = 4;
|
|
219
|
+
if (part.length > len) {
|
|
220
|
+
return `[${part.slice(0, plen)}…${part.slice(-plen)}]`;
|
|
221
|
+
}
|
|
222
|
+
return part;
|
|
223
|
+
})
|
|
224
|
+
.join(':');
|
|
225
|
+
return Domino.of('span').classNames(['font-mono dx-tag--blue', tagPadding]).text(text).build();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// TODO(burdon): Pass in variables.
|
|
230
|
+
const variables = ['this'];
|
|
231
|
+
const commands = ['this', 'each', 'if', 'unless', 'with'];
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Provides completions for Handlebars variables.
|
|
235
|
+
*/
|
|
236
|
+
function handlebarsCompletions(context: CompletionContext): CompletionResult | null {
|
|
237
|
+
const match = context.matchBefore(/\{\{[^}]*/);
|
|
238
|
+
if (!match || match.from === match.to) {
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
let type = 'variable';
|
|
243
|
+
let text = match.text.slice(2);
|
|
244
|
+
let from = match.from + 2;
|
|
245
|
+
let matches = [];
|
|
246
|
+
if (text.startsWith('#') || text.startsWith('/')) {
|
|
247
|
+
const idx = text.lastIndexOf(' ');
|
|
248
|
+
if (idx !== -1) {
|
|
249
|
+
type = 'variable';
|
|
250
|
+
matches = variables;
|
|
251
|
+
text = text.slice(idx + 1);
|
|
252
|
+
from += idx + 1;
|
|
253
|
+
} else {
|
|
254
|
+
type = 'command';
|
|
255
|
+
text = text.slice(1);
|
|
256
|
+
matches = commands;
|
|
257
|
+
from += 1;
|
|
258
|
+
}
|
|
259
|
+
} else {
|
|
260
|
+
type = 'variable';
|
|
261
|
+
matches = variables;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const options = matches.filter((name) => name.startsWith(text)).map((name) => ({ type, label: name }));
|
|
265
|
+
return {
|
|
266
|
+
from,
|
|
267
|
+
options,
|
|
268
|
+
};
|
|
269
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { syntaxTree } from '@codemirror/language';
|
|
6
|
+
import { type Extension, RangeSetBuilder } from '@codemirror/state';
|
|
7
|
+
import { Decoration, type DecorationSet, type EditorView, ViewPlugin, type ViewUpdate } from '@codemirror/view';
|
|
8
|
+
|
|
9
|
+
export type XmlOptions = {};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* XML decorator plugin for CodeMirror.
|
|
13
|
+
* Decorates XML tags with monospace font using the XML language grammar.
|
|
14
|
+
*/
|
|
15
|
+
export const xmlDecorator = (_: XmlOptions = {}): Extension => {
|
|
16
|
+
return [xmlDecoratorPlugin];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* ViewPlugin that decorates XML tags using syntax tree.
|
|
21
|
+
*/
|
|
22
|
+
const xmlDecoratorPlugin = ViewPlugin.fromClass(
|
|
23
|
+
class {
|
|
24
|
+
decorations: DecorationSet;
|
|
25
|
+
|
|
26
|
+
constructor(view: EditorView) {
|
|
27
|
+
this.decorations = this.buildDecorations(view);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
update(update: ViewUpdate) {
|
|
31
|
+
if (update.docChanged || update.viewportChanged) {
|
|
32
|
+
this.decorations = this.buildDecorations(update.view);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
buildDecorations(view: EditorView) {
|
|
37
|
+
const builder = new RangeSetBuilder<Decoration>();
|
|
38
|
+
|
|
39
|
+
for (const { from, to } of view.visibleRanges) {
|
|
40
|
+
syntaxTree(view.state).iterate({
|
|
41
|
+
from,
|
|
42
|
+
to,
|
|
43
|
+
enter: (node) => {
|
|
44
|
+
// Decorate XML elements (opening tags, closing tags, self-closing tags).
|
|
45
|
+
if (
|
|
46
|
+
node.name === 'HTMLTag' ||
|
|
47
|
+
node.name === 'OpenTag' ||
|
|
48
|
+
node.name === 'CloseTag' ||
|
|
49
|
+
node.name === 'SelfClosingTag' ||
|
|
50
|
+
node.name === 'Element'
|
|
51
|
+
) {
|
|
52
|
+
builder.add(node.from, node.to, Decoration.mark({ class: 'font-mono text-subdued' }));
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return builder.finish();
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
decorations: (v) => v.decorations,
|
|
63
|
+
},
|
|
64
|
+
);
|