@dxos/plugin-assistant 0.8.3 → 0.8.4-main.c1de068
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/ChatContainer-M3IHQLRS.mjs +54 -0
- package/dist/lib/browser/ChatContainer-M3IHQLRS.mjs.map +7 -0
- package/dist/lib/browser/ChatDialog-X6VN6QZI.mjs +72 -0
- package/dist/lib/browser/ChatDialog-X6VN6QZI.mjs.map +7 -0
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs +162 -0
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +7 -0
- package/dist/lib/browser/{TemplateContainer-QQHVOTSI.mjs → TemplateContainer-RPJ2LBOB.mjs} +5 -6
- package/dist/lib/browser/TemplateContainer-RPJ2LBOB.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-E4H5DCOJ.mjs → app-graph-builder-JTXBKE7O.mjs} +34 -36
- package/dist/lib/browser/app-graph-builder-JTXBKE7O.mjs.map +7 -0
- package/dist/lib/browser/chunk-AEAEKWOC.mjs +98 -0
- package/dist/lib/browser/chunk-AEAEKWOC.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BI6AHRNJ.mjs → chunk-EQDW6BYQ.mjs} +19 -68
- package/dist/lib/browser/chunk-EQDW6BYQ.mjs.map +7 -0
- package/dist/lib/{node/chunk-P74TWGMG.cjs → browser/chunk-FDCJSQYF.mjs} +10 -14
- package/dist/lib/{node-esm/chunk-BB2TAT4P.mjs.map → browser/chunk-FDCJSQYF.mjs.map} +1 -1
- package/dist/lib/browser/chunk-JQBVLTM5.mjs +158 -0
- package/dist/lib/browser/chunk-JQBVLTM5.mjs.map +7 -0
- package/dist/lib/browser/chunk-OWY4CUQY.mjs +2245 -0
- package/dist/lib/browser/chunk-OWY4CUQY.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +87 -119
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs +60 -0
- package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-LXCNUSZN.mjs → react-surface-66VY37YQ.mjs} +42 -51
- package/dist/lib/browser/react-surface-66VY37YQ.mjs.map +7 -0
- package/dist/lib/browser/{settings-XRHXVWGB.mjs → settings-2DGP3UTS.mjs} +6 -6
- package/dist/lib/browser/settings-2DGP3UTS.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -20
- package/dist/lib/node-esm/ChatContainer-VZT74PO2.mjs +55 -0
- package/dist/lib/node-esm/ChatContainer-VZT74PO2.mjs.map +7 -0
- package/dist/lib/node-esm/ChatDialog-RJ6FDX4Q.mjs +73 -0
- package/dist/lib/node-esm/ChatDialog-RJ6FDX4Q.mjs.map +7 -0
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs +163 -0
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +7 -0
- package/dist/lib/node-esm/{TemplateContainer-SOEWY2ZN.mjs → TemplateContainer-A3NAQCZE.mjs} +5 -6
- package/dist/lib/node-esm/TemplateContainer-A3NAQCZE.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-3SY5MBIK.mjs → app-graph-builder-OWSOXFTD.mjs} +34 -36
- package/dist/lib/node-esm/app-graph-builder-OWSOXFTD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-OYN6HLXZ.mjs → chunk-2XL6MNPE.mjs} +44 -33
- package/dist/lib/node-esm/chunk-2XL6MNPE.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BISJDTBK.mjs +159 -0
- package/dist/lib/node-esm/chunk-BISJDTBK.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UCOFKNKN.mjs → chunk-E33DNNDW.mjs} +19 -68
- package/dist/lib/node-esm/chunk-E33DNNDW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +41 -0
- package/dist/lib/{browser/chunk-XOZ7YMO3.mjs.map → node-esm/chunk-QN2H2EHV.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-SENTQAEO.mjs +2246 -0
- package/dist/lib/node-esm/chunk-SENTQAEO.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +87 -119
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs +61 -0
- package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-7HA5EDWY.mjs → react-surface-RJMRBR2M.mjs} +42 -51
- package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-5IAY6BT4.mjs → settings-47RYZOU4.mjs} +6 -6
- package/dist/lib/node-esm/settings-47RYZOU4.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +4 -20
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +2 -2
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +47 -0
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -0
- package/dist/types/src/components/Chat/events.d.ts +30 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -0
- package/dist/types/src/components/Chat/index.d.ts +3 -0
- package/dist/types/src/components/Chat/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +6 -6
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts +8 -0
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts +11 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +9 -0
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts +11 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +11 -0
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +8 -0
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/index.d.ts +6 -0
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +17 -0
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +19 -0
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +241 -0
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +19 -0
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/index.d.ts +2 -0
- package/dist/types/src/components/ChatThread/index.d.ts.map +1 -0
- package/dist/types/src/components/{Thread → ChatThread}/reducer.d.ts +4 -4
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +1 -0
- package/dist/types/src/components/PromptSettings.d.ts +2 -2
- package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
- package/dist/types/src/components/SequenceContainer.d.ts +8 -0
- package/dist/types/src/components/SequenceContainer.d.ts.map +1 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +13 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +8 -0
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/SequenceEditor/index.d.ts +2 -0
- package/dist/types/src/components/SequenceEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateContainer.d.ts +5 -5
- package/dist/types/src/components/TemplateContainer.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -2
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +3 -3
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +3 -3
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +11 -4
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +6 -12
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/hooks/{processor.d.ts → chat-processor.d.ts} +36 -22
- package/dist/types/src/hooks/chat-processor.d.ts.map +1 -0
- package/dist/types/src/hooks/chat-processor.test.d.ts +2 -0
- package/dist/types/src/hooks/chat-processor.test.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +5 -5
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/presets.d.ts +13 -0
- package/dist/types/src/hooks/presets.d.ts.map +1 -0
- package/dist/types/src/hooks/useBlueprints.d.ts +9 -0
- package/dist/types/src/hooks/useBlueprints.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +20 -8
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +14 -0
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts +7 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -0
- package/dist/types/src/parser/index.d.ts +1 -1
- package/dist/types/src/parser/index.d.ts.map +1 -1
- package/dist/types/src/queue-logger.d.ts +5 -5
- package/dist/types/src/queue-logger.d.ts.map +1 -1
- package/dist/types/src/stories/Chat.stories.d.ts +249 -0
- package/dist/types/src/stories/Chat.stories.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-sequence.d.ts +8 -0
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +77 -113
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -3
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +88 -0
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/src/types/service.d.ts +9 -9
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +80 -74
- package/src/AssistantPlugin.tsx +20 -47
- package/src/capabilities/app-graph-builder.ts +35 -30
- package/src/capabilities/index.ts +0 -3
- package/src/capabilities/intent-resolver.ts +27 -14
- package/src/capabilities/react-surface.tsx +38 -37
- package/src/capabilities/settings.ts +3 -3
- package/src/components/AssistantSettings/AssistantSettings.tsx +4 -4
- package/src/components/Chat/Chat.tsx +388 -0
- package/src/components/Chat/events.ts +50 -0
- package/src/components/Chat/index.ts +7 -0
- package/src/components/ChatContainer.tsx +26 -20
- package/src/components/ChatDialog.tsx +64 -0
- package/src/components/ChatPrompt/ChatActions.tsx +71 -0
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +52 -0
- package/src/components/ChatPrompt/ChatPresets.tsx +28 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +53 -0
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +39 -0
- package/src/components/ChatPrompt/index.ts +9 -0
- package/src/components/ChatThread/ChatMessage.tsx +268 -0
- package/src/components/ChatThread/ChatThread.stories.tsx +143 -0
- package/src/components/ChatThread/ChatThread.tsx +57 -0
- package/src/components/{Thread/ToolInvocations.tsx → ChatThread/ToolBlock.tsx} +36 -21
- package/src/{experimental/transcription → components/ChatThread}/index.ts +2 -0
- package/src/components/{Thread → ChatThread}/reducer.ts +14 -14
- package/src/components/PromptSettings.tsx +43 -45
- package/src/components/SequenceContainer.tsx +132 -0
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +32 -0
- package/src/components/{BlueprintEditor/BlueprintEditor.tsx → SequenceEditor/SequenceEditor.tsx} +7 -7
- package/src/components/{AmbientDialog → SequenceEditor}/index.ts +1 -1
- package/src/components/TemplateContainer.tsx +8 -7
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +28 -33
- package/src/components/TemplateEditor/TemplateEditor.tsx +32 -19
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +15 -15
- package/src/components/TemplateEditor/TemplateForm.tsx +47 -55
- package/src/components/Toolbox/Toolbox.stories.tsx +5 -6
- package/src/components/Toolbox/Toolbox.tsx +60 -4
- package/src/components/index.ts +4 -5
- package/src/events.ts +2 -2
- package/src/hooks/{processor.test.ts → chat-processor.test.ts} +3 -2
- package/src/hooks/chat-processor.ts +314 -0
- package/src/hooks/index.ts +5 -5
- package/src/hooks/presets.ts +52 -0
- package/src/hooks/useBlueprints.ts +57 -0
- package/src/hooks/useChatProcessor.ts +143 -0
- package/src/hooks/useChatServices.ts +91 -0
- package/src/hooks/{useContextProvider.ts → useReferencesProvider.ts} +14 -14
- package/src/parser/index.ts +1 -1
- package/src/queue-logger.ts +6 -6
- package/src/stories/Chat.stories.tsx +378 -0
- package/src/testing/index.ts +1 -1
- package/src/testing/test-functions.ts +1 -1
- package/src/testing/test-sequence.ts +51 -0
- package/src/tools/openapi.test.ts +11 -11
- package/src/translations.ts +43 -23
- package/src/types/index.ts +1 -3
- package/src/types/schema.ts +95 -0
- package/dist/lib/browser/AssistantDialog-MQOOR364.mjs +0 -47
- package/dist/lib/browser/AssistantDialog-MQOOR364.mjs.map +0 -7
- package/dist/lib/browser/BlueprintContainer-AT5Y7EXG.mjs +0 -321
- package/dist/lib/browser/BlueprintContainer-AT5Y7EXG.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-C2NEAS3A.mjs +0 -40
- package/dist/lib/browser/ChatContainer-C2NEAS3A.mjs.map +0 -7
- package/dist/lib/browser/TemplateContainer-QQHVOTSI.mjs.map +0 -7
- package/dist/lib/browser/ai-client-MK2ZZII2.mjs +0 -39
- package/dist/lib/browser/ai-client-MK2ZZII2.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-E4H5DCOJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-AAOKC2JN.mjs +0 -208
- package/dist/lib/browser/chunk-AAOKC2JN.mjs.map +0 -7
- package/dist/lib/browser/chunk-BI6AHRNJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-JO4W3MF7.mjs +0 -2101
- package/dist/lib/browser/chunk-JO4W3MF7.mjs.map +0 -7
- package/dist/lib/browser/chunk-JQFUME3B.mjs +0 -87
- package/dist/lib/browser/chunk-JQFUME3B.mjs.map +0 -7
- package/dist/lib/browser/chunk-MEGMOFJB.mjs +0 -16
- package/dist/lib/browser/chunk-MEGMOFJB.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q6UZ4F3H.mjs +0 -96
- package/dist/lib/browser/chunk-Q6UZ4F3H.mjs.map +0 -7
- package/dist/lib/browser/chunk-UE3IZ4PN.mjs +0 -15
- package/dist/lib/browser/chunk-UE3IZ4PN.mjs.map +0 -7
- package/dist/lib/browser/chunk-XOZ7YMO3.mjs +0 -20
- package/dist/lib/browser/intent-resolver-3UICTGPM.mjs +0 -43
- package/dist/lib/browser/intent-resolver-3UICTGPM.mjs.map +0 -7
- package/dist/lib/browser/react-surface-LXCNUSZN.mjs.map +0 -7
- package/dist/lib/browser/settings-XRHXVWGB.mjs.map +0 -7
- package/dist/lib/node/AssistantDialog-AN4Z6YUV.cjs +0 -73
- package/dist/lib/node/AssistantDialog-AN4Z6YUV.cjs.map +0 -7
- package/dist/lib/node/BlueprintContainer-NOWLDYCZ.cjs +0 -344
- package/dist/lib/node/BlueprintContainer-NOWLDYCZ.cjs.map +0 -7
- package/dist/lib/node/ChatContainer-VKYBQHUB.cjs +0 -68
- package/dist/lib/node/ChatContainer-VKYBQHUB.cjs.map +0 -7
- package/dist/lib/node/TemplateContainer-JZF2DCCG.cjs +0 -58
- package/dist/lib/node/TemplateContainer-JZF2DCCG.cjs.map +0 -7
- package/dist/lib/node/ai-client-7HNSMUMT.cjs +0 -53
- package/dist/lib/node/ai-client-7HNSMUMT.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-PPR5B5KU.cjs +0 -235
- package/dist/lib/node/app-graph-builder-PPR5B5KU.cjs.map +0 -7
- package/dist/lib/node/chunk-4EEWTDQK.cjs +0 -117
- package/dist/lib/node/chunk-4EEWTDQK.cjs.map +0 -7
- package/dist/lib/node/chunk-FUAGEO7Q.cjs +0 -52
- package/dist/lib/node/chunk-FUAGEO7Q.cjs.map +0 -7
- package/dist/lib/node/chunk-HRNIUYVQ.cjs +0 -128
- package/dist/lib/node/chunk-HRNIUYVQ.cjs.map +0 -7
- package/dist/lib/node/chunk-IKZBMHSW.cjs +0 -184
- package/dist/lib/node/chunk-IKZBMHSW.cjs.map +0 -7
- package/dist/lib/node/chunk-LMDJEGZ2.cjs +0 -233
- package/dist/lib/node/chunk-LMDJEGZ2.cjs.map +0 -7
- package/dist/lib/node/chunk-NIDICM57.cjs +0 -2080
- package/dist/lib/node/chunk-NIDICM57.cjs.map +0 -7
- package/dist/lib/node/chunk-P74TWGMG.cjs.map +0 -7
- package/dist/lib/node/chunk-QGPWY6GW.cjs +0 -34
- package/dist/lib/node/chunk-QGPWY6GW.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -289
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-QSWGTKON.cjs +0 -58
- package/dist/lib/node/intent-resolver-QSWGTKON.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/react-surface-D3NBYRZ6.cjs +0 -172
- package/dist/lib/node/react-surface-D3NBYRZ6.cjs.map +0 -7
- package/dist/lib/node/settings-2JXLKYGE.cjs +0 -36
- package/dist/lib/node/settings-2JXLKYGE.cjs.map +0 -7
- package/dist/lib/node/types/index.cjs +0 -54
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/AssistantDialog-6WEMLUPU.mjs +0 -48
- package/dist/lib/node-esm/AssistantDialog-6WEMLUPU.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-STOJAVML.mjs +0 -322
- package/dist/lib/node-esm/BlueprintContainer-STOJAVML.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-3MVBTUJN.mjs +0 -41
- package/dist/lib/node-esm/ChatContainer-3MVBTUJN.mjs.map +0 -7
- package/dist/lib/node-esm/TemplateContainer-SOEWY2ZN.mjs.map +0 -7
- package/dist/lib/node-esm/ai-client-XGZBJ6BE.mjs +0 -40
- package/dist/lib/node-esm/ai-client-XGZBJ6BE.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-3SY5MBIK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-34EX6E5Q.mjs +0 -18
- package/dist/lib/node-esm/chunk-34EX6E5Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3UEZLJ2V.mjs +0 -16
- package/dist/lib/node-esm/chunk-3UEZLJ2V.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BB2TAT4P.mjs +0 -22
- package/dist/lib/node-esm/chunk-CDAILLCU.mjs +0 -98
- package/dist/lib/node-esm/chunk-CDAILLCU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-J6UXXZGJ.mjs +0 -209
- package/dist/lib/node-esm/chunk-J6UXXZGJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OD574YIU.mjs +0 -2102
- package/dist/lib/node-esm/chunk-OD574YIU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OYN6HLXZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UCOFKNKN.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-E6MXTYAU.mjs +0 -44
- package/dist/lib/node-esm/intent-resolver-E6MXTYAU.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-7HA5EDWY.mjs.map +0 -7
- package/dist/lib/node-esm/settings-5IAY6BT4.mjs.map +0 -7
- package/dist/types/src/capabilities/ai-client.d.ts +0 -5
- package/dist/types/src/capabilities/ai-client.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -6
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts +0 -10
- package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts.map +0 -1
- package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts +0 -8
- package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/AmbientDialog/index.d.ts +0 -2
- package/dist/types/src/components/AmbientDialog/index.d.ts.map +0 -1
- package/dist/types/src/components/AssistantDialog.d.ts +0 -7
- package/dist/types/src/components/AssistantDialog.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintContainer.d.ts +0 -9
- package/dist/types/src/components/BlueprintContainer.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts +0 -13
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.stories.d.ts +0 -8
- package/dist/types/src/components/BlueprintEditor/BlueprintEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintEditor/index.d.ts +0 -2
- package/dist/types/src/components/BlueprintEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/Prompt.d.ts +0 -23
- package/dist/types/src/components/Prompt/Prompt.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts +0 -13
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/PromptBar.d.ts +0 -16
- package/dist/types/src/components/Prompt/PromptBar.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/PromptBar.stories.d.ts +0 -9
- package/dist/types/src/components/Prompt/PromptBar.stories.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/autocomplete.d.ts +0 -25
- package/dist/types/src/components/Prompt/autocomplete.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/index.d.ts +0 -3
- package/dist/types/src/components/Prompt/index.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/references.d.ts +0 -30
- package/dist/types/src/components/Prompt/references.d.ts.map +0 -1
- package/dist/types/src/components/Thread/Thread.d.ts +0 -28
- package/dist/types/src/components/Thread/Thread.d.ts.map +0 -1
- package/dist/types/src/components/Thread/Thread.stories.d.ts +0 -11
- package/dist/types/src/components/Thread/Thread.stories.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ThreadContainer.d.ts +0 -13
- package/dist/types/src/components/Thread/ThreadContainer.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts +0 -16
- package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ThreadMessage.d.ts +0 -16
- package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ToolInvocations.d.ts +0 -13
- package/dist/types/src/components/Thread/ToolInvocations.d.ts.map +0 -1
- package/dist/types/src/components/Thread/index.d.ts +0 -3
- package/dist/types/src/components/Thread/index.d.ts.map +0 -1
- package/dist/types/src/components/Thread/reducer.d.ts.map +0 -1
- package/dist/types/src/experimental/transcription/index.d.ts +0 -1
- package/dist/types/src/experimental/transcription/index.d.ts.map +0 -1
- package/dist/types/src/hooks/processor.d.ts.map +0 -1
- package/dist/types/src/hooks/processor.test.d.ts +0 -2
- package/dist/types/src/hooks/processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/useContextProvider.d.ts +0 -17
- package/dist/types/src/hooks/useContextProvider.d.ts.map +0 -1
- package/dist/types/src/hooks/useMessageQueue.d.ts +0 -42
- package/dist/types/src/hooks/useMessageQueue.d.ts.map +0 -1
- package/dist/types/src/hooks/useServices.d.ts +0 -7
- package/dist/types/src/hooks/useServices.d.ts.map +0 -1
- package/dist/types/src/hooks/useTextInputEvents.d.ts +0 -13
- package/dist/types/src/hooks/useTextInputEvents.d.ts.map +0 -1
- package/dist/types/src/stories/Prompt.stories.d.ts +0 -8
- package/dist/types/src/stories/Prompt.stories.d.ts.map +0 -1
- package/dist/types/src/stories/Query.stories.d.ts +0 -19
- package/dist/types/src/stories/Query.stories.d.ts.map +0 -1
- package/dist/types/src/stories/Research.stories.d.ts +0 -15
- package/dist/types/src/stories/Research.stories.d.ts.map +0 -1
- package/dist/types/src/stories/test-data.d.ts +0 -3
- package/dist/types/src/stories/test-data.d.ts.map +0 -1
- package/dist/types/src/stories/testing.d.ts +0 -12
- package/dist/types/src/stories/testing.d.ts.map +0 -1
- package/dist/types/src/testing/test-blueprint.d.ts +0 -8
- package/dist/types/src/testing/test-blueprint.d.ts.map +0 -1
- package/dist/types/src/types/chat.d.ts +0 -23
- package/dist/types/src/types/chat.d.ts.map +0 -1
- package/dist/types/src/types/template.d.ts +0 -56
- package/dist/types/src/types/template.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -50
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/capabilities/ai-client.ts +0 -42
- package/src/capabilities/capabilities.ts +0 -15
- package/src/components/AmbientDialog/AmbientDialog.stories.tsx +0 -84
- package/src/components/AmbientDialog/AmbientDialog.tsx +0 -117
- package/src/components/AssistantDialog.tsx +0 -37
- package/src/components/BlueprintContainer.tsx +0 -148
- package/src/components/BlueprintEditor/BlueprintEditor.stories.tsx +0 -32
- package/src/components/BlueprintEditor/index.ts +0 -5
- package/src/components/Prompt/Prompt.stories.tsx +0 -121
- package/src/components/Prompt/Prompt.tsx +0 -124
- package/src/components/Prompt/PromptBar.stories.tsx +0 -69
- package/src/components/Prompt/PromptBar.tsx +0 -105
- package/src/components/Prompt/autocomplete.ts +0 -218
- package/src/components/Prompt/index.ts +0 -6
- package/src/components/Prompt/references.ts +0 -180
- package/src/components/Thread/Thread.stories.tsx +0 -201
- package/src/components/Thread/Thread.tsx +0 -118
- package/src/components/Thread/ThreadContainer.stories.tsx +0 -283
- package/src/components/Thread/ThreadContainer.tsx +0 -105
- package/src/components/Thread/ThreadMessage.tsx +0 -234
- package/src/components/Thread/index.ts +0 -6
- package/src/hooks/processor.ts +0 -238
- package/src/hooks/useChatProcessor.tsx +0 -97
- package/src/hooks/useMessageQueue.ts +0 -22
- package/src/hooks/useServices.ts +0 -28
- package/src/hooks/useTextInputEvents.ts +0 -49
- package/src/stories/Prompt.stories.tsx +0 -60
- package/src/stories/Query.stories.tsx +0 -514
- package/src/stories/Research.stories.tsx +0 -482
- package/src/stories/test-data.ts +0 -128
- package/src/stories/testing.ts +0 -60
- package/src/testing/test-blueprint.ts +0 -58
- package/src/types/chat.ts +0 -32
- package/src/types/template.ts +0 -66
- package/src/types/types.ts +0 -48
package/src/components/{BlueprintEditor/BlueprintEditor.tsx → SequenceEditor/SequenceEditor.tsx}
RENAMED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { forwardRef, useImperativeHandle } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { SequenceDefinition } from '@dxos/conductor';
|
|
8
8
|
import { Type } from '@dxos/echo';
|
|
9
9
|
import { useThemeContext, type ThemedClassName } from '@dxos/react-ui';
|
|
10
10
|
import {
|
|
@@ -16,16 +16,16 @@ import {
|
|
|
16
16
|
} from '@dxos/react-ui-editor';
|
|
17
17
|
import { mx } from '@dxos/react-ui-theme';
|
|
18
18
|
|
|
19
|
-
export type
|
|
20
|
-
|
|
19
|
+
export type SequenceEditorProps = ThemedClassName<{
|
|
20
|
+
sequence: SequenceDefinition;
|
|
21
21
|
}>;
|
|
22
22
|
|
|
23
23
|
// TODO(burdon): Factor out JsonEditor.
|
|
24
|
-
export const
|
|
25
|
-
({ classNames,
|
|
24
|
+
export const SequenceEditor = forwardRef<EditorView | undefined, SequenceEditorProps>(
|
|
25
|
+
({ classNames, sequence }, forwardedRef) => {
|
|
26
26
|
const { themeMode } = useThemeContext();
|
|
27
27
|
const { parentRef, view } = useTextEditor({
|
|
28
|
-
initialValue: JSON.stringify(
|
|
28
|
+
initialValue: JSON.stringify(sequence, null, 2),
|
|
29
29
|
extensions: [
|
|
30
30
|
createBasicExtensions({
|
|
31
31
|
lineNumbers: true,
|
|
@@ -38,7 +38,7 @@ export const BlueprintEditor = forwardRef<EditorView | undefined, BlueprintEdito
|
|
|
38
38
|
syntaxHighlighting: true,
|
|
39
39
|
}),
|
|
40
40
|
createJsonExtensions({
|
|
41
|
-
schema: Type.toJsonSchema(
|
|
41
|
+
schema: Type.toJsonSchema(SequenceDefinition, { strict: true }),
|
|
42
42
|
}),
|
|
43
43
|
],
|
|
44
44
|
});
|
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { type Template } from '@dxos/blueprints';
|
|
8
|
+
import { StackItem } from '@dxos/react-ui-stack';
|
|
8
9
|
|
|
9
10
|
import { TemplateEditor } from './TemplateEditor';
|
|
10
|
-
import { type TemplateType } from '../types';
|
|
11
11
|
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
export type TemplateContainerProps = {
|
|
13
|
+
template: Template.Template;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const TemplateContainer = ({ template }: TemplateContainerProps) => {
|
|
16
17
|
return (
|
|
17
|
-
<StackItem.Content
|
|
18
|
+
<StackItem.Content classNames='container-max-width'>
|
|
18
19
|
<TemplateEditor template={template} />
|
|
19
20
|
</StackItem.Content>
|
|
20
21
|
);
|
|
@@ -4,48 +4,43 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type Meta } from '@storybook/react';
|
|
7
|
+
import { type Meta } from '@storybook/react-vite';
|
|
8
8
|
import React, { useState } from 'react';
|
|
9
9
|
|
|
10
|
-
import { createSystemPrompt } from '@dxos/
|
|
11
|
-
import {
|
|
10
|
+
import { createSystemPrompt } from '@dxos/assistant';
|
|
11
|
+
import { Template } from '@dxos/blueprints';
|
|
12
12
|
import { useClient } from '@dxos/react-client';
|
|
13
13
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
14
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
14
|
+
import { ColumnContainer, withLayout, withTheme } from '@dxos/storybook-utils';
|
|
15
|
+
import { trim } from '@dxos/util';
|
|
15
16
|
|
|
16
17
|
import { TemplateEditor, type TemplateEditorProps } from './TemplateEditor';
|
|
17
|
-
import translations from '../../translations';
|
|
18
|
-
import { TemplateType } from '../../types';
|
|
18
|
+
import { translations } from '../../translations';
|
|
19
19
|
|
|
20
|
-
const TEMPLATE =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
'',
|
|
27
|
-
'{{#each artifacts}}',
|
|
28
|
-
'- {{this}}',
|
|
29
|
-
'{{/each}}',
|
|
30
|
-
'',
|
|
31
|
-
'---',
|
|
32
|
-
'',
|
|
33
|
-
'{{input}}',
|
|
34
|
-
'',
|
|
35
|
-
].join('\n');
|
|
20
|
+
const TEMPLATE = trim`
|
|
21
|
+
{{! System Prompt }}
|
|
22
|
+
|
|
23
|
+
You are a machine that is an expert chess player.
|
|
24
|
+
The move history of the current game is: {{history}}
|
|
25
|
+
If asked to suggest a move explain why it is a good move.
|
|
36
26
|
|
|
37
|
-
|
|
27
|
+
{{#each artifacts}}
|
|
28
|
+
- {{this}}
|
|
29
|
+
{{/each}}
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
{{input}}
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
const DefaultStory = ({ source }: TemplateEditorProps & { source: string }) => {
|
|
38
37
|
const client = useClient();
|
|
39
38
|
const [template] = useState(() => {
|
|
40
39
|
const space = client.spaces.default;
|
|
41
|
-
return space.db.add(
|
|
40
|
+
return space.db.add(Template.make({ source }));
|
|
42
41
|
});
|
|
43
42
|
|
|
44
|
-
return
|
|
45
|
-
<div role='none' className='flex w-[50rem] overflow-hidden border-x border-separator'>
|
|
46
|
-
<TemplateEditor template={template} />
|
|
47
|
-
</div>
|
|
48
|
-
);
|
|
43
|
+
return <TemplateEditor template={template} />;
|
|
49
44
|
};
|
|
50
45
|
|
|
51
46
|
const meta: Meta<typeof DefaultStory> = {
|
|
@@ -56,9 +51,9 @@ const meta: Meta<typeof DefaultStory> = {
|
|
|
56
51
|
withClientProvider({
|
|
57
52
|
createIdentity: true,
|
|
58
53
|
createSpace: true,
|
|
59
|
-
types: [
|
|
54
|
+
types: [Template.Template],
|
|
60
55
|
}),
|
|
61
|
-
withLayout({ fullscreen: true,
|
|
56
|
+
withLayout({ fullscreen: true, Container: ColumnContainer }),
|
|
62
57
|
withTheme,
|
|
63
58
|
],
|
|
64
59
|
parameters: {
|
|
@@ -72,12 +67,12 @@ type Story = Meta<typeof DefaultStory>;
|
|
|
72
67
|
|
|
73
68
|
export const Default: Story = {
|
|
74
69
|
args: {
|
|
75
|
-
|
|
70
|
+
source: TEMPLATE,
|
|
76
71
|
},
|
|
77
72
|
};
|
|
78
73
|
|
|
79
74
|
export const System: Story = {
|
|
80
75
|
args: {
|
|
81
|
-
|
|
76
|
+
source: createSystemPrompt({}),
|
|
82
77
|
},
|
|
83
78
|
};
|
|
@@ -7,6 +7,8 @@ import { styleTags, tags } from '@lezer/highlight';
|
|
|
7
7
|
import { handlebarsLanguage } from '@xiechao/codemirror-lang-handlebars';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
|
+
import { type Template } from '@dxos/blueprints';
|
|
11
|
+
import { invariant } from '@dxos/invariant';
|
|
10
12
|
import { createDocAccessor } from '@dxos/react-client/echo';
|
|
11
13
|
import { useThemeContext, useTranslation, type ThemedClassName } from '@dxos/react-ui';
|
|
12
14
|
import {
|
|
@@ -17,8 +19,7 @@ import {
|
|
|
17
19
|
} from '@dxos/react-ui-editor';
|
|
18
20
|
import { mx } from '@dxos/react-ui-theme';
|
|
19
21
|
|
|
20
|
-
import {
|
|
21
|
-
import { type TemplateType } from '../../types';
|
|
22
|
+
import { meta } from '../../meta';
|
|
22
23
|
|
|
23
24
|
handlebarsLanguage.configure({
|
|
24
25
|
props: [
|
|
@@ -29,48 +30,60 @@ handlebarsLanguage.configure({
|
|
|
29
30
|
});
|
|
30
31
|
|
|
31
32
|
export type TemplateEditorProps = ThemedClassName<{
|
|
32
|
-
template:
|
|
33
|
+
template: Template.Template;
|
|
33
34
|
}>;
|
|
34
35
|
|
|
35
36
|
export const TemplateEditor = ({ classNames, template }: TemplateEditorProps) => {
|
|
36
|
-
const { t } = useTranslation(
|
|
37
|
+
const { t } = useTranslation(meta.id);
|
|
37
38
|
const { themeMode } = useThemeContext();
|
|
38
|
-
const { parentRef } = useTextEditor(
|
|
39
|
-
()
|
|
40
|
-
|
|
39
|
+
const { parentRef } = useTextEditor(() => {
|
|
40
|
+
invariant(template.source.target);
|
|
41
|
+
return {
|
|
42
|
+
initialValue: template.source.target.content,
|
|
41
43
|
extensions: [
|
|
42
44
|
createDataExtensions({
|
|
43
45
|
id: template.id,
|
|
44
|
-
text: template.source
|
|
46
|
+
text: createDocAccessor(template.source.target, ['content']),
|
|
45
47
|
}),
|
|
46
48
|
createBasicExtensions({
|
|
47
49
|
bracketMatching: false,
|
|
50
|
+
lineNumbers: true,
|
|
48
51
|
lineWrapping: true,
|
|
52
|
+
monospace: true,
|
|
49
53
|
placeholder: t('template placeholder'),
|
|
50
54
|
}),
|
|
51
55
|
createThemeExtensions({
|
|
52
56
|
themeMode,
|
|
53
|
-
slots: {
|
|
54
|
-
content: { className: '!p-3' },
|
|
55
|
-
},
|
|
56
57
|
}),
|
|
57
58
|
|
|
58
59
|
// https://github.com/xiechao/lang-handlebars
|
|
59
60
|
new LanguageSupport(handlebarsLanguage, syntaxHighlighting(handlebarsHighlightStyle)),
|
|
60
61
|
],
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
);
|
|
62
|
+
};
|
|
63
|
+
}, [themeMode, template]);
|
|
64
64
|
|
|
65
|
-
return <div ref={parentRef} className={mx(classNames)} />;
|
|
65
|
+
return <div ref={parentRef} className={mx('h-full', classNames)} />;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* https://github.com/xiechao/lang-handlebars/blob/direct/src/highlight.js
|
|
70
70
|
*/
|
|
71
71
|
export const handlebarsHighlightStyle = HighlightStyle.define([
|
|
72
|
-
{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
{
|
|
73
|
+
// Braces.
|
|
74
|
+
tag: tags.tagName,
|
|
75
|
+
class: 'text-redText',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
tag: tags.variableName,
|
|
79
|
+
class: 'text-blueText',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
tag: tags.keyword,
|
|
83
|
+
class: 'text-greenText',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
tag: tags.comment,
|
|
87
|
+
class: 'text-subdued',
|
|
88
|
+
},
|
|
76
89
|
]);
|
|
@@ -4,33 +4,33 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type Meta } from '@storybook/react';
|
|
7
|
+
import { type Meta } from '@storybook/react-vite';
|
|
8
8
|
import React, { useState } from 'react';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { Template } from '@dxos/blueprints';
|
|
11
11
|
import { useClient } from '@dxos/react-client';
|
|
12
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
13
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
14
|
+
import { trim } from '@dxos/util';
|
|
14
15
|
|
|
15
16
|
import { TemplateForm } from './TemplateForm';
|
|
16
|
-
import translations from '../../translations';
|
|
17
|
-
import { TemplateType } from '../../types';
|
|
17
|
+
import { translations } from '../../translations';
|
|
18
18
|
|
|
19
|
-
const TEMPLATE =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
const TEMPLATE = trim`
|
|
20
|
+
You are a machine that is an expert chess player.
|
|
21
|
+
The move history of the current game is: {{history}}
|
|
22
|
+
If asked to suggest a move explain why it is a good move.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
{{input}},
|
|
27
|
+
`;
|
|
28
28
|
|
|
29
29
|
const DefaultStory = () => {
|
|
30
30
|
const client = useClient();
|
|
31
31
|
const [template] = useState(() => {
|
|
32
32
|
const space = client.spaces.default;
|
|
33
|
-
return space.db.add(
|
|
33
|
+
return space.db.add(Template.make({ source: TEMPLATE }));
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
return (
|
|
@@ -48,7 +48,7 @@ const meta: Meta<typeof TemplateForm> = {
|
|
|
48
48
|
withClientProvider({
|
|
49
49
|
createIdentity: true,
|
|
50
50
|
createSpace: true,
|
|
51
|
-
types: [
|
|
51
|
+
types: [Template.Template],
|
|
52
52
|
}),
|
|
53
53
|
withLayout({ fullscreen: true, classNames: 'flex justify-center' }),
|
|
54
54
|
withTheme,
|
|
@@ -5,34 +5,33 @@
|
|
|
5
5
|
import { type Schema } from 'effect';
|
|
6
6
|
import React, { Fragment, useEffect } from 'react';
|
|
7
7
|
|
|
8
|
+
import { type Template } from '@dxos/blueprints';
|
|
8
9
|
import { Input, Select, useTranslation } from '@dxos/react-ui';
|
|
9
10
|
import { attentionSurface, groupBorder, mx } from '@dxos/react-ui-theme';
|
|
10
11
|
import { isNonNullable } from '@dxos/util';
|
|
11
12
|
|
|
12
13
|
import { TemplateEditor } from './TemplateEditor';
|
|
13
|
-
import {
|
|
14
|
-
import { type TemplateInput, TemplateInputType, type TemplateType } from '../../types';
|
|
14
|
+
import { meta } from '../../meta';
|
|
15
15
|
|
|
16
16
|
export type TemplateFormProps = {
|
|
17
|
-
template:
|
|
17
|
+
template: Template.Template;
|
|
18
18
|
schema?: Schema.Schema<any, any, any>;
|
|
19
19
|
commandEditable?: boolean;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export const TemplateForm = ({ template, commandEditable = true }: TemplateFormProps) => {
|
|
23
|
-
const { t } = useTranslation(
|
|
24
|
-
|
|
23
|
+
const { t } = useTranslation(meta.id);
|
|
25
24
|
usePromptInputs(template);
|
|
26
25
|
|
|
27
26
|
return (
|
|
28
27
|
<div className={mx('flex flex-col w-full overflow-hidden gap-4', groupBorder)}>
|
|
29
|
-
{commandEditable && (
|
|
28
|
+
{/* {commandEditable && (
|
|
30
29
|
<div className='flex items-center pl-4'>
|
|
31
30
|
<span className='text-neutral-500'>/</span>
|
|
32
31
|
<Input.Root>
|
|
33
32
|
<Input.TextInput
|
|
34
33
|
placeholder={t('command placeholder')}
|
|
35
|
-
classNames=
|
|
34
|
+
classNames='is-full bg-transparent m-2'
|
|
36
35
|
value={template.command ?? ''}
|
|
37
36
|
onChange={(event) => {
|
|
38
37
|
template.command = event.target.value.replace(/\w/g, '');
|
|
@@ -40,7 +39,7 @@ export const TemplateForm = ({ template, commandEditable = true }: TemplateFormP
|
|
|
40
39
|
/>
|
|
41
40
|
</Input.Root>
|
|
42
41
|
</div>
|
|
43
|
-
)}
|
|
42
|
+
)} */}
|
|
44
43
|
|
|
45
44
|
<TemplateEditor template={template} classNames={[attentionSurface, 'min-h-[120px]']} />
|
|
46
45
|
|
|
@@ -52,17 +51,17 @@ export const TemplateForm = ({ template, commandEditable = true }: TemplateFormP
|
|
|
52
51
|
|
|
53
52
|
<Input.Root>
|
|
54
53
|
<Select.Root
|
|
55
|
-
value={
|
|
56
|
-
onValueChange={(
|
|
57
|
-
input.
|
|
54
|
+
value={input.kind}
|
|
55
|
+
onValueChange={(kind) => {
|
|
56
|
+
input.kind = kind as Template.InputKind;
|
|
58
57
|
}}
|
|
59
58
|
>
|
|
60
59
|
<Select.TriggerButton placeholder='Type' classNames='is-full' />
|
|
61
60
|
<Select.Portal>
|
|
62
61
|
<Select.Content>
|
|
63
62
|
<Select.Viewport>
|
|
64
|
-
{
|
|
65
|
-
<Select.Option key={
|
|
63
|
+
{inputs.map(({ kind, label }) => (
|
|
64
|
+
<Select.Option key={kind} value={kind}>
|
|
66
65
|
{label}
|
|
67
66
|
</Select.Option>
|
|
68
67
|
))}
|
|
@@ -73,26 +72,20 @@ export const TemplateForm = ({ template, commandEditable = true }: TemplateFormP
|
|
|
73
72
|
</Input.Root>
|
|
74
73
|
|
|
75
74
|
<div>
|
|
76
|
-
{input.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
input.value = event.target.value;
|
|
91
|
-
}}
|
|
92
|
-
/>
|
|
93
|
-
</Input.Root>
|
|
94
|
-
</div>
|
|
95
|
-
)}
|
|
75
|
+
{input.kind !== undefined && ['value', 'context', 'resolver', 'schema'].includes(input.kind) && (
|
|
76
|
+
<div>
|
|
77
|
+
<Input.Root>
|
|
78
|
+
<Input.TextInput
|
|
79
|
+
placeholder={t('command placeholder')}
|
|
80
|
+
classNames='is-full bg-transparent'
|
|
81
|
+
value={input.default ?? ''}
|
|
82
|
+
onChange={(event) => {
|
|
83
|
+
input.default = event.target.value;
|
|
84
|
+
}}
|
|
85
|
+
/>
|
|
86
|
+
</Input.Root>
|
|
87
|
+
</div>
|
|
88
|
+
)}
|
|
96
89
|
</div>
|
|
97
90
|
</Fragment>
|
|
98
91
|
))}
|
|
@@ -102,57 +95,56 @@ export const TemplateForm = ({ template, commandEditable = true }: TemplateFormP
|
|
|
102
95
|
);
|
|
103
96
|
};
|
|
104
97
|
|
|
105
|
-
|
|
98
|
+
// TODO(burdon): Translations.
|
|
99
|
+
const inputs: { kind: Template.InputKind; label: string }[] = [
|
|
106
100
|
{
|
|
107
|
-
|
|
101
|
+
kind: 'value',
|
|
108
102
|
label: 'Value',
|
|
109
103
|
},
|
|
110
104
|
{
|
|
111
|
-
|
|
105
|
+
kind: 'pass-through',
|
|
112
106
|
label: 'Pass through',
|
|
113
107
|
},
|
|
114
108
|
{
|
|
115
|
-
|
|
109
|
+
kind: 'retriever',
|
|
116
110
|
label: 'Retriever',
|
|
117
111
|
},
|
|
118
|
-
// {
|
|
119
|
-
// value: TemplateInputType.FUNCTION,
|
|
120
|
-
// label: 'Function',
|
|
121
|
-
// },
|
|
122
|
-
// {
|
|
123
|
-
// value: TemplateInputType.QUERY,
|
|
124
|
-
// label: 'Query',
|
|
125
|
-
// },
|
|
126
112
|
{
|
|
127
|
-
|
|
113
|
+
kind: 'function',
|
|
114
|
+
label: 'Function',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
kind: 'query',
|
|
118
|
+
label: 'Query',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
kind: 'resolver',
|
|
128
122
|
label: 'Resolver',
|
|
129
123
|
},
|
|
130
124
|
{
|
|
131
|
-
|
|
125
|
+
kind: 'context',
|
|
132
126
|
label: 'Context',
|
|
133
127
|
},
|
|
134
128
|
{
|
|
135
|
-
|
|
129
|
+
kind: 'schema',
|
|
136
130
|
label: 'Schema',
|
|
137
131
|
},
|
|
138
132
|
];
|
|
139
133
|
|
|
140
|
-
export const
|
|
141
|
-
|
|
142
|
-
const getInputType = (type: string) => inputTypes.find(({ value }) => String(value) === type)?.value;
|
|
134
|
+
export const NAME_REGEXP = /\{\{([\w-]+)\}\}/;
|
|
143
135
|
|
|
144
|
-
const usePromptInputs = (template:
|
|
136
|
+
const usePromptInputs = (template: Template.Template) => {
|
|
145
137
|
useEffect(() => {
|
|
146
138
|
const text = template.source ?? '';
|
|
147
139
|
if (!template.inputs) {
|
|
148
140
|
template.inputs = []; // TODO(burdon): Required?
|
|
149
141
|
}
|
|
150
142
|
|
|
151
|
-
const regex = new RegExp(
|
|
152
|
-
const variables = new Set<string>([...text.matchAll(regex)].map((m) => m[1]));
|
|
143
|
+
const regex = new RegExp(NAME_REGEXP, 'g');
|
|
144
|
+
const variables = new Set<string>([...(text.target?.content.matchAll(regex) ?? [])].map((m) => m[1]));
|
|
153
145
|
|
|
154
146
|
// Create map of unclaimed inputs.
|
|
155
|
-
const unclaimed = new Map<string,
|
|
147
|
+
const unclaimed = new Map<string, Template.Input>(
|
|
156
148
|
template.inputs?.filter(isNonNullable).map((input) => [input.name, input]),
|
|
157
149
|
);
|
|
158
150
|
const missing: string[] = [];
|
|
@@ -4,21 +4,21 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type Meta } from '@storybook/react';
|
|
7
|
+
import { type Meta } from '@storybook/react-vite';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
10
|
import { IntentPlugin, Capabilities, useCapabilities, SettingsPlugin } from '@dxos/app-framework';
|
|
11
11
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
-
import { capabilities } from '@dxos/
|
|
12
|
+
import { capabilities } from '@dxos/assistant-testing';
|
|
13
13
|
import { ChessPlugin } from '@dxos/plugin-chess';
|
|
14
14
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
15
15
|
import { MapPlugin } from '@dxos/plugin-map';
|
|
16
16
|
import { SpacePlugin } from '@dxos/plugin-space';
|
|
17
17
|
import { TablePlugin } from '@dxos/plugin-table';
|
|
18
|
-
import { withLayout,
|
|
18
|
+
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
19
19
|
|
|
20
20
|
import { Toolbox, type ToolboxProps } from './Toolbox';
|
|
21
|
-
import translations from '../../translations';
|
|
21
|
+
import { translations } from '../../translations';
|
|
22
22
|
|
|
23
23
|
const DefaultStory = (props: ToolboxProps) => {
|
|
24
24
|
const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
|
|
@@ -26,7 +26,7 @@ const DefaultStory = (props: ToolboxProps) => {
|
|
|
26
26
|
<Toolbox
|
|
27
27
|
{...props}
|
|
28
28
|
artifacts={artifactDefinitions}
|
|
29
|
-
classNames='w-[30rem] h-[15rem] rounded-
|
|
29
|
+
classNames='w-[30rem] h-[15rem] rounded-sm border border-separator py-1'
|
|
30
30
|
/>
|
|
31
31
|
);
|
|
32
32
|
};
|
|
@@ -36,7 +36,6 @@ const meta: Meta<typeof Toolbox> = {
|
|
|
36
36
|
component: Toolbox,
|
|
37
37
|
render: DefaultStory,
|
|
38
38
|
decorators: [
|
|
39
|
-
withSignals,
|
|
40
39
|
withPluginManager({
|
|
41
40
|
plugins: [
|
|
42
41
|
ClientPlugin({
|
|
@@ -6,26 +6,65 @@ import React, { useState, useEffect, Fragment, type FC } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { parseToolName, type Tool } from '@dxos/ai';
|
|
8
8
|
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
9
|
-
import { type ArtifactDefinition } from '@dxos/
|
|
9
|
+
import { type ArtifactDefinition } from '@dxos/blueprints';
|
|
10
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
11
|
+
import { type Ref } from '@dxos/echo';
|
|
10
12
|
import { FunctionType } from '@dxos/functions';
|
|
11
13
|
import { log } from '@dxos/log';
|
|
12
14
|
import { Filter, type Space, useQuery } from '@dxos/react-client/echo';
|
|
13
15
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
16
|
+
import { useTranslation } from '@dxos/react-ui';
|
|
14
17
|
import { mx } from '@dxos/react-ui-theme';
|
|
15
18
|
|
|
19
|
+
import { type ChatProcessor } from '../../hooks';
|
|
20
|
+
import { meta } from '../../meta';
|
|
16
21
|
import { createToolsFromService } from '../../tools';
|
|
17
22
|
import { ServiceType } from '../../types';
|
|
18
23
|
|
|
19
24
|
export type ToolboxProps = ThemedClassName<{
|
|
25
|
+
blueprints?: readonly Ref.Ref<Blueprint.Blueprint>[];
|
|
20
26
|
artifacts?: ArtifactDefinition[];
|
|
21
27
|
services?: { service: ServiceType; tools: Tool[] }[];
|
|
22
28
|
functions?: FunctionType[];
|
|
29
|
+
activeBlueprints?: readonly Ref.Ref<Blueprint.Blueprint>[];
|
|
23
30
|
striped?: boolean;
|
|
24
31
|
}>;
|
|
25
32
|
|
|
26
|
-
export const Toolbox = ({
|
|
33
|
+
export const Toolbox = ({
|
|
34
|
+
classNames,
|
|
35
|
+
artifacts,
|
|
36
|
+
functions,
|
|
37
|
+
services,
|
|
38
|
+
blueprints,
|
|
39
|
+
activeBlueprints,
|
|
40
|
+
striped,
|
|
41
|
+
}: ToolboxProps) => {
|
|
42
|
+
const { t } = useTranslation(meta.id);
|
|
43
|
+
|
|
27
44
|
return (
|
|
28
45
|
<div className={mx('flex flex-col overflow-y-auto box-content', classNames)}>
|
|
46
|
+
{blueprints && blueprints.length > 0 && (
|
|
47
|
+
<Section
|
|
48
|
+
title='Blueprints'
|
|
49
|
+
items={blueprints.map(({ target }) => ({
|
|
50
|
+
name: target?.name ?? '',
|
|
51
|
+
description: target?.description ?? '',
|
|
52
|
+
subitems: target?.tools.map((toolId) => ({ name: `∙ ${parseToolName(toolId)}` })),
|
|
53
|
+
}))}
|
|
54
|
+
/>
|
|
55
|
+
)}
|
|
56
|
+
|
|
57
|
+
{activeBlueprints && activeBlueprints.length > 0 && (
|
|
58
|
+
<Section
|
|
59
|
+
title='Blueprints'
|
|
60
|
+
items={activeBlueprints.map(({ target }) => ({
|
|
61
|
+
name: target?.name ?? '',
|
|
62
|
+
description: target?.description ?? '',
|
|
63
|
+
subitems: target?.tools.map((toolId) => ({ name: `∙ ${parseToolName(toolId)}` })),
|
|
64
|
+
}))}
|
|
65
|
+
/>
|
|
66
|
+
)}
|
|
67
|
+
|
|
29
68
|
{artifacts && artifacts.length > 0 && (
|
|
30
69
|
<Section
|
|
31
70
|
title='Artifacts'
|
|
@@ -51,6 +90,12 @@ export const Toolbox = ({ classNames, artifacts, functions, services, striped }:
|
|
|
51
90
|
{functions && functions.length > 0 && (
|
|
52
91
|
<Section title='Functions' items={functions.map(({ name, description }) => ({ name, description }))} />
|
|
53
92
|
)}
|
|
93
|
+
|
|
94
|
+
{!blueprints?.length &&
|
|
95
|
+
!activeBlueprints?.length &&
|
|
96
|
+
!artifacts?.length &&
|
|
97
|
+
!services?.length &&
|
|
98
|
+
!functions?.length && <div>{t('no tools')}</div>}
|
|
54
99
|
</div>
|
|
55
100
|
);
|
|
56
101
|
};
|
|
@@ -89,7 +134,12 @@ const Section: FC<{
|
|
|
89
134
|
);
|
|
90
135
|
};
|
|
91
136
|
|
|
92
|
-
export
|
|
137
|
+
export type ToolboxContainerProps = ThemedClassName<{
|
|
138
|
+
space?: Space;
|
|
139
|
+
processor?: ChatProcessor;
|
|
140
|
+
}>;
|
|
141
|
+
|
|
142
|
+
export const ToolboxContainer = ({ classNames, space, processor }: ToolboxContainerProps) => {
|
|
93
143
|
// Plugin artifacts.
|
|
94
144
|
const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
|
|
95
145
|
|
|
@@ -111,6 +161,12 @@ export const ToolboxContainer = ({ classNames, space }: ThemedClassName<{ space?
|
|
|
111
161
|
const functions = useQuery(space, Filter.type(FunctionType));
|
|
112
162
|
|
|
113
163
|
return (
|
|
114
|
-
<Toolbox
|
|
164
|
+
<Toolbox
|
|
165
|
+
classNames={classNames}
|
|
166
|
+
blueprints={processor?.context.blueprints.value}
|
|
167
|
+
artifacts={artifactDefinitions}
|
|
168
|
+
services={serviceTools}
|
|
169
|
+
functions={functions}
|
|
170
|
+
/>
|
|
115
171
|
);
|
|
116
172
|
};
|