@dxos/plugin-assistant 0.8.4-main.406dc2a → 0.8.4-main.52d7546f51
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/BlueprintArticle-6SP2ZWJ2.mjs +30 -0
- package/dist/lib/browser/BlueprintArticle-6SP2ZWJ2.mjs.map +7 -0
- package/dist/lib/browser/ChatCompanion-JOTRKE7B.mjs +200 -0
- package/dist/lib/browser/ChatCompanion-JOTRKE7B.mjs.map +7 -0
- package/dist/lib/browser/ChatContainer-ESDLG5JY.mjs +73 -0
- package/dist/lib/browser/ChatContainer-ESDLG5JY.mjs.map +7 -0
- package/dist/lib/browser/ChatDialog-LKY3FTYO.mjs +85 -0
- package/dist/lib/browser/ChatDialog-LKY3FTYO.mjs.map +7 -0
- package/dist/lib/browser/InitiativeContainer-T2SQ4O6J.mjs +267 -0
- package/dist/lib/browser/InitiativeContainer-T2SQ4O6J.mjs.map +7 -0
- package/dist/lib/browser/PromptArticle-PK3CBRUB.mjs +52 -0
- package/dist/lib/browser/PromptArticle-PK3CBRUB.mjs.map +7 -0
- package/dist/lib/browser/ai-service-CY2BYPH6.mjs +22 -0
- package/dist/lib/browser/ai-service-CY2BYPH6.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-MUZGUQSC.mjs +234 -0
- package/dist/lib/browser/app-graph-builder-MUZGUQSC.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-YAGWYVCL.mjs +14 -0
- package/dist/lib/browser/blueprints/index.mjs +12 -0
- package/dist/lib/browser/chunk-3ETBCBMH.mjs +47 -0
- package/dist/lib/browser/chunk-3ETBCBMH.mjs.map +7 -0
- package/dist/lib/browser/chunk-6BVCG5SJ.mjs +230 -0
- package/dist/lib/browser/chunk-6BVCG5SJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-DKQMSMBN.mjs +326 -0
- package/dist/lib/browser/chunk-DKQMSMBN.mjs.map +7 -0
- package/dist/lib/browser/chunk-EXVT7D4B.mjs +23 -0
- package/dist/lib/browser/chunk-EXVT7D4B.mjs.map +7 -0
- package/dist/lib/browser/chunk-IJYAKPEU.mjs +286 -0
- package/dist/lib/browser/chunk-IJYAKPEU.mjs.map +7 -0
- package/dist/lib/browser/chunk-POPBT2AQ.mjs +198 -0
- package/dist/lib/browser/chunk-POPBT2AQ.mjs.map +7 -0
- package/dist/lib/browser/chunk-Q4QUMX62.mjs +1974 -0
- package/dist/lib/browser/chunk-Q4QUMX62.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-YTMFQEN5.mjs +21 -0
- package/dist/lib/browser/edge-model-resolver-YTMFQEN5.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +251 -215
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/local-model-resolver-CGRQH37T.mjs +20 -0
- package/dist/lib/browser/local-model-resolver-CGRQH37T.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-2673CFJS.mjs +133 -0
- package/dist/lib/browser/operation-resolver-2673CFJS.mjs.map +7 -0
- package/dist/lib/browser/react-surface-I7YJVK4K.mjs +125 -0
- package/dist/lib/browser/react-surface-I7YJVK4K.mjs.map +7 -0
- package/dist/lib/browser/repair-IRXDYF4R.mjs +51 -0
- package/dist/lib/browser/repair-IRXDYF4R.mjs.map +7 -0
- package/dist/lib/browser/settings-XF6GKHCG.mjs +33 -0
- package/dist/lib/browser/settings-XF6GKHCG.mjs.map +7 -0
- package/dist/lib/browser/state-OYDPWLKA.mjs +26 -0
- package/dist/lib/browser/state-OYDPWLKA.mjs.map +7 -0
- package/dist/lib/browser/toolkit-IDXQCSTX.mjs +19 -0
- package/dist/lib/browser/toolkit-IDXQCSTX.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +8 -4
- package/dist/lib/node-esm/BlueprintArticle-7LI6UXKZ.mjs +31 -0
- package/dist/lib/node-esm/BlueprintArticle-7LI6UXKZ.mjs.map +7 -0
- package/dist/lib/node-esm/ChatCompanion-52OWAARX.mjs +201 -0
- package/dist/lib/node-esm/ChatCompanion-52OWAARX.mjs.map +7 -0
- package/dist/lib/node-esm/ChatContainer-VLWSQ3ZO.mjs +74 -0
- package/dist/lib/node-esm/ChatContainer-VLWSQ3ZO.mjs.map +7 -0
- package/dist/lib/node-esm/ChatDialog-5DUQIF2T.mjs +86 -0
- package/dist/lib/node-esm/ChatDialog-5DUQIF2T.mjs.map +7 -0
- package/dist/lib/node-esm/InitiativeContainer-ATD3D23L.mjs +268 -0
- package/dist/lib/node-esm/InitiativeContainer-ATD3D23L.mjs.map +7 -0
- package/dist/lib/node-esm/PromptArticle-BHPABYLT.mjs +53 -0
- package/dist/lib/node-esm/PromptArticle-BHPABYLT.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-ZI3A6RVG.mjs +23 -0
- package/dist/lib/node-esm/ai-service-ZI3A6RVG.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-4QN5M6PD.mjs +235 -0
- package/dist/lib/node-esm/app-graph-builder-4QN5M6PD.mjs.map +7 -0
- package/dist/lib/node-esm/{blueprint-definition-WD2IVMAI.mjs → blueprint-definition-H3LFAEK2.mjs} +6 -4
- package/dist/lib/node-esm/blueprint-definition-H3LFAEK2.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +13 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-2LEN26ZQ.mjs +48 -0
- package/dist/lib/node-esm/chunk-2LEN26ZQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-75PHXBN3.mjs +327 -0
- package/dist/lib/node-esm/chunk-75PHXBN3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ESDMBGF7.mjs +1975 -0
- package/dist/lib/node-esm/chunk-ESDMBGF7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-F6LA7XNS.mjs +199 -0
- package/dist/lib/node-esm/chunk-F6LA7XNS.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-LB72WG6R.mjs +231 -0
- package/dist/lib/node-esm/chunk-LB72WG6R.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MJD5XWQV.mjs +288 -0
- package/dist/lib/node-esm/chunk-MJD5XWQV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-73ABYRYX.mjs → chunk-POWB2BPC.mjs} +7 -2
- package/dist/lib/node-esm/chunk-POWB2BPC.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-CMJ3KNLQ.mjs +22 -0
- package/dist/lib/node-esm/edge-model-resolver-CMJ3KNLQ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +251 -215
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/local-model-resolver-FFDAKOXN.mjs +21 -0
- package/dist/lib/node-esm/local-model-resolver-FFDAKOXN.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-2ZD2DXOU.mjs +134 -0
- package/dist/lib/node-esm/operation-resolver-2ZD2DXOU.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-2CWJ6GZW.mjs +126 -0
- package/dist/lib/node-esm/react-surface-2CWJ6GZW.mjs.map +7 -0
- package/dist/lib/node-esm/repair-DMI55PON.mjs +52 -0
- package/dist/lib/node-esm/repair-DMI55PON.mjs.map +7 -0
- package/dist/lib/node-esm/settings-NGGZA7S7.mjs +34 -0
- package/dist/lib/node-esm/settings-NGGZA7S7.mjs.map +7 -0
- package/dist/lib/node-esm/state-VSCPGN7R.mjs +27 -0
- package/dist/lib/node-esm/state-VSCPGN7R.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-JPRJRDDB.mjs +20 -0
- package/dist/lib/node-esm/toolkit-JPRJRDDB.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +8 -4
- package/dist/types/src/AssistantPlugin.d.ts +2 -1
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/assistant-blueprint.d.ts +11 -0
- package/dist/types/src/blueprints/assistant-blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +7 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts +6 -0
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts.map +1 -0
- package/dist/types/src/capabilities/ai-service/index.d.ts +3 -0
- package/dist/types/src/capabilities/ai-service/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +26 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +4 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts +7 -0
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/edge-model-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +10 -11
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/local-model-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts +13 -0
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/repair/index.d.ts +3 -0
- package/dist/types/src/capabilities/repair/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/repair/repair.d.ts +6 -0
- package/dist/types/src/capabilities/repair/repair.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +15 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +18 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +11 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +13 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit/index.d.ts +3 -0
- package/dist/types/src/capabilities/toolkit/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts +6 -0
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +4 -2
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/BlueprintArticle.d.ts +7 -0
- package/dist/types/src/components/BlueprintArticle.d.ts.map +1 -0
- package/dist/types/src/components/Chat/Chat.d.ts +25 -13
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +5 -1
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts +4 -4
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer.d.ts +14 -6
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts +2 -2
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +2 -2
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +3 -3
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +3 -3
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +7 -10
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +246 -73
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts +12 -6
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
- package/dist/types/src/components/InitiativeContainer.d.ts +9 -0
- package/dist/types/src/components/InitiativeContainer.d.ts.map +1 -0
- package/dist/types/src/components/PromptArticle.d.ts +7 -0
- package/dist/types/src/components/PromptArticle.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +230 -61
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +11 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +231 -62
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts +3 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts +8 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +10 -8
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +6 -7
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +230 -60
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/TriggerStatus/TriggerStatus.d.ts +4 -0
- package/dist/types/src/components/TriggerStatus/TriggerStatus.d.ts.map +1 -0
- package/dist/types/src/components/TriggerStatus/index.d.ts +2 -0
- package/dist/types/src/components/TriggerStatus/index.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts +12 -0
- package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/Typewriter.d.ts +11 -0
- package/dist/types/src/components/Typewriter/Typewriter.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts +7 -0
- package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/assistant-extension.d.ts +5 -0
- package/dist/types/src/components/Typewriter/assistant-extension.d.ts.map +1 -0
- package/dist/types/src/components/Typewriter/index.d.ts +2 -0
- package/dist/types/src/components/Typewriter/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +10 -10
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/functions/index.d.ts +3 -3
- package/dist/types/src/functions/index.d.ts.map +1 -1
- package/dist/types/src/functions/{list.d.ts → object-list.d.ts} +3 -3
- package/dist/types/src/functions/object-list.d.ts.map +1 -0
- package/dist/types/src/functions/{load.d.ts → object-load.d.ts} +3 -3
- package/dist/types/src/functions/object-load.d.ts.map +1 -0
- package/dist/types/src/functions/object-search.d.ts +10 -0
- package/dist/types/src/functions/object-search.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +2 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +5 -5
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +5 -2
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +5 -5
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts +8 -0
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextBinder.d.ts +2 -2
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextObjects.d.ts +7 -7
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -1
- package/dist/types/src/hooks/useFilteredTypes.d.ts +3 -0
- package/dist/types/src/hooks/useFilteredTypes.d.ts.map +1 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +1 -0
- package/dist/types/src/processor/index.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +23 -18
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- 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/queue-logger.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +5 -4
- package/dist/types/src/testing/test-generator.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +358 -26
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +7 -38
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantAction.d.ts +90 -100
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +33 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +10 -212
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +119 -90
- package/src/AssistantPlugin.tsx +114 -112
- package/src/blueprints/assistant-blueprint.ts +57 -0
- package/src/blueprints/index.ts +12 -0
- package/src/capabilities/ai-service/ai-service.ts +30 -0
- package/src/capabilities/ai-service/index.ts +7 -0
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +200 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +74 -0
- package/src/capabilities/blueprint-definition/index.ts +8 -0
- package/src/capabilities/edge-model-resolver/edge-model-resolver.ts +33 -0
- package/src/capabilities/edge-model-resolver/index.ts +7 -0
- package/src/capabilities/index.ts +10 -14
- package/src/capabilities/local-model-resolver/index.ts +7 -0
- package/src/capabilities/local-model-resolver/local-model-resolver.ts +38 -0
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +112 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +111 -0
- package/src/capabilities/repair/index.ts +7 -0
- package/src/capabilities/repair/repair.ts +62 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +31 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +27 -0
- package/src/capabilities/toolkit/index.ts +7 -0
- package/src/capabilities/toolkit/toolkit.ts +27 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +28 -20
- package/src/components/BlueprintArticle.tsx +28 -0
- package/src/components/Chat/Chat.tsx +189 -127
- package/src/components/Chat/events.ts +7 -1
- package/src/components/ChatCompanion.tsx +191 -101
- package/src/components/ChatContainer.tsx +48 -31
- package/src/components/ChatDialog.tsx +15 -8
- package/src/components/ChatProgress/ChatProgress.tsx +6 -20
- package/src/components/ChatPrompt/ChatActions.tsx +11 -5
- package/src/components/ChatPrompt/ChatOptions.tsx +93 -80
- package/src/components/ChatPrompt/ChatReferences.tsx +7 -8
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +1 -1
- package/src/components/ChatThread/ChatThread.stories.tsx +58 -37
- package/src/components/ChatThread/ChatThread.tsx +35 -36
- package/src/components/ChatThread/Link.tsx +4 -4
- package/src/components/ChatThread/registry.tsx +25 -35
- package/src/components/ChatThread/sync.test.ts +33 -17
- package/src/components/ChatThread/sync.ts +53 -12
- package/src/components/ChatThread/testing/thread.md +37 -0
- package/src/components/InitiativeContainer.tsx +340 -0
- package/src/components/PromptArticle.tsx +49 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +16 -6
- package/src/components/TemplateEditor/TemplateEditor.tsx +24 -12
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +17 -9
- package/src/components/TemplateEditor/TemplateForm.tsx +76 -29
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +274 -0
- package/src/components/TemplateEditor/extensions/index.ts +6 -0
- package/src/components/TemplateEditor/extensions/xml-extension.ts +64 -0
- package/src/components/ToolBlock/ToolBlock.tsx +36 -45
- package/src/components/Toolbox/Toolbox.stories.tsx +10 -11
- package/src/components/Toolbox/Toolbox.tsx +54 -56
- package/src/components/TriggerStatus/TriggerStatus.tsx +142 -0
- package/src/components/{Toolbar → TriggerStatus}/index.ts +1 -1
- package/src/components/Typewriter/AssistantToolbar.tsx +161 -0
- package/src/components/Typewriter/Typewriter.stories.tsx +83 -0
- package/src/components/Typewriter/Typewriter.tsx +54 -0
- package/src/components/Typewriter/assistant-extension.tsx +144 -0
- package/src/components/Typewriter/index.ts +5 -0
- package/src/components/index.ts +13 -7
- package/src/functions/index.ts +3 -3
- package/src/functions/{list.ts → object-list.ts} +8 -7
- package/src/functions/object-load.ts +44 -0
- package/src/functions/object-search.ts +46 -0
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useBlueprintRegistry.ts +31 -20
- package/src/hooks/useChatProcessor.ts +17 -13
- package/src/hooks/useChatServices.ts +16 -18
- package/src/hooks/useChatToolbarActions.ts +122 -0
- package/src/hooks/useContextBinder.ts +9 -7
- package/src/hooks/useContextObjects.ts +13 -25
- package/src/hooks/useFilteredTypes.ts +37 -0
- package/src/hooks/useReferencesProvider.ts +7 -6
- package/src/index.ts +0 -1
- package/src/meta.ts +8 -3
- package/src/processor/index.ts +1 -0
- package/src/processor/presets.ts +1 -1
- package/src/processor/processor.test.ts +16 -25
- package/src/processor/processor.ts +72 -73
- package/src/processor/update-name.ts +58 -0
- package/src/queue-logger.ts +8 -9
- package/src/testing/test-generator.ts +14 -13
- package/src/testing/test-services.ts +8 -6
- package/src/translations.ts +51 -18
- package/src/types/Assistant.ts +4 -40
- package/src/types/AssistantAction.ts +67 -53
- package/src/types/capabilities.ts +27 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +6 -1
- package/src/types/service.ts +12 -9
- package/dist/lib/browser/BlueprintContainer-WX2SSDVI.mjs +0 -28
- package/dist/lib/browser/BlueprintContainer-WX2SSDVI.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-BDZ55ZRF.mjs +0 -150
- package/dist/lib/browser/ChatCompanion-BDZ55ZRF.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-RYGNN73X.mjs +0 -73
- package/dist/lib/browser/ChatContainer-RYGNN73X.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-MVHH2U66.mjs +0 -86
- package/dist/lib/browser/ChatDialog-MVHH2U66.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-2FEWMQGW.mjs +0 -150
- package/dist/lib/browser/SequenceContainer-2FEWMQGW.mjs.map +0 -7
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs +0 -19
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-2U7SLCRX.mjs +0 -154
- package/dist/lib/browser/app-graph-builder-2U7SLCRX.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-NSJARW5U.mjs +0 -12
- package/dist/lib/browser/chunk-2CE2KPKZ.mjs +0 -175
- package/dist/lib/browser/chunk-2CE2KPKZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-43I2LR6O.mjs +0 -216
- package/dist/lib/browser/chunk-43I2LR6O.mjs.map +0 -7
- package/dist/lib/browser/chunk-5EGXHCAZ.mjs +0 -16
- package/dist/lib/browser/chunk-5EGXHCAZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-5RICKAMN.mjs +0 -18
- package/dist/lib/browser/chunk-5RICKAMN.mjs.map +0 -7
- package/dist/lib/browser/chunk-CQ7UHYTT.mjs +0 -296
- package/dist/lib/browser/chunk-CQ7UHYTT.mjs.map +0 -7
- package/dist/lib/browser/chunk-FP56WB24.mjs +0 -212
- package/dist/lib/browser/chunk-FP56WB24.mjs.map +0 -7
- package/dist/lib/browser/chunk-JZRZVB2A.mjs +0 -170
- package/dist/lib/browser/chunk-JZRZVB2A.mjs.map +0 -7
- package/dist/lib/browser/chunk-WRJGOT5P.mjs +0 -1794
- package/dist/lib/browser/chunk-WRJGOT5P.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs +0 -18
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-3GOJMBXJ.mjs +0 -114
- package/dist/lib/browser/intent-resolver-3GOJMBXJ.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs +0 -17
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs.map +0 -7
- package/dist/lib/browser/react-surface-FTKCE6GG.mjs +0 -107
- package/dist/lib/browser/react-surface-FTKCE6GG.mjs.map +0 -7
- package/dist/lib/browser/settings-HBF32KV6.mjs +0 -23
- package/dist/lib/browser/settings-HBF32KV6.mjs.map +0 -7
- package/dist/lib/browser/state-LXTS54DI.mjs +0 -21
- package/dist/lib/browser/state-LXTS54DI.mjs.map +0 -7
- package/dist/lib/browser/toolkit-NQ2GXCF5.mjs +0 -199
- package/dist/lib/browser/toolkit-NQ2GXCF5.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-4MKN6ZRB.mjs +0 -29
- package/dist/lib/node-esm/BlueprintContainer-4MKN6ZRB.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-XFNXVZIP.mjs +0 -151
- package/dist/lib/node-esm/ChatCompanion-XFNXVZIP.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-UTJGCQXF.mjs +0 -74
- package/dist/lib/node-esm/ChatContainer-UTJGCQXF.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-QEYZ4IOV.mjs +0 -87
- package/dist/lib/node-esm/ChatDialog-QEYZ4IOV.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-PGGJUQ46.mjs +0 -151
- package/dist/lib/node-esm/SequenceContainer-PGGJUQ46.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs +0 -20
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-OKNLR7H2.mjs +0 -155
- package/dist/lib/node-esm/app-graph-builder-OKNLR7H2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-73ABYRYX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DSE2IILK.mjs +0 -217
- package/dist/lib/node-esm/chunk-DSE2IILK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-E2WXZND7.mjs +0 -297
- package/dist/lib/node-esm/chunk-E2WXZND7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HXIBCBH4.mjs +0 -171
- package/dist/lib/node-esm/chunk-HXIBCBH4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TNR46C3L.mjs +0 -213
- package/dist/lib/node-esm/chunk-TNR46C3L.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-U2NYUS2N.mjs +0 -177
- package/dist/lib/node-esm/chunk-U2NYUS2N.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UFKLCEAE.mjs +0 -1795
- package/dist/lib/node-esm/chunk-UFKLCEAE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XQGWSZ4T.mjs +0 -17
- package/dist/lib/node-esm/chunk-XQGWSZ4T.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs +0 -19
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-6XLVTRDJ.mjs +0 -115
- package/dist/lib/node-esm/intent-resolver-6XLVTRDJ.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs +0 -18
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-K7ZXQLAP.mjs +0 -108
- package/dist/lib/node-esm/react-surface-K7ZXQLAP.mjs.map +0 -7
- package/dist/lib/node-esm/settings-CWP6MTWP.mjs +0 -24
- package/dist/lib/node-esm/settings-CWP6MTWP.mjs.map +0 -7
- package/dist/lib/node-esm/state-BO6GUFLB.mjs +0 -22
- package/dist/lib/node-esm/state-BO6GUFLB.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-V57PRJNG.mjs +0 -200
- package/dist/lib/node-esm/toolkit-V57PRJNG.mjs.map +0 -7
- package/dist/types/src/capabilities/ai-service.d.ts +0 -4
- package/dist/types/src/capabilities/ai-service.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -7
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -11
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +0 -10
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state.d.ts +0 -4
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/toolkit.d.ts +0 -4
- package/dist/types/src/capabilities/toolkit.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintContainer.d.ts +0 -8
- package/dist/types/src/components/BlueprintContainer.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/reducers.d.ts +0 -40
- package/dist/types/src/components/ChatThread/reducers.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 -269
- 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/components/TemplateEditor/handlebars-extension.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -5
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/index.d.ts +0 -2
- package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +0 -11
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/functions/analysis.d.ts +0 -5
- package/dist/types/src/functions/analysis.d.ts.map +0 -1
- package/dist/types/src/functions/list.d.ts.map +0 -1
- package/dist/types/src/functions/load.d.ts.map +0 -1
- package/dist/types/src/hooks/useItemTypes.d.ts +0 -4
- package/dist/types/src/hooks/useItemTypes.d.ts.map +0 -1
- package/src/capabilities/ai-service.ts +0 -27
- package/src/capabilities/app-graph-builder.ts +0 -163
- package/src/capabilities/blueprint-definition.ts +0 -64
- package/src/capabilities/capabilities.ts +0 -18
- package/src/capabilities/edge-model-resolver.ts +0 -25
- package/src/capabilities/intent-resolver.ts +0 -96
- package/src/capabilities/local-model-resolver.ts +0 -30
- package/src/capabilities/react-surface.tsx +0 -91
- package/src/capabilities/settings.ts +0 -19
- package/src/capabilities/state.ts +0 -20
- package/src/capabilities/toolkit.ts +0 -168
- package/src/components/BlueprintContainer.tsx +0 -24
- package/src/components/ChatThread/reducers.ts +0 -151
- package/src/components/PromptSettings.tsx +0 -90
- package/src/components/SequenceContainer.tsx +0 -131
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -35
- package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
- package/src/components/SequenceEditor/index.ts +0 -5
- package/src/components/TemplateEditor/handlebars-extension.ts +0 -165
- package/src/components/Toolbar/Toolbar.tsx +0 -21
- package/src/components/Toolbar/useChatToolbarActions.ts +0 -126
- package/src/events.ts +0 -11
- package/src/functions/analysis.ts +0 -22
- package/src/functions/load.ts +0 -46
- package/src/hooks/useItemTypes.ts +0 -37
- /package/dist/lib/browser/{blueprint-definition-NSJARW5U.mjs.map → blueprint-definition-YAGWYVCL.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprint-definition-WD2IVMAI.mjs.map → browser/blueprints/index.mjs.map} +0 -0
- /package/dist/types/src/components/TemplateEditor/{handlebars-extension.d.ts → extensions/handlebars-extension.d.ts} +0 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Atom, useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Match from 'effect/Match';
|
|
8
|
+
import * as Option from 'effect/Option';
|
|
9
|
+
import type * as Record from 'effect/Record';
|
|
10
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
11
|
+
|
|
12
|
+
import { Surface, useCapability } from '@dxos/app-framework/ui';
|
|
13
|
+
import { Initiative } from '@dxos/assistant-toolkit';
|
|
14
|
+
import { DXN, Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
15
|
+
import { type JsonPath, splitJsonPath } from '@dxos/echo/internal';
|
|
16
|
+
import { AtomObj, AtomRef } from '@dxos/echo-atom';
|
|
17
|
+
import { FunctionDefinition, QueueService, Trigger } from '@dxos/functions';
|
|
18
|
+
import { AutomationCapabilities } from '@dxos/plugin-automation/types';
|
|
19
|
+
import { MarkdownEditor } from '@dxos/plugin-markdown';
|
|
20
|
+
import { useObject, useQuery } from '@dxos/react-client/echo';
|
|
21
|
+
import { Button, ButtonGroup, IconButton, Input, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
22
|
+
import { Form, type FormFieldMap, omitId } from '@dxos/react-ui-form';
|
|
23
|
+
import { StackItem } from '@dxos/react-ui-stack';
|
|
24
|
+
import { type Text } from '@dxos/schema';
|
|
25
|
+
|
|
26
|
+
export type InitiativeContainerProps = {
|
|
27
|
+
role?: string;
|
|
28
|
+
initiative: Initiative.Initiative;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const TAB_INITATIVE = 'Initiative';
|
|
32
|
+
const TAB_CHAT = 'Chat';
|
|
33
|
+
|
|
34
|
+
export const InitiativeContainer = ({ role, initiative }: InitiativeContainerProps) => {
|
|
35
|
+
const [selectedTab, setSelectedTab] = useState<string>(TAB_INITATIVE);
|
|
36
|
+
|
|
37
|
+
const tabs = useAtomValue(
|
|
38
|
+
useMemo(
|
|
39
|
+
() =>
|
|
40
|
+
AtomObj.make(initiative).pipe((initiative) =>
|
|
41
|
+
Atom.make((get) => {
|
|
42
|
+
return [TAB_INITATIVE, TAB_CHAT, ...get(initiative).artifacts.map((artifact) => artifact.name)];
|
|
43
|
+
}),
|
|
44
|
+
),
|
|
45
|
+
[initiative],
|
|
46
|
+
),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const chat = useAtomValue(
|
|
50
|
+
useMemo(
|
|
51
|
+
() =>
|
|
52
|
+
AtomObj.make(initiative).pipe((initiative) =>
|
|
53
|
+
Atom.make((get) => {
|
|
54
|
+
const chat = get(initiative).chat;
|
|
55
|
+
return chat ? get(AtomRef.make(chat)) : undefined;
|
|
56
|
+
}),
|
|
57
|
+
),
|
|
58
|
+
[initiative],
|
|
59
|
+
),
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const artifacts = useAtomValue(
|
|
63
|
+
useMemo(
|
|
64
|
+
() =>
|
|
65
|
+
AtomObj.make(initiative).pipe((initiative) =>
|
|
66
|
+
Atom.make((get) => {
|
|
67
|
+
return get(initiative).artifacts.map((artifact) => ({
|
|
68
|
+
name: artifact.name,
|
|
69
|
+
data: get(AtomRef.make(artifact.data)),
|
|
70
|
+
}));
|
|
71
|
+
}),
|
|
72
|
+
),
|
|
73
|
+
[initiative],
|
|
74
|
+
),
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const selectedArtifact = artifacts.find((artifact) => artifact.name === selectedTab);
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<StackItem.Content toolbar>
|
|
81
|
+
<div
|
|
82
|
+
role='none'
|
|
83
|
+
className='flex-1 min-is-0 overflow-x-auto scrollbar-none flex gap-1 border-b border-subduedSeparator'
|
|
84
|
+
>
|
|
85
|
+
{tabs.map((tab) => (
|
|
86
|
+
<IconButton
|
|
87
|
+
key={tab}
|
|
88
|
+
icon={Match.value(tab).pipe(
|
|
89
|
+
Match.when(TAB_INITATIVE, () => 'ph--sparkle--regular'),
|
|
90
|
+
Match.when(TAB_CHAT, () => 'ph--chat--regular'),
|
|
91
|
+
Match.orElse(() => 'ph--file--regular'),
|
|
92
|
+
)}
|
|
93
|
+
label={tab}
|
|
94
|
+
variant={selectedTab === tab ? 'primary' : 'ghost'}
|
|
95
|
+
onClick={() => setSelectedTab(tab)}
|
|
96
|
+
/>
|
|
97
|
+
))}
|
|
98
|
+
</div>
|
|
99
|
+
{selectedTab === TAB_INITATIVE && <InitiativeForm initiative={initiative} />}
|
|
100
|
+
{selectedTab === TAB_CHAT && <Surface.Surface role='article' data={{ subject: chat }} limit={1} />}
|
|
101
|
+
{selectedArtifact && <Surface.Surface role='section' data={{ subject: selectedArtifact.data }} limit={1} />}
|
|
102
|
+
</StackItem.Content>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export default InitiativeContainer;
|
|
107
|
+
|
|
108
|
+
const InitiativeForm = ({ initiative }: { initiative: Initiative.Initiative }) => {
|
|
109
|
+
const handleChange = useCallback(
|
|
110
|
+
(
|
|
111
|
+
values: Omit<Initiative.Initiative, 'id'>,
|
|
112
|
+
{ isValid, changed }: { isValid: boolean; changed: Record<string, boolean> },
|
|
113
|
+
) => {
|
|
114
|
+
if (!isValid) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const changedPaths = Object.keys(changed).filter((path) => changed[path as string]) as JsonPath[];
|
|
119
|
+
// Handle other property changes.
|
|
120
|
+
if (changedPaths.length > 0) {
|
|
121
|
+
Obj.change(initiative, () => {
|
|
122
|
+
for (const path of changedPaths) {
|
|
123
|
+
const parts = splitJsonPath(path);
|
|
124
|
+
const value = Obj.getValue(values as any, parts);
|
|
125
|
+
Obj.setValue(initiative, parts, value);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
queueMicrotask(() => syncTriggers(initiative));
|
|
131
|
+
},
|
|
132
|
+
[initiative],
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
const fieldMap = useMemo<FormFieldMap>(
|
|
136
|
+
() => ({
|
|
137
|
+
spec: ({ type, label, getValue, onValueChange }) => {
|
|
138
|
+
const { t } = useTranslation();
|
|
139
|
+
|
|
140
|
+
const value: Ref.Ref<Text.Text> = getValue();
|
|
141
|
+
const target = useAtomValue(AtomRef.make(value));
|
|
142
|
+
const [initialValue] = useObject(target, 'content');
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<Input.Root>
|
|
146
|
+
<div role='none'>
|
|
147
|
+
<Input.Label>{toLocalizedString(label, t)}</Input.Label>
|
|
148
|
+
</div>
|
|
149
|
+
<MarkdownEditor.Root id={target?.id ?? ''} object={target}>
|
|
150
|
+
<MarkdownEditor.Content initialValue={initialValue} />
|
|
151
|
+
</MarkdownEditor.Root>
|
|
152
|
+
</Input.Root>
|
|
153
|
+
);
|
|
154
|
+
},
|
|
155
|
+
plan: ({ type, label, getValue, onValueChange }) => {
|
|
156
|
+
const { t } = useTranslation();
|
|
157
|
+
|
|
158
|
+
const value: Ref.Ref<Text.Text> = getValue();
|
|
159
|
+
const target = useAtomValue(AtomRef.make(value));
|
|
160
|
+
const [initialValue] = useObject(target, 'content');
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<Input.Root>
|
|
164
|
+
<div role='none'>
|
|
165
|
+
<Input.Label>{toLocalizedString(label, t)}</Input.Label>
|
|
166
|
+
</div>
|
|
167
|
+
<MarkdownEditor.Root id={target?.id ?? ''} object={target}>
|
|
168
|
+
<MarkdownEditor.Content initialValue={initialValue} />
|
|
169
|
+
</MarkdownEditor.Root>
|
|
170
|
+
</Input.Root>
|
|
171
|
+
);
|
|
172
|
+
},
|
|
173
|
+
}),
|
|
174
|
+
[],
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
const computeRuntime = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
178
|
+
|
|
179
|
+
const handleResetHistory = useCallback(async () => {
|
|
180
|
+
const runtime = computeRuntime.getRuntime(Obj.getDatabase(initiative)!.spaceId);
|
|
181
|
+
|
|
182
|
+
await runtime.runPromise(Initiative.resetChatHistory(initiative));
|
|
183
|
+
|
|
184
|
+
if (!initiative.queue) {
|
|
185
|
+
await runtime.runPromise(
|
|
186
|
+
Effect.gen(function* () {
|
|
187
|
+
const queue = yield* QueueService.createQueue();
|
|
188
|
+
Obj.change(initiative, (initiative) => {
|
|
189
|
+
initiative.queue = Ref.fromDXN(queue.dxn);
|
|
190
|
+
});
|
|
191
|
+
}),
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
}, [initiative, computeRuntime]);
|
|
195
|
+
|
|
196
|
+
const inputQueue = useAtomValue(
|
|
197
|
+
AtomObj.make(initiative).pipe((_) =>
|
|
198
|
+
Atom.make((get) =>
|
|
199
|
+
Option.fromNullable(get(_).queue).pipe(Option.map(AtomRef.make), Option.map(get), Option.getOrUndefined),
|
|
200
|
+
),
|
|
201
|
+
),
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
const inputQueueItems = useQuery(inputQueue, Query.select(Filter.everything()));
|
|
205
|
+
|
|
206
|
+
// TODO(dmaretskyi): Form breaks if we provide the echo object directly.
|
|
207
|
+
const spreadValue = useMemo(() => ({ ...initiative }), [initiative]);
|
|
208
|
+
return (
|
|
209
|
+
<div className='flex flex-col gap-2'>
|
|
210
|
+
<ButtonGroup classNames='h-10'>
|
|
211
|
+
<Button onClick={handleResetHistory}>Reset History</Button>
|
|
212
|
+
</ButtonGroup>
|
|
213
|
+
<h3 className='mb-2'>Input Queue</h3>
|
|
214
|
+
<div className='border border-subduedSeparator rounded-md p-2 h-64 overflow-y-auto'>
|
|
215
|
+
{inputQueueItems.map((item) => (
|
|
216
|
+
<Surface.Surface key={item.id} role='section' data={{ subject: item }} limit={1} />
|
|
217
|
+
))}
|
|
218
|
+
{inputQueueItems.length === 0 && <div className='text-subdued'>No items in queue</div>}
|
|
219
|
+
</div>
|
|
220
|
+
<Form.Root
|
|
221
|
+
schema={omitId(Initiative.Initiative)}
|
|
222
|
+
onValuesChanged={handleChange as any}
|
|
223
|
+
values={spreadValue}
|
|
224
|
+
db={Obj.getDatabase(initiative)}
|
|
225
|
+
fieldMap={fieldMap}
|
|
226
|
+
>
|
|
227
|
+
<Form.FieldSet />
|
|
228
|
+
</Form.Root>
|
|
229
|
+
</div>
|
|
230
|
+
);
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
// TODO(dmaretskyi): Perhaps the association is better done with a relation.
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Foreign key {@link INITIATIVE_TRIGGER_EXTENSION_KEY} => <initative id : ObjectId>
|
|
237
|
+
*/
|
|
238
|
+
const INITIATIVE_TRIGGER_EXTENSION_KEY = 'dxos.org/extension/InitiativeTrigger';
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Foreign key {@link INITIATIVE_TRIGGER_EXTENSION_KEY} => <dxn string of subscription target>
|
|
242
|
+
*/
|
|
243
|
+
const INITIATIVE_TRIGGER_TARGET_EXTENSION_KEY = 'dxos.org/extension/InitiativeTriggerTarget';
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Syncs triggers in the database with the initiative subscriptions.
|
|
247
|
+
*/
|
|
248
|
+
|
|
249
|
+
const syncTriggers = async (initiative: Initiative.Initiative) => {
|
|
250
|
+
const db = Obj.getDatabase(initiative);
|
|
251
|
+
if (!db) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const triggers = await db
|
|
256
|
+
.query(Filter.foreignKeys(Trigger.Trigger, [{ source: INITIATIVE_TRIGGER_EXTENSION_KEY, id: initiative.id }]))
|
|
257
|
+
.run();
|
|
258
|
+
|
|
259
|
+
// Delete triggers that are not in subscriptions.
|
|
260
|
+
for (const trigger of triggers) {
|
|
261
|
+
const target = Obj.getKeys(trigger, INITIATIVE_TRIGGER_TARGET_EXTENSION_KEY).at(0)?.id;
|
|
262
|
+
|
|
263
|
+
const exists = initiative.subscriptions.find((subscription) => subscription.dxn.toString() === target);
|
|
264
|
+
if (!exists && !(initiative.useQualifyingAgent && target === Obj.getDXN(initiative)?.toString())) {
|
|
265
|
+
db.remove(trigger);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// Add triggers that are not in the database.
|
|
270
|
+
for (const subscription of initiative.subscriptions) {
|
|
271
|
+
const relevantTrigger = triggers.find((trigger) =>
|
|
272
|
+
Obj.getKeys(trigger, INITIATIVE_TRIGGER_TARGET_EXTENSION_KEY).some(
|
|
273
|
+
(key) => key.id === subscription.dxn.toString(),
|
|
274
|
+
),
|
|
275
|
+
);
|
|
276
|
+
if (relevantTrigger) {
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const target = await subscription.tryLoad();
|
|
281
|
+
if (!target || !target.queue || !(target.queue.dxn instanceof DXN) || target.queue.dxn.kind !== DXN.kind.QUEUE) {
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
db.add(
|
|
286
|
+
Trigger.make({
|
|
287
|
+
[Obj.Meta]: {
|
|
288
|
+
keys: [
|
|
289
|
+
{ source: INITIATIVE_TRIGGER_EXTENSION_KEY, id: initiative.id },
|
|
290
|
+
{ source: INITIATIVE_TRIGGER_TARGET_EXTENSION_KEY, id: subscription.dxn.toString() },
|
|
291
|
+
],
|
|
292
|
+
},
|
|
293
|
+
enabled: true,
|
|
294
|
+
spec: {
|
|
295
|
+
kind: 'queue',
|
|
296
|
+
queue: target.queue.dxn.toString(),
|
|
297
|
+
},
|
|
298
|
+
function: Ref.make(
|
|
299
|
+
FunctionDefinition.serialize(initiative.useQualifyingAgent ? Initiative.qualifier : Initiative.agent),
|
|
300
|
+
),
|
|
301
|
+
input: {
|
|
302
|
+
initiative: Ref.make(initiative),
|
|
303
|
+
event: '{{event}}',
|
|
304
|
+
},
|
|
305
|
+
}),
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
if (initiative.useQualifyingAgent) {
|
|
310
|
+
const qualifierTrigger = triggers.find((trigger) =>
|
|
311
|
+
Obj.getKeys(trigger, INITIATIVE_TRIGGER_TARGET_EXTENSION_KEY).some(
|
|
312
|
+
(key) => key.id === Obj.getDXN(initiative)?.toString(),
|
|
313
|
+
),
|
|
314
|
+
);
|
|
315
|
+
if (!qualifierTrigger && initiative.queue) {
|
|
316
|
+
db.add(
|
|
317
|
+
Trigger.make({
|
|
318
|
+
[Obj.Meta]: {
|
|
319
|
+
keys: [
|
|
320
|
+
{ source: INITIATIVE_TRIGGER_EXTENSION_KEY, id: initiative.id },
|
|
321
|
+
{ source: INITIATIVE_TRIGGER_TARGET_EXTENSION_KEY, id: Obj.getDXN(initiative)?.toString() ?? '' },
|
|
322
|
+
],
|
|
323
|
+
},
|
|
324
|
+
function: Ref.make(FunctionDefinition.serialize(Initiative.agent)),
|
|
325
|
+
enabled: true,
|
|
326
|
+
spec: {
|
|
327
|
+
kind: 'queue',
|
|
328
|
+
queue: initiative.queue.dxn.toString(),
|
|
329
|
+
},
|
|
330
|
+
input: {
|
|
331
|
+
initiative: Ref.make(initiative),
|
|
332
|
+
event: '{{event}}',
|
|
333
|
+
},
|
|
334
|
+
}),
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
await db.flush({ indexes: true });
|
|
340
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { Agent } from '@dxos/assistant-toolkit';
|
|
9
|
+
import { type Prompt } from '@dxos/blueprints';
|
|
10
|
+
import { Obj } from '@dxos/echo';
|
|
11
|
+
import { invokeFunctionWithTracing, useComputeRuntimeCallback } from '@dxos/plugin-automation';
|
|
12
|
+
import { Layout, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
13
|
+
import { useAttention } from '@dxos/react-ui-attention';
|
|
14
|
+
|
|
15
|
+
import { meta } from '../meta';
|
|
16
|
+
|
|
17
|
+
import { TemplateEditor } from './TemplateEditor';
|
|
18
|
+
|
|
19
|
+
export type PromptArticleProps = SurfaceComponentProps<Prompt.Prompt>;
|
|
20
|
+
|
|
21
|
+
export const PromptArticle = ({ role, subject }: PromptArticleProps) => {
|
|
22
|
+
const { t } = useTranslation(meta.id);
|
|
23
|
+
const db = Obj.getDatabase(subject);
|
|
24
|
+
const { hasAttention } = useAttention(Obj.getDXN(subject).toString());
|
|
25
|
+
|
|
26
|
+
const inputData = useMemo(
|
|
27
|
+
() =>
|
|
28
|
+
subject && {
|
|
29
|
+
prompt: db?.makeRef(Obj.getDXN(subject)),
|
|
30
|
+
input: {},
|
|
31
|
+
},
|
|
32
|
+
[subject, db],
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const handleRun = useComputeRuntimeCallback(db?.spaceId, () => invokeFunctionWithTracing(Agent.prompt, inputData), [
|
|
36
|
+
inputData,
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Layout.Main role={role} toolbar>
|
|
41
|
+
<Toolbar.Root disabled={!hasAttention} onClick={handleRun}>
|
|
42
|
+
<Toolbar.IconButton iconOnly icon='ph--play--regular' label={t('run prompt label')} onClick={handleRun} />
|
|
43
|
+
</Toolbar.Root>
|
|
44
|
+
<TemplateEditor id={subject.id} template={subject.instructions} classNames='container-max-width' />
|
|
45
|
+
</Layout.Main>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default PromptArticle;
|
|
@@ -9,26 +9,36 @@ import { createSystemPrompt } from '@dxos/assistant';
|
|
|
9
9
|
import { Blueprint, Template } from '@dxos/blueprints';
|
|
10
10
|
import { useClient } from '@dxos/react-client';
|
|
11
11
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
12
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
12
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
13
13
|
import { trim } from '@dxos/util';
|
|
14
14
|
|
|
15
15
|
import { translations } from '../../translations';
|
|
16
16
|
|
|
17
17
|
import { TemplateEditor, type TemplateEditorProps } from './TemplateEditor';
|
|
18
18
|
|
|
19
|
+
const FENCE = '```';
|
|
20
|
+
|
|
19
21
|
const TEMPLATE = trim`
|
|
20
22
|
{{! System Prompt }}
|
|
21
23
|
|
|
22
|
-
You are
|
|
24
|
+
You are an expert chess player.
|
|
23
25
|
The move history of the current game is: {{history}}.
|
|
24
26
|
If asked to suggest a move explain why it is a good move.
|
|
25
27
|
|
|
26
28
|
{{#each artifacts}}
|
|
27
|
-
|
|
29
|
+
{{this}}
|
|
28
30
|
{{/each}}
|
|
29
31
|
|
|
32
|
+
Reponse in the format: <suggestion>SUGGESTION</suggestion>
|
|
33
|
+
|
|
34
|
+
@dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M
|
|
35
|
+
|
|
30
36
|
---
|
|
31
37
|
|
|
38
|
+
${FENCE}ts
|
|
39
|
+
const x = 100;
|
|
40
|
+
${FENCE}
|
|
41
|
+
|
|
32
42
|
{{input}}
|
|
33
43
|
`;
|
|
34
44
|
|
|
@@ -47,7 +57,7 @@ const DefaultStory = ({ source }: TemplateEditorProps & { source: string }) => {
|
|
|
47
57
|
|
|
48
58
|
return (
|
|
49
59
|
<TemplateEditor
|
|
50
|
-
classNames='bg-baseSurface
|
|
60
|
+
classNames='bg-baseSurface is-full max-is-proseMaxWidth'
|
|
51
61
|
id={blueprint.id}
|
|
52
62
|
template={blueprint.instructions}
|
|
53
63
|
/>
|
|
@@ -59,7 +69,8 @@ const meta = {
|
|
|
59
69
|
component: TemplateEditor as any,
|
|
60
70
|
render: DefaultStory,
|
|
61
71
|
decorators: [
|
|
62
|
-
withTheme,
|
|
72
|
+
withTheme(),
|
|
73
|
+
withLayout({ layout: 'column' }),
|
|
63
74
|
withClientProvider({
|
|
64
75
|
types: [Blueprint.Blueprint],
|
|
65
76
|
createIdentity: true,
|
|
@@ -67,7 +78,6 @@ const meta = {
|
|
|
67
78
|
}),
|
|
68
79
|
],
|
|
69
80
|
parameters: {
|
|
70
|
-
layout: 'column',
|
|
71
81
|
translations,
|
|
72
82
|
},
|
|
73
83
|
} satisfies Meta<typeof DefaultStory>;
|
|
@@ -2,32 +2,34 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { defaultHighlightStyle, syntaxHighlighting } from '@codemirror/language';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
8
|
import { type Template } from '@dxos/blueprints';
|
|
8
|
-
import { createDocAccessor } from '@dxos/
|
|
9
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
9
10
|
import { type ThemedClassName, useThemeContext, useTranslation } from '@dxos/react-ui';
|
|
11
|
+
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
10
12
|
import {
|
|
11
13
|
createBasicExtensions,
|
|
12
14
|
createDataExtensions,
|
|
13
15
|
createMarkdownExtensions,
|
|
14
16
|
createThemeExtensions,
|
|
15
17
|
decorateMarkdown,
|
|
16
|
-
|
|
17
|
-
} from '@dxos/
|
|
18
|
-
import {
|
|
19
|
-
import { isTruthy } from '@dxos/util';
|
|
18
|
+
} from '@dxos/ui-editor';
|
|
19
|
+
import { mx } from '@dxos/ui-theme';
|
|
20
|
+
import { isNonNullable } from '@dxos/util';
|
|
20
21
|
|
|
21
22
|
import { meta } from '../../meta';
|
|
22
23
|
|
|
23
|
-
import { handlebars } from './
|
|
24
|
+
import { handlebars, xmlDecorator } from './extensions';
|
|
24
25
|
|
|
25
26
|
export type TemplateEditorProps = ThemedClassName<{
|
|
26
27
|
id: string;
|
|
27
28
|
template: Template.Template;
|
|
29
|
+
lineNumbers?: boolean;
|
|
28
30
|
}>;
|
|
29
31
|
|
|
30
|
-
export const TemplateEditor = ({ id, classNames, template }: TemplateEditorProps) => {
|
|
32
|
+
export const TemplateEditor = ({ id, classNames, template, lineNumbers = true }: TemplateEditorProps) => {
|
|
31
33
|
const { t } = useTranslation(meta.id);
|
|
32
34
|
const { themeMode } = useThemeContext();
|
|
33
35
|
const { parentRef } = useTextEditor(() => {
|
|
@@ -39,20 +41,30 @@ export const TemplateEditor = ({ id, classNames, template }: TemplateEditorProps
|
|
|
39
41
|
return {
|
|
40
42
|
initialValue: text.content ?? '',
|
|
41
43
|
extensions: [
|
|
42
|
-
createDataExtensions({
|
|
44
|
+
createDataExtensions({
|
|
45
|
+
id,
|
|
46
|
+
text: createDocAccessor(text, ['content']),
|
|
47
|
+
}),
|
|
43
48
|
createBasicExtensions({
|
|
44
49
|
bracketMatching: false,
|
|
45
|
-
lineNumbers
|
|
50
|
+
lineNumbers,
|
|
46
51
|
lineWrapping: true,
|
|
47
52
|
placeholder: t('template placeholder'),
|
|
48
53
|
}),
|
|
49
|
-
createThemeExtensions({
|
|
54
|
+
createThemeExtensions({
|
|
55
|
+
themeMode,
|
|
56
|
+
slots: { content: { className: '!pie-4' } },
|
|
57
|
+
}),
|
|
50
58
|
createMarkdownExtensions(),
|
|
51
59
|
decorateMarkdown(),
|
|
52
60
|
handlebars(),
|
|
53
|
-
|
|
61
|
+
// xml(),
|
|
62
|
+
// NOTE: Since we're using markdown only HTML nodes are parsed.
|
|
63
|
+
xmlDecorator(),
|
|
64
|
+
syntaxHighlighting(defaultHighlightStyle),
|
|
65
|
+
].filter(isNonNullable),
|
|
54
66
|
};
|
|
55
|
-
}, [themeMode, template.source?.target]);
|
|
67
|
+
}, [themeMode, template.source?.target, lineNumbers]);
|
|
56
68
|
|
|
57
69
|
return <div ref={parentRef} className={mx('bs-full overflow-hidden', classNames)} />;
|
|
58
70
|
};
|
|
@@ -3,25 +3,26 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta } from '@storybook/react-vite';
|
|
6
|
-
import React, { useState } from 'react';
|
|
6
|
+
import React, { useCallback, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { Blueprint, Template } from '@dxos/blueprints';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
9
10
|
import { useClient } from '@dxos/react-client';
|
|
10
11
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
11
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
12
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
12
13
|
import { trim } from '@dxos/util';
|
|
13
14
|
|
|
14
15
|
import { translations } from '../../translations';
|
|
15
16
|
|
|
16
|
-
import { TemplateForm } from './TemplateForm';
|
|
17
|
+
import { type TemplateChangeCallback, TemplateForm } from './TemplateForm';
|
|
17
18
|
|
|
18
19
|
const TEMPLATE = trim`
|
|
19
20
|
You are a machine that is an expert chess player.
|
|
20
21
|
The move history of the current game is: {{history}}
|
|
21
22
|
If asked to suggest a move explain why it is a good move.
|
|
22
|
-
|
|
23
|
+
|
|
23
24
|
---
|
|
24
|
-
|
|
25
|
+
|
|
25
26
|
{{input}},
|
|
26
27
|
`;
|
|
27
28
|
|
|
@@ -38,9 +39,16 @@ const DefaultStory = () => {
|
|
|
38
39
|
);
|
|
39
40
|
});
|
|
40
41
|
|
|
42
|
+
const handleChange: TemplateChangeCallback = useCallback(
|
|
43
|
+
(mutate) => {
|
|
44
|
+
Obj.change(blueprint, (b) => mutate(b.instructions));
|
|
45
|
+
},
|
|
46
|
+
[blueprint],
|
|
47
|
+
);
|
|
48
|
+
|
|
41
49
|
return (
|
|
42
|
-
<div role='none' className='flex
|
|
43
|
-
<TemplateForm id={blueprint.id} template={blueprint.instructions} />
|
|
50
|
+
<div role='none' className='flex is-[40rem] border border-separator overflow-hidden'>
|
|
51
|
+
<TemplateForm id={blueprint.id} template={blueprint.instructions} onChange={handleChange} />
|
|
44
52
|
</div>
|
|
45
53
|
);
|
|
46
54
|
};
|
|
@@ -50,7 +58,8 @@ const meta = {
|
|
|
50
58
|
component: TemplateForm,
|
|
51
59
|
render: DefaultStory,
|
|
52
60
|
decorators: [
|
|
53
|
-
withTheme,
|
|
61
|
+
withTheme(),
|
|
62
|
+
withLayout({ layout: 'column' }),
|
|
54
63
|
withClientProvider({
|
|
55
64
|
types: [Blueprint.Blueprint],
|
|
56
65
|
createIdentity: true,
|
|
@@ -58,7 +67,6 @@ const meta = {
|
|
|
58
67
|
}),
|
|
59
68
|
],
|
|
60
69
|
parameters: {
|
|
61
|
-
layout: 'column',
|
|
62
70
|
translations,
|
|
63
71
|
},
|
|
64
72
|
} satisfies Meta<typeof TemplateForm>;
|