@dxos/plugin-assistant 0.8.4-main.2e9d522 → 0.8.4-main.3eb6e50203
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-6SP2ZWJ2.mjs +30 -0
- package/dist/lib/browser/BlueprintArticle-6SP2ZWJ2.mjs.map +7 -0
- package/dist/lib/browser/ChatCompanion-CAKFZAWN.mjs +200 -0
- package/dist/lib/browser/ChatCompanion-CAKFZAWN.mjs.map +7 -0
- package/dist/lib/browser/ChatContainer-QB37VONJ.mjs +73 -0
- package/dist/lib/browser/ChatContainer-QB37VONJ.mjs.map +7 -0
- package/dist/lib/browser/ChatDialog-ASVBLOOS.mjs +85 -0
- package/dist/lib/browser/ChatDialog-ASVBLOOS.mjs.map +7 -0
- package/dist/lib/browser/InitiativeContainer-V522FCYH.mjs +266 -0
- package/dist/lib/browser/InitiativeContainer-V522FCYH.mjs.map +7 -0
- package/dist/lib/browser/PromptArticle-PK3CBRUB.mjs +52 -0
- package/dist/lib/browser/PromptArticle-PK3CBRUB.mjs.map +7 -0
- package/dist/lib/browser/ai-service-CY2BYPH6.mjs +22 -0
- package/dist/lib/browser/ai-service-CY2BYPH6.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-MUZGUQSC.mjs +234 -0
- package/dist/lib/browser/app-graph-builder-MUZGUQSC.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-YAGWYVCL.mjs +14 -0
- package/dist/lib/browser/blueprint-definition-YAGWYVCL.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +12 -0
- package/dist/lib/browser/blueprints/index.mjs.map +7 -0
- package/dist/lib/browser/chunk-3ETBCBMH.mjs +47 -0
- package/dist/lib/browser/chunk-3ETBCBMH.mjs.map +7 -0
- package/dist/lib/browser/chunk-6BVCG5SJ.mjs +230 -0
- package/dist/lib/browser/chunk-6BVCG5SJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-DKQMSMBN.mjs +326 -0
- package/dist/lib/browser/chunk-DKQMSMBN.mjs.map +7 -0
- package/dist/lib/browser/chunk-EXVT7D4B.mjs +23 -0
- package/dist/lib/browser/chunk-EXVT7D4B.mjs.map +7 -0
- package/dist/lib/browser/chunk-IJYAKPEU.mjs +286 -0
- package/dist/lib/browser/chunk-IJYAKPEU.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-JA7PUZC7.mjs +1974 -0
- package/dist/lib/browser/chunk-JA7PUZC7.mjs.map +7 -0
- package/dist/lib/browser/chunk-POPBT2AQ.mjs +198 -0
- package/dist/lib/browser/chunk-POPBT2AQ.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-YTMFQEN5.mjs +21 -0
- package/dist/lib/browser/edge-model-resolver-YTMFQEN5.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +310 -156
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/local-model-resolver-CGRQH37T.mjs +20 -0
- package/dist/lib/browser/local-model-resolver-CGRQH37T.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-2673CFJS.mjs +133 -0
- package/dist/lib/browser/operation-resolver-2673CFJS.mjs.map +7 -0
- package/dist/lib/browser/react-surface-T3FN4GVP.mjs +125 -0
- package/dist/lib/browser/react-surface-T3FN4GVP.mjs.map +7 -0
- package/dist/lib/browser/repair-IRXDYF4R.mjs +51 -0
- package/dist/lib/browser/repair-IRXDYF4R.mjs.map +7 -0
- package/dist/lib/browser/settings-XF6GKHCG.mjs +33 -0
- package/dist/lib/browser/settings-XF6GKHCG.mjs.map +7 -0
- package/dist/lib/browser/state-OYDPWLKA.mjs +26 -0
- package/dist/lib/browser/state-OYDPWLKA.mjs.map +7 -0
- package/dist/lib/browser/toolkit-IDXQCSTX.mjs +19 -0
- package/dist/lib/browser/toolkit-IDXQCSTX.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +11 -4
- package/dist/lib/node-esm/BlueprintArticle-7LI6UXKZ.mjs +31 -0
- package/dist/lib/node-esm/BlueprintArticle-7LI6UXKZ.mjs.map +7 -0
- package/dist/lib/node-esm/ChatCompanion-W4PGOCGR.mjs +201 -0
- package/dist/lib/node-esm/ChatCompanion-W4PGOCGR.mjs.map +7 -0
- package/dist/lib/node-esm/ChatContainer-ECFQVH6O.mjs +74 -0
- package/dist/lib/node-esm/ChatContainer-ECFQVH6O.mjs.map +7 -0
- package/dist/lib/node-esm/ChatDialog-AFLPYSIU.mjs +86 -0
- package/dist/lib/node-esm/ChatDialog-AFLPYSIU.mjs.map +7 -0
- package/dist/lib/node-esm/InitiativeContainer-U4LGO3BW.mjs +267 -0
- package/dist/lib/node-esm/InitiativeContainer-U4LGO3BW.mjs.map +7 -0
- package/dist/lib/node-esm/PromptArticle-BHPABYLT.mjs +53 -0
- package/dist/lib/node-esm/PromptArticle-BHPABYLT.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-ZI3A6RVG.mjs +23 -0
- package/dist/lib/node-esm/ai-service-ZI3A6RVG.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-4QN5M6PD.mjs +235 -0
- package/dist/lib/node-esm/app-graph-builder-4QN5M6PD.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-H3LFAEK2.mjs +15 -0
- package/dist/lib/node-esm/blueprint-definition-H3LFAEK2.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +13 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-2LEN26ZQ.mjs +48 -0
- package/dist/lib/node-esm/chunk-2LEN26ZQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-3XC7LQSO.mjs +1975 -0
- package/dist/lib/node-esm/chunk-3XC7LQSO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-75PHXBN3.mjs +327 -0
- package/dist/lib/node-esm/chunk-75PHXBN3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-F6LA7XNS.mjs +199 -0
- package/dist/lib/node-esm/chunk-F6LA7XNS.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-LB72WG6R.mjs +231 -0
- package/dist/lib/node-esm/chunk-LB72WG6R.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MJD5XWQV.mjs +288 -0
- package/dist/lib/node-esm/chunk-MJD5XWQV.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs +25 -0
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-CMJ3KNLQ.mjs +22 -0
- package/dist/lib/node-esm/edge-model-resolver-CMJ3KNLQ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +310 -156
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/local-model-resolver-FFDAKOXN.mjs +21 -0
- package/dist/lib/node-esm/local-model-resolver-FFDAKOXN.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-2ZD2DXOU.mjs +134 -0
- package/dist/lib/node-esm/operation-resolver-2ZD2DXOU.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-T4VMCCKZ.mjs +126 -0
- package/dist/lib/node-esm/react-surface-T4VMCCKZ.mjs.map +7 -0
- package/dist/lib/node-esm/repair-DMI55PON.mjs +52 -0
- package/dist/lib/node-esm/repair-DMI55PON.mjs.map +7 -0
- package/dist/lib/node-esm/settings-NGGZA7S7.mjs +34 -0
- package/dist/lib/node-esm/settings-NGGZA7S7.mjs.map +7 -0
- package/dist/lib/node-esm/state-VSCPGN7R.mjs +27 -0
- package/dist/lib/node-esm/state-VSCPGN7R.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-JPRJRDDB.mjs +20 -0
- package/dist/lib/node-esm/toolkit-JPRJRDDB.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +11 -4
- package/dist/types/src/AssistantPlugin.d.ts +2 -1
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/assistant-blueprint.d.ts +11 -0
- package/dist/types/src/blueprints/assistant-blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +7 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts +6 -0
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts.map +1 -0
- package/dist/types/src/capabilities/ai-service/index.d.ts +3 -0
- package/dist/types/src/capabilities/ai-service/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +26 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +4 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts +7 -0
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/edge-model-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +11 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/local-model-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts +13 -0
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/repair/index.d.ts +3 -0
- package/dist/types/src/capabilities/repair/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/repair/repair.d.ts +6 -0
- package/dist/types/src/capabilities/repair/repair.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +15 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +18 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +11 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +13 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit/index.d.ts +3 -0
- package/dist/types/src/capabilities/toolkit/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts +6 -0
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +4 -2
- 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 +37 -21
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +10 -1
- 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 +16 -8
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts +2 -2
- 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 +5 -6
- 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 +13 -11
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +285 -71
- 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/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/InitiativeContainer.d.ts +9 -0
- package/dist/types/src/components/InitiativeContainer.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 +3 -6
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +431 -7
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +13 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +428 -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 +9 -15
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +432 -5
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/TriggerStatus/TriggerStatus.d.ts +4 -0
- package/dist/types/src/components/TriggerStatus/TriggerStatus.d.ts.map +1 -0
- package/dist/types/src/components/TriggerStatus/index.d.ts +2 -0
- package/dist/types/src/components/TriggerStatus/index.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts +12 -0
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/Typewriter.d.ts +11 -0
- package/dist/types/src/components/Typewriter/Typewriter.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts +7 -0
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/assistant-extension.d.ts +5 -0
- package/dist/types/src/components/Typewriter/assistant-extension.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/index.d.ts +2 -0
- package/dist/types/src/components/Typewriter/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +10 -7
- package/dist/types/src/components/index.d.ts.map +1 -1
- 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/functions/object-search.d.ts +10 -0
- package/dist/types/src/functions/object-search.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 +10 -20
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +7 -8
- 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 +3 -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 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +3 -4
- 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 +79 -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 +8 -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 +376 -37
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +20 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -0
- package/dist/types/src/types/AssistantAction.d.ts +97 -0
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +33 -0
- package/dist/types/src/types/capabilities.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/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +6 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +14 -213
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +125 -96
- package/src/AssistantPlugin.tsx +159 -88
- package/src/blueprints/assistant-blueprint.ts +57 -0
- package/src/blueprints/index.ts +12 -0
- package/src/capabilities/ai-service/ai-service.ts +30 -0
- package/src/capabilities/ai-service/index.ts +7 -0
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +200 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +74 -0
- package/src/capabilities/blueprint-definition/index.ts +8 -0
- package/src/capabilities/edge-model-resolver/edge-model-resolver.ts +33 -0
- package/src/capabilities/edge-model-resolver/index.ts +7 -0
- package/src/capabilities/index.ts +11 -6
- package/src/capabilities/local-model-resolver/index.ts +7 -0
- package/src/capabilities/local-model-resolver/local-model-resolver.ts +38 -0
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +112 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +111 -0
- package/src/capabilities/repair/index.ts +7 -0
- package/src/capabilities/repair/repair.ts +62 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +31 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +27 -0
- package/src/capabilities/toolkit/index.ts +7 -0
- package/src/capabilities/toolkit/toolkit.ts +27 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +92 -77
- package/src/components/BlueprintArticle.tsx +28 -0
- package/src/components/Chat/Chat.tsx +267 -197
- package/src/components/Chat/events.ts +14 -1
- package/src/components/ChatCompanion.tsx +226 -0
- package/src/components/ChatContainer.tsx +56 -33
- package/src/components/ChatDialog.tsx +30 -19
- package/src/components/ChatProgress/ChatProgress.tsx +53 -0
- package/src/components/{SequenceEditor → ChatProgress}/index.ts +1 -1
- package/src/components/ChatPrompt/ChatActions.tsx +19 -27
- package/src/components/ChatPrompt/ChatOptions.tsx +238 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +32 -38
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
- package/src/components/ChatPrompt/index.ts +1 -1
- package/src/components/ChatThread/ChatThread.stories.tsx +123 -116
- package/src/components/ChatThread/ChatThread.tsx +75 -36
- package/src/components/ChatThread/Link.tsx +26 -0
- package/src/components/ChatThread/registry.tsx +174 -0
- package/src/components/ChatThread/sync.test.ts +97 -0
- package/src/components/ChatThread/sync.ts +154 -0
- package/src/components/ChatThread/testing/thread.md +37 -0
- package/src/components/InitiativeContainer.tsx +340 -0
- package/src/components/PromptArticle.tsx +49 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +40 -19
- package/src/components/TemplateEditor/TemplateEditor.tsx +33 -52
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +30 -17
- package/src/components/TemplateEditor/TemplateForm.tsx +82 -32
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +274 -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 +18 -28
- package/src/components/Toolbox/Toolbox.tsx +70 -102
- package/src/components/TriggerStatus/TriggerStatus.tsx +142 -0
- package/src/components/TriggerStatus/index.ts +5 -0
- package/src/components/Typewriter/AssistantToolbar.tsx +161 -0
- package/src/components/Typewriter/Typewriter.stories.tsx +83 -0
- package/src/components/Typewriter/Typewriter.tsx +54 -0
- package/src/components/Typewriter/assistant-extension.tsx +144 -0
- package/src/components/Typewriter/index.ts +5 -0
- package/src/components/index.ts +14 -9
- package/src/functions/index.ts +7 -0
- package/src/functions/object-list.ts +49 -0
- package/src/functions/object-load.ts +44 -0
- package/src/functions/object-search.ts +46 -0
- package/src/hooks/index.ts +8 -4
- package/src/hooks/useBlueprintRegistry.ts +105 -0
- package/src/hooks/useChatProcessor.ts +40 -105
- package/src/hooks/useChatServices.ts +31 -75
- package/src/hooks/useChatToolbarActions.ts +122 -0
- package/src/hooks/useContextBinder.ts +32 -0
- package/src/hooks/useContextObjects.ts +46 -0
- package/src/hooks/useFilteredTypes.ts +37 -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 +15 -12
- package/src/index.ts +2 -1
- package/src/meta.ts +11 -8
- package/src/processor/index.ts +7 -0
- package/src/{hooks → processor}/presets.ts +16 -8
- package/src/processor/processor.test.ts +72 -0
- package/src/processor/processor.ts +301 -0
- package/src/processor/update-name.ts +58 -0
- package/src/queue-logger.ts +17 -18
- package/src/testing/index.ts +1 -1
- package/src/testing/test-generator.ts +262 -0
- package/src/testing/test-sequence.ts +2 -27
- package/src/testing/test-services.ts +10 -14
- package/src/translations.ts +71 -28
- package/src/types/Assistant.ts +28 -0
- package/src/types/AssistantAction.ts +76 -0
- package/src/types/capabilities.ts +27 -0
- package/src/types/defs.ts +5 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +9 -1
- package/src/types/service.ts +25 -14
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/ChatContainer-M3IHQLRS.mjs +0 -54
- package/dist/lib/browser/ChatContainer-M3IHQLRS.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-X6VN6QZI.mjs +0 -72
- package/dist/lib/browser/ChatDialog-X6VN6QZI.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/TemplateContainer-RPJ2LBOB.mjs +0 -27
- package/dist/lib/browser/TemplateContainer-RPJ2LBOB.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-JTXBKE7O.mjs +0 -223
- package/dist/lib/browser/app-graph-builder-JTXBKE7O.mjs.map +0 -7
- package/dist/lib/browser/chunk-AEAEKWOC.mjs +0 -98
- package/dist/lib/browser/chunk-AEAEKWOC.mjs.map +0 -7
- package/dist/lib/browser/chunk-EQDW6BYQ.mjs +0 -108
- package/dist/lib/browser/chunk-EQDW6BYQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
- package/dist/lib/browser/chunk-FDCJSQYF.mjs.map +0 -7
- package/dist/lib/browser/chunk-JQBVLTM5.mjs +0 -158
- package/dist/lib/browser/chunk-JQBVLTM5.mjs.map +0 -7
- package/dist/lib/browser/chunk-OWY4CUQY.mjs +0 -2245
- package/dist/lib/browser/chunk-OWY4CUQY.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs +0 -60
- package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs.map +0 -7
- package/dist/lib/browser/react-surface-66VY37YQ.mjs +0 -150
- package/dist/lib/browser/react-surface-66VY37YQ.mjs.map +0 -7
- package/dist/lib/browser/settings-2DGP3UTS.mjs +0 -22
- package/dist/lib/browser/settings-2DGP3UTS.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-VZT74PO2.mjs +0 -55
- package/dist/lib/node-esm/ChatContainer-VZT74PO2.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-RJ6FDX4Q.mjs +0 -73
- package/dist/lib/node-esm/ChatDialog-RJ6FDX4Q.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/TemplateContainer-A3NAQCZE.mjs +0 -28
- package/dist/lib/node-esm/TemplateContainer-A3NAQCZE.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-OWSOXFTD.mjs +0 -224
- package/dist/lib/node-esm/app-graph-builder-OWSOXFTD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2XL6MNPE.mjs +0 -99
- package/dist/lib/node-esm/chunk-2XL6MNPE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BISJDTBK.mjs +0 -159
- package/dist/lib/node-esm/chunk-BISJDTBK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-E33DNNDW.mjs +0 -109
- package/dist/lib/node-esm/chunk-E33DNNDW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SENTQAEO.mjs +0 -2246
- package/dist/lib/node-esm/chunk-SENTQAEO.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs +0 -61
- package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs +0 -151
- package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs.map +0 -7
- package/dist/lib/node-esm/settings-47RYZOU4.mjs +0 -23
- package/dist/lib/node-esm/settings-47RYZOU4.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.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/components/TemplateContainer.d.ts +0 -8
- package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.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 -249
- 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 -88
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -253
- package/src/capabilities/intent-resolver.ts +0 -58
- package/src/capabilities/react-surface.tsx +0 -138
- package/src/capabilities/settings.ts +0 -19
- 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/components/TemplateContainer.tsx +0 -24
- package/src/events.ts +0 -11
- 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 -378
- 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 -95
- package/src/typings.d.ts +0 -9
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Effect } from 'effect';
|
|
6
|
-
|
|
7
|
-
import { Capabilities, contributes, createIntent, createResolver, type PluginContext } from '@dxos/app-framework';
|
|
8
|
-
import { Sequence } from '@dxos/conductor';
|
|
9
|
-
import { Key, Obj, Ref } from '@dxos/echo';
|
|
10
|
-
import { CollectionAction } from '@dxos/plugin-space/types';
|
|
11
|
-
|
|
12
|
-
import { Assistant } from '../types';
|
|
13
|
-
|
|
14
|
-
export default (context: PluginContext) => [
|
|
15
|
-
contributes(Capabilities.IntentResolver, [
|
|
16
|
-
createResolver({
|
|
17
|
-
intent: Assistant.OnSpaceCreated,
|
|
18
|
-
resolve: ({ space, rootCollection }) =>
|
|
19
|
-
Effect.gen(function* () {
|
|
20
|
-
const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
21
|
-
const { object: collection } = yield* dispatch(
|
|
22
|
-
createIntent(CollectionAction.CreateQueryCollection, { typename: Assistant.Chat.typename }),
|
|
23
|
-
);
|
|
24
|
-
rootCollection.objects.push(Ref.make(collection));
|
|
25
|
-
|
|
26
|
-
const { object: chat } = yield* dispatch(createIntent(Assistant.CreateChat, { space }));
|
|
27
|
-
space.db.add(chat);
|
|
28
|
-
}),
|
|
29
|
-
}),
|
|
30
|
-
createResolver({
|
|
31
|
-
intent: Assistant.CreateChat,
|
|
32
|
-
resolve: ({ space, name }) => ({
|
|
33
|
-
data: {
|
|
34
|
-
object: Obj.make(Assistant.Chat, {
|
|
35
|
-
name,
|
|
36
|
-
queue: Ref.fromDXN(space.queues.create().dxn),
|
|
37
|
-
}),
|
|
38
|
-
},
|
|
39
|
-
}),
|
|
40
|
-
}),
|
|
41
|
-
createResolver({
|
|
42
|
-
intent: Assistant.CreateSequence,
|
|
43
|
-
resolve: ({ name }) => ({
|
|
44
|
-
data: {
|
|
45
|
-
object: Obj.make(Sequence, {
|
|
46
|
-
name,
|
|
47
|
-
steps: [
|
|
48
|
-
{
|
|
49
|
-
id: Key.ObjectId.random(),
|
|
50
|
-
instructions: 'You are a helpful assistant.',
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
}),
|
|
54
|
-
},
|
|
55
|
-
}),
|
|
56
|
-
}),
|
|
57
|
-
]),
|
|
58
|
-
];
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Effect } from 'effect';
|
|
6
|
-
import React, { useEffect, useMemo } from 'react';
|
|
7
|
-
|
|
8
|
-
import { Capabilities, contributes, createIntent, createSurface, useIntentDispatcher } from '@dxos/app-framework';
|
|
9
|
-
import { Template } from '@dxos/blueprints';
|
|
10
|
-
import { fullyQualifiedId, getSpace, getTypename } from '@dxos/client/echo';
|
|
11
|
-
import { Sequence } from '@dxos/conductor';
|
|
12
|
-
import { InvocationTraceContainer } from '@dxos/devtools';
|
|
13
|
-
import { Filter, type Key, Obj, Query } from '@dxos/echo';
|
|
14
|
-
import { SettingsStore } from '@dxos/local-storage';
|
|
15
|
-
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
16
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
AssistantSettings,
|
|
20
|
-
ChatContainer,
|
|
21
|
-
ChatDialog,
|
|
22
|
-
PromptSettings,
|
|
23
|
-
SequenceContainer,
|
|
24
|
-
TemplateContainer,
|
|
25
|
-
} from '../components';
|
|
26
|
-
import { meta, ASSISTANT_DIALOG } from '../meta';
|
|
27
|
-
import { Assistant } from '../types';
|
|
28
|
-
|
|
29
|
-
export default () =>
|
|
30
|
-
contributes(Capabilities.ReactSurface, [
|
|
31
|
-
createSurface({
|
|
32
|
-
id: `${meta.id}/plugin-settings`,
|
|
33
|
-
role: 'article',
|
|
34
|
-
filter: (data): data is { subject: SettingsStore<Assistant.Settings> } =>
|
|
35
|
-
data.subject instanceof SettingsStore && data.subject.prefix === meta.id,
|
|
36
|
-
component: ({ data: { subject } }) => <AssistantSettings settings={subject.value} />,
|
|
37
|
-
}),
|
|
38
|
-
createSurface({
|
|
39
|
-
id: `${meta.id}/chat`,
|
|
40
|
-
role: 'article',
|
|
41
|
-
filter: (data): data is { subject: Assistant.Chat; variant: undefined } =>
|
|
42
|
-
Obj.instanceOf(Assistant.Chat, data.subject) && data.variant !== 'assistant-chat',
|
|
43
|
-
component: ({ data, role }) => <ChatContainer role={role} chat={data.subject} />,
|
|
44
|
-
}),
|
|
45
|
-
createSurface({
|
|
46
|
-
id: `${meta.id}/object-chat`,
|
|
47
|
-
role: 'article',
|
|
48
|
-
filter: (data): data is { companionTo: Obj.Any; subject: Assistant.Chat | 'assistant-chat' } =>
|
|
49
|
-
Obj.isObject(data.companionTo) &&
|
|
50
|
-
(Obj.instanceOf(Assistant.Chat, data.subject) || data.subject === 'assistant-chat'),
|
|
51
|
-
component: ({ data, role }) => {
|
|
52
|
-
const { dispatch } = useIntentDispatcher();
|
|
53
|
-
const associatedArtifact = useMemo(
|
|
54
|
-
() => ({
|
|
55
|
-
id: fullyQualifiedId(data.companionTo),
|
|
56
|
-
typename: getTypename(data.companionTo) ?? 'unknown',
|
|
57
|
-
spaceId: (getSpace(data.companionTo)?.id ?? 'unknown') as Key.SpaceId,
|
|
58
|
-
}),
|
|
59
|
-
[data.companionTo],
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
// TODO(wittjosiah): Factor out to container.
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
const timeout = setTimeout(async () => {
|
|
65
|
-
const space = getSpace(data.companionTo);
|
|
66
|
-
if (space && data.subject === 'assistant-chat') {
|
|
67
|
-
const result = await space.db
|
|
68
|
-
.query(Query.select(Filter.ids(data.companionTo.id)).targetOf(Assistant.CompanionTo).source())
|
|
69
|
-
.run();
|
|
70
|
-
if (result.objects.length > 0) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const program = Effect.gen(function* () {
|
|
75
|
-
const { object } = yield* dispatch(createIntent(Assistant.CreateChat, { space }));
|
|
76
|
-
yield* dispatch(createIntent(SpaceAction.AddObject, { object, target: space, hidden: true }));
|
|
77
|
-
yield* dispatch(
|
|
78
|
-
createIntent(SpaceAction.AddRelation, {
|
|
79
|
-
space,
|
|
80
|
-
schema: Assistant.CompanionTo,
|
|
81
|
-
source: object,
|
|
82
|
-
target: data.companionTo,
|
|
83
|
-
}),
|
|
84
|
-
);
|
|
85
|
-
});
|
|
86
|
-
void Effect.runPromise(program);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
return () => clearTimeout(timeout);
|
|
91
|
-
}, [data.subject]);
|
|
92
|
-
|
|
93
|
-
if (data.subject === 'assistant-chat') {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return <ChatContainer role={role} chat={data.subject} artifact={associatedArtifact} />;
|
|
98
|
-
},
|
|
99
|
-
}),
|
|
100
|
-
createSurface({
|
|
101
|
-
id: `${meta.id}/sequence`,
|
|
102
|
-
role: 'article',
|
|
103
|
-
filter: (data): data is { subject: Sequence } => Obj.instanceOf(Sequence, data.subject),
|
|
104
|
-
component: ({ data }) => <SequenceContainer sequence={data.subject} />,
|
|
105
|
-
}),
|
|
106
|
-
createSurface({
|
|
107
|
-
id: `${meta.id}/companion/logs`,
|
|
108
|
-
role: 'article',
|
|
109
|
-
filter: (data): data is { companionTo: Sequence } =>
|
|
110
|
-
Obj.instanceOf(Sequence, data.companionTo) && data.subject === 'logs',
|
|
111
|
-
component: ({ data, role }) => {
|
|
112
|
-
const space = getSpace(data.companionTo);
|
|
113
|
-
return (
|
|
114
|
-
<StackItem.Content>
|
|
115
|
-
<InvocationTraceContainer space={space} target={data.companionTo} detailAxis='block' />
|
|
116
|
-
</StackItem.Content>
|
|
117
|
-
);
|
|
118
|
-
},
|
|
119
|
-
}),
|
|
120
|
-
createSurface({
|
|
121
|
-
id: `${meta.id}/template`,
|
|
122
|
-
role: 'article',
|
|
123
|
-
filter: (data): data is { subject: Template.Template } => Obj.instanceOf(Template.Template, data.subject),
|
|
124
|
-
component: ({ data }) => <TemplateContainer template={data.subject} />,
|
|
125
|
-
}),
|
|
126
|
-
createSurface({
|
|
127
|
-
id: `${meta.id}/prompt-settings`,
|
|
128
|
-
role: 'object-settings',
|
|
129
|
-
filter: (data): data is { subject: Template.Template } => Obj.instanceOf(Template.Template, data.subject),
|
|
130
|
-
component: ({ data }) => <PromptSettings template={data.subject} />,
|
|
131
|
-
}),
|
|
132
|
-
createSurface({
|
|
133
|
-
id: ASSISTANT_DIALOG,
|
|
134
|
-
role: 'dialog',
|
|
135
|
-
filter: (data): data is { props: { chat: Assistant.Chat } } => data.component === ASSISTANT_DIALOG,
|
|
136
|
-
component: ({ data }) => <ChatDialog {...data.props} />,
|
|
137
|
-
}),
|
|
138
|
-
]);
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Capabilities, contributes } from '@dxos/app-framework';
|
|
6
|
-
import { live } from '@dxos/live-object';
|
|
7
|
-
|
|
8
|
-
import { meta } from '../meta';
|
|
9
|
-
import { Assistant } from '../types';
|
|
10
|
-
|
|
11
|
-
export default () => {
|
|
12
|
-
const settings = live<Assistant.Settings>({});
|
|
13
|
-
|
|
14
|
-
return contributes(Capabilities.Settings, {
|
|
15
|
-
prefix: meta.id,
|
|
16
|
-
schema: Assistant.Settings,
|
|
17
|
-
value: settings,
|
|
18
|
-
});
|
|
19
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useMemo } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Blueprint } from '@dxos/blueprints';
|
|
8
|
-
import { DropdownMenu, IconButton, Input, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
|
|
10
|
-
import { meta } from '../../meta';
|
|
11
|
-
|
|
12
|
-
export type ChatOptionsMenuProps = {
|
|
13
|
-
blueprintRegistry?: Blueprint.Registry;
|
|
14
|
-
blueprints?: Blueprint.Blueprint[];
|
|
15
|
-
onChange?: (key: string, active: boolean) => void;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const ChatOptionsMenu = ({ blueprintRegistry, blueprints, onChange }: ChatOptionsMenuProps) => {
|
|
19
|
-
const { t } = useTranslation(meta.id);
|
|
20
|
-
const blueprintOptions = useMemo(
|
|
21
|
-
() => blueprintRegistry?.query().map((blueprint) => ({ key: blueprint.key, label: blueprint.name })),
|
|
22
|
-
[blueprintRegistry],
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<DropdownMenu.Root>
|
|
27
|
-
<DropdownMenu.Trigger asChild disabled={!blueprintOptions?.length}>
|
|
28
|
-
<IconButton icon='ph--plus--regular' variant='ghost' size={5} iconOnly label={t('button add blueprint')} />
|
|
29
|
-
</DropdownMenu.Trigger>
|
|
30
|
-
<DropdownMenu.Portal>
|
|
31
|
-
<DropdownMenu.Content side='left'>
|
|
32
|
-
<DropdownMenu.Viewport>
|
|
33
|
-
{blueprintOptions?.map((option) => (
|
|
34
|
-
<DropdownMenu.Item key={option.key}>
|
|
35
|
-
<Input.Root>
|
|
36
|
-
<Input.Checkbox
|
|
37
|
-
checked={!!blueprints?.find((blueprint) => blueprint.key === option.key)}
|
|
38
|
-
onCheckedChange={(checked) => onChange?.(option.key, !!checked)}
|
|
39
|
-
/>
|
|
40
|
-
{/* TODO(burdon): Remove need for custom margin. */}
|
|
41
|
-
{/* TODO(burdon): Clicking on label doesn't toggle checkbox. */}
|
|
42
|
-
<Input.Label classNames='m-0'>{option.label}</Input.Label>
|
|
43
|
-
</Input.Root>
|
|
44
|
-
</DropdownMenu.Item>
|
|
45
|
-
))}
|
|
46
|
-
</DropdownMenu.Viewport>
|
|
47
|
-
<DropdownMenu.Arrow />
|
|
48
|
-
</DropdownMenu.Content>
|
|
49
|
-
</DropdownMenu.Portal>
|
|
50
|
-
</DropdownMenu.Root>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { Fragment, type FC, type PropsWithChildren } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Tool } from '@dxos/ai';
|
|
8
|
-
import { Surface } from '@dxos/app-framework';
|
|
9
|
-
import { invariant } from '@dxos/invariant';
|
|
10
|
-
import { type Space } from '@dxos/react-client/echo';
|
|
11
|
-
import { Button, Icon, IconButton, useTranslation, type ThemedClassName } from '@dxos/react-ui';
|
|
12
|
-
import {
|
|
13
|
-
MarkdownViewer,
|
|
14
|
-
ToggleContainer as NativeToggleContainer,
|
|
15
|
-
type ToggleContainerProps,
|
|
16
|
-
} from '@dxos/react-ui-components';
|
|
17
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
18
|
-
import { type ContentBlock, type DataType } from '@dxos/schema';
|
|
19
|
-
import { safeParseJson } from '@dxos/util';
|
|
20
|
-
|
|
21
|
-
import { Json, ToolBlock, isToolMessage } from './ToolBlock';
|
|
22
|
-
import { type ChatProcessor } from '../../hooks';
|
|
23
|
-
import { meta } from '../../meta';
|
|
24
|
-
import { type ChatEvent } from '../Chat';
|
|
25
|
-
import { ToolboxContainer } from '../Toolbox';
|
|
26
|
-
|
|
27
|
-
export type ChatMessageProps = ThemedClassName<{
|
|
28
|
-
debug?: boolean;
|
|
29
|
-
space?: Space;
|
|
30
|
-
message: DataType.Message;
|
|
31
|
-
// TODO(burdon): Move to context.
|
|
32
|
-
processor?: ChatProcessor;
|
|
33
|
-
tools?: Tool[];
|
|
34
|
-
onEvent?: (event: ChatEvent) => void;
|
|
35
|
-
}>;
|
|
36
|
-
|
|
37
|
-
export const ChatMessage = ({ classNames, debug, space, message, processor, tools, onEvent }: ChatMessageProps) => {
|
|
38
|
-
const { t } = useTranslation(meta.id);
|
|
39
|
-
const {
|
|
40
|
-
sender: { role },
|
|
41
|
-
blocks,
|
|
42
|
-
} = message;
|
|
43
|
-
|
|
44
|
-
// TODO(burdon): Restructure types to make check unnecessary.
|
|
45
|
-
if (isToolMessage(message)) {
|
|
46
|
-
return (
|
|
47
|
-
<MessageContainer classNames={mx(classNames, 'animate-[fadeIn_0.5s]')}>
|
|
48
|
-
<ToolBlock classNames={panelClasses} message={message} tools={tools} />
|
|
49
|
-
</MessageContainer>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<>
|
|
55
|
-
{debug && (
|
|
56
|
-
<div className={mx('flex justify-end text-subdued', marginClasses)}>
|
|
57
|
-
<pre className='text-xs'>{JSON.stringify({ created: message.created })}</pre>
|
|
58
|
-
</div>
|
|
59
|
-
)}
|
|
60
|
-
|
|
61
|
-
{blocks.map((block, idx) => {
|
|
62
|
-
// TODO(burdon): Filter empty messages.
|
|
63
|
-
if (block._tag === 'text' && block.text.replaceAll(/\s+/g, '').length === 0) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const Component: BlockComponent = components[block._tag] ?? components.default!;
|
|
68
|
-
if (!Component) {
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<Fragment key={idx}>
|
|
74
|
-
<MessageContainer classNames={classNames} user={block._tag === 'text' && role === 'user'}>
|
|
75
|
-
<Component space={space} processor={processor} block={block} onEvent={onEvent} />
|
|
76
|
-
</MessageContainer>
|
|
77
|
-
{debug && (
|
|
78
|
-
<div className={mx('flex justify-end text-subdued', marginClasses)}>
|
|
79
|
-
<pre className='text-xs'>{JSON.stringify({ block: block._tag })}</pre>
|
|
80
|
-
</div>
|
|
81
|
-
)}
|
|
82
|
-
</Fragment>
|
|
83
|
-
);
|
|
84
|
-
})}
|
|
85
|
-
<div className={mx('flex justify-end pbs-2 pbe-2 opacity-50 hover:opacity-100', marginClasses)}>
|
|
86
|
-
<IconButton
|
|
87
|
-
classNames='animate-[fadeIn_0.5s]'
|
|
88
|
-
icon='ph--trash--regular'
|
|
89
|
-
iconOnly
|
|
90
|
-
label={t('button delete message')}
|
|
91
|
-
onClick={() => onEvent?.({ type: 'delete', id: message.id })}
|
|
92
|
-
/>
|
|
93
|
-
</div>
|
|
94
|
-
</>
|
|
95
|
-
);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
type BlockComponentProps = {
|
|
99
|
-
space?: Space;
|
|
100
|
-
block: ContentBlock.Any;
|
|
101
|
-
/** @deprecated Replace with context */
|
|
102
|
-
processor?: ChatProcessor;
|
|
103
|
-
onEvent?: (event: ChatEvent) => void;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
type BlockComponent = FC<BlockComponentProps>;
|
|
107
|
-
|
|
108
|
-
const components: Partial<Record<ContentBlock.Any['_tag'] | 'default', BlockComponent>> = {
|
|
109
|
-
//
|
|
110
|
-
// Text
|
|
111
|
-
//
|
|
112
|
-
['text' as const]: ({ block }) => {
|
|
113
|
-
invariant(block._tag === 'text');
|
|
114
|
-
// const [open, setOpen] = useState(block.disposition === 'cot' && block.pending);
|
|
115
|
-
const title = block.disposition ? titles[block.disposition] : undefined;
|
|
116
|
-
if (!title) {
|
|
117
|
-
return <MarkdownViewer content={block.text} />;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// TOOD(burdon): Store last time user opened/closed COT.
|
|
121
|
-
// Autoclose when streaming ends.
|
|
122
|
-
// useEffect(() => {
|
|
123
|
-
// if (block.disposition === 'cot' && !block.pending) {
|
|
124
|
-
// setOpen(false);
|
|
125
|
-
// }
|
|
126
|
-
// }, [block.disposition, block.pending]);
|
|
127
|
-
|
|
128
|
-
return (
|
|
129
|
-
<ToggleContainer
|
|
130
|
-
// open={open}
|
|
131
|
-
defaultOpen={systemDispositions.includes(block.disposition ?? '') && block.pending}
|
|
132
|
-
title={title}
|
|
133
|
-
icon={
|
|
134
|
-
block.pending ? (
|
|
135
|
-
<Icon icon={'ph--circle-notch--regular'} classNames='text-subdued animate-spin' size={4} />
|
|
136
|
-
) : undefined
|
|
137
|
-
}
|
|
138
|
-
>
|
|
139
|
-
<MarkdownViewer
|
|
140
|
-
content={block.text}
|
|
141
|
-
classNames={['pbe-2', systemDispositions.includes(block.disposition ?? '') && 'text-sm text-subdued']}
|
|
142
|
-
/>
|
|
143
|
-
</ToggleContainer>
|
|
144
|
-
);
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
//
|
|
148
|
-
// JSON
|
|
149
|
-
//
|
|
150
|
-
['json' as const]: ({ space, processor, block, onEvent }) => {
|
|
151
|
-
invariant(block._tag === 'json');
|
|
152
|
-
|
|
153
|
-
switch (block.disposition) {
|
|
154
|
-
case 'tool_list': {
|
|
155
|
-
return (
|
|
156
|
-
<ToggleContainer title={titles[block.disposition]} defaultOpen={true}>
|
|
157
|
-
<ToolboxContainer space={space} processor={processor} classNames='pbe-2' />
|
|
158
|
-
</ToggleContainer>
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
case 'suggest': {
|
|
163
|
-
const { text = '' }: { text: string } = safeParseJson(block.data ?? '{}') ?? ({} as any);
|
|
164
|
-
return (
|
|
165
|
-
<IconButton icon='ph--lightning--regular' label={text} onClick={() => onEvent?.({ type: 'submit', text })} />
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
case 'select': {
|
|
170
|
-
const { options = [] }: { options: string[] } = safeParseJson(block.data ?? '{}') ?? ({} as any);
|
|
171
|
-
return (
|
|
172
|
-
<div className='flex flex-wrap gap-1'>
|
|
173
|
-
{options.map((text, idx) => (
|
|
174
|
-
<Button
|
|
175
|
-
classNames={'animate-[fadeIn_0.5s] rounded-sm text-sm'}
|
|
176
|
-
key={idx}
|
|
177
|
-
onClick={() => onEvent?.({ type: 'submit', text })}
|
|
178
|
-
>
|
|
179
|
-
{text}
|
|
180
|
-
</Button>
|
|
181
|
-
))}
|
|
182
|
-
</div>
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
case 'graph': {
|
|
187
|
-
return (
|
|
188
|
-
<div className='flex flex-wrap gap-1'>
|
|
189
|
-
<Surface
|
|
190
|
-
role='card'
|
|
191
|
-
data={{ subject: JSON.parse(block.data ?? '{}') }}
|
|
192
|
-
limit={1}
|
|
193
|
-
fallback={<div className='font-mono text-xs text-pre'>{block.data}</div>}
|
|
194
|
-
/>
|
|
195
|
-
{onEvent && (
|
|
196
|
-
<IconButton
|
|
197
|
-
icon='ph--plus--regular'
|
|
198
|
-
label='Add to graph'
|
|
199
|
-
onClick={() => onEvent?.({ type: 'add', object: JSON.parse(block.data ?? '{}') })}
|
|
200
|
-
/>
|
|
201
|
-
)}
|
|
202
|
-
</div>
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
default: {
|
|
207
|
-
const title = block.disposition ? titles[block.disposition] : undefined;
|
|
208
|
-
return (
|
|
209
|
-
<ToggleContainer title={title ?? 'JSON'}>
|
|
210
|
-
<Json data={safeParseJson(block.data ?? block)} />
|
|
211
|
-
</ToggleContainer>
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
|
|
217
|
-
//
|
|
218
|
-
// Default
|
|
219
|
-
//
|
|
220
|
-
default: ({ block }) => {
|
|
221
|
-
let title = titles[block._tag];
|
|
222
|
-
if (block._tag === 'toolCall') {
|
|
223
|
-
title = `Tool [${block.name}]`; // TODO(burdon): Get label from tool.
|
|
224
|
-
} else {
|
|
225
|
-
title = block._tag;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return (
|
|
229
|
-
<ToggleContainer title={title ?? 'JSON'}>
|
|
230
|
-
<Json data={block} />
|
|
231
|
-
</ToggleContainer>
|
|
232
|
-
);
|
|
233
|
-
},
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
// TODO(burdon): Translations.
|
|
237
|
-
const titles: Record<string, string> = {
|
|
238
|
-
['cot' as const]: 'Chain of thought',
|
|
239
|
-
['artifact' as const]: 'Artifact',
|
|
240
|
-
['tool_use' as const]: 'Tool request',
|
|
241
|
-
['tool_result' as const]: 'Tool result',
|
|
242
|
-
['tool_list' as const]: 'Tools',
|
|
243
|
-
['artifact-update' as const]: 'Artifact(s) changed',
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
const systemDispositions: string[] = ['cot', 'artifact-update'];
|
|
247
|
-
|
|
248
|
-
const panelClasses = 'flex flex-col is-full bg-activeSurface rounded-sm';
|
|
249
|
-
const marginClasses = 'pie-4 pis-4';
|
|
250
|
-
const paddingClasses = 'pis-2 pie-2 pbs-0.5 pbe-0.5';
|
|
251
|
-
|
|
252
|
-
const MessageContainer = ({ classNames, children, user }: ThemedClassName<PropsWithChildren<{ user?: boolean }>>) => {
|
|
253
|
-
if (!children) {
|
|
254
|
-
return null;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
return (
|
|
258
|
-
<div role='list-item' className={mx('flex is-full', user && 'justify-end', marginClasses, classNames)}>
|
|
259
|
-
<div className={mx(user ? ['rounded-sm', 'bg-[--user-fill] text-accentSurfaceText', paddingClasses] : 'is-full')}>
|
|
260
|
-
{children}
|
|
261
|
-
</div>
|
|
262
|
-
</div>
|
|
263
|
-
);
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
const ToggleContainer = (props: ToggleContainerProps) => {
|
|
267
|
-
return <NativeToggleContainer {...props} classNames={mx(panelClasses, props.classNames)} />;
|
|
268
|
-
};
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type FC, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type AgentStatus, type Tool } from '@dxos/ai';
|
|
8
|
-
import { log } from '@dxos/log';
|
|
9
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
10
|
-
import { NumericTabs, StatusRoll, ToggleContainer } from '@dxos/react-ui-components';
|
|
11
|
-
import { type JsonProps, Json as NativeJson } from '@dxos/react-ui-syntax-highlighter';
|
|
12
|
-
import { type DataType } from '@dxos/schema';
|
|
13
|
-
import { isNonNullable, isNotFalsy } from '@dxos/util';
|
|
14
|
-
|
|
15
|
-
export const isToolMessage = (message: DataType.Message) => {
|
|
16
|
-
return message.blocks.some((block) => block._tag === 'toolCall' || block._tag === 'toolResult');
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const getToolName = (tool: Tool) => {
|
|
20
|
-
return tool.namespace && tool.function ? `${tool.namespace}:${tool.function}` : tool.name.split('_').pop();
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const getToolCaption = (tool: Tool | undefined, status: AgentStatus | undefined) => {
|
|
24
|
-
if (!tool) {
|
|
25
|
-
return 'Calling tool...';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return status?.message ?? tool.caption ?? `Calling ${getToolName(tool)}...`;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export type ToolBlockProps = ThemedClassName<{
|
|
32
|
-
message: DataType.Message;
|
|
33
|
-
tools?: Tool[];
|
|
34
|
-
}>;
|
|
35
|
-
|
|
36
|
-
export const ToolBlock: FC<ToolBlockProps> = ({ classNames, message, tools }) => {
|
|
37
|
-
const { blocks = [] } = message;
|
|
38
|
-
|
|
39
|
-
let request: { tool: Tool | undefined; block: any } | undefined;
|
|
40
|
-
const toolBlocks = blocks.filter((block) => block._tag === 'toolCall' || block._tag === 'toolResult');
|
|
41
|
-
const items = toolBlocks
|
|
42
|
-
.map((block) => {
|
|
43
|
-
switch (block._tag) {
|
|
44
|
-
case 'toolCall': {
|
|
45
|
-
// TODO(burdon): Skip these updates?
|
|
46
|
-
if (block.pending && request?.block.toolCallId === block.toolCallId) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
request = { tool: tools?.find((tool) => tool.name === block.name), block };
|
|
51
|
-
return {
|
|
52
|
-
title: getToolCaption(request.tool, undefined), // block.status), // TODO(burdon): Get status?
|
|
53
|
-
block,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
case 'toolResult': {
|
|
58
|
-
if (!request) {
|
|
59
|
-
log.warn('unexpected message', { block });
|
|
60
|
-
return { title: 'Error', block };
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
title: `${getToolCaption(request.tool, undefined)} (Success)`,
|
|
65
|
-
block,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
default: {
|
|
70
|
-
request = undefined;
|
|
71
|
-
return {
|
|
72
|
-
title: 'Error',
|
|
73
|
-
block,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
.filter(isNonNullable);
|
|
79
|
-
|
|
80
|
-
return <ToolContainer classNames={classNames} items={items} />;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export const ToolContainer: FC<ThemedClassName<{ items: { title: string; block: any }[] }>> = ({
|
|
84
|
-
classNames,
|
|
85
|
-
items,
|
|
86
|
-
}) => {
|
|
87
|
-
const tabsRef = useRef<HTMLDivElement>(null);
|
|
88
|
-
const [selected, setSelected] = useState(0);
|
|
89
|
-
const [open, setOpen] = useState(false);
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
if (open) {
|
|
92
|
-
tabsRef.current?.focus();
|
|
93
|
-
}
|
|
94
|
-
}, [open]);
|
|
95
|
-
|
|
96
|
-
const handleSelect = (index: number) => {
|
|
97
|
-
if (index === selected) {
|
|
98
|
-
setOpen(false);
|
|
99
|
-
} else {
|
|
100
|
-
setSelected(index);
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const title = useMemo(() => {
|
|
105
|
-
const lines = items.map((item) => item.title).filter(isNotFalsy);
|
|
106
|
-
return <StatusRoll key='status-roll' lines={lines} duration={1_000} autoAdvance />;
|
|
107
|
-
}, [items]);
|
|
108
|
-
|
|
109
|
-
return (
|
|
110
|
-
<ToggleContainer classNames={['flex flex-col', classNames]} title={title} open={open} onChangeOpen={setOpen}>
|
|
111
|
-
<div className='w-full grid grid-cols-[32px_1fr]'>
|
|
112
|
-
<NumericTabs ref={tabsRef} length={items.length} selected={selected} onSelect={handleSelect} />
|
|
113
|
-
<Json data={items[selected].block} />
|
|
114
|
-
</div>
|
|
115
|
-
</ToggleContainer>
|
|
116
|
-
);
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
export const Json = ({ data }: Pick<JsonProps, 'data'>) => (
|
|
120
|
-
<NativeJson data={data} classNames='!p-1 text-xs bg-transparent' />
|
|
121
|
-
);
|