@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
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import type * as Tool from '@effect/ai/Tool';
|
|
6
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { NumericTabs, TextCrawl, ToggleContainer, type ToggleContainerRootProps } from '@dxos/react-ui-components';
|
|
10
|
+
import { type XmlWidgetProps } from '@dxos/react-ui-editor';
|
|
11
|
+
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
12
|
+
import { type ContentBlock, type Message } from '@dxos/types';
|
|
13
|
+
import { isNonNullable, safeParseJson } from '@dxos/util';
|
|
14
|
+
|
|
15
|
+
import { meta } from '../../meta';
|
|
16
|
+
|
|
17
|
+
export const isToolMessage = (message: Message.Message) => {
|
|
18
|
+
return message.blocks.some((block: ContentBlock.Any) => block._tag === 'toolCall' || block._tag === 'toolResult');
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type ToolBlockProps = XmlWidgetProps<{
|
|
22
|
+
blocks: ContentBlock.Any[];
|
|
23
|
+
}>;
|
|
24
|
+
|
|
25
|
+
export const ToolBlock = ({ view, blocks = [] }: ToolBlockProps) => {
|
|
26
|
+
const { t } = useTranslation(meta.id);
|
|
27
|
+
|
|
28
|
+
const items = useMemo<ToolContainerParams['items']>(() => {
|
|
29
|
+
let lastToolCall: { tool: Tool.Any | undefined; block: ContentBlock.ToolCall } | undefined;
|
|
30
|
+
// TODO(burdon): Get from context?
|
|
31
|
+
const tools: Tool.Any[] = []; //processor.conversation.toolkit?.tools ?? [];
|
|
32
|
+
return blocks
|
|
33
|
+
.filter((block) => block._tag === 'toolCall' || block._tag === 'toolResult' || block._tag === 'summary')
|
|
34
|
+
.map((block) => {
|
|
35
|
+
switch (block._tag) {
|
|
36
|
+
case 'toolCall': {
|
|
37
|
+
if (block.pending && lastToolCall?.block.toolCallId === block.toolCallId) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const tool = tools.find((tool) => tool.name === block.name);
|
|
42
|
+
lastToolCall = { tool, block };
|
|
43
|
+
return {
|
|
44
|
+
title: tool?.description ?? [t('tool call label'), tool?.name].join(' '),
|
|
45
|
+
content: {
|
|
46
|
+
...block,
|
|
47
|
+
input: safeParseJson(block.input),
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
case 'toolResult': {
|
|
53
|
+
// TODO(burdon): Parse error type.
|
|
54
|
+
if (block.error) {
|
|
55
|
+
return {
|
|
56
|
+
title: t('tool error label'),
|
|
57
|
+
content: block,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const title =
|
|
62
|
+
lastToolCall?.tool?.description ?? [t('tool result label'), lastToolCall?.tool?.name].join(' ');
|
|
63
|
+
lastToolCall = undefined;
|
|
64
|
+
return {
|
|
65
|
+
title,
|
|
66
|
+
content: {
|
|
67
|
+
...block,
|
|
68
|
+
result: safeParseJson(block.result),
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
case 'summary': {
|
|
74
|
+
if (!lastToolCall) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
title: t('summary label'),
|
|
80
|
+
content: block,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
.filter(isNonNullable);
|
|
86
|
+
}, [blocks]);
|
|
87
|
+
|
|
88
|
+
const handleChangeOpen = useCallback(() => {
|
|
89
|
+
setTimeout(() => {
|
|
90
|
+
// Measure after animation.
|
|
91
|
+
view?.requestMeasure();
|
|
92
|
+
}, 1_000);
|
|
93
|
+
}, [view]);
|
|
94
|
+
|
|
95
|
+
if (!items.length) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return <ToolContainer items={items} onChangeOpen={handleChangeOpen} />;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
ToolBlock.displayName = 'ToolBlock';
|
|
103
|
+
|
|
104
|
+
type ToolContainerParams = {
|
|
105
|
+
items: { title: string; content: any }[];
|
|
106
|
+
} & Pick<ToggleContainerRootProps, 'onChangeOpen'>;
|
|
107
|
+
|
|
108
|
+
export const ToolContainer = ({ items, onChangeOpen }: ToolContainerParams) => {
|
|
109
|
+
const tabsRef = useRef<HTMLDivElement>(null);
|
|
110
|
+
const [selected, setSelected] = useState(0);
|
|
111
|
+
const [open, setOpen] = useState(false);
|
|
112
|
+
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
onChangeOpen?.(open);
|
|
115
|
+
if (open) {
|
|
116
|
+
tabsRef.current?.focus();
|
|
117
|
+
}
|
|
118
|
+
}, [open, onChangeOpen]);
|
|
119
|
+
|
|
120
|
+
const handleSelect = (index: number) => {
|
|
121
|
+
setSelected(index);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<ToggleContainer.Root classNames='mbs-2 is-full rounded-sm' open={open} onChangeOpen={setOpen}>
|
|
126
|
+
<ToggleContainer.Header classNames='text-sm text-placeholder'>
|
|
127
|
+
<TextCrawl key='status-roll' lines={items.map((item) => item.title)} autoAdvance greedy />
|
|
128
|
+
</ToggleContainer.Header>
|
|
129
|
+
<ToggleContainer.Content classNames='grid grid-cols-[32px_1fr]'>
|
|
130
|
+
<NumericTabs ref={tabsRef} classNames='p-1' length={items.length} selected={selected} onSelect={handleSelect} />
|
|
131
|
+
<Json
|
|
132
|
+
data={items[selected]?.content}
|
|
133
|
+
classNames='p-1 text-xs bg-transparent'
|
|
134
|
+
replacer={{
|
|
135
|
+
maxDepth: 3,
|
|
136
|
+
maxArrayLen: 10,
|
|
137
|
+
maxStringLen: 128,
|
|
138
|
+
}}
|
|
139
|
+
/>
|
|
140
|
+
</ToggleContainer.Content>
|
|
141
|
+
</ToggleContainer.Root>
|
|
142
|
+
);
|
|
143
|
+
};
|
|
@@ -2,48 +2,41 @@
|
|
|
2
2
|
// Copyright 2025 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 from 'react';
|
|
9
7
|
|
|
10
|
-
import { IntentPlugin,
|
|
8
|
+
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
11
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
-
import { capabilities } from '@dxos/assistant-
|
|
10
|
+
import { capabilities } from '@dxos/assistant-toolkit';
|
|
13
11
|
import { ChessPlugin } from '@dxos/plugin-chess';
|
|
14
12
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
15
13
|
import { MapPlugin } from '@dxos/plugin-map';
|
|
16
14
|
import { SpacePlugin } from '@dxos/plugin-space';
|
|
17
15
|
import { TablePlugin } from '@dxos/plugin-table';
|
|
18
|
-
import {
|
|
16
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
19
17
|
|
|
20
|
-
import { Toolbox, type ToolboxProps } from './Toolbox';
|
|
21
18
|
import { translations } from '../../translations';
|
|
22
19
|
|
|
20
|
+
import { Toolbox, type ToolboxProps } from './Toolbox';
|
|
21
|
+
|
|
23
22
|
const DefaultStory = (props: ToolboxProps) => {
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<Toolbox
|
|
27
|
-
{...props}
|
|
28
|
-
artifacts={artifactDefinitions}
|
|
29
|
-
classNames='w-[30rem] h-[15rem] rounded-sm border border-separator py-1'
|
|
30
|
-
/>
|
|
31
|
-
);
|
|
23
|
+
return <Toolbox {...props} classNames='is-[30rem] bs-[15rem] rounded-sm border border-separator plb-1' />;
|
|
32
24
|
};
|
|
33
25
|
|
|
34
|
-
const meta
|
|
26
|
+
const meta = {
|
|
35
27
|
title: 'plugins/plugin-assistant/Toolbox',
|
|
36
|
-
component: Toolbox,
|
|
28
|
+
component: Toolbox as any,
|
|
37
29
|
render: DefaultStory,
|
|
38
30
|
decorators: [
|
|
31
|
+
withTheme,
|
|
39
32
|
withPluginManager({
|
|
40
33
|
plugins: [
|
|
41
34
|
ClientPlugin({
|
|
42
|
-
onClientInitialized: async (
|
|
35
|
+
onClientInitialized: async ({ client }) => {
|
|
43
36
|
await client.halo.createIdentity();
|
|
44
37
|
},
|
|
45
38
|
}),
|
|
46
|
-
SpacePlugin(),
|
|
39
|
+
SpacePlugin({}),
|
|
47
40
|
SettingsPlugin(),
|
|
48
41
|
IntentPlugin(),
|
|
49
42
|
ChessPlugin(),
|
|
@@ -52,17 +45,15 @@ const meta: Meta<typeof Toolbox> = {
|
|
|
52
45
|
],
|
|
53
46
|
capabilities,
|
|
54
47
|
}),
|
|
55
|
-
withTheme,
|
|
56
|
-
withLayout(),
|
|
57
48
|
],
|
|
58
49
|
parameters: {
|
|
59
50
|
layout: 'centered',
|
|
60
51
|
translations,
|
|
61
52
|
},
|
|
62
|
-
}
|
|
53
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
63
54
|
|
|
64
55
|
export default meta;
|
|
65
56
|
|
|
66
|
-
type Story =
|
|
57
|
+
type Story = StoryObj<typeof meta>;
|
|
67
58
|
|
|
68
59
|
export const Default: Story = {};
|
|
@@ -2,43 +2,30 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { type FC, Fragment, useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { parseToolName, type Tool } from '@dxos/ai';
|
|
8
|
-
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
9
|
-
import { type ArtifactDefinition } from '@dxos/blueprints';
|
|
10
7
|
import { type Blueprint } from '@dxos/blueprints';
|
|
11
8
|
import { type Ref } from '@dxos/echo';
|
|
12
|
-
import {
|
|
9
|
+
import { Function } from '@dxos/functions';
|
|
13
10
|
import { log } from '@dxos/log';
|
|
14
11
|
import { Filter, type Space, useQuery } from '@dxos/react-client/echo';
|
|
15
12
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
16
13
|
import { useTranslation } from '@dxos/react-ui';
|
|
17
14
|
import { mx } from '@dxos/react-ui-theme';
|
|
18
15
|
|
|
19
|
-
import { type ChatProcessor } from '../../hooks';
|
|
20
16
|
import { meta } from '../../meta';
|
|
21
|
-
import {
|
|
17
|
+
import { type AiChatProcessor } from '../../processor';
|
|
22
18
|
import { ServiceType } from '../../types';
|
|
23
19
|
|
|
24
20
|
export type ToolboxProps = ThemedClassName<{
|
|
21
|
+
services?: { service: ServiceType }[];
|
|
22
|
+
functions?: Function.Function[];
|
|
23
|
+
// TODO(burdon): Combine into single array.
|
|
25
24
|
blueprints?: readonly Ref.Ref<Blueprint.Blueprint>[];
|
|
26
|
-
artifacts?: ArtifactDefinition[];
|
|
27
|
-
services?: { service: ServiceType; tools: Tool[] }[];
|
|
28
|
-
functions?: FunctionType[];
|
|
29
25
|
activeBlueprints?: readonly Ref.Ref<Blueprint.Blueprint>[];
|
|
30
|
-
striped?: boolean;
|
|
31
26
|
}>;
|
|
32
27
|
|
|
33
|
-
export const Toolbox = ({
|
|
34
|
-
classNames,
|
|
35
|
-
artifacts,
|
|
36
|
-
functions,
|
|
37
|
-
services,
|
|
38
|
-
blueprints,
|
|
39
|
-
activeBlueprints,
|
|
40
|
-
striped,
|
|
41
|
-
}: ToolboxProps) => {
|
|
28
|
+
export const Toolbox = ({ classNames, functions, services, blueprints, activeBlueprints }: ToolboxProps) => {
|
|
42
29
|
const { t } = useTranslation(meta.id);
|
|
43
30
|
|
|
44
31
|
return (
|
|
@@ -49,7 +36,7 @@ export const Toolbox = ({
|
|
|
49
36
|
items={blueprints.map(({ target }) => ({
|
|
50
37
|
name: target?.name ?? '',
|
|
51
38
|
description: target?.description ?? '',
|
|
52
|
-
subitems: target?.tools.map((toolId) => ({ name: `∙ ${
|
|
39
|
+
subitems: target?.tools.map((toolId) => ({ name: `∙ ${safeToolId(toolId)}` })),
|
|
53
40
|
}))}
|
|
54
41
|
/>
|
|
55
42
|
)}
|
|
@@ -60,18 +47,7 @@ export const Toolbox = ({
|
|
|
60
47
|
items={activeBlueprints.map(({ target }) => ({
|
|
61
48
|
name: target?.name ?? '',
|
|
62
49
|
description: target?.description ?? '',
|
|
63
|
-
subitems: target?.tools.map((toolId) => ({ name: `∙ ${
|
|
64
|
-
}))}
|
|
65
|
-
/>
|
|
66
|
-
)}
|
|
67
|
-
|
|
68
|
-
{artifacts && artifacts.length > 0 && (
|
|
69
|
-
<Section
|
|
70
|
-
title='Artifacts'
|
|
71
|
-
items={artifacts.map(({ name, description, tools }) => ({
|
|
72
|
-
name,
|
|
73
|
-
description,
|
|
74
|
-
subitems: tools.map(({ name, description }) => ({ name: `∙ ${parseToolName(name)}`, description })),
|
|
50
|
+
subitems: target?.tools.map((toolId) => ({ name: `∙ ${safeToolId(toolId)}` })),
|
|
75
51
|
}))}
|
|
76
52
|
/>
|
|
77
53
|
)}
|
|
@@ -79,10 +55,10 @@ export const Toolbox = ({
|
|
|
79
55
|
{services && services.length > 0 && (
|
|
80
56
|
<Section
|
|
81
57
|
title='Services'
|
|
82
|
-
items={services.map(({ service: { serviceId, name, description }
|
|
58
|
+
items={services.map(({ service: { serviceId, name, description } }) => ({
|
|
83
59
|
name: name ?? serviceId,
|
|
84
60
|
description,
|
|
85
|
-
subitems: tools.map(({ name, description }) => ({ name: `∙ ${name}`, description })),
|
|
61
|
+
// subitems: tools.map(({ name, description }) => ({ name: `∙ ${name}`, description })),
|
|
86
62
|
}))}
|
|
87
63
|
/>
|
|
88
64
|
)}
|
|
@@ -90,12 +66,6 @@ export const Toolbox = ({
|
|
|
90
66
|
{functions && functions.length > 0 && (
|
|
91
67
|
<Section title='Functions' items={functions.map(({ name, description }) => ({ name, description }))} />
|
|
92
68
|
)}
|
|
93
|
-
|
|
94
|
-
{!blueprints?.length &&
|
|
95
|
-
!activeBlueprints?.length &&
|
|
96
|
-
!artifacts?.length &&
|
|
97
|
-
!services?.length &&
|
|
98
|
-
!functions?.length && <div>{t('no tools')}</div>}
|
|
99
69
|
</div>
|
|
100
70
|
);
|
|
101
71
|
};
|
|
@@ -107,11 +77,11 @@ const Section: FC<{
|
|
|
107
77
|
}> = ({ title, items, striped }) => {
|
|
108
78
|
const stripeClassNames = 'odd:bg-neutral-50 dark:odd:bg-neutral-800';
|
|
109
79
|
const gridClassNames = 'grid grid-cols-[8rem_1fr]';
|
|
110
|
-
const subGridClassNames = mx('col-span-full grid grid-cols-subgrid text-xs
|
|
80
|
+
const subGridClassNames = mx('col-span-full grid grid-cols-subgrid text-xs pli-2', striped && stripeClassNames);
|
|
111
81
|
|
|
112
82
|
return (
|
|
113
83
|
<div>
|
|
114
|
-
<h1 className='
|
|
84
|
+
<h1 className='pli-2 text-sm'>{title}</h1>
|
|
115
85
|
<div className={gridClassNames}>
|
|
116
86
|
{items.map(({ name, description, subitems }, i) => (
|
|
117
87
|
<Fragment key={i}>
|
|
@@ -136,37 +106,37 @@ const Section: FC<{
|
|
|
136
106
|
|
|
137
107
|
export type ToolboxContainerProps = ThemedClassName<{
|
|
138
108
|
space?: Space;
|
|
139
|
-
processor?:
|
|
109
|
+
processor?: AiChatProcessor;
|
|
140
110
|
}>;
|
|
141
111
|
|
|
142
112
|
export const ToolboxContainer = ({ classNames, space, processor }: ToolboxContainerProps) => {
|
|
143
|
-
// Plugin artifacts.
|
|
144
|
-
const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
|
|
145
|
-
|
|
146
113
|
// Registered services.
|
|
147
114
|
const services = useQuery(space, Filter.type(ServiceType));
|
|
148
|
-
const [serviceTools, setServiceTools] = useState<{ service: ServiceType
|
|
115
|
+
const [serviceTools, setServiceTools] = useState<{ service: ServiceType }[]>([]);
|
|
149
116
|
useEffect(() => {
|
|
150
117
|
log('creating service tools...', { services: services.length });
|
|
151
118
|
queueMicrotask(async () => {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
)
|
|
155
|
-
|
|
156
|
-
setServiceTools(tools);
|
|
119
|
+
// TODO(burdon): Fix.
|
|
120
|
+
// const tools = await Promise.all(
|
|
121
|
+
// services.map(async (service) => ({ service, tools: await createToolsFromService(service) })),
|
|
122
|
+
// );
|
|
123
|
+
// setServiceTools(tools);
|
|
157
124
|
});
|
|
158
125
|
}, [services]);
|
|
159
126
|
|
|
160
127
|
// Deployed functions.
|
|
161
|
-
const functions = useQuery(space, Filter.type(
|
|
128
|
+
const functions = useQuery(space, Filter.type(Function.Function));
|
|
162
129
|
|
|
163
130
|
return (
|
|
164
131
|
<Toolbox
|
|
165
132
|
classNames={classNames}
|
|
166
133
|
blueprints={processor?.context.blueprints.value}
|
|
167
|
-
artifacts={artifactDefinitions}
|
|
168
134
|
services={serviceTools}
|
|
169
135
|
functions={functions}
|
|
170
136
|
/>
|
|
171
137
|
);
|
|
172
138
|
};
|
|
139
|
+
|
|
140
|
+
const safeToolId = (name: string) => {
|
|
141
|
+
return name.split('_').pop();
|
|
142
|
+
};
|
package/src/components/index.ts
CHANGED
|
@@ -6,15 +6,11 @@ import { lazy } from 'react';
|
|
|
6
6
|
|
|
7
7
|
export * from './AssistantSettings';
|
|
8
8
|
export * from './Chat';
|
|
9
|
-
export * from './PromptSettings';
|
|
10
9
|
export * from './TemplateEditor';
|
|
11
10
|
export * from './Toolbox';
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// https://github.com/microsoft/fluentui/issues/34020
|
|
16
|
-
|
|
17
|
-
export const BlueprintContainer = lazy(() => import('./BlueprintContainer'));
|
|
12
|
+
export const BlueprintArticle = lazy(() => import('./BlueprintArticle'));
|
|
13
|
+
export const ChatCompanion = lazy(() => import('./ChatCompanion'));
|
|
18
14
|
export const ChatContainer = lazy(() => import('./ChatContainer'));
|
|
19
15
|
export const ChatDialog = lazy(() => import('./ChatDialog'));
|
|
20
|
-
export const
|
|
16
|
+
export const PromptArticle = lazy(() => import('./PromptArticle'));
|
package/src/events.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { defineEvent } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
7
|
import { meta } from './meta';
|
|
8
8
|
|
|
9
9
|
export namespace AssistantEvents {
|
|
10
|
-
export const
|
|
10
|
+
export const SetupAiServiceProviders = defineEvent(`${meta.id}/event/setup-ai-service-providers`);
|
|
11
11
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { defineFunction } from '@dxos/functions';
|
|
9
|
+
import { log } from '@dxos/log';
|
|
10
|
+
|
|
11
|
+
export default defineFunction({
|
|
12
|
+
key: 'dxos.org/function/assistant-analysis',
|
|
13
|
+
name: 'Assistant analysis',
|
|
14
|
+
description: 'Enter analysis analysis mode.',
|
|
15
|
+
inputSchema: Schema.Struct({
|
|
16
|
+
enable: Schema.Boolean.annotations({ description: 'Enable or disable analysis mode.' }),
|
|
17
|
+
}),
|
|
18
|
+
outputSchema: Schema.Void,
|
|
19
|
+
handler: Effect.fn(function* ({ context, data: { enable } }) {
|
|
20
|
+
log.info('analysis mode', { enable });
|
|
21
|
+
}),
|
|
22
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { Filter, Obj, Query } from '@dxos/echo';
|
|
9
|
+
import { DatabaseService, defineFunction } from '@dxos/functions';
|
|
10
|
+
import { trim } from '@dxos/util';
|
|
11
|
+
|
|
12
|
+
// TODO(burdon): Move to toolkit (i.e., tool not function).
|
|
13
|
+
export default defineFunction({
|
|
14
|
+
key: 'dxos.org/function/assistant/object-list',
|
|
15
|
+
name: 'List objects',
|
|
16
|
+
description:
|
|
17
|
+
// TODO(wittjosiah): Find a better way to prompt for looking up typenames before querying with them.
|
|
18
|
+
trim`
|
|
19
|
+
Lists the objects of the given type.
|
|
20
|
+
Check the get-schemas tool for available types before calling this function.
|
|
21
|
+
`,
|
|
22
|
+
inputSchema: Schema.Struct({
|
|
23
|
+
typename: Schema.String.annotations({
|
|
24
|
+
description: 'The typename of the objects to list.',
|
|
25
|
+
}),
|
|
26
|
+
}),
|
|
27
|
+
outputSchema: Schema.Struct({
|
|
28
|
+
results: Schema.Array(
|
|
29
|
+
Schema.Struct({
|
|
30
|
+
dxn: Schema.String.annotations({ description: 'The DXN of the object.' }),
|
|
31
|
+
label: Schema.optional(Schema.String.annotations({ description: 'The label of the object.' })),
|
|
32
|
+
}),
|
|
33
|
+
),
|
|
34
|
+
}),
|
|
35
|
+
handler: Effect.fn(function* ({ data: { typename } }) {
|
|
36
|
+
// TODO(wittjosiah): Typename query is not working for dynamic schemas.
|
|
37
|
+
const [schema] = yield* DatabaseService.runSchemaQuery({ typename });
|
|
38
|
+
const filter = schema ? Filter.type(schema) : Filter.typename(typename);
|
|
39
|
+
|
|
40
|
+
const { objects } = yield* DatabaseService.runQuery(Query.select(filter));
|
|
41
|
+
const results = objects.map((object) => ({
|
|
42
|
+
dxn: Obj.getDXN(object).toString(),
|
|
43
|
+
label: Obj.getLabel(object),
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
return { results };
|
|
47
|
+
}),
|
|
48
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Function from 'effect/Function';
|
|
7
|
+
import * as Option from 'effect/Option';
|
|
8
|
+
import * as Schema from 'effect/Schema';
|
|
9
|
+
|
|
10
|
+
import { ArtifactId } from '@dxos/assistant';
|
|
11
|
+
import { Obj } from '@dxos/echo';
|
|
12
|
+
import { DatabaseService, defineFunction } from '@dxos/functions';
|
|
13
|
+
|
|
14
|
+
// TODO(burdon): Move to toolkit (i.e., tool not function).
|
|
15
|
+
export default defineFunction({
|
|
16
|
+
key: 'dxos.org/function/assistant/object-load',
|
|
17
|
+
name: 'Load object',
|
|
18
|
+
description: 'Loads the object.',
|
|
19
|
+
inputSchema: Schema.Struct({
|
|
20
|
+
id: ArtifactId.annotations({
|
|
21
|
+
description: 'The ID of the object.',
|
|
22
|
+
}),
|
|
23
|
+
typename: Schema.String.annotations({
|
|
24
|
+
description: 'The typename of the object.',
|
|
25
|
+
}),
|
|
26
|
+
}),
|
|
27
|
+
outputSchema: Schema.Struct({
|
|
28
|
+
// TODO(wittjosiah): Type.Entity.Any
|
|
29
|
+
object: Schema.Any,
|
|
30
|
+
}),
|
|
31
|
+
handler: Effect.fn(function* ({ data: { id, typename } }) {
|
|
32
|
+
const object = yield* DatabaseService.resolve(ArtifactId.toDXN(id));
|
|
33
|
+
return yield* Function.pipe(
|
|
34
|
+
Option.fromNullable(object),
|
|
35
|
+
Option.flatMap((object) => (Obj.getTypename(object) === typename ? Option.some(object) : Option.none())),
|
|
36
|
+
Option.match({
|
|
37
|
+
onNone: () => Effect.fail('Object not found.'),
|
|
38
|
+
onSome: (object) => {
|
|
39
|
+
// log.info('object', { object });
|
|
40
|
+
return Effect.succeed({ object });
|
|
41
|
+
},
|
|
42
|
+
}),
|
|
43
|
+
);
|
|
44
|
+
}),
|
|
45
|
+
});
|
package/src/hooks/index.ts
CHANGED
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './presets';
|
|
7
|
-
|
|
8
|
-
export * from './useBlueprints';
|
|
5
|
+
export * from './useBlueprintRegistry';
|
|
9
6
|
export * from './useChatProcessor';
|
|
10
7
|
export * from './useChatServices';
|
|
8
|
+
export * from './useChatToolbarActions';
|
|
9
|
+
export * from './useContextBinder';
|
|
10
|
+
export * from './useContextObjects';
|
|
11
|
+
export * from './useFilteredTypes';
|
|
12
|
+
export * from './useFlush';
|
|
13
|
+
export * from './useOnline';
|
|
14
|
+
export * from './usePresets';
|
|
11
15
|
export * from './useReferencesProvider';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useSignalEffect } from '@preact/signals-react';
|
|
6
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capabilities } from '@dxos/app-framework';
|
|
9
|
+
import { useCapabilities } from '@dxos/app-framework/react';
|
|
10
|
+
import { type AiContextBinder } from '@dxos/assistant';
|
|
11
|
+
import { Blueprint } from '@dxos/blueprints';
|
|
12
|
+
import { type Space } from '@dxos/client/echo';
|
|
13
|
+
import { Filter, Obj, Ref } from '@dxos/echo';
|
|
14
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
15
|
+
import { distinctBy, isNonNullable } from '@dxos/util';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Provide a registry of blueprints from plugins.
|
|
19
|
+
*/
|
|
20
|
+
// TODO(burdon): Reconcile with eventual public registry.
|
|
21
|
+
export const useBlueprintRegistry = () => {
|
|
22
|
+
const blueprints = useCapabilities(Capabilities.BlueprintDefinition);
|
|
23
|
+
return useMemo(() => new Blueprint.Registry(blueprints), [blueprints]);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const useBlueprints = ({
|
|
27
|
+
blueprintRegistry,
|
|
28
|
+
space,
|
|
29
|
+
}: {
|
|
30
|
+
blueprintRegistry?: Blueprint.Registry;
|
|
31
|
+
space?: Space;
|
|
32
|
+
}) => {
|
|
33
|
+
const staticBlueprints = useMemo(() => blueprintRegistry?.query() ?? [], [blueprintRegistry]);
|
|
34
|
+
const spaceBlueprints = useQuery(space, Filter.type(Blueprint.Blueprint));
|
|
35
|
+
return useMemo(() => {
|
|
36
|
+
const blueprints = distinctBy([...staticBlueprints, ...spaceBlueprints], (b) => b.key);
|
|
37
|
+
blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
|
|
38
|
+
return blueprints;
|
|
39
|
+
}, [staticBlueprints, spaceBlueprints]);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Create reactive map of active blueprints (by key).
|
|
44
|
+
*/
|
|
45
|
+
export const useActiveBlueprints = ({ context }: { context?: AiContextBinder }) => {
|
|
46
|
+
const [active, setActive] = useState<Map<string, Blueprint.Blueprint>>(new Map());
|
|
47
|
+
|
|
48
|
+
useSignalEffect(() => {
|
|
49
|
+
const refs = [...(context?.blueprints.value ?? [])];
|
|
50
|
+
const blueprints = refs.map((ref) => ref.target).filter(isNonNullable);
|
|
51
|
+
setActive(new Map(blueprints.map((blueprint) => [blueprint.key, blueprint])));
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return active;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// TODO(burdon): Move logic into binder.
|
|
58
|
+
export const useBlueprintHandlers = ({
|
|
59
|
+
space,
|
|
60
|
+
context,
|
|
61
|
+
blueprintRegistry,
|
|
62
|
+
}: {
|
|
63
|
+
space: Space;
|
|
64
|
+
context?: AiContextBinder;
|
|
65
|
+
blueprintRegistry?: Blueprint.Registry;
|
|
66
|
+
}) => {
|
|
67
|
+
const onUpdateBlueprint = useCallback(
|
|
68
|
+
async (key: string, checked: boolean) => {
|
|
69
|
+
if (!context || !blueprintRegistry) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Find existing cloned blueprint.
|
|
74
|
+
const { objects } = await space.db.query(Filter.type(Blueprint.Blueprint)).run();
|
|
75
|
+
let storedBlueprint = objects.find((blueprint) => blueprint.key === key);
|
|
76
|
+
if (checked) {
|
|
77
|
+
if (!storedBlueprint) {
|
|
78
|
+
const blueprint = blueprintRegistry.getByKey(key);
|
|
79
|
+
if (!blueprint) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// NOTE: Possible race condition with other peers.
|
|
84
|
+
storedBlueprint = space.db.add(Obj.clone(blueprint));
|
|
85
|
+
}
|
|
86
|
+
await context.bind({ blueprints: [Ref.make(storedBlueprint)] });
|
|
87
|
+
} else if (storedBlueprint) {
|
|
88
|
+
await context.unbind({ blueprints: [Ref.make(storedBlueprint)] });
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
[space, context, blueprintRegistry],
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
return { onUpdateBlueprint };
|
|
95
|
+
};
|