@dxos/plugin-assistant 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/AssistantSettings-PTNCDWC6.mjs +100 -0
- package/dist/lib/browser/AssistantSettings-PTNCDWC6.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +3 -7
- package/dist/lib/browser/chunk-EZRS3J25.mjs +30 -0
- package/dist/lib/browser/chunk-EZRS3J25.mjs.map +7 -0
- package/dist/lib/browser/chunk-OWBVGFDF.mjs +345 -0
- package/dist/lib/browser/chunk-OWBVGFDF.mjs.map +7 -0
- package/dist/lib/browser/chunk-RUV2WOQH.mjs +154 -0
- package/dist/lib/browser/chunk-RUV2WOQH.mjs.map +7 -0
- package/dist/lib/browser/chunk-YD4JTOO5.mjs +173 -0
- package/dist/lib/browser/chunk-YD4JTOO5.mjs.map +7 -0
- package/dist/lib/browser/create-chat-6G6WROW2.mjs +89 -0
- package/dist/lib/browser/create-chat-6G6WROW2.mjs.map +7 -0
- package/dist/lib/browser/ensure-companion-chat-F46BGW2T.mjs +65 -0
- package/dist/lib/browser/ensure-companion-chat-F46BGW2T.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +2458 -245
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/on-create-space-F5HHB3GI.mjs +22 -0
- package/dist/lib/browser/on-create-space-F5HHB3GI.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +13 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/resolve-navigation-targets-5Y7FT4CQ.mjs +22 -0
- package/dist/lib/browser/resolve-navigation-targets-5Y7FT4CQ.mjs.map +7 -0
- package/dist/lib/browser/run-prompt-in-new-chat-XSPRWOSR.mjs +144 -0
- package/dist/lib/browser/run-prompt-in-new-chat-XSPRWOSR.mjs.map +7 -0
- package/dist/lib/browser/set-current-chat-JPWBMS7N.mjs +35 -0
- package/dist/lib/browser/set-current-chat-JPWBMS7N.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -4
- package/dist/lib/browser/update-chat-name-AEMFSIJX.mjs +60 -0
- package/dist/lib/browser/update-chat-name-AEMFSIJX.mjs.map +7 -0
- package/dist/lib/node-esm/AssistantSettings-Z5ZZWWSN.mjs +101 -0
- package/dist/lib/node-esm/AssistantSettings-Z5ZZWWSN.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +3 -7
- package/dist/lib/node-esm/chunk-NZIKC7AN.mjs +32 -0
- package/dist/lib/node-esm/chunk-NZIKC7AN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-POJO5MTX.mjs +347 -0
- package/dist/lib/node-esm/chunk-POJO5MTX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-PY4X6FJT.mjs +155 -0
- package/dist/lib/node-esm/chunk-PY4X6FJT.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QHPGS4A4.mjs +174 -0
- package/dist/lib/node-esm/chunk-QHPGS4A4.mjs.map +7 -0
- package/dist/lib/node-esm/create-chat-EEMDTQRE.mjs +90 -0
- package/dist/lib/node-esm/create-chat-EEMDTQRE.mjs.map +7 -0
- package/dist/lib/node-esm/ensure-companion-chat-YAKJY7TB.mjs +66 -0
- package/dist/lib/node-esm/ensure-companion-chat-YAKJY7TB.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +2458 -245
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/on-create-space-YE5NQ3D2.mjs +23 -0
- package/dist/lib/node-esm/on-create-space-YE5NQ3D2.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +14 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/resolve-navigation-targets-W3GTFXDD.mjs +23 -0
- package/dist/lib/node-esm/resolve-navigation-targets-W3GTFXDD.mjs.map +7 -0
- package/dist/lib/node-esm/run-prompt-in-new-chat-Q2CLUUM4.mjs +145 -0
- package/dist/lib/node-esm/run-prompt-in-new-chat-Q2CLUUM4.mjs.map +7 -0
- package/dist/lib/node-esm/set-current-chat-ZBEFWS6P.mjs +36 -0
- package/dist/lib/node-esm/set-current-chat-ZBEFWS6P.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -4
- package/dist/lib/node-esm/update-chat-name-6F7COUGR.mjs +61 -0
- package/dist/lib/node-esm/update-chat-name-6F7COUGR.mjs.map +7 -0
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/assistant/blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/assistant/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/blueprint.test.d.ts +2 -0
- package/dist/types/src/blueprints/assistant/blueprint.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/index.d.ts +2 -0
- package/dist/types/src/blueprints/assistant/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +1 -6
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts +6 -0
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts +9 -0
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +7 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +41 -11
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +13 -0
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/markdown.d.ts +5 -0
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
- package/dist/types/src/capabilities/migrations.d.ts +5 -0
- package/dist/types/src/capabilities/migrations.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/{settings/settings.d.ts → settings.d.ts} +4 -3
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +21 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit.d.ts +6 -0
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +4 -6
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.stories.d.ts +511 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/index.d.ts +2 -1
- package/dist/types/src/components/AssistantSettings/index.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +23 -11
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +6 -3
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +491 -299
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts +14 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts.map +1 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts +8 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts.map +1 -0
- package/dist/types/src/components/ProcessTree/index.d.ts +2 -0
- package/dist/types/src/components/ProcessTree/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +9 -4
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +487 -295
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +487 -295
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +4 -4
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +14 -8
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +487 -295
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts +2 -2
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts.map +1 -1
- package/dist/types/src/components/Typewriter/Typewriter.d.ts.map +1 -1
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -12
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts +6 -0
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts.map +1 -0
- package/dist/types/src/containers/BlueprintArticle/index.d.ts +3 -0
- package/dist/types/src/containers/BlueprintArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts +14 -0
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/containers/ChatCompanion/index.d.ts +3 -0
- package/dist/types/src/containers/ChatCompanion/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/ChatContainer}/ChatContainer.d.ts +7 -6
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts.map +1 -0
- package/dist/types/src/containers/ChatContainer/index.d.ts +3 -0
- package/dist/types/src/containers/ChatContainer/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/ChatDialog}/ChatDialog.d.ts +2 -3
- package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts.map +1 -0
- package/dist/types/src/containers/ChatDialog/index.d.ts +3 -0
- package/dist/types/src/containers/ChatDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/ProjectArticle/ProjectArticle.d.ts +6 -0
- package/dist/types/src/containers/ProjectArticle/ProjectArticle.d.ts.map +1 -0
- package/dist/types/src/containers/ProjectArticle/index.d.ts +3 -0
- package/dist/types/src/containers/ProjectArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ProjectSettings/ProjectSettings.d.ts +6 -0
- package/dist/types/src/containers/ProjectSettings/ProjectSettings.d.ts.map +1 -0
- package/dist/types/src/containers/ProjectSettings/index.d.ts +3 -0
- package/dist/types/src/containers/ProjectSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts +6 -0
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PromptArticle/index.d.ts +3 -0
- package/dist/types/src/containers/PromptArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/PromptList/PromptList.d.ts +6 -0
- package/dist/types/src/containers/PromptList/PromptList.d.ts.map +1 -0
- package/dist/types/src/containers/PromptList/PromptList.stories.d.ts +517 -0
- package/dist/types/src/containers/PromptList/PromptList.stories.d.ts.map +1 -0
- package/dist/types/src/containers/PromptList/index.d.ts +3 -0
- package/dist/types/src/containers/PromptList/index.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts +6 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts +19 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.test.d.ts +2 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.test.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/index.d.ts +4 -0
- package/dist/types/src/containers/TracePanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts +4 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/index.d.ts +3 -0
- package/dist/types/src/containers/TriggerStatus/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +12 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/extensions/index.d.ts +2 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -0
- package/dist/types/src/extensions/prompt-extension.d.ts +10 -0
- package/dist/types/src/extensions/prompt-extension.d.ts.map +1 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +7 -6
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +3 -6
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts +2 -2
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -1
- package/dist/types/src/hooks/useFilteredTypes.d.ts +1 -1
- package/dist/types/src/hooks/useFilteredTypes.d.ts.map +1 -1
- package/dist/types/src/hooks/usePresets.d.ts +1 -1
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -1
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create-chat.d.ts +5 -0
- package/dist/types/src/operations/create-chat.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +134 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/ensure-companion-chat.d.ts +5 -0
- package/dist/types/src/operations/ensure-companion-chat.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/on-create-space.d.ts +5 -0
- package/dist/types/src/operations/on-create-space.d.ts.map +1 -0
- package/dist/types/src/operations/resolve-navigation-targets.d.ts +15 -0
- package/dist/types/src/operations/resolve-navigation-targets.d.ts.map +1 -0
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts +5 -0
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts.map +1 -0
- package/dist/types/src/operations/set-current-chat.d.ts +5 -0
- package/dist/types/src/operations/set-current-chat.d.ts.map +1 -0
- package/dist/types/src/operations/update-chat-name.d.ts +5 -0
- package/dist/types/src/operations/update-chat-name.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +27 -28
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/processor/update-name.d.ts +2 -2
- package/dist/types/src/processor/update-name.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts +1 -1
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +487 -295
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +17 -39
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +10 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +11 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +117 -92
- package/src/AssistantPlugin.tsx +151 -53
- package/src/blueprints/assistant/blueprint.conversations.json +1 -0
- package/src/blueprints/assistant/blueprint.test.ts +46 -0
- package/src/blueprints/assistant/blueprint.ts +31 -0
- package/src/blueprints/assistant/index.ts +5 -0
- package/src/blueprints/index.ts +1 -8
- package/src/capabilities/{ai-service/ai-service.ts → ai-service.ts} +4 -3
- package/src/capabilities/app-graph-builder.ts +208 -0
- package/src/capabilities/blueprint-definition.ts +58 -0
- package/src/capabilities/companion-chat-provisioner.ts +165 -0
- package/src/capabilities/{edge-model-resolver/edge-model-resolver.ts → edge-model-resolver.ts} +4 -3
- package/src/capabilities/index.ts +22 -11
- package/src/capabilities/{local-model-resolver/local-model-resolver.ts → local-model-resolver.ts} +4 -3
- package/src/capabilities/markdown.ts +39 -0
- package/src/capabilities/migrations.ts +34 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +153 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +5 -4
- package/src/capabilities/{state/state.ts → state.ts} +11 -3
- package/src/capabilities/toolkit.ts +13 -0
- package/src/components/AssistantSettings/AssistantSettings.stories.tsx +35 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +104 -92
- package/src/components/AssistantSettings/index.ts +4 -2
- package/src/components/Chat/Chat.tsx +72 -42
- package/src/components/ChatProgress/ChatProgress.tsx +9 -7
- package/src/components/ChatPrompt/ChatActions.tsx +12 -4
- package/src/components/ChatPrompt/ChatOptions.tsx +43 -29
- package/src/components/ChatPrompt/ChatReferences.tsx +18 -8
- package/src/components/ChatThread/ChatThread.stories.tsx +16 -16
- package/src/components/ChatThread/ChatThread.tsx +19 -6
- package/src/components/ChatThread/Link.tsx +1 -1
- package/src/components/ChatThread/registry.tsx +51 -18
- package/src/components/ChatThread/sync.test.ts +9 -7
- package/src/components/ChatThread/sync.ts +14 -8
- package/src/components/ProcessTree/ProcessTree.stories.tsx +109 -0
- package/src/components/ProcessTree/ProcessTree.tsx +85 -0
- package/src/components/ProcessTree/index.ts +5 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +4 -8
- package/src/components/TemplateEditor/TemplateEditor.tsx +50 -42
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +7 -5
- package/src/components/TemplateEditor/TemplateForm.tsx +9 -10
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +4 -4
- package/src/components/ToolBlock/ToolBlock.tsx +20 -20
- package/src/components/Toolbox/Toolbox.stories.tsx +4 -5
- package/src/components/Toolbox/Toolbox.tsx +65 -60
- package/src/components/Typewriter/AssistantToolbar.tsx +7 -7
- package/src/components/Typewriter/Typewriter.stories.tsx +18 -15
- package/src/components/Typewriter/Typewriter.tsx +6 -10
- package/src/components/Typewriter/assistant-extension.tsx +5 -8
- package/src/components/index.ts +3 -7
- package/src/containers/BlueprintArticle/BlueprintArticle.tsx +29 -0
- package/src/containers/BlueprintArticle/index.ts +7 -0
- package/src/{components → containers/ChatCompanion}/ChatCompanion.tsx +23 -43
- package/src/containers/ChatCompanion/index.ts +7 -0
- package/src/containers/ChatContainer/ChatContainer.tsx +95 -0
- package/src/containers/ChatContainer/index.ts +7 -0
- package/src/{components → containers/ChatDialog}/ChatDialog.tsx +10 -12
- package/src/containers/ChatDialog/index.ts +7 -0
- package/src/containers/ProjectArticle/ProjectArticle.tsx +127 -0
- package/src/containers/ProjectArticle/index.ts +7 -0
- package/src/containers/ProjectSettings/ProjectSettings.tsx +139 -0
- package/src/containers/ProjectSettings/index.ts +7 -0
- package/src/containers/PromptArticle/PromptArticle.tsx +59 -0
- package/src/containers/PromptArticle/index.ts +7 -0
- package/src/containers/PromptList/PromptList.stories.tsx +130 -0
- package/src/containers/PromptList/PromptList.tsx +49 -0
- package/src/containers/PromptList/index.ts +7 -0
- package/src/containers/TracePanel/TracePanel.tsx +258 -0
- package/src/containers/TracePanel/dxn-extractor.test.ts +153 -0
- package/src/containers/TracePanel/dxn-extractor.ts +178 -0
- package/src/containers/TracePanel/index.ts +9 -0
- package/src/containers/TriggerStatus/TriggerStatus.tsx +144 -0
- package/src/containers/TriggerStatus/index.ts +7 -0
- package/src/containers/index.ts +16 -0
- package/src/extensions/index.ts +5 -0
- package/src/extensions/prompt-extension.ts +111 -0
- package/src/hooks/useBlueprintRegistry.ts +8 -4
- package/src/hooks/useChatProcessor.ts +21 -15
- package/src/hooks/useChatServices.ts +7 -28
- package/src/hooks/useChatToolbarActions.ts +13 -12
- package/src/hooks/useContextObjects.ts +8 -4
- package/src/hooks/useFilteredTypes.ts +3 -3
- package/src/hooks/usePresets.ts +1 -1
- package/src/hooks/useReferencesProvider.ts +1 -5
- package/src/index.ts +1 -1
- package/src/meta.ts +5 -2
- package/src/operations/create-chat.ts +79 -0
- package/src/operations/definitions.ts +126 -0
- package/src/operations/ensure-companion-chat.ts +59 -0
- package/src/operations/index.ts +17 -0
- package/src/operations/on-create-space.ts +24 -0
- package/src/operations/resolve-navigation-targets.ts +26 -0
- package/src/operations/run-prompt-in-new-chat.ts +114 -0
- package/src/operations/set-current-chat.ts +35 -0
- package/src/operations/update-chat-name.ts +55 -0
- package/src/processor/processor.test.ts +16 -49
- package/src/processor/processor.ts +158 -127
- package/src/processor/update-name.ts +4 -5
- package/src/queue-logger.ts +2 -2
- package/src/testing/test-sequence.ts +3 -3
- package/src/testing/test-services.ts +2 -2
- package/src/translations.ts +125 -83
- package/src/types/Assistant.ts +8 -56
- package/src/types/Settings.ts +21 -0
- package/src/types/capabilities.ts +11 -3
- package/src/types/events.ts +2 -2
- package/src/types/index.ts +3 -1
- package/src/types/service.ts +5 -5
- package/dist/lib/browser/BlueprintArticle-WP3G5GLG.mjs +0 -31
- package/dist/lib/browser/BlueprintArticle-WP3G5GLG.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-ECQYUQ2B.mjs +0 -153
- package/dist/lib/browser/ChatCompanion-ECQYUQ2B.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-QCCOFBUX.mjs +0 -73
- package/dist/lib/browser/ChatContainer-QCCOFBUX.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-SMK4RSZU.mjs +0 -85
- package/dist/lib/browser/ChatDialog-SMK4RSZU.mjs.map +0 -7
- package/dist/lib/browser/PromptArticle-K362ZPAE.mjs +0 -53
- package/dist/lib/browser/PromptArticle-K362ZPAE.mjs.map +0 -7
- package/dist/lib/browser/ai-service-5GUDOEWF.mjs +0 -21
- package/dist/lib/browser/ai-service-5GUDOEWF.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-DSNH2OMY.mjs +0 -212
- package/dist/lib/browser/app-graph-builder-DSNH2OMY.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-DGHH7MUU.mjs +0 -14
- package/dist/lib/browser/blueprint-definition-DGHH7MUU.mjs.map +0 -7
- package/dist/lib/browser/chunk-3JYPE2MM.mjs +0 -1832
- package/dist/lib/browser/chunk-3JYPE2MM.mjs.map +0 -7
- package/dist/lib/browser/chunk-DKQMSMBN.mjs +0 -326
- package/dist/lib/browser/chunk-DKQMSMBN.mjs.map +0 -7
- package/dist/lib/browser/chunk-EXVT7D4B.mjs +0 -23
- package/dist/lib/browser/chunk-EXVT7D4B.mjs.map +0 -7
- package/dist/lib/browser/chunk-ML3QCFKA.mjs +0 -265
- package/dist/lib/browser/chunk-ML3QCFKA.mjs.map +0 -7
- package/dist/lib/browser/chunk-MRJVYGLU.mjs +0 -208
- package/dist/lib/browser/chunk-MRJVYGLU.mjs.map +0 -7
- package/dist/lib/browser/chunk-V772AMZM.mjs +0 -250
- package/dist/lib/browser/chunk-V772AMZM.mjs.map +0 -7
- package/dist/lib/browser/chunk-WGQTU6UJ.mjs +0 -41
- package/dist/lib/browser/chunk-WGQTU6UJ.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-26BOY6HY.mjs +0 -20
- package/dist/lib/browser/edge-model-resolver-26BOY6HY.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-ZFIM6GGV.mjs +0 -19
- package/dist/lib/browser/local-model-resolver-ZFIM6GGV.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-7XJLBRQY.mjs +0 -132
- package/dist/lib/browser/operation-resolver-7XJLBRQY.mjs.map +0 -7
- package/dist/lib/browser/react-surface-NCITRSJJ.mjs +0 -109
- package/dist/lib/browser/react-surface-NCITRSJJ.mjs.map +0 -7
- package/dist/lib/browser/repair-6QGAKOVM.mjs +0 -54
- package/dist/lib/browser/repair-6QGAKOVM.mjs.map +0 -7
- package/dist/lib/browser/settings-4ZDLUMYE.mjs +0 -32
- package/dist/lib/browser/settings-4ZDLUMYE.mjs.map +0 -7
- package/dist/lib/browser/state-AN6336ZX.mjs +0 -26
- package/dist/lib/browser/state-AN6336ZX.mjs.map +0 -7
- package/dist/lib/browser/toolkit-7AVTEPMA.mjs +0 -18
- package/dist/lib/browser/toolkit-7AVTEPMA.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintArticle-WZ76E2C4.mjs +0 -32
- package/dist/lib/node-esm/BlueprintArticle-WZ76E2C4.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-Q4FUZ2MW.mjs +0 -154
- package/dist/lib/node-esm/ChatCompanion-Q4FUZ2MW.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-AKI33HIB.mjs +0 -74
- package/dist/lib/node-esm/ChatContainer-AKI33HIB.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-AP45PVZR.mjs +0 -86
- package/dist/lib/node-esm/ChatDialog-AP45PVZR.mjs.map +0 -7
- package/dist/lib/node-esm/PromptArticle-D4HAIIC6.mjs +0 -54
- package/dist/lib/node-esm/PromptArticle-D4HAIIC6.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-PXKKCFIF.mjs +0 -22
- package/dist/lib/node-esm/ai-service-PXKKCFIF.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-TJCUEXW5.mjs +0 -213
- package/dist/lib/node-esm/app-graph-builder-TJCUEXW5.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-SEMDEIYG.mjs +0 -15
- package/dist/lib/node-esm/blueprint-definition-SEMDEIYG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-355W5B27.mjs +0 -251
- package/dist/lib/node-esm/chunk-355W5B27.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-75PHXBN3.mjs +0 -327
- package/dist/lib/node-esm/chunk-75PHXBN3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DCA5QWQT.mjs +0 -209
- package/dist/lib/node-esm/chunk-DCA5QWQT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MSBPC4RJ.mjs +0 -42
- package/dist/lib/node-esm/chunk-MSBPC4RJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs +0 -25
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XI5T3MJC.mjs +0 -1833
- package/dist/lib/node-esm/chunk-XI5T3MJC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZRIPP7YF.mjs +0 -267
- package/dist/lib/node-esm/chunk-ZRIPP7YF.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-G5KMODPO.mjs +0 -21
- package/dist/lib/node-esm/edge-model-resolver-G5KMODPO.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-KDZLYI7Y.mjs +0 -20
- package/dist/lib/node-esm/local-model-resolver-KDZLYI7Y.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-SX4WMNA7.mjs +0 -133
- package/dist/lib/node-esm/operation-resolver-SX4WMNA7.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-ST6V7LPE.mjs +0 -110
- package/dist/lib/node-esm/react-surface-ST6V7LPE.mjs.map +0 -7
- package/dist/lib/node-esm/repair-QJ7CQDKU.mjs +0 -55
- package/dist/lib/node-esm/repair-QJ7CQDKU.mjs.map +0 -7
- package/dist/lib/node-esm/settings-CQEOHR3R.mjs +0 -33
- package/dist/lib/node-esm/settings-CQEOHR3R.mjs.map +0 -7
- package/dist/lib/node-esm/state-HDON4REW.mjs +0 -27
- package/dist/lib/node-esm/state-HDON4REW.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-OWGCEKOO.mjs +0 -19
- package/dist/lib/node-esm/toolkit-OWGCEKOO.mjs.map +0 -7
- package/dist/types/src/blueprints/assistant-blueprint.d.ts +0 -209
- package/dist/types/src/blueprints/assistant-blueprint.d.ts.map +0 -1
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts +0 -5
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts.map +0 -1
- package/dist/types/src/capabilities/ai-service/index.d.ts +0 -3
- package/dist/types/src/capabilities/ai-service/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +0 -6
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -21
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -4
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts +0 -6
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/edge-model-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/edge-model-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/local-model-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/local-model-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts +0 -12
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/repair/index.d.ts +0 -3
- package/dist/types/src/capabilities/repair/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/repair/repair.d.ts +0 -6
- package/dist/types/src/capabilities/repair/repair.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -15
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/index.d.ts +0 -11
- package/dist/types/src/capabilities/state/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/state.d.ts +0 -13
- package/dist/types/src/capabilities/state/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/toolkit/index.d.ts +0 -3
- package/dist/types/src/capabilities/toolkit/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts +0 -5
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintArticle.d.ts +0 -7
- package/dist/types/src/components/BlueprintArticle.d.ts.map +0 -1
- package/dist/types/src/components/ChatCompanion.d.ts +0 -13
- package/dist/types/src/components/ChatCompanion.d.ts.map +0 -1
- package/dist/types/src/components/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/components/ChatDialog.d.ts.map +0 -1
- package/dist/types/src/components/PromptArticle.d.ts +0 -7
- package/dist/types/src/components/PromptArticle.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -4
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/object-list.d.ts +0 -10
- package/dist/types/src/functions/object-list.d.ts.map +0 -1
- package/dist/types/src/functions/object-load.d.ts +0 -8
- package/dist/types/src/functions/object-load.d.ts.map +0 -1
- package/dist/types/src/functions/object-search.d.ts +0 -10
- package/dist/types/src/functions/object-search.d.ts.map +0 -1
- package/dist/types/src/types/AssistantAction.d.ts +0 -95
- package/dist/types/src/types/AssistantAction.d.ts.map +0 -1
- package/src/blueprints/assistant-blueprint.ts +0 -62
- package/src/capabilities/ai-service/index.ts +0 -7
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -180
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +0 -60
- package/src/capabilities/blueprint-definition/index.ts +0 -8
- package/src/capabilities/edge-model-resolver/index.ts +0 -7
- package/src/capabilities/local-model-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -110
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -95
- package/src/capabilities/repair/index.ts +0 -7
- package/src/capabilities/repair/repair.ts +0 -63
- package/src/capabilities/settings/index.ts +0 -7
- package/src/capabilities/state/index.ts +0 -7
- package/src/capabilities/toolkit/index.ts +0 -7
- package/src/capabilities/toolkit/toolkit.ts +0 -26
- package/src/components/BlueprintArticle.tsx +0 -29
- package/src/components/ChatContainer.tsx +0 -61
- package/src/components/PromptArticle.tsx +0 -50
- package/src/functions/index.ts +0 -7
- package/src/functions/object-list.ts +0 -49
- package/src/functions/object-load.ts +0 -47
- package/src/functions/object-search.ts +0 -46
- package/src/types/AssistantAction.ts +0 -75
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities } from '@dxos/app-framework';
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
10
|
+
|
|
11
|
+
import { AssistantCapabilities } from '../types';
|
|
12
|
+
import { SetCurrentChat } from './definitions';
|
|
13
|
+
|
|
14
|
+
const handler: Operation.WithHandler<typeof SetCurrentChat> = SetCurrentChat.pipe(
|
|
15
|
+
Operation.withHandler(
|
|
16
|
+
Effect.fnUntraced(function* ({ companionTo, chat }) {
|
|
17
|
+
const companionToId = Obj.getDXN(companionTo).toString();
|
|
18
|
+
const chatId = chat && Obj.getDXN(chat).toString();
|
|
19
|
+
yield* Capabilities.updateAtomValue(AssistantCapabilities.State, (current) => ({
|
|
20
|
+
...current,
|
|
21
|
+
currentChat: { ...current.currentChat, [companionToId]: chatId },
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
// When clearing the selection (new thread), evict the cached transient chat so a fresh one is created.
|
|
25
|
+
if (!chat) {
|
|
26
|
+
yield* Capabilities.updateAtomValue(AssistantCapabilities.CompanionChatCache, (current) => {
|
|
27
|
+
const { [companionToId]: _, ...rest } = current;
|
|
28
|
+
return rest;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}),
|
|
32
|
+
),
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export default handler;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AiConversation } from '@dxos/assistant';
|
|
9
|
+
import { Feed, Obj } from '@dxos/echo';
|
|
10
|
+
import { Trace, TracingService } from '@dxos/functions';
|
|
11
|
+
import { invariant } from '@dxos/invariant';
|
|
12
|
+
import { Operation } from '@dxos/operation';
|
|
13
|
+
import { AutomationCapabilities } from '@dxos/plugin-automation/types';
|
|
14
|
+
import { ClientCapabilities } from '@dxos/plugin-client/types';
|
|
15
|
+
import { type Message } from '@dxos/types';
|
|
16
|
+
|
|
17
|
+
import { type AiChatServices, updateName } from '../processor';
|
|
18
|
+
import { UpdateChatName } from './definitions';
|
|
19
|
+
|
|
20
|
+
const handler: Operation.WithHandler<typeof UpdateChatName> = UpdateChatName.pipe(
|
|
21
|
+
Operation.withHandler(
|
|
22
|
+
Effect.fnUntraced(function* ({ chat }) {
|
|
23
|
+
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
24
|
+
const db = Obj.getDatabase(chat);
|
|
25
|
+
const feedTarget = chat.feed.target;
|
|
26
|
+
if (!db || !feedTarget) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const queueDxn = Feed.getQueueDxn(feedTarget);
|
|
30
|
+
invariant(queueDxn, 'Feed queue DXN not found.');
|
|
31
|
+
const client = yield* Capability.get(ClientCapabilities.Client);
|
|
32
|
+
const space = client.spaces.get(db.spaceId);
|
|
33
|
+
invariant(space, 'Space not found.');
|
|
34
|
+
const queue = space.queues.get<Message.Message>(queueDxn);
|
|
35
|
+
|
|
36
|
+
const runtimeResolver = yield* Capability.get(AutomationCapabilities.ComputeRuntime);
|
|
37
|
+
const runtime = yield* Effect.promise(() =>
|
|
38
|
+
runtimeResolver
|
|
39
|
+
.getRuntime(db.spaceId)
|
|
40
|
+
.runPromise(
|
|
41
|
+
Effect.runtime<AiChatServices>().pipe(
|
|
42
|
+
Effect.provide(TracingService.layerNoop),
|
|
43
|
+
Effect.provide(Trace.writerLayerNoop),
|
|
44
|
+
),
|
|
45
|
+
),
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
yield* Effect.promise(() =>
|
|
49
|
+
new AiConversation({ queue, registry }).use(async (conversation) => updateName(runtime, conversation, chat)),
|
|
50
|
+
);
|
|
51
|
+
}),
|
|
52
|
+
),
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
export default handler;
|
|
@@ -2,71 +2,38 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Tool from '@effect/ai/Tool';
|
|
6
|
-
import * as Toolkit from '@effect/ai/Toolkit';
|
|
7
5
|
import { describe, it } from '@effect/vitest';
|
|
8
6
|
import * as Effect from 'effect/Effect';
|
|
9
|
-
import * as
|
|
10
|
-
import * as Schema from 'effect/Schema';
|
|
7
|
+
import * as ManagedRuntime from 'effect/ManagedRuntime';
|
|
11
8
|
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
9
|
+
import { AiConversation } from '@dxos/assistant';
|
|
10
|
+
import { AssistantTestLayer } from '@dxos/assistant/testing';
|
|
11
|
+
import { Feed } from '@dxos/echo';
|
|
15
12
|
import { acquireReleaseResource } from '@dxos/effect';
|
|
16
13
|
import { TestHelpers } from '@dxos/effect/testing';
|
|
17
|
-
import {
|
|
18
|
-
import { FunctionInvocationServiceLayerTestMocked, TestDatabaseLayer } from '@dxos/functions-runtime/testing';
|
|
14
|
+
import { QueueService } from '@dxos/functions';
|
|
19
15
|
import { type Message } from '@dxos/types';
|
|
20
16
|
|
|
21
|
-
import { AiChatProcessor
|
|
17
|
+
import { AiChatProcessor } from './processor';
|
|
22
18
|
|
|
23
|
-
const TestToolkit = Toolkit.make(
|
|
24
|
-
Tool.make('random', {
|
|
25
|
-
description: 'Random number generator',
|
|
26
|
-
parameters: {},
|
|
27
|
-
success: Schema.Number,
|
|
28
|
-
}),
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
// TODO(burdon): Create minimal toolkit.
|
|
32
|
-
const toolkit = Toolkit.merge(TestToolkit) as Toolkit.Toolkit<any>;
|
|
33
|
-
|
|
34
|
-
// TODO(burdon): Explain structure.
|
|
35
|
-
const TestServicesLayer = Layer.mergeAll(
|
|
36
|
-
TracingService.layerNoop,
|
|
37
|
-
AiServiceTestingPreset('direct'),
|
|
38
|
-
TestDatabaseLayer({
|
|
39
|
-
// indexing: { vector: true },
|
|
40
|
-
// types: [],
|
|
41
|
-
}),
|
|
42
|
-
// CredentialsService.configuredLayer([{ service: 'exa.ai', apiKey: EXA_API_KEY }]),
|
|
43
|
-
FunctionInvocationServiceLayerTestMocked({ functions: [] }).pipe(Layer.provideMerge(TracingService.layerNoop)),
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
const TestLayer: Layer.Layer<AiChatServices, never, never> = Layer.mergeAll(
|
|
47
|
-
AiService.model('@anthropic/claude-opus-4-0'),
|
|
48
|
-
makeToolResolverFromFunctions([], toolkit),
|
|
49
|
-
makeToolExecutionServiceFromFunctions(toolkit, toolkit.toLayer({}) as any),
|
|
50
|
-
CredentialsService.layerFromDatabase(),
|
|
51
|
-
).pipe(Layer.provideMerge(TestServicesLayer), Layer.orDie);
|
|
52
|
-
|
|
53
|
-
// TODO(burdon): Create actual test with mock LLM.
|
|
54
19
|
describe('Chat processor', () => {
|
|
55
20
|
it.scoped(
|
|
56
21
|
'basic',
|
|
57
22
|
Effect.fn(
|
|
58
23
|
function* ({ expect }) {
|
|
59
|
-
const services = yield* Effect.runtime<AiChatServices>();
|
|
60
24
|
const queue = yield* QueueService.createQueue<Message.Message>();
|
|
61
25
|
const conversation = yield* acquireReleaseResource(() => new AiConversation({ queue }));
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
26
|
+
const runtime = yield* Effect.runtime<any>();
|
|
27
|
+
const managedRuntime = ManagedRuntime.make(
|
|
28
|
+
Effect.runSync(Effect.map(Effect.context<never>(), () => undefined as any)) as any,
|
|
29
|
+
);
|
|
30
|
+
const feed = Feed.make();
|
|
31
|
+
const processor = new AiChatProcessor(conversation, managedRuntime as any, feed);
|
|
32
|
+
expect(processor).toBeDefined();
|
|
33
|
+
expect(processor.active).toBeDefined();
|
|
67
34
|
},
|
|
68
|
-
Effect.provide(
|
|
69
|
-
TestHelpers.
|
|
35
|
+
Effect.provide(AssistantTestLayer({ tracing: 'noop' })),
|
|
36
|
+
TestHelpers.provideTestContext,
|
|
70
37
|
),
|
|
71
38
|
);
|
|
72
39
|
});
|
|
@@ -3,15 +3,13 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Atom, Registry } from '@effect-atom/atom-react';
|
|
6
|
-
import * as Cause from 'effect/Cause';
|
|
7
6
|
import * as Effect from 'effect/Effect';
|
|
8
|
-
import * as Exit from 'effect/Exit';
|
|
9
7
|
import * as Fiber from 'effect/Fiber';
|
|
10
8
|
import * as Option from 'effect/Option';
|
|
11
|
-
import * as
|
|
9
|
+
import * as Stream from 'effect/Stream';
|
|
12
10
|
|
|
13
11
|
import {
|
|
14
|
-
AiService,
|
|
12
|
+
type AiService,
|
|
15
13
|
DEFAULT_EDGE_MODEL,
|
|
16
14
|
type ModelName,
|
|
17
15
|
type ModelRegistry,
|
|
@@ -19,29 +17,34 @@ import {
|
|
|
19
17
|
type ToolResolverService,
|
|
20
18
|
} from '@dxos/ai';
|
|
21
19
|
import {
|
|
20
|
+
AiContextService,
|
|
22
21
|
type AiConversation,
|
|
23
|
-
type AiConversationRunProps,
|
|
24
|
-
ArtifactDiffResolver,
|
|
25
|
-
GenerationObserver,
|
|
26
22
|
createSystemPrompt,
|
|
23
|
+
formatSystemPrompt,
|
|
24
|
+
AgentService,
|
|
25
|
+
PartialBlock,
|
|
27
26
|
} from '@dxos/assistant';
|
|
27
|
+
import { type Chat } from '@dxos/assistant-toolkit';
|
|
28
28
|
import { type Blueprint } from '@dxos/blueprints';
|
|
29
|
-
import { Obj } from '@dxos/echo';
|
|
30
|
-
import { type Database } from '@dxos/echo';
|
|
31
|
-
import { runAndForwardErrors, throwCause } from '@dxos/effect';
|
|
29
|
+
import { type Database, Feed, Obj, Ref } from '@dxos/echo';
|
|
32
30
|
import {
|
|
31
|
+
Trace,
|
|
33
32
|
type CredentialsService,
|
|
34
33
|
type FunctionInvocationService,
|
|
35
34
|
type QueueService,
|
|
36
35
|
type TracingService,
|
|
37
36
|
} from '@dxos/functions';
|
|
37
|
+
import { runAndForwardErrors } from '@dxos/effect';
|
|
38
38
|
import { log } from '@dxos/log';
|
|
39
|
-
import {
|
|
40
|
-
|
|
41
|
-
import { type Assistant } from '../types';
|
|
39
|
+
import { Message } from '@dxos/types';
|
|
42
40
|
|
|
43
41
|
import { updateName } from './update-name';
|
|
42
|
+
import type { AutomationCapabilities } from '@dxos/plugin-automation/types';
|
|
44
43
|
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Services type for the old direct-conversation processor path.
|
|
46
|
+
* Retained for backward compatibility with CLI and update-name.
|
|
47
|
+
*/
|
|
45
48
|
export type AiChatServices =
|
|
46
49
|
| CredentialsService
|
|
47
50
|
| Database.Service
|
|
@@ -50,21 +53,25 @@ export type AiChatServices =
|
|
|
50
53
|
| AiService.AiService
|
|
51
54
|
| ToolExecutionService
|
|
52
55
|
| ToolResolverService
|
|
53
|
-
| TracingService
|
|
56
|
+
| TracingService
|
|
57
|
+
| Trace.TraceService;
|
|
54
58
|
|
|
55
59
|
export type AiChatProcessorOptions = {
|
|
56
60
|
model?: ModelName;
|
|
57
61
|
modelRegistry?: ModelRegistry;
|
|
58
62
|
blueprintRegistry?: Blueprint.Registry;
|
|
59
63
|
observableRegistry?: Registry.Registry;
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
/**
|
|
65
|
+
* For tracing.
|
|
66
|
+
*/
|
|
67
|
+
chat?: Ref.Ref<Chat.Chat>;
|
|
68
|
+
system?: string;
|
|
69
|
+
};
|
|
62
70
|
|
|
63
71
|
const defaultOptions: Partial<AiChatProcessorOptions> = {
|
|
64
72
|
model: DEFAULT_EDGE_MODEL,
|
|
65
73
|
};
|
|
66
74
|
|
|
67
|
-
// TODO(burdon): Retry, timeout?
|
|
68
75
|
export type AiRequestOptions = {};
|
|
69
76
|
|
|
70
77
|
export type AiRequest = {
|
|
@@ -74,55 +81,45 @@ export type AiRequest = {
|
|
|
74
81
|
|
|
75
82
|
/**
|
|
76
83
|
* Handles interactions with the AI service.
|
|
77
|
-
*
|
|
84
|
+
* Uses AgentService to spawn a process-backed agent and subscribes to ephemeral trace events for streaming.
|
|
78
85
|
*/
|
|
79
86
|
export class AiChatProcessor {
|
|
80
|
-
|
|
87
|
+
readonly #registry: Registry.Registry;
|
|
81
88
|
|
|
82
|
-
/**
|
|
83
|
-
|
|
89
|
+
/** Pending messages (finalized, non-streaming). */
|
|
90
|
+
readonly #pending = Atom.make<Message.Message[]>([]);
|
|
84
91
|
|
|
85
|
-
/**
|
|
86
|
-
|
|
92
|
+
/** Currently streaming messages (from ephemeral trace events). */
|
|
93
|
+
readonly #streaming = Atom.make<Message.Message[]>([]);
|
|
87
94
|
|
|
88
|
-
/**
|
|
89
|
-
|
|
95
|
+
/** Set of message IDs that have been finalized (non-pending delivered via ephemeral). */
|
|
96
|
+
readonly #finalizedIds = new Set<string>();
|
|
90
97
|
|
|
91
98
|
/** Currently active request fiber. */
|
|
92
|
-
|
|
99
|
+
#requestFiber: Fiber.RuntimeFiber<void, unknown> | undefined;
|
|
93
100
|
|
|
94
101
|
/** Last request (for retries). */
|
|
95
|
-
|
|
102
|
+
#lastRequest: AiRequest | undefined;
|
|
96
103
|
|
|
97
104
|
/** Streaming state. */
|
|
98
|
-
public readonly streaming = Atom.make<boolean>((get) =>
|
|
105
|
+
public readonly streaming = Atom.make<boolean>((get) => get(this.#streaming).length > 0);
|
|
99
106
|
|
|
100
107
|
/** Active state. */
|
|
101
108
|
public readonly active = Atom.make(false);
|
|
102
109
|
|
|
103
110
|
/** Array of Messages (incl. the current message being streamed). */
|
|
104
|
-
public readonly messages = Atom.make<Message.Message[]>((get) =>
|
|
105
|
-
Option.match(get(this._streaming), {
|
|
106
|
-
onNone: () => get(this._pending),
|
|
107
|
-
onSome: (streaming) => [...get(this._pending), streaming],
|
|
108
|
-
}),
|
|
109
|
-
);
|
|
111
|
+
public readonly messages = Atom.make<Message.Message[]>((get) => [...get(this.#pending), ...get(this.#streaming)]);
|
|
110
112
|
|
|
111
113
|
/** Last error. */
|
|
112
114
|
public readonly error = Atom.make<Option.Option<Error>>(Option.none());
|
|
113
115
|
|
|
114
116
|
constructor(
|
|
115
117
|
private readonly _conversation: AiConversation,
|
|
116
|
-
|
|
117
|
-
private readonly
|
|
118
|
+
private readonly _runtime: AutomationCapabilities.ComputeRuntime,
|
|
119
|
+
private readonly _feed: Feed.Feed,
|
|
118
120
|
private readonly _options: AiChatProcessorOptions = defaultOptions,
|
|
119
121
|
) {
|
|
120
|
-
|
|
121
|
-
this._registry = this._options.observableRegistry ?? Registry.make();
|
|
122
|
-
this._observer = GenerationObserver.make({
|
|
123
|
-
onBlock: this._onBlock,
|
|
124
|
-
onMessage: this._onMessage,
|
|
125
|
-
});
|
|
122
|
+
this.#registry = this._options.observableRegistry ?? Registry.make();
|
|
126
123
|
if (this._options.model && !this._options.system) {
|
|
127
124
|
const capabilities = this._options.modelRegistry?.getCapabilities(this._options.model) ?? {};
|
|
128
125
|
this._options.system = createSystemPrompt(capabilities);
|
|
@@ -141,52 +138,84 @@ export class AiChatProcessor {
|
|
|
141
138
|
return this._options.blueprintRegistry;
|
|
142
139
|
}
|
|
143
140
|
|
|
141
|
+
get system(): string {
|
|
142
|
+
return this._options.system ?? '';
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async getTools(): Promise<Record<string, any>> {
|
|
146
|
+
return this._runtime.runPromise(this._conversation.getTools());
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async getSystemPrompt(): Promise<string> {
|
|
150
|
+
return this._runtime.runPromise(
|
|
151
|
+
Effect.gen(this, function* () {
|
|
152
|
+
const blueprints = this.context.getBlueprints();
|
|
153
|
+
const objects = this.context.getObjects();
|
|
154
|
+
return yield* formatSystemPrompt({ system: this._options.system, blueprints, objects });
|
|
155
|
+
}).pipe(Effect.provideService(AiContextService, { binder: this.context }), Effect.orDie),
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
144
159
|
/**
|
|
145
|
-
* Initiates a new request.
|
|
160
|
+
* Initiates a new request via AgentService.
|
|
146
161
|
*/
|
|
147
162
|
async request(requestProp: AiRequest): Promise<void> {
|
|
148
|
-
if (this
|
|
163
|
+
if (this.#requestFiber) {
|
|
149
164
|
await this.cancel();
|
|
150
165
|
}
|
|
151
166
|
|
|
152
167
|
try {
|
|
153
|
-
this
|
|
154
|
-
this.
|
|
155
|
-
this.
|
|
168
|
+
this.#lastRequest = requestProp;
|
|
169
|
+
this.#registry.set(this.error, Option.none());
|
|
170
|
+
this.#registry.set(this.active, true);
|
|
171
|
+
|
|
172
|
+
const effect = Effect.gen(this, function* () {
|
|
173
|
+
const session = yield* AgentService.getSession(this._feed);
|
|
174
|
+
|
|
175
|
+
const ephemeralStream = session.subscribeEphemeral();
|
|
176
|
+
yield* ephemeralStream.pipe(
|
|
177
|
+
Stream.runForEach((message) =>
|
|
178
|
+
Effect.sync(() => {
|
|
179
|
+
for (const event of message.events) {
|
|
180
|
+
if (Trace.isOfType(PartialBlock, event)) {
|
|
181
|
+
this.#handleEphemeralMessage(event.data);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}),
|
|
185
|
+
),
|
|
186
|
+
Effect.fork,
|
|
187
|
+
);
|
|
156
188
|
|
|
157
|
-
|
|
189
|
+
log('chat processor submitting prompt', { length: requestProp.message.length });
|
|
190
|
+
yield* session.submitPrompt(requestProp.message);
|
|
191
|
+
log('chat processor submitPrompt returned, waiting for agent', {});
|
|
192
|
+
yield* session.waitForCompletion();
|
|
193
|
+
log.info('session complete');
|
|
158
194
|
|
|
159
|
-
|
|
160
|
-
const request = this._conversation.createRequest({
|
|
161
|
-
system: this._options.system,
|
|
162
|
-
prompt: requestProp.message,
|
|
163
|
-
observer: this._observer,
|
|
195
|
+
this.#flushStreaming();
|
|
164
196
|
});
|
|
165
197
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
// Execute request.
|
|
176
|
-
const response = await this._fiber.pipe(Fiber.join, Effect.runPromiseExit);
|
|
177
|
-
if (!Exit.isSuccess(response) && !Cause.isInterruptedOnly(response.cause)) {
|
|
178
|
-
throwCause(response.cause);
|
|
198
|
+
this.#requestFiber = this._runtime.runFork(effect);
|
|
199
|
+
|
|
200
|
+
try {
|
|
201
|
+
await this._runtime.runPromise(Fiber.join(this.#requestFiber));
|
|
202
|
+
} catch (err: any) {
|
|
203
|
+
if (err._tag === 'InterruptedException' || err.message?.includes('interrupted')) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
throw err;
|
|
179
207
|
}
|
|
180
208
|
|
|
181
|
-
this.
|
|
182
|
-
this
|
|
183
|
-
this
|
|
209
|
+
this.#registry.set(this.error, Option.none());
|
|
210
|
+
this.#lastRequest = undefined;
|
|
211
|
+
this.#requestFiber = undefined;
|
|
184
212
|
} catch (err) {
|
|
185
213
|
log.error('request failed', { error: err });
|
|
186
|
-
this.
|
|
214
|
+
this.#registry.set(this.error, Option.some(new Error('AI service error', { cause: err })));
|
|
187
215
|
} finally {
|
|
188
|
-
|
|
189
|
-
this.
|
|
216
|
+
log.info('setting active to false');
|
|
217
|
+
this.#registry.set(this.active, false);
|
|
218
|
+
this.#requestFiber = undefined;
|
|
190
219
|
}
|
|
191
220
|
}
|
|
192
221
|
|
|
@@ -196,80 +225,82 @@ export class AiChatProcessor {
|
|
|
196
225
|
async cancel(): Promise<void> {
|
|
197
226
|
await runAndForwardErrors(
|
|
198
227
|
Effect.gen(this, function* () {
|
|
199
|
-
if (this
|
|
200
|
-
yield*
|
|
228
|
+
if (this.#requestFiber) {
|
|
229
|
+
yield* Fiber.interrupt(this.#requestFiber);
|
|
201
230
|
}
|
|
202
231
|
}),
|
|
203
232
|
);
|
|
204
233
|
|
|
205
|
-
this
|
|
206
|
-
this.
|
|
234
|
+
this.#requestFiber = undefined;
|
|
235
|
+
this.#registry.set(this.active, false);
|
|
207
236
|
}
|
|
208
237
|
|
|
209
238
|
/**
|
|
210
239
|
* Retry last failed request.
|
|
211
240
|
*/
|
|
212
241
|
async retry(): Promise<void> {
|
|
213
|
-
if (this
|
|
214
|
-
return this.request(this
|
|
242
|
+
if (this.#lastRequest) {
|
|
243
|
+
return this.request(this.#lastRequest);
|
|
215
244
|
}
|
|
216
245
|
}
|
|
217
246
|
|
|
218
247
|
/**
|
|
219
248
|
* Update the current chat's name.
|
|
220
249
|
*/
|
|
221
|
-
async updateName(chat:
|
|
222
|
-
const runtime = await this.
|
|
250
|
+
async updateName(chat: Chat.Chat): Promise<void> {
|
|
251
|
+
const runtime = await this._runtime.runPromise(Effect.runtime<any>());
|
|
223
252
|
await updateName(runtime, this._conversation, chat, this._options.model);
|
|
224
253
|
}
|
|
225
254
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
// version: getVersion(object),
|
|
241
|
-
// diff: `Current state: ${JSON.stringify(object)}`,
|
|
242
|
-
// });
|
|
243
|
-
// }),
|
|
244
|
-
// );
|
|
245
|
-
|
|
246
|
-
return versions;
|
|
247
|
-
},
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
private _onMessage = Effect.fn(
|
|
251
|
-
function* (this: AiChatProcessor, message: Message.Message) {
|
|
252
|
-
this._registry.set(this._streaming, Option.none());
|
|
253
|
-
this._registry.update(this._pending, (pending) => [...pending, message]);
|
|
254
|
-
}.bind(this),
|
|
255
|
-
);
|
|
256
|
-
|
|
257
|
-
private _onBlock = Effect.fn(
|
|
258
|
-
function* (this: AiChatProcessor, block: ContentBlock.Any) {
|
|
259
|
-
this._registry.update(this._streaming, (streaming) => {
|
|
260
|
-
const blocks = streaming.pipe(
|
|
261
|
-
Option.map((streaming) => streaming.blocks.filter((b: ContentBlock.Any) => !b.pending)),
|
|
262
|
-
Option.getOrElse(() => []),
|
|
263
|
-
);
|
|
255
|
+
/**
|
|
256
|
+
* Handles an ephemeral message from the agent process.
|
|
257
|
+
* Both pending and completed blocks arrive here. Completed blocks are deduped
|
|
258
|
+
* against messages already written to the feed queue to handle the race between
|
|
259
|
+
* ephemeral delivery and feed replication.
|
|
260
|
+
*/
|
|
261
|
+
#handleEphemeralMessage(event: Trace.PayloadType<typeof PartialBlock>) {
|
|
262
|
+
const isPending = event.block.pending;
|
|
263
|
+
const message = Obj.make(Message.Message, {
|
|
264
|
+
id: event.messageId,
|
|
265
|
+
created: new Date().toISOString(),
|
|
266
|
+
sender: { role: event.role },
|
|
267
|
+
blocks: [event.block],
|
|
268
|
+
});
|
|
264
269
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
)
|
|
270
|
+
if (isPending) {
|
|
271
|
+
if (this.#finalizedIds.has(event.messageId)) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
this.#registry.update(this.#streaming, (streaming) => {
|
|
275
|
+
const idx = streaming.findIndex((existing) => existing.id === event.messageId);
|
|
276
|
+
if (idx >= 0) {
|
|
277
|
+
const updated = [...streaming];
|
|
278
|
+
updated[idx] = message;
|
|
279
|
+
return updated;
|
|
280
|
+
}
|
|
281
|
+
return [...streaming, message];
|
|
272
282
|
});
|
|
273
|
-
}
|
|
274
|
-
|
|
283
|
+
} else {
|
|
284
|
+
this.#finalizedIds.add(event.messageId);
|
|
285
|
+
this.#registry.update(this.#streaming, (streaming) => streaming.filter((existing) => existing.id !== message.id));
|
|
286
|
+
this.#registry.update(this.#pending, (pending) => {
|
|
287
|
+
if (pending.some((existing) => existing.id === message.id)) {
|
|
288
|
+
return pending;
|
|
289
|
+
}
|
|
290
|
+
return [...pending, message];
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Move remaining streaming messages to pending (called when agent completes).
|
|
297
|
+
*/
|
|
298
|
+
#flushStreaming() {
|
|
299
|
+
const remaining = this.#registry.get(this.#streaming);
|
|
300
|
+
if (remaining.length > 0) {
|
|
301
|
+
this.#registry.update(this.#pending, (pending) => [...pending, ...remaining]);
|
|
302
|
+
this.#registry.set(this.#streaming, []);
|
|
303
|
+
}
|
|
304
|
+
this.#finalizedIds.clear();
|
|
305
|
+
}
|
|
275
306
|
}
|
|
@@ -9,12 +9,11 @@ import * as Runtime from 'effect/Runtime';
|
|
|
9
9
|
|
|
10
10
|
import { AiService, DEFAULT_EDGE_MODEL, type ModelName } from '@dxos/ai';
|
|
11
11
|
import { type AiConversation, AiSession } from '@dxos/assistant';
|
|
12
|
+
import { type Chat } from '@dxos/assistant-toolkit';
|
|
12
13
|
import { Obj } from '@dxos/echo';
|
|
13
14
|
import { throwCause } from '@dxos/effect';
|
|
14
15
|
import { trim } from '@dxos/util';
|
|
15
16
|
|
|
16
|
-
import { type Assistant } from '../types';
|
|
17
|
-
|
|
18
17
|
import { type AiChatServices } from './processor';
|
|
19
18
|
|
|
20
19
|
/**
|
|
@@ -24,7 +23,7 @@ import { type AiChatServices } from './processor';
|
|
|
24
23
|
export const updateName = async (
|
|
25
24
|
runtime: Runtime.Runtime<AiChatServices>,
|
|
26
25
|
conversation: AiConversation,
|
|
27
|
-
chat:
|
|
26
|
+
chat: Chat.Chat,
|
|
28
27
|
model: ModelName = DEFAULT_EDGE_MODEL,
|
|
29
28
|
): Promise<void> => {
|
|
30
29
|
const history = await conversation.getHistory();
|
|
@@ -44,8 +43,8 @@ export const updateName = async (
|
|
|
44
43
|
const message = messages.find((message) => message.sender.role === 'assistant');
|
|
45
44
|
const title = message?.blocks.find((block) => block._tag === 'text')?.text;
|
|
46
45
|
if (title) {
|
|
47
|
-
Obj.change(chat, (
|
|
48
|
-
|
|
46
|
+
Obj.change(chat, (obj) => {
|
|
47
|
+
obj.name = title;
|
|
49
48
|
});
|
|
50
49
|
}
|
|
51
50
|
}),
|
package/src/queue-logger.ts
CHANGED
|
@@ -24,8 +24,8 @@ export class QueueLogger implements SequenceLogger {
|
|
|
24
24
|
if (!dxn) {
|
|
25
25
|
dxn = DXN.fromQueue(QueueSubspaceTags.TRACE, this._space.id, Key.ObjectId.random());
|
|
26
26
|
const newDxn = dxn;
|
|
27
|
-
Obj.change(this._space.properties, (
|
|
28
|
-
|
|
27
|
+
Obj.change(this._space.properties, (obj) => {
|
|
28
|
+
obj.invocationTraceQueue = Ref.fromDXN(newDxn);
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
this._invocationTraceQueue = this._space.queues.get(dxn);
|
|
@@ -9,16 +9,16 @@ export const RESEARCH_SEQUENCE_DEFINITION: SequenceDefinition = {
|
|
|
9
9
|
steps: [
|
|
10
10
|
{
|
|
11
11
|
instructions: 'Research information and entities related to the selected objects.',
|
|
12
|
-
tools: [ToolId.make('search/
|
|
12
|
+
tools: [ToolId.make('search/web-search')],
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
instructions:
|
|
16
16
|
'Based on your research find matching entires that are already in the graph. Do exaustive research.',
|
|
17
|
-
tools: [ToolId.make('search/
|
|
17
|
+
tools: [ToolId.make('search/local-search')],
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
instructions: 'Add researched data to the graph. Make connections to existing objects.',
|
|
21
|
-
tools: [ToolId.make('search/
|
|
21
|
+
tools: [ToolId.make('search/local-search'), ToolId.make('graph/writer')],
|
|
22
22
|
},
|
|
23
23
|
],
|
|
24
24
|
};
|