@dxos/plugin-assistant 0.9.1-main.c7dcc2e112 → 0.9.1-staging.ee54ba693a
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/PLUGIN.mdl +18 -24
- package/dist/lib/neutral/{AgentArticle-2BEPWUMN.mjs → AgentArticle-GV6EEW3I.mjs} +1 -2
- package/dist/lib/neutral/AgentArticle-GV6EEW3I.mjs.map +7 -0
- package/dist/lib/neutral/AssistantPlugin.mjs +1 -1
- package/dist/lib/neutral/AssistantPlugin.node.mjs +6 -6
- package/dist/lib/neutral/AssistantPlugin.node.mjs.map +3 -3
- package/dist/lib/neutral/AssistantPlugin.workerd.mjs +7 -34
- package/dist/lib/neutral/AssistantPlugin.workerd.mjs.map +4 -4
- package/dist/lib/neutral/AssistantSettings-3N5M5VCN.mjs +302 -0
- package/dist/lib/neutral/AssistantSettings-3N5M5VCN.mjs.map +7 -0
- package/dist/lib/neutral/{ChatArticle-KT46SUFU.mjs → ChatArticle-OO7GGEFW.mjs} +2 -2
- package/dist/lib/neutral/{ChatCompanion-YHC43RYQ.mjs → ChatCompanion-GIFJRY6I.mjs} +27 -27
- package/dist/lib/neutral/ChatCompanion-GIFJRY6I.mjs.map +7 -0
- package/dist/lib/neutral/{ChatDialog-YZDZLIQA.mjs → ChatDialog-5MXN4MXS.mjs} +5 -5
- package/dist/lib/neutral/ChatDialog-5MXN4MXS.mjs.map +7 -0
- package/dist/lib/neutral/IntegrationPrompt-2HJQFYJE.mjs +72 -0
- package/dist/lib/neutral/IntegrationPrompt-2HJQFYJE.mjs.map +7 -0
- package/dist/lib/neutral/{SpaceHomePrompt-HTWQKLGI.mjs → SpaceHomePrompt-ISAB76LD.mjs} +8 -7
- package/dist/lib/neutral/SpaceHomePrompt-ISAB76LD.mjs.map +7 -0
- package/dist/lib/neutral/SpaceHomeSuggestions-IDH77QQR.mjs +63 -0
- package/dist/lib/neutral/SpaceHomeSuggestions-IDH77QQR.mjs.map +7 -0
- package/dist/lib/neutral/{TracePanel-T552TAOH.mjs → TracePanel-JKNWADJ4.mjs} +2 -2
- package/dist/lib/neutral/{TriggerStatus-RBOHHDOK.mjs → TriggerStatus-FURRBHYA.mjs} +7 -5
- package/dist/lib/neutral/TriggerStatus-FURRBHYA.mjs.map +7 -0
- package/dist/lib/neutral/{agent-hydrator-PJBYVMBW.mjs → agent-hydrator-OBO3RHLO.mjs} +3 -4
- package/dist/lib/neutral/agent-hydrator-OBO3RHLO.mjs.map +7 -0
- package/dist/lib/neutral/{agent-service-WV5CSHAG.mjs → agent-service-XFJ4VQMT.mjs} +7 -9
- package/dist/lib/neutral/agent-service-XFJ4VQMT.mjs.map +7 -0
- package/dist/lib/neutral/ai-context-LIKJYMIN.mjs +14 -0
- package/dist/lib/neutral/ai-context-LIKJYMIN.mjs.map +7 -0
- package/dist/lib/neutral/{ai-service-AADUIKBY.mjs → ai-service-DM6YXWUC.mjs} +9 -5
- package/dist/lib/neutral/ai-service-DM6YXWUC.mjs.map +7 -0
- package/dist/lib/neutral/{app-graph-builder-PTSRZXRN.mjs → app-graph-builder-OPVOEQY7.mjs} +36 -19
- package/dist/lib/neutral/app-graph-builder-OPVOEQY7.mjs.map +7 -0
- package/dist/lib/neutral/automation-templates-MADJLXGJ.mjs +97 -0
- package/dist/lib/neutral/automation-templates-MADJLXGJ.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +20 -18
- package/dist/lib/neutral/capabilities/index.mjs.map +3 -3
- package/dist/lib/neutral/{chunk-KLYLW4WH.mjs → chunk-5IHQ52KJ.mjs} +1 -1
- package/dist/lib/neutral/chunk-5IHQ52KJ.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-5KB2WRI2.mjs → chunk-6Q4OBGIK.mjs} +83 -55
- package/dist/lib/neutral/chunk-6Q4OBGIK.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-54W7N6M6.mjs → chunk-BXI2R4OO.mjs} +49 -84
- package/dist/lib/neutral/chunk-BXI2R4OO.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-5H6UJHLF.mjs → chunk-CMPLPDYE.mjs} +12 -12
- package/dist/lib/neutral/chunk-CMPLPDYE.mjs.map +7 -0
- package/dist/lib/neutral/chunk-GPHT3HYS.mjs +8 -0
- package/dist/lib/neutral/{chunk-7FQT4XMI.mjs.map → chunk-GPHT3HYS.mjs.map} +2 -2
- package/dist/lib/neutral/{markdown-extension-IJ5RQMQ4.mjs → chunk-HKLSFB5I.mjs} +2 -38
- package/dist/lib/neutral/chunk-HKLSFB5I.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-ZNDQVYUN.mjs → chunk-L7AR4VTA.mjs} +3 -3
- package/dist/lib/neutral/{chunk-ZNDQVYUN.mjs.map → chunk-L7AR4VTA.mjs.map} +1 -1
- package/dist/lib/neutral/chunk-LS72HWMM.mjs +42 -0
- package/dist/lib/neutral/chunk-LS72HWMM.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-35EL65O4.mjs → chunk-OZWZGIV2.mjs} +4 -2
- package/dist/lib/neutral/{chunk-35EL65O4.mjs.map → chunk-OZWZGIV2.mjs.map} +3 -3
- package/dist/lib/neutral/{toolkit-GVWXPDLJ.mjs → chunk-QOKLFHUS.mjs} +3 -4
- package/dist/lib/neutral/{toolkit-GVWXPDLJ.mjs.map → chunk-QOKLFHUS.mjs.map} +1 -1
- package/dist/lib/neutral/{chunk-5LKNH7FD.mjs → chunk-SCTHQVIJ.mjs} +8 -5
- package/dist/lib/neutral/{chunk-5LKNH7FD.mjs.map → chunk-SCTHQVIJ.mjs.map} +3 -3
- package/dist/lib/neutral/chunk-U4LTLBAX.mjs +56 -0
- package/dist/lib/neutral/chunk-U4LTLBAX.mjs.map +7 -0
- package/dist/lib/neutral/{chunk-H77JTXAN.mjs → chunk-UPKFUZ6V.mjs} +7 -10
- package/dist/lib/neutral/chunk-UPKFUZ6V.mjs.map +7 -0
- package/dist/lib/neutral/{operation-handler-SF36MOB5.mjs → chunk-V2Y4XE3O.mjs} +3 -4
- package/dist/lib/neutral/{operation-handler-SF36MOB5.mjs.map → chunk-V2Y4XE3O.mjs.map} +1 -1
- package/dist/lib/neutral/chunk-VTK5R4H3.mjs +9 -0
- package/dist/lib/neutral/chunk-VTK5R4H3.mjs.map +7 -0
- package/dist/lib/neutral/chunk-XVGEJWJX.mjs +133 -0
- package/dist/lib/neutral/chunk-XVGEJWJX.mjs.map +7 -0
- package/dist/lib/neutral/{companion-chat-provisioner-YZZ73P6E.mjs → companion-chat-provisioner-IQV5VIVE.mjs} +14 -8
- package/dist/lib/neutral/companion-chat-provisioner-IQV5VIVE.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +509 -579
- package/dist/lib/neutral/components/index.mjs.map +4 -4
- package/dist/lib/neutral/{integration-provider-RBD3AFJU.mjs → connector-ITLLTBPZ.mjs} +13 -14
- package/dist/lib/neutral/connector-ITLLTBPZ.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +12 -14
- package/dist/lib/neutral/containers/index.mjs.map +3 -3
- package/dist/lib/neutral/{create-chat-Z3FNA6OJ.mjs → create-chat-YGVZZYGP.mjs} +18 -16
- package/dist/lib/neutral/create-chat-YGVZZYGP.mjs.map +7 -0
- package/dist/lib/neutral/{create-object-BJUDDKQQ.mjs → create-object-5PAEJ6KM.mjs} +11 -27
- package/dist/lib/neutral/create-object-5PAEJ6KM.mjs.map +7 -0
- package/dist/lib/neutral/{edge-model-resolver-BBVOJBGJ.mjs → edge-model-resolver-WDJWDZTT.mjs} +2 -2
- package/dist/lib/neutral/execution-graph/index.mjs +182 -64
- package/dist/lib/neutral/execution-graph/index.mjs.map +3 -3
- package/dist/lib/neutral/extensions/index.mjs +8 -0
- package/dist/lib/neutral/{fork-chat-UYXYT6BT.mjs → fork-chat-RMAAYYQF.mjs} +15 -18
- package/dist/lib/neutral/fork-chat-RMAAYYQF.mjs.map +7 -0
- package/dist/lib/neutral/generate-home-suggestions-6MM2XWPV.mjs +93 -0
- package/dist/lib/neutral/generate-home-suggestions-6MM2XWPV.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +195 -105
- package/dist/lib/neutral/hooks/index.mjs.map +4 -4
- package/dist/lib/neutral/index.mjs +14 -10
- package/dist/lib/neutral/markdown-extension-R4TKDTIF.mjs +41 -0
- package/dist/lib/neutral/markdown-extension-R4TKDTIF.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/meta.mjs +1 -1
- package/dist/lib/neutral/navigation-resolver-PYGP2DAW.mjs +18 -0
- package/dist/lib/neutral/navigation-resolver-PYGP2DAW.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-2LEN45GP.mjs +8 -0
- package/dist/lib/neutral/operation-handler-2LEN45GP.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +1 -1
- package/dist/lib/neutral/plugin.mjs +2 -2
- package/dist/lib/neutral/plugin.workerd.mjs +13 -0
- package/dist/lib/neutral/plugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/{react-surface-ES7UHZ65.mjs → react-surface-HEJEK44F.mjs} +20 -35
- package/dist/lib/neutral/react-surface-HEJEK44F.mjs.map +7 -0
- package/dist/lib/neutral/resolve-navigation-targets-PBQ3OLUE.mjs +28 -0
- package/dist/lib/neutral/resolve-navigation-targets-PBQ3OLUE.mjs.map +7 -0
- package/dist/lib/neutral/{run-prompt-in-new-chat-NIAGCKQV.mjs → run-prompt-in-new-chat-RNUJE2FM.mjs} +28 -31
- package/dist/lib/neutral/run-prompt-in-new-chat-RNUJE2FM.mjs.map +7 -0
- package/dist/lib/neutral/skill-definition-553MQRTR.mjs +8 -0
- package/dist/lib/neutral/skill-definition-553MQRTR.mjs.map +7 -0
- package/dist/lib/neutral/skills/index.mjs +8 -0
- package/dist/lib/neutral/skills/index.mjs.map +7 -0
- package/dist/lib/neutral/{state-XO2UYSSG.mjs → state-4LGAKSSD.mjs} +8 -2
- package/dist/lib/neutral/{state-XO2UYSSG.mjs.map → state-4LGAKSSD.mjs.map} +3 -3
- package/dist/lib/neutral/testing.mjs +1 -1
- package/dist/lib/neutral/toolkit-ETWLG5NT.mjs +8 -0
- package/dist/lib/neutral/toolkit-ETWLG5NT.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +64 -33
- package/dist/lib/neutral/translations.mjs.map +3 -3
- package/dist/lib/neutral/types/index.mjs +5 -1
- package/dist/lib/neutral/{update-chat-name-Y7JWIP64.mjs → update-chat-name-IJJELRR6.mjs} +3 -3
- package/dist/lib/neutral/{update-chat-name-Y7JWIP64.mjs.map → update-chat-name-IJJELRR6.mjs.map} +2 -2
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/AssistantPlugin.workerd.d.ts.map +1 -1
- package/dist/types/src/capabilities/agent-hydrator.d.ts +1 -1
- package/dist/types/src/capabilities/agent-service.d.ts +1 -2
- package/dist/types/src/capabilities/agent-service.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-context.d.ts +1 -2
- package/dist/types/src/capabilities/ai-context.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -3
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/automation-templates.d.ts +1 -2
- package/dist/types/src/capabilities/automation-templates.d.ts.map +1 -1
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts +1 -1
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts.map +1 -1
- package/dist/types/src/capabilities/{integration-provider.d.ts → connector.d.ts} +2 -2
- package/dist/types/src/capabilities/connector.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.d.ts +1 -27
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +3 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown-extension.d.ts +1 -1
- package/dist/types/src/capabilities/migrations.d.ts +1 -2
- package/dist/types/src/capabilities/migrations.d.ts.map +1 -1
- package/dist/types/src/capabilities/navigation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/navigation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -2
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/skill-definition.d.ts +5 -0
- package/dist/types/src/capabilities/skill-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +1 -17
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts +1 -2
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
- package/dist/types/src/components/AgentProperties/AgentProperties.stories.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +4 -5
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +0 -4
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts +2 -2
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts +2 -2
- package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatPrompt.d.ts +5 -5
- package/dist/types/src/components/ChatPrompt/ChatPrompt.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/useChatVoiceInput.d.ts +9 -0
- package/dist/types/src/components/ChatPrompt/useChatVoiceInput.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +4 -4
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts +2 -2
- package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.stories.d.ts +2 -2
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/SurfaceWidget.d.ts +11 -0
- package/dist/types/src/components/ChatThread/widgets/SurfaceWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/index.d.ts +1 -0
- package/dist/types/src/components/ChatThread/widgets/index.d.ts.map +1 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts.map +1 -1
- package/dist/types/src/components/TaskList/TaskList.stories.d.ts +2 -2
- package/dist/types/src/components/TaskList/TaskList.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +3 -3
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +1 -1
- package/dist/types/src/constants.d.ts.map +1 -1
- package/dist/types/src/containers/AgentArticle/AgentArticle.stories.d.ts +2 -2
- package/dist/types/src/containers/AgentArticle/AgentArticle.stories.d.ts.map +1 -1
- package/dist/types/src/{components → containers}/AssistantSettings/AssistantSettings.d.ts +1 -1
- package/dist/types/src/containers/AssistantSettings/AssistantSettings.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/AssistantSettings/AssistantSettings.stories.d.ts.map +1 -1
- package/dist/types/src/containers/AssistantSettings/OllamaModels.d.ts +12 -0
- package/dist/types/src/containers/AssistantSettings/OllamaModels.d.ts.map +1 -0
- package/dist/types/src/{components/TemplateEditor/TemplateEditor.stories.d.ts → containers/AssistantSettings/OllamaModels.stories.d.ts} +9 -7
- package/dist/types/src/containers/AssistantSettings/OllamaModels.stories.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/AssistantSettings/index.d.ts.map +1 -1
- package/dist/types/src/containers/ChatArticle/ChatArticle.d.ts +2 -9
- package/dist/types/src/containers/ChatArticle/ChatArticle.d.ts.map +1 -1
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts +3 -10
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts.map +1 -1
- package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/containers/IntegrationPrompt/IntegrationPrompt.d.ts +13 -0
- package/dist/types/src/containers/IntegrationPrompt/IntegrationPrompt.d.ts.map +1 -0
- package/dist/types/src/containers/IntegrationPrompt/index.d.ts +2 -0
- package/dist/types/src/{components/RoutineProperties → containers/IntegrationPrompt}/index.d.ts.map +1 -1
- package/dist/types/src/containers/SpaceHomePrompt/SpaceHomePrompt.d.ts.map +1 -1
- package/dist/types/src/containers/SpaceHomeSuggestions/SpaceHomeSuggestions.d.ts +1 -1
- package/dist/types/src/containers/SpaceHomeSuggestions/SpaceHomeSuggestions.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/testing/simulated-agent.d.ts +1 -1
- package/dist/types/src/containers/TracePanel/testing/simulated-agent.d.ts.map +1 -1
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +2 -3
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/execution-graph/execution-graph.d.ts +2 -1
- package/dist/types/src/execution-graph/execution-graph.d.ts.map +1 -1
- package/dist/types/src/execution-graph/index.d.ts +3 -3
- package/dist/types/src/execution-graph/index.d.ts.map +1 -1
- package/dist/types/src/execution-graph/span-tree.d.ts +13 -0
- package/dist/types/src/execution-graph/span-tree.d.ts.map +1 -1
- package/dist/types/src/extensions/index.d.ts +1 -1
- package/dist/types/src/extensions/index.d.ts.map +1 -1
- package/dist/types/src/extensions/prompt-extension.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +2 -2
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
- package/dist/types/src/hooks/useHomeSuggestions.d.ts +8 -0
- package/dist/types/src/hooks/useHomeSuggestions.d.ts.map +1 -0
- package/dist/types/src/hooks/usePresets.d.ts +6 -2
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -1
- package/dist/types/src/hooks/useSkillRegistry.d.ts +21 -0
- package/dist/types/src/hooks/useSkillRegistry.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +4 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create-chat.d.ts.map +1 -1
- package/dist/types/src/operations/fork-chat.d.ts.map +1 -1
- package/dist/types/src/operations/generate-home-suggestions.d.ts +5 -0
- package/dist/types/src/operations/generate-home-suggestions.d.ts.map +1 -0
- package/dist/types/src/operations/generate-home-suggestions.test.d.ts +2 -0
- package/dist/types/src/operations/generate-home-suggestions.test.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/resolve-navigation-targets.d.ts +3 -15
- package/dist/types/src/operations/resolve-navigation-targets.d.ts.map +1 -1
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts +2 -2
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts.map +1 -1
- package/dist/types/src/paths.d.ts +1 -1
- package/dist/types/src/paths.d.ts.map +1 -1
- package/dist/types/src/plugin.workerd.d.ts +2 -0
- package/dist/types/src/plugin.workerd.d.ts.map +1 -0
- package/dist/types/src/processor/presets.d.ts +20 -9
- package/dist/types/src/processor/presets.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +10 -209
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/skills/assistant/index.d.ts +2 -0
- package/dist/types/src/skills/assistant/index.d.ts.map +1 -0
- package/dist/types/src/skills/assistant/skill.d.ts +4 -0
- package/dist/types/src/skills/assistant/skill.d.ts.map +1 -0
- package/dist/types/src/skills/assistant/skill.node.test.d.ts +2 -0
- package/dist/types/src/skills/assistant/skill.node.test.d.ts.map +1 -0
- package/dist/types/src/skills/index.d.ts.map +1 -0
- package/dist/types/src/templates/daily-digest.d.ts +2 -2
- package/dist/types/src/templates/daily-digest.d.ts.map +1 -1
- package/dist/types/src/templates/index.d.ts +3 -3
- package/dist/types/src/templates/index.d.ts.map +1 -1
- package/dist/types/src/templates/research-brief.d.ts +2 -2
- package/dist/types/src/templates/research-brief.d.ts.map +1 -1
- package/dist/types/src/templates/routine-templates.test.d.ts +2 -0
- package/dist/types/src/templates/routine-templates.test.d.ts.map +1 -0
- package/dist/types/src/templates/scaffold.d.ts +9 -9
- package/dist/types/src/templates/scaffold.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +1 -1
- package/dist/types/src/testing/test-generator.d.ts.map +1 -1
- package/dist/types/src/testing/test-sequence.d.ts +1 -8
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/testing/test-trace.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +5 -12
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantCapabilities.d.ts +21 -0
- package/dist/types/src/types/AssistantCapabilities.d.ts.map +1 -1
- package/dist/types/src/types/AssistantOperation.d.ts +17 -110
- package/dist/types/src/types/AssistantOperation.d.ts.map +1 -1
- package/dist/types/src/types/ChatSurface.d.ts +12 -0
- package/dist/types/src/types/ChatSurface.d.ts.map +1 -0
- package/dist/types/src/types/Ollama.d.ts +44 -0
- package/dist/types/src/types/Ollama.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +5 -4
- package/dist/types/src/types/Settings.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +4 -3
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/src/util/suggestions.d.ts +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dx.config.ts +2 -2
- package/package.json +102 -90
- package/src/AssistantPlugin.conversations.json +1 -1
- package/src/AssistantPlugin.node.ts +5 -5
- package/src/AssistantPlugin.test.ts +26 -40
- package/src/AssistantPlugin.ts +12 -10
- package/src/AssistantPlugin.workerd.ts +15 -6
- package/src/capabilities/agent-hydrator.ts +1 -2
- package/src/capabilities/agent-service.ts +5 -7
- package/src/capabilities/ai-context.ts +7 -32
- package/src/capabilities/ai-service.ts +3 -2
- package/src/capabilities/app-graph-builder.ts +38 -18
- package/src/capabilities/automation-templates.ts +3 -3
- package/src/capabilities/companion-chat-provisioner.ts +22 -6
- package/src/capabilities/{integration-provider.ts → connector.ts} +7 -12
- package/src/capabilities/create-object.ts +9 -26
- package/src/capabilities/index.ts +3 -5
- package/src/capabilities/markdown-extension.ts +2 -3
- package/src/capabilities/navigation-resolver.ts +20 -0
- package/src/capabilities/react-surface.tsx +21 -33
- package/src/capabilities/skill-definition.ts +72 -0
- package/src/capabilities/state.ts +7 -0
- package/src/components/AgentProperties/AgentProperties.stories.tsx +1 -2
- package/src/components/Chat/Chat.tsx +28 -10
- package/src/components/Chat/events.ts +0 -6
- package/src/components/ChatPrompt/ChatActions.tsx +181 -18
- package/src/components/ChatPrompt/ChatOptions.stories.tsx +3 -3
- package/src/components/ChatPrompt/ChatOptions.tsx +17 -21
- package/src/components/ChatPrompt/ChatPrompt.tsx +30 -46
- package/src/components/ChatPrompt/useChatVoiceInput.ts +103 -0
- package/src/components/ChatThread/ChatThread.stories.tsx +7 -16
- package/src/components/ChatThread/MarkdownStream.stories.tsx +3 -3
- package/src/components/ChatThread/registry.tsx +43 -17
- package/src/components/ChatThread/widgets/ReasoningWidget.stories.tsx +2 -2
- package/src/components/ChatThread/widgets/SurfaceWidget.tsx +41 -0
- package/src/components/ChatThread/widgets/index.ts +1 -0
- package/src/components/ProcessTree/ProcessTree.tsx +2 -10
- package/src/components/TaskList/TaskList.stories.tsx +2 -2
- package/src/components/TaskList/TaskList.tsx +2 -2
- package/src/components/Toolbox/Toolbox.tsx +11 -11
- package/src/components/index.ts +0 -6
- package/src/constants.ts +1 -1
- package/src/containers/AgentArticle/AgentArticle.stories.tsx +8 -9
- package/src/containers/AgentArticle/AgentArticle.tsx +1 -1
- package/src/{components → containers}/AssistantSettings/AssistantSettings.stories.tsx +3 -2
- package/src/containers/AssistantSettings/AssistantSettings.tsx +90 -0
- package/src/containers/AssistantSettings/OllamaModels.stories.tsx +108 -0
- package/src/containers/AssistantSettings/OllamaModels.tsx +255 -0
- package/src/containers/ChatArticle/ChatArticle.stories.tsx +3 -3
- package/src/containers/ChatArticle/ChatArticle.tsx +8 -19
- package/src/containers/ChatCompanion/ChatCompanion.tsx +26 -26
- package/src/containers/ChatDialog/ChatDialog.tsx +5 -4
- package/src/containers/IntegrationPrompt/IntegrationPrompt.tsx +79 -0
- package/src/containers/IntegrationPrompt/index.ts +5 -0
- package/src/containers/SpaceHomePrompt/SpaceHomePrompt.tsx +8 -6
- package/src/containers/SpaceHomeSuggestions/SpaceHomeSuggestions.tsx +46 -32
- package/src/containers/TracePanel/TracePanel.stories.tsx +89 -47
- package/src/containers/TracePanel/TracePanel.tsx +13 -8
- package/src/containers/TracePanel/dxn-extractor.test.ts +2 -2
- package/src/containers/TriggerStatus/TriggerStatus.tsx +8 -4
- package/src/containers/index.ts +2 -3
- package/src/execution-graph/SPEC.md +1 -1
- package/src/execution-graph/execution-graph.test.ts +213 -25
- package/src/execution-graph/execution-graph.ts +209 -72
- package/src/execution-graph/index.ts +8 -8
- package/src/execution-graph/span-tree.test.ts +33 -1
- package/src/execution-graph/span-tree.ts +43 -2
- package/src/execution-graph/sub-agent-delegation.test.ts +19 -19
- package/src/extensions/index.ts +1 -1
- package/src/extensions/prompt-extension.ts +1 -1
- package/src/feed-logger.ts +4 -4
- package/src/functions/services.test.ts +4 -4
- package/src/hooks/index.ts +2 -2
- package/src/hooks/useChatProcessor.ts +12 -16
- package/src/hooks/useContextBinder.ts +2 -4
- package/src/hooks/useDebug.ts +2 -2
- package/src/hooks/useHomeSuggestions.ts +55 -0
- package/src/hooks/usePresets.ts +80 -11
- package/src/hooks/useProcessEphemeralStatus.ts +1 -1
- package/src/hooks/useReferencesProvider.ts +1 -1
- package/src/hooks/useSkillRegistry.ts +125 -0
- package/src/index.ts +1 -1
- package/src/operations/create-chat.ts +11 -12
- package/src/operations/fork-chat.ts +14 -19
- package/src/operations/generate-home-suggestions.test.ts +103 -0
- package/src/operations/generate-home-suggestions.ts +116 -0
- package/src/operations/index.ts +1 -0
- package/src/operations/prompt.node.test.ts +14 -17
- package/src/operations/resolve-navigation-targets.ts +32 -19
- package/src/operations/run-prompt-in-new-chat.ts +30 -33
- package/src/operations/update-chat-name.ts +2 -2
- package/src/paths.ts +4 -2
- package/src/plugin.workerd.ts +5 -0
- package/src/processor/presets.ts +38 -61
- package/src/processor/processor.node.test.ts +1 -1
- package/src/processor/processor.ts +34 -20
- package/src/skills/assistant/index.ts +5 -0
- package/src/{blueprints/assistant/blueprint.node.test.ts → skills/assistant/skill.node.test.ts} +8 -8
- package/src/{blueprints/assistant/blueprint.ts → skills/assistant/skill.ts} +9 -9
- package/src/templates/daily-digest.ts +10 -12
- package/src/templates/index.ts +3 -3
- package/src/templates/research-brief.ts +15 -13
- package/src/templates/routine-templates.test.ts +55 -0
- package/src/templates/scaffold.ts +22 -57
- package/src/testing/data/trace-timeline-multiple.dx.json +1 -1
- package/src/testing/data/trace-timeline-remote.dx.json +1 -1
- package/src/testing/data/trace-timeline.dx.json +3430 -1092
- package/src/testing/test-generator.test.ts +26 -22
- package/src/testing/test-generator.ts +4 -8
- package/src/testing/test-trace.ts +2 -1
- package/src/testing/trace-timeline.node.test.ts +14 -14
- package/src/translations.ts +68 -33
- package/src/types/Assistant.ts +3 -1
- package/src/types/AssistantCapabilities.ts +21 -0
- package/src/types/AssistantOperation.ts +21 -32
- package/src/types/ChatSurface.ts +16 -0
- package/src/types/Ollama.ts +59 -0
- package/src/types/Settings.ts +12 -10
- package/src/types/index.ts +3 -0
- package/src/types/service.ts +14 -14
- package/src/util/suggestions.ts +1 -1
- package/dist/lib/neutral/AgentArticle-2BEPWUMN.mjs.map +0 -7
- package/dist/lib/neutral/AssistantSettings-7ALY4BMS.mjs +0 -40
- package/dist/lib/neutral/AssistantSettings-7ALY4BMS.mjs.map +0 -7
- package/dist/lib/neutral/BlueprintArticle-ZBOZNZM7.mjs +0 -27
- package/dist/lib/neutral/BlueprintArticle-ZBOZNZM7.mjs.map +0 -7
- package/dist/lib/neutral/ChatCompanion-YHC43RYQ.mjs.map +0 -7
- package/dist/lib/neutral/ChatDialog-YZDZLIQA.mjs.map +0 -7
- package/dist/lib/neutral/RoutineArticle-FK5BXQN5.mjs +0 -119
- package/dist/lib/neutral/RoutineArticle-FK5BXQN5.mjs.map +0 -7
- package/dist/lib/neutral/RoutineList-SO5ETHNT.mjs +0 -48
- package/dist/lib/neutral/RoutineList-SO5ETHNT.mjs.map +0 -7
- package/dist/lib/neutral/RoutineProperties-FISLMW2R.mjs +0 -17
- package/dist/lib/neutral/RoutineProperties-FISLMW2R.mjs.map +0 -7
- package/dist/lib/neutral/SpaceHomePrompt-HTWQKLGI.mjs.map +0 -7
- package/dist/lib/neutral/SpaceHomeSuggestions-6G4E7GNJ.mjs +0 -50
- package/dist/lib/neutral/SpaceHomeSuggestions-6G4E7GNJ.mjs.map +0 -7
- package/dist/lib/neutral/TriggerStatus-RBOHHDOK.mjs.map +0 -7
- package/dist/lib/neutral/agent-hydrator-PJBYVMBW.mjs.map +0 -7
- package/dist/lib/neutral/agent-service-WV5CSHAG.mjs.map +0 -7
- package/dist/lib/neutral/ai-context-7WRHWYXY.mjs +0 -42
- package/dist/lib/neutral/ai-context-7WRHWYXY.mjs.map +0 -7
- package/dist/lib/neutral/ai-service-AADUIKBY.mjs.map +0 -7
- package/dist/lib/neutral/app-graph-builder-PTSRZXRN.mjs.map +0 -7
- package/dist/lib/neutral/automation-templates-M2XQWGR6.mjs +0 -115
- package/dist/lib/neutral/automation-templates-M2XQWGR6.mjs.map +0 -7
- package/dist/lib/neutral/blueprint-definition-2XPYI35X.mjs +0 -40
- package/dist/lib/neutral/blueprint-definition-2XPYI35X.mjs.map +0 -7
- package/dist/lib/neutral/blueprints/index.mjs +0 -8
- package/dist/lib/neutral/chunk-54W7N6M6.mjs.map +0 -7
- package/dist/lib/neutral/chunk-5H6UJHLF.mjs.map +0 -7
- package/dist/lib/neutral/chunk-5KB2WRI2.mjs.map +0 -7
- package/dist/lib/neutral/chunk-7FQT4XMI.mjs +0 -8
- package/dist/lib/neutral/chunk-H77JTXAN.mjs.map +0 -7
- package/dist/lib/neutral/chunk-IQZJ5TTM.mjs +0 -130
- package/dist/lib/neutral/chunk-IQZJ5TTM.mjs.map +0 -7
- package/dist/lib/neutral/chunk-KLYLW4WH.mjs.map +0 -7
- package/dist/lib/neutral/companion-chat-provisioner-YZZ73P6E.mjs.map +0 -7
- package/dist/lib/neutral/create-chat-Z3FNA6OJ.mjs.map +0 -7
- package/dist/lib/neutral/create-object-BJUDDKQQ.mjs.map +0 -7
- package/dist/lib/neutral/fork-chat-UYXYT6BT.mjs.map +0 -7
- package/dist/lib/neutral/integration-provider-RBD3AFJU.mjs.map +0 -7
- package/dist/lib/neutral/markdown-extension-IJ5RQMQ4.mjs.map +0 -7
- package/dist/lib/neutral/react-surface-ES7UHZ65.mjs.map +0 -7
- package/dist/lib/neutral/resolve-navigation-targets-ZHIMMH7L.mjs +0 -22
- package/dist/lib/neutral/resolve-navigation-targets-ZHIMMH7L.mjs.map +0 -7
- package/dist/lib/neutral/run-prompt-in-new-chat-NIAGCKQV.mjs.map +0 -7
- package/dist/types/src/blueprints/assistant/blueprint.d.ts +0 -4
- package/dist/types/src/blueprints/assistant/blueprint.d.ts.map +0 -1
- package/dist/types/src/blueprints/assistant/blueprint.node.test.d.ts +0 -2
- package/dist/types/src/blueprints/assistant/blueprint.node.test.d.ts.map +0 -1
- package/dist/types/src/blueprints/assistant/index.d.ts +0 -2
- package/dist/types/src/blueprints/assistant/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -5
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/integration-provider.d.ts.map +0 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +0 -1
- package/dist/types/src/components/RoutineProperties/RoutineProperties.d.ts +0 -7
- package/dist/types/src/components/RoutineProperties/RoutineProperties.d.ts.map +0 -1
- package/dist/types/src/components/RoutineProperties/RoutineProperties.stories.d.ts +0 -15
- package/dist/types/src/components/RoutineProperties/RoutineProperties.stories.d.ts.map +0 -1
- package/dist/types/src/components/RoutineProperties/index.d.ts +0 -2
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +0 -13
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +0 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +0 -21
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +0 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +0 -16
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +0 -1
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts +0 -12
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +0 -1
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts +0 -3
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts.map +0 -1
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts +0 -8
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +0 -1
- package/dist/types/src/components/TemplateEditor/index.d.ts +0 -2
- package/dist/types/src/components/TemplateEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/TemplateEditor/types.d.ts +0 -18
- package/dist/types/src/components/TemplateEditor/types.d.ts.map +0 -1
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts +0 -6
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts.map +0 -1
- package/dist/types/src/containers/BlueprintArticle/index.d.ts +0 -2
- package/dist/types/src/containers/BlueprintArticle/index.d.ts.map +0 -1
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts +0 -6
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts.map +0 -1
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.stories.d.ts +0 -15
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.stories.d.ts.map +0 -1
- package/dist/types/src/containers/RoutineArticle/index.d.ts +0 -2
- package/dist/types/src/containers/RoutineArticle/index.d.ts.map +0 -1
- package/dist/types/src/containers/RoutineList/RoutineList.d.ts +0 -6
- package/dist/types/src/containers/RoutineList/RoutineList.d.ts.map +0 -1
- package/dist/types/src/containers/RoutineList/RoutineList.stories.d.ts +0 -21
- package/dist/types/src/containers/RoutineList/RoutineList.stories.d.ts.map +0 -1
- package/dist/types/src/containers/RoutineList/index.d.ts +0 -2
- package/dist/types/src/containers/RoutineList/index.d.ts.map +0 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +0 -66
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +0 -1
- package/dist/types/src/hooks/useOnline.d.ts +0 -3
- package/dist/types/src/hooks/useOnline.d.ts.map +0 -1
- package/dist/types/src/templates/automation-templates.test.d.ts +0 -2
- package/dist/types/src/templates/automation-templates.test.d.ts.map +0 -1
- package/src/blueprints/assistant/index.ts +0 -5
- package/src/capabilities/blueprint-definition.ts +0 -67
- package/src/components/AssistantSettings/AssistantSettings.tsx +0 -43
- package/src/components/RoutineProperties/RoutineProperties.stories.tsx +0 -59
- package/src/components/RoutineProperties/RoutineProperties.tsx +0 -23
- package/src/components/RoutineProperties/index.ts +0 -5
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +0 -95
- package/src/components/TemplateEditor/TemplateEditor.tsx +0 -80
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +0 -76
- package/src/components/TemplateEditor/TemplateForm.tsx +0 -204
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +0 -274
- package/src/components/TemplateEditor/extensions/index.ts +0 -6
- package/src/components/TemplateEditor/extensions/xml-extension.ts +0 -64
- package/src/components/TemplateEditor/index.ts +0 -5
- package/src/components/TemplateEditor/types.tsx +0 -28
- package/src/containers/BlueprintArticle/BlueprintArticle.tsx +0 -29
- package/src/containers/BlueprintArticle/index.ts +0 -5
- package/src/containers/RoutineArticle/RoutineArticle.stories.tsx +0 -75
- package/src/containers/RoutineArticle/RoutineArticle.tsx +0 -109
- package/src/containers/RoutineArticle/index.ts +0 -5
- package/src/containers/RoutineList/RoutineList.stories.tsx +0 -130
- package/src/containers/RoutineList/RoutineList.tsx +0 -50
- package/src/containers/RoutineList/index.ts +0 -5
- package/src/hooks/useBlueprintRegistry.ts +0 -125
- package/src/hooks/useOnline.ts +0 -10
- package/src/templates/automation-templates.test.ts +0 -66
- /package/dist/lib/neutral/{ChatArticle-KT46SUFU.mjs.map → ChatArticle-OO7GGEFW.mjs.map} +0 -0
- /package/dist/lib/neutral/{TracePanel-T552TAOH.mjs.map → TracePanel-JKNWADJ4.mjs.map} +0 -0
- /package/dist/lib/neutral/{edge-model-resolver-BBVOJBGJ.mjs.map → edge-model-resolver-WDJWDZTT.mjs.map} +0 -0
- /package/dist/lib/neutral/{blueprints → extensions}/index.mjs.map +0 -0
- /package/dist/types/src/{components → containers}/AssistantSettings/AssistantSettings.stories.d.ts +0 -0
- /package/dist/types/src/{components → containers}/AssistantSettings/index.d.ts +0 -0
- /package/dist/types/src/{blueprints → skills}/index.d.ts +0 -0
- /package/src/{components → containers}/AssistantSettings/index.ts +0 -0
- /package/src/{blueprints → skills}/index.ts +0 -0
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TracePanel
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-SCTHQVIJ.mjs";
|
|
4
4
|
import {
|
|
5
|
-
AiUsageQuotaError,
|
|
6
5
|
ChatContextProvider,
|
|
7
6
|
useChatContext
|
|
8
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-VTK5R4H3.mjs";
|
|
8
|
+
import {
|
|
9
|
+
AiUsageQuotaError
|
|
10
|
+
} from "../chunk-BXI2R4OO.mjs";
|
|
9
11
|
import "../chunk-J5LGTIGS.mjs";
|
|
10
12
|
|
|
11
|
-
// src/components/index.ts
|
|
12
|
-
import { lazy } from "react";
|
|
13
|
-
|
|
14
13
|
// src/components/AgentProperties/AgentProperties.tsx
|
|
15
14
|
import { Atom } from "@effect-atom/atom";
|
|
16
15
|
import { useAtomValue } from "@effect-atom/atom-react";
|
|
@@ -76,52 +75,164 @@ var AgentProperties = ({ agent }) => {
|
|
|
76
75
|
};
|
|
77
76
|
|
|
78
77
|
// src/components/Chat/Chat.tsx
|
|
78
|
+
import { Atom as Atom2 } from "@effect-atom/atom";
|
|
79
79
|
import { useAtomValue as useAtomValue4 } from "@effect-atom/atom-react";
|
|
80
|
-
import * as
|
|
80
|
+
import * as Array2 from "effect/Array";
|
|
81
81
|
import * as Option3 from "effect/Option";
|
|
82
|
-
import
|
|
83
|
-
import { Agent } from "@dxos/assistant-toolkit";
|
|
82
|
+
import React17, { useCallback as useCallback9, useEffect as useEffect8, useMemo as useMemo10, useRef as useRef5, useState as useState7 } from "react";
|
|
84
83
|
import { Event } from "@dxos/async";
|
|
85
84
|
import { getSpace } from "@dxos/client/echo";
|
|
86
85
|
import { Filter as Filter3, Obj as Obj4, Query } from "@dxos/echo";
|
|
87
|
-
import { useQuery as useQuery3 } from "@dxos/react-client/echo";
|
|
86
|
+
import { useObject as useObject3, useQuery as useQuery3 } from "@dxos/react-client/echo";
|
|
88
87
|
import { useIdentity } from "@dxos/react-client/halo";
|
|
89
|
-
import { Button, Toast, composable as composable2, composableProps as composableProps2, useTranslation as
|
|
88
|
+
import { Button, Toast, composable as composable2, composableProps as composableProps2, useTranslation as useTranslation10 } from "@dxos/react-ui";
|
|
90
89
|
import { Menu } from "@dxos/react-ui-menu";
|
|
91
90
|
import { Message as Message2 } from "@dxos/types";
|
|
92
91
|
import { useChatKeymapExtensions as useChatKeymapExtensions2, useChatToolbarActions, useDebug, useTraceMessages } from "#hooks";
|
|
93
|
-
import { meta as
|
|
92
|
+
import { meta as meta10 } from "#meta";
|
|
94
93
|
|
|
95
94
|
// src/components/ChatPrompt/ChatActions.tsx
|
|
96
|
-
import React2 from "react";
|
|
97
|
-
import {
|
|
95
|
+
import React2, { useCallback as useCallback2, useEffect, useState } from "react";
|
|
96
|
+
import { useOptionalAtomCapabilityState, useOptionalCapabilities } from "@dxos/app-framework/ui";
|
|
97
|
+
import { TranscriptionCapabilities } from "@dxos/plugin-transcription";
|
|
98
|
+
import { DropdownMenu, Icon, IconButton, MicButton, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
98
99
|
import { mx } from "@dxos/ui-theme";
|
|
99
100
|
import { meta as meta2 } from "#meta";
|
|
100
|
-
var ChatActions = ({ classNames, children,
|
|
101
|
+
var ChatActions = ({ classNames, children, docId, microphone, processing, debug, onEvent }) => {
|
|
101
102
|
const { t } = useTranslation2(meta2.profile.key);
|
|
103
|
+
const transcriptionAvailable = useOptionalCapabilities(TranscriptionCapabilities.RecordingSession).length > 0;
|
|
104
|
+
const [session, setSession] = useOptionalAtomCapabilityState(TranscriptionCapabilities.RecordingSession);
|
|
105
|
+
const [settings, setSettings] = useOptionalAtomCapabilityState(TranscriptionCapabilities.Settings);
|
|
106
|
+
const recording = !!session?.recording && session.id === docId;
|
|
107
|
+
const recordMode = settings?.recordMode ?? "toggle";
|
|
108
|
+
const entityExtraction = settings?.entityExtraction !== false;
|
|
109
|
+
const selectedDeviceId = settings?.audioDeviceId ?? "";
|
|
110
|
+
const [devices, setDevices] = useState([]);
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
if (!microphone || !transcriptionAvailable || !navigator.mediaDevices?.enumerateDevices) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
let cancelled = false;
|
|
116
|
+
const refresh = async () => {
|
|
117
|
+
const all = await navigator.mediaDevices.enumerateDevices();
|
|
118
|
+
if (cancelled) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
setDevices(all.filter((device) => device.kind === "audioinput" && device.deviceId).map((device, index) => ({
|
|
122
|
+
deviceId: device.deviceId,
|
|
123
|
+
label: device.label || `Microphone ${index + 1}`
|
|
124
|
+
})));
|
|
125
|
+
};
|
|
126
|
+
void refresh();
|
|
127
|
+
navigator.mediaDevices.addEventListener("devicechange", refresh);
|
|
128
|
+
return () => {
|
|
129
|
+
cancelled = true;
|
|
130
|
+
navigator.mediaDevices.removeEventListener("devicechange", refresh);
|
|
131
|
+
};
|
|
132
|
+
}, [
|
|
133
|
+
microphone,
|
|
134
|
+
transcriptionAvailable
|
|
135
|
+
]);
|
|
136
|
+
const handleToggle = useCallback2(() => {
|
|
137
|
+
if (!docId) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
setSession((current) => current?.recording && current.id === docId ? null : {
|
|
141
|
+
id: docId,
|
|
142
|
+
recording: true
|
|
143
|
+
});
|
|
144
|
+
}, [
|
|
145
|
+
setSession,
|
|
146
|
+
docId
|
|
147
|
+
]);
|
|
148
|
+
const handlePressStart = useCallback2(() => {
|
|
149
|
+
if (!docId) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
setSession(() => ({
|
|
153
|
+
id: docId,
|
|
154
|
+
recording: true
|
|
155
|
+
}));
|
|
156
|
+
}, [
|
|
157
|
+
setSession,
|
|
158
|
+
docId
|
|
159
|
+
]);
|
|
160
|
+
const handlePressEnd = useCallback2(() => {
|
|
161
|
+
setSession((current) => current?.id === docId ? null : current);
|
|
162
|
+
}, [
|
|
163
|
+
setSession,
|
|
164
|
+
docId
|
|
165
|
+
]);
|
|
166
|
+
const handleRecordModeChange = useCallback2((mode) => setSettings((current) => ({
|
|
167
|
+
...current,
|
|
168
|
+
recordMode: mode
|
|
169
|
+
})), [
|
|
170
|
+
setSettings
|
|
171
|
+
]);
|
|
172
|
+
const handleEntityExtractionChange = useCallback2((value2) => setSettings((current) => ({
|
|
173
|
+
...current,
|
|
174
|
+
entityExtraction: value2
|
|
175
|
+
})), [
|
|
176
|
+
setSettings
|
|
177
|
+
]);
|
|
178
|
+
const handleSelectDevice = useCallback2((deviceId) => setSettings((current) => ({
|
|
179
|
+
...current,
|
|
180
|
+
audioDeviceId: deviceId || void 0
|
|
181
|
+
})), [
|
|
182
|
+
setSettings
|
|
183
|
+
]);
|
|
184
|
+
const recordLabel = recording ? t("stop-recording.label") : recordMode === "hold" ? t("hold-to-record.label") : t("start-recording.label");
|
|
102
185
|
return /* @__PURE__ */ React2.createElement("div", {
|
|
103
186
|
className: mx("flex items-center", classNames)
|
|
104
|
-
}, children, microphone && /* @__PURE__ */ React2.createElement(
|
|
105
|
-
|
|
106
|
-
classNames: mx(recording && "bg-primary-500"),
|
|
187
|
+
}, children, microphone && docId && transcriptionAvailable && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(MicButton, {
|
|
188
|
+
iconOnly: true,
|
|
107
189
|
variant: "ghost",
|
|
108
|
-
|
|
190
|
+
label: recordLabel,
|
|
191
|
+
recording,
|
|
192
|
+
mode: recordMode,
|
|
193
|
+
onToggle: handleToggle,
|
|
194
|
+
onPressStart: handlePressStart,
|
|
195
|
+
onPressEnd: handlePressEnd,
|
|
196
|
+
"data-testid": "assistant.record"
|
|
197
|
+
}), /* @__PURE__ */ React2.createElement(DropdownMenu.Root, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Trigger, {
|
|
198
|
+
asChild: true
|
|
199
|
+
}, /* @__PURE__ */ React2.createElement(IconButton, {
|
|
200
|
+
icon: "ph--caret-down--regular",
|
|
109
201
|
iconOnly: true,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
202
|
+
label: t("recording-options.label"),
|
|
203
|
+
variant: "ghost",
|
|
204
|
+
classNames: "w-4",
|
|
205
|
+
"data-testid": "assistant.record.options"
|
|
206
|
+
})), /* @__PURE__ */ React2.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Content, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, null, /* @__PURE__ */ React2.createElement(DropdownMenu.GroupLabel, null, t("record-mode.label")), /* @__PURE__ */ React2.createElement(SettingsSelectableItem, {
|
|
207
|
+
label: t("record-mode.toggle.label"),
|
|
208
|
+
selected: recordMode === "toggle",
|
|
209
|
+
onSelect: () => handleRecordModeChange("toggle")
|
|
210
|
+
}), /* @__PURE__ */ React2.createElement(SettingsSelectableItem, {
|
|
211
|
+
label: t("record-mode.hold.label"),
|
|
212
|
+
selected: recordMode === "hold",
|
|
213
|
+
onSelect: () => handleRecordModeChange("hold")
|
|
214
|
+
}), /* @__PURE__ */ React2.createElement(DropdownMenu.Separator, null), /* @__PURE__ */ React2.createElement(DropdownMenu.GroupLabel, null, t("audio-device.label")), /* @__PURE__ */ React2.createElement(SettingsSelectableItem, {
|
|
215
|
+
label: t("audio-device.default.label"),
|
|
216
|
+
selected: selectedDeviceId === "",
|
|
217
|
+
onSelect: () => handleSelectDevice("")
|
|
218
|
+
}), devices.map((device) => /* @__PURE__ */ React2.createElement(SettingsSelectableItem, {
|
|
219
|
+
key: device.deviceId,
|
|
220
|
+
label: device.label,
|
|
221
|
+
selected: selectedDeviceId === device.deviceId,
|
|
222
|
+
onSelect: () => handleSelectDevice(device.deviceId)
|
|
223
|
+
})), /* @__PURE__ */ React2.createElement(DropdownMenu.Separator, null), /* @__PURE__ */ React2.createElement(DropdownMenu.CheckboxItem, {
|
|
224
|
+
checked: entityExtraction,
|
|
225
|
+
onCheckedChange: handleEntityExtractionChange,
|
|
226
|
+
classNames: "gap-2",
|
|
227
|
+
"data-testid": "assistant.entity-extraction"
|
|
228
|
+
}, /* @__PURE__ */ React2.createElement("span", {
|
|
229
|
+
className: "grow truncate"
|
|
230
|
+
}, t("settings.entity-extraction.label")), /* @__PURE__ */ React2.createElement(DropdownMenu.ItemIndicator, {
|
|
231
|
+
asChild: true
|
|
232
|
+
}, /* @__PURE__ */ React2.createElement(Icon, {
|
|
233
|
+
icon: "ph--check--regular",
|
|
234
|
+
size: 4
|
|
235
|
+
})))), /* @__PURE__ */ React2.createElement(DropdownMenu.Arrow, null))))), debug && /* @__PURE__ */ React2.createElement(IconButton, {
|
|
125
236
|
variant: "ghost",
|
|
126
237
|
icon: "ph--wrench--regular",
|
|
127
238
|
iconOnly: true,
|
|
@@ -142,16 +253,27 @@ var ChatActions = ({ classNames, children, microphone, recording, processing, de
|
|
|
142
253
|
}
|
|
143
254
|
}));
|
|
144
255
|
};
|
|
256
|
+
var SettingsSelectableItem = ({ label, selected, onSelect }) => /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
257
|
+
classNames: "gap-2",
|
|
258
|
+
role: "menuitemradio",
|
|
259
|
+
"aria-checked": selected,
|
|
260
|
+
onSelect
|
|
261
|
+
}, /* @__PURE__ */ React2.createElement("span", {
|
|
262
|
+
className: "grow truncate"
|
|
263
|
+
}, label), selected && /* @__PURE__ */ React2.createElement(Icon, {
|
|
264
|
+
icon: "ph--check--regular",
|
|
265
|
+
size: 4
|
|
266
|
+
}));
|
|
145
267
|
|
|
146
268
|
// src/components/ChatPrompt/ChatMcpErrors.tsx
|
|
147
269
|
import { useAtomValue as useAtomValue2 } from "@effect-atom/atom-react";
|
|
148
|
-
import React3, { useCallback as
|
|
270
|
+
import React3, { useCallback as useCallback3 } from "react";
|
|
149
271
|
import { Message, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
150
272
|
import { meta as meta3 } from "#meta";
|
|
151
273
|
var ChatMcpErrors = ({ classNames, processor }) => {
|
|
152
274
|
const { t } = useTranslation3(meta3.profile.key);
|
|
153
275
|
const errors = useAtomValue2(processor.mcpErrors);
|
|
154
|
-
const handleDismiss =
|
|
276
|
+
const handleDismiss = useCallback3(() => {
|
|
155
277
|
processor.dismissMcpErrors();
|
|
156
278
|
}, [
|
|
157
279
|
processor
|
|
@@ -180,7 +302,7 @@ var ChatMcpErrors = ({ classNames, processor }) => {
|
|
|
180
302
|
};
|
|
181
303
|
|
|
182
304
|
// src/components/ChatPrompt/ChatOptions.tsx
|
|
183
|
-
import React4, { useCallback as
|
|
305
|
+
import React4, { useCallback as useCallback4, useMemo as useMemo2, useState as useState2 } from "react";
|
|
184
306
|
import { McpServer } from "@dxos/assistant-toolkit";
|
|
185
307
|
import { Filter as Filter2, Obj as Obj2, Type as Type2 } from "@dxos/echo";
|
|
186
308
|
import { useObject, useQuery as useQuery2 } from "@dxos/react-client/echo";
|
|
@@ -189,7 +311,7 @@ import { Listbox } from "@dxos/react-ui-list";
|
|
|
189
311
|
import { SearchList, useSearchListResults } from "@dxos/react-ui-search";
|
|
190
312
|
import { Tabs } from "@dxos/react-ui-tabs";
|
|
191
313
|
import { getStyles, mx as mx2 } from "@dxos/ui-theme";
|
|
192
|
-
import {
|
|
314
|
+
import { useActiveSkills, useContextObjects, useFilteredTypes, useSkillHandlers, useSkills } from "#hooks";
|
|
193
315
|
import { meta as meta4 } from "#meta";
|
|
194
316
|
import { Assistant } from "#types";
|
|
195
317
|
var styles = {
|
|
@@ -240,8 +362,8 @@ var ChatOptions = ({ chat, db, context, registry, presets, preset, onPresetChang
|
|
|
240
362
|
})), /* @__PURE__ */ React4.createElement(Tabs.Panel, {
|
|
241
363
|
tabIndex: -1,
|
|
242
364
|
classNames: "dx-focus-ring-inset overflow-hidden",
|
|
243
|
-
value: "
|
|
244
|
-
}, /* @__PURE__ */ React4.createElement(
|
|
365
|
+
value: "skills"
|
|
366
|
+
}, /* @__PURE__ */ React4.createElement(SkillsPanel, {
|
|
245
367
|
registry,
|
|
246
368
|
db,
|
|
247
369
|
context
|
|
@@ -268,9 +390,9 @@ var ChatOptions = ({ chat, db, context, registry, presets, preset, onPresetChang
|
|
|
268
390
|
icon: "ph--eye--regular",
|
|
269
391
|
label: t("chat-view.title")
|
|
270
392
|
}), /* @__PURE__ */ React4.createElement(Tabs.IconTab, {
|
|
271
|
-
value: "
|
|
393
|
+
value: "skills",
|
|
272
394
|
icon: "ph--blueprint--regular",
|
|
273
|
-
label: t("options.
|
|
395
|
+
label: t("options.skills.title")
|
|
274
396
|
}), /* @__PURE__ */ React4.createElement(Tabs.IconTab, {
|
|
275
397
|
value: "mcp-servers",
|
|
276
398
|
icon: "ph--plugs-connected--regular",
|
|
@@ -281,38 +403,38 @@ var ChatOptions = ({ chat, db, context, registry, presets, preset, onPresetChang
|
|
|
281
403
|
label: t("options.chat-model.title")
|
|
282
404
|
}))))), /* @__PURE__ */ React4.createElement(Popover.Arrow, null)))));
|
|
283
405
|
};
|
|
284
|
-
var
|
|
406
|
+
var SkillsPanel = ({ registry, db, context }) => {
|
|
285
407
|
const { t } = useTranslation4(meta4.profile.key);
|
|
286
|
-
const
|
|
408
|
+
const skills = useSkills({
|
|
287
409
|
registry,
|
|
288
410
|
db
|
|
289
411
|
});
|
|
290
|
-
const
|
|
412
|
+
const activeSkills = useActiveSkills({
|
|
291
413
|
context
|
|
292
414
|
});
|
|
293
|
-
const {
|
|
415
|
+
const { onUpdateSkill } = useSkillHandlers({
|
|
294
416
|
db,
|
|
295
417
|
context,
|
|
296
418
|
registry
|
|
297
419
|
});
|
|
298
420
|
const { results, handleSearch } = useSearchListResults({
|
|
299
|
-
items:
|
|
300
|
-
extract: (
|
|
421
|
+
items: skills,
|
|
422
|
+
extract: (skill) => skill.name
|
|
301
423
|
});
|
|
302
424
|
return /* @__PURE__ */ React4.createElement(SearchList.Root, {
|
|
303
425
|
onSearch: handleSearch
|
|
304
426
|
}, /* @__PURE__ */ React4.createElement(SearchList.Content, {
|
|
305
427
|
classNames: "flex flex-col"
|
|
306
|
-
}, /* @__PURE__ */ React4.createElement(SearchList.Viewport, null, results.map((
|
|
307
|
-
const
|
|
308
|
-
const isActive =
|
|
428
|
+
}, /* @__PURE__ */ React4.createElement(SearchList.Viewport, null, results.map((skill) => {
|
|
429
|
+
const skillKey = Obj2.getMeta(skill).key ?? skill.id;
|
|
430
|
+
const isActive = activeSkills.has(skillKey);
|
|
309
431
|
return /* @__PURE__ */ React4.createElement(SearchList.Item, {
|
|
310
432
|
classNames: "flex items-center overflow-hidden",
|
|
311
|
-
key:
|
|
312
|
-
value:
|
|
313
|
-
label:
|
|
433
|
+
key: skillKey,
|
|
434
|
+
value: skillKey,
|
|
435
|
+
label: skill.name,
|
|
314
436
|
checked: isActive,
|
|
315
|
-
onSelect: () =>
|
|
437
|
+
onSelect: () => onUpdateSkill?.(skillKey, !isActive)
|
|
316
438
|
});
|
|
317
439
|
})), /* @__PURE__ */ React4.createElement(SearchList.Input, {
|
|
318
440
|
placeholder: t("search.placeholder"),
|
|
@@ -355,8 +477,8 @@ var ModelsPanel = ({ presets, preset, onPresetChange }) => {
|
|
|
355
477
|
var McpServersPanel = ({ db }) => {
|
|
356
478
|
const { t } = useTranslation4(meta4.profile.key);
|
|
357
479
|
const servers = useQuery2(db, Filter2.type(McpServer.McpServer));
|
|
358
|
-
const [adding, setAdding] =
|
|
359
|
-
const handleAdd =
|
|
480
|
+
const [adding, setAdding] = useState2(false);
|
|
481
|
+
const handleAdd = useCallback4((name, url, protocol, apiKey) => {
|
|
360
482
|
db.add(Obj2.make(McpServer.McpServer, {
|
|
361
483
|
name,
|
|
362
484
|
url,
|
|
@@ -368,7 +490,7 @@ var McpServersPanel = ({ db }) => {
|
|
|
368
490
|
}, [
|
|
369
491
|
db
|
|
370
492
|
]);
|
|
371
|
-
const handleRemove =
|
|
493
|
+
const handleRemove = useCallback4((server) => {
|
|
372
494
|
db.remove(server);
|
|
373
495
|
}, [
|
|
374
496
|
db
|
|
@@ -413,12 +535,12 @@ var McpServerRow = ({ server, onRemove }) => {
|
|
|
413
535
|
};
|
|
414
536
|
var McpServerForm = ({ onSubmit, onCancel }) => {
|
|
415
537
|
const { t } = useTranslation4(meta4.profile.key);
|
|
416
|
-
const [name, setName] =
|
|
417
|
-
const [url, setUrl] =
|
|
418
|
-
const [protocol, setProtocol] =
|
|
419
|
-
const [apiKey, setApiKey] =
|
|
538
|
+
const [name, setName] = useState2("");
|
|
539
|
+
const [url, setUrl] = useState2("");
|
|
540
|
+
const [protocol, setProtocol] = useState2("sse");
|
|
541
|
+
const [apiKey, setApiKey] = useState2("");
|
|
420
542
|
const canSubmit = name.trim().length > 0 && url.trim().length > 0;
|
|
421
|
-
const handleSubmit =
|
|
543
|
+
const handleSubmit = useCallback4(() => {
|
|
422
544
|
if (canSubmit) {
|
|
423
545
|
onSubmit(name.trim(), url.trim(), protocol, apiKey.trim() || void 0);
|
|
424
546
|
}
|
|
@@ -499,7 +621,7 @@ var ObjectsPanel = ({ db, context }) => {
|
|
|
499
621
|
types,
|
|
500
622
|
t
|
|
501
623
|
]);
|
|
502
|
-
const [selectedUri, setSelectedUri] =
|
|
624
|
+
const [selectedUri, setSelectedUri] = useState2(ANY);
|
|
503
625
|
const anyFilter = useMemo2(() => Filter2.or(...typeOptions.map(({ uri }) => Filter2.type(uri))), [
|
|
504
626
|
typeOptions
|
|
505
627
|
]);
|
|
@@ -561,18 +683,18 @@ import { Select as Select2 } from "@dxos/react-ui";
|
|
|
561
683
|
// src/components/ChatPrompt/ChatPrompt.tsx
|
|
562
684
|
import { useAtomValue as useAtomValue3 } from "@effect-atom/atom-react";
|
|
563
685
|
import * as Option2 from "effect/Option";
|
|
564
|
-
import React8, { useCallback as
|
|
565
|
-
import {
|
|
566
|
-
import { Input as Input3, useDynamicRef, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
686
|
+
import React8, { useCallback as useCallback6, useEffect as useEffect4, useId, useMemo as useMemo4, useRef as useRef2 } from "react";
|
|
687
|
+
import { Input as Input3, useDynamicRef, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
567
688
|
import { ChatEditor } from "@dxos/react-ui-chat";
|
|
689
|
+
import { pendingText } from "@dxos/ui-editor";
|
|
568
690
|
import { mx as mx5 } from "@dxos/ui-theme";
|
|
569
691
|
import { useChatKeymapExtensions } from "#hooks";
|
|
570
|
-
import { meta as
|
|
692
|
+
import { meta as meta7 } from "#meta";
|
|
571
693
|
|
|
572
694
|
// src/components/ChatPrompt/ChatReferences.tsx
|
|
573
695
|
import React6 from "react";
|
|
574
696
|
import { Obj as Obj3 } from "@dxos/echo";
|
|
575
|
-
import { Icon, IconButton as IconButton3, toLocalizedString, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
697
|
+
import { Icon as Icon2, IconButton as IconButton3, toLocalizedString, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
576
698
|
import { getStyles as getStyles2, mx as mx3 } from "@dxos/ui-theme";
|
|
577
699
|
import { useContextObjects as useContextObjects2 } from "#hooks";
|
|
578
700
|
import { meta as meta5 } from "#meta";
|
|
@@ -602,7 +724,7 @@ var ChatReferences = ({ classNames, context, db }) => {
|
|
|
602
724
|
key: uri.toString(),
|
|
603
725
|
className: "dx-tag py-0 flex items-center gap-1",
|
|
604
726
|
"data-hue": "neutral"
|
|
605
|
-
}, /* @__PURE__ */ React6.createElement(
|
|
727
|
+
}, /* @__PURE__ */ React6.createElement(Icon2, {
|
|
606
728
|
icon,
|
|
607
729
|
size: 4
|
|
608
730
|
}), toLocalizedString(label, t), /* @__PURE__ */ React6.createElement(IconButton3, {
|
|
@@ -619,14 +741,14 @@ var ChatReferences = ({ classNames, context, db }) => {
|
|
|
619
741
|
var DEFAULT_OBJECT_ICON = "ph--cube--regular";
|
|
620
742
|
|
|
621
743
|
// src/components/ChatPrompt/ChatStatusIndicator.tsx
|
|
622
|
-
import React7, { useEffect, useState as
|
|
744
|
+
import React7, { useEffect as useEffect2, useState as useState3 } from "react";
|
|
623
745
|
import { Tooltip, useTimeout } from "@dxos/react-ui";
|
|
624
746
|
import { Spinner } from "@dxos/react-ui-components";
|
|
625
747
|
import { mx as mx4 } from "@dxos/ui-theme";
|
|
626
748
|
var period = 3e3;
|
|
627
749
|
var ChatStatusIndicator = ({ classNames, preset, processing, error, ...props }) => {
|
|
628
|
-
const [init, setInit] =
|
|
629
|
-
|
|
750
|
+
const [init, setInit] = useState3(false);
|
|
751
|
+
useEffect2(() => setInit(false), [
|
|
630
752
|
preset
|
|
631
753
|
]);
|
|
632
754
|
useTimeout(async () => {
|
|
@@ -648,46 +770,117 @@ var ChatStatusIndicator = ({ classNames, preset, processing, error, ...props })
|
|
|
648
770
|
})));
|
|
649
771
|
};
|
|
650
772
|
|
|
651
|
-
// src/components/ChatPrompt/
|
|
652
|
-
|
|
773
|
+
// src/components/ChatPrompt/useChatVoiceInput.ts
|
|
774
|
+
import { useCallback as useCallback5, useEffect as useEffect3, useMemo as useMemo3, useRef } from "react";
|
|
775
|
+
import { useOptionalAtomCapabilityState as useOptionalAtomCapabilityState2 } from "@dxos/app-framework/ui";
|
|
776
|
+
import { TranscriptionCapabilities as TranscriptionCapabilities2 } from "@dxos/plugin-transcription/types";
|
|
777
|
+
import { useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
778
|
+
import { useAudioTrack, useTranscriber } from "@dxos/react-ui-transcription";
|
|
779
|
+
import { PendingTextStreamer, cancelPendingText, editorPendingTextSink, pendingTextState } from "@dxos/ui-editor";
|
|
780
|
+
import { meta as meta6 } from "#meta";
|
|
781
|
+
var RECORDER_INTERVAL_MS = 200;
|
|
782
|
+
var useChatVoiceInput = (docId, editorRef) => {
|
|
653
783
|
const { t } = useTranslation6(meta6.profile.key);
|
|
784
|
+
const [session] = useOptionalAtomCapabilityState2(TranscriptionCapabilities2.RecordingSession);
|
|
785
|
+
const [settings] = useOptionalAtomCapabilityState2(TranscriptionCapabilities2.Settings);
|
|
786
|
+
const active = !!session?.recording && session.id === docId;
|
|
787
|
+
const streamerRef = useRef(null);
|
|
788
|
+
useEffect3(() => {
|
|
789
|
+
if (!active) {
|
|
790
|
+
return;
|
|
791
|
+
}
|
|
792
|
+
const view = editorRef.current?.view;
|
|
793
|
+
if (!view) {
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
const streamer = new PendingTextStreamer(editorPendingTextSink(view), {
|
|
797
|
+
mode: settings?.streamMode ?? "word",
|
|
798
|
+
wordIntervalMs: settings?.wordIntervalMs ?? 80
|
|
799
|
+
});
|
|
800
|
+
streamer.start({
|
|
801
|
+
anchor: view.state.selection.main.head,
|
|
802
|
+
placeholder: t("recording.placeholder")
|
|
803
|
+
});
|
|
804
|
+
streamerRef.current = streamer;
|
|
805
|
+
return () => {
|
|
806
|
+
streamer.dispose();
|
|
807
|
+
streamerRef.current = null;
|
|
808
|
+
const currentView = editorRef.current?.view;
|
|
809
|
+
if (currentView) {
|
|
810
|
+
const pending = currentView.state.field(pendingTextState, false);
|
|
811
|
+
if (pending && pending.final.length === 0) {
|
|
812
|
+
currentView.dispatch({
|
|
813
|
+
effects: cancelPendingText.of()
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
}, [
|
|
819
|
+
active,
|
|
820
|
+
settings?.streamMode,
|
|
821
|
+
settings?.wordIntervalMs
|
|
822
|
+
]);
|
|
823
|
+
const handleSegments = useCallback5(async (segments) => {
|
|
824
|
+
const text = segments.map((segment) => segment.text).join(" ").trim();
|
|
825
|
+
if (text.length > 0) {
|
|
826
|
+
streamerRef.current?.push(text);
|
|
827
|
+
}
|
|
828
|
+
}, []);
|
|
829
|
+
const transcriberConfig = useMemo3(() => ({
|
|
830
|
+
transcribeAfterChunksAmount: Math.max(1, Math.round((settings?.transcribeAfterMs ?? 4e3) / RECORDER_INTERVAL_MS))
|
|
831
|
+
}), [
|
|
832
|
+
settings?.transcribeAfterMs
|
|
833
|
+
]);
|
|
834
|
+
const recorderConfig = useMemo3(() => ({
|
|
835
|
+
interval: RECORDER_INTERVAL_MS
|
|
836
|
+
}), []);
|
|
837
|
+
const audioConstraints = useMemo3(() => settings?.audioDeviceId ? {
|
|
838
|
+
deviceId: {
|
|
839
|
+
exact: settings.audioDeviceId
|
|
840
|
+
}
|
|
841
|
+
} : void 0, [
|
|
842
|
+
settings?.audioDeviceId
|
|
843
|
+
]);
|
|
844
|
+
const track = useAudioTrack(active, audioConstraints);
|
|
845
|
+
useTranscriber({
|
|
846
|
+
audioStreamTrack: track,
|
|
847
|
+
transcriberConfig,
|
|
848
|
+
recorderConfig,
|
|
849
|
+
onSegments: handleSegments
|
|
850
|
+
});
|
|
851
|
+
};
|
|
852
|
+
|
|
853
|
+
// src/components/ChatPrompt/ChatPrompt.tsx
|
|
854
|
+
var ChatPrompt = ({ classNames, outline, db, chat, processor, event, online, placeholder, onPresetChange, settings = true, presets, preset }) => {
|
|
855
|
+
const { t } = useTranslation7(meta7.profile.key);
|
|
654
856
|
const error = useAtomValue3(processor.error).pipe(Option2.getOrUndefined);
|
|
655
857
|
const streaming = useAtomValue3(processor.streaming);
|
|
656
858
|
const active = useAtomValue3(processor.active);
|
|
657
859
|
const activeRef = useDynamicRef(active);
|
|
658
|
-
const editorRef =
|
|
659
|
-
|
|
660
|
-
useEffect2(() => {
|
|
860
|
+
const editorRef = useRef2(null);
|
|
861
|
+
useEffect4(() => {
|
|
661
862
|
return event.on((ev) => {
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
editorRef.current?.setText(ev.text);
|
|
666
|
-
editorRef.current?.focus();
|
|
667
|
-
}
|
|
668
|
-
break;
|
|
669
|
-
case "record-start":
|
|
670
|
-
setRecordingState(true);
|
|
671
|
-
break;
|
|
672
|
-
case "record-stop":
|
|
673
|
-
setRecordingState(false);
|
|
674
|
-
break;
|
|
863
|
+
if (ev.type === "update-prompt" && !editorRef.current?.getText()?.length) {
|
|
864
|
+
editorRef.current?.setText(ev.text);
|
|
865
|
+
editorRef.current?.focus();
|
|
675
866
|
}
|
|
676
867
|
});
|
|
677
868
|
}, [
|
|
678
869
|
event
|
|
679
870
|
]);
|
|
680
|
-
const
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
editorRef.current?.focus();
|
|
685
|
-
}
|
|
686
|
-
});
|
|
687
|
-
const extensions = useChatKeymapExtensions({
|
|
871
|
+
const fallbackDocId = useId();
|
|
872
|
+
const docId = chat?.id ?? fallbackDocId;
|
|
873
|
+
useChatVoiceInput(docId, editorRef);
|
|
874
|
+
const keymapExtensions = useChatKeymapExtensions({
|
|
688
875
|
event
|
|
689
876
|
});
|
|
690
|
-
const
|
|
877
|
+
const extensions = useMemo4(() => [
|
|
878
|
+
keymapExtensions,
|
|
879
|
+
pendingText()
|
|
880
|
+
], [
|
|
881
|
+
keymapExtensions
|
|
882
|
+
]);
|
|
883
|
+
const handleSubmit = useCallback6((text) => {
|
|
691
884
|
if (!activeRef.current) {
|
|
692
885
|
event.emit({
|
|
693
886
|
type: "submit",
|
|
@@ -698,7 +891,7 @@ var ChatPrompt = ({ classNames, outline, db, chat, processor, event, online, pla
|
|
|
698
891
|
}, [
|
|
699
892
|
event
|
|
700
893
|
]);
|
|
701
|
-
const handleEvent =
|
|
894
|
+
const handleEvent = useCallback6((ev) => {
|
|
702
895
|
event.emit(ev);
|
|
703
896
|
}, [
|
|
704
897
|
event
|
|
@@ -741,7 +934,7 @@ var ChatPrompt = ({ classNames, outline, db, chat, processor, event, online, pla
|
|
|
741
934
|
})), /* @__PURE__ */ React8.createElement(ChatActions, {
|
|
742
935
|
classNames: "col-span-2",
|
|
743
936
|
microphone: true,
|
|
744
|
-
|
|
937
|
+
docId,
|
|
745
938
|
processing: streaming,
|
|
746
939
|
onEvent: handleEvent
|
|
747
940
|
}, online !== void 0 && /* @__PURE__ */ React8.createElement(Input3.Root, null, /* @__PURE__ */ React8.createElement(Input3.Label, {
|
|
@@ -749,13 +942,13 @@ var ChatPrompt = ({ classNames, outline, db, chat, processor, event, online, pla
|
|
|
749
942
|
}, t("online-switch.label")), /* @__PURE__ */ React8.createElement(Input3.Switch, {
|
|
750
943
|
classNames: "mx-1",
|
|
751
944
|
checked: online,
|
|
752
|
-
|
|
945
|
+
disabled: true
|
|
753
946
|
})))));
|
|
754
947
|
};
|
|
755
948
|
ChatPrompt.displayName = "Chat.Prompt";
|
|
756
949
|
|
|
757
950
|
// src/components/ChatPrompt/ChatStatus.tsx
|
|
758
|
-
import React9, { useEffect as
|
|
951
|
+
import React9, { useEffect as useEffect5, useMemo as useMemo5, useState as useState4 } from "react";
|
|
759
952
|
import { ChatStatus as NaturalChatStatus, formatElapsed } from "@dxos/react-ui-chat";
|
|
760
953
|
import { Matrix } from "@dxos/react-ui-components";
|
|
761
954
|
import { Unit } from "@dxos/util";
|
|
@@ -763,7 +956,7 @@ var CHAT_STREAM_STATUS_NAME = "Chat.StreamStatus";
|
|
|
763
956
|
var TICK_MS = 1e3;
|
|
764
957
|
var ChatStatus = ({ classNames, icon }) => {
|
|
765
958
|
const { messages, requestTiming } = useChatContext(CHAT_STREAM_STATUS_NAME);
|
|
766
|
-
const { lastOutputTokens, sessionTotalTokens } =
|
|
959
|
+
const { lastOutputTokens, sessionTotalTokens } = useMemo5(() => {
|
|
767
960
|
let last;
|
|
768
961
|
let total = 0;
|
|
769
962
|
for (const message of messages) {
|
|
@@ -809,7 +1002,7 @@ var ChatStatus = ({ classNames, icon }) => {
|
|
|
809
1002
|
var Elapsed = ({ timing }) => {
|
|
810
1003
|
const isRunning = timing.endedAt == null;
|
|
811
1004
|
const [now, setNow] = useState4(Date.now());
|
|
812
|
-
|
|
1005
|
+
useEffect5(() => {
|
|
813
1006
|
if (!isRunning) {
|
|
814
1007
|
return;
|
|
815
1008
|
}
|
|
@@ -823,16 +1016,16 @@ var Elapsed = ({ timing }) => {
|
|
|
823
1016
|
var isStats = (block) => block._tag === "stats";
|
|
824
1017
|
|
|
825
1018
|
// src/components/ChatThread/ChatThread.tsx
|
|
826
|
-
import
|
|
1019
|
+
import React15, { forwardRef, useCallback as useCallback8, useEffect as useEffect7, useMemo as useMemo8, useRef as useRef4, useState as useState6 } from "react";
|
|
827
1020
|
import { PublicKey } from "@dxos/keys";
|
|
828
1021
|
import { setRef } from "@dxos/react-ui";
|
|
829
1022
|
import { MarkdownStream } from "@dxos/react-ui-markdown";
|
|
830
1023
|
import { keyToFallback } from "@dxos/util";
|
|
831
1024
|
|
|
832
1025
|
// src/components/ChatThread/registry.tsx
|
|
833
|
-
import
|
|
834
|
-
import { log } from "@dxos/log";
|
|
835
|
-
import { getXmlTextChild } from "@dxos/ui-editor";
|
|
1026
|
+
import React14 from "react";
|
|
1027
|
+
import { log as log2 } from "@dxos/log";
|
|
1028
|
+
import { AnchorWidget, getXmlTextChild as getXmlTextChild2 } from "@dxos/ui-editor";
|
|
836
1029
|
|
|
837
1030
|
// src/components/ChatThread/tool-widget-state.ts
|
|
838
1031
|
var applyToolBlockToWidgetState = (context, block) => {
|
|
@@ -1061,11 +1254,11 @@ var StatusWidget = class extends WidgetType5 {
|
|
|
1061
1254
|
|
|
1062
1255
|
// src/components/ChatThread/widgets/SummaryWidget.tsx
|
|
1063
1256
|
import React11 from "react";
|
|
1064
|
-
import { useTranslation as
|
|
1257
|
+
import { useTranslation as useTranslation8 } from "@dxos/react-ui";
|
|
1065
1258
|
import { TogglePanel as TogglePanel2 } from "@dxos/react-ui-components";
|
|
1066
|
-
import { meta as
|
|
1259
|
+
import { meta as meta8 } from "#meta";
|
|
1067
1260
|
var SummaryWidget = ({ children }) => {
|
|
1068
|
-
const { t } =
|
|
1261
|
+
const { t } = useTranslation8(meta8.profile.key);
|
|
1069
1262
|
return /* @__PURE__ */ React11.createElement(TogglePanel2.Root, null, /* @__PURE__ */ React11.createElement(TogglePanel2.Content, {
|
|
1070
1263
|
classNames: styles2.border
|
|
1071
1264
|
}, /* @__PURE__ */ React11.createElement(TogglePanel2.Header, {
|
|
@@ -1075,6 +1268,45 @@ var SummaryWidget = ({ children }) => {
|
|
|
1075
1268
|
}, children))));
|
|
1076
1269
|
};
|
|
1077
1270
|
|
|
1271
|
+
// src/components/ChatThread/widgets/SurfaceWidget.tsx
|
|
1272
|
+
import React12, { useMemo as useMemo6 } from "react";
|
|
1273
|
+
import { Surface } from "@dxos/app-framework/ui";
|
|
1274
|
+
import { log } from "@dxos/log";
|
|
1275
|
+
import { getXmlTextChild } from "@dxos/ui-editor";
|
|
1276
|
+
import { ChatSurface } from "#types";
|
|
1277
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/ChatThread/widgets/SurfaceWidget.tsx";
|
|
1278
|
+
var SurfaceWidget = ({ role, children }) => {
|
|
1279
|
+
const data = useMemo6(() => {
|
|
1280
|
+
const raw = getXmlTextChild(children ?? []);
|
|
1281
|
+
if (!raw) {
|
|
1282
|
+
return void 0;
|
|
1283
|
+
}
|
|
1284
|
+
try {
|
|
1285
|
+
const parsed = JSON.parse(raw);
|
|
1286
|
+
return parsed != null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : void 0;
|
|
1287
|
+
} catch (err) {
|
|
1288
|
+
log.warn("failed to parse surface data", {
|
|
1289
|
+
raw,
|
|
1290
|
+
err
|
|
1291
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 24, S: void 0 });
|
|
1292
|
+
return void 0;
|
|
1293
|
+
}
|
|
1294
|
+
}, [
|
|
1295
|
+
children
|
|
1296
|
+
]);
|
|
1297
|
+
if (!role) {
|
|
1298
|
+
return null;
|
|
1299
|
+
}
|
|
1300
|
+
return /* @__PURE__ */ React12.createElement(Surface.Surface, {
|
|
1301
|
+
type: ChatSurface,
|
|
1302
|
+
data: {
|
|
1303
|
+
role,
|
|
1304
|
+
data
|
|
1305
|
+
},
|
|
1306
|
+
limit: 1
|
|
1307
|
+
});
|
|
1308
|
+
};
|
|
1309
|
+
|
|
1078
1310
|
// src/components/ChatThread/widgets/SuggestionWidget.ts
|
|
1079
1311
|
import { WidgetType as WidgetType6 } from "@codemirror/view";
|
|
1080
1312
|
import { Domino as Domino6, mx as mx6 } from "@dxos/ui";
|
|
@@ -1098,15 +1330,15 @@ var SuggestionWidget = class extends WidgetType6 {
|
|
|
1098
1330
|
};
|
|
1099
1331
|
|
|
1100
1332
|
// src/components/ChatThread/widgets/ToolWidget.tsx
|
|
1101
|
-
import
|
|
1102
|
-
import { Icon as
|
|
1333
|
+
import React13, { useCallback as useCallback7, useEffect as useEffect6, useMemo as useMemo7, useRef as useRef3, useState as useState5 } from "react";
|
|
1334
|
+
import { Icon as Icon3, useTranslation as useTranslation9 } from "@dxos/react-ui";
|
|
1103
1335
|
import { NumericTabs, TextCrawl, TogglePanel as TogglePanel3 } from "@dxos/react-ui-components";
|
|
1104
1336
|
import { JsonHighlighter as JsonHighlighter2 } from "@dxos/react-ui-syntax-highlighter";
|
|
1105
1337
|
import { isNonNullable, safeParseJson } from "@dxos/util";
|
|
1106
|
-
import { meta as
|
|
1338
|
+
import { meta as meta9 } from "#meta";
|
|
1107
1339
|
var ToolWidget = ({ view, blocks = [] }) => {
|
|
1108
|
-
const { t } =
|
|
1109
|
-
const items =
|
|
1340
|
+
const { t } = useTranslation9(meta9.profile.key);
|
|
1341
|
+
const items = useMemo7(() => {
|
|
1110
1342
|
let lastToolCall;
|
|
1111
1343
|
const tools = [];
|
|
1112
1344
|
return blocks.filter((block) => block._tag === "toolCall" || block._tag === "toolResult" || block._tag === "stats").map((block) => {
|
|
@@ -1171,7 +1403,7 @@ var ToolWidget = ({ view, blocks = [] }) => {
|
|
|
1171
1403
|
blocks,
|
|
1172
1404
|
t
|
|
1173
1405
|
]);
|
|
1174
|
-
const handleChangeOpen =
|
|
1406
|
+
const handleChangeOpen = useCallback7(() => {
|
|
1175
1407
|
setTimeout(() => {
|
|
1176
1408
|
view?.requestMeasure();
|
|
1177
1409
|
}, 1e3);
|
|
@@ -1181,22 +1413,22 @@ var ToolWidget = ({ view, blocks = [] }) => {
|
|
|
1181
1413
|
if (!items.length) {
|
|
1182
1414
|
return null;
|
|
1183
1415
|
}
|
|
1184
|
-
return /* @__PURE__ */
|
|
1416
|
+
return /* @__PURE__ */ React13.createElement(ToolPanel, {
|
|
1185
1417
|
items,
|
|
1186
1418
|
onChangeOpen: handleChangeOpen
|
|
1187
1419
|
});
|
|
1188
1420
|
};
|
|
1189
1421
|
var DEFAULT_TOOL_ICON = "ph--wrench--regular";
|
|
1190
1422
|
var ToolPanel = ({ items, onChangeOpen }) => {
|
|
1191
|
-
const tabsRef =
|
|
1423
|
+
const tabsRef = useRef3(null);
|
|
1192
1424
|
const [selected, setSelected] = useState5(0);
|
|
1193
1425
|
const [open, setOpen] = useState5(false);
|
|
1194
|
-
|
|
1426
|
+
useEffect6(() => {
|
|
1195
1427
|
setSelected((prev) => Math.min(prev, Math.max(0, items.length - 1)));
|
|
1196
1428
|
}, [
|
|
1197
1429
|
items.length
|
|
1198
1430
|
]);
|
|
1199
|
-
|
|
1431
|
+
useEffect6(() => {
|
|
1200
1432
|
onChangeOpen?.(open);
|
|
1201
1433
|
if (open) {
|
|
1202
1434
|
tabsRef.current?.focus();
|
|
@@ -1205,33 +1437,33 @@ var ToolPanel = ({ items, onChangeOpen }) => {
|
|
|
1205
1437
|
open,
|
|
1206
1438
|
onChangeOpen
|
|
1207
1439
|
]);
|
|
1208
|
-
const handleSelect =
|
|
1440
|
+
const handleSelect = useCallback7((index) => {
|
|
1209
1441
|
setSelected(index);
|
|
1210
1442
|
}, []);
|
|
1211
1443
|
const headerIcon = items[items.length - 1]?.icon ?? items[0]?.icon ?? DEFAULT_TOOL_ICON;
|
|
1212
|
-
return /* @__PURE__ */
|
|
1444
|
+
return /* @__PURE__ */ React13.createElement(TogglePanel3.Root, {
|
|
1213
1445
|
open,
|
|
1214
1446
|
onChangeOpen: setOpen
|
|
1215
|
-
}, /* @__PURE__ */
|
|
1447
|
+
}, /* @__PURE__ */ React13.createElement(TogglePanel3.Content, null, /* @__PURE__ */ React13.createElement(TogglePanel3.Header, {
|
|
1216
1448
|
classNames: "flex items-center gap-2 text-sm text-placeholder"
|
|
1217
|
-
}, /* @__PURE__ */
|
|
1449
|
+
}, /* @__PURE__ */ React13.createElement(Icon3, {
|
|
1218
1450
|
icon: headerIcon,
|
|
1219
1451
|
size: 4,
|
|
1220
1452
|
classNames: "shrink-0 opacity-70"
|
|
1221
|
-
}), /* @__PURE__ */
|
|
1453
|
+
}), /* @__PURE__ */ React13.createElement(TextCrawl, {
|
|
1222
1454
|
key: "status-roll",
|
|
1223
1455
|
lines: items.map((item) => item.title),
|
|
1224
1456
|
autoAdvance: true,
|
|
1225
1457
|
greedy: true
|
|
1226
|
-
})), /* @__PURE__ */
|
|
1458
|
+
})), /* @__PURE__ */ React13.createElement(TogglePanel3.Body, null, /* @__PURE__ */ React13.createElement(TogglePanel3.Viewport, {
|
|
1227
1459
|
classNames: "grid grid-cols-[32px_1fr]"
|
|
1228
|
-
}, /* @__PURE__ */
|
|
1460
|
+
}, /* @__PURE__ */ React13.createElement(NumericTabs, {
|
|
1229
1461
|
ref: tabsRef,
|
|
1230
1462
|
classNames: "p-1",
|
|
1231
1463
|
length: items.length,
|
|
1232
1464
|
selected,
|
|
1233
1465
|
onSelect: handleSelect
|
|
1234
|
-
}), /* @__PURE__ */
|
|
1466
|
+
}), /* @__PURE__ */ React13.createElement(JsonHighlighter2, {
|
|
1235
1467
|
data: items[selected]?.content,
|
|
1236
1468
|
classNames: "p-1 text-xs bg-transparent",
|
|
1237
1469
|
replacer: {
|
|
@@ -1243,93 +1475,105 @@ var ToolPanel = ({ items, onChangeOpen }) => {
|
|
|
1243
1475
|
};
|
|
1244
1476
|
|
|
1245
1477
|
// src/components/ChatThread/registry.tsx
|
|
1246
|
-
var
|
|
1478
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/ChatThread/registry.tsx";
|
|
1247
1479
|
var componentRegistry = {
|
|
1248
1480
|
//
|
|
1249
1481
|
// Block-only (no widget — see note above).
|
|
1250
1482
|
//
|
|
1251
|
-
prompt: {
|
|
1483
|
+
"prompt": {
|
|
1252
1484
|
block: true
|
|
1253
1485
|
},
|
|
1254
1486
|
//
|
|
1255
1487
|
// DOM Widgets
|
|
1256
1488
|
//
|
|
1257
|
-
|
|
1489
|
+
"link-preview": {
|
|
1490
|
+
block: false,
|
|
1491
|
+
urlSchemes: [
|
|
1492
|
+
"dxn:",
|
|
1493
|
+
"echo:"
|
|
1494
|
+
],
|
|
1495
|
+
factory: ({ label, dxn }) => typeof label === "string" && typeof dxn === "string" ? new AnchorWidget(label, dxn) : null
|
|
1496
|
+
},
|
|
1497
|
+
"synthetic": {
|
|
1258
1498
|
block: true,
|
|
1259
1499
|
factory: ({ children, range }) => {
|
|
1260
|
-
const text =
|
|
1500
|
+
const text = getXmlTextChild2(children);
|
|
1261
1501
|
return text ? new ReasoningWidget(text, range.from) : null;
|
|
1262
1502
|
}
|
|
1263
1503
|
},
|
|
1264
|
-
reasoning: {
|
|
1504
|
+
"reasoning": {
|
|
1265
1505
|
block: true,
|
|
1266
1506
|
streaming: true,
|
|
1267
1507
|
factory: ({ children, range }) => {
|
|
1268
|
-
const text =
|
|
1508
|
+
const text = getXmlTextChild2(children);
|
|
1269
1509
|
return text ? new ReasoningWidget(text, range.from) : null;
|
|
1270
1510
|
}
|
|
1271
1511
|
},
|
|
1272
|
-
reference: {
|
|
1512
|
+
"reference": {
|
|
1273
1513
|
block: false,
|
|
1274
1514
|
factory: ({ children, ref }) => {
|
|
1275
|
-
const text =
|
|
1515
|
+
const text = getXmlTextChild2(children);
|
|
1276
1516
|
return text && ref ? new ReferenceWidget(text, ref) : null;
|
|
1277
1517
|
}
|
|
1278
1518
|
},
|
|
1279
|
-
select: {
|
|
1519
|
+
"select": {
|
|
1280
1520
|
block: true,
|
|
1281
1521
|
factory: ({ children }) => {
|
|
1282
|
-
const options = children?.map((option) => option._tag === "option" &&
|
|
1522
|
+
const options = children?.map((option) => option._tag === "option" && getXmlTextChild2(option.children)).filter(Boolean);
|
|
1283
1523
|
return options?.length ? new SelectWidget(options) : null;
|
|
1284
1524
|
}
|
|
1285
1525
|
},
|
|
1286
|
-
suggestion: {
|
|
1526
|
+
"suggestion": {
|
|
1287
1527
|
block: true,
|
|
1288
1528
|
factory: ({ children }) => {
|
|
1289
|
-
const text =
|
|
1529
|
+
const text = getXmlTextChild2(children);
|
|
1290
1530
|
return text ? new SuggestionWidget(text) : null;
|
|
1291
1531
|
}
|
|
1292
1532
|
},
|
|
1293
|
-
stats: {
|
|
1533
|
+
"stats": {
|
|
1294
1534
|
block: true,
|
|
1295
1535
|
factory: ({ children }) => {
|
|
1296
|
-
const text =
|
|
1536
|
+
const text = getXmlTextChild2(children);
|
|
1297
1537
|
return text ? new StatsWidget(text) : null;
|
|
1298
1538
|
}
|
|
1299
1539
|
},
|
|
1300
|
-
status: {
|
|
1540
|
+
"status": {
|
|
1301
1541
|
block: true,
|
|
1302
1542
|
streaming: true,
|
|
1303
1543
|
factory: ({ children }) => {
|
|
1304
|
-
const text =
|
|
1544
|
+
const text = getXmlTextChild2(children);
|
|
1305
1545
|
return text ? new StatusWidget(text) : null;
|
|
1306
1546
|
}
|
|
1307
1547
|
},
|
|
1308
1548
|
//
|
|
1309
1549
|
// React Widgets (portaled outside of the editor)
|
|
1310
1550
|
//
|
|
1311
|
-
summary: {
|
|
1551
|
+
"summary": {
|
|
1312
1552
|
block: true,
|
|
1313
1553
|
Component: SummaryWidget
|
|
1314
1554
|
},
|
|
1315
|
-
|
|
1555
|
+
"surface": {
|
|
1556
|
+
block: true,
|
|
1557
|
+
Component: SurfaceWidget
|
|
1558
|
+
},
|
|
1559
|
+
"toolCall": {
|
|
1316
1560
|
block: true,
|
|
1317
|
-
Component: (props) => /* @__PURE__ */
|
|
1561
|
+
Component: (props) => /* @__PURE__ */ React14.createElement("div", {
|
|
1318
1562
|
className: "py-2"
|
|
1319
|
-
}, /* @__PURE__ */
|
|
1563
|
+
}, /* @__PURE__ */ React14.createElement(ToolWidget, props))
|
|
1320
1564
|
},
|
|
1321
|
-
toolResult: {
|
|
1565
|
+
"toolResult": {
|
|
1322
1566
|
block: true,
|
|
1323
1567
|
Component: FallbackWidget
|
|
1324
1568
|
},
|
|
1325
|
-
toolkit: {
|
|
1569
|
+
"toolkit": {
|
|
1326
1570
|
block: true,
|
|
1327
1571
|
Component: FallbackWidget
|
|
1328
1572
|
},
|
|
1329
1573
|
//
|
|
1330
1574
|
// Fallback
|
|
1331
1575
|
//
|
|
1332
|
-
json: {
|
|
1576
|
+
"json": {
|
|
1333
1577
|
block: true,
|
|
1334
1578
|
Component: FallbackWidget
|
|
1335
1579
|
}
|
|
@@ -1361,9 +1605,9 @@ var isBlockVisible = (viewType, message, block) => {
|
|
|
1361
1605
|
}
|
|
1362
1606
|
};
|
|
1363
1607
|
var blockToMarkdownImpl = (context, message, block) => {
|
|
1364
|
-
|
|
1608
|
+
log2("blockToMarkdown", {
|
|
1365
1609
|
block: JSON.stringify(block)
|
|
1366
|
-
}, { "~LogMeta": "~LogMeta", F:
|
|
1610
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 166, S: void 0 });
|
|
1367
1611
|
switch (block._tag) {
|
|
1368
1612
|
case "text": {
|
|
1369
1613
|
if (message.sender.role === "user") {
|
|
@@ -1436,6 +1680,15 @@ var blockToMarkdownImpl = (context, message, block) => {
|
|
|
1436
1680
|
pending: block.pending
|
|
1437
1681
|
});
|
|
1438
1682
|
}
|
|
1683
|
+
case "surface": {
|
|
1684
|
+
if (block.pending) {
|
|
1685
|
+
return;
|
|
1686
|
+
}
|
|
1687
|
+
return renderXMLBlock("surface", {
|
|
1688
|
+
content: JSON.stringify(block.data ?? {}),
|
|
1689
|
+
attributes: `role="${escapeXmlAttribute(block.role)}"`
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1439
1692
|
default: {
|
|
1440
1693
|
return `<json id="${message.id}">
|
|
1441
1694
|
${JSON.stringify(block)}
|
|
@@ -1444,6 +1697,7 @@ ${JSON.stringify(block)}
|
|
|
1444
1697
|
}
|
|
1445
1698
|
};
|
|
1446
1699
|
var escapeXmlTextContent = (raw) => raw.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1700
|
+
var escapeXmlAttribute = (raw) => escapeXmlTextContent(raw).replace(/"/g, """);
|
|
1447
1701
|
var renderXMLBlock = (tag, opts) => {
|
|
1448
1702
|
const content = escapeXmlTextContent((opts.content ?? "").replace(/\n\n/g, " ").trim());
|
|
1449
1703
|
if (opts.pending) {
|
|
@@ -1553,17 +1807,17 @@ var defaultOptions = {
|
|
|
1553
1807
|
};
|
|
1554
1808
|
var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages = [], error, options = defaultOptions, footer, debug = false, extensions, viewType, onEvent }, forwardedRef) => {
|
|
1555
1809
|
const [controller, setController] = useState6(null);
|
|
1556
|
-
const handleMarkdownStreamRef =
|
|
1810
|
+
const handleMarkdownStreamRef = useCallback8((instance) => {
|
|
1557
1811
|
setController(instance);
|
|
1558
1812
|
setRef(forwardedRef, instance);
|
|
1559
1813
|
}, [
|
|
1560
1814
|
forwardedRef
|
|
1561
1815
|
]);
|
|
1562
|
-
const userHue =
|
|
1816
|
+
const userHue = useMemo8(() => identity?.profile?.data?.hue || keyToFallback(identity?.identityKey ?? PublicKey.random()).hue, [
|
|
1563
1817
|
identity
|
|
1564
1818
|
]);
|
|
1565
|
-
const initializedRef =
|
|
1566
|
-
|
|
1819
|
+
const initializedRef = useRef4(false);
|
|
1820
|
+
useEffect7(() => {
|
|
1567
1821
|
if (!controller) {
|
|
1568
1822
|
initializedRef.current = false;
|
|
1569
1823
|
return;
|
|
@@ -1574,14 +1828,14 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
|
|
|
1574
1828
|
controller,
|
|
1575
1829
|
error
|
|
1576
1830
|
]);
|
|
1577
|
-
const renderer =
|
|
1831
|
+
const renderer = useMemo8(() => createBlockRenderer(viewType), [
|
|
1578
1832
|
viewType
|
|
1579
1833
|
]);
|
|
1580
|
-
const syncer =
|
|
1834
|
+
const syncer = useMemo8(() => controller && new MessageSyncer(controller, renderer), [
|
|
1581
1835
|
controller,
|
|
1582
1836
|
renderer
|
|
1583
1837
|
]);
|
|
1584
|
-
|
|
1838
|
+
useEffect7(() => {
|
|
1585
1839
|
if (!syncer) {
|
|
1586
1840
|
return;
|
|
1587
1841
|
}
|
|
@@ -1593,7 +1847,7 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
|
|
|
1593
1847
|
syncer,
|
|
1594
1848
|
messages
|
|
1595
1849
|
]);
|
|
1596
|
-
const handleEvent =
|
|
1850
|
+
const handleEvent = useCallback8(({ type, value: value2 }) => {
|
|
1597
1851
|
switch (type) {
|
|
1598
1852
|
case "submit": {
|
|
1599
1853
|
value2 && onEvent?.({
|
|
@@ -1606,10 +1860,10 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
|
|
|
1606
1860
|
}, [
|
|
1607
1861
|
onEvent
|
|
1608
1862
|
]);
|
|
1609
|
-
return /* @__PURE__ */
|
|
1863
|
+
return /* @__PURE__ */ React15.createElement("div", {
|
|
1610
1864
|
"data-hue": userHue,
|
|
1611
1865
|
className: "contents"
|
|
1612
|
-
}, /* @__PURE__ */
|
|
1866
|
+
}, /* @__PURE__ */ React15.createElement(MarkdownStream, {
|
|
1613
1867
|
key: viewType,
|
|
1614
1868
|
classNames,
|
|
1615
1869
|
registry: componentRegistry,
|
|
@@ -1623,10 +1877,10 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
|
|
|
1623
1877
|
});
|
|
1624
1878
|
|
|
1625
1879
|
// src/components/TaskList/TaskList.tsx
|
|
1626
|
-
import
|
|
1880
|
+
import React16, { useMemo as useMemo9 } from "react";
|
|
1627
1881
|
import { Plan } from "@dxos/assistant-toolkit";
|
|
1628
1882
|
import { useObject as useObject2 } from "@dxos/react-client/echo";
|
|
1629
|
-
import { Icon as
|
|
1883
|
+
import { Icon as Icon4, Tag } from "@dxos/react-ui";
|
|
1630
1884
|
import { composable, composableProps } from "@dxos/react-ui";
|
|
1631
1885
|
import { TextCrawl as TextCrawl2 } from "@dxos/react-ui-components";
|
|
1632
1886
|
import { Listbox as Listbox2 } from "@dxos/react-ui-list";
|
|
@@ -1635,14 +1889,14 @@ import { isTerminalActivityLine, useProcessEphemeralStatus } from "#hooks";
|
|
|
1635
1889
|
var TaskList = composable(({ plan, space, conversationId, traceMessages, ...props }, forwardedRef) => {
|
|
1636
1890
|
const [snapshot] = useObject2(plan);
|
|
1637
1891
|
const tasks = snapshot?.tasks ?? [];
|
|
1638
|
-
return /* @__PURE__ */
|
|
1892
|
+
return /* @__PURE__ */ React16.createElement(Listbox2.Root, null, /* @__PURE__ */ React16.createElement(Listbox2.Viewport, {
|
|
1639
1893
|
...composableProps(props, {
|
|
1640
1894
|
classNames: "dx-container"
|
|
1641
1895
|
}),
|
|
1642
1896
|
ref: forwardedRef
|
|
1643
|
-
}, /* @__PURE__ */
|
|
1897
|
+
}, /* @__PURE__ */ React16.createElement(Listbox2.Content, {
|
|
1644
1898
|
"aria-label": "Tasks"
|
|
1645
|
-
}, tasks.map((task) => /* @__PURE__ */
|
|
1899
|
+
}, tasks.map((task) => /* @__PURE__ */ React16.createElement(TaskListItem, {
|
|
1646
1900
|
key: task.id,
|
|
1647
1901
|
task,
|
|
1648
1902
|
space,
|
|
@@ -1651,7 +1905,7 @@ var TaskList = composable(({ plan, space, conversationId, traceMessages, ...prop
|
|
|
1651
1905
|
})))));
|
|
1652
1906
|
});
|
|
1653
1907
|
var TaskListItem = ({ task, space, traceMessages, conversationId }) => {
|
|
1654
|
-
const durableLines =
|
|
1908
|
+
const durableLines = useMemo9(() => {
|
|
1655
1909
|
if (!task.agentPid || !traceMessages?.length) {
|
|
1656
1910
|
return [];
|
|
1657
1911
|
}
|
|
@@ -1669,7 +1923,7 @@ var TaskListItem = ({ task, space, traceMessages, conversationId }) => {
|
|
|
1669
1923
|
conversationId
|
|
1670
1924
|
]);
|
|
1671
1925
|
const ephemeralLine = useProcessEphemeralStatus(task.delegated === true && task.status === "in-progress" ? task.agentPid : void 0, space);
|
|
1672
|
-
const inFlightLine =
|
|
1926
|
+
const inFlightLine = useMemo9(() => {
|
|
1673
1927
|
if (ephemeralLine || task.status !== "in-progress" || !task.agentPid || !traceMessages?.length) {
|
|
1674
1928
|
return void 0;
|
|
1675
1929
|
}
|
|
@@ -1683,7 +1937,7 @@ var TaskListItem = ({ task, space, traceMessages, conversationId }) => {
|
|
|
1683
1937
|
traceMessages,
|
|
1684
1938
|
conversationId
|
|
1685
1939
|
]);
|
|
1686
|
-
const activityLines =
|
|
1940
|
+
const activityLines = useMemo9(() => {
|
|
1687
1941
|
if (ephemeralLine) {
|
|
1688
1942
|
return [
|
|
1689
1943
|
ephemeralLine
|
|
@@ -1702,38 +1956,38 @@ var TaskListItem = ({ task, space, traceMessages, conversationId }) => {
|
|
|
1702
1956
|
]);
|
|
1703
1957
|
const agentPid = task.agentPid;
|
|
1704
1958
|
const showActivity = task.delegated === true && agentPid != null && activityLines.length > 0;
|
|
1705
|
-
return /* @__PURE__ */
|
|
1959
|
+
return /* @__PURE__ */ React16.createElement(Listbox2.Item, {
|
|
1706
1960
|
id: task.id,
|
|
1707
1961
|
classNames: "py-0"
|
|
1708
|
-
}, /* @__PURE__ */
|
|
1962
|
+
}, /* @__PURE__ */ React16.createElement("div", {
|
|
1709
1963
|
className: "flex flex-col gap-0.5 min-w-0"
|
|
1710
|
-
}, /* @__PURE__ */
|
|
1964
|
+
}, /* @__PURE__ */ React16.createElement("div", {
|
|
1711
1965
|
className: "flex items-center gap-2 min-w-0"
|
|
1712
|
-
}, /* @__PURE__ */
|
|
1966
|
+
}, /* @__PURE__ */ React16.createElement(Icon4, {
|
|
1713
1967
|
icon: task.status === "done" ? "ph--check--regular" : "ph--circle--regular",
|
|
1714
1968
|
classNames: task.status === "done" ? "text-success-text" : void 0,
|
|
1715
1969
|
size: 4
|
|
1716
|
-
}), /* @__PURE__ */
|
|
1970
|
+
}), /* @__PURE__ */ React16.createElement("span", {
|
|
1717
1971
|
className: "sr-only"
|
|
1718
|
-
}, task.status === "done" ? "done" : task.status === "in-progress" ? "in progress" : "to do"), /* @__PURE__ */
|
|
1972
|
+
}, task.status === "done" ? "done" : task.status === "in-progress" ? "in progress" : "to do"), /* @__PURE__ */ React16.createElement("span", {
|
|
1719
1973
|
className: "truncate flex-1"
|
|
1720
|
-
}, task.title), task.status === "in-progress" && /* @__PURE__ */
|
|
1721
|
-
|
|
1722
|
-
}, "pending"), task.agentPid && /* @__PURE__ */
|
|
1723
|
-
|
|
1724
|
-
}, Plan.formatAgentPidTag(task.agentPid))), showActivity && agentPid != null && /* @__PURE__ */
|
|
1974
|
+
}, task.title), task.status === "in-progress" && /* @__PURE__ */ React16.createElement(Tag, {
|
|
1975
|
+
hue: "info"
|
|
1976
|
+
}, "pending"), task.agentPid && /* @__PURE__ */ React16.createElement(Tag, {
|
|
1977
|
+
hue: "info"
|
|
1978
|
+
}, Plan.formatAgentPidTag(task.agentPid))), showActivity && agentPid != null && /* @__PURE__ */ React16.createElement(DelegatedTaskActivity, {
|
|
1725
1979
|
agentPid,
|
|
1726
1980
|
lines: activityLines
|
|
1727
1981
|
})));
|
|
1728
1982
|
};
|
|
1729
1983
|
var DelegatedTaskActivity = ({ agentPid, lines }) => {
|
|
1730
|
-
return /* @__PURE__ */
|
|
1984
|
+
return /* @__PURE__ */ React16.createElement("div", {
|
|
1731
1985
|
className: "flex items-center gap-2 ps-6 min-w-0 text-placeholder"
|
|
1732
|
-
}, /* @__PURE__ */
|
|
1986
|
+
}, /* @__PURE__ */ React16.createElement(Icon4, {
|
|
1733
1987
|
icon: "ph--brain--regular",
|
|
1734
1988
|
size: 3,
|
|
1735
1989
|
classNames: "shrink-0 opacity-70"
|
|
1736
|
-
}), /* @__PURE__ */
|
|
1990
|
+
}), /* @__PURE__ */ React16.createElement(TextCrawl2, {
|
|
1737
1991
|
key: `${String(agentPid)}:${lines.length}:${lines[lines.length - 1]}`,
|
|
1738
1992
|
lines,
|
|
1739
1993
|
autoAdvance: true,
|
|
@@ -1744,19 +1998,21 @@ var DelegatedTaskActivity = ({ agentPid, lines }) => {
|
|
|
1744
1998
|
};
|
|
1745
1999
|
|
|
1746
2000
|
// src/components/Chat/Chat.tsx
|
|
1747
|
-
var ChatRoot = ({ children, chat,
|
|
2001
|
+
var ChatRoot = ({ children, chat, processor, db: dbFallback, onEvent, onSubmit, ...props }) => {
|
|
1748
2002
|
const [debug, setDebug] = useState7(false);
|
|
1749
2003
|
const streaming = useAtomValue4(processor.streaming);
|
|
1750
2004
|
const active = useAtomValue4(processor.active);
|
|
1751
2005
|
const requestTiming = useRequestTiming({
|
|
1752
2006
|
active
|
|
1753
2007
|
});
|
|
1754
|
-
const lastPrompt =
|
|
2008
|
+
const lastPrompt = useRef5(void 0);
|
|
1755
2009
|
const db = chat && Obj4.getDatabase(chat) || dbFallback;
|
|
1756
|
-
const
|
|
2010
|
+
const [feedSnapshot] = useObject3(chat?.feed);
|
|
2011
|
+
const feed = Obj4.getReactiveOrUndefined(feedSnapshot);
|
|
2012
|
+
const event = useMemo10(() => new Event(), []);
|
|
1757
2013
|
const feedMessages = useQuery3(db, feed ? Query.select(Filter3.type(Message2.Message)).from(feed) : Query.select(Filter3.nothing()));
|
|
1758
2014
|
const pendingMessages = useAtomValue4(processor.messages);
|
|
1759
|
-
const messages =
|
|
2015
|
+
const messages = useMemo10(() => Array2.dedupeWith([
|
|
1760
2016
|
...feedMessages,
|
|
1761
2017
|
...pendingMessages
|
|
1762
2018
|
], ({ id: a }, { id: b }) => a === b), [
|
|
@@ -1767,7 +2023,7 @@ var ChatRoot = ({ children, chat, feed, processor, db: dbFallback, onEvent, onSu
|
|
|
1767
2023
|
processor
|
|
1768
2024
|
});
|
|
1769
2025
|
const error = useAtomValue4(processor.error);
|
|
1770
|
-
|
|
2026
|
+
useEffect8(() => {
|
|
1771
2027
|
if (Option3.isSome(error)) {
|
|
1772
2028
|
event.emit({
|
|
1773
2029
|
type: "error",
|
|
@@ -1778,7 +2034,7 @@ var ChatRoot = ({ children, chat, feed, processor, db: dbFallback, onEvent, onSu
|
|
|
1778
2034
|
event,
|
|
1779
2035
|
error
|
|
1780
2036
|
]);
|
|
1781
|
-
|
|
2037
|
+
useEffect8(() => {
|
|
1782
2038
|
return event.on((ev) => {
|
|
1783
2039
|
switch (ev.type) {
|
|
1784
2040
|
case "toggle-debug": {
|
|
@@ -1831,7 +2087,7 @@ var ChatRoot = ({ children, chat, feed, processor, db: dbFallback, onEvent, onSu
|
|
|
1831
2087
|
onEvent,
|
|
1832
2088
|
onSubmit
|
|
1833
2089
|
]);
|
|
1834
|
-
return /* @__PURE__ */
|
|
2090
|
+
return /* @__PURE__ */ React17.createElement(ChatContextProvider, {
|
|
1835
2091
|
debug,
|
|
1836
2092
|
event,
|
|
1837
2093
|
db,
|
|
@@ -1845,7 +2101,7 @@ var ChatRoot = ({ children, chat, feed, processor, db: dbFallback, onEvent, onSu
|
|
|
1845
2101
|
ChatRoot.displayName = "Chat.Root";
|
|
1846
2102
|
var useRequestTiming = ({ active }) => {
|
|
1847
2103
|
const [requestTiming, setRequestTiming] = useState7(null);
|
|
1848
|
-
|
|
2104
|
+
useEffect8(() => {
|
|
1849
2105
|
if (active) {
|
|
1850
2106
|
setRequestTiming({
|
|
1851
2107
|
startedAt: Date.now(),
|
|
@@ -1869,11 +2125,11 @@ var ChatToolbar = composable2(({ children, attendableId, alwaysActive, companion
|
|
|
1869
2125
|
chat,
|
|
1870
2126
|
companionTo
|
|
1871
2127
|
});
|
|
1872
|
-
return /* @__PURE__ */
|
|
2128
|
+
return /* @__PURE__ */ React17.createElement(Menu.Root, {
|
|
1873
2129
|
...menuActions,
|
|
1874
2130
|
attendableId,
|
|
1875
2131
|
alwaysActive
|
|
1876
|
-
}, /* @__PURE__ */
|
|
2132
|
+
}, /* @__PURE__ */ React17.createElement(Menu.Toolbar, {
|
|
1877
2133
|
...composableProps2(props),
|
|
1878
2134
|
ref: forwardedRef
|
|
1879
2135
|
}, children));
|
|
@@ -1881,7 +2137,7 @@ var ChatToolbar = composable2(({ children, attendableId, alwaysActive, companion
|
|
|
1881
2137
|
ChatToolbar.displayName = CHAT_TOOLBAR_NAME;
|
|
1882
2138
|
var CHAT_CONTENT_NAME = "Chat.Content";
|
|
1883
2139
|
var ChatContent = composable2(({ children, ...props }, forwardedRef) => {
|
|
1884
|
-
return /* @__PURE__ */
|
|
2140
|
+
return /* @__PURE__ */ React17.createElement("div", {
|
|
1885
2141
|
...composableProps2(props, {
|
|
1886
2142
|
classNames: "dx-expander flex flex-col"
|
|
1887
2143
|
}),
|
|
@@ -1891,7 +2147,7 @@ var ChatContent = composable2(({ children, ...props }, forwardedRef) => {
|
|
|
1891
2147
|
ChatContent.displayName = CHAT_CONTENT_NAME;
|
|
1892
2148
|
var CHAT_THREAD_NAME = "Chat.Thread";
|
|
1893
2149
|
var ChatThread2 = ({ viewType, debug: debugProp, onViewUsage, ...props }) => {
|
|
1894
|
-
const { t } =
|
|
2150
|
+
const { t } = useTranslation10(meta10.profile.key);
|
|
1895
2151
|
const { debug, event, messages, processor } = useChatContext(CHAT_THREAD_NAME);
|
|
1896
2152
|
const extensions = useChatKeymapExtensions2({
|
|
1897
2153
|
event
|
|
@@ -1901,8 +2157,8 @@ var ChatThread2 = ({ viewType, debug: debugProp, onViewUsage, ...props }) => {
|
|
|
1901
2157
|
const [toastError, setToastError] = useState7(void 0);
|
|
1902
2158
|
const toastAction = toastError instanceof AiUsageQuotaError ? toastError.action : void 0;
|
|
1903
2159
|
const debugView = viewType === "debug";
|
|
1904
|
-
const controllerRef =
|
|
1905
|
-
|
|
2160
|
+
const controllerRef = useRef5(null);
|
|
2161
|
+
useEffect8(() => {
|
|
1906
2162
|
return event.on((event2) => {
|
|
1907
2163
|
switch (event2.type) {
|
|
1908
2164
|
case "submit":
|
|
@@ -1923,17 +2179,17 @@ var ChatThread2 = ({ viewType, debug: debugProp, onViewUsage, ...props }) => {
|
|
|
1923
2179
|
}, [
|
|
1924
2180
|
event
|
|
1925
2181
|
]);
|
|
1926
|
-
const handleEvent =
|
|
2182
|
+
const handleEvent = useCallback9((ev) => {
|
|
1927
2183
|
event.emit(ev);
|
|
1928
2184
|
}, [
|
|
1929
2185
|
event
|
|
1930
2186
|
]);
|
|
1931
2187
|
if (!identity) {
|
|
1932
|
-
return /* @__PURE__ */
|
|
2188
|
+
return /* @__PURE__ */ React17.createElement("div", {
|
|
1933
2189
|
className: "dx-expander"
|
|
1934
2190
|
});
|
|
1935
2191
|
}
|
|
1936
|
-
return /* @__PURE__ */
|
|
2192
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(ChatThread, {
|
|
1937
2193
|
...props,
|
|
1938
2194
|
identity,
|
|
1939
2195
|
messages,
|
|
@@ -1943,18 +2199,18 @@ var ChatThread2 = ({ viewType, debug: debugProp, onViewUsage, ...props }) => {
|
|
|
1943
2199
|
extensions,
|
|
1944
2200
|
onEvent: handleEvent,
|
|
1945
2201
|
ref: controllerRef
|
|
1946
|
-
}), /* @__PURE__ */
|
|
2202
|
+
}), /* @__PURE__ */ React17.createElement(Toast.Root, {
|
|
1947
2203
|
type: "foreground",
|
|
1948
2204
|
open: !!toastError,
|
|
1949
2205
|
duration: 2e4,
|
|
1950
2206
|
onOpenChange: (open) => !open && setToastError(void 0)
|
|
1951
|
-
}, /* @__PURE__ */
|
|
2207
|
+
}, /* @__PURE__ */ React17.createElement(Toast.Title, {
|
|
1952
2208
|
icon: "ph--warning--regular",
|
|
1953
2209
|
onClose: () => setToastError(void 0)
|
|
1954
|
-
}, t("ai-service-error.label")), /* @__PURE__ */
|
|
2210
|
+
}, t("ai-service-error.label")), /* @__PURE__ */ React17.createElement(Toast.Description, null, toastError?.message), toastAction && onViewUsage && /* @__PURE__ */ React17.createElement(Toast.Actions, null, /* @__PURE__ */ React17.createElement(Toast.Action, {
|
|
1955
2211
|
altText: t(toastAction.labelKey),
|
|
1956
2212
|
asChild: true
|
|
1957
|
-
}, /* @__PURE__ */
|
|
2213
|
+
}, /* @__PURE__ */ React17.createElement(Button, {
|
|
1958
2214
|
onClick: () => {
|
|
1959
2215
|
setToastError(void 0);
|
|
1960
2216
|
onViewUsage();
|
|
@@ -1965,7 +2221,7 @@ ChatThread2.displayName = CHAT_THREAD_NAME;
|
|
|
1965
2221
|
var CHAT_PROMPT_NAME = "Chat.Prompt";
|
|
1966
2222
|
var ChatPrompt2 = (props) => {
|
|
1967
2223
|
const { chat, db, processor, event } = useChatContext(CHAT_PROMPT_NAME);
|
|
1968
|
-
return /* @__PURE__ */
|
|
2224
|
+
return /* @__PURE__ */ React17.createElement(ChatPrompt, {
|
|
1969
2225
|
...props,
|
|
1970
2226
|
chat,
|
|
1971
2227
|
db,
|
|
@@ -1977,16 +2233,17 @@ ChatPrompt2.displayName = CHAT_PROMPT_NAME;
|
|
|
1977
2233
|
var CHAT_TASK_LIST_NAME = "Chat.TaskList";
|
|
1978
2234
|
var ChatTaskList = composable2(({ plan: planProp, ...props }, forwardedRef) => {
|
|
1979
2235
|
const { chat } = useChatContext(CHAT_TASK_LIST_NAME);
|
|
1980
|
-
const
|
|
1981
|
-
|
|
1982
|
-
|
|
2236
|
+
const plan = useAtomValue4(useMemo10(() => Atom2.make((get) => planProp ?? Option3.fromNullable(chat).pipe(Option3.map((_) => get(Obj4.atom(_))), Option3.flatMapNullable((_) => _?.plan?.atom), Option3.map(get), Option3.getOrUndefined)), [
|
|
2237
|
+
chat,
|
|
2238
|
+
planProp
|
|
2239
|
+
]));
|
|
1983
2240
|
const space = chat ? getSpace(chat) : void 0;
|
|
1984
2241
|
const traceMessages = useTraceMessages(space);
|
|
1985
2242
|
const conversationId = chat?.feed?.target?.id;
|
|
1986
|
-
if (!plan) {
|
|
2243
|
+
if (!plan || !(plan.tasks?.length ?? 0)) {
|
|
1987
2244
|
return null;
|
|
1988
2245
|
}
|
|
1989
|
-
return /* @__PURE__ */
|
|
2246
|
+
return /* @__PURE__ */ React17.createElement(TaskList, {
|
|
1990
2247
|
...props,
|
|
1991
2248
|
plan,
|
|
1992
2249
|
space,
|
|
@@ -2009,9 +2266,10 @@ var Chat = {
|
|
|
2009
2266
|
// src/components/ProcessTree/ProcessTree.tsx
|
|
2010
2267
|
import * as Match from "effect/Match";
|
|
2011
2268
|
import * as Option4 from "effect/Option";
|
|
2012
|
-
import
|
|
2269
|
+
import React18, { useMemo as useMemo11 } from "react";
|
|
2013
2270
|
import { Process } from "@dxos/compute";
|
|
2014
|
-
import { Icon as
|
|
2271
|
+
import { Icon as Icon5, IconButton as IconButton4, ScrollArea, Tooltip as Tooltip2, composable as composable3, composableProps as composableProps3 } from "@dxos/react-ui";
|
|
2272
|
+
import { Treegrid, TREEGRID_PATH_SEPARATOR } from "@dxos/react-ui-list";
|
|
2015
2273
|
import { mx as mx7 } from "@dxos/ui-theme";
|
|
2016
2274
|
import { Unit as Unit2 } from "@dxos/util";
|
|
2017
2275
|
var DEFAULT_DEPTH = 1;
|
|
@@ -2021,20 +2279,20 @@ var NESTED_ACTIVE_STATES = /* @__PURE__ */ new Set([
|
|
|
2021
2279
|
Process.State.HYBERNATING,
|
|
2022
2280
|
Process.State.TERMINATING
|
|
2023
2281
|
]);
|
|
2024
|
-
var ProcessTree = /* @__PURE__ */
|
|
2025
|
-
const rows =
|
|
2282
|
+
var ProcessTree = /* @__PURE__ */ React18.memo(composable3(({ processes, depth = DEFAULT_DEPTH, onProcessSelect, onProcessTerminate, ...props }, forwardedRef) => {
|
|
2283
|
+
const rows = useMemo11(() => buildProcessTreeRows(processes, depth), [
|
|
2026
2284
|
processes,
|
|
2027
2285
|
depth
|
|
2028
2286
|
]);
|
|
2029
|
-
return /* @__PURE__ */
|
|
2287
|
+
return /* @__PURE__ */ React18.createElement(ScrollArea.Root, {
|
|
2030
2288
|
...composableProps3(props, {
|
|
2031
2289
|
classNames: "dx-expander"
|
|
2032
2290
|
}),
|
|
2033
2291
|
thin: true,
|
|
2034
2292
|
ref: forwardedRef
|
|
2035
|
-
}, /* @__PURE__ */
|
|
2293
|
+
}, /* @__PURE__ */ React18.createElement(ScrollArea.Viewport, null, /* @__PURE__ */ React18.createElement(Treegrid.Root, {
|
|
2036
2294
|
classNames: "grid grid-cols-[min-content_1fr_min-content_min-content]"
|
|
2037
|
-
}, rows.map(({ process, path }) => /* @__PURE__ */
|
|
2295
|
+
}, rows.map(({ process, path }) => /* @__PURE__ */ React18.createElement(ProcessTreeRowView, {
|
|
2038
2296
|
key: path.join(TREEGRID_PATH_SEPARATOR),
|
|
2039
2297
|
process,
|
|
2040
2298
|
path,
|
|
@@ -2046,38 +2304,38 @@ var ProcessTreeRowView = ({ process, path, onProcessSelect, onProcessTerminate }
|
|
|
2046
2304
|
const duration = Unit2.Duration(process.metrics.wallTime);
|
|
2047
2305
|
const level = path.length;
|
|
2048
2306
|
const nested = level > 1;
|
|
2049
|
-
return /* @__PURE__ */
|
|
2307
|
+
return /* @__PURE__ */ React18.createElement(Treegrid.Row, {
|
|
2050
2308
|
id: path.join(TREEGRID_PATH_SEPARATOR),
|
|
2051
2309
|
classNames: mx7("col-span-full grid grid-cols-subgrid gap-2 ps-1", onProcessSelect && "dx-hover")
|
|
2052
|
-
}, /* @__PURE__ */
|
|
2310
|
+
}, /* @__PURE__ */ React18.createElement(Treegrid.Cell, {
|
|
2053
2311
|
classNames: "flex items-center gap-0.5"
|
|
2054
|
-
}, nested && /* @__PURE__ */
|
|
2312
|
+
}, nested && /* @__PURE__ */ React18.createElement(Icon5, {
|
|
2055
2313
|
icon: "ph--arrow-elbow-down-right--regular",
|
|
2056
2314
|
size: 3,
|
|
2057
2315
|
classNames: "shrink-0 text-subdued"
|
|
2058
|
-
}), /* @__PURE__ */
|
|
2316
|
+
}), /* @__PURE__ */ React18.createElement(Tooltip2.Trigger, {
|
|
2059
2317
|
content: process.state.toString()
|
|
2060
|
-
}, /* @__PURE__ */
|
|
2318
|
+
}, /* @__PURE__ */ React18.createElement(Icon5, {
|
|
2061
2319
|
size: 4,
|
|
2062
2320
|
synchronized: true,
|
|
2063
2321
|
classNames: mx7(process.state === Process.State.RUNNING && "animate-spin", process.state === Process.State.FAILED && "text-error-text", process.state === Process.State.SUCCEEDED && "text-success-text"),
|
|
2064
2322
|
icon: Match.value(process.state).pipe(Match.when(Process.State.RUNNING, () => "ph--spinner-gap--regular"), Match.when(Process.State.SUCCEEDED, () => "ph--check-circle--regular"), Match.when(Process.State.FAILED, () => "ph--warning--regular"), Match.when(Process.State.HYBERNATING, () => "ph--spinner--regular"), Match.when(Process.State.IDLE, () => "ph--moon-stars--regular"), Match.when(Process.State.TERMINATING, () => "ph--x-circle--regular"), Match.when(Process.State.TERMINATED, () => "ph--x-circle--regular"), Match.orElse(() => "ph--spinner-gap--regular"))
|
|
2065
|
-
}))), /* @__PURE__ */
|
|
2323
|
+
}))), /* @__PURE__ */ React18.createElement(Treegrid.Cell, {
|
|
2066
2324
|
classNames: "flex items-center truncate",
|
|
2067
2325
|
style: nested ? {
|
|
2068
2326
|
paddingInlineStart: `${(level - 1) * LABEL_INDENT_REM}rem`
|
|
2069
2327
|
} : void 0,
|
|
2070
2328
|
onClick: () => onProcessSelect?.(process)
|
|
2071
|
-
}, /* @__PURE__ */
|
|
2329
|
+
}, /* @__PURE__ */ React18.createElement("span", {
|
|
2072
2330
|
className: mx7("truncate text-sm", level === 1 && "font-medium", process.state !== Process.State.RUNNING && "text-description")
|
|
2073
|
-
}, process.params.name ?? process.pid.toString())), /* @__PURE__ */
|
|
2331
|
+
}, process.params.name ?? process.pid.toString())), /* @__PURE__ */ React18.createElement(Treegrid.Cell, {
|
|
2074
2332
|
classNames: "flex items-center justify-end text-xs text-description tabular-nums"
|
|
2075
2333
|
}, [
|
|
2076
2334
|
Process.State.FAILED,
|
|
2077
2335
|
Process.State.SUCCEEDED
|
|
2078
|
-
].includes(process.state) && /* @__PURE__ */
|
|
2336
|
+
].includes(process.state) && /* @__PURE__ */ React18.createElement("span", {
|
|
2079
2337
|
className: "whitespace-nowrap"
|
|
2080
|
-
}, duration.toString())), /* @__PURE__ */
|
|
2338
|
+
}, duration.toString())), /* @__PURE__ */ React18.createElement(Treegrid.Cell, null, onProcessTerminate && /* @__PURE__ */ React18.createElement(IconButton4, {
|
|
2081
2339
|
classNames: "min-h-0 p-1",
|
|
2082
2340
|
icon: "ph--x--regular",
|
|
2083
2341
|
iconOnly: true,
|
|
@@ -2158,356 +2416,35 @@ var buildProcessTreeRows = (processes, maxDepth) => {
|
|
|
2158
2416
|
return rows;
|
|
2159
2417
|
};
|
|
2160
2418
|
|
|
2161
|
-
// src/components/TemplateEditor/TemplateEditor.tsx
|
|
2162
|
-
import { defaultHighlightStyle, syntaxHighlighting } from "@codemirror/language";
|
|
2163
|
-
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
2164
|
-
import React18 from "react";
|
|
2165
|
-
import { createDocAccessor } from "@dxos/echo-client";
|
|
2166
|
-
import { useThemeContext, useTranslation as useTranslation10 } from "@dxos/react-ui";
|
|
2167
|
-
import { composable as composable4, composableProps as composableProps4 } from "@dxos/react-ui";
|
|
2168
|
-
import { useTextEditor } from "@dxos/react-ui-editor";
|
|
2169
|
-
import { createBasicExtensions, createDataExtensions, createMarkdownExtensions, createThemeExtensions, decorateMarkdown } from "@dxos/ui-editor";
|
|
2170
|
-
import { isNonNullable as isNonNullable2 } from "@dxos/util";
|
|
2171
|
-
import { meta as meta10 } from "#meta";
|
|
2172
|
-
|
|
2173
|
-
// src/components/TemplateEditor/extensions/handlebars-extension.ts
|
|
2174
|
-
import { autocompletion, completionKeymap } from "@codemirror/autocomplete";
|
|
2175
|
-
import { RangeSetBuilder } from "@codemirror/state";
|
|
2176
|
-
import { Decoration, ViewPlugin, WidgetType as WidgetType7, keymap } from "@codemirror/view";
|
|
2177
|
-
import { Domino as Domino7, mx as mx8 } from "@dxos/ui";
|
|
2178
|
-
var handlebars = (_ = {}) => {
|
|
2179
|
-
return [
|
|
2180
|
-
handlebarsHighlightPlugin,
|
|
2181
|
-
autocompletion({
|
|
2182
|
-
activateOnTyping: true,
|
|
2183
|
-
aboveCursor: true,
|
|
2184
|
-
closeOnBlur: true,
|
|
2185
|
-
override: [
|
|
2186
|
-
handlebarsCompletions
|
|
2187
|
-
]
|
|
2188
|
-
}),
|
|
2189
|
-
keymap.of(completionKeymap)
|
|
2190
|
-
];
|
|
2191
|
-
};
|
|
2192
|
-
var regex = {
|
|
2193
|
-
// {{! comment }}
|
|
2194
|
-
comment: /\{\{!\s*[^}]*\}\}/g,
|
|
2195
|
-
// {{var}}
|
|
2196
|
-
brackets: /\{\{[^}]*\}\}/g,
|
|
2197
|
-
// {{#command}} {{/command}}
|
|
2198
|
-
command: /\{\{[#/]([^}]+)\}\}/g,
|
|
2199
|
-
// {{var}}
|
|
2200
|
-
var: /\{\{(?!\s*!)(\w[^}]*)\}\}/g,
|
|
2201
|
-
// @echo://space/id or @dxn:nsid
|
|
2202
|
-
dxn: /@?(?:echo:\/{1,3}[\w/]+|dxn:[\w.-]+)/g,
|
|
2203
|
-
// example.com/path/xxx
|
|
2204
|
-
url: /[\w.-]+\.[\w.-]+\/[\w/]+/g
|
|
2205
|
-
};
|
|
2206
|
-
var tagPadding = "mx-0.5 px-1 rounded-xs";
|
|
2207
|
-
var handlebarsHighlightPlugin = ViewPlugin.fromClass(class {
|
|
2208
|
-
decorations;
|
|
2209
|
-
constructor(view) {
|
|
2210
|
-
this.decorations = this.buildDecorations(view);
|
|
2211
|
-
}
|
|
2212
|
-
update(update) {
|
|
2213
|
-
if (update.docChanged || update.viewportChanged || update.selectionSet) {
|
|
2214
|
-
this.decorations = this.buildDecorations(update.view);
|
|
2215
|
-
}
|
|
2216
|
-
}
|
|
2217
|
-
// NOTE: Decorations may clash with other extensions (e.g., markdown).
|
|
2218
|
-
buildDecorations(view) {
|
|
2219
|
-
const selection = view.state.selection.main;
|
|
2220
|
-
const decorations = [];
|
|
2221
|
-
for (const { from, to } of view.visibleRanges) {
|
|
2222
|
-
const text = view.state.doc.sliceString(from, to);
|
|
2223
|
-
{
|
|
2224
|
-
let match;
|
|
2225
|
-
while ((match = regex.dxn.exec(text)) !== null) {
|
|
2226
|
-
const start = from + match.index;
|
|
2227
|
-
const end = start + match[0].length;
|
|
2228
|
-
const overlaps = selection.to > start && selection.from <= end;
|
|
2229
|
-
if (!overlaps) {
|
|
2230
|
-
decorations.push({
|
|
2231
|
-
from: start,
|
|
2232
|
-
to: end,
|
|
2233
|
-
decoration: Decoration.widget({
|
|
2234
|
-
widget: new DXNWidget(match[0])
|
|
2235
|
-
})
|
|
2236
|
-
});
|
|
2237
|
-
}
|
|
2238
|
-
}
|
|
2239
|
-
}
|
|
2240
|
-
{
|
|
2241
|
-
let match;
|
|
2242
|
-
while ((match = regex.url.exec(text)) !== null) {
|
|
2243
|
-
const start = from + match.index;
|
|
2244
|
-
const end = start + match[0].length;
|
|
2245
|
-
decorations.push({
|
|
2246
|
-
from: start,
|
|
2247
|
-
to: end,
|
|
2248
|
-
decoration: Decoration.mark({
|
|
2249
|
-
class: mx8("dx-tag--blue", tagPadding)
|
|
2250
|
-
})
|
|
2251
|
-
});
|
|
2252
|
-
}
|
|
2253
|
-
}
|
|
2254
|
-
{
|
|
2255
|
-
let match;
|
|
2256
|
-
while ((match = regex.brackets.exec(text)) !== null) {
|
|
2257
|
-
const start = from + match.index;
|
|
2258
|
-
const end = start + match[0].length;
|
|
2259
|
-
decorations.push({
|
|
2260
|
-
from: start,
|
|
2261
|
-
to: end,
|
|
2262
|
-
decoration: Decoration.mark({
|
|
2263
|
-
class: "text-subdued"
|
|
2264
|
-
})
|
|
2265
|
-
});
|
|
2266
|
-
}
|
|
2267
|
-
}
|
|
2268
|
-
{
|
|
2269
|
-
let match;
|
|
2270
|
-
while ((match = regex.command.exec(text)) !== null) {
|
|
2271
|
-
const start = from + match.index + 2;
|
|
2272
|
-
let end = start + match[0].length - 4;
|
|
2273
|
-
const text2 = view.state.doc.sliceString(start, end);
|
|
2274
|
-
const parts = text2.split(/\s+/);
|
|
2275
|
-
if (parts.length > 1) {
|
|
2276
|
-
const idx = start + parts[0].length;
|
|
2277
|
-
decorations.push({
|
|
2278
|
-
from: idx,
|
|
2279
|
-
to: end,
|
|
2280
|
-
decoration: Decoration.mark({
|
|
2281
|
-
class: "text-green-text"
|
|
2282
|
-
})
|
|
2283
|
-
});
|
|
2284
|
-
end = idx;
|
|
2285
|
-
}
|
|
2286
|
-
decorations.push({
|
|
2287
|
-
from: start,
|
|
2288
|
-
to: end,
|
|
2289
|
-
decoration: Decoration.mark({
|
|
2290
|
-
class: "text-blue-text"
|
|
2291
|
-
})
|
|
2292
|
-
});
|
|
2293
|
-
}
|
|
2294
|
-
}
|
|
2295
|
-
{
|
|
2296
|
-
let match;
|
|
2297
|
-
while ((match = regex.var.exec(text)) !== null) {
|
|
2298
|
-
const start = from + match.index + 2;
|
|
2299
|
-
const end = start + match[0].length - 4;
|
|
2300
|
-
decorations.push({
|
|
2301
|
-
from: start,
|
|
2302
|
-
to: end,
|
|
2303
|
-
decoration: Decoration.mark({
|
|
2304
|
-
class: "text-green-text"
|
|
2305
|
-
})
|
|
2306
|
-
});
|
|
2307
|
-
}
|
|
2308
|
-
}
|
|
2309
|
-
}
|
|
2310
|
-
decorations.sort((a, b) => a.from - b.from || a.to - b.to);
|
|
2311
|
-
const builder = new RangeSetBuilder();
|
|
2312
|
-
for (const { from, to, decoration } of decorations) {
|
|
2313
|
-
builder.add(from, to, decoration);
|
|
2314
|
-
}
|
|
2315
|
-
return builder.finish();
|
|
2316
|
-
}
|
|
2317
|
-
}, {
|
|
2318
|
-
decorations: (v) => v.decorations
|
|
2319
|
-
});
|
|
2320
|
-
var DXNWidget = class extends WidgetType7 {
|
|
2321
|
-
_identifier;
|
|
2322
|
-
constructor(_identifier) {
|
|
2323
|
-
super(), this._identifier = _identifier;
|
|
2324
|
-
}
|
|
2325
|
-
ignoreEvent() {
|
|
2326
|
-
return false;
|
|
2327
|
-
}
|
|
2328
|
-
eq(other) {
|
|
2329
|
-
return this._identifier === other._identifier;
|
|
2330
|
-
}
|
|
2331
|
-
toDOM() {
|
|
2332
|
-
const text = this._identifier.split(":").map((part) => {
|
|
2333
|
-
const len = 16;
|
|
2334
|
-
const plen = 4;
|
|
2335
|
-
if (part.length > len) {
|
|
2336
|
-
return `[${part.slice(0, plen)}\u2026${part.slice(-plen)}]`;
|
|
2337
|
-
}
|
|
2338
|
-
return part;
|
|
2339
|
-
}).join(":");
|
|
2340
|
-
return Domino7.of("span").classNames(mx8("font-mono dx-tag--blue", tagPadding)).text(text).root;
|
|
2341
|
-
}
|
|
2342
|
-
};
|
|
2343
|
-
var variables = [
|
|
2344
|
-
"this"
|
|
2345
|
-
];
|
|
2346
|
-
var commands = [
|
|
2347
|
-
"this",
|
|
2348
|
-
"each",
|
|
2349
|
-
"if",
|
|
2350
|
-
"unless",
|
|
2351
|
-
"with"
|
|
2352
|
-
];
|
|
2353
|
-
function handlebarsCompletions(context) {
|
|
2354
|
-
const match = context.matchBefore(/\{\{[^}]*/);
|
|
2355
|
-
if (!match || match.from === match.to) {
|
|
2356
|
-
return null;
|
|
2357
|
-
}
|
|
2358
|
-
let type = "variable";
|
|
2359
|
-
let text = match.text.slice(2);
|
|
2360
|
-
let from = match.from + 2;
|
|
2361
|
-
let matches = [];
|
|
2362
|
-
if (text.startsWith("#") || text.startsWith("/")) {
|
|
2363
|
-
const idx = text.lastIndexOf(" ");
|
|
2364
|
-
if (idx !== -1) {
|
|
2365
|
-
type = "variable";
|
|
2366
|
-
matches = variables;
|
|
2367
|
-
text = text.slice(idx + 1);
|
|
2368
|
-
from += idx + 1;
|
|
2369
|
-
} else {
|
|
2370
|
-
type = "command";
|
|
2371
|
-
text = text.slice(1);
|
|
2372
|
-
matches = commands;
|
|
2373
|
-
from += 1;
|
|
2374
|
-
}
|
|
2375
|
-
} else {
|
|
2376
|
-
type = "variable";
|
|
2377
|
-
matches = variables;
|
|
2378
|
-
}
|
|
2379
|
-
const options = matches.filter((name) => name.startsWith(text)).map((name) => ({
|
|
2380
|
-
type,
|
|
2381
|
-
label: name
|
|
2382
|
-
}));
|
|
2383
|
-
return {
|
|
2384
|
-
from,
|
|
2385
|
-
options
|
|
2386
|
-
};
|
|
2387
|
-
}
|
|
2388
|
-
|
|
2389
|
-
// src/components/TemplateEditor/extensions/xml-extension.ts
|
|
2390
|
-
import { syntaxTree } from "@codemirror/language";
|
|
2391
|
-
import { RangeSetBuilder as RangeSetBuilder2 } from "@codemirror/state";
|
|
2392
|
-
import { Decoration as Decoration2, ViewPlugin as ViewPlugin2 } from "@codemirror/view";
|
|
2393
|
-
var xmlDecorator = (_ = {}) => {
|
|
2394
|
-
return [
|
|
2395
|
-
xmlDecoratorPlugin
|
|
2396
|
-
];
|
|
2397
|
-
};
|
|
2398
|
-
var xmlDecoratorPlugin = ViewPlugin2.fromClass(class {
|
|
2399
|
-
decorations;
|
|
2400
|
-
constructor(view) {
|
|
2401
|
-
this.decorations = this.buildDecorations(view);
|
|
2402
|
-
}
|
|
2403
|
-
update(update) {
|
|
2404
|
-
if (update.docChanged || update.viewportChanged) {
|
|
2405
|
-
this.decorations = this.buildDecorations(update.view);
|
|
2406
|
-
}
|
|
2407
|
-
}
|
|
2408
|
-
buildDecorations(view) {
|
|
2409
|
-
const builder = new RangeSetBuilder2();
|
|
2410
|
-
for (const { from, to } of view.visibleRanges) {
|
|
2411
|
-
syntaxTree(view.state).iterate({
|
|
2412
|
-
from,
|
|
2413
|
-
to,
|
|
2414
|
-
enter: (node) => {
|
|
2415
|
-
if (node.name === "HTMLTag" || node.name === "OpenTag" || node.name === "CloseTag" || node.name === "SelfClosingTag" || node.name === "Element") {
|
|
2416
|
-
builder.add(node.from, node.to, Decoration2.mark({
|
|
2417
|
-
class: "font-mono text-subdued"
|
|
2418
|
-
}));
|
|
2419
|
-
}
|
|
2420
|
-
}
|
|
2421
|
-
});
|
|
2422
|
-
}
|
|
2423
|
-
return builder.finish();
|
|
2424
|
-
}
|
|
2425
|
-
}, {
|
|
2426
|
-
decorations: (v) => v.decorations
|
|
2427
|
-
});
|
|
2428
|
-
|
|
2429
|
-
// src/components/TemplateEditor/TemplateEditor.tsx
|
|
2430
|
-
var TemplateEditor = composable4(({ classNames, id, source, lineNumbers = true, ...props }, forwardedRef) => {
|
|
2431
|
-
const { t } = useTranslation10(meta10.profile.key);
|
|
2432
|
-
const { themeMode } = useThemeContext();
|
|
2433
|
-
const { parentRef } = useTextEditor(() => {
|
|
2434
|
-
const target = source?.target;
|
|
2435
|
-
if (!target) {
|
|
2436
|
-
return {};
|
|
2437
|
-
}
|
|
2438
|
-
return {
|
|
2439
|
-
initialValue: target.content ?? "",
|
|
2440
|
-
extensions: [
|
|
2441
|
-
createDataExtensions({
|
|
2442
|
-
id,
|
|
2443
|
-
text: createDocAccessor(target, [
|
|
2444
|
-
"content"
|
|
2445
|
-
])
|
|
2446
|
-
}),
|
|
2447
|
-
createBasicExtensions({
|
|
2448
|
-
bracketMatching: false,
|
|
2449
|
-
lineNumbers,
|
|
2450
|
-
lineWrapping: true,
|
|
2451
|
-
placeholder: t("template.placeholder")
|
|
2452
|
-
}),
|
|
2453
|
-
createThemeExtensions({
|
|
2454
|
-
themeMode
|
|
2455
|
-
}),
|
|
2456
|
-
createMarkdownExtensions(),
|
|
2457
|
-
decorateMarkdown(),
|
|
2458
|
-
handlebars(),
|
|
2459
|
-
// xml(),
|
|
2460
|
-
// NOTE: Since we're using markdown only HTML nodes are parsed.
|
|
2461
|
-
xmlDecorator(),
|
|
2462
|
-
syntaxHighlighting(defaultHighlightStyle)
|
|
2463
|
-
].filter(isNonNullable2)
|
|
2464
|
-
};
|
|
2465
|
-
}, [
|
|
2466
|
-
themeMode,
|
|
2467
|
-
source?.target,
|
|
2468
|
-
lineNumbers
|
|
2469
|
-
]);
|
|
2470
|
-
return /* @__PURE__ */ React18.createElement("div", {
|
|
2471
|
-
...composableProps4(props, {
|
|
2472
|
-
role: "none",
|
|
2473
|
-
classNames: [
|
|
2474
|
-
"h-full overflow-hidden",
|
|
2475
|
-
classNames
|
|
2476
|
-
]
|
|
2477
|
-
}),
|
|
2478
|
-
ref: composeRefs(parentRef, forwardedRef)
|
|
2479
|
-
});
|
|
2480
|
-
});
|
|
2481
|
-
|
|
2482
2419
|
// src/components/Toolbox/Toolbox.tsx
|
|
2483
|
-
import React19, { Fragment, useEffect as
|
|
2420
|
+
import React19, { Fragment, useEffect as useEffect9, useState as useState8 } from "react";
|
|
2484
2421
|
import { Operation } from "@dxos/compute";
|
|
2485
2422
|
import { Filter as Filter4 } from "@dxos/echo";
|
|
2486
|
-
import { log as
|
|
2423
|
+
import { log as log3 } from "@dxos/log";
|
|
2487
2424
|
import { useQuery as useQuery4 } from "@dxos/react-client/echo";
|
|
2488
2425
|
import { ScrollArea as ScrollArea2 } from "@dxos/react-ui";
|
|
2489
|
-
import { composable as
|
|
2490
|
-
import { mx as
|
|
2426
|
+
import { composable as composable4, composableProps as composableProps4 } from "@dxos/react-ui";
|
|
2427
|
+
import { mx as mx8 } from "@dxos/ui-theme";
|
|
2491
2428
|
import { ServiceType } from "#types";
|
|
2492
|
-
var
|
|
2493
|
-
var Toolbox =
|
|
2429
|
+
var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/Toolbox/Toolbox.tsx";
|
|
2430
|
+
var Toolbox = composable4(({ functions, services, skills, activeSkills, ...props }, forwardedRef) => {
|
|
2494
2431
|
return /* @__PURE__ */ React19.createElement(ScrollArea2.Root, {
|
|
2495
|
-
...
|
|
2432
|
+
...composableProps4(props),
|
|
2496
2433
|
thin: true,
|
|
2497
2434
|
orientation: "vertical",
|
|
2498
2435
|
ref: forwardedRef
|
|
2499
|
-
}, /* @__PURE__ */ React19.createElement(ScrollArea2.Viewport, null,
|
|
2500
|
-
title: "
|
|
2501
|
-
items:
|
|
2436
|
+
}, /* @__PURE__ */ React19.createElement(ScrollArea2.Viewport, null, skills && skills.length > 0 && /* @__PURE__ */ React19.createElement(Section, {
|
|
2437
|
+
title: "Skills",
|
|
2438
|
+
items: skills.map(({ name, description, tools }) => ({
|
|
2502
2439
|
name,
|
|
2503
2440
|
description,
|
|
2504
2441
|
subitems: tools.map((toolId) => ({
|
|
2505
2442
|
name: `\u2219 ${safeToolId(toolId)}`
|
|
2506
2443
|
}))
|
|
2507
2444
|
}))
|
|
2508
|
-
}),
|
|
2509
|
-
title: "
|
|
2510
|
-
items:
|
|
2445
|
+
}), activeSkills && activeSkills.length > 0 && /* @__PURE__ */ React19.createElement(Section, {
|
|
2446
|
+
title: "Skills",
|
|
2447
|
+
items: activeSkills.map(({ target }) => ({
|
|
2511
2448
|
name: target?.name ?? "",
|
|
2512
2449
|
description: target?.description ?? "",
|
|
2513
2450
|
subitems: target?.tools.map((toolId) => ({
|
|
@@ -2532,7 +2469,7 @@ Toolbox.displayName = "Toolbox";
|
|
|
2532
2469
|
var Section = ({ title, items, striped }) => {
|
|
2533
2470
|
const stripeClassNames = "odd:bg-neutral-50 dark:odd:bg-neutral-800";
|
|
2534
2471
|
const gridClassNames = "grid grid-cols-[8rem_1fr]";
|
|
2535
|
-
const subGridClassNames =
|
|
2472
|
+
const subGridClassNames = mx8("col-span-full grid grid-cols-subgrid text-xs px-2", striped && stripeClassNames);
|
|
2536
2473
|
return /* @__PURE__ */ React19.createElement("div", null, /* @__PURE__ */ React19.createElement("h1", {
|
|
2537
2474
|
className: "px-2 text-sm"
|
|
2538
2475
|
}, title), /* @__PURE__ */ React19.createElement("div", {
|
|
@@ -2547,7 +2484,7 @@ var Section = ({ title, items, striped }) => {
|
|
|
2547
2484
|
className: "line-clamp-2"
|
|
2548
2485
|
}, description)), subitems?.map(({ name: name2, description: description2 }, i2) => /* @__PURE__ */ React19.createElement("div", {
|
|
2549
2486
|
key: i2,
|
|
2550
|
-
className:
|
|
2487
|
+
className: mx8(subGridClassNames, striped && stripeClassNames)
|
|
2551
2488
|
}, /* @__PURE__ */ React19.createElement("div", {
|
|
2552
2489
|
className: "truncate"
|
|
2553
2490
|
}, name2), /* @__PURE__ */ React19.createElement("div", {
|
|
@@ -2557,10 +2494,10 @@ var Section = ({ title, items, striped }) => {
|
|
|
2557
2494
|
var ToolboxPanel = ({ classNames, db, processor }) => {
|
|
2558
2495
|
const services = useQuery4(db, Filter4.type(ServiceType));
|
|
2559
2496
|
const [serviceTools, setServiceTools] = useState8([]);
|
|
2560
|
-
|
|
2561
|
-
|
|
2497
|
+
useEffect9(() => {
|
|
2498
|
+
log3("creating service tools...", {
|
|
2562
2499
|
services: services.length
|
|
2563
|
-
}, { "~LogMeta": "~LogMeta", F:
|
|
2500
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 82, S: void 0 });
|
|
2564
2501
|
queueMicrotask(async () => {
|
|
2565
2502
|
});
|
|
2566
2503
|
}, [
|
|
@@ -2569,7 +2506,7 @@ var ToolboxPanel = ({ classNames, db, processor }) => {
|
|
|
2569
2506
|
const functions = useQuery4(db, Filter4.type(Operation.PersistentOperation));
|
|
2570
2507
|
return /* @__PURE__ */ React19.createElement(Toolbox, {
|
|
2571
2508
|
classNames,
|
|
2572
|
-
|
|
2509
|
+
skills: processor?.context.getSkills(),
|
|
2573
2510
|
services: serviceTools,
|
|
2574
2511
|
functions
|
|
2575
2512
|
});
|
|
@@ -2577,19 +2514,12 @@ var ToolboxPanel = ({ classNames, db, processor }) => {
|
|
|
2577
2514
|
var safeToolId = (name) => {
|
|
2578
2515
|
return name.split("_").pop();
|
|
2579
2516
|
};
|
|
2580
|
-
|
|
2581
|
-
// src/components/index.ts
|
|
2582
|
-
var AssistantSettings = lazy(() => import("../AssistantSettings-7ALY4BMS.mjs"));
|
|
2583
|
-
var RoutineProperties = lazy(() => import("../RoutineProperties-FISLMW2R.mjs"));
|
|
2584
2517
|
export {
|
|
2585
2518
|
AgentProperties,
|
|
2586
|
-
AssistantSettings,
|
|
2587
2519
|
Chat,
|
|
2588
2520
|
ChatPrompt,
|
|
2589
2521
|
ProcessTree,
|
|
2590
|
-
RoutineProperties,
|
|
2591
2522
|
TaskList,
|
|
2592
|
-
TemplateEditor,
|
|
2593
2523
|
Toolbox,
|
|
2594
2524
|
ToolboxPanel,
|
|
2595
2525
|
TracePanel
|