@dxos/plugin-assistant 0.8.4-main.21d9917 → 0.8.4-main.2244d791bb
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-WP3G5GLG.mjs → BlueprintArticle-6SP2ZWJ2.mjs} +2 -3
- package/dist/lib/browser/BlueprintArticle-6SP2ZWJ2.mjs.map +7 -0
- package/dist/lib/browser/{ChatCompanion-GFSJZTOT.mjs → ChatCompanion-KGPU4DLI.mjs} +67 -20
- package/dist/lib/browser/ChatCompanion-KGPU4DLI.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-IHAPBIZE.mjs → ChatContainer-IHPTKMDK.mjs} +7 -6
- package/dist/lib/browser/ChatContainer-IHPTKMDK.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-EGRMPCTL.mjs → ChatDialog-VALCOM3W.mjs} +5 -5
- package/dist/lib/browser/{ChatDialog-EGRMPCTL.mjs.map → ChatDialog-VALCOM3W.mjs.map} +2 -2
- package/dist/lib/browser/InitiativeContainer-LQHJLTPE.mjs +264 -0
- package/dist/lib/browser/InitiativeContainer-LQHJLTPE.mjs.map +7 -0
- package/dist/lib/browser/{PromptArticle-K362ZPAE.mjs → PromptArticle-YJ5E2YYE.mjs} +21 -9
- package/dist/lib/browser/PromptArticle-YJ5E2YYE.mjs.map +7 -0
- package/dist/lib/browser/{ai-service-5GUDOEWF.mjs → ai-service-CY2BYPH6.mjs} +5 -4
- package/dist/lib/browser/ai-service-CY2BYPH6.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-DSNH2OMY.mjs → app-graph-builder-MUZGUQSC.mjs} +43 -21
- package/dist/lib/browser/app-graph-builder-MUZGUQSC.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-4D42KBDM.mjs +33 -0
- package/dist/lib/browser/blueprint-definition-4D42KBDM.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +3 -7
- package/dist/lib/browser/{chunk-V772AMZM.mjs → chunk-6BVCG5SJ.mjs} +17 -37
- package/dist/lib/browser/chunk-6BVCG5SJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ML3QCFKA.mjs → chunk-JYY5AD65.mjs} +50 -29
- package/dist/lib/browser/chunk-JYY5AD65.mjs.map +7 -0
- package/dist/lib/browser/{chunk-MRJVYGLU.mjs → chunk-MEM7ET2A.mjs} +34 -68
- package/dist/lib/browser/chunk-MEM7ET2A.mjs.map +7 -0
- package/dist/lib/browser/{chunk-A75V4MOQ.mjs → chunk-THZPCE3E.mjs} +228 -92
- package/dist/lib/browser/chunk-THZPCE3E.mjs.map +7 -0
- package/dist/lib/browser/{edge-model-resolver-26BOY6HY.mjs → edge-model-resolver-YTMFQEN5.mjs} +4 -3
- package/dist/lib/browser/edge-model-resolver-YTMFQEN5.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +97 -52
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{local-model-resolver-ZFIM6GGV.mjs → local-model-resolver-CGRQH37T.mjs} +4 -3
- 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-7XJLBRQY.mjs → operation-resolver-MB7OQBPT.mjs} +21 -23
- package/dist/lib/browser/operation-resolver-MB7OQBPT.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-S7SBFOSW.mjs → react-surface-UHDDX6N3.mjs} +37 -21
- package/dist/lib/browser/react-surface-UHDDX6N3.mjs.map +7 -0
- package/dist/lib/browser/{repair-6QGAKOVM.mjs → repair-IRXDYF4R.mjs} +4 -7
- package/dist/lib/browser/repair-IRXDYF4R.mjs.map +7 -0
- package/dist/lib/browser/{settings-4ZDLUMYE.mjs → settings-XF6GKHCG.mjs} +5 -4
- package/dist/lib/browser/settings-XF6GKHCG.mjs.map +7 -0
- package/dist/lib/browser/{state-AN6336ZX.mjs → state-OYDPWLKA.mjs} +2 -2
- 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 +1 -1
- package/dist/lib/node-esm/{BlueprintArticle-WZ76E2C4.mjs → BlueprintArticle-7LI6UXKZ.mjs} +2 -3
- package/dist/lib/node-esm/BlueprintArticle-7LI6UXKZ.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatCompanion-UR7DXZ54.mjs → ChatCompanion-XY3MAAKH.mjs} +67 -20
- package/dist/lib/node-esm/ChatCompanion-XY3MAAKH.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-YMLLGOZK.mjs → ChatContainer-3YXC4HOK.mjs} +7 -6
- package/dist/lib/node-esm/ChatContainer-3YXC4HOK.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-D24WJPK4.mjs → ChatDialog-UAYXP3UM.mjs} +5 -5
- package/dist/lib/node-esm/{ChatDialog-D24WJPK4.mjs.map → ChatDialog-UAYXP3UM.mjs.map} +2 -2
- package/dist/lib/node-esm/InitiativeContainer-EAUOSH36.mjs +265 -0
- package/dist/lib/node-esm/InitiativeContainer-EAUOSH36.mjs.map +7 -0
- package/dist/lib/node-esm/{PromptArticle-D4HAIIC6.mjs → PromptArticle-U2IYPLFR.mjs} +21 -9
- package/dist/lib/node-esm/PromptArticle-U2IYPLFR.mjs.map +7 -0
- package/dist/lib/node-esm/{ai-service-PXKKCFIF.mjs → ai-service-ZI3A6RVG.mjs} +5 -4
- package/dist/lib/node-esm/ai-service-ZI3A6RVG.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-TJCUEXW5.mjs → app-graph-builder-4QN5M6PD.mjs} +43 -21
- package/dist/lib/node-esm/app-graph-builder-4QN5M6PD.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-EJOAZFY5.mjs +34 -0
- package/dist/lib/node-esm/blueprint-definition-EJOAZFY5.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +3 -7
- package/dist/lib/node-esm/{chunk-4BERCIES.mjs → chunk-3DG7AJES.mjs} +228 -92
- package/dist/lib/node-esm/chunk-3DG7AJES.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-DCA5QWQT.mjs → chunk-CTHGEJJA.mjs} +34 -67
- package/dist/lib/node-esm/chunk-CTHGEJJA.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ZRIPP7YF.mjs → chunk-JMBYVUD6.mjs} +50 -29
- package/dist/lib/node-esm/chunk-JMBYVUD6.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-355W5B27.mjs → chunk-LB72WG6R.mjs} +17 -37
- package/dist/lib/node-esm/chunk-LB72WG6R.mjs.map +7 -0
- package/dist/lib/node-esm/{edge-model-resolver-G5KMODPO.mjs → edge-model-resolver-CMJ3KNLQ.mjs} +4 -3
- package/dist/lib/node-esm/edge-model-resolver-CMJ3KNLQ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +97 -52
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{local-model-resolver-KDZLYI7Y.mjs → local-model-resolver-FFDAKOXN.mjs} +4 -3
- 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-SX4WMNA7.mjs → operation-resolver-VWNTUHQQ.mjs} +21 -23
- package/dist/lib/node-esm/operation-resolver-VWNTUHQQ.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-ZR6FXGLF.mjs → react-surface-DTOXFPWM.mjs} +37 -21
- package/dist/lib/node-esm/react-surface-DTOXFPWM.mjs.map +7 -0
- package/dist/lib/node-esm/{repair-QJ7CQDKU.mjs → repair-DMI55PON.mjs} +4 -7
- package/dist/lib/node-esm/repair-DMI55PON.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-CQEOHR3R.mjs → settings-NGGZA7S7.mjs} +5 -4
- package/dist/lib/node-esm/settings-NGGZA7S7.mjs.map +7 -0
- package/dist/lib/node-esm/{state-HDON4REW.mjs → state-VSCPGN7R.mjs} +2 -2
- package/dist/lib/node-esm/{toolkit-OWGCEKOO.mjs → toolkit-JPRJRDDB.mjs} +6 -5
- package/dist/lib/node-esm/toolkit-JPRJRDDB.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/assistant/blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/assistant/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/functions/index.d.ts +25 -0
- package/dist/types/src/blueprints/assistant/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/functions/object-list.d.ts.map +1 -0
- package/dist/types/src/{functions → blueprints/assistant/functions}/object-load.d.ts +1 -1
- package/dist/types/src/blueprints/assistant/functions/object-load.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/functions/object-search.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/index.d.ts +2 -0
- package/dist/types/src/blueprints/assistant/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +1 -6
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts +3 -2
- package/dist/types/src/capabilities/ai-service/ai-service.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service/index.d.ts +1 -1
- package/dist/types/src/capabilities/ai-service/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +4 -19
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +1 -2
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts +3 -2
- package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts +3 -2
- package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/repair/repair.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings/index.d.ts +1 -1
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings/settings.d.ts +3 -2
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit/index.d.ts +1 -1
- package/dist/types/src/capabilities/toolkit/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts +3 -2
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +1 -1
- package/dist/types/src/components/BlueprintArticle.d.ts +1 -1
- package/dist/types/src/components/BlueprintArticle.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +6 -3
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts +2 -2
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer.d.ts +4 -4
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts +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/ChatThread/ChatThread.d.ts +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +115 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
- package/dist/types/src/components/InitiativeContainer/InitiativeContainer.d.ts +7 -0
- package/dist/types/src/components/InitiativeContainer/InitiativeContainer.d.ts.map +1 -0
- package/dist/types/src/components/InitiativeContainer/index.d.ts +3 -0
- package/dist/types/src/components/InitiativeContainer/index.d.ts.map +1 -0
- package/dist/types/src/components/PromptArticle.d.ts +1 -1
- package/dist/types/src/components/PromptArticle.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +114 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +114 -0
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +114 -0
- 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/index.d.ts +10 -11
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +2 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +2 -2
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts +2 -2
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -1
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +7 -3
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/processor/update-name.d.ts +2 -2
- package/dist/types/src/processor/update-name.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +114 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +5 -27
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantAction.d.ts +3 -1
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +94 -91
- package/src/AssistantPlugin.tsx +62 -29
- package/src/blueprints/assistant/blueprint.ts +34 -0
- package/src/blueprints/assistant/functions/index.ts +13 -0
- package/src/{functions → blueprints/assistant/functions}/object-list.ts +2 -2
- package/src/{functions → blueprints/assistant/functions}/object-load.ts +9 -12
- package/src/{functions → blueprints/assistant/functions}/object-search.ts +1 -1
- package/src/blueprints/assistant/index.ts +5 -0
- package/src/blueprints/index.ts +1 -8
- package/src/capabilities/ai-service/ai-service.ts +4 -3
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +37 -17
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +28 -42
- package/src/capabilities/blueprint-definition/index.ts +0 -1
- package/src/capabilities/edge-model-resolver/edge-model-resolver.ts +4 -3
- package/src/capabilities/local-model-resolver/local-model-resolver.ts +4 -3
- package/src/capabilities/operation-resolver/operation-resolver.ts +17 -15
- package/src/capabilities/react-surface/react-surface.tsx +35 -19
- package/src/capabilities/repair/repair.ts +3 -4
- package/src/capabilities/settings/settings.ts +3 -2
- package/src/capabilities/toolkit/toolkit.ts +5 -4
- package/src/components/AssistantSettings/AssistantSettings.tsx +15 -15
- package/src/components/BlueprintArticle.tsx +2 -3
- package/src/components/Chat/Chat.tsx +41 -14
- package/src/components/ChatCompanion.tsx +81 -18
- package/src/components/ChatContainer.tsx +20 -13
- package/src/components/ChatDialog.tsx +4 -3
- package/src/components/ChatProgress/ChatProgress.tsx +2 -3
- package/src/components/ChatPrompt/ChatActions.tsx +8 -0
- package/src/components/ChatThread/ChatThread.stories.tsx +3 -3
- package/src/components/ChatThread/ChatThread.tsx +13 -4
- package/src/components/ChatThread/Link.tsx +1 -1
- package/src/components/ChatThread/registry.tsx +18 -1
- package/src/components/ChatThread/sync.test.ts +2 -1
- package/src/components/ChatThread/sync.ts +14 -8
- package/src/components/InitiativeContainer/InitiativeContainer.tsx +340 -0
- package/src/components/InitiativeContainer/index.ts +6 -0
- package/src/components/PromptArticle.tsx +21 -13
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +1 -1
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +1 -1
- package/src/components/Toolbox/Toolbox.stories.tsx +2 -2
- package/src/components/Toolbox/Toolbox.tsx +41 -42
- package/src/components/TriggerStatus/TriggerStatus.tsx +142 -0
- package/src/components/TriggerStatus/index.ts +5 -0
- package/src/components/index.ts +11 -2
- package/src/hooks/useBlueprintRegistry.ts +7 -4
- package/src/hooks/useChatProcessor.ts +2 -1
- package/src/hooks/useChatServices.ts +3 -3
- package/src/hooks/useChatToolbarActions.ts +6 -5
- package/src/hooks/useReferencesProvider.ts +1 -5
- package/src/index.ts +1 -0
- package/src/processor/processor.test.ts +7 -7
- package/src/processor/processor.ts +47 -26
- package/src/processor/update-name.ts +2 -3
- package/src/translations.ts +23 -2
- package/src/types/Assistant.ts +4 -38
- package/src/types/AssistantAction.ts +6 -5
- package/src/types/index.ts +3 -0
- package/dist/lib/browser/BlueprintArticle-WP3G5GLG.mjs.map +0 -7
- package/dist/lib/browser/ChatCompanion-GFSJZTOT.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-IHAPBIZE.mjs.map +0 -7
- package/dist/lib/browser/PromptArticle-K362ZPAE.mjs.map +0 -7
- package/dist/lib/browser/ai-service-5GUDOEWF.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-DSNH2OMY.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-DGHH7MUU.mjs +0 -14
- package/dist/lib/browser/blueprint-definition-DGHH7MUU.mjs.map +0 -7
- package/dist/lib/browser/chunk-A75V4MOQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-ML3QCFKA.mjs.map +0 -7
- package/dist/lib/browser/chunk-MRJVYGLU.mjs.map +0 -7
- package/dist/lib/browser/chunk-V772AMZM.mjs.map +0 -7
- package/dist/lib/browser/chunk-WGQTU6UJ.mjs +0 -41
- package/dist/lib/browser/chunk-WGQTU6UJ.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-26BOY6HY.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-ZFIM6GGV.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-7XJLBRQY.mjs.map +0 -7
- package/dist/lib/browser/react-surface-S7SBFOSW.mjs.map +0 -7
- package/dist/lib/browser/repair-6QGAKOVM.mjs.map +0 -7
- package/dist/lib/browser/settings-4ZDLUMYE.mjs.map +0 -7
- package/dist/lib/browser/toolkit-7AVTEPMA.mjs +0 -18
- package/dist/lib/browser/toolkit-7AVTEPMA.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintArticle-WZ76E2C4.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-UR7DXZ54.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-YMLLGOZK.mjs.map +0 -7
- package/dist/lib/node-esm/PromptArticle-D4HAIIC6.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-PXKKCFIF.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-TJCUEXW5.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-SEMDEIYG.mjs +0 -15
- package/dist/lib/node-esm/blueprint-definition-SEMDEIYG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-355W5B27.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4BERCIES.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DCA5QWQT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MSBPC4RJ.mjs +0 -42
- package/dist/lib/node-esm/chunk-MSBPC4RJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZRIPP7YF.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-G5KMODPO.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-KDZLYI7Y.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-SX4WMNA7.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-ZR6FXGLF.mjs.map +0 -7
- package/dist/lib/node-esm/repair-QJ7CQDKU.mjs.map +0 -7
- package/dist/lib/node-esm/settings-CQEOHR3R.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-OWGCEKOO.mjs.map +0 -7
- package/dist/types/src/blueprints/assistant-blueprint.d.ts +0 -209
- package/dist/types/src/blueprints/assistant-blueprint.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/functions/index.d.ts +0 -4
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/object-list.d.ts.map +0 -1
- package/dist/types/src/functions/object-load.d.ts.map +0 -1
- package/dist/types/src/functions/object-search.d.ts.map +0 -1
- package/src/blueprints/assistant-blueprint.ts +0 -62
- package/src/components/ChatThread/reducers.ts +0 -151
- package/src/functions/index.ts +0 -7
- /package/dist/lib/browser/{state-AN6336ZX.mjs.map → state-OYDPWLKA.mjs.map} +0 -0
- /package/dist/lib/node-esm/{state-HDON4REW.mjs.map → state-VSCPGN7R.mjs.map} +0 -0
- /package/dist/types/src/{functions → blueprints/assistant/functions}/object-list.d.ts +0 -0
- /package/dist/types/src/{functions → blueprints/assistant/functions}/object-search.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 { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
14
|
+
import { Initiative, InitiativeFunctions, Plan } from '@dxos/assistant-toolkit';
|
|
15
|
+
import { DXN, Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
16
|
+
import { type JsonPath, splitJsonPath } from '@dxos/echo/internal';
|
|
17
|
+
import { AtomObj, AtomRef } from '@dxos/echo-atom';
|
|
18
|
+
import { FunctionDefinition, QueueService, Trigger } from '@dxos/functions';
|
|
19
|
+
import { AutomationCapabilities } from '@dxos/plugin-automation/types';
|
|
20
|
+
import { MarkdownEditor } from '@dxos/plugin-markdown';
|
|
21
|
+
import { useObject, useQuery } from '@dxos/react-client/echo';
|
|
22
|
+
import { Button, ButtonGroup, IconButton, Input, Layout, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
23
|
+
import { Form, type FormFieldMap, omitId } from '@dxos/react-ui-form';
|
|
24
|
+
import { StackItem } from '@dxos/react-ui-stack';
|
|
25
|
+
import { type Text } from '@dxos/schema';
|
|
26
|
+
|
|
27
|
+
const TAB_INITATIVE = 'Initiative';
|
|
28
|
+
const TAB_CHAT = 'Chat';
|
|
29
|
+
|
|
30
|
+
export type InitiativeContainerProps = SurfaceComponentProps<Initiative.Initiative>;
|
|
31
|
+
|
|
32
|
+
export const InitiativeContainer = ({ subject: initiative }: InitiativeContainerProps) => {
|
|
33
|
+
const [selectedTab, setSelectedTab] = useState<string>(TAB_INITATIVE);
|
|
34
|
+
|
|
35
|
+
const tabs = useAtomValue(
|
|
36
|
+
useMemo(
|
|
37
|
+
() =>
|
|
38
|
+
AtomObj.make(initiative).pipe((initiative) =>
|
|
39
|
+
Atom.make((get) => {
|
|
40
|
+
return [TAB_INITATIVE, TAB_CHAT, ...get(initiative).artifacts.map((artifact) => artifact.name)];
|
|
41
|
+
}),
|
|
42
|
+
),
|
|
43
|
+
[initiative],
|
|
44
|
+
),
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const chat = useAtomValue(
|
|
48
|
+
useMemo(
|
|
49
|
+
() =>
|
|
50
|
+
AtomObj.make(initiative).pipe((initiative) =>
|
|
51
|
+
Atom.make((get) => {
|
|
52
|
+
const chat = get(initiative).chat;
|
|
53
|
+
return chat ? get(AtomRef.make(chat)) : undefined;
|
|
54
|
+
}),
|
|
55
|
+
),
|
|
56
|
+
[initiative],
|
|
57
|
+
),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const artifacts = useAtomValue(
|
|
61
|
+
useMemo(
|
|
62
|
+
() =>
|
|
63
|
+
AtomObj.make(initiative).pipe((initiative) =>
|
|
64
|
+
Atom.make((get) => {
|
|
65
|
+
return get(initiative).artifacts.map((artifact) => ({
|
|
66
|
+
name: artifact.name,
|
|
67
|
+
data: get(AtomRef.make(artifact.data)),
|
|
68
|
+
}));
|
|
69
|
+
}),
|
|
70
|
+
),
|
|
71
|
+
[initiative],
|
|
72
|
+
),
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const selectedArtifact = artifacts.find((artifact) => artifact.name === selectedTab);
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<StackItem.Content toolbar>
|
|
79
|
+
<div
|
|
80
|
+
role='none'
|
|
81
|
+
className='flex flex-1 min-is-0 overflow-x-auto scrollbar-none gap-1 border-b border-subduedSeparator'
|
|
82
|
+
>
|
|
83
|
+
{tabs.map((tab) => (
|
|
84
|
+
<IconButton
|
|
85
|
+
key={tab}
|
|
86
|
+
icon={Match.value(tab).pipe(
|
|
87
|
+
Match.when(TAB_INITATIVE, () => 'ph--sparkle--regular'),
|
|
88
|
+
Match.when(TAB_CHAT, () => 'ph--chat--regular'),
|
|
89
|
+
Match.orElse(() => 'ph--file--regular'),
|
|
90
|
+
)}
|
|
91
|
+
label={tab}
|
|
92
|
+
variant={selectedTab === tab ? 'primary' : 'ghost'}
|
|
93
|
+
onClick={() => setSelectedTab(tab)}
|
|
94
|
+
/>
|
|
95
|
+
))}
|
|
96
|
+
</div>
|
|
97
|
+
{selectedTab === TAB_INITATIVE && <InitiativeForm initiative={initiative} />}
|
|
98
|
+
{selectedTab === TAB_CHAT && <Surface.Surface role='article' data={{ subject: chat }} limit={1} />}
|
|
99
|
+
{selectedArtifact && <Surface.Surface role='section' data={{ subject: selectedArtifact.data }} limit={1} />}
|
|
100
|
+
</StackItem.Content>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export default InitiativeContainer;
|
|
105
|
+
|
|
106
|
+
const InitiativeForm = ({ initiative }: { initiative: Initiative.Initiative }) => {
|
|
107
|
+
const handleChange = useCallback(
|
|
108
|
+
(
|
|
109
|
+
values: Omit<Initiative.Initiative, 'id'>,
|
|
110
|
+
{ isValid, changed }: { isValid: boolean; changed: Record<string, boolean> },
|
|
111
|
+
) => {
|
|
112
|
+
if (!isValid) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const changedPaths = Object.keys(changed).filter((path) => changed[path as string]) as JsonPath[];
|
|
117
|
+
// Handle other property changes.
|
|
118
|
+
if (changedPaths.length > 0) {
|
|
119
|
+
Obj.change(initiative, () => {
|
|
120
|
+
for (const path of changedPaths) {
|
|
121
|
+
const parts = splitJsonPath(path);
|
|
122
|
+
const value = Obj.getValue(values as any, parts);
|
|
123
|
+
Obj.setValue(initiative, parts, value);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
queueMicrotask(() => syncTriggers(initiative));
|
|
129
|
+
},
|
|
130
|
+
[initiative],
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const fieldMap = useMemo<FormFieldMap>(
|
|
134
|
+
() => ({
|
|
135
|
+
spec: ({ type, label, getValue, onValueChange }) => {
|
|
136
|
+
const { t } = useTranslation();
|
|
137
|
+
|
|
138
|
+
const value: Ref.Ref<Text.Text> = getValue();
|
|
139
|
+
const target = useAtomValue(AtomRef.make(value));
|
|
140
|
+
const [initialValue] = useObject(target, 'content');
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
<Input.Root>
|
|
144
|
+
<div role='none'>
|
|
145
|
+
<Input.Label>{toLocalizedString(label, t)}</Input.Label>
|
|
146
|
+
</div>
|
|
147
|
+
<MarkdownEditor.Root id={target?.id ?? ''} object={target}>
|
|
148
|
+
<MarkdownEditor.Content initialValue={initialValue} />
|
|
149
|
+
</MarkdownEditor.Root>
|
|
150
|
+
</Input.Root>
|
|
151
|
+
);
|
|
152
|
+
},
|
|
153
|
+
plan: ({ type, label, getValue, onValueChange }) => {
|
|
154
|
+
const { t } = useTranslation();
|
|
155
|
+
|
|
156
|
+
const value: Ref.Ref<Plan.Plan> = getValue();
|
|
157
|
+
const target = useAtomValue(AtomRef.make(value));
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<Input.Root>
|
|
161
|
+
<div role='none'>
|
|
162
|
+
<Input.Label>{toLocalizedString(label, t)}</Input.Label>
|
|
163
|
+
</div>
|
|
164
|
+
<MarkdownEditor.Root id={target?.id ?? ''}>
|
|
165
|
+
<MarkdownEditor.Content initialValue={target ? Plan.formatPlan(target) : ''} />
|
|
166
|
+
</MarkdownEditor.Root>
|
|
167
|
+
</Input.Root>
|
|
168
|
+
);
|
|
169
|
+
},
|
|
170
|
+
}),
|
|
171
|
+
[],
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
const computeRuntime = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
175
|
+
|
|
176
|
+
const handleResetHistory = useCallback(async () => {
|
|
177
|
+
const runtime = computeRuntime.getRuntime(Obj.getDatabase(initiative)!.spaceId);
|
|
178
|
+
|
|
179
|
+
await runtime.runPromise(Initiative.resetChatHistory(initiative));
|
|
180
|
+
|
|
181
|
+
if (!initiative.queue) {
|
|
182
|
+
await runtime.runPromise(
|
|
183
|
+
Effect.gen(function* () {
|
|
184
|
+
const queue = yield* QueueService.createQueue();
|
|
185
|
+
Obj.change(initiative, (initiative) => {
|
|
186
|
+
initiative.queue = Ref.fromDXN(queue.dxn);
|
|
187
|
+
});
|
|
188
|
+
}),
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
}, [initiative, computeRuntime]);
|
|
192
|
+
|
|
193
|
+
const inputQueue = useAtomValue(
|
|
194
|
+
AtomObj.make(initiative).pipe((_) =>
|
|
195
|
+
Atom.make((get) =>
|
|
196
|
+
Option.fromNullable(get(_).queue).pipe(Option.map(AtomRef.make), Option.map(get), Option.getOrUndefined),
|
|
197
|
+
),
|
|
198
|
+
),
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
const inputQueueItems = useQuery(inputQueue, Query.select(Filter.everything()));
|
|
202
|
+
|
|
203
|
+
// TODO(dmaretskyi): Form breaks if we provide the echo object directly.
|
|
204
|
+
const spreadValue = useMemo(() => ({ ...initiative }), [initiative]);
|
|
205
|
+
return (
|
|
206
|
+
<Layout.Main>
|
|
207
|
+
<ButtonGroup classNames='h-10'>
|
|
208
|
+
<Button onClick={handleResetHistory}>Reset History</Button>
|
|
209
|
+
</ButtonGroup>
|
|
210
|
+
<h3 className='mb-2'>Input Queue</h3>
|
|
211
|
+
<div className='border border-subduedSeparator rounded-md p-2 h-64 overflow-y-auto'>
|
|
212
|
+
{inputQueueItems.map((item) => (
|
|
213
|
+
<Surface.Surface key={item.id} role='section' data={{ subject: item }} limit={1} />
|
|
214
|
+
))}
|
|
215
|
+
{inputQueueItems.length === 0 && <div className='text-subdued'>No items in queue</div>}
|
|
216
|
+
</div>
|
|
217
|
+
<Form.Root
|
|
218
|
+
schema={omitId(Initiative.Initiative)}
|
|
219
|
+
onValuesChanged={handleChange as any}
|
|
220
|
+
values={spreadValue}
|
|
221
|
+
db={Obj.getDatabase(initiative)}
|
|
222
|
+
fieldMap={fieldMap}
|
|
223
|
+
>
|
|
224
|
+
<Form.FieldSet />
|
|
225
|
+
</Form.Root>
|
|
226
|
+
</Layout.Main>
|
|
227
|
+
);
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
// TODO(dmaretskyi): Perhaps the association is better done with a relation.
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Foreign key {@link INITIATIVE_TRIGGER_EXTENSION_KEY} => <initative id : ObjectId>
|
|
234
|
+
*/
|
|
235
|
+
const INITIATIVE_TRIGGER_EXTENSION_KEY = 'dxos.org/extension/InitiativeTrigger';
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Foreign key {@link INITIATIVE_TRIGGER_EXTENSION_KEY} => <dxn string of subscription target>
|
|
239
|
+
*/
|
|
240
|
+
const INITIATIVE_TRIGGER_TARGET_EXTENSION_KEY = 'dxos.org/extension/InitiativeTriggerTarget';
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Syncs triggers in the database with the initiative subscriptions.
|
|
244
|
+
*/
|
|
245
|
+
|
|
246
|
+
const syncTriggers = async (initiative: Initiative.Initiative) => {
|
|
247
|
+
const db = Obj.getDatabase(initiative);
|
|
248
|
+
if (!db) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const triggers = await db
|
|
253
|
+
.query(Filter.foreignKeys(Trigger.Trigger, [{ source: INITIATIVE_TRIGGER_EXTENSION_KEY, id: initiative.id }]))
|
|
254
|
+
.run();
|
|
255
|
+
|
|
256
|
+
// Delete triggers that are not in subscriptions.
|
|
257
|
+
for (const trigger of triggers) {
|
|
258
|
+
const target = Obj.getKeys(trigger, INITIATIVE_TRIGGER_TARGET_EXTENSION_KEY).at(0)?.id;
|
|
259
|
+
|
|
260
|
+
const exists = initiative.subscriptions.find((subscription) => subscription.dxn.toString() === target);
|
|
261
|
+
if (!exists && !(initiative.useQualifyingAgent && target === Obj.getDXN(initiative)?.toString())) {
|
|
262
|
+
db.remove(trigger);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Add triggers that are not in the database.
|
|
267
|
+
for (const subscription of initiative.subscriptions) {
|
|
268
|
+
const relevantTrigger = triggers.find((trigger) =>
|
|
269
|
+
Obj.getKeys(trigger, INITIATIVE_TRIGGER_TARGET_EXTENSION_KEY).some(
|
|
270
|
+
(key) => key.id === subscription.dxn.toString(),
|
|
271
|
+
),
|
|
272
|
+
);
|
|
273
|
+
if (relevantTrigger) {
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const target = await subscription.tryLoad();
|
|
278
|
+
if (!target || !target.queue || !(target.queue.dxn instanceof DXN) || target.queue.dxn.kind !== DXN.kind.QUEUE) {
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
db.add(
|
|
283
|
+
Trigger.make({
|
|
284
|
+
[Obj.Meta]: {
|
|
285
|
+
keys: [
|
|
286
|
+
{ source: INITIATIVE_TRIGGER_EXTENSION_KEY, id: initiative.id },
|
|
287
|
+
{ source: INITIATIVE_TRIGGER_TARGET_EXTENSION_KEY, id: subscription.dxn.toString() },
|
|
288
|
+
],
|
|
289
|
+
},
|
|
290
|
+
enabled: true,
|
|
291
|
+
spec: {
|
|
292
|
+
kind: 'queue',
|
|
293
|
+
queue: target.queue.dxn.toString(),
|
|
294
|
+
},
|
|
295
|
+
function: Ref.make(
|
|
296
|
+
FunctionDefinition.serialize(
|
|
297
|
+
initiative.useQualifyingAgent ? InitiativeFunctions.Qualifier : InitiativeFunctions.Agent,
|
|
298
|
+
),
|
|
299
|
+
),
|
|
300
|
+
input: {
|
|
301
|
+
initiative: Ref.make(initiative),
|
|
302
|
+
event: '{{event}}',
|
|
303
|
+
},
|
|
304
|
+
concurrency: initiative.useQualifyingAgent ? 5 : undefined,
|
|
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(InitiativeFunctions.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
|
+
};
|
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type SurfaceComponentProps } from '@dxos/app-
|
|
8
|
-
import {
|
|
7
|
+
import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { AgentFunctions } from '@dxos/assistant-toolkit';
|
|
9
9
|
import { type Prompt } from '@dxos/blueprints';
|
|
10
10
|
import { Obj } from '@dxos/echo';
|
|
11
|
+
import { type FunctionDefinition } from '@dxos/functions';
|
|
12
|
+
import { invariant } from '@dxos/invariant';
|
|
11
13
|
import { invokeFunctionWithTracing, useComputeRuntimeCallback } from '@dxos/plugin-automation';
|
|
12
|
-
import { Toolbar, useTranslation } from '@dxos/react-ui';
|
|
14
|
+
import { Layout, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
13
15
|
import { useAttention } from '@dxos/react-ui-attention';
|
|
14
|
-
import { Layout } from '@dxos/react-ui-mosaic';
|
|
15
16
|
|
|
16
17
|
import { meta } from '../meta';
|
|
17
18
|
|
|
@@ -21,21 +22,28 @@ export type PromptArticleProps = SurfaceComponentProps<Prompt.Prompt>;
|
|
|
21
22
|
|
|
22
23
|
export const PromptArticle = ({ role, subject }: PromptArticleProps) => {
|
|
23
24
|
const { t } = useTranslation(meta.id);
|
|
24
|
-
const db = Obj.getDatabase(subject);
|
|
25
25
|
const { hasAttention } = useAttention(Obj.getDXN(subject).toString());
|
|
26
|
+
const db = Obj.getDatabase(subject);
|
|
26
27
|
|
|
27
|
-
const inputData = useMemo(
|
|
28
|
+
const inputData = useMemo<FunctionDefinition.Input<typeof AgentFunctions.Prompt> | undefined>(
|
|
28
29
|
() =>
|
|
29
|
-
subject &&
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
subject && db
|
|
31
|
+
? {
|
|
32
|
+
prompt: db.makeRef(Obj.getDXN(subject)),
|
|
33
|
+
input: {},
|
|
34
|
+
}
|
|
35
|
+
: undefined,
|
|
33
36
|
[subject, db],
|
|
34
37
|
);
|
|
35
38
|
|
|
36
|
-
const handleRun = useComputeRuntimeCallback(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
const handleRun = useComputeRuntimeCallback(
|
|
40
|
+
db?.spaceId,
|
|
41
|
+
() => {
|
|
42
|
+
invariant(inputData);
|
|
43
|
+
return invokeFunctionWithTracing(AgentFunctions.Prompt, inputData);
|
|
44
|
+
},
|
|
45
|
+
[inputData],
|
|
46
|
+
);
|
|
39
47
|
|
|
40
48
|
return (
|
|
41
49
|
<Layout.Main role={role} toolbar>
|
|
@@ -20,7 +20,7 @@ import { translations } from '../../translations';
|
|
|
20
20
|
import { Toolbox, type ToolboxProps } from './Toolbox';
|
|
21
21
|
|
|
22
22
|
const DefaultStory = (props: ToolboxProps) => {
|
|
23
|
-
return <Toolbox {...props} classNames='
|
|
23
|
+
return <Toolbox {...props} classNames='bs-[15rem] is-[30rem] plb-1 rounded-sm border border-separator' />;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const meta = {
|
|
@@ -28,7 +28,7 @@ const meta = {
|
|
|
28
28
|
component: Toolbox as any,
|
|
29
29
|
render: DefaultStory,
|
|
30
30
|
decorators: [
|
|
31
|
-
withTheme,
|
|
31
|
+
withTheme(),
|
|
32
32
|
withPluginManager({
|
|
33
33
|
plugins: [
|
|
34
34
|
...corePlugins(),
|
|
@@ -9,10 +9,9 @@ import { type Database, type Ref } from '@dxos/echo';
|
|
|
9
9
|
import { Function } from '@dxos/functions';
|
|
10
10
|
import { log } from '@dxos/log';
|
|
11
11
|
import { Filter, useQuery } from '@dxos/react-client/echo';
|
|
12
|
-
import { type ThemedClassName
|
|
12
|
+
import { ScrollArea, type ThemedClassName } from '@dxos/react-ui';
|
|
13
13
|
import { mx } from '@dxos/ui-theme';
|
|
14
14
|
|
|
15
|
-
import { meta } from '../../meta';
|
|
16
15
|
import { type AiChatProcessor } from '../../processor';
|
|
17
16
|
import { ServiceType } from '../../types';
|
|
18
17
|
|
|
@@ -25,47 +24,47 @@ export type ToolboxProps = ThemedClassName<{
|
|
|
25
24
|
}>;
|
|
26
25
|
|
|
27
26
|
export const Toolbox = ({ classNames, functions, services, blueprints, activeBlueprints }: ToolboxProps) => {
|
|
28
|
-
const { t } = useTranslation(meta.id);
|
|
29
|
-
|
|
30
27
|
return (
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
name,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
28
|
+
<ScrollArea.Root thin orientation='vertical'>
|
|
29
|
+
<ScrollArea.Viewport classNames={classNames}>
|
|
30
|
+
{blueprints && blueprints.length > 0 && (
|
|
31
|
+
<Section
|
|
32
|
+
title='Blueprints'
|
|
33
|
+
items={blueprints.map(({ name, description, tools }) => ({
|
|
34
|
+
name,
|
|
35
|
+
description,
|
|
36
|
+
subitems: tools.map((toolId) => ({ name: `∙ ${safeToolId(toolId)}` })),
|
|
37
|
+
}))}
|
|
38
|
+
/>
|
|
39
|
+
)}
|
|
40
|
+
|
|
41
|
+
{activeBlueprints && activeBlueprints.length > 0 && (
|
|
42
|
+
<Section
|
|
43
|
+
title='Blueprints'
|
|
44
|
+
items={activeBlueprints.map(({ target }) => ({
|
|
45
|
+
name: target?.name ?? '',
|
|
46
|
+
description: target?.description ?? '',
|
|
47
|
+
subitems: target?.tools.map((toolId) => ({ name: `∙ ${safeToolId(toolId)}` })),
|
|
48
|
+
}))}
|
|
49
|
+
/>
|
|
50
|
+
)}
|
|
51
|
+
|
|
52
|
+
{services && services.length > 0 && (
|
|
53
|
+
<Section
|
|
54
|
+
title='Services'
|
|
55
|
+
items={services.map(({ service: { serviceId, name, description } }) => ({
|
|
56
|
+
name: name ?? serviceId,
|
|
57
|
+
description,
|
|
58
|
+
// subitems: tools.map(({ name, description }) => ({ name: `∙ ${name}`, description })),
|
|
59
|
+
}))}
|
|
60
|
+
/>
|
|
61
|
+
)}
|
|
62
|
+
|
|
63
|
+
{functions && functions.length > 0 && (
|
|
64
|
+
<Section title='Functions' items={functions.map(({ name, description }) => ({ name, description }))} />
|
|
65
|
+
)}
|
|
66
|
+
</ScrollArea.Viewport>
|
|
67
|
+
</ScrollArea.Root>
|
|
69
68
|
);
|
|
70
69
|
};
|
|
71
70
|
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { useCapability } from '@dxos/app-framework/ui';
|
|
8
|
+
import { useLayout } from '@dxos/app-toolkit/ui';
|
|
9
|
+
import { type InvocationsState } from '@dxos/functions-runtime';
|
|
10
|
+
import { useTriggerRuntimeControls } from '@dxos/plugin-automation';
|
|
11
|
+
import { ClientCapabilities } from '@dxos/plugin-client/types';
|
|
12
|
+
import { StatusBar } from '@dxos/plugin-status-bar';
|
|
13
|
+
import { parseId } from '@dxos/react-client/echo';
|
|
14
|
+
import { Icon, Input, Popover, useTranslation } from '@dxos/react-ui';
|
|
15
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
16
|
+
import { mx } from '@dxos/ui-theme';
|
|
17
|
+
|
|
18
|
+
import { meta } from '../../meta';
|
|
19
|
+
|
|
20
|
+
type TriggerStatusState = 'disabled' | 'idle' | 'running' | 'error';
|
|
21
|
+
|
|
22
|
+
const getIcon = (state: TriggerStatusState): string => {
|
|
23
|
+
switch (state) {
|
|
24
|
+
case 'disabled':
|
|
25
|
+
return 'ph--lightning-slash--regular';
|
|
26
|
+
case 'idle':
|
|
27
|
+
return 'ph--lightning--regular';
|
|
28
|
+
case 'running':
|
|
29
|
+
return 'ph--lightning--fill';
|
|
30
|
+
case 'error':
|
|
31
|
+
return 'ph--warning--regular';
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const getIconClassNames = (state: TriggerStatusState): string | undefined => {
|
|
36
|
+
switch (state) {
|
|
37
|
+
case 'running':
|
|
38
|
+
return 'animate-pulse text-accentText';
|
|
39
|
+
case 'error':
|
|
40
|
+
return 'text-errorText';
|
|
41
|
+
default:
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const useCurrentSpace = () => {
|
|
47
|
+
const layout = useLayout();
|
|
48
|
+
const client = useCapability(ClientCapabilities.Client);
|
|
49
|
+
const { spaceId } = parseId(layout.workspace);
|
|
50
|
+
const space = spaceId ? client.spaces.get(spaceId) : undefined;
|
|
51
|
+
return space;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const TriggerStatus = () => {
|
|
55
|
+
const space = useCurrentSpace();
|
|
56
|
+
const db = space?.db;
|
|
57
|
+
const { state, start, stop } = useTriggerRuntimeControls(db);
|
|
58
|
+
const isRunning = state?.enabled ?? false;
|
|
59
|
+
|
|
60
|
+
// Determine the current trigger status state.
|
|
61
|
+
const triggerState: TriggerStatusState = useMemo(() => {
|
|
62
|
+
if (!isRunning) {
|
|
63
|
+
return 'disabled';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Check if there's any pending invocation.
|
|
67
|
+
const hasPending = state?.invocations.some((invocation) => invocation.result === null);
|
|
68
|
+
if (hasPending) {
|
|
69
|
+
return 'running';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Check if the last invocation failed.
|
|
73
|
+
const lastInvocation = state?.invocations.at(-1);
|
|
74
|
+
if (lastInvocation?.result?._tag === 'Failure') {
|
|
75
|
+
return 'error';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return 'idle';
|
|
79
|
+
}, [isRunning, state?.invocations]);
|
|
80
|
+
|
|
81
|
+
const { t } = useTranslation(meta.id);
|
|
82
|
+
const title = t(`trigger status ${triggerState} label`);
|
|
83
|
+
const icon = <Icon icon={getIcon(triggerState)} classNames={getIconClassNames(triggerState)} />;
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<Popover.Root>
|
|
87
|
+
<Popover.Trigger asChild>
|
|
88
|
+
<StatusBar.Item title={title}>{icon}</StatusBar.Item>
|
|
89
|
+
</Popover.Trigger>
|
|
90
|
+
<Popover.Portal>
|
|
91
|
+
<Popover.Content>
|
|
92
|
+
<TriggerStatusPopover
|
|
93
|
+
isRunning={isRunning}
|
|
94
|
+
state={triggerState}
|
|
95
|
+
currentFunctionName={state?.invocations.at(-1)?.function?.name ?? state?.invocations.at(-1)?.function?.key}
|
|
96
|
+
lastInvocation={state?.invocations.at(-1)}
|
|
97
|
+
onToggle={isRunning ? stop : start}
|
|
98
|
+
/>
|
|
99
|
+
<Popover.Arrow />
|
|
100
|
+
</Popover.Content>
|
|
101
|
+
</Popover.Portal>
|
|
102
|
+
</Popover.Root>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
interface TriggerStatusPopoverProps {
|
|
107
|
+
isRunning: boolean;
|
|
108
|
+
state: TriggerStatusState;
|
|
109
|
+
currentFunctionName?: string;
|
|
110
|
+
lastInvocation?: InvocationsState;
|
|
111
|
+
onToggle: () => void;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const TriggerStatusPopover = ({
|
|
115
|
+
isRunning,
|
|
116
|
+
state,
|
|
117
|
+
currentFunctionName,
|
|
118
|
+
lastInvocation,
|
|
119
|
+
onToggle,
|
|
120
|
+
}: TriggerStatusPopoverProps) => {
|
|
121
|
+
const { t } = useTranslation(meta.id);
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<div className='min-is-[240px] p-2 space-y-3'>
|
|
125
|
+
{/* Runtime Toggle */}
|
|
126
|
+
<Settings.ItemInput title={t('trigger runtime label')} description={t('trigger runtime description')}>
|
|
127
|
+
<Input.Switch classNames='justify-self-end' checked={isRunning} onCheckedChange={onToggle} />
|
|
128
|
+
</Settings.ItemInput>
|
|
129
|
+
|
|
130
|
+
{/* Status Indicator */}
|
|
131
|
+
<div className='flex items-center gap-2 pt-2 border-t border-separator'>
|
|
132
|
+
<Icon icon={getIcon(state)} classNames={mx(getIconClassNames(state), 'shrink-0')} />
|
|
133
|
+
<span className='text-sm'>{t(`trigger status ${state} label`)}</span>
|
|
134
|
+
{currentFunctionName && state === 'running' && (
|
|
135
|
+
<span className='text-xs text-description'>{currentFunctionName}</span>
|
|
136
|
+
)}
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export default TriggerStatus;
|