@dxos/plugin-assistant 0.8.4-main.67995b8 → 0.8.4-main.ae835ea
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/{BlueprintContainer-IZ4AK5EO.mjs → BlueprintContainer-GMSYKGSO.mjs} +14 -6
- package/dist/lib/browser/BlueprintContainer-GMSYKGSO.mjs.map +7 -0
- package/dist/lib/browser/ChatCompanion-M3FDKTQM.mjs +151 -0
- package/dist/lib/browser/ChatCompanion-M3FDKTQM.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-RP3QEXYX.mjs → ChatContainer-KAH7XITI.mjs} +34 -14
- package/dist/lib/browser/ChatContainer-KAH7XITI.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-ZVLXFHEY.mjs → ChatDialog-ZWRGABW6.mjs} +27 -12
- package/dist/lib/browser/ChatDialog-ZWRGABW6.mjs.map +7 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs +19 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-XSEOKJLG.mjs → app-graph-builder-R5T7BJPC.mjs} +60 -41
- package/dist/lib/browser/app-graph-builder-R5T7BJPC.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-AGTDXTXO.mjs +13 -0
- package/dist/lib/browser/blueprint-definition-AGTDXTXO.mjs.map +7 -0
- package/dist/lib/browser/chunk-357IHWQL.mjs +1519 -0
- package/dist/lib/browser/chunk-357IHWQL.mjs.map +7 -0
- package/dist/lib/browser/chunk-A2NVNXPL.mjs +170 -0
- package/dist/lib/browser/chunk-A2NVNXPL.mjs.map +7 -0
- package/dist/lib/browser/chunk-CQW6UPJM.mjs +199 -0
- package/dist/lib/browser/chunk-CQW6UPJM.mjs.map +7 -0
- package/dist/lib/browser/chunk-GNI6HL6G.mjs +219 -0
- package/dist/lib/browser/chunk-GNI6HL6G.mjs.map +7 -0
- package/dist/lib/browser/chunk-GXHZTOWJ.mjs +378 -0
- package/dist/lib/browser/chunk-GXHZTOWJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-L5OA5OGS.mjs +262 -0
- package/dist/lib/browser/chunk-L5OA5OGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-MEN5WTLA.mjs +182 -0
- package/dist/lib/browser/chunk-MEN5WTLA.mjs.map +7 -0
- package/dist/lib/browser/chunk-PUG24BEC.mjs +277 -0
- package/dist/lib/browser/chunk-PUG24BEC.mjs.map +7 -0
- package/dist/lib/browser/chunk-SJJV3HEX.mjs +16 -0
- package/dist/lib/browser/chunk-SJJV3HEX.mjs.map +7 -0
- package/dist/lib/browser/chunk-WBG5PTSX.mjs +23 -0
- package/dist/lib/browser/chunk-WBG5PTSX.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs +18 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +185 -76
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-3C5TABOX.mjs +136 -0
- package/dist/lib/browser/intent-resolver-3C5TABOX.mjs.map +7 -0
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs +17 -0
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-EYKA5IFU.mjs +90 -0
- package/dist/lib/browser/react-surface-EYKA5IFU.mjs.map +7 -0
- package/dist/lib/browser/{settings-5GTTCVGD.mjs → settings-VMVBYZLN.mjs} +8 -7
- package/dist/lib/{node-esm/settings-J2EXEM5H.mjs.map → browser/settings-VMVBYZLN.mjs.map} +1 -1
- package/dist/lib/browser/state-CFREPBB6.mjs +21 -0
- package/dist/lib/browser/state-CFREPBB6.mjs.map +7 -0
- package/dist/lib/browser/toolkit-F3NQ7TSI.mjs +21 -0
- package/dist/lib/browser/toolkit-F3NQ7TSI.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -4
- package/dist/lib/node-esm/{BlueprintContainer-RGTMNLNX.mjs → BlueprintContainer-6GBLMK4Z.mjs} +14 -6
- package/dist/lib/node-esm/BlueprintContainer-6GBLMK4Z.mjs.map +7 -0
- package/dist/lib/node-esm/ChatCompanion-OV426GCP.mjs +152 -0
- package/dist/lib/node-esm/ChatCompanion-OV426GCP.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-W3W6FWV3.mjs → ChatContainer-UKY7NHFY.mjs} +34 -14
- package/dist/lib/node-esm/ChatContainer-UKY7NHFY.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-QW4JRKVO.mjs → ChatDialog-2BDQIEXH.mjs} +27 -12
- package/dist/lib/node-esm/ChatDialog-2BDQIEXH.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs +20 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-PANCJUHV.mjs → app-graph-builder-I52RYVWH.mjs} +60 -41
- package/dist/lib/node-esm/app-graph-builder-I52RYVWH.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-CFCUD2VC.mjs +14 -0
- package/dist/lib/node-esm/blueprint-definition-CFCUD2VC.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-2CAETDW2.mjs +183 -0
- package/dist/lib/node-esm/chunk-2CAETDW2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4J5FYNNM.mjs +171 -0
- package/dist/lib/node-esm/chunk-4J5FYNNM.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-5ARE4R2I.mjs +220 -0
- package/dist/lib/node-esm/chunk-5ARE4R2I.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7ZYOYW7F.mjs +264 -0
- package/dist/lib/node-esm/chunk-7ZYOYW7F.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HJPIYMWD.mjs +1520 -0
- package/dist/lib/node-esm/chunk-HJPIYMWD.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-O36P4LN5.mjs +200 -0
- package/dist/lib/node-esm/chunk-O36P4LN5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WE6KTH72.mjs +25 -0
- package/dist/lib/node-esm/chunk-WE6KTH72.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XM4BVQQR.mjs +278 -0
- package/dist/lib/node-esm/chunk-XM4BVQQR.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XQBL2SBL.mjs +17 -0
- package/dist/lib/node-esm/chunk-XQBL2SBL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YIO5MEPR.mjs +380 -0
- package/dist/lib/node-esm/chunk-YIO5MEPR.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs +19 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +185 -76
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-HQ27YALS.mjs +137 -0
- package/dist/lib/node-esm/intent-resolver-HQ27YALS.mjs.map +7 -0
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs +18 -0
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-UOC3CBPH.mjs +91 -0
- package/dist/lib/node-esm/react-surface-UOC3CBPH.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-J2EXEM5H.mjs → settings-7AUVNDM2.mjs} +8 -7
- package/dist/lib/{browser/settings-5GTTCVGD.mjs.map → node-esm/settings-7AUVNDM2.mjs.map} +1 -1
- package/dist/lib/node-esm/state-XXND44OW.mjs +22 -0
- package/dist/lib/node-esm/state-XXND44OW.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-7CH5UNSQ.mjs +22 -0
- package/dist/lib/node-esm/toolkit-7CH5UNSQ.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +7 -4
- package/dist/types/src/AssistantPlugin.d.ts +1 -1
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts +4 -0
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +7 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +11 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +11 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +10 -0
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/capabilities/state.d.ts +4 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit.d.ts +4 -0
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/BlueprintContainer.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +21 -17
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +5 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts +13 -0
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +4 -4
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +7 -0
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
- package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
- package/dist/types/src/components/ChatProgress/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +20 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +4 -5
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +12 -7
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +120 -33
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/reducers.d.ts +40 -0
- package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/registry.d.ts +11 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.d.ts +36 -0
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts +2 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts.map +1 -0
- package/dist/types/src/components/ChatToolbar/ChatToolbar.d.ts +6 -0
- package/dist/types/src/components/ChatToolbar/ChatToolbar.d.ts.map +1 -0
- package/dist/types/src/components/ChatToolbar/index.d.ts +2 -0
- package/dist/types/src/components/ChatToolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatToolbar/useChatToolbarActions.d.ts +9 -0
- package/dist/types/src/components/ChatToolbar/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -6
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +265 -7
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +262 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts +12 -0
- package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +19 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts +2 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/index.d.ts +3 -0
- package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +6 -11
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +266 -5
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -5
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/functions/analysis.d.ts +5 -0
- package/dist/types/src/functions/analysis.d.ts.map +1 -0
- package/dist/types/src/functions/index.d.ts +4 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/object-list.d.ts +10 -0
- package/dist/types/src/functions/object-list.d.ts.map +1 -0
- package/dist/types/src/functions/object-load.d.ts +8 -0
- package/dist/types/src/functions/object-load.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +7 -3
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +25 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +8 -21
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +5 -6
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextBinder.d.ts +4 -0
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
- package/dist/types/src/hooks/useFlush.d.ts +6 -0
- package/dist/types/src/hooks/useFlush.d.ts.map +1 -0
- package/dist/types/src/hooks/useItemTypes.d.ts +4 -0
- package/dist/types/src/hooks/useItemTypes.d.ts.map +1 -0
- package/dist/types/src/hooks/useOnline.d.ts +3 -0
- package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
- package/dist/types/src/hooks/usePresets.d.ts +7 -0
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +4 -0
- package/dist/types/src/processor/index.d.ts.map +1 -0
- package/dist/types/src/{hooks → processor}/presets.d.ts +3 -3
- package/dist/types/src/processor/presets.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +74 -0
- package/dist/types/src/processor/processor.d.ts.map +1 -0
- package/dist/types/src/processor/processor.test.d.ts +2 -0
- package/dist/types/src/processor/processor.test.d.ts.map +1 -0
- package/dist/types/src/processor/update-name.d.ts +10 -0
- package/dist/types/src/processor/update-name.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +7 -0
- package/dist/types/src/testing/test-generator.d.ts.map +1 -0
- package/dist/types/src/testing/test-sequence.d.ts +0 -4
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts +2 -2
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/toolkits/AssistantToolkit.d.ts +21 -0
- package/dist/types/src/toolkits/AssistantToolkit.d.ts.map +1 -0
- package/dist/types/src/toolkits/SystemToolkit.d.ts +69 -0
- package/dist/types/src/toolkits/SystemToolkit.d.ts.map +1 -0
- package/dist/types/src/toolkits/index.d.ts +3 -0
- package/dist/types/src/toolkits/index.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +29 -12
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +48 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -0
- package/dist/types/src/types/AssistantAction.d.ts +119 -0
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
- package/dist/types/src/types/defs.d.ts +2 -0
- package/dist/types/src/types/defs.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +21 -18
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +97 -96
- package/src/AssistantPlugin.tsx +154 -107
- package/src/capabilities/ai-service.ts +27 -0
- package/src/capabilities/app-graph-builder.ts +76 -51
- package/src/capabilities/blueprint-definition.ts +66 -0
- package/src/capabilities/capabilities.ts +18 -0
- package/src/capabilities/edge-model-resolver.ts +25 -0
- package/src/capabilities/index.ts +9 -0
- package/src/capabilities/intent-resolver.ts +72 -23
- package/src/capabilities/local-model-resolver.ts +30 -0
- package/src/capabilities/react-surface.tsx +10 -77
- package/src/capabilities/state.ts +20 -0
- package/src/capabilities/toolkit.ts +19 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +83 -76
- package/src/components/BlueprintContainer.tsx +8 -2
- package/src/components/Chat/Chat.tsx +189 -181
- package/src/components/Chat/events.ts +7 -0
- package/src/components/ChatCompanion.tsx +136 -0
- package/src/components/ChatContainer.tsx +19 -13
- package/src/components/ChatDialog.tsx +18 -14
- package/src/components/ChatProgress/ChatProgress.tsx +67 -0
- package/src/components/{SequenceEditor → ChatProgress}/index.ts +1 -1
- package/src/components/ChatPrompt/ChatActions.tsx +10 -24
- package/src/components/ChatPrompt/ChatOptions.tsx +225 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +31 -36
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
- package/src/components/ChatPrompt/index.ts +1 -1
- package/src/components/ChatThread/ChatThread.stories.tsx +98 -112
- package/src/components/ChatThread/ChatThread.tsx +69 -29
- package/src/components/ChatThread/Link.tsx +26 -0
- package/src/components/ChatThread/reducers.ts +151 -0
- package/src/components/ChatThread/registry.tsx +184 -0
- package/src/components/ChatThread/sync.test.ts +81 -0
- package/src/components/ChatThread/sync.ts +113 -0
- package/src/components/ChatToolbar/ChatToolbar.tsx +23 -0
- package/src/components/ChatToolbar/index.ts +5 -0
- package/src/components/ChatToolbar/useChatToolbarActions.ts +126 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +28 -15
- package/src/components/TemplateEditor/TemplateEditor.tsx +29 -54
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +15 -10
- package/src/components/TemplateEditor/TemplateForm.tsx +4 -2
- package/src/components/TemplateEditor/handlebars-extension.ts +166 -0
- package/src/components/ToolBlock/ToolBlock.tsx +152 -0
- package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
- package/src/components/ToolBlock/index.ts +6 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +14 -23
- package/src/components/Toolbox/Toolbox.tsx +23 -53
- package/src/components/index.ts +3 -6
- package/src/events.ts +2 -2
- package/src/functions/analysis.ts +22 -0
- package/src/functions/index.ts +7 -0
- package/src/functions/object-list.ts +48 -0
- package/src/functions/object-load.ts +45 -0
- package/src/hooks/index.ts +7 -4
- package/src/hooks/useBlueprintRegistry.ts +94 -0
- package/src/hooks/useChatProcessor.ts +30 -99
- package/src/hooks/useChatServices.ts +30 -49
- package/src/hooks/useContextBinder.ts +30 -0
- package/src/hooks/useContextObjects.ts +58 -0
- package/src/hooks/useFlush.ts +35 -0
- package/src/hooks/useItemTypes.ts +37 -0
- package/src/hooks/useOnline.ts +10 -0
- package/src/hooks/usePresets.ts +44 -0
- package/src/hooks/useReferencesProvider.ts +11 -9
- package/src/index.ts +2 -0
- package/src/meta.ts +9 -6
- package/src/processor/index.ts +7 -0
- package/src/{hooks → processor}/presets.ts +15 -7
- package/src/processor/processor.test.ts +81 -0
- package/src/processor/processor.ts +277 -0
- package/src/processor/update-name.ts +57 -0
- package/src/queue-logger.ts +10 -10
- package/src/testing/index.ts +1 -1
- package/src/testing/test-generator.ts +261 -0
- package/src/testing/test-sequence.ts +2 -27
- package/src/testing/test-services.ts +2 -8
- package/src/toolkits/AssistantToolkit.ts +55 -0
- package/src/toolkits/SystemToolkit.ts +292 -0
- package/src/toolkits/index.ts +6 -0
- package/src/translations.ts +32 -12
- package/src/types/Assistant.ts +63 -0
- package/src/types/AssistantAction.ts +70 -0
- package/src/types/defs.ts +5 -0
- package/src/types/index.ts +4 -1
- package/src/types/service.ts +17 -9
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/BlueprintContainer-IZ4AK5EO.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-RP3QEXYX.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-ZVLXFHEY.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs +0 -162
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-XSEOKJLG.mjs.map +0 -7
- package/dist/lib/browser/chunk-63GG6U6D.mjs +0 -2226
- package/dist/lib/browser/chunk-63GG6U6D.mjs.map +0 -7
- package/dist/lib/browser/chunk-7W7LHTRH.mjs +0 -171
- package/dist/lib/browser/chunk-7W7LHTRH.mjs.map +0 -7
- package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
- package/dist/lib/browser/chunk-FDCJSQYF.mjs.map +0 -7
- package/dist/lib/browser/chunk-KFXSBNZR.mjs +0 -89
- package/dist/lib/browser/chunk-KFXSBNZR.mjs.map +0 -7
- package/dist/lib/browser/chunk-LERGF5YG.mjs +0 -108
- package/dist/lib/browser/chunk-LERGF5YG.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs +0 -75
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3GYEHQRP.mjs +0 -150
- package/dist/lib/browser/react-surface-3GYEHQRP.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-RGTMNLNX.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-W3W6FWV3.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-QW4JRKVO.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs +0 -163
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-PANCJUHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs +0 -2227
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MS3PJARN.mjs +0 -109
- package/dist/lib/node-esm/chunk-MS3PJARN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs +0 -90
- package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs +0 -172
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs +0 -76
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs +0 -151
- package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs.map +0 -7
- package/dist/types/src/capability-definitions.d.ts +0 -7
- package/dist/types/src/capability-definitions.d.ts.map +0 -1
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -17
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +0 -19
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
- package/dist/types/src/components/PromptSettings.d.ts +0 -6
- package/dist/types/src/components/PromptSettings.d.ts.map +0 -1
- package/dist/types/src/components/SequenceContainer.d.ts +0 -8
- package/dist/types/src/components/SequenceContainer.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +0 -13
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +0 -8
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/index.d.ts +0 -2
- package/dist/types/src/components/SequenceEditor/index.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.d.ts +0 -86
- package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
- package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/presets.d.ts.map +0 -1
- package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
- package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.d.ts +0 -4
- package/dist/types/src/parser/filter-generator.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.test.d.ts +0 -2
- package/dist/types/src/parser/filter-generator.test.d.ts.map +0 -1
- package/dist/types/src/parser/index.d.ts +0 -4
- package/dist/types/src/parser/index.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.d.ts +0 -15
- package/dist/types/src/parser/query-parser.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.test.d.ts +0 -2
- package/dist/types/src/parser/query-parser.test.d.ts.map +0 -1
- package/dist/types/src/parser/types.d.ts +0 -24
- package/dist/types/src/parser/types.d.ts.map +0 -1
- package/dist/types/src/stories/Chat.stories.d.ts +0 -207
- package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -3
- package/dist/types/src/testing/test-functions.d.ts.map +0 -1
- package/dist/types/src/tools/function.d.ts +0 -5
- package/dist/types/src/tools/function.d.ts.map +0 -1
- package/dist/types/src/tools/index.d.ts +0 -3
- package/dist/types/src/tools/index.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.d.ts +0 -10
- package/dist/types/src/tools/openapi.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.test.d.ts +0 -2
- package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -120
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capability-definitions.ts +0 -15
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
- package/src/components/ChatThread/ChatMessage.tsx +0 -268
- package/src/components/ChatThread/ToolBlock.tsx +0 -121
- package/src/components/ChatThread/reducer.ts +0 -52
- package/src/components/PromptSettings.tsx +0 -89
- package/src/components/SequenceContainer.tsx +0 -132
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -32
- package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
- package/src/hooks/chat-processor.test.ts +0 -16
- package/src/hooks/chat-processor.ts +0 -314
- package/src/hooks/useBlueprints.ts +0 -57
- package/src/parser/filter-generator.test.ts +0 -32
- package/src/parser/filter-generator.ts +0 -81
- package/src/parser/index.ts +0 -7
- package/src/parser/query-parser.test.ts +0 -139
- package/src/parser/query-parser.ts +0 -199
- package/src/parser/types.ts +0 -34
- package/src/shims.d.ts +0 -8
- package/src/stories/Chat.stories.tsx +0 -371
- package/src/testing/test-functions.ts +0 -11
- package/src/tools/function.ts +0 -46
- package/src/tools/index.ts +0 -6
- package/src/tools/openapi.test.ts +0 -217
- package/src/tools/openapi.ts +0 -338
- package/src/types/schema.ts +0 -108
- package/src/typings.d.ts +0 -9
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Obj } from '@dxos/echo';
|
|
8
|
+
import { ContextQueueService, DatabaseService } from '@dxos/functions';
|
|
9
|
+
import { faker } from '@dxos/random';
|
|
10
|
+
import { renderObjectLink } from '@dxos/react-ui-components';
|
|
11
|
+
import { type ContentBlock, DataType } from '@dxos/schema';
|
|
12
|
+
import { trim } from '@dxos/util';
|
|
13
|
+
|
|
14
|
+
export const createMessage = (role: DataType.ActorRole, blocks: ContentBlock.Any[]): DataType.Message => {
|
|
15
|
+
return Obj.make(DataType.Message, {
|
|
16
|
+
created: new Date().toISOString(),
|
|
17
|
+
sender: { role },
|
|
18
|
+
blocks,
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type MessageGenerator = Effect.Effect<void, never, DatabaseService | ContextQueueService>;
|
|
23
|
+
|
|
24
|
+
export const createMessageGenerator = (): MessageGenerator[] => [
|
|
25
|
+
Effect.gen(function* () {
|
|
26
|
+
const { queue } = yield* ContextQueueService;
|
|
27
|
+
yield* Effect.promise(() =>
|
|
28
|
+
queue.append([
|
|
29
|
+
createMessage('user', [
|
|
30
|
+
{
|
|
31
|
+
_tag: 'text',
|
|
32
|
+
text: faker.lorem.sentence(5),
|
|
33
|
+
},
|
|
34
|
+
]),
|
|
35
|
+
]),
|
|
36
|
+
);
|
|
37
|
+
}),
|
|
38
|
+
|
|
39
|
+
Effect.gen(function* () {
|
|
40
|
+
const { queue } = yield* ContextQueueService;
|
|
41
|
+
yield* Effect.promise(() =>
|
|
42
|
+
queue.append([
|
|
43
|
+
createMessage('assistant', [
|
|
44
|
+
{
|
|
45
|
+
_tag: 'text',
|
|
46
|
+
text:
|
|
47
|
+
trim`
|
|
48
|
+
## Markdown
|
|
49
|
+
Here is a [link](https://dxos.org)
|
|
50
|
+
|
|
51
|
+
And some **bold** text.
|
|
52
|
+
|
|
53
|
+
And some JSON
|
|
54
|
+
\`\`\`json
|
|
55
|
+
{
|
|
56
|
+
"key": "value"
|
|
57
|
+
}
|
|
58
|
+
\`\`\`
|
|
59
|
+
|
|
60
|
+
And some code
|
|
61
|
+
\`\`\`js
|
|
62
|
+
const x = 1;
|
|
63
|
+
\`\`\`
|
|
64
|
+
` + '\n',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
_tag: 'text',
|
|
68
|
+
disposition: 'cot',
|
|
69
|
+
text:
|
|
70
|
+
[
|
|
71
|
+
faker.lorem.paragraph(),
|
|
72
|
+
'',
|
|
73
|
+
...Array.from({ length: faker.number.int({ min: 3, max: 5 }) }).map(
|
|
74
|
+
(_, idx) => `${idx + 1}. ${faker.lorem.paragraph()}`,
|
|
75
|
+
),
|
|
76
|
+
].join('\n') + '\n',
|
|
77
|
+
},
|
|
78
|
+
]),
|
|
79
|
+
]),
|
|
80
|
+
);
|
|
81
|
+
}),
|
|
82
|
+
|
|
83
|
+
Effect.gen(function* () {
|
|
84
|
+
const { queue } = yield* ContextQueueService;
|
|
85
|
+
yield* Effect.promise(() =>
|
|
86
|
+
queue.append([
|
|
87
|
+
createMessage('assistant', [
|
|
88
|
+
{
|
|
89
|
+
_tag: 'text',
|
|
90
|
+
text: 'How can I help?',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
_tag: 'suggestion',
|
|
94
|
+
text: 'List tools',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
_tag: 'suggestion',
|
|
98
|
+
text: 'Show info',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
_tag: 'suggestion',
|
|
102
|
+
text: faker.lorem.paragraph(),
|
|
103
|
+
},
|
|
104
|
+
]),
|
|
105
|
+
createMessage('assistant', [
|
|
106
|
+
{
|
|
107
|
+
_tag: 'text',
|
|
108
|
+
text: 'Select an option:',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
_tag: 'select',
|
|
112
|
+
options: ['Option 1', 'Option 2', 'Option 3'],
|
|
113
|
+
},
|
|
114
|
+
]),
|
|
115
|
+
]),
|
|
116
|
+
);
|
|
117
|
+
}),
|
|
118
|
+
|
|
119
|
+
Effect.gen(function* () {
|
|
120
|
+
const { queue } = yield* ContextQueueService;
|
|
121
|
+
yield* Effect.promise(() =>
|
|
122
|
+
queue.append([
|
|
123
|
+
createMessage('assistant', [
|
|
124
|
+
{
|
|
125
|
+
_tag: 'toolkit',
|
|
126
|
+
},
|
|
127
|
+
]),
|
|
128
|
+
]),
|
|
129
|
+
);
|
|
130
|
+
}),
|
|
131
|
+
|
|
132
|
+
Effect.gen(function* () {
|
|
133
|
+
const { queue } = yield* ContextQueueService;
|
|
134
|
+
yield* Effect.promise(() =>
|
|
135
|
+
queue.append([
|
|
136
|
+
createMessage('user', [
|
|
137
|
+
{
|
|
138
|
+
_tag: 'text',
|
|
139
|
+
text: faker.lorem.sentence(5),
|
|
140
|
+
},
|
|
141
|
+
]),
|
|
142
|
+
]),
|
|
143
|
+
);
|
|
144
|
+
}),
|
|
145
|
+
|
|
146
|
+
Effect.gen(function* () {
|
|
147
|
+
const { queue } = yield* ContextQueueService;
|
|
148
|
+
const { db } = yield* DatabaseService;
|
|
149
|
+
const obj1 = db.add(Obj.make(DataType.Organization, { name: 'DXOS' }));
|
|
150
|
+
// const obj2 = db.add(Obj.make(DataType.Person, { fullName: 'Alice' }));
|
|
151
|
+
// const obj3 = db.add(Obj.make(DataType.Person, { fullName: 'Bob' }));
|
|
152
|
+
// const obj4 = db.add(Obj.make(DataType.Person, { fullName: 'Charlie' }));
|
|
153
|
+
yield* Effect.promise(() =>
|
|
154
|
+
queue.append([
|
|
155
|
+
createMessage('assistant', [
|
|
156
|
+
// Inline tag.
|
|
157
|
+
{
|
|
158
|
+
_tag: 'text',
|
|
159
|
+
text: [faker.lorem.paragraph(), renderObjectLink(obj1), faker.lorem.paragraph(), '\n'].join(' '),
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
// Inline cards.
|
|
163
|
+
// ...[obj1, obj2, obj3, obj4].map(
|
|
164
|
+
// (obj) =>
|
|
165
|
+
// ({
|
|
166
|
+
// _tag: 'text',
|
|
167
|
+
// text: renderObjectLink(obj, true) + '\n',
|
|
168
|
+
// }) satisfies ContentBlock.Text,
|
|
169
|
+
// ),
|
|
170
|
+
]),
|
|
171
|
+
]),
|
|
172
|
+
);
|
|
173
|
+
}),
|
|
174
|
+
|
|
175
|
+
Effect.gen(function* () {
|
|
176
|
+
const { queue } = yield* ContextQueueService;
|
|
177
|
+
yield* Effect.promise(() =>
|
|
178
|
+
queue.append([
|
|
179
|
+
createMessage('assistant', [
|
|
180
|
+
{
|
|
181
|
+
_tag: 'text',
|
|
182
|
+
text: faker.lorem.paragraph() + '\n',
|
|
183
|
+
},
|
|
184
|
+
]),
|
|
185
|
+
createMessage('assistant', [
|
|
186
|
+
{
|
|
187
|
+
_tag: 'toolCall',
|
|
188
|
+
toolCallId: '1234',
|
|
189
|
+
name: 'search',
|
|
190
|
+
input: JSON.stringify({}),
|
|
191
|
+
providerExecuted: false,
|
|
192
|
+
},
|
|
193
|
+
]),
|
|
194
|
+
createMessage('user', [
|
|
195
|
+
{
|
|
196
|
+
_tag: 'toolResult',
|
|
197
|
+
toolCallId: '1234',
|
|
198
|
+
name: 'search',
|
|
199
|
+
result: 'This is a tool result.',
|
|
200
|
+
providerExecuted: false,
|
|
201
|
+
},
|
|
202
|
+
]),
|
|
203
|
+
]),
|
|
204
|
+
);
|
|
205
|
+
}),
|
|
206
|
+
|
|
207
|
+
Effect.gen(function* () {
|
|
208
|
+
const { queue } = yield* ContextQueueService;
|
|
209
|
+
yield* Effect.promise(() =>
|
|
210
|
+
queue.append([
|
|
211
|
+
createMessage('assistant', [
|
|
212
|
+
{
|
|
213
|
+
_tag: 'text',
|
|
214
|
+
text: faker.lorem.paragraph() + '\n',
|
|
215
|
+
},
|
|
216
|
+
]),
|
|
217
|
+
createMessage('assistant', [
|
|
218
|
+
{
|
|
219
|
+
_tag: 'toolCall',
|
|
220
|
+
toolCallId: '4567',
|
|
221
|
+
name: 'create',
|
|
222
|
+
input: JSON.stringify({}),
|
|
223
|
+
providerExecuted: false,
|
|
224
|
+
},
|
|
225
|
+
]),
|
|
226
|
+
createMessage('user', [
|
|
227
|
+
{
|
|
228
|
+
_tag: 'toolResult',
|
|
229
|
+
toolCallId: '4567',
|
|
230
|
+
name: 'create',
|
|
231
|
+
result: 'This is a tool result.',
|
|
232
|
+
providerExecuted: false,
|
|
233
|
+
},
|
|
234
|
+
]),
|
|
235
|
+
createMessage('assistant', [
|
|
236
|
+
{
|
|
237
|
+
_tag: 'text',
|
|
238
|
+
text:
|
|
239
|
+
Array.from({ length: faker.number.int({ min: 2, max: 3 }) })
|
|
240
|
+
.map(() => faker.lorem.paragraph())
|
|
241
|
+
.join('\n\n') + '\n',
|
|
242
|
+
},
|
|
243
|
+
]),
|
|
244
|
+
]),
|
|
245
|
+
);
|
|
246
|
+
}),
|
|
247
|
+
|
|
248
|
+
Effect.gen(function* () {
|
|
249
|
+
const { queue } = yield* ContextQueueService;
|
|
250
|
+
yield* Effect.promise(() =>
|
|
251
|
+
queue.append([
|
|
252
|
+
createMessage('assistant', [
|
|
253
|
+
{
|
|
254
|
+
_tag: 'text',
|
|
255
|
+
text: faker.lorem.paragraph(),
|
|
256
|
+
},
|
|
257
|
+
]),
|
|
258
|
+
]),
|
|
259
|
+
);
|
|
260
|
+
}),
|
|
261
|
+
];
|
|
@@ -2,33 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { ToolId
|
|
6
|
-
|
|
7
|
-
import { type Space } from '@dxos/client/echo';
|
|
8
|
-
import { SequenceParser, type SequenceDefinition } from '@dxos/conductor';
|
|
9
|
-
import { type DXN } from '@dxos/keys';
|
|
10
|
-
import { isNonNullable } from '@dxos/util';
|
|
11
|
-
|
|
12
|
-
// TODO(dmaretskyi): make db available through services (same as function executor).
|
|
13
|
-
// TODO(burdon): Can tools implement "aspects" so that variants can be used rather than an explicit reference?
|
|
14
|
-
export const createToolRegistry = (space: Space, queueDxn?: DXN): ToolRegistry => {
|
|
15
|
-
return new ToolRegistry(
|
|
16
|
-
[
|
|
17
|
-
// createExaTool({ apiKey: EXA_API_KEY }),
|
|
18
|
-
// createLocalSearchTool(space.db, queueDxn && space.queues.get(queueDxn)),
|
|
19
|
-
// queueDxn &&
|
|
20
|
-
// createGraphWriterTool({
|
|
21
|
-
// db: space.db,
|
|
22
|
-
// queue: space.queues.get(queueDxn),
|
|
23
|
-
// schema: DataTypes,
|
|
24
|
-
// onDone: async (objects) => {
|
|
25
|
-
// const queue = space.queues.get(queueDxn);
|
|
26
|
-
// await queue.append(objects);
|
|
27
|
-
// },
|
|
28
|
-
// }),
|
|
29
|
-
].filter(isNonNullable),
|
|
30
|
-
);
|
|
31
|
-
};
|
|
5
|
+
import { ToolId } from '@dxos/ai';
|
|
6
|
+
import { type SequenceDefinition, SequenceParser } from '@dxos/conductor';
|
|
32
7
|
|
|
33
8
|
export const RESEARCH_SEQUENCE_DEFINITION: SequenceDefinition = {
|
|
34
9
|
steps: [
|
|
@@ -4,16 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import { Obj } from '@dxos/echo';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
type ApiAuthorization,
|
|
9
|
-
type BaseServiceRegistry,
|
|
10
|
-
type ServiceQuery,
|
|
11
|
-
ServiceType,
|
|
12
|
-
categoryIcons,
|
|
13
|
-
} from '../types';
|
|
7
|
+
import { type ApiAuthorization, type BaseServiceRegistry, ServiceType, categoryIcons } from '../types';
|
|
14
8
|
|
|
15
9
|
export class MockServiceRegistry implements BaseServiceRegistry {
|
|
16
|
-
async queryServices(
|
|
10
|
+
async queryServices(): Promise<ServiceType[]> {
|
|
17
11
|
return TEST_SERVICES;
|
|
18
12
|
}
|
|
19
13
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Tool from '@effect/ai/Tool';
|
|
6
|
+
import * as Toolkit from '@effect/ai/Toolkit';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
import type * as Layer from 'effect/Layer';
|
|
9
|
+
import * as Record from 'effect/Record';
|
|
10
|
+
import * as Schema from 'effect/Schema';
|
|
11
|
+
|
|
12
|
+
import { type PluginContext } from '@dxos/app-framework';
|
|
13
|
+
import { AiContextService, ArtifactId } from '@dxos/assistant';
|
|
14
|
+
import { Ref } from '@dxos/echo';
|
|
15
|
+
import { DatabaseService } from '@dxos/functions';
|
|
16
|
+
import { trim } from '@dxos/util';
|
|
17
|
+
|
|
18
|
+
const Toolkit$ = Toolkit.make(
|
|
19
|
+
Tool.make('add-to-context', {
|
|
20
|
+
description: trim`
|
|
21
|
+
Adds the object to the chat context.
|
|
22
|
+
`,
|
|
23
|
+
parameters: {
|
|
24
|
+
id: ArtifactId.annotations({
|
|
25
|
+
description: 'The ID of the document to read.',
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
28
|
+
success: Schema.Void,
|
|
29
|
+
failure: Schema.Never,
|
|
30
|
+
dependencies: [AiContextService, DatabaseService],
|
|
31
|
+
}),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export namespace AssistantToolkit {
|
|
35
|
+
export const Toolkit = Toolkit$;
|
|
36
|
+
|
|
37
|
+
export const tools = Record.keys(Toolkit$.tools);
|
|
38
|
+
|
|
39
|
+
export const createLayer = (
|
|
40
|
+
_context: PluginContext,
|
|
41
|
+
): Layer.Layer<Tool.Handler<any>, never, AiContextService | DatabaseService> =>
|
|
42
|
+
Toolkit$.toLayer({
|
|
43
|
+
'add-to-context': Effect.fnUntraced(function* ({ id }) {
|
|
44
|
+
const { binder } = yield* AiContextService;
|
|
45
|
+
const { db } = yield* DatabaseService;
|
|
46
|
+
const ref = Ref.fromDXN(ArtifactId.toDXN(id, db.spaceId));
|
|
47
|
+
yield* Effect.promise(() =>
|
|
48
|
+
binder.bind({
|
|
49
|
+
blueprints: [],
|
|
50
|
+
objects: [ref],
|
|
51
|
+
}),
|
|
52
|
+
);
|
|
53
|
+
}),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Tool from '@effect/ai/Tool';
|
|
6
|
+
import * as Toolkit from '@effect/ai/Toolkit';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
import type * as Layer from 'effect/Layer';
|
|
9
|
+
import * as Record from 'effect/Record';
|
|
10
|
+
import * as Schema from 'effect/Schema';
|
|
11
|
+
|
|
12
|
+
import { Capabilities, type PluginContext, createIntent } from '@dxos/app-framework';
|
|
13
|
+
import { ArtifactId } from '@dxos/assistant';
|
|
14
|
+
import { DXN, Filter, Obj, Relation, SchemaNotFoundError, Tag, Type } from '@dxos/echo';
|
|
15
|
+
import { DatabaseService } from '@dxos/functions';
|
|
16
|
+
import { invariant } from '@dxos/invariant';
|
|
17
|
+
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
18
|
+
import { SpaceCapabilities, getActiveSpace } from '@dxos/plugin-space';
|
|
19
|
+
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
20
|
+
import { DataType } from '@dxos/schema';
|
|
21
|
+
import { trim } from '@dxos/util';
|
|
22
|
+
|
|
23
|
+
// TODO(burdon): Factor out (is there a way to remove plugin deps?)
|
|
24
|
+
// TODO(burdon): Reconcile with functions (currently reuses plugin framework intents).
|
|
25
|
+
|
|
26
|
+
const Toolkit$ = Toolkit.make(
|
|
27
|
+
//
|
|
28
|
+
// Schema
|
|
29
|
+
//
|
|
30
|
+
|
|
31
|
+
Tool.make('schema-list', {
|
|
32
|
+
description: trim`
|
|
33
|
+
Lists schemas definitions.
|
|
34
|
+
`,
|
|
35
|
+
parameters: {
|
|
36
|
+
// TODO(wittjosiah): Remove this once parameter-less tools are fixed.
|
|
37
|
+
limit: Schema.Number,
|
|
38
|
+
},
|
|
39
|
+
// TODO(dmaretskyi): Effect returns ({ result, encodedResult })
|
|
40
|
+
success: Schema.Any,
|
|
41
|
+
failure: Schema.Never,
|
|
42
|
+
}),
|
|
43
|
+
|
|
44
|
+
Tool.make('schema-add', {
|
|
45
|
+
description: trim`
|
|
46
|
+
Adds a schema to the space.
|
|
47
|
+
The name will be used when displayed to the user.
|
|
48
|
+
The typename must be in the format of "example.com/type/Type".
|
|
49
|
+
`,
|
|
50
|
+
parameters: {
|
|
51
|
+
name: Schema.String,
|
|
52
|
+
typename: Schema.String,
|
|
53
|
+
jsonSchema: Schema.Any,
|
|
54
|
+
},
|
|
55
|
+
success: Schema.Any,
|
|
56
|
+
failure: Schema.Never,
|
|
57
|
+
}),
|
|
58
|
+
|
|
59
|
+
//
|
|
60
|
+
// Objects
|
|
61
|
+
//
|
|
62
|
+
|
|
63
|
+
Tool.make('object-create', {
|
|
64
|
+
description: trim`
|
|
65
|
+
Creates a new object and adds it to the current space.
|
|
66
|
+
Get the schema from the schema-list tool and ensure that the data matches the corresponding schema.
|
|
67
|
+
`,
|
|
68
|
+
parameters: {
|
|
69
|
+
typename: Schema.String,
|
|
70
|
+
data: Schema.Any,
|
|
71
|
+
},
|
|
72
|
+
success: Schema.Any,
|
|
73
|
+
failure: Schema.Never,
|
|
74
|
+
}),
|
|
75
|
+
|
|
76
|
+
Tool.make('object-remove', {
|
|
77
|
+
description: trim`
|
|
78
|
+
Removes an object or relation from the database.
|
|
79
|
+
`,
|
|
80
|
+
parameters: {
|
|
81
|
+
id: ArtifactId.annotations({
|
|
82
|
+
description: 'The ID of the object.',
|
|
83
|
+
}),
|
|
84
|
+
},
|
|
85
|
+
success: Schema.Any,
|
|
86
|
+
failure: Schema.Never,
|
|
87
|
+
}),
|
|
88
|
+
|
|
89
|
+
//
|
|
90
|
+
// Relations
|
|
91
|
+
//
|
|
92
|
+
|
|
93
|
+
Tool.make('relation-create', {
|
|
94
|
+
description: trim`
|
|
95
|
+
Creates a new relation and adds it to the current space.
|
|
96
|
+
Get the schema from the schema-list tool and ensure that the data matches the corresponding schema.
|
|
97
|
+
`,
|
|
98
|
+
parameters: {
|
|
99
|
+
typename: Schema.String,
|
|
100
|
+
source: ArtifactId.annotations({
|
|
101
|
+
description: 'The ID of the source object.',
|
|
102
|
+
}),
|
|
103
|
+
target: ArtifactId.annotations({
|
|
104
|
+
description: 'The ID of the target object.',
|
|
105
|
+
}),
|
|
106
|
+
data: Schema.Any.annotations({
|
|
107
|
+
description: 'The data to be stored in the relation.',
|
|
108
|
+
}),
|
|
109
|
+
},
|
|
110
|
+
success: Schema.Any,
|
|
111
|
+
failure: Schema.Never,
|
|
112
|
+
}),
|
|
113
|
+
|
|
114
|
+
//
|
|
115
|
+
// Tags
|
|
116
|
+
//
|
|
117
|
+
|
|
118
|
+
Tool.make('tag-add', {
|
|
119
|
+
description: trim`
|
|
120
|
+
Adds a tag to an object.
|
|
121
|
+
Tags are objects of type ${Tag.Tag.typename}.
|
|
122
|
+
`,
|
|
123
|
+
parameters: {
|
|
124
|
+
tagId: ArtifactId.annotations({
|
|
125
|
+
description: 'The ID of the tag.',
|
|
126
|
+
}),
|
|
127
|
+
objectId: ArtifactId.annotations({
|
|
128
|
+
description: 'The ID of the object.',
|
|
129
|
+
}),
|
|
130
|
+
},
|
|
131
|
+
success: Schema.Any,
|
|
132
|
+
failure: Schema.Never,
|
|
133
|
+
}),
|
|
134
|
+
|
|
135
|
+
Tool.make('tag-remove', {
|
|
136
|
+
description: trim`
|
|
137
|
+
Removes a tag from an object.
|
|
138
|
+
Tags are objects of type ${Tag.Tag.typename}.
|
|
139
|
+
`,
|
|
140
|
+
parameters: {
|
|
141
|
+
tagId: ArtifactId.annotations({
|
|
142
|
+
description: 'The ID of the tag.',
|
|
143
|
+
}),
|
|
144
|
+
objectId: ArtifactId.annotations({
|
|
145
|
+
description: 'The ID of the object.',
|
|
146
|
+
}),
|
|
147
|
+
},
|
|
148
|
+
success: Schema.Any,
|
|
149
|
+
failure: Schema.Never,
|
|
150
|
+
}),
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
export namespace SystemToolkit {
|
|
154
|
+
export const Toolkit = Toolkit$;
|
|
155
|
+
|
|
156
|
+
export const tools = Record.keys(Toolkit$.tools);
|
|
157
|
+
|
|
158
|
+
export const createLayer = (context: PluginContext): Layer.Layer<Tool.Handler<any>, never, never> =>
|
|
159
|
+
Toolkit$.toLayer({
|
|
160
|
+
'schema-list': () => {
|
|
161
|
+
const space = getActiveSpace(context);
|
|
162
|
+
invariant(space, 'No active space');
|
|
163
|
+
|
|
164
|
+
return Effect.gen(function* () {
|
|
165
|
+
const registered = context
|
|
166
|
+
// TODO(burdon): Can we remove plugin dependency? Get from layer?
|
|
167
|
+
.getCapabilities(ClientCapabilities.Schema)
|
|
168
|
+
.flat()
|
|
169
|
+
.map((schema) => {
|
|
170
|
+
const meta = Type.getMeta(schema);
|
|
171
|
+
return {
|
|
172
|
+
typename: Type.getTypename(schema),
|
|
173
|
+
jsonSchema: Type.toJsonSchema(schema),
|
|
174
|
+
kind: meta?.sourceSchema ? 'relation' : 'record',
|
|
175
|
+
};
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// TODO(burdon): Can we remove plugin dependency? Get from layer?
|
|
179
|
+
const forms = context.getCapabilities(SpaceCapabilities.ObjectForm).map((form) => ({
|
|
180
|
+
typename: Type.getTypename(form.objectSchema),
|
|
181
|
+
jsonSchema: Type.toJsonSchema(form.objectSchema),
|
|
182
|
+
kind: 'item',
|
|
183
|
+
}));
|
|
184
|
+
|
|
185
|
+
const schemas = [...registered, ...forms];
|
|
186
|
+
if (space) {
|
|
187
|
+
const { objects } = yield* DatabaseService.runQuery(Filter.type(DataType.StoredSchema));
|
|
188
|
+
schemas.push(
|
|
189
|
+
...objects.map((object) => ({
|
|
190
|
+
typename: object.typename,
|
|
191
|
+
jsonSchema: object.jsonSchema,
|
|
192
|
+
kind: 'record',
|
|
193
|
+
})),
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return schemas;
|
|
198
|
+
}).pipe(Effect.provide(DatabaseService.layer(space.db)));
|
|
199
|
+
},
|
|
200
|
+
|
|
201
|
+
'schema-add': ({ name, typename, jsonSchema }) => {
|
|
202
|
+
return Effect.gen(function* () {
|
|
203
|
+
const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
204
|
+
const space = getActiveSpace(context);
|
|
205
|
+
invariant(space, 'No active space');
|
|
206
|
+
|
|
207
|
+
const schema = Type.toEffectSchema(jsonSchema).pipe(Type.Obj({ typename, version: '0.1.0' }));
|
|
208
|
+
yield* dispatch(createIntent(SpaceAction.AddSchema, { space, name, typename, schema }));
|
|
209
|
+
}).pipe(Effect.orDie);
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
'object-create': ({ typename, data }) => {
|
|
213
|
+
const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
214
|
+
const space = getActiveSpace(context);
|
|
215
|
+
invariant(space, 'No active space');
|
|
216
|
+
|
|
217
|
+
return Effect.gen(function* () {
|
|
218
|
+
const schemas = context.getCapabilities(ClientCapabilities.Schema).flat();
|
|
219
|
+
const { objects } = yield* DatabaseService.runQuery(Filter.type(DataType.StoredSchema));
|
|
220
|
+
schemas.push(...objects.map((object) => Type.toEffectSchema(object.jsonSchema)));
|
|
221
|
+
const schema = schemas.find((schema) => Type.getTypename(schema) === typename);
|
|
222
|
+
if (!schema) {
|
|
223
|
+
throw new SchemaNotFoundError(typename);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const object = Obj.make(schema, data);
|
|
227
|
+
yield* dispatch(createIntent(SpaceAction.AddObject, { object, target: space, hidden: true }));
|
|
228
|
+
return object;
|
|
229
|
+
}).pipe(Effect.provide(DatabaseService.layer(space.db)), Effect.orDie);
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
'object-remove': ({ id }) => {
|
|
233
|
+
const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
234
|
+
const space = getActiveSpace(context);
|
|
235
|
+
invariant(space, 'No active space');
|
|
236
|
+
|
|
237
|
+
return Effect.gen(function* () {
|
|
238
|
+
const object = yield* DatabaseService.resolve(DXN.parse(id));
|
|
239
|
+
yield* dispatch(createIntent(SpaceAction.RemoveObjects, { objects: [object] }));
|
|
240
|
+
return object;
|
|
241
|
+
}).pipe(Effect.provide(DatabaseService.layer(space.db)), Effect.orDie);
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
'relation-create': ({ typename, source, target, data }) => {
|
|
245
|
+
const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
246
|
+
const space = getActiveSpace(context);
|
|
247
|
+
invariant(space, 'No active space');
|
|
248
|
+
|
|
249
|
+
return Effect.gen(function* () {
|
|
250
|
+
const schemas = context.getCapabilities(ClientCapabilities.Schema).flat();
|
|
251
|
+
const schema = schemas.find((schema) => Type.getTypename(schema) === typename);
|
|
252
|
+
if (!schema) {
|
|
253
|
+
throw new SchemaNotFoundError(typename);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const sourceObj = yield* DatabaseService.resolve(DXN.parse(source));
|
|
257
|
+
const targetObj = yield* DatabaseService.resolve(DXN.parse(target));
|
|
258
|
+
const relation = Relation.make(schema, {
|
|
259
|
+
[Relation.Source]: sourceObj,
|
|
260
|
+
[Relation.Target]: targetObj,
|
|
261
|
+
...data,
|
|
262
|
+
});
|
|
263
|
+
yield* dispatch(createIntent(SpaceAction.AddObject, { object: relation, target: space, hidden: true }));
|
|
264
|
+
return relation;
|
|
265
|
+
}).pipe(Effect.provide(DatabaseService.layer(space.db)), Effect.orDie);
|
|
266
|
+
},
|
|
267
|
+
|
|
268
|
+
'tag-add': ({ tagId, objectId }) => {
|
|
269
|
+
const space = getActiveSpace(context);
|
|
270
|
+
invariant(space, 'No active space');
|
|
271
|
+
|
|
272
|
+
return Effect.gen(function* () {
|
|
273
|
+
const object = yield* DatabaseService.resolve(DXN.parse(objectId));
|
|
274
|
+
const meta = Obj.getMeta(object);
|
|
275
|
+
meta.tags = [DXN.parse(tagId).toString()];
|
|
276
|
+
return object;
|
|
277
|
+
}).pipe(Effect.provide(DatabaseService.layer(space.db)), Effect.orDie);
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
'tag-remove': ({ tagId, objectId }) => {
|
|
281
|
+
const space = getActiveSpace(context);
|
|
282
|
+
invariant(space, 'No active space');
|
|
283
|
+
|
|
284
|
+
return Effect.gen(function* () {
|
|
285
|
+
const object = yield* DatabaseService.resolve(DXN.parse(objectId));
|
|
286
|
+
const meta = Obj.getMeta(object);
|
|
287
|
+
meta.tags = meta.tags?.filter((tag) => tag !== DXN.parse(tagId).toString());
|
|
288
|
+
return object;
|
|
289
|
+
}).pipe(Effect.provide(DatabaseService.layer(space.db)), Effect.orDie);
|
|
290
|
+
},
|
|
291
|
+
});
|
|
292
|
+
}
|