@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,274 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
type CompletionContext,
|
|
7
|
+
type CompletionResult,
|
|
8
|
+
autocompletion,
|
|
9
|
+
completionKeymap,
|
|
10
|
+
} from '@codemirror/autocomplete';
|
|
11
|
+
import { type Extension, RangeSetBuilder } from '@codemirror/state';
|
|
12
|
+
import {
|
|
13
|
+
Decoration,
|
|
14
|
+
type DecorationSet,
|
|
15
|
+
type EditorView,
|
|
16
|
+
ViewPlugin,
|
|
17
|
+
type ViewUpdate,
|
|
18
|
+
WidgetType,
|
|
19
|
+
keymap,
|
|
20
|
+
} from '@codemirror/view';
|
|
21
|
+
|
|
22
|
+
import { Domino, mx } from '@dxos/ui';
|
|
23
|
+
|
|
24
|
+
export type HandlebarsOptions = {};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Simple Handlebars plugin for CodeMirror.
|
|
28
|
+
* Supports:
|
|
29
|
+
* - Comments: {{! comment }}
|
|
30
|
+
* - Commands: {{#command}} {{/command}}
|
|
31
|
+
* - Variables: {{var}}
|
|
32
|
+
* - Commands with variables: {{#each items}} {{/each}}
|
|
33
|
+
*/
|
|
34
|
+
export const handlebars = (_: HandlebarsOptions = {}): Extension => {
|
|
35
|
+
return [
|
|
36
|
+
handlebarsHighlightPlugin,
|
|
37
|
+
autocompletion({
|
|
38
|
+
activateOnTyping: true,
|
|
39
|
+
aboveCursor: true,
|
|
40
|
+
closeOnBlur: true,
|
|
41
|
+
override: [handlebarsCompletions],
|
|
42
|
+
}),
|
|
43
|
+
keymap.of(completionKeymap),
|
|
44
|
+
];
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const regex = {
|
|
48
|
+
// {{! comment }}
|
|
49
|
+
comment: /\{\{!\s*[^}]*\}\}/g,
|
|
50
|
+
|
|
51
|
+
// {{var}}
|
|
52
|
+
brackets: /\{\{[^}]*\}\}/g,
|
|
53
|
+
|
|
54
|
+
// {{#command}} {{/command}}
|
|
55
|
+
command: /\{\{[#/]([^}]+)\}\}/g,
|
|
56
|
+
|
|
57
|
+
// {{var}}
|
|
58
|
+
var: /\{\{(?!\s*!)(\w[^}]*)\}\}/g,
|
|
59
|
+
|
|
60
|
+
// @dxn:queue:data:xxx
|
|
61
|
+
dxn: /@?dxn:[\w@:]+/g,
|
|
62
|
+
|
|
63
|
+
// dxos.org/type/xxx
|
|
64
|
+
url: /[\w.-]+\.[\w.-]+\/[\w/]+/g,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const tagPadding = 'mx-0.5 px-1 rounded-xs';
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* ViewPlugin that decorates Handlebars syntax.
|
|
71
|
+
*/
|
|
72
|
+
const handlebarsHighlightPlugin = ViewPlugin.fromClass(
|
|
73
|
+
class {
|
|
74
|
+
decorations: DecorationSet;
|
|
75
|
+
|
|
76
|
+
constructor(view: EditorView) {
|
|
77
|
+
this.decorations = this.buildDecorations(view);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
update(update: ViewUpdate) {
|
|
81
|
+
if (update.docChanged || update.viewportChanged || update.selectionSet) {
|
|
82
|
+
this.decorations = this.buildDecorations(update.view);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// NOTE: Decorations may clash with other extensions (e.g., markdown).
|
|
87
|
+
buildDecorations(view: EditorView) {
|
|
88
|
+
const selection = view.state.selection.main;
|
|
89
|
+
const decorations: Array<{
|
|
90
|
+
from: number;
|
|
91
|
+
to: number;
|
|
92
|
+
decoration: Decoration;
|
|
93
|
+
}> = [];
|
|
94
|
+
|
|
95
|
+
for (const { from, to } of view.visibleRanges) {
|
|
96
|
+
const text = view.state.doc.sliceString(from, to);
|
|
97
|
+
|
|
98
|
+
// Match DXN.
|
|
99
|
+
{
|
|
100
|
+
let match;
|
|
101
|
+
while ((match = regex.dxn.exec(text)) !== null) {
|
|
102
|
+
const start = from + match.index;
|
|
103
|
+
const end = start + match[0].length;
|
|
104
|
+
// Only show widget if selection doesn't overlap with the match range.
|
|
105
|
+
const overlaps = selection.to > start && selection.from <= end;
|
|
106
|
+
if (!overlaps) {
|
|
107
|
+
decorations.push({
|
|
108
|
+
from: start,
|
|
109
|
+
to: end,
|
|
110
|
+
decoration: Decoration.widget({
|
|
111
|
+
widget: new DXNWidget(match[0]),
|
|
112
|
+
}),
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Match URLs.
|
|
119
|
+
{
|
|
120
|
+
let match;
|
|
121
|
+
while ((match = regex.url.exec(text)) !== null) {
|
|
122
|
+
const start = from + match.index;
|
|
123
|
+
const end = start + match[0].length;
|
|
124
|
+
decorations.push({
|
|
125
|
+
from: start,
|
|
126
|
+
to: end,
|
|
127
|
+
decoration: Decoration.mark({
|
|
128
|
+
class: mx('dx-tag--blue', tagPadding),
|
|
129
|
+
}),
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Match brackets: {{ and }}.
|
|
135
|
+
{
|
|
136
|
+
let match;
|
|
137
|
+
while ((match = regex.brackets.exec(text)) !== null) {
|
|
138
|
+
const start = from + match.index;
|
|
139
|
+
const end = start + match[0].length;
|
|
140
|
+
decorations.push({
|
|
141
|
+
from: start,
|
|
142
|
+
to: end,
|
|
143
|
+
decoration: Decoration.mark({ class: 'text-subdued' }),
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Match commands: {{#command}} and {{/command}}.
|
|
149
|
+
{
|
|
150
|
+
let match;
|
|
151
|
+
while ((match = regex.command.exec(text)) !== null) {
|
|
152
|
+
const start = from + match.index + 2;
|
|
153
|
+
let end = start + match[0].length - 4;
|
|
154
|
+
const text = view.state.doc.sliceString(start, end);
|
|
155
|
+
const parts = text.split(/\s+/);
|
|
156
|
+
if (parts.length > 1) {
|
|
157
|
+
const idx = start + parts[0].length;
|
|
158
|
+
decorations.push({
|
|
159
|
+
from: idx,
|
|
160
|
+
to: end,
|
|
161
|
+
decoration: Decoration.mark({ class: 'text-green-text' }),
|
|
162
|
+
});
|
|
163
|
+
end = idx;
|
|
164
|
+
}
|
|
165
|
+
decorations.push({
|
|
166
|
+
from: start,
|
|
167
|
+
to: end,
|
|
168
|
+
decoration: Decoration.mark({ class: 'text-blue-text' }),
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Match variables: {{var}}.
|
|
174
|
+
{
|
|
175
|
+
let match;
|
|
176
|
+
while ((match = regex.var.exec(text)) !== null) {
|
|
177
|
+
const start = from + match.index + 2;
|
|
178
|
+
const end = start + match[0].length - 4;
|
|
179
|
+
decorations.push({
|
|
180
|
+
from: start,
|
|
181
|
+
to: end,
|
|
182
|
+
decoration: Decoration.mark({ class: 'text-green-text' }),
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Sort decorations by position to satisfy RangeSetBuilder requirements.
|
|
189
|
+
decorations.sort((a, b) => a.from - b.from || a.to - b.to);
|
|
190
|
+
|
|
191
|
+
// Add sorted decorations to builder.
|
|
192
|
+
const builder = new RangeSetBuilder<Decoration>();
|
|
193
|
+
for (const { from, to, decoration } of decorations) {
|
|
194
|
+
builder.add(from, to, decoration);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return builder.finish();
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
decorations: (v) => v.decorations,
|
|
202
|
+
},
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
class DXNWidget extends WidgetType {
|
|
206
|
+
constructor(private readonly _identifier: string) {
|
|
207
|
+
super();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
override ignoreEvent() {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
override eq(other: this) {
|
|
215
|
+
return this._identifier === other._identifier;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
override toDOM() {
|
|
219
|
+
const text = this._identifier
|
|
220
|
+
.split(':')
|
|
221
|
+
.map((part) => {
|
|
222
|
+
const len = 16;
|
|
223
|
+
const plen = 4;
|
|
224
|
+
if (part.length > len) {
|
|
225
|
+
return `[${part.slice(0, plen)}…${part.slice(-plen)}]`;
|
|
226
|
+
}
|
|
227
|
+
return part;
|
|
228
|
+
})
|
|
229
|
+
.join(':');
|
|
230
|
+
return Domino.of('span').classNames(mx('font-mono dx-tag--blue', tagPadding)).text(text).root;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// TODO(burdon): Pass in variables.
|
|
235
|
+
const variables = ['this'];
|
|
236
|
+
const commands = ['this', 'each', 'if', 'unless', 'with'];
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Provides completions for Handlebars variables.
|
|
240
|
+
*/
|
|
241
|
+
function handlebarsCompletions(context: CompletionContext): CompletionResult | null {
|
|
242
|
+
const match = context.matchBefore(/\{\{[^}]*/);
|
|
243
|
+
if (!match || match.from === match.to) {
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
let type = 'variable';
|
|
248
|
+
let text = match.text.slice(2);
|
|
249
|
+
let from = match.from + 2;
|
|
250
|
+
let matches = [];
|
|
251
|
+
if (text.startsWith('#') || text.startsWith('/')) {
|
|
252
|
+
const idx = text.lastIndexOf(' ');
|
|
253
|
+
if (idx !== -1) {
|
|
254
|
+
type = 'variable';
|
|
255
|
+
matches = variables;
|
|
256
|
+
text = text.slice(idx + 1);
|
|
257
|
+
from += idx + 1;
|
|
258
|
+
} else {
|
|
259
|
+
type = 'command';
|
|
260
|
+
text = text.slice(1);
|
|
261
|
+
matches = commands;
|
|
262
|
+
from += 1;
|
|
263
|
+
}
|
|
264
|
+
} else {
|
|
265
|
+
type = 'variable';
|
|
266
|
+
matches = variables;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const options = matches.filter((name) => name.startsWith(text)).map((name) => ({ type, label: name }));
|
|
270
|
+
return {
|
|
271
|
+
from,
|
|
272
|
+
options,
|
|
273
|
+
};
|
|
274
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { syntaxTree } from '@codemirror/language';
|
|
6
|
+
import { type Extension, RangeSetBuilder } from '@codemirror/state';
|
|
7
|
+
import { Decoration, type DecorationSet, type EditorView, ViewPlugin, type ViewUpdate } from '@codemirror/view';
|
|
8
|
+
|
|
9
|
+
export type XmlOptions = {};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* XML decorator plugin for CodeMirror.
|
|
13
|
+
* Decorates XML tags with monospace font using the XML language grammar.
|
|
14
|
+
*/
|
|
15
|
+
export const xmlDecorator = (_: XmlOptions = {}): Extension => {
|
|
16
|
+
return [xmlDecoratorPlugin];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* ViewPlugin that decorates XML tags using syntax tree.
|
|
21
|
+
*/
|
|
22
|
+
const xmlDecoratorPlugin = ViewPlugin.fromClass(
|
|
23
|
+
class {
|
|
24
|
+
decorations: DecorationSet;
|
|
25
|
+
|
|
26
|
+
constructor(view: EditorView) {
|
|
27
|
+
this.decorations = this.buildDecorations(view);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
update(update: ViewUpdate) {
|
|
31
|
+
if (update.docChanged || update.viewportChanged) {
|
|
32
|
+
this.decorations = this.buildDecorations(update.view);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
buildDecorations(view: EditorView) {
|
|
37
|
+
const builder = new RangeSetBuilder<Decoration>();
|
|
38
|
+
|
|
39
|
+
for (const { from, to } of view.visibleRanges) {
|
|
40
|
+
syntaxTree(view.state).iterate({
|
|
41
|
+
from,
|
|
42
|
+
to,
|
|
43
|
+
enter: (node) => {
|
|
44
|
+
// Decorate XML elements (opening tags, closing tags, self-closing tags).
|
|
45
|
+
if (
|
|
46
|
+
node.name === 'HTMLTag' ||
|
|
47
|
+
node.name === 'OpenTag' ||
|
|
48
|
+
node.name === 'CloseTag' ||
|
|
49
|
+
node.name === 'SelfClosingTag' ||
|
|
50
|
+
node.name === 'Element'
|
|
51
|
+
) {
|
|
52
|
+
builder.add(node.from, node.to, Decoration.mark({ class: 'font-mono text-subdued' }));
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return builder.finish();
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
decorations: (v) => v.decorations,
|
|
63
|
+
},
|
|
64
|
+
);
|
|
@@ -3,50 +3,34 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import type * as Tool from '@effect/ai/Tool';
|
|
6
|
-
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
6
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { type AgentStatus } from '@dxos/ai';
|
|
9
8
|
import { useTranslation } from '@dxos/react-ui';
|
|
10
|
-
import {
|
|
11
|
-
NumericTabs,
|
|
12
|
-
TextCrawl,
|
|
13
|
-
ToggleContainer,
|
|
14
|
-
chatMessageJson,
|
|
15
|
-
chatMessagePanel,
|
|
16
|
-
chatMessagePanelContent,
|
|
17
|
-
chatMessagePanelHeader,
|
|
18
|
-
} from '@dxos/react-ui-components';
|
|
9
|
+
import { NumericTabs, TextCrawl, TogglePanel, type TogglePanelRootProps } from '@dxos/react-ui-components';
|
|
19
10
|
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
20
|
-
import { type ContentBlock, type
|
|
11
|
+
import { type ContentBlock, type Message } from '@dxos/types';
|
|
12
|
+
import { type XmlWidgetProps } from '@dxos/ui-editor';
|
|
21
13
|
import { isNonNullable, safeParseJson } from '@dxos/util';
|
|
22
14
|
|
|
23
|
-
import { meta } from '
|
|
15
|
+
import { meta } from '#meta';
|
|
24
16
|
|
|
25
|
-
export const isToolMessage = (message:
|
|
26
|
-
return message.blocks.some((block) => block._tag === 'toolCall' || block._tag === 'toolResult');
|
|
17
|
+
export const isToolMessage = (message: Message.Message) => {
|
|
18
|
+
return message.blocks.some((block: ContentBlock.Any) => block._tag === 'toolCall' || block._tag === 'toolResult');
|
|
27
19
|
};
|
|
28
20
|
|
|
29
|
-
export type ToolBlockProps = {
|
|
21
|
+
export type ToolBlockProps = XmlWidgetProps<{
|
|
30
22
|
blocks: ContentBlock.Any[];
|
|
31
|
-
}
|
|
23
|
+
}>;
|
|
32
24
|
|
|
33
|
-
export const ToolBlock = ({ blocks = [] }: ToolBlockProps) => {
|
|
25
|
+
export const ToolBlock = ({ view, blocks = [] }: ToolBlockProps) => {
|
|
34
26
|
const { t } = useTranslation(meta.id);
|
|
35
27
|
|
|
36
|
-
const
|
|
37
|
-
if (!tool) {
|
|
38
|
-
return t('calling tool label');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return status?.message ?? tool.description ?? [t('calling label'), tool.name].join(' ');
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const items = useMemo(() => {
|
|
28
|
+
const items = useMemo<ToolPanelProps['items']>(() => {
|
|
45
29
|
let lastToolCall: { tool: Tool.Any | undefined; block: ContentBlock.ToolCall } | undefined;
|
|
46
30
|
// TODO(burdon): Get from context?
|
|
47
31
|
const tools: Tool.Any[] = []; //processor.conversation.toolkit?.tools ?? [];
|
|
48
32
|
return blocks
|
|
49
|
-
.filter((block) => block._tag === 'toolCall' || block._tag === 'toolResult' || block._tag === '
|
|
33
|
+
.filter((block) => block._tag === 'toolCall' || block._tag === 'toolResult' || block._tag === 'stats')
|
|
50
34
|
.map((block) => {
|
|
51
35
|
switch (block._tag) {
|
|
52
36
|
case 'toolCall': {
|
|
@@ -57,7 +41,7 @@ export const ToolBlock = ({ blocks = [] }: ToolBlockProps) => {
|
|
|
57
41
|
const tool = tools.find((tool) => tool.name === block.name);
|
|
58
42
|
lastToolCall = { tool, block };
|
|
59
43
|
return {
|
|
60
|
-
title:
|
|
44
|
+
title: tool?.description ?? [t('tool-call.label'), tool?.name].join(' '),
|
|
61
45
|
content: {
|
|
62
46
|
...block,
|
|
63
47
|
input: safeParseJson(block.input),
|
|
@@ -69,12 +53,13 @@ export const ToolBlock = ({ blocks = [] }: ToolBlockProps) => {
|
|
|
69
53
|
// TODO(burdon): Parse error type.
|
|
70
54
|
if (block.error) {
|
|
71
55
|
return {
|
|
72
|
-
title: t('error
|
|
56
|
+
title: t('tool-error.label'),
|
|
73
57
|
content: block,
|
|
74
58
|
};
|
|
75
59
|
}
|
|
76
60
|
|
|
77
|
-
const title =
|
|
61
|
+
const title =
|
|
62
|
+
lastToolCall?.tool?.description ?? [t('tool-result.label'), lastToolCall?.tool?.name].join(' ');
|
|
78
63
|
lastToolCall = undefined;
|
|
79
64
|
return {
|
|
80
65
|
title,
|
|
@@ -85,13 +70,13 @@ export const ToolBlock = ({ blocks = [] }: ToolBlockProps) => {
|
|
|
85
70
|
};
|
|
86
71
|
}
|
|
87
72
|
|
|
88
|
-
case '
|
|
73
|
+
case 'stats': {
|
|
89
74
|
if (!lastToolCall) {
|
|
90
75
|
return null;
|
|
91
76
|
}
|
|
92
77
|
|
|
93
78
|
return {
|
|
94
|
-
title: t('
|
|
79
|
+
title: t('stats.label'),
|
|
95
80
|
content: block,
|
|
96
81
|
};
|
|
97
82
|
}
|
|
@@ -100,53 +85,59 @@ export const ToolBlock = ({ blocks = [] }: ToolBlockProps) => {
|
|
|
100
85
|
.filter(isNonNullable);
|
|
101
86
|
}, [blocks]);
|
|
102
87
|
|
|
88
|
+
const handleChangeOpen = useCallback(() => {
|
|
89
|
+
setTimeout(() => {
|
|
90
|
+
// Measure after animation.
|
|
91
|
+
view?.requestMeasure();
|
|
92
|
+
}, 1_000);
|
|
93
|
+
}, [view]);
|
|
94
|
+
|
|
103
95
|
if (!items.length) {
|
|
104
96
|
return null;
|
|
105
97
|
}
|
|
106
98
|
|
|
107
|
-
return <
|
|
99
|
+
return <ToolPanel items={items} onChangeOpen={handleChangeOpen} />;
|
|
108
100
|
};
|
|
109
101
|
|
|
110
102
|
ToolBlock.displayName = 'ToolBlock';
|
|
111
103
|
|
|
112
|
-
type
|
|
104
|
+
type ToolPanelProps = {
|
|
113
105
|
items: { title: string; content: any }[];
|
|
114
|
-
}
|
|
106
|
+
} & Pick<TogglePanelRootProps, 'onChangeOpen'>;
|
|
115
107
|
|
|
116
|
-
|
|
117
|
-
export const ToolContainer = ({ items }: ToolContainerParams) => {
|
|
108
|
+
export const ToolPanel = ({ items, onChangeOpen }: ToolPanelProps) => {
|
|
118
109
|
const tabsRef = useRef<HTMLDivElement>(null);
|
|
119
110
|
const [selected, setSelected] = useState(0);
|
|
120
111
|
const [open, setOpen] = useState(false);
|
|
112
|
+
|
|
121
113
|
useEffect(() => {
|
|
114
|
+
onChangeOpen?.(open);
|
|
122
115
|
if (open) {
|
|
123
116
|
tabsRef.current?.focus();
|
|
124
117
|
}
|
|
125
|
-
}, [open]);
|
|
118
|
+
}, [open, onChangeOpen]);
|
|
126
119
|
|
|
127
|
-
const handleSelect = (index: number) => {
|
|
120
|
+
const handleSelect = useCallback((index: number) => {
|
|
128
121
|
setSelected(index);
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const data = items[selected]?.content;
|
|
122
|
+
}, []);
|
|
132
123
|
|
|
133
124
|
return (
|
|
134
|
-
<
|
|
135
|
-
<
|
|
136
|
-
<TextCrawl key='status-roll' lines={items.map((item) => item.title)} />
|
|
137
|
-
</
|
|
138
|
-
<
|
|
125
|
+
<TogglePanel.Root classNames='mt-2 w-full rounded-xs' open={open} onChangeOpen={setOpen}>
|
|
126
|
+
<TogglePanel.Header classNames='text-sm text-placeholder'>
|
|
127
|
+
<TextCrawl key='status-roll' lines={items.map((item) => item.title)} autoAdvance greedy />
|
|
128
|
+
</TogglePanel.Header>
|
|
129
|
+
<TogglePanel.Content classNames='grid grid-cols-[32px_1fr]'>
|
|
139
130
|
<NumericTabs ref={tabsRef} classNames='p-1' length={items.length} selected={selected} onSelect={handleSelect} />
|
|
140
|
-
<Json
|
|
141
|
-
data={
|
|
142
|
-
classNames=
|
|
131
|
+
<Json.Data
|
|
132
|
+
data={items[selected]?.content}
|
|
133
|
+
classNames='p-1 text-xs bg-transparent'
|
|
143
134
|
replacer={{
|
|
144
135
|
maxDepth: 3,
|
|
145
136
|
maxArrayLen: 10,
|
|
146
137
|
maxStringLen: 128,
|
|
147
138
|
}}
|
|
148
139
|
/>
|
|
149
|
-
</
|
|
150
|
-
</
|
|
140
|
+
</TogglePanel.Content>
|
|
141
|
+
</TogglePanel.Root>
|
|
151
142
|
);
|
|
152
143
|
};
|
|
@@ -3,42 +3,40 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
6
7
|
import React from 'react';
|
|
7
8
|
|
|
8
|
-
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
-
import { capabilities } from '@dxos/assistant-toolkit';
|
|
10
|
+
import { capabilities } from '@dxos/assistant-toolkit/testing';
|
|
11
11
|
import { ChessPlugin } from '@dxos/plugin-chess';
|
|
12
12
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
13
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
13
14
|
import { MapPlugin } from '@dxos/plugin-map';
|
|
14
|
-
import { SpacePlugin } from '@dxos/plugin-space';
|
|
15
15
|
import { TablePlugin } from '@dxos/plugin-table';
|
|
16
|
-
import {
|
|
16
|
+
import { corePlugins } from '@dxos/plugin-testing';
|
|
17
17
|
|
|
18
18
|
import { translations } from '../../translations';
|
|
19
19
|
|
|
20
20
|
import { Toolbox, type ToolboxProps } from './Toolbox';
|
|
21
21
|
|
|
22
22
|
const DefaultStory = (props: ToolboxProps) => {
|
|
23
|
-
return <Toolbox {...props} classNames='
|
|
23
|
+
return <Toolbox {...props} classNames='h-[15rem] w-[30rem] py-1 rounded-xs border border-separator' />;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const meta = {
|
|
27
|
-
title: 'plugins/plugin-assistant/Toolbox',
|
|
27
|
+
title: 'plugins/plugin-assistant/components/Toolbox',
|
|
28
28
|
component: Toolbox as any,
|
|
29
29
|
render: DefaultStory,
|
|
30
30
|
decorators: [
|
|
31
|
-
withTheme,
|
|
32
31
|
withPluginManager({
|
|
33
32
|
plugins: [
|
|
33
|
+
...corePlugins(),
|
|
34
34
|
ClientPlugin({
|
|
35
|
-
onClientInitialized:
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
onClientInitialized: ({ client }) =>
|
|
36
|
+
Effect.gen(function* () {
|
|
37
|
+
yield* initializeIdentity(client);
|
|
38
|
+
}),
|
|
38
39
|
}),
|
|
39
|
-
SpacePlugin({}),
|
|
40
|
-
SettingsPlugin(),
|
|
41
|
-
IntentPlugin(),
|
|
42
40
|
ChessPlugin(),
|
|
43
41
|
MapPlugin(),
|
|
44
42
|
TablePlugin(),
|