@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
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Template } from '@dxos/blueprints';
|
|
8
|
-
import { Toolbar, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
|
|
10
|
-
import { meta } from '../meta';
|
|
11
|
-
|
|
12
|
-
export const PromptSettings = ({ template }: { template: Template.Template }) => {
|
|
13
|
-
const { t } = useTranslation(meta.id);
|
|
14
|
-
|
|
15
|
-
// const handleKindChange = useCallback(
|
|
16
|
-
// (value: string) => {
|
|
17
|
-
// const kind = Match.type<string>().pipe(
|
|
18
|
-
// Match.withReturnType<Schema.Schema.Type<typeof Template.Template>>(),
|
|
19
|
-
// Match.when('always', () => ({ include: 'always' })),
|
|
20
|
-
// Match.when('schema-matching', () => ({ include: 'schema-matching', typename: '' })),
|
|
21
|
-
// Match.when('automatically', () => ({ include: 'automatically', description: '' })),
|
|
22
|
-
// Match.orElse(() => ({ include: 'manual' })),
|
|
23
|
-
// )(value);
|
|
24
|
-
//
|
|
25
|
-
// template.kind = kind;
|
|
26
|
-
// },
|
|
27
|
-
// [template],
|
|
28
|
-
// );
|
|
29
|
-
|
|
30
|
-
// const handleTypenameChange = useCallback(
|
|
31
|
-
// debounce((event: ChangeEvent<HTMLInputElement>) => {
|
|
32
|
-
// if (template.kind.include === 'schema-matching') {
|
|
33
|
-
// template.kind.typename = event.target.value;
|
|
34
|
-
// }
|
|
35
|
-
// }, 300),
|
|
36
|
-
// [template.kind.include],
|
|
37
|
-
// );
|
|
38
|
-
|
|
39
|
-
// const handleDescriptionChange = useCallback(
|
|
40
|
-
// debounce((event: ChangeEvent<HTMLInputElement>) => {
|
|
41
|
-
// if (template.kind.include === 'automatically') {
|
|
42
|
-
// template.kind.description = event.target.value;
|
|
43
|
-
// }
|
|
44
|
-
// }, 300),
|
|
45
|
-
// [template.kind.include],
|
|
46
|
-
// );
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<div className='flex flex-col gap-4'>
|
|
50
|
-
<h2>{t('prompt rules label')}</h2>
|
|
51
|
-
<Toolbar.Root>
|
|
52
|
-
{/* <Select.Root value={template.kind.include} onValueChange={handleKindChange}>
|
|
53
|
-
<Toolbar.Button asChild>
|
|
54
|
-
<Select.TriggerButton />
|
|
55
|
-
</Toolbar.Button>
|
|
56
|
-
<Select.Portal>
|
|
57
|
-
<Select.Content>
|
|
58
|
-
<Select.Viewport>
|
|
59
|
-
{Template.Kinds.map((kind) => (
|
|
60
|
-
<Select.Option key={kind} value={kind}>
|
|
61
|
-
{kind}
|
|
62
|
-
</Select.Option>
|
|
63
|
-
))}
|
|
64
|
-
</Select.Viewport>
|
|
65
|
-
</Select.Content>
|
|
66
|
-
</Select.Portal>
|
|
67
|
-
</Select.Root> */}
|
|
68
|
-
{/* {template.kind.include === 'schema-matching' && (
|
|
69
|
-
<Input.Root>
|
|
70
|
-
<Input.TextInput
|
|
71
|
-
placeholder={t('typename placeholder')}
|
|
72
|
-
defaultValue={template.kind.typename}
|
|
73
|
-
onChange={handleTypenameChange}
|
|
74
|
-
/>
|
|
75
|
-
</Input.Root>
|
|
76
|
-
)} */}
|
|
77
|
-
{/* {template.kind.include === 'automatically' && (
|
|
78
|
-
<Input.Root>
|
|
79
|
-
<Input.TextInput
|
|
80
|
-
placeholder={t('description placeholder')}
|
|
81
|
-
defaultValue={template.kind.description}
|
|
82
|
-
onChange={handleDescriptionChange}
|
|
83
|
-
/>
|
|
84
|
-
</Input.Root>
|
|
85
|
-
)} */}
|
|
86
|
-
</Toolbar.Root>
|
|
87
|
-
</div>
|
|
88
|
-
);
|
|
89
|
-
};
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type EditorView } from '@codemirror/view';
|
|
6
|
-
import JSON5 from 'json5';
|
|
7
|
-
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
8
|
-
|
|
9
|
-
import { ToolRegistry } from '@dxos/ai';
|
|
10
|
-
import { getSpace } from '@dxos/client/echo';
|
|
11
|
-
import { type Sequence, type SequenceDefinition } from '@dxos/conductor';
|
|
12
|
-
import { Key } from '@dxos/echo';
|
|
13
|
-
import { Toolbar, useTranslation } from '@dxos/react-ui';
|
|
14
|
-
import { useSelectionManager } from '@dxos/react-ui-attention';
|
|
15
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
16
|
-
|
|
17
|
-
import { SequenceEditor } from './SequenceEditor';
|
|
18
|
-
import { meta } from '../meta';
|
|
19
|
-
|
|
20
|
-
// TODO(burdon): Move to config.
|
|
21
|
-
export const EXA_API_KEY = '9c7e17ff-0c85-4cd5-827a-8b489f139e03';
|
|
22
|
-
|
|
23
|
-
// TODO(burdon): Validate.
|
|
24
|
-
const parseSequence = (text: string): SequenceDefinition | undefined => {
|
|
25
|
-
try {
|
|
26
|
-
const json = JSON5.parse(text);
|
|
27
|
-
const { steps } = json;
|
|
28
|
-
return { steps };
|
|
29
|
-
} catch (error) {
|
|
30
|
-
// Ignore.
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const SequenceContainer = ({ sequence }: { sequence: Sequence }) => {
|
|
35
|
-
const { t } = useTranslation(meta.id);
|
|
36
|
-
const selectionManager = useSelectionManager();
|
|
37
|
-
const [definition, setDefinition] = useState<SequenceDefinition>();
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
setDefinition({
|
|
40
|
-
steps: sequence.steps.map(({ instructions, tools }) => ({ instructions, tools })),
|
|
41
|
-
});
|
|
42
|
-
}, [sequence]);
|
|
43
|
-
|
|
44
|
-
const editorRef = useRef<EditorView | undefined>(undefined);
|
|
45
|
-
|
|
46
|
-
// TODO(burdon): Factor out.
|
|
47
|
-
const toolRegistry = useMemo(() => {
|
|
48
|
-
const space = getSpace(sequence);
|
|
49
|
-
if (!space) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// TODO(burdon): How should the queue be created?
|
|
54
|
-
// eslint-disable-next-line no-unused-vars
|
|
55
|
-
const _queue = space.queues.create();
|
|
56
|
-
|
|
57
|
-
return new ToolRegistry([
|
|
58
|
-
// createExaTool({ apiKey: EXA_API_KEY }),
|
|
59
|
-
// createLocalSearchTool(space.db, queue),
|
|
60
|
-
// createGraphWriterTool({
|
|
61
|
-
// db: space.db,
|
|
62
|
-
// queue,
|
|
63
|
-
// schema: [], // TODO(burdon): Get schema from client/sequence?
|
|
64
|
-
// onDone: async (objects) => {
|
|
65
|
-
// await queue.append(objects);
|
|
66
|
-
// },
|
|
67
|
-
// }),
|
|
68
|
-
]);
|
|
69
|
-
}, [sequence]);
|
|
70
|
-
|
|
71
|
-
const formatAndSave = useCallback((): SequenceDefinition | undefined => {
|
|
72
|
-
if (!sequence) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const text = editorRef.current?.state.doc.toString();
|
|
77
|
-
if (!text) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const definition = parseSequence(text);
|
|
82
|
-
if (!definition) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
setDefinition(definition);
|
|
87
|
-
const formatted = JSON.stringify(definition, null, 2);
|
|
88
|
-
editorRef.current?.dispatch({
|
|
89
|
-
changes: { from: 0, to: text.length, insert: formatted },
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
sequence.steps.length = 0;
|
|
93
|
-
for (const step of definition.steps) {
|
|
94
|
-
sequence.steps.push({
|
|
95
|
-
id: Key.ObjectId.random(),
|
|
96
|
-
instructions: step.instructions,
|
|
97
|
-
tools: step.tools,
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return sequence;
|
|
102
|
-
}, [sequence]);
|
|
103
|
-
|
|
104
|
-
// TODO(burdon): Save raw sequence separately from parsed sequence? (like Script).
|
|
105
|
-
const handleSave = useCallback(() => formatAndSave(), [formatAndSave]);
|
|
106
|
-
|
|
107
|
-
const handleRun = useCallback(async () => {
|
|
108
|
-
// if (!aiClient?.value || !toolRegistry) {
|
|
109
|
-
// return;
|
|
110
|
-
// }
|
|
111
|
-
// formatAndSave();
|
|
112
|
-
// // Get input from selection.
|
|
113
|
-
// const input = Array.from(getSelectionSet(selectionManager)).map((id) => DXN.fromLocalObjectId(id));
|
|
114
|
-
// if (!input.length) {
|
|
115
|
-
// return;
|
|
116
|
-
// }
|
|
117
|
-
// const machine = new SequenceMachine(toolRegistry, sequence).setLogger(new QueueLogger(sequence));
|
|
118
|
-
// await machine.runToCompletion({ aiClient: aiClient.value, input });
|
|
119
|
-
}, [sequence, formatAndSave, selectionManager, toolRegistry]);
|
|
120
|
-
|
|
121
|
-
return (
|
|
122
|
-
<StackItem.Content toolbar>
|
|
123
|
-
<Toolbar.Root>
|
|
124
|
-
<Toolbar.Button onClick={handleSave}>{t('button save')}</Toolbar.Button>
|
|
125
|
-
<Toolbar.Button onClick={handleRun}>{t('button run')}</Toolbar.Button>
|
|
126
|
-
</Toolbar.Root>
|
|
127
|
-
{definition && <SequenceEditor ref={editorRef} sequence={definition} />}
|
|
128
|
-
</StackItem.Content>
|
|
129
|
-
);
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
export default SequenceContainer;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react-vite';
|
|
8
|
-
|
|
9
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
10
|
-
|
|
11
|
-
import { SequenceEditor } from './SequenceEditor';
|
|
12
|
-
import { RESEARCH_SEQUENCE_DEFINITION } from '../../testing';
|
|
13
|
-
import { translations } from '../../translations';
|
|
14
|
-
|
|
15
|
-
const meta: Meta<typeof SequenceEditor> = {
|
|
16
|
-
title: 'plugins/plugin-assistant/SequenceEditor',
|
|
17
|
-
component: SequenceEditor,
|
|
18
|
-
decorators: [withTheme, withLayout({ fullscreen: true, classNames: 'mli-auto max-is-[50rem] justify-center' })],
|
|
19
|
-
parameters: {
|
|
20
|
-
translations,
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default meta;
|
|
25
|
-
|
|
26
|
-
type Story = StoryObj<typeof SequenceEditor>;
|
|
27
|
-
|
|
28
|
-
export const Default: Story = {
|
|
29
|
-
args: {
|
|
30
|
-
sequence: RESEARCH_SEQUENCE_DEFINITION,
|
|
31
|
-
},
|
|
32
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { forwardRef, useImperativeHandle } from 'react';
|
|
6
|
-
|
|
7
|
-
import { SequenceDefinition } from '@dxos/conductor';
|
|
8
|
-
import { Type } from '@dxos/echo';
|
|
9
|
-
import { useThemeContext, type ThemedClassName } from '@dxos/react-ui';
|
|
10
|
-
import {
|
|
11
|
-
type EditorView,
|
|
12
|
-
createBasicExtensions,
|
|
13
|
-
createJsonExtensions,
|
|
14
|
-
createThemeExtensions,
|
|
15
|
-
useTextEditor,
|
|
16
|
-
} from '@dxos/react-ui-editor';
|
|
17
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
18
|
-
|
|
19
|
-
export type SequenceEditorProps = ThemedClassName<{
|
|
20
|
-
sequence: SequenceDefinition;
|
|
21
|
-
}>;
|
|
22
|
-
|
|
23
|
-
// TODO(burdon): Factor out JsonEditor.
|
|
24
|
-
export const SequenceEditor = forwardRef<EditorView | undefined, SequenceEditorProps>(
|
|
25
|
-
({ classNames, sequence }, forwardedRef) => {
|
|
26
|
-
const { themeMode } = useThemeContext();
|
|
27
|
-
const { parentRef, view } = useTextEditor({
|
|
28
|
-
initialValue: JSON.stringify(sequence, null, 2),
|
|
29
|
-
extensions: [
|
|
30
|
-
createBasicExtensions({
|
|
31
|
-
lineNumbers: true,
|
|
32
|
-
lineWrapping: false,
|
|
33
|
-
monospace: true,
|
|
34
|
-
scrollPastEnd: true,
|
|
35
|
-
}),
|
|
36
|
-
createThemeExtensions({
|
|
37
|
-
themeMode,
|
|
38
|
-
syntaxHighlighting: true,
|
|
39
|
-
}),
|
|
40
|
-
createJsonExtensions({
|
|
41
|
-
schema: Type.toJsonSchema(SequenceDefinition, { strict: true }),
|
|
42
|
-
}),
|
|
43
|
-
],
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
useImperativeHandle(forwardedRef, () => view, [view]);
|
|
47
|
-
|
|
48
|
-
return <div ref={parentRef} className={mx('overflow-hidden', classNames)} />;
|
|
49
|
-
},
|
|
50
|
-
);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { describe, it } from 'vitest';
|
|
6
|
-
|
|
7
|
-
import { ChatProcessor } from './chat-processor';
|
|
8
|
-
|
|
9
|
-
describe('ChatProcessor', () => {
|
|
10
|
-
it('should be instantiable', ({ expect }) => {
|
|
11
|
-
const services = {} as any; // TODO(burdon): Create mock.
|
|
12
|
-
const client = {} as any; // TODO(burdon): Create mock.
|
|
13
|
-
const processor = new ChatProcessor(services, client);
|
|
14
|
-
expect(processor).toBeDefined();
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Signal, batch, computed, signal } from '@preact/signals-core';
|
|
6
|
-
import { Effect, type Layer } from 'effect';
|
|
7
|
-
|
|
8
|
-
import { AiService, DEFAULT_EDGE_MODEL, type ExecutableTool, type GenerateRequest } from '@dxos/ai';
|
|
9
|
-
import { type PromiseIntentDispatcher } from '@dxos/app-framework';
|
|
10
|
-
import { type AiSession, ArtifactDiffResolver, type ContextBinder, type Conversation } from '@dxos/assistant';
|
|
11
|
-
import { type ArtifactDefinition, type Blueprint } from '@dxos/blueprints';
|
|
12
|
-
import { Context } from '@dxos/context';
|
|
13
|
-
import { Obj } from '@dxos/echo';
|
|
14
|
-
import { runAndForwardErrors } from '@dxos/effect';
|
|
15
|
-
import { log } from '@dxos/log';
|
|
16
|
-
import { Filter, type Space, getVersion } from '@dxos/react-client/echo';
|
|
17
|
-
import { DataType } from '@dxos/schema';
|
|
18
|
-
|
|
19
|
-
import type { ChatServices } from './useChatServices';
|
|
20
|
-
|
|
21
|
-
// TODO(burdon): Factor out.
|
|
22
|
-
declare global {
|
|
23
|
-
interface ToolContextExtensions {
|
|
24
|
-
space?: Space;
|
|
25
|
-
dispatch?: PromiseIntentDispatcher;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
type RequestOptions = {
|
|
30
|
-
// Empty for now.
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type ChatProcessorOptions = {
|
|
34
|
-
// TODO(burdon): Change to AiToolkit.
|
|
35
|
-
tools?: readonly ExecutableTool[];
|
|
36
|
-
blueprintRegistry?: Blueprint.Registry;
|
|
37
|
-
|
|
38
|
-
// TODO(dmaretskyi): Remove.
|
|
39
|
-
artifacts?: readonly ArtifactDefinition[];
|
|
40
|
-
extensions?: ToolContextExtensions;
|
|
41
|
-
// TODO(burdon): Remove systemPrompt -- should come from blueprint.
|
|
42
|
-
} & Pick<GenerateRequest, 'model' | 'systemPrompt'>;
|
|
43
|
-
|
|
44
|
-
const defaultOptions: Partial<ChatProcessorOptions> = {
|
|
45
|
-
model: DEFAULT_EDGE_MODEL,
|
|
46
|
-
systemPrompt: 'you are a helpful assistant',
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Handles interactions with the AI service.
|
|
51
|
-
* Maintains a queue of messages and handles streaming responses from the AI service.
|
|
52
|
-
* Executes tools based on AI responses.
|
|
53
|
-
* Supports cancellation of in-progress requests.
|
|
54
|
-
*/
|
|
55
|
-
// TODO(burdon): Rename ChatContext?
|
|
56
|
-
export class ChatProcessor {
|
|
57
|
-
/**
|
|
58
|
-
* Pending messages (incl. the current user request).
|
|
59
|
-
* @reactive
|
|
60
|
-
*/
|
|
61
|
-
private readonly _pending: Signal<DataType.Message[]> = signal([]);
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Current streaming message (from the AI service).
|
|
65
|
-
* @reactive
|
|
66
|
-
*/
|
|
67
|
-
private readonly _streaming: Signal<DataType.Message | undefined> = signal(undefined);
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Streaming state.
|
|
71
|
-
* @reactive
|
|
72
|
-
*/
|
|
73
|
-
public readonly streaming: Signal<boolean> = computed(() => this._streaming.value !== undefined);
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Last error.
|
|
77
|
-
* @reactive
|
|
78
|
-
*/
|
|
79
|
-
public readonly error: Signal<Error | undefined> = signal(undefined);
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Array of Messages (incl. the current message being streamed).
|
|
83
|
-
* @reactive
|
|
84
|
-
*/
|
|
85
|
-
public readonly messages: Signal<DataType.Message[]> = computed(() => {
|
|
86
|
-
const messages = [...this._pending.value];
|
|
87
|
-
if (this._streaming.value) {
|
|
88
|
-
// TODO(dmaretskyi): Replace with Obj.clone.
|
|
89
|
-
// NOTE: We have to clone the message here so that react will re-render.
|
|
90
|
-
messages.push(Obj.make(DataType.Message, this._streaming.value));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return messages;
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
// TODO(burdon): Replace with Toolkit.
|
|
97
|
-
private _tools?: ExecutableTool[];
|
|
98
|
-
|
|
99
|
-
/** Current session. */
|
|
100
|
-
private _session: AiSession | undefined = undefined;
|
|
101
|
-
|
|
102
|
-
constructor(
|
|
103
|
-
// TODO(dmaretskyi): Replace this with effect's ManagedRuntime wrapping this layer.
|
|
104
|
-
private readonly _services: Layer.Layer<ChatServices>,
|
|
105
|
-
private readonly _conversation: Conversation,
|
|
106
|
-
private readonly _options: ChatProcessorOptions = defaultOptions,
|
|
107
|
-
) {
|
|
108
|
-
this._tools = [...(_options.tools ?? [])];
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
get conversation() {
|
|
112
|
-
return this._conversation;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
get context(): ContextBinder {
|
|
116
|
-
return this._conversation.context;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
get blueprintRegistry() {
|
|
120
|
-
return this._options.blueprintRegistry;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
get tools() {
|
|
124
|
-
return this._tools;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* @deprecated Replace with blueprints
|
|
129
|
-
*/
|
|
130
|
-
setTools(tools: ExecutableTool[]): void {
|
|
131
|
-
this._tools = tools;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Make GPT request.
|
|
136
|
-
*/
|
|
137
|
-
async request(message: string, options: RequestOptions = {}): Promise<DataType.Message[]> {
|
|
138
|
-
await using ctx = Context.default(); // Auto-disposed at the end of this block.
|
|
139
|
-
|
|
140
|
-
this._conversation.onBegin.on(ctx, (session) => {
|
|
141
|
-
log.info('onBegin', { session, isDisposed: ctx.disposed });
|
|
142
|
-
|
|
143
|
-
this._session = session;
|
|
144
|
-
ctx.onDispose(() => {
|
|
145
|
-
log.info('onDispose', { session, isDisposed: ctx.disposed });
|
|
146
|
-
if (this._session === session) {
|
|
147
|
-
this._session = undefined;
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
// User message.
|
|
152
|
-
session.userMessage.on((message) => {
|
|
153
|
-
log.info('userMessage', { message });
|
|
154
|
-
this._pending.value = [...this._pending.value, message];
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
// Message complete.
|
|
158
|
-
session.message.on((message) => {
|
|
159
|
-
batch(() => {
|
|
160
|
-
this._pending.value = [...this._pending.value, message];
|
|
161
|
-
this._streaming.value = undefined;
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
// Streaming update (happens before message complete).
|
|
166
|
-
session.update.on((block) => {
|
|
167
|
-
batch(() => {
|
|
168
|
-
if (!this._streaming.value) {
|
|
169
|
-
// TODO(burdon): Hack to create temp message; better for session to send initial partial object?
|
|
170
|
-
this._streaming.value = Obj.make(DataType.Message, {
|
|
171
|
-
created: new Date().toISOString(),
|
|
172
|
-
sender: { role: 'assistant' },
|
|
173
|
-
blocks: [block],
|
|
174
|
-
});
|
|
175
|
-
} else if (this._streaming.value.blocks.at(-1)?.pending === true) {
|
|
176
|
-
this._streaming.value.blocks[this._streaming.value.blocks.length - 1] = block;
|
|
177
|
-
} else {
|
|
178
|
-
this._streaming.value.blocks.push(block);
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
session.block.on((block) => {
|
|
184
|
-
if (!this._streaming.value) {
|
|
185
|
-
// TODO(burdon): Hack to create temp message; better for session to send initial partial object?
|
|
186
|
-
this._streaming.value = Obj.make(DataType.Message, {
|
|
187
|
-
created: new Date().toISOString(),
|
|
188
|
-
sender: { role: 'assistant' },
|
|
189
|
-
blocks: [block],
|
|
190
|
-
});
|
|
191
|
-
} else if (this._streaming.value.blocks.at(-1)?.pending === true) {
|
|
192
|
-
this._streaming.value.blocks[this._streaming.value.blocks.length - 1] = block;
|
|
193
|
-
} else {
|
|
194
|
-
this._streaming.value.blocks.push(block);
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
// TODO(dmaretskyi): Handle tool status reports.
|
|
199
|
-
// session.toolStatusReport.on(({ message, status }) => {
|
|
200
|
-
// const msg = this._pending.peek().find((m) => m.id === message.id);
|
|
201
|
-
// const toolUse = msg?.content.find((block) => block.type === 'tool_use');
|
|
202
|
-
// if (!toolUse) {
|
|
203
|
-
// return;
|
|
204
|
-
// }
|
|
205
|
-
|
|
206
|
-
// const block = msg?.content.find(
|
|
207
|
-
// (block): block is ToolUseContentBlock => block.type === 'tool_use' && block.id === toolUse.id,
|
|
208
|
-
// );
|
|
209
|
-
// if (block) {
|
|
210
|
-
// this._pending.value = this._pending.value.map((m) => {
|
|
211
|
-
// if (m.id === message.id) {
|
|
212
|
-
// return {
|
|
213
|
-
// ...m,
|
|
214
|
-
// content: m.content.map((block) =>
|
|
215
|
-
// block.type === 'tool_use' && block.id === toolUse.id ? { ...block, currentStatus: status } : block,
|
|
216
|
-
// ),
|
|
217
|
-
// };
|
|
218
|
-
// }
|
|
219
|
-
|
|
220
|
-
// return m;
|
|
221
|
-
// });
|
|
222
|
-
// } else {
|
|
223
|
-
// log.warn('no block for status report');
|
|
224
|
-
// }
|
|
225
|
-
// });
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
try {
|
|
229
|
-
const messages = await runAndForwardErrors(
|
|
230
|
-
this._conversation
|
|
231
|
-
.run({
|
|
232
|
-
prompt: message,
|
|
233
|
-
// TODO(burdon): Construct from blueprints?
|
|
234
|
-
systemPrompt: this._options.systemPrompt,
|
|
235
|
-
})
|
|
236
|
-
.pipe(
|
|
237
|
-
//
|
|
238
|
-
Effect.provide(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL)),
|
|
239
|
-
// TODO(dmaretskyi): Move ArtifactDiffResolver upstream.
|
|
240
|
-
Effect.provideService(ArtifactDiffResolver, this._artifactDiffResolver),
|
|
241
|
-
Effect.provide(this._services),
|
|
242
|
-
Effect.tapErrorCause((cause) => {
|
|
243
|
-
log.error('error', { cause });
|
|
244
|
-
return Effect.void;
|
|
245
|
-
}),
|
|
246
|
-
),
|
|
247
|
-
);
|
|
248
|
-
|
|
249
|
-
log('completed', { messages });
|
|
250
|
-
} catch (err) {
|
|
251
|
-
log.catch(err);
|
|
252
|
-
if (err instanceof Error && err.message.includes('Overloaded')) {
|
|
253
|
-
this.error.value = new AiServiceOverloadedError('AI service overloaded', { cause: err });
|
|
254
|
-
} else {
|
|
255
|
-
this.error.value = new Error('AI service error', { cause: err });
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return this._reset();
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Cancel pending requests.
|
|
264
|
-
* @returns Pending requests (incl. the request message).
|
|
265
|
-
*/
|
|
266
|
-
async cancel(): Promise<DataType.Message[]> {
|
|
267
|
-
log.info('cancelling...');
|
|
268
|
-
|
|
269
|
-
// TODO(dmaretskyi): Conversation should handle aborting.
|
|
270
|
-
this._session?.abort();
|
|
271
|
-
return this._reset();
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
private async _reset(): Promise<DataType.Message[]> {
|
|
275
|
-
const messages = this._pending.value;
|
|
276
|
-
batch(() => {
|
|
277
|
-
this._pending.value = [];
|
|
278
|
-
this._streaming.value = undefined;
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
return messages;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
private _artifactDiffResolver: ArtifactDiffResolver.Service = {
|
|
285
|
-
resolve: async (artifacts) => {
|
|
286
|
-
const space = this._options.extensions?.space;
|
|
287
|
-
if (!space) {
|
|
288
|
-
return new Map();
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
const versions = new Map();
|
|
292
|
-
await Promise.all(
|
|
293
|
-
artifacts.map(async (artifact) => {
|
|
294
|
-
const {
|
|
295
|
-
objects: [object],
|
|
296
|
-
} = await space.db.query(Filter.ids(artifact.id)).run();
|
|
297
|
-
if (!object) {
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
versions.set(artifact.id, {
|
|
301
|
-
version: getVersion(object),
|
|
302
|
-
diff: `Current state: ${JSON.stringify(object)}`,
|
|
303
|
-
});
|
|
304
|
-
}),
|
|
305
|
-
);
|
|
306
|
-
return versions;
|
|
307
|
-
},
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// TODO(wittjosiah): Move to ai-service-client.
|
|
312
|
-
export class AiServiceOverloadedError extends Error {
|
|
313
|
-
code = 'AI_SERVICE_OVERLOADED';
|
|
314
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { effect } from '@preact/signals-react';
|
|
6
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
7
|
-
|
|
8
|
-
import { type ContextBinder } from '@dxos/assistant';
|
|
9
|
-
import { Blueprint } from '@dxos/blueprints';
|
|
10
|
-
import { type Space } from '@dxos/client/echo';
|
|
11
|
-
import { Obj, Ref } from '@dxos/echo';
|
|
12
|
-
import { log } from '@dxos/log';
|
|
13
|
-
import { isNonNullable } from '@dxos/util';
|
|
14
|
-
|
|
15
|
-
export type UpdateCallback = (key: string, active: boolean) => void;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Get collection of active blueprints based on the context.
|
|
19
|
-
*/
|
|
20
|
-
export const useBlueprints = (
|
|
21
|
-
space: Space,
|
|
22
|
-
context: ContextBinder,
|
|
23
|
-
blueprintRegistry?: Blueprint.Registry,
|
|
24
|
-
): [Blueprint.Blueprint[], UpdateCallback] => {
|
|
25
|
-
const [blueprints, setBlueprints] = useState<Blueprint.Blueprint[]>([]);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
let t: NodeJS.Timeout;
|
|
28
|
-
effect(() => {
|
|
29
|
-
const refs = [...(context.blueprints.value ?? [])];
|
|
30
|
-
t = setTimeout(async () => {
|
|
31
|
-
const blueprints = (await Ref.Array.loadAll(refs)).filter(isNonNullable);
|
|
32
|
-
setBlueprints(blueprints);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
return () => clearTimeout(t);
|
|
37
|
-
}, [context]);
|
|
38
|
-
|
|
39
|
-
const handleUpdate = useCallback<UpdateCallback>(
|
|
40
|
-
(key: string, active: boolean) => {
|
|
41
|
-
log.info('update', { key, active });
|
|
42
|
-
if (active) {
|
|
43
|
-
// TODO(burdon): Check if already in space.
|
|
44
|
-
const blueprint = blueprintRegistry?.getByKey(key);
|
|
45
|
-
if (blueprint) {
|
|
46
|
-
// TODO(dmaretskyi): This should be done by Obj.clone.
|
|
47
|
-
const { id: _id, ...data } = blueprint;
|
|
48
|
-
const obj = space.db.add(Obj.make(Blueprint.Blueprint, data));
|
|
49
|
-
void context.bind({ blueprints: [Ref.make(obj)] });
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
[space, context],
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
return [blueprints, handleUpdate] as const;
|
|
57
|
-
};
|