@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
|
@@ -2,32 +2,33 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { createSystemPrompt } from '@dxos/assistant';
|
|
11
9
|
import { Blueprint, Template } from '@dxos/blueprints';
|
|
12
10
|
import { useClient } from '@dxos/react-client';
|
|
13
11
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
14
|
-
import {
|
|
12
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
15
13
|
import { trim } from '@dxos/util';
|
|
16
14
|
|
|
17
|
-
import { TemplateEditor, type TemplateEditorProps } from './TemplateEditor';
|
|
18
15
|
import { translations } from '../../translations';
|
|
19
16
|
|
|
17
|
+
import { TemplateEditor, type TemplateEditorProps } from './TemplateEditor';
|
|
18
|
+
|
|
20
19
|
const TEMPLATE = trim`
|
|
21
20
|
{{! System Prompt }}
|
|
22
21
|
|
|
23
22
|
You are a machine that is an expert chess player.
|
|
24
|
-
The move history of the current game is: {{history}}
|
|
23
|
+
The move history of the current game is: {{history}}.
|
|
25
24
|
If asked to suggest a move explain why it is a good move.
|
|
26
25
|
|
|
27
26
|
{{#each artifacts}}
|
|
28
27
|
- {{this}}
|
|
29
28
|
{{/each}}
|
|
30
29
|
|
|
30
|
+
Reponse in the format: <suggestion>SUGGESTION</suggestion>
|
|
31
|
+
|
|
31
32
|
---
|
|
32
33
|
|
|
33
34
|
{{input}}
|
|
@@ -37,33 +38,45 @@ const DefaultStory = ({ source }: TemplateEditorProps & { source: string }) => {
|
|
|
37
38
|
const client = useClient();
|
|
38
39
|
const [blueprint] = useState(() => {
|
|
39
40
|
const space = client.spaces.default;
|
|
40
|
-
return space.db.add(
|
|
41
|
+
return space.db.add(
|
|
42
|
+
Blueprint.make({
|
|
43
|
+
key: 'example.com/blueprint/test',
|
|
44
|
+
name: 'Test',
|
|
45
|
+
instructions: Template.make({ source }),
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
41
48
|
});
|
|
42
49
|
|
|
43
|
-
return
|
|
50
|
+
return (
|
|
51
|
+
<TemplateEditor
|
|
52
|
+
classNames='bg-baseSurface max-is-prose is-full'
|
|
53
|
+
id={blueprint.id}
|
|
54
|
+
template={blueprint.instructions}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
44
57
|
};
|
|
45
58
|
|
|
46
|
-
const meta
|
|
59
|
+
const meta = {
|
|
47
60
|
title: 'plugins/plugin-assistant/TemplateEditor',
|
|
48
|
-
component: TemplateEditor,
|
|
61
|
+
component: TemplateEditor as any,
|
|
49
62
|
render: DefaultStory,
|
|
50
63
|
decorators: [
|
|
64
|
+
withTheme,
|
|
65
|
+
withLayout({ container: 'column' }),
|
|
51
66
|
withClientProvider({
|
|
67
|
+
types: [Blueprint.Blueprint],
|
|
52
68
|
createIdentity: true,
|
|
53
69
|
createSpace: true,
|
|
54
|
-
types: [Template.Template],
|
|
55
70
|
}),
|
|
56
|
-
withLayout({ fullscreen: true, Container: ColumnContainer }),
|
|
57
|
-
withTheme,
|
|
58
71
|
],
|
|
59
72
|
parameters: {
|
|
60
73
|
translations,
|
|
61
74
|
},
|
|
62
|
-
}
|
|
75
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
63
76
|
|
|
64
77
|
export default meta;
|
|
65
78
|
|
|
66
|
-
type Story =
|
|
79
|
+
type Story = StoryObj<typeof meta>;
|
|
67
80
|
|
|
68
81
|
export const Default: Story = {
|
|
69
82
|
args: {
|
|
@@ -2,90 +2,65 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { handlebarsLanguage } from '@xiechao/codemirror-lang-handlebars';
|
|
5
|
+
import { xml } from '@codemirror/lang-xml';
|
|
6
|
+
import { defaultHighlightStyle, syntaxHighlighting } from '@codemirror/language';
|
|
8
7
|
import React from 'react';
|
|
9
8
|
|
|
10
9
|
import { type Template } from '@dxos/blueprints';
|
|
11
10
|
import { createDocAccessor } from '@dxos/react-client/echo';
|
|
12
|
-
import { useThemeContext, useTranslation
|
|
11
|
+
import { type ThemedClassName, useThemeContext, useTranslation } from '@dxos/react-ui';
|
|
13
12
|
import {
|
|
14
13
|
createBasicExtensions,
|
|
15
14
|
createDataExtensions,
|
|
15
|
+
createMarkdownExtensions,
|
|
16
16
|
createThemeExtensions,
|
|
17
|
+
decorateMarkdown,
|
|
17
18
|
useTextEditor,
|
|
18
19
|
} from '@dxos/react-ui-editor';
|
|
19
20
|
import { mx } from '@dxos/react-ui-theme';
|
|
20
|
-
import {
|
|
21
|
+
import { isNonNullable } from '@dxos/util';
|
|
21
22
|
|
|
22
23
|
import { meta } from '../../meta';
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
props: [
|
|
26
|
-
styleTags({
|
|
27
|
-
'---': tags.lineComment,
|
|
28
|
-
}),
|
|
29
|
-
],
|
|
30
|
-
});
|
|
25
|
+
import { handlebars } from './handlebars-extension';
|
|
31
26
|
|
|
32
27
|
export type TemplateEditorProps = ThemedClassName<{
|
|
33
28
|
id: string;
|
|
34
29
|
template: Template.Template;
|
|
30
|
+
lineNumbers?: boolean;
|
|
35
31
|
}>;
|
|
36
32
|
|
|
37
|
-
export const TemplateEditor = ({ id, classNames, template }: TemplateEditorProps) => {
|
|
33
|
+
export const TemplateEditor = ({ id, classNames, template, lineNumbers = true }: TemplateEditorProps) => {
|
|
38
34
|
const { t } = useTranslation(meta.id);
|
|
39
35
|
const { themeMode } = useThemeContext();
|
|
40
36
|
const { parentRef } = useTextEditor(() => {
|
|
41
37
|
const text = template.source?.target;
|
|
38
|
+
if (!text) {
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
42
|
return {
|
|
43
|
-
initialValue: text
|
|
43
|
+
initialValue: text.content ?? '',
|
|
44
44
|
extensions: [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}),
|
|
45
|
+
createDataExtensions({
|
|
46
|
+
id,
|
|
47
|
+
text: createDocAccessor(text, ['content']),
|
|
48
|
+
}),
|
|
50
49
|
createBasicExtensions({
|
|
51
50
|
bracketMatching: false,
|
|
52
|
-
lineNumbers
|
|
53
|
-
lineWrapping:
|
|
54
|
-
monospace: true,
|
|
51
|
+
lineNumbers,
|
|
52
|
+
lineWrapping: false,
|
|
55
53
|
placeholder: t('template placeholder'),
|
|
56
54
|
}),
|
|
57
|
-
createThemeExtensions({
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
].filter(
|
|
55
|
+
createThemeExtensions({ themeMode }),
|
|
56
|
+
createMarkdownExtensions(),
|
|
57
|
+
decorateMarkdown(), // TODO(burdon): Move into bundle.
|
|
58
|
+
handlebars(),
|
|
59
|
+
xml(),
|
|
60
|
+
syntaxHighlighting(defaultHighlightStyle),
|
|
61
|
+
].filter(isNonNullable),
|
|
64
62
|
};
|
|
65
|
-
}, [themeMode, template.source?.target]);
|
|
63
|
+
}, [themeMode, template.source?.target, lineNumbers]);
|
|
66
64
|
|
|
67
|
-
return <div ref={parentRef} className={mx('
|
|
65
|
+
return <div ref={parentRef} className={mx('bs-full overflow-hidden', classNames)} />;
|
|
68
66
|
};
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* https://github.com/xiechao/lang-handlebars/blob/direct/src/highlight.js
|
|
72
|
-
*/
|
|
73
|
-
export const handlebarsHighlightStyle = HighlightStyle.define([
|
|
74
|
-
{
|
|
75
|
-
// Braces.
|
|
76
|
-
tag: tags.tagName,
|
|
77
|
-
class: 'text-redText',
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
tag: tags.variableName,
|
|
81
|
-
class: 'text-blueText',
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
tag: tags.keyword,
|
|
85
|
-
class: 'text-greenText',
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
tag: tags.comment,
|
|
89
|
-
class: 'text-subdued',
|
|
90
|
-
},
|
|
91
|
-
]);
|
|
@@ -2,20 +2,19 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta } from '@storybook/react-vite';
|
|
8
6
|
import React, { useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { Blueprint, Template } from '@dxos/blueprints';
|
|
11
9
|
import { useClient } from '@dxos/react-client';
|
|
12
10
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
|
-
import { withLayout, withTheme } from '@dxos/
|
|
11
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
14
12
|
import { trim } from '@dxos/util';
|
|
15
13
|
|
|
16
|
-
import { TemplateForm } from './TemplateForm';
|
|
17
14
|
import { translations } from '../../translations';
|
|
18
15
|
|
|
16
|
+
import { TemplateForm } from './TemplateForm';
|
|
17
|
+
|
|
19
18
|
const TEMPLATE = trim`
|
|
20
19
|
You are a machine that is an expert chess player.
|
|
21
20
|
The move history of the current game is: {{history}}
|
|
@@ -30,7 +29,13 @@ const DefaultStory = () => {
|
|
|
30
29
|
const client = useClient();
|
|
31
30
|
const [blueprint] = useState(() => {
|
|
32
31
|
const space = client.spaces.default;
|
|
33
|
-
return space.db.add(
|
|
32
|
+
return space.db.add(
|
|
33
|
+
Blueprint.make({
|
|
34
|
+
key: 'example.com/blueprint/test',
|
|
35
|
+
name: 'Test',
|
|
36
|
+
instructions: Template.make({ source: TEMPLATE }),
|
|
37
|
+
}),
|
|
38
|
+
);
|
|
34
39
|
});
|
|
35
40
|
|
|
36
41
|
return (
|
|
@@ -40,23 +45,23 @@ const DefaultStory = () => {
|
|
|
40
45
|
);
|
|
41
46
|
};
|
|
42
47
|
|
|
43
|
-
const meta
|
|
48
|
+
const meta = {
|
|
44
49
|
title: 'plugins/plugin-assistant/TemplateForm',
|
|
45
50
|
component: TemplateForm,
|
|
46
51
|
render: DefaultStory,
|
|
47
52
|
decorators: [
|
|
53
|
+
withTheme,
|
|
54
|
+
withLayout({ container: 'column' }),
|
|
48
55
|
withClientProvider({
|
|
56
|
+
types: [Blueprint.Blueprint],
|
|
49
57
|
createIdentity: true,
|
|
50
58
|
createSpace: true,
|
|
51
|
-
types: [Template.Template],
|
|
52
59
|
}),
|
|
53
|
-
withLayout({ fullscreen: true, classNames: 'flex justify-center' }),
|
|
54
|
-
withTheme,
|
|
55
60
|
],
|
|
56
61
|
parameters: {
|
|
57
62
|
translations,
|
|
58
63
|
},
|
|
59
|
-
}
|
|
64
|
+
} satisfies Meta<typeof TemplateForm>;
|
|
60
65
|
|
|
61
66
|
export default meta;
|
|
62
67
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import type * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { Fragment, useEffect } from 'react';
|
|
7
7
|
|
|
8
8
|
import { type Template } from '@dxos/blueprints';
|
|
@@ -10,9 +10,10 @@ import { Input, Select, useTranslation } from '@dxos/react-ui';
|
|
|
10
10
|
import { attentionSurface, groupBorder, mx } from '@dxos/react-ui-theme';
|
|
11
11
|
import { isNonNullable } from '@dxos/util';
|
|
12
12
|
|
|
13
|
-
import { TemplateEditor } from './TemplateEditor';
|
|
14
13
|
import { meta } from '../../meta';
|
|
15
14
|
|
|
15
|
+
import { TemplateEditor } from './TemplateEditor';
|
|
16
|
+
|
|
16
17
|
export type TemplateFormProps = {
|
|
17
18
|
id: string;
|
|
18
19
|
template: Template.Template;
|
|
@@ -67,6 +68,7 @@ export const TemplateForm = ({ id, template, commandEditable = true }: TemplateF
|
|
|
67
68
|
</Select.Option>
|
|
68
69
|
))}
|
|
69
70
|
</Select.Viewport>
|
|
71
|
+
<Select.Arrow />
|
|
70
72
|
</Select.Content>
|
|
71
73
|
</Select.Portal>
|
|
72
74
|
</Select.Root>
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
type CompletionContext,
|
|
7
|
+
type CompletionResult,
|
|
8
|
+
autocompletion,
|
|
9
|
+
completionKeymap,
|
|
10
|
+
} from '@codemirror/autocomplete';
|
|
11
|
+
import { type Extension } from '@codemirror/state';
|
|
12
|
+
import { Decoration, type DecorationSet, type EditorView, ViewPlugin, type ViewUpdate, keymap } from '@codemirror/view';
|
|
13
|
+
|
|
14
|
+
export type HandlebarsOptions = {};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Simple Handlebars plugin for CodeMirror.
|
|
18
|
+
* Supports:
|
|
19
|
+
* - Comments: {{! comment }}
|
|
20
|
+
* - Commands: {{#command}} {{/command}}
|
|
21
|
+
* - Variables: {{var}}
|
|
22
|
+
* - Commands with variables: {{#each items}} {{/each}}
|
|
23
|
+
*/
|
|
24
|
+
export const handlebars = (_: HandlebarsOptions = {}): Extension => {
|
|
25
|
+
return [
|
|
26
|
+
handlebarsHighlightPlugin,
|
|
27
|
+
autocompletion({
|
|
28
|
+
activateOnTyping: true,
|
|
29
|
+
aboveCursor: true,
|
|
30
|
+
closeOnBlur: true,
|
|
31
|
+
override: [handlebarsCompletions],
|
|
32
|
+
}),
|
|
33
|
+
keymap.of(completionKeymap),
|
|
34
|
+
];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const regex = {
|
|
38
|
+
comment: /\{\{!\s*[^}]*\}\}/g,
|
|
39
|
+
brackets: /\{\{[^}]*\}\}/g,
|
|
40
|
+
command: /\{\{[#/]([^}]+)\}\}/g,
|
|
41
|
+
var: /\{\{(?!\s*!)(\w[^}]*)\}\}/g,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* ViewPlugin that decorates Handlebars syntax.
|
|
46
|
+
*/
|
|
47
|
+
const handlebarsHighlightPlugin = ViewPlugin.fromClass(
|
|
48
|
+
class {
|
|
49
|
+
decorations: DecorationSet;
|
|
50
|
+
|
|
51
|
+
constructor(view: EditorView) {
|
|
52
|
+
this.decorations = this.buildDecorations(view);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// NOTE: Decorations may clash with other extensions (e.g., markdown).
|
|
56
|
+
buildDecorations(view: EditorView) {
|
|
57
|
+
const widgets: any[] = [];
|
|
58
|
+
|
|
59
|
+
for (const { from, to } of view.visibleRanges) {
|
|
60
|
+
const text = view.state.doc.sliceString(from, to);
|
|
61
|
+
|
|
62
|
+
// Match comments: {{! comment }}
|
|
63
|
+
// {
|
|
64
|
+
// let match;
|
|
65
|
+
// while ((match = regex.comment.exec(text)) !== null) {
|
|
66
|
+
// const start = from + match.index;
|
|
67
|
+
// const end = start + match[0].length;
|
|
68
|
+
// widgets.push(Decoration.mark({ class: '!text-roseText' }).range(start, end));
|
|
69
|
+
// }
|
|
70
|
+
// }
|
|
71
|
+
|
|
72
|
+
// Match brackets: {{ and }}
|
|
73
|
+
{
|
|
74
|
+
let match;
|
|
75
|
+
while ((match = regex.brackets.exec(text)) !== null) {
|
|
76
|
+
const start = from + match.index;
|
|
77
|
+
const end = start + match[0].length;
|
|
78
|
+
widgets.push(Decoration.mark({ class: 'text-subdued' }).range(start, end));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Match commands: {{#command}} and {{/command}}
|
|
83
|
+
{
|
|
84
|
+
let match;
|
|
85
|
+
while ((match = regex.command.exec(text)) !== null) {
|
|
86
|
+
const start = from + match.index + 2;
|
|
87
|
+
let end = start + match[0].length - 4;
|
|
88
|
+
const text = view.state.doc.sliceString(start, end);
|
|
89
|
+
const parts = text.split(/\s+/);
|
|
90
|
+
if (parts.length > 1) {
|
|
91
|
+
const idx = start + parts[0].length;
|
|
92
|
+
widgets.push(Decoration.mark({ class: 'text-greenText' }).range(idx, end));
|
|
93
|
+
end = idx;
|
|
94
|
+
}
|
|
95
|
+
widgets.push(Decoration.mark({ class: 'text-blueText' }).range(start, end));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Match variables: {{var}}
|
|
100
|
+
{
|
|
101
|
+
let match;
|
|
102
|
+
while ((match = regex.var.exec(text)) !== null) {
|
|
103
|
+
const start = from + match.index + 2;
|
|
104
|
+
const end = start + match[0].length - 4;
|
|
105
|
+
widgets.push(Decoration.mark({ class: 'text-greenText' }).range(start, end));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Sort decorations by position to avoid "Ranges must be added sorted" error.
|
|
111
|
+
widgets.sort((a, b) => a.from - b.from || a.startSide - b.startSide);
|
|
112
|
+
return Decoration.set(widgets);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
update(update: ViewUpdate) {
|
|
116
|
+
if (update.docChanged || update.viewportChanged) {
|
|
117
|
+
this.decorations = this.buildDecorations(update.view);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
decorations: (v) => v.decorations,
|
|
123
|
+
},
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
// TODO(burdon): Pass in variables.
|
|
127
|
+
const variables = ['this'];
|
|
128
|
+
const commands = ['this', 'each', 'if', 'unless', 'with'];
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Provides completions for Handlebars variables.
|
|
132
|
+
*/
|
|
133
|
+
function handlebarsCompletions(context: CompletionContext): CompletionResult | null {
|
|
134
|
+
const match = context.matchBefore(/\{\{[^}]*/);
|
|
135
|
+
if (!match || match.from === match.to) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
let type = 'variable';
|
|
140
|
+
let text = match.text.slice(2);
|
|
141
|
+
let from = match.from + 2;
|
|
142
|
+
let matches = [];
|
|
143
|
+
if (text.startsWith('#') || text.startsWith('/')) {
|
|
144
|
+
const idx = text.lastIndexOf(' ');
|
|
145
|
+
if (idx !== -1) {
|
|
146
|
+
type = 'variable';
|
|
147
|
+
matches = variables;
|
|
148
|
+
text = text.slice(idx + 1);
|
|
149
|
+
from += idx + 1;
|
|
150
|
+
} else {
|
|
151
|
+
type = 'command';
|
|
152
|
+
text = text.slice(1);
|
|
153
|
+
matches = commands;
|
|
154
|
+
from += 1;
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
type = 'variable';
|
|
158
|
+
matches = variables;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const options = matches.filter((name) => name.startsWith(text)).map((name) => ({ type, label: name }));
|
|
162
|
+
return {
|
|
163
|
+
from,
|
|
164
|
+
options,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import type * as Tool from '@effect/ai/Tool';
|
|
6
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { type AgentStatus } from '@dxos/ai';
|
|
9
|
+
import { useTranslation } from '@dxos/react-ui';
|
|
10
|
+
import {
|
|
11
|
+
NumericTabs,
|
|
12
|
+
TextCrawl,
|
|
13
|
+
ToggleContainer,
|
|
14
|
+
chatMessageJson,
|
|
15
|
+
chatMessagePanel,
|
|
16
|
+
chatMessagePanelContent,
|
|
17
|
+
chatMessagePanelHeader,
|
|
18
|
+
} from '@dxos/react-ui-components';
|
|
19
|
+
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
20
|
+
import { type ContentBlock, type DataType } from '@dxos/schema';
|
|
21
|
+
import { isNonNullable, safeParseJson } from '@dxos/util';
|
|
22
|
+
|
|
23
|
+
import { meta } from '../../meta';
|
|
24
|
+
|
|
25
|
+
export const isToolMessage = (message: DataType.Message) => {
|
|
26
|
+
return message.blocks.some((block) => block._tag === 'toolCall' || block._tag === 'toolResult');
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type ToolBlockProps = {
|
|
30
|
+
blocks: ContentBlock.Any[];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const ToolBlock = ({ blocks = [] }: ToolBlockProps) => {
|
|
34
|
+
const { t } = useTranslation(meta.id);
|
|
35
|
+
|
|
36
|
+
const getToolCaption = (tool?: Tool.Any, status?: AgentStatus) => {
|
|
37
|
+
if (!tool) {
|
|
38
|
+
return t('calling tool label');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return status?.message ?? tool.description ?? [t('calling label'), tool.name].join(' ');
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const items = useMemo(() => {
|
|
45
|
+
let lastToolCall: { tool: Tool.Any | undefined; block: ContentBlock.ToolCall } | undefined;
|
|
46
|
+
// TODO(burdon): Get from context?
|
|
47
|
+
const tools: Tool.Any[] = []; //processor.conversation.toolkit?.tools ?? [];
|
|
48
|
+
return blocks
|
|
49
|
+
.filter((block) => block._tag === 'toolCall' || block._tag === 'toolResult' || block._tag === 'summary')
|
|
50
|
+
.map((block) => {
|
|
51
|
+
switch (block._tag) {
|
|
52
|
+
case 'toolCall': {
|
|
53
|
+
if (block.pending && lastToolCall?.block.toolCallId === block.toolCallId) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const tool = tools.find((tool) => tool.name === block.name);
|
|
58
|
+
lastToolCall = { tool, block };
|
|
59
|
+
return {
|
|
60
|
+
title: getToolCaption(lastToolCall?.tool),
|
|
61
|
+
content: {
|
|
62
|
+
...block,
|
|
63
|
+
input: safeParseJson(block.input),
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
case 'toolResult': {
|
|
69
|
+
// TODO(burdon): Parse error type.
|
|
70
|
+
if (block.error) {
|
|
71
|
+
return {
|
|
72
|
+
title: t('error label'),
|
|
73
|
+
content: block,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const title = getToolCaption(lastToolCall?.tool ?? t('tool result label'));
|
|
78
|
+
lastToolCall = undefined;
|
|
79
|
+
return {
|
|
80
|
+
title,
|
|
81
|
+
content: {
|
|
82
|
+
...block,
|
|
83
|
+
result: safeParseJson(block.result),
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
case 'summary': {
|
|
89
|
+
if (!lastToolCall) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
title: t('summary label'),
|
|
95
|
+
content: block,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
.filter(isNonNullable);
|
|
101
|
+
}, [blocks]);
|
|
102
|
+
|
|
103
|
+
if (!items.length) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return <ToolContainer items={items} />;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
ToolBlock.displayName = 'ToolBlock';
|
|
111
|
+
|
|
112
|
+
type ToolContainerParams = {
|
|
113
|
+
items: { title: string; content: any }[];
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// TODO(burdon): Maintain scroll position when closing.
|
|
117
|
+
export const ToolContainer = ({ items }: ToolContainerParams) => {
|
|
118
|
+
const tabsRef = useRef<HTMLDivElement>(null);
|
|
119
|
+
const [selected, setSelected] = useState(0);
|
|
120
|
+
const [open, setOpen] = useState(false);
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (open) {
|
|
123
|
+
tabsRef.current?.focus();
|
|
124
|
+
}
|
|
125
|
+
}, [open]);
|
|
126
|
+
|
|
127
|
+
const handleSelect = (index: number) => {
|
|
128
|
+
setSelected(index);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const data = items[selected]?.content;
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<ToggleContainer.Root classNames={chatMessagePanel} open={open} onChangeOpen={setOpen}>
|
|
135
|
+
<ToggleContainer.Header classNames={chatMessagePanelHeader}>
|
|
136
|
+
<TextCrawl key='status-roll' lines={items.map((item) => item.title)} />
|
|
137
|
+
</ToggleContainer.Header>
|
|
138
|
+
<ToggleContainer.Content classNames={['grid grid-cols-[32px_1fr]', chatMessagePanelContent]}>
|
|
139
|
+
<NumericTabs ref={tabsRef} classNames='p-1' length={items.length} selected={selected} onSelect={handleSelect} />
|
|
140
|
+
<Json
|
|
141
|
+
data={data}
|
|
142
|
+
classNames={chatMessageJson}
|
|
143
|
+
replacer={{
|
|
144
|
+
maxDepth: 3,
|
|
145
|
+
maxArrayLen: 10,
|
|
146
|
+
maxStringLen: 128,
|
|
147
|
+
}}
|
|
148
|
+
/>
|
|
149
|
+
</ToggleContainer.Content>
|
|
150
|
+
</ToggleContainer.Root>
|
|
151
|
+
);
|
|
152
|
+
};
|