@dxos/plugin-assistant 0.8.4-main.ae835ea → 0.8.4-main.bcb3aa67d6
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/AssistantSettings-PTNCDWC6.mjs +100 -0
- package/dist/lib/browser/AssistantSettings-PTNCDWC6.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/chunk-EZRS3J25.mjs +30 -0
- package/dist/lib/browser/chunk-EZRS3J25.mjs.map +7 -0
- package/dist/lib/browser/chunk-OWBVGFDF.mjs +345 -0
- package/dist/lib/browser/chunk-OWBVGFDF.mjs.map +7 -0
- package/dist/lib/browser/chunk-RUV2WOQH.mjs +154 -0
- package/dist/lib/browser/chunk-RUV2WOQH.mjs.map +7 -0
- package/dist/lib/browser/chunk-YD4JTOO5.mjs +173 -0
- package/dist/lib/browser/chunk-YD4JTOO5.mjs.map +7 -0
- package/dist/lib/browser/create-chat-6G6WROW2.mjs +89 -0
- package/dist/lib/browser/create-chat-6G6WROW2.mjs.map +7 -0
- package/dist/lib/browser/ensure-companion-chat-F46BGW2T.mjs +65 -0
- package/dist/lib/browser/ensure-companion-chat-F46BGW2T.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +2511 -311
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/on-create-space-F5HHB3GI.mjs +22 -0
- package/dist/lib/browser/on-create-space-F5HHB3GI.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +13 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/resolve-navigation-targets-5Y7FT4CQ.mjs +22 -0
- package/dist/lib/browser/resolve-navigation-targets-5Y7FT4CQ.mjs.map +7 -0
- package/dist/lib/browser/run-prompt-in-new-chat-XSPRWOSR.mjs +144 -0
- package/dist/lib/browser/run-prompt-in-new-chat-XSPRWOSR.mjs.map +7 -0
- package/dist/lib/browser/set-current-chat-JPWBMS7N.mjs +35 -0
- package/dist/lib/browser/set-current-chat-JPWBMS7N.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +5 -4
- package/dist/lib/browser/update-chat-name-AEMFSIJX.mjs +60 -0
- package/dist/lib/browser/update-chat-name-AEMFSIJX.mjs.map +7 -0
- package/dist/lib/node-esm/AssistantSettings-Z5ZZWWSN.mjs +101 -0
- package/dist/lib/node-esm/AssistantSettings-Z5ZZWWSN.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +9 -0
- package/dist/lib/node-esm/chunk-NZIKC7AN.mjs +32 -0
- package/dist/lib/node-esm/chunk-NZIKC7AN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-POJO5MTX.mjs +347 -0
- package/dist/lib/node-esm/chunk-POJO5MTX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-PY4X6FJT.mjs +155 -0
- package/dist/lib/node-esm/chunk-PY4X6FJT.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QHPGS4A4.mjs +174 -0
- package/dist/lib/node-esm/chunk-QHPGS4A4.mjs.map +7 -0
- package/dist/lib/node-esm/create-chat-EEMDTQRE.mjs +90 -0
- package/dist/lib/node-esm/create-chat-EEMDTQRE.mjs.map +7 -0
- package/dist/lib/node-esm/ensure-companion-chat-YAKJY7TB.mjs +66 -0
- package/dist/lib/node-esm/ensure-companion-chat-YAKJY7TB.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +2511 -311
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/on-create-space-YE5NQ3D2.mjs +23 -0
- package/dist/lib/node-esm/on-create-space-YE5NQ3D2.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +14 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/resolve-navigation-targets-W3GTFXDD.mjs +23 -0
- package/dist/lib/node-esm/resolve-navigation-targets-W3GTFXDD.mjs.map +7 -0
- package/dist/lib/node-esm/run-prompt-in-new-chat-Q2CLUUM4.mjs +145 -0
- package/dist/lib/node-esm/run-prompt-in-new-chat-Q2CLUUM4.mjs.map +7 -0
- package/dist/lib/node-esm/set-current-chat-ZBEFWS6P.mjs +36 -0
- package/dist/lib/node-esm/set-current-chat-ZBEFWS6P.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +5 -4
- package/dist/lib/node-esm/update-chat-name-6F7COUGR.mjs +61 -0
- package/dist/lib/node-esm/update-chat-name-6F7COUGR.mjs.map +7 -0
- 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 +4 -0
- package/dist/types/src/blueprints/assistant/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/blueprint.test.d.ts +2 -0
- package/dist/types/src/blueprints/assistant/blueprint.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/index.d.ts +2 -0
- package/dist/types/src/blueprints/assistant/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/ai-service.d.ts +4 -2
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +4 -6
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts +9 -0
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +6 -3
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +41 -12
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +6 -3
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts +5 -0
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
- package/dist/types/src/capabilities/migrations.d.ts +5 -0
- package/dist/types/src/capabilities/migrations.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +16 -2
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +19 -2
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts +4 -2
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +4 -4
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.stories.d.ts +511 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/index.d.ts +2 -1
- package/dist/types/src/components/AssistantSettings/index.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +36 -15
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +5 -1
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +6 -3
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +3 -3
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +3 -3
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +7 -10
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +504 -257
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts +12 -6
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts +14 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts.map +1 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts +8 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts.map +1 -0
- package/dist/types/src/components/ProcessTree/index.d.ts +2 -0
- package/dist/types/src/components/ProcessTree/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +9 -4
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +488 -244
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +11 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +489 -245
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- 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 +10 -8
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +17 -12
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +488 -244
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- 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 +3 -7
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts +6 -0
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts.map +1 -0
- package/dist/types/src/containers/BlueprintArticle/index.d.ts +3 -0
- package/dist/types/src/containers/BlueprintArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts +14 -0
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/containers/ChatCompanion/index.d.ts +3 -0
- package/dist/types/src/containers/ChatCompanion/index.d.ts.map +1 -0
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts +20 -0
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts.map +1 -0
- package/dist/types/src/containers/ChatContainer/index.d.ts +3 -0
- package/dist/types/src/containers/ChatContainer/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/ChatDialog}/ChatDialog.d.ts +2 -3
- package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts.map +1 -0
- package/dist/types/src/containers/ChatDialog/index.d.ts +3 -0
- package/dist/types/src/containers/ChatDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/ProjectArticle/ProjectArticle.d.ts +6 -0
- package/dist/types/src/containers/ProjectArticle/ProjectArticle.d.ts.map +1 -0
- package/dist/types/src/containers/ProjectArticle/index.d.ts +3 -0
- package/dist/types/src/containers/ProjectArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ProjectSettings/ProjectSettings.d.ts +6 -0
- package/dist/types/src/containers/ProjectSettings/ProjectSettings.d.ts.map +1 -0
- package/dist/types/src/containers/ProjectSettings/index.d.ts +3 -0
- package/dist/types/src/containers/ProjectSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts +6 -0
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PromptArticle/index.d.ts +3 -0
- package/dist/types/src/containers/PromptArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/PromptList/PromptList.d.ts +6 -0
- package/dist/types/src/containers/PromptList/PromptList.d.ts.map +1 -0
- package/dist/types/src/containers/PromptList/PromptList.stories.d.ts +517 -0
- package/dist/types/src/containers/PromptList/PromptList.stories.d.ts.map +1 -0
- package/dist/types/src/containers/PromptList/index.d.ts +3 -0
- package/dist/types/src/containers/PromptList/index.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts +6 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts +19 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.test.d.ts +2 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.test.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/index.d.ts +4 -0
- package/dist/types/src/containers/TracePanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts +4 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/index.d.ts +3 -0
- package/dist/types/src/containers/TriggerStatus/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +12 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/extensions/index.d.ts +2 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -0
- package/dist/types/src/extensions/prompt-extension.d.ts +10 -0
- package/dist/types/src/extensions/prompt-extension.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +2 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +5 -5
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +9 -6
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +5 -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 +2 -2
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextObjects.d.ts +7 -7
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -1
- 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/usePresets.d.ts +1 -1
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -1
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +4 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create-chat.d.ts +5 -0
- package/dist/types/src/operations/create-chat.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +134 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/ensure-companion-chat.d.ts +5 -0
- package/dist/types/src/operations/ensure-companion-chat.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/on-create-space.d.ts +5 -0
- package/dist/types/src/operations/on-create-space.d.ts.map +1 -0
- package/dist/types/src/operations/resolve-navigation-targets.d.ts +15 -0
- package/dist/types/src/operations/resolve-navigation-targets.d.ts.map +1 -0
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts +5 -0
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts.map +1 -0
- package/dist/types/src/operations/set-current-chat.d.ts +5 -0
- package/dist/types/src/operations/set-current-chat.d.ts.map +1 -0
- package/dist/types/src/operations/update-chat-name.d.ts +5 -0
- package/dist/types/src/operations/update-chat-name.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +34 -34
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/processor/update-name.d.ts +2 -2
- package/dist/types/src/processor/update-name.d.ts.map +1 -1
- package/dist/types/src/queue-logger.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +5 -4
- package/dist/types/src/testing/test-generator.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts +1 -1
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +492 -83
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +18 -46
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +10 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +44 -0
- package/dist/types/src/types/capabilities.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 +3 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +10 -212
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +139 -91
- package/src/AssistantPlugin.tsx +186 -123
- package/src/blueprints/assistant/blueprint.conversations.json +1 -0
- package/src/blueprints/assistant/blueprint.test.ts +46 -0
- package/src/blueprints/assistant/blueprint.ts +31 -0
- package/src/blueprints/assistant/index.ts +5 -0
- package/src/{components/ChatToolbar → blueprints}/index.ts +1 -1
- package/src/capabilities/ai-service.ts +20 -17
- package/src/capabilities/app-graph-builder.ts +184 -170
- package/src/capabilities/blueprint-definition.ts +47 -55
- package/src/capabilities/companion-chat-provisioner.ts +165 -0
- package/src/capabilities/edge-model-resolver.ts +22 -14
- package/src/capabilities/index.ts +21 -14
- package/src/capabilities/local-model-resolver.ts +21 -13
- package/src/capabilities/markdown.ts +39 -0
- package/src/capabilities/migrations.ts +34 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +141 -59
- package/src/capabilities/settings.ts +24 -12
- package/src/capabilities/state.ts +27 -12
- package/src/capabilities/toolkit.ts +7 -13
- package/src/components/AssistantSettings/AssistantSettings.stories.tsx +35 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +105 -85
- package/src/components/AssistantSettings/index.ts +4 -2
- package/src/components/Chat/Chat.tsx +201 -136
- package/src/components/Chat/events.ts +7 -1
- package/src/components/ChatProgress/ChatProgress.tsx +11 -22
- package/src/components/ChatPrompt/ChatActions.tsx +13 -7
- package/src/components/ChatPrompt/ChatOptions.tsx +117 -90
- package/src/components/ChatPrompt/ChatReferences.tsx +23 -14
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +1 -1
- package/src/components/ChatThread/ChatThread.stories.tsx +59 -38
- package/src/components/ChatThread/ChatThread.tsx +41 -38
- package/src/components/ChatThread/Link.tsx +4 -4
- package/src/components/ChatThread/registry.tsx +74 -51
- package/src/components/ChatThread/sync.test.ts +36 -18
- package/src/components/ChatThread/sync.ts +61 -14
- package/src/components/ChatThread/testing/thread.md +37 -0
- package/src/components/ProcessTree/ProcessTree.stories.tsx +109 -0
- package/src/components/ProcessTree/ProcessTree.tsx +85 -0
- package/src/components/ProcessTree/index.ts +5 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +15 -11
- package/src/components/TemplateEditor/TemplateEditor.tsx +54 -42
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +19 -9
- package/src/components/TemplateEditor/TemplateForm.tsx +83 -37
- 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 +44 -53
- package/src/components/Toolbox/Toolbox.stories.tsx +11 -13
- package/src/components/Toolbox/Toolbox.tsx +69 -65
- package/src/components/Typewriter/AssistantToolbar.tsx +161 -0
- package/src/components/Typewriter/Typewriter.stories.tsx +86 -0
- package/src/components/Typewriter/Typewriter.tsx +50 -0
- package/src/components/Typewriter/assistant-extension.tsx +141 -0
- package/src/components/Typewriter/index.ts +5 -0
- package/src/components/index.ts +3 -8
- package/src/containers/BlueprintArticle/BlueprintArticle.tsx +29 -0
- package/src/containers/BlueprintArticle/index.ts +7 -0
- package/src/containers/ChatCompanion/ChatCompanion.tsx +143 -0
- package/src/containers/ChatCompanion/index.ts +7 -0
- package/src/containers/ChatContainer/ChatContainer.tsx +95 -0
- package/src/containers/ChatContainer/index.ts +7 -0
- package/src/{components → containers/ChatDialog}/ChatDialog.tsx +19 -15
- package/src/containers/ChatDialog/index.ts +7 -0
- package/src/containers/ProjectArticle/ProjectArticle.tsx +127 -0
- package/src/containers/ProjectArticle/index.ts +7 -0
- package/src/containers/ProjectSettings/ProjectSettings.tsx +139 -0
- package/src/containers/ProjectSettings/index.ts +7 -0
- package/src/containers/PromptArticle/PromptArticle.tsx +59 -0
- package/src/containers/PromptArticle/index.ts +7 -0
- package/src/containers/PromptList/PromptList.stories.tsx +130 -0
- package/src/containers/PromptList/PromptList.tsx +49 -0
- package/src/containers/PromptList/index.ts +7 -0
- package/src/containers/TracePanel/TracePanel.tsx +258 -0
- package/src/containers/TracePanel/dxn-extractor.test.ts +153 -0
- package/src/containers/TracePanel/dxn-extractor.ts +178 -0
- package/src/containers/TracePanel/index.ts +9 -0
- package/src/containers/TriggerStatus/TriggerStatus.tsx +144 -0
- package/src/containers/TriggerStatus/index.ts +7 -0
- package/src/containers/index.ts +16 -0
- package/src/extensions/index.ts +5 -0
- package/src/extensions/prompt-extension.ts +111 -0
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useBlueprintRegistry.ts +36 -21
- package/src/hooks/useChatProcessor.ts +32 -23
- package/src/hooks/useChatServices.ts +9 -31
- package/src/hooks/useChatToolbarActions.ts +122 -0
- package/src/hooks/useContextBinder.ts +9 -7
- package/src/hooks/useContextObjects.ts +16 -24
- package/src/hooks/useFilteredTypes.ts +37 -0
- package/src/hooks/usePresets.ts +1 -1
- package/src/hooks/useReferencesProvider.ts +5 -8
- package/src/index.ts +1 -2
- package/src/meta.ts +7 -4
- package/src/operations/create-chat.ts +79 -0
- package/src/operations/definitions.ts +126 -0
- package/src/operations/ensure-companion-chat.ts +59 -0
- package/src/operations/index.ts +17 -0
- package/src/operations/on-create-space.ts +24 -0
- package/src/operations/resolve-navigation-targets.ts +26 -0
- package/src/operations/run-prompt-in-new-chat.ts +114 -0
- package/src/operations/set-current-chat.ts +35 -0
- package/src/operations/update-chat-name.ts +55 -0
- package/src/processor/presets.ts +1 -1
- package/src/processor/processor.test.ts +21 -63
- package/src/processor/processor.ts +168 -139
- package/src/processor/update-name.ts +6 -5
- package/src/queue-logger.ts +8 -9
- package/src/testing/test-generator.ts +14 -13
- package/src/testing/test-sequence.ts +3 -3
- package/src/testing/test-services.ts +9 -7
- package/src/translations.ts +129 -76
- package/src/types/Assistant.ts +8 -57
- package/src/types/Settings.ts +21 -0
- package/src/types/capabilities.ts +35 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +5 -1
- package/src/types/service.ts +14 -11
- package/dist/lib/browser/BlueprintContainer-GMSYKGSO.mjs +0 -36
- package/dist/lib/browser/BlueprintContainer-GMSYKGSO.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-M3FDKTQM.mjs +0 -151
- package/dist/lib/browser/ChatCompanion-M3FDKTQM.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-KAH7XITI.mjs +0 -74
- package/dist/lib/browser/ChatContainer-KAH7XITI.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-ZWRGABW6.mjs +0 -87
- package/dist/lib/browser/ChatDialog-ZWRGABW6.mjs.map +0 -7
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs +0 -19
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-R5T7BJPC.mjs +0 -183
- package/dist/lib/browser/app-graph-builder-R5T7BJPC.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-AGTDXTXO.mjs +0 -13
- package/dist/lib/browser/chunk-357IHWQL.mjs +0 -1519
- package/dist/lib/browser/chunk-357IHWQL.mjs.map +0 -7
- package/dist/lib/browser/chunk-A2NVNXPL.mjs +0 -170
- package/dist/lib/browser/chunk-A2NVNXPL.mjs.map +0 -7
- package/dist/lib/browser/chunk-CQW6UPJM.mjs +0 -199
- package/dist/lib/browser/chunk-CQW6UPJM.mjs.map +0 -7
- package/dist/lib/browser/chunk-GNI6HL6G.mjs +0 -219
- package/dist/lib/browser/chunk-GNI6HL6G.mjs.map +0 -7
- package/dist/lib/browser/chunk-GXHZTOWJ.mjs +0 -378
- package/dist/lib/browser/chunk-GXHZTOWJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-L5OA5OGS.mjs +0 -262
- package/dist/lib/browser/chunk-L5OA5OGS.mjs.map +0 -7
- package/dist/lib/browser/chunk-MEN5WTLA.mjs +0 -182
- package/dist/lib/browser/chunk-MEN5WTLA.mjs.map +0 -7
- package/dist/lib/browser/chunk-PUG24BEC.mjs +0 -277
- package/dist/lib/browser/chunk-PUG24BEC.mjs.map +0 -7
- package/dist/lib/browser/chunk-SJJV3HEX.mjs +0 -16
- package/dist/lib/browser/chunk-SJJV3HEX.mjs.map +0 -7
- package/dist/lib/browser/chunk-WBG5PTSX.mjs +0 -23
- package/dist/lib/browser/chunk-WBG5PTSX.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs +0 -18
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-3C5TABOX.mjs +0 -136
- package/dist/lib/browser/intent-resolver-3C5TABOX.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs +0 -17
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs.map +0 -7
- package/dist/lib/browser/react-surface-EYKA5IFU.mjs +0 -90
- package/dist/lib/browser/react-surface-EYKA5IFU.mjs.map +0 -7
- package/dist/lib/browser/settings-VMVBYZLN.mjs +0 -23
- package/dist/lib/browser/settings-VMVBYZLN.mjs.map +0 -7
- package/dist/lib/browser/state-CFREPBB6.mjs +0 -21
- package/dist/lib/browser/state-CFREPBB6.mjs.map +0 -7
- package/dist/lib/browser/toolkit-F3NQ7TSI.mjs +0 -21
- package/dist/lib/browser/toolkit-F3NQ7TSI.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-6GBLMK4Z.mjs +0 -37
- package/dist/lib/node-esm/BlueprintContainer-6GBLMK4Z.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-OV426GCP.mjs +0 -152
- package/dist/lib/node-esm/ChatCompanion-OV426GCP.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-UKY7NHFY.mjs +0 -75
- package/dist/lib/node-esm/ChatContainer-UKY7NHFY.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-2BDQIEXH.mjs +0 -88
- package/dist/lib/node-esm/ChatDialog-2BDQIEXH.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs +0 -20
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-I52RYVWH.mjs +0 -184
- package/dist/lib/node-esm/app-graph-builder-I52RYVWH.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-CFCUD2VC.mjs +0 -14
- package/dist/lib/node-esm/chunk-2CAETDW2.mjs +0 -183
- package/dist/lib/node-esm/chunk-2CAETDW2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4J5FYNNM.mjs +0 -171
- package/dist/lib/node-esm/chunk-4J5FYNNM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5ARE4R2I.mjs +0 -220
- package/dist/lib/node-esm/chunk-5ARE4R2I.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7ZYOYW7F.mjs +0 -264
- package/dist/lib/node-esm/chunk-7ZYOYW7F.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HJPIYMWD.mjs +0 -1520
- package/dist/lib/node-esm/chunk-HJPIYMWD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-O36P4LN5.mjs +0 -200
- package/dist/lib/node-esm/chunk-O36P4LN5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WE6KTH72.mjs +0 -25
- package/dist/lib/node-esm/chunk-WE6KTH72.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XM4BVQQR.mjs +0 -278
- package/dist/lib/node-esm/chunk-XM4BVQQR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XQBL2SBL.mjs +0 -17
- package/dist/lib/node-esm/chunk-XQBL2SBL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YIO5MEPR.mjs +0 -380
- package/dist/lib/node-esm/chunk-YIO5MEPR.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs +0 -19
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-HQ27YALS.mjs +0 -137
- package/dist/lib/node-esm/intent-resolver-HQ27YALS.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs +0 -18
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-UOC3CBPH.mjs +0 -91
- package/dist/lib/node-esm/react-surface-UOC3CBPH.mjs.map +0 -7
- package/dist/lib/node-esm/settings-7AUVNDM2.mjs +0 -24
- package/dist/lib/node-esm/settings-7AUVNDM2.mjs.map +0 -7
- package/dist/lib/node-esm/state-XXND44OW.mjs +0 -22
- package/dist/lib/node-esm/state-XXND44OW.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-7CH5UNSQ.mjs +0 -22
- package/dist/lib/node-esm/toolkit-7CH5UNSQ.mjs.map +0 -7
- package/dist/types/src/capabilities/capabilities.d.ts +0 -11
- package/dist/types/src/capabilities/capabilities.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/components/BlueprintContainer.d.ts +0 -8
- package/dist/types/src/components/BlueprintContainer.d.ts.map +0 -1
- package/dist/types/src/components/ChatCompanion.d.ts +0 -13
- package/dist/types/src/components/ChatCompanion.d.ts.map +0 -1
- package/dist/types/src/components/ChatContainer.d.ts +0 -11
- package/dist/types/src/components/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/components/ChatDialog.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/reducers.d.ts +0 -40
- package/dist/types/src/components/ChatThread/reducers.d.ts.map +0 -1
- package/dist/types/src/components/ChatToolbar/ChatToolbar.d.ts +0 -6
- package/dist/types/src/components/ChatToolbar/ChatToolbar.d.ts.map +0 -1
- package/dist/types/src/components/ChatToolbar/index.d.ts +0 -2
- package/dist/types/src/components/ChatToolbar/index.d.ts.map +0 -1
- package/dist/types/src/components/ChatToolbar/useChatToolbarActions.d.ts +0 -9
- package/dist/types/src/components/ChatToolbar/useChatToolbarActions.d.ts.map +0 -1
- package/dist/types/src/components/TemplateEditor/handlebars-extension.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/functions/analysis.d.ts +0 -5
- package/dist/types/src/functions/analysis.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -4
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/object-list.d.ts +0 -10
- package/dist/types/src/functions/object-list.d.ts.map +0 -1
- package/dist/types/src/functions/object-load.d.ts +0 -8
- package/dist/types/src/functions/object-load.d.ts.map +0 -1
- package/dist/types/src/hooks/useItemTypes.d.ts +0 -4
- package/dist/types/src/hooks/useItemTypes.d.ts.map +0 -1
- package/dist/types/src/toolkits/AssistantToolkit.d.ts +0 -21
- package/dist/types/src/toolkits/AssistantToolkit.d.ts.map +0 -1
- package/dist/types/src/toolkits/SystemToolkit.d.ts +0 -69
- package/dist/types/src/toolkits/SystemToolkit.d.ts.map +0 -1
- package/dist/types/src/toolkits/index.d.ts +0 -3
- package/dist/types/src/toolkits/index.d.ts.map +0 -1
- package/dist/types/src/types/AssistantAction.d.ts +0 -119
- package/dist/types/src/types/AssistantAction.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -18
- package/src/capabilities/intent-resolver.ts +0 -121
- package/src/components/BlueprintContainer.tsx +0 -30
- package/src/components/ChatCompanion.tsx +0 -136
- package/src/components/ChatContainer.tsx +0 -51
- package/src/components/ChatThread/reducers.ts +0 -151
- package/src/components/ChatToolbar/ChatToolbar.tsx +0 -23
- package/src/components/ChatToolbar/useChatToolbarActions.ts +0 -126
- package/src/components/TemplateEditor/handlebars-extension.ts +0 -166
- package/src/events.ts +0 -11
- package/src/functions/analysis.ts +0 -22
- package/src/functions/index.ts +0 -7
- package/src/functions/object-list.ts +0 -48
- package/src/functions/object-load.ts +0 -45
- package/src/hooks/useItemTypes.ts +0 -37
- package/src/toolkits/AssistantToolkit.ts +0 -55
- package/src/toolkits/SystemToolkit.ts +0 -292
- package/src/toolkits/index.ts +0 -6
- package/src/types/AssistantAction.ts +0 -70
- /package/dist/lib/browser/{blueprint-definition-AGTDXTXO.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/node-esm/{blueprint-definition-CFCUD2VC.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/types/src/components/TemplateEditor/{handlebars-extension.d.ts → extensions/handlebars-extension.d.ts} +0 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Array from 'effect/Array';
|
|
6
|
+
import * as Function from 'effect/Function';
|
|
7
|
+
import * as Option from 'effect/Option';
|
|
8
|
+
import React, { forwardRef, useCallback, useMemo } from 'react';
|
|
9
|
+
|
|
10
|
+
import { useCapabilities, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
11
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
12
|
+
import { type CompanionSurfaceProps } from '@dxos/app-toolkit/ui';
|
|
13
|
+
import { Chat } from '@dxos/assistant-toolkit';
|
|
14
|
+
import { Blueprint } from '@dxos/blueprints';
|
|
15
|
+
import { getSpace } from '@dxos/client/echo';
|
|
16
|
+
import { Feed, Filter, Obj, Ref } from '@dxos/echo';
|
|
17
|
+
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
18
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
19
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
20
|
+
|
|
21
|
+
import { type ChatEvent } from '#components';
|
|
22
|
+
import { useBlueprintRegistry, useContextBinder } from '#hooks';
|
|
23
|
+
import { AssistantOperation } from '#operations';
|
|
24
|
+
|
|
25
|
+
import ChatContainer from '../ChatContainer';
|
|
26
|
+
|
|
27
|
+
export type ChatCompanionProps = CompanionSurfaceProps<Chat.Chat>;
|
|
28
|
+
|
|
29
|
+
export const ChatCompanion = forwardRef<HTMLDivElement, ChatCompanionProps>(
|
|
30
|
+
({ role, subject: chat, companionTo, attendableId }, forwardedRef) => {
|
|
31
|
+
const { invokePromise } = useOperationInvoker();
|
|
32
|
+
const blueprintRegistry = useBlueprintRegistry();
|
|
33
|
+
const space = getSpace(companionTo);
|
|
34
|
+
const feedTarget = chat?.feed.target;
|
|
35
|
+
const chatQueue = space && feedTarget ? space.queues.get(Feed.getQueueDxn(feedTarget)!) : undefined;
|
|
36
|
+
const binder = useContextBinder(chatQueue);
|
|
37
|
+
|
|
38
|
+
// Persist chat on first submit.
|
|
39
|
+
const handleEvent = useCallback(
|
|
40
|
+
async (event: ChatEvent) => {
|
|
41
|
+
if (!space || !chat) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (event.type === 'submit' && !getSpace(chat)) {
|
|
46
|
+
await invokePromise(SpaceOperation.AddObject, {
|
|
47
|
+
object: chat,
|
|
48
|
+
target: space.db,
|
|
49
|
+
hidden: true,
|
|
50
|
+
});
|
|
51
|
+
await invokePromise(SpaceOperation.AddRelation, {
|
|
52
|
+
db: space.db,
|
|
53
|
+
schema: Chat.CompanionTo,
|
|
54
|
+
source: chat,
|
|
55
|
+
target: companionTo,
|
|
56
|
+
});
|
|
57
|
+
await invokePromise(AssistantOperation.SetCurrentChat, {
|
|
58
|
+
companionTo,
|
|
59
|
+
chat,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
[chat, space, companionTo, invokePromise],
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const metadata = useCapabilities(AppCapabilities.Metadata);
|
|
67
|
+
const blueprintKeys = useMemo(
|
|
68
|
+
() =>
|
|
69
|
+
Function.pipe(
|
|
70
|
+
metadata,
|
|
71
|
+
Array.findFirst(
|
|
72
|
+
(
|
|
73
|
+
capability,
|
|
74
|
+
): capability is {
|
|
75
|
+
id: string;
|
|
76
|
+
metadata: { blueprints?: string[] };
|
|
77
|
+
} => capability.id === Obj.getTypename(companionTo),
|
|
78
|
+
),
|
|
79
|
+
Option.flatMap((c) => Option.fromNullable(c.metadata.blueprints)),
|
|
80
|
+
Option.getOrElse(() => [] as string[]),
|
|
81
|
+
),
|
|
82
|
+
[metadata, companionTo],
|
|
83
|
+
);
|
|
84
|
+
const existingBlueprints = useQuery(space?.db, Filter.type(Blueprint.Blueprint));
|
|
85
|
+
const pluginBlueprints = useMemo(
|
|
86
|
+
() => existingBlueprints.filter((blueprint) => blueprintKeys.includes(blueprint.key)),
|
|
87
|
+
[existingBlueprints, blueprintKeys],
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
// Initialize related blueprints that are not already in the space.
|
|
91
|
+
useAsyncEffect(async () => {
|
|
92
|
+
if (!space) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// NOTE: This must be run instead of using the useQuery result to avoid duplicates.
|
|
97
|
+
const existingBlueprints = await space.db.query(Filter.type(Blueprint.Blueprint)).run();
|
|
98
|
+
for (const key of blueprintKeys) {
|
|
99
|
+
const existingBlueprint = existingBlueprints.find((blueprint) => blueprint.key === key);
|
|
100
|
+
if (existingBlueprint) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const blueprint = blueprintRegistry.getByKey(key);
|
|
105
|
+
if (!blueprint) {
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
space.db.add(Obj.clone(blueprint, { deep: true }));
|
|
110
|
+
}
|
|
111
|
+
}, [space, blueprintRegistry, blueprintKeys]);
|
|
112
|
+
|
|
113
|
+
useAsyncEffect(async () => {
|
|
114
|
+
if (!binder?.isOpen) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (pluginBlueprints.length > 0) {
|
|
119
|
+
await binder.bind({
|
|
120
|
+
blueprints: pluginBlueprints.map((blueprint) => Ref.make(blueprint)),
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (Obj.instanceOf(Blueprint.Blueprint, companionTo)) {
|
|
125
|
+
await binder.bind({ blueprints: [Ref.make(companionTo)] });
|
|
126
|
+
} else {
|
|
127
|
+
await binder.bind({ objects: [Ref.make(companionTo)] });
|
|
128
|
+
}
|
|
129
|
+
}, [binder, companionTo, blueprintKeys]);
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<ChatContainer
|
|
133
|
+
role={role}
|
|
134
|
+
space={space}
|
|
135
|
+
subject={chat}
|
|
136
|
+
attendableId={attendableId}
|
|
137
|
+
companionTo={companionTo}
|
|
138
|
+
onEvent={handleEvent}
|
|
139
|
+
ref={forwardedRef}
|
|
140
|
+
/>
|
|
141
|
+
);
|
|
142
|
+
},
|
|
143
|
+
);
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { forwardRef, useEffect, useRef } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Capabilities } from '@dxos/app-framework';
|
|
8
|
+
import { useAtomCapability, useCapability } from '@dxos/app-framework/ui';
|
|
9
|
+
import { type ObjectSurfaceProps } from '@dxos/app-toolkit/ui';
|
|
10
|
+
import { type Space, getSpace } from '@dxos/client/echo';
|
|
11
|
+
import { Feed, type Obj } from '@dxos/echo';
|
|
12
|
+
import { Panel } from '@dxos/react-ui';
|
|
13
|
+
import { getParentId } from '@dxos/react-ui-attention';
|
|
14
|
+
|
|
15
|
+
import { Chat as ChatComponent, type ChatRootProps } from '#components';
|
|
16
|
+
import { useBlueprintRegistry, useChatProcessor, useChatServices, useOnline, usePresets } from '#hooks';
|
|
17
|
+
import { AssistantCapabilities, type ChatType } from '#types';
|
|
18
|
+
|
|
19
|
+
export type ChatContainerProps = ObjectSurfaceProps<
|
|
20
|
+
ChatType.Chat | undefined,
|
|
21
|
+
{
|
|
22
|
+
space?: Space;
|
|
23
|
+
companionTo?: Obj.Unknown;
|
|
24
|
+
} & Pick<ChatRootProps, 'onEvent'>
|
|
25
|
+
>;
|
|
26
|
+
|
|
27
|
+
export const ChatContainer = forwardRef<HTMLDivElement, ChatContainerProps>((props, forwardedRef) => {
|
|
28
|
+
const { role, attendableId, subject: chat, space: spaceProp, companionTo, onEvent } = props;
|
|
29
|
+
const parentId = attendableId ? getParentId(attendableId) : undefined;
|
|
30
|
+
const space = spaceProp ?? getSpace(chat);
|
|
31
|
+
const settings = useAtomCapability(AssistantCapabilities.Settings);
|
|
32
|
+
const runtime = useChatServices({ id: space?.id });
|
|
33
|
+
const [online, setOnline] = useOnline();
|
|
34
|
+
const { preset, ...chatProps } = usePresets(online);
|
|
35
|
+
const blueprintRegistry = useBlueprintRegistry();
|
|
36
|
+
const processor = useChatProcessor({
|
|
37
|
+
space,
|
|
38
|
+
chat,
|
|
39
|
+
preset,
|
|
40
|
+
runtime,
|
|
41
|
+
blueprintRegistry,
|
|
42
|
+
settings,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const registry = useCapability(Capabilities.AtomRegistry);
|
|
46
|
+
const stateAtom = useCapability(AssistantCapabilities.State);
|
|
47
|
+
const pendingSubmitted = useRef(false);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (!processor || !attendableId || pendingSubmitted.current) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const state = registry.get(stateAtom);
|
|
54
|
+
const pendingPrompt = state.pendingPrompts[attendableId];
|
|
55
|
+
if (pendingPrompt) {
|
|
56
|
+
pendingSubmitted.current = true;
|
|
57
|
+
registry.update(stateAtom, (current) => {
|
|
58
|
+
const { [attendableId]: _, ...rest } = current.pendingPrompts;
|
|
59
|
+
return { ...current, pendingPrompts: rest };
|
|
60
|
+
});
|
|
61
|
+
void processor.request({ message: pendingPrompt });
|
|
62
|
+
}
|
|
63
|
+
}, [processor, attendableId, registry, stateAtom]);
|
|
64
|
+
|
|
65
|
+
const feedTarget = chat?.feed.target;
|
|
66
|
+
const queue = space && feedTarget ? space.queues.get(Feed.getQueueDxn(feedTarget)!) : undefined;
|
|
67
|
+
|
|
68
|
+
if (!processor) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<ChatComponent.Root db={space?.db} chat={chat} queue={queue} processor={processor} onEvent={onEvent}>
|
|
74
|
+
<Panel.Root role={role} classNames='dx-document' ref={forwardedRef}>
|
|
75
|
+
<Panel.Toolbar className='bg-toolbar-surface'>
|
|
76
|
+
<ChatComponent.Toolbar classNames='dx-document' attendableId={parentId} companionTo={companionTo} />
|
|
77
|
+
</Panel.Toolbar>
|
|
78
|
+
<Panel.Content>
|
|
79
|
+
<ChatComponent.Viewport>
|
|
80
|
+
<ChatComponent.Thread />
|
|
81
|
+
<div role='none' className='p-4'>
|
|
82
|
+
<ChatComponent.Prompt
|
|
83
|
+
{...chatProps}
|
|
84
|
+
outline
|
|
85
|
+
preset={preset?.id}
|
|
86
|
+
online={online}
|
|
87
|
+
onOnlineChange={setOnline}
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
</ChatComponent.Viewport>
|
|
91
|
+
</Panel.Content>
|
|
92
|
+
</Panel.Root>
|
|
93
|
+
</ChatComponent.Root>
|
|
94
|
+
);
|
|
95
|
+
});
|
|
@@ -4,31 +4,37 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useAtomCapability } from '@dxos/app-framework/ui';
|
|
8
|
+
import { type Chat as ChatTypes } from '@dxos/assistant-toolkit';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
9
10
|
import { useTranslation } from '@dxos/react-ui';
|
|
10
11
|
import { ChatDialog as NaturalChatDialog } from '@dxos/react-ui-chat';
|
|
11
12
|
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
import { Chat, type ChatRootProps } from './Chat';
|
|
13
|
+
import { Chat, type ChatRootProps } from '#components';
|
|
14
|
+
import { useBlueprintRegistry, useChatProcessor, useChatServices, useOnline, usePresets } from '#hooks';
|
|
15
|
+
import { meta } from '#meta';
|
|
16
|
+
import { AssistantCapabilities } from '#types';
|
|
17
17
|
|
|
18
18
|
export type ChatDialogProps = {
|
|
19
|
-
chat?:
|
|
19
|
+
chat?: ChatTypes.Chat;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export const ChatDialog = ({ chat }: ChatDialogProps) => {
|
|
23
23
|
const { t } = useTranslation(meta.id);
|
|
24
24
|
|
|
25
|
-
const
|
|
26
|
-
const settings =
|
|
27
|
-
const
|
|
25
|
+
const db = chat && Obj.getDatabase(chat);
|
|
26
|
+
const settings = useAtomCapability(AssistantCapabilities.Settings);
|
|
27
|
+
const runtime = useChatServices({ id: db?.spaceId });
|
|
28
28
|
const [online, setOnline] = useOnline();
|
|
29
29
|
const { preset, ...chatProps } = usePresets(online);
|
|
30
30
|
const blueprintRegistry = useBlueprintRegistry();
|
|
31
|
-
const processor = useChatProcessor({
|
|
31
|
+
const processor = useChatProcessor({
|
|
32
|
+
chat,
|
|
33
|
+
preset,
|
|
34
|
+
runtime,
|
|
35
|
+
blueprintRegistry,
|
|
36
|
+
settings,
|
|
37
|
+
});
|
|
32
38
|
|
|
33
39
|
// TODO(burdon): Refocus when open.
|
|
34
40
|
const [open, setOpen] = useState(true);
|
|
@@ -53,7 +59,7 @@ export const ChatDialog = ({ chat }: ChatDialogProps) => {
|
|
|
53
59
|
return (
|
|
54
60
|
<Chat.Root chat={chat} processor={processor} onEvent={handleEvent}>
|
|
55
61
|
<NaturalChatDialog.Root open={open} expanded={expanded} onOpenChange={setOpen}>
|
|
56
|
-
<NaturalChatDialog.Header title={t('assistant
|
|
62
|
+
<NaturalChatDialog.Header title={t('assistant-dialog.title')} />
|
|
57
63
|
<NaturalChatDialog.Content>
|
|
58
64
|
<Chat.Thread />
|
|
59
65
|
</NaturalChatDialog.Content>
|
|
@@ -64,5 +70,3 @@ export const ChatDialog = ({ chat }: ChatDialogProps) => {
|
|
|
64
70
|
</Chat.Root>
|
|
65
71
|
);
|
|
66
72
|
};
|
|
67
|
-
|
|
68
|
-
export default ChatDialog;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Atom, useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import * as Function from 'effect/Function';
|
|
7
|
+
import * as Option from 'effect/Option';
|
|
8
|
+
import React, { forwardRef, useMemo, useState } from 'react';
|
|
9
|
+
|
|
10
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
11
|
+
import { type ObjectSurfaceProps, useObjectMenuItems } from '@dxos/app-toolkit/ui';
|
|
12
|
+
import { type Project } from '@dxos/assistant-toolkit';
|
|
13
|
+
import { Annotation, Filter, Obj, Query } from '@dxos/echo';
|
|
14
|
+
import { AtomObj, AtomRef } from '@dxos/echo-atom';
|
|
15
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
16
|
+
import { Card, Panel, ScrollArea, Toolbar } from '@dxos/react-ui';
|
|
17
|
+
import { Menu } from '@dxos/react-ui-menu';
|
|
18
|
+
import { Focus, Mosaic, type MosaicTileProps } from '@dxos/react-ui-mosaic';
|
|
19
|
+
import { isNonNullable } from '@dxos/util';
|
|
20
|
+
|
|
21
|
+
export type ProjectArticleProps = ObjectSurfaceProps<Project.Project>;
|
|
22
|
+
|
|
23
|
+
export const ProjectArticle = ({ subject: project }: ProjectArticleProps) => {
|
|
24
|
+
const inputQueue = useAtomValue(
|
|
25
|
+
AtomObj.make(project).pipe((_) =>
|
|
26
|
+
Atom.make((get) =>
|
|
27
|
+
Option.fromNullable(get(_).queue).pipe(Option.map(AtomRef.make), Option.map(get), Option.getOrUndefined),
|
|
28
|
+
),
|
|
29
|
+
),
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const inputQueueItems: Obj.Unknown[] = useQuery(inputQueue, Query.select(Filter.everything()));
|
|
33
|
+
|
|
34
|
+
const artifacts = useAtomValue(
|
|
35
|
+
useMemo(
|
|
36
|
+
() =>
|
|
37
|
+
AtomObj.make(project).pipe((project) =>
|
|
38
|
+
Atom.make((get) => {
|
|
39
|
+
return get(project).artifacts.map((artifact) => get(AtomRef.make(artifact.data)) as Obj.Unknown);
|
|
40
|
+
}),
|
|
41
|
+
),
|
|
42
|
+
[project],
|
|
43
|
+
),
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const [viewport, setViewport] = useState<HTMLElement | null>(null);
|
|
47
|
+
|
|
48
|
+
const stackObjects = [...artifacts, ...inputQueueItems].filter(isNonNullable);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Panel.Root className='dx-document'>
|
|
52
|
+
<Panel.Content>
|
|
53
|
+
{/* TODO(burdon): Factor out. */}
|
|
54
|
+
{stackObjects.length === 0 && (
|
|
55
|
+
<div className='text-subdued'>
|
|
56
|
+
Project has no objects associated with it.
|
|
57
|
+
<br />
|
|
58
|
+
<br />
|
|
59
|
+
To get started:
|
|
60
|
+
<br />- Write the initative spec: what is the goal of the project?
|
|
61
|
+
<br />- subscribe project to your email.
|
|
62
|
+
<br />- Chat with the agent.
|
|
63
|
+
</div>
|
|
64
|
+
)}
|
|
65
|
+
|
|
66
|
+
{stackObjects.length > 0 && (
|
|
67
|
+
<Focus.Group asChild border>
|
|
68
|
+
<Mosaic.Container asChild withFocus autoScroll={viewport}>
|
|
69
|
+
<ScrollArea.Root orientation='vertical'>
|
|
70
|
+
<ScrollArea.Viewport classNames='p-2' ref={setViewport}>
|
|
71
|
+
<Mosaic.Stack items={stackObjects} getId={(item) => item.id} draggable={false} Tile={StackTile} />
|
|
72
|
+
</ScrollArea.Viewport>
|
|
73
|
+
</ScrollArea.Root>
|
|
74
|
+
</Mosaic.Container>
|
|
75
|
+
</Focus.Group>
|
|
76
|
+
)}
|
|
77
|
+
</Panel.Content>
|
|
78
|
+
</Panel.Root>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const StackTile = forwardRef<HTMLDivElement, MosaicTileProps<Obj.Unknown>>(
|
|
83
|
+
({ data, location, debug }, forwardedRef) => {
|
|
84
|
+
const objectMenuItems = useObjectMenuItems(data);
|
|
85
|
+
const icon = Function.pipe(
|
|
86
|
+
Obj.getSchema(data),
|
|
87
|
+
Option.fromNullable,
|
|
88
|
+
Option.flatMap(Annotation.IconAnnotation.get),
|
|
89
|
+
Option.map(({ icon }) => icon),
|
|
90
|
+
Option.getOrElse(() => 'ph--placeholder--regular'),
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<Menu.Root>
|
|
95
|
+
<Mosaic.Tile asChild id={data.id} data={data} location={location} debug={debug}>
|
|
96
|
+
<Focus.Item asChild>
|
|
97
|
+
<Card.Root ref={forwardedRef} data-testid='board-item'>
|
|
98
|
+
<Card.Toolbar>
|
|
99
|
+
<Card.IconBlock padding>
|
|
100
|
+
<Card.Icon icon={icon} />
|
|
101
|
+
</Card.IconBlock>
|
|
102
|
+
<Card.Title>{Obj.getLabel(data)}</Card.Title>
|
|
103
|
+
{/* TODO(wittjosiah): Reconcile with Card.Menu. */}
|
|
104
|
+
<Card.IconBlock padding>
|
|
105
|
+
<Menu.Trigger asChild disabled={!objectMenuItems?.length}>
|
|
106
|
+
<Toolbar.IconButton
|
|
107
|
+
iconOnly
|
|
108
|
+
variant='ghost'
|
|
109
|
+
icon='ph--dots-three-vertical--regular'
|
|
110
|
+
label='Actions'
|
|
111
|
+
/>
|
|
112
|
+
</Menu.Trigger>
|
|
113
|
+
<Menu.Content items={objectMenuItems} />
|
|
114
|
+
</Card.IconBlock>
|
|
115
|
+
</Card.Toolbar>
|
|
116
|
+
<Card.Content>
|
|
117
|
+
<Surface.Surface role='card--content' limit={1} data={{ subject: data }} />
|
|
118
|
+
</Card.Content>
|
|
119
|
+
</Card.Root>
|
|
120
|
+
</Focus.Item>
|
|
121
|
+
</Mosaic.Tile>
|
|
122
|
+
</Menu.Root>
|
|
123
|
+
);
|
|
124
|
+
},
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
StackTile.displayName = 'StackTile';
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Atom } from '@effect-atom/atom';
|
|
6
|
+
import { useAtomValue } from '@effect-atom/atom-react';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
import * as Option from 'effect/Option';
|
|
9
|
+
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
10
|
+
|
|
11
|
+
import { useCapability } from '@dxos/app-framework/ui';
|
|
12
|
+
import { type ObjectSurfaceProps } from '@dxos/app-toolkit/ui';
|
|
13
|
+
import { Project, syncProjectTriggers } from '@dxos/assistant-toolkit';
|
|
14
|
+
import { DXN, Obj, Ref } from '@dxos/echo';
|
|
15
|
+
import { AtomObj, AtomRef } from '@dxos/echo-atom';
|
|
16
|
+
import { QueueService } from '@dxos/functions';
|
|
17
|
+
import { AutomationCapabilities } from '@dxos/plugin-automation/types';
|
|
18
|
+
import { MarkdownEditor } from '@dxos/plugin-markdown';
|
|
19
|
+
import { Filter, useQuery } from '@dxos/react-client/echo';
|
|
20
|
+
import { useObject } from '@dxos/react-client/echo';
|
|
21
|
+
import { Button } from '@dxos/react-ui';
|
|
22
|
+
import { useTranslation, Input } from '@dxos/react-ui';
|
|
23
|
+
import { FeedAnnotation } from '@dxos/schema';
|
|
24
|
+
|
|
25
|
+
import { meta } from '#meta';
|
|
26
|
+
|
|
27
|
+
export type ProjectSettingsProps = ObjectSurfaceProps<Project.Project>;
|
|
28
|
+
|
|
29
|
+
export const ProjectSettings = ({ subject: project }: ProjectSettingsProps) => {
|
|
30
|
+
const { t } = useTranslation(meta.id);
|
|
31
|
+
const computeRuntime = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
32
|
+
|
|
33
|
+
const handleResetHistory = useCallback(async () => {
|
|
34
|
+
const runtime = computeRuntime.getRuntime(Obj.getDatabase(project)!.spaceId);
|
|
35
|
+
await runtime.runPromise(Project.resetChatHistory(project));
|
|
36
|
+
if (!project.queue) {
|
|
37
|
+
await runtime.runPromise(
|
|
38
|
+
Effect.gen(function* () {
|
|
39
|
+
const queue = yield* QueueService.createQueue();
|
|
40
|
+
Obj.change(project, (project) => {
|
|
41
|
+
project.queue = Ref.fromDXN(queue.dxn);
|
|
42
|
+
});
|
|
43
|
+
}),
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
}, [project, computeRuntime]);
|
|
47
|
+
|
|
48
|
+
const spec = useAtomValue(AtomRef.make(project.spec));
|
|
49
|
+
const [specInitialValue] = useObject(spec, 'content');
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
const db = Obj.getDatabase(project);
|
|
53
|
+
if (!db) return;
|
|
54
|
+
const runtime = computeRuntime.getRuntime(db.spaceId);
|
|
55
|
+
return Obj.subscribe(project, () => {
|
|
56
|
+
queueMicrotask(() => runtime.runPromise(syncProjectTriggers(project)));
|
|
57
|
+
});
|
|
58
|
+
}, [project, computeRuntime]);
|
|
59
|
+
|
|
60
|
+
const db = Obj.getDatabase(project);
|
|
61
|
+
const feedFilter = useMemo(() => {
|
|
62
|
+
if (!db) {
|
|
63
|
+
return Filter.nothing();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const schemas = db.schemaRegistry.query({ location: ['database', 'runtime'] }).runSync();
|
|
67
|
+
const feedSchemas = schemas.filter((schema) => {
|
|
68
|
+
const annotation = FeedAnnotation.get(schema);
|
|
69
|
+
return Option.isSome(annotation) && annotation.value === true;
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
if (feedSchemas.length === 0) {
|
|
73
|
+
return Filter.nothing();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return Filter.or(...feedSchemas.map((schema) => Filter.type(schema)));
|
|
77
|
+
}, [db]);
|
|
78
|
+
const subscribableObjects = useQuery(db, feedFilter);
|
|
79
|
+
|
|
80
|
+
const existingSubscripts = useAtomValue(
|
|
81
|
+
useMemo(
|
|
82
|
+
() =>
|
|
83
|
+
AtomObj.make(project).pipe((_) =>
|
|
84
|
+
Atom.make((get) => {
|
|
85
|
+
const project = get(_);
|
|
86
|
+
const selectedSubscriptions: Obj.Unknown[] = subscribableObjects.filter((object) =>
|
|
87
|
+
project.subscriptions.some((subscription) => DXN.equals(subscription.dxn, Obj.getDXN(object))),
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
return selectedSubscriptions;
|
|
91
|
+
}),
|
|
92
|
+
),
|
|
93
|
+
[project, subscribableObjects],
|
|
94
|
+
),
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<div role='none' className='dx-container grid grid-rows-[min-content_1fr_min-content] gap-2 pb-trim-md'>
|
|
99
|
+
<div role='none' className='flex flex-col'>
|
|
100
|
+
<Input.Root>
|
|
101
|
+
<Input.Label>{t('subscriptions.label')}</Input.Label>
|
|
102
|
+
</Input.Root>
|
|
103
|
+
{subscribableObjects.map((object) => (
|
|
104
|
+
<Input.Root key={object.id}>
|
|
105
|
+
<div className='flex items-center gap-2'>
|
|
106
|
+
<Input.Checkbox
|
|
107
|
+
checked={existingSubscripts.includes(object)}
|
|
108
|
+
onCheckedChange={(checked) => {
|
|
109
|
+
Obj.change(project, (project) => {
|
|
110
|
+
if (checked) {
|
|
111
|
+
project.subscriptions.push(Ref.fromDXN(Obj.getDXN(object)));
|
|
112
|
+
} else {
|
|
113
|
+
project.subscriptions = project.subscriptions.filter(
|
|
114
|
+
(subscription) => !DXN.equals(subscription.dxn, Obj.getDXN(object)),
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}}
|
|
119
|
+
/>
|
|
120
|
+
<Input.Label>{Obj.getLabel(object) ?? object.id}</Input.Label>
|
|
121
|
+
</div>
|
|
122
|
+
</Input.Root>
|
|
123
|
+
))}
|
|
124
|
+
</div>
|
|
125
|
+
<div className='dx-expander flex flex-col'>
|
|
126
|
+
<Input.Root>
|
|
127
|
+
<Input.Label>{t('instructions.label')}</Input.Label>
|
|
128
|
+
{spec && (
|
|
129
|
+
<MarkdownEditor.Root id={spec.id} object={spec}>
|
|
130
|
+
<MarkdownEditor.Content initialValue={specInitialValue} />
|
|
131
|
+
</MarkdownEditor.Root>
|
|
132
|
+
)}
|
|
133
|
+
</Input.Root>
|
|
134
|
+
</div>
|
|
135
|
+
{/* TODO(burdon): Move into toolbar in parent. */}
|
|
136
|
+
<Button onClick={handleResetHistory}>{t('reset-history.button')}</Button>
|
|
137
|
+
</div>
|
|
138
|
+
);
|
|
139
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type ObjectSurfaceProps } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { AgentPrompt } from '@dxos/assistant-toolkit';
|
|
9
|
+
import { type Prompt } from '@dxos/blueprints';
|
|
10
|
+
import { Obj } from '@dxos/echo';
|
|
11
|
+
import { Operation } from '@dxos/operation';
|
|
12
|
+
import { invariant } from '@dxos/invariant';
|
|
13
|
+
import { invokeFunctionWithTracing, useComputeRuntimeCallback } from '@dxos/plugin-automation/hooks';
|
|
14
|
+
import { Panel, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
15
|
+
import { useAttention } from '@dxos/react-ui-attention';
|
|
16
|
+
|
|
17
|
+
import { TemplateEditor } from '#components';
|
|
18
|
+
import { meta } from '#meta';
|
|
19
|
+
|
|
20
|
+
export type PromptArticleProps = ObjectSurfaceProps<Prompt.Prompt>;
|
|
21
|
+
|
|
22
|
+
export const PromptArticle = ({ role, attendableId, subject }: PromptArticleProps) => {
|
|
23
|
+
const { t } = useTranslation(meta.id);
|
|
24
|
+
const { hasAttention } = useAttention(attendableId);
|
|
25
|
+
const db = Obj.getDatabase(subject);
|
|
26
|
+
|
|
27
|
+
const inputData = useMemo<Operation.Definition.Input<typeof AgentPrompt> | undefined>(
|
|
28
|
+
() =>
|
|
29
|
+
subject && db
|
|
30
|
+
? {
|
|
31
|
+
prompt: db.makeRef(Obj.getDXN(subject)),
|
|
32
|
+
input: {},
|
|
33
|
+
}
|
|
34
|
+
: undefined,
|
|
35
|
+
[subject, db],
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const handleRun = useComputeRuntimeCallback(
|
|
39
|
+
db?.spaceId,
|
|
40
|
+
() => {
|
|
41
|
+
invariant(inputData);
|
|
42
|
+
return invokeFunctionWithTracing(AgentPrompt, inputData);
|
|
43
|
+
},
|
|
44
|
+
[inputData],
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Panel.Root role={role} className='dx-document'>
|
|
49
|
+
<Panel.Toolbar asChild>
|
|
50
|
+
<Toolbar.Root disabled={!hasAttention} onClick={handleRun}>
|
|
51
|
+
<Toolbar.IconButton iconOnly icon='ph--play--regular' label={t('run-prompt.label')} onClick={handleRun} />
|
|
52
|
+
</Toolbar.Root>
|
|
53
|
+
</Panel.Toolbar>
|
|
54
|
+
<Panel.Content asChild>
|
|
55
|
+
<TemplateEditor id={subject.id} template={subject.instructions} />
|
|
56
|
+
</Panel.Content>
|
|
57
|
+
</Panel.Root>
|
|
58
|
+
);
|
|
59
|
+
};
|