@dxos/plugin-assistant 0.8.4-main.dedc0f3 → 0.8.4-main.ead640a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{BlueprintContainer-BFNN6K46.mjs → BlueprintContainer-FOZTO447.mjs} +6 -7
- package/dist/lib/browser/{BlueprintContainer-BFNN6K46.mjs.map → BlueprintContainer-FOZTO447.mjs.map} +3 -3
- package/dist/lib/browser/{ChatCompanion-YYYCHZYV.mjs → ChatCompanion-EC6LBEWF.mjs} +38 -14
- package/dist/lib/browser/ChatCompanion-EC6LBEWF.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-G6YHR6GJ.mjs → ChatContainer-A2SL6WO5.mjs} +7 -9
- package/dist/lib/browser/{ChatContainer-G6YHR6GJ.mjs.map → ChatContainer-A2SL6WO5.mjs.map} +3 -3
- package/dist/lib/browser/{ChatDialog-HJ7VDRQO.mjs → ChatDialog-XMOUFX2P.mjs} +3 -5
- package/dist/lib/browser/{ChatDialog-HJ7VDRQO.mjs.map → ChatDialog-XMOUFX2P.mjs.map} +1 -1
- package/dist/lib/browser/{SequenceContainer-TF5QNXYM.mjs → SequenceContainer-2FEWMQGW.mjs} +4 -4
- package/dist/lib/browser/SequenceContainer-2FEWMQGW.mjs.map +7 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs +19 -0
- package/dist/lib/browser/ai-service-ERTZBTP3.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-3C43MLCD.mjs → app-graph-builder-7AE4R5KJ.mjs} +41 -11
- package/dist/lib/browser/app-graph-builder-7AE4R5KJ.mjs.map +7 -0
- package/dist/lib/browser/{blueprint-definition-VHFSRTEJ.mjs → blueprint-definition-NSJARW5U.mjs} +2 -2
- package/dist/lib/browser/{chunk-GLWD66TA.mjs → chunk-2CE2KPKZ.mjs} +28 -14
- package/dist/lib/browser/chunk-2CE2KPKZ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SMIVXXAI.mjs → chunk-37VMDB4P.mjs} +32 -14
- package/dist/lib/browser/chunk-37VMDB4P.mjs.map +7 -0
- package/dist/lib/browser/{chunk-R6LRGW3I.mjs → chunk-3EWE2UQD.mjs} +11 -7
- package/dist/lib/browser/chunk-3EWE2UQD.mjs.map +7 -0
- package/dist/lib/browser/{chunk-EZUSNS2J.mjs → chunk-5EGXHCAZ.mjs} +2 -5
- package/dist/lib/browser/chunk-5EGXHCAZ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-O4LUJEDV.mjs → chunk-5RICKAMN.mjs} +5 -7
- package/dist/lib/browser/chunk-5RICKAMN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-PL4O4ZJU.mjs → chunk-7THOIN6F.mjs} +309 -481
- package/dist/lib/browser/chunk-7THOIN6F.mjs.map +7 -0
- package/dist/lib/browser/{chunk-PQI3MGDN.mjs → chunk-HYYWP3KP.mjs} +6 -5
- package/dist/lib/browser/chunk-HYYWP3KP.mjs.map +7 -0
- package/dist/lib/browser/{chunk-PPJAIE2T.mjs → chunk-Z7DQT64Z.mjs} +39 -37
- package/dist/lib/browser/chunk-Z7DQT64Z.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs +18 -0
- package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +72 -48
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-I6M3ZDAS.mjs → intent-resolver-BZUU4UNA.mjs} +29 -11
- package/dist/lib/browser/intent-resolver-BZUU4UNA.mjs.map +7 -0
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs +17 -0
- package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-WNLA2636.mjs → react-surface-KRRUOMYY.mjs} +13 -15
- package/dist/lib/browser/react-surface-KRRUOMYY.mjs.map +7 -0
- package/dist/lib/browser/{settings-36V3VUMW.mjs → settings-PSR3WF3X.mjs} +5 -5
- package/dist/lib/browser/{settings-36V3VUMW.mjs.map → settings-PSR3WF3X.mjs.map} +1 -1
- package/dist/lib/browser/{state-AINRYS5W.mjs → state-LXTS54DI.mjs} +5 -5
- package/dist/lib/browser/{state-AINRYS5W.mjs.map → state-LXTS54DI.mjs.map} +1 -1
- package/dist/lib/browser/{toolkit-Y5OYX5PO.mjs → toolkit-NQ2GXCF5.mjs} +29 -21
- package/dist/lib/browser/toolkit-NQ2GXCF5.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/{BlueprintContainer-X4MRBKDR.mjs → BlueprintContainer-6HSEVQ7U.mjs} +6 -7
- package/dist/lib/node-esm/{BlueprintContainer-X4MRBKDR.mjs.map → BlueprintContainer-6HSEVQ7U.mjs.map} +3 -3
- package/dist/lib/node-esm/{ChatCompanion-PUAFRIEC.mjs → ChatCompanion-NDYEAUQN.mjs} +38 -14
- package/dist/lib/node-esm/ChatCompanion-NDYEAUQN.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-EZZF7RSQ.mjs → ChatContainer-NMDQM5HG.mjs} +7 -9
- package/dist/lib/node-esm/{ChatContainer-EZZF7RSQ.mjs.map → ChatContainer-NMDQM5HG.mjs.map} +3 -3
- package/dist/lib/node-esm/{ChatDialog-PTQLZNJU.mjs → ChatDialog-QPRWMRU4.mjs} +3 -5
- package/dist/lib/node-esm/{ChatDialog-PTQLZNJU.mjs.map → ChatDialog-QPRWMRU4.mjs.map} +1 -1
- package/dist/lib/node-esm/{SequenceContainer-UXOVZPZO.mjs → SequenceContainer-PGGJUQ46.mjs} +4 -4
- package/dist/lib/node-esm/SequenceContainer-PGGJUQ46.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs +20 -0
- package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-NM3JDLQ2.mjs → app-graph-builder-SJCOS64C.mjs} +41 -11
- package/dist/lib/node-esm/app-graph-builder-SJCOS64C.mjs.map +7 -0
- package/dist/lib/node-esm/{blueprint-definition-4E6XTLVN.mjs → blueprint-definition-WD2IVMAI.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-VFY2JG62.mjs → chunk-73ABYRYX.mjs} +5 -7
- package/dist/lib/node-esm/chunk-73ABYRYX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-LVTG5JTW.mjs → chunk-HDZX6TSZ.mjs} +11 -7
- package/dist/lib/node-esm/chunk-HDZX6TSZ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-4WLFSXZG.mjs → chunk-TMCGJPAN.mjs} +6 -5
- package/dist/lib/node-esm/chunk-TMCGJPAN.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VH3LTD76.mjs → chunk-TW2WKKSR.mjs} +39 -37
- package/dist/lib/node-esm/chunk-TW2WKKSR.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-QG2KT3AT.mjs → chunk-U2NYUS2N.mjs} +28 -14
- package/dist/lib/node-esm/chunk-U2NYUS2N.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-XD4CDA4R.mjs → chunk-XQGWSZ4T.mjs} +2 -5
- package/dist/lib/node-esm/chunk-XQGWSZ4T.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ZIDP7HBI.mjs → chunk-YZYGXFVG.mjs} +309 -481
- package/dist/lib/node-esm/chunk-YZYGXFVG.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7YOGZI66.mjs → chunk-ZQ3THJ2W.mjs} +32 -14
- package/dist/lib/node-esm/chunk-ZQ3THJ2W.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs +19 -0
- package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +72 -48
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-VIINHFMT.mjs → intent-resolver-B7YAS3NT.mjs} +29 -11
- package/dist/lib/node-esm/intent-resolver-B7YAS3NT.mjs.map +7 -0
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs +18 -0
- package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-GP3LU6DX.mjs → react-surface-VRDDARFF.mjs} +13 -15
- package/dist/lib/node-esm/react-surface-VRDDARFF.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-7ZCZ6AS5.mjs → settings-4EBIOJVK.mjs} +5 -5
- package/dist/lib/node-esm/{settings-7ZCZ6AS5.mjs.map → settings-4EBIOJVK.mjs.map} +1 -1
- package/dist/lib/node-esm/{state-EQS5KP6M.mjs → state-BO6GUFLB.mjs} +5 -5
- package/dist/lib/node-esm/{state-EQS5KP6M.mjs.map → state-BO6GUFLB.mjs.map} +1 -1
- package/dist/lib/node-esm/{toolkit-2F2OL6WB.mjs → toolkit-V57PRJNG.mjs} +29 -21
- package/dist/lib/node-esm/toolkit-V57PRJNG.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/AssistantPlugin.d.ts +1 -1
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts +2 -3
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -21
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +0 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
- package/dist/types/src/components/BlueprintSettings.d.ts +6 -0
- package/dist/types/src/components/BlueprintSettings.d.ts.map +1 -0
- package/dist/types/src/components/Chat/Chat.d.ts +2 -1
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/ChatCompanion.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +4 -2
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +7 -3
- 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/SequenceEditor/SequenceEditor.d.ts +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +8 -3
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +4 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +4 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +1 -3
- package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +4 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/functions/analysis.d.ts.map +1 -1
- package/dist/types/src/functions/list.d.ts.map +1 -1
- package/dist/types/src/functions/load.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +0 -2
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +2 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/processor/index.d.ts +1 -0
- package/dist/types/src/processor/index.d.ts.map +1 -1
- package/dist/types/src/processor/presets.d.ts +1 -1
- package/dist/types/src/processor/presets.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +4 -3
- 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/testing/index.d.ts +0 -2
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +1 -1
- package/dist/types/src/testing/test-generator.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts +2 -2
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +16 -7
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantAction.d.ts +19 -4
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +12 -12
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +91 -112
- package/src/AssistantPlugin.tsx +139 -137
- package/src/capabilities/ai-service.ts +6 -7
- package/src/capabilities/app-graph-builder.ts +36 -4
- package/src/capabilities/blueprint-definition.ts +7 -1
- package/src/capabilities/capabilities.ts +0 -53
- package/src/capabilities/edge-model-resolver.ts +5 -7
- package/src/capabilities/index.ts +0 -1
- package/src/capabilities/intent-resolver.ts +26 -3
- package/src/capabilities/local-model-resolver.ts +6 -8
- package/src/capabilities/react-surface.tsx +3 -3
- package/src/capabilities/toolkit.ts +18 -13
- package/src/components/BlueprintContainer.tsx +2 -2
- package/src/components/BlueprintSettings.tsx +15 -0
- package/src/components/Chat/Chat.tsx +41 -34
- package/src/components/ChatCompanion.tsx +33 -8
- package/src/components/ChatContainer.tsx +2 -2
- package/src/components/ChatProgress/ChatProgress.tsx +1 -2
- package/src/components/ChatPrompt/ChatOptions.tsx +17 -25
- package/src/components/ChatThread/ChatThread.stories.tsx +10 -11
- package/src/components/ChatThread/ChatThread.tsx +7 -3
- package/src/components/ChatThread/registry.tsx +6 -11
- package/src/components/ChatThread/sync.test.ts +1 -1
- package/src/components/ChatThread/sync.ts +1 -1
- package/src/components/SequenceContainer.tsx +2 -2
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +5 -4
- package/src/components/SequenceEditor/SequenceEditor.tsx +2 -2
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +5 -5
- package/src/components/TemplateEditor/TemplateEditor.tsx +8 -4
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +3 -5
- package/src/components/TemplateEditor/TemplateForm.tsx +1 -1
- package/src/components/ToolBlock/ToolBlock.tsx +6 -6
- package/src/components/Toolbar/Toolbar.tsx +1 -1
- package/src/components/Toolbar/useChatToolbarActions.ts +1 -1
- package/src/components/Toolbox/Toolbox.stories.tsx +3 -6
- package/src/components/index.ts +1 -1
- package/src/functions/analysis.ts +4 -2
- package/src/functions/list.ts +4 -2
- package/src/functions/load.ts +7 -3
- package/src/hooks/index.ts +0 -2
- package/src/hooks/useBlueprintRegistry.ts +17 -3
- package/src/hooks/useChatProcessor.ts +12 -4
- package/src/hooks/useChatServices.ts +5 -4
- package/src/hooks/useContextBinder.ts +17 -5
- package/src/hooks/useItemTypes.ts +1 -1
- package/src/index.ts +2 -0
- package/src/meta.ts +3 -5
- package/src/processor/index.ts +1 -0
- package/src/processor/presets.ts +1 -1
- package/src/processor/processor.test.ts +17 -13
- package/src/processor/processor.ts +14 -39
- package/src/processor/update-name.ts +57 -0
- package/src/testing/index.ts +0 -2
- package/src/testing/test-generator.ts +5 -1
- package/src/testing/test-services.ts +2 -8
- package/src/translations.ts +1 -0
- package/src/types/Assistant.ts +7 -4
- package/src/types/AssistantAction.ts +10 -2
- package/src/types/service.ts +15 -7
- package/dist/lib/browser/ChatCompanion-YYYCHZYV.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs.map +0 -7
- package/dist/lib/browser/ai-service-YC2EQPHA.mjs +0 -22
- package/dist/lib/browser/ai-service-YC2EQPHA.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-3C43MLCD.mjs.map +0 -7
- package/dist/lib/browser/chunk-EZUSNS2J.mjs.map +0 -7
- package/dist/lib/browser/chunk-GLWD66TA.mjs.map +0 -7
- package/dist/lib/browser/chunk-O4LUJEDV.mjs.map +0 -7
- package/dist/lib/browser/chunk-PL4O4ZJU.mjs.map +0 -7
- package/dist/lib/browser/chunk-PPJAIE2T.mjs.map +0 -7
- package/dist/lib/browser/chunk-PQI3MGDN.mjs.map +0 -7
- package/dist/lib/browser/chunk-R6LRGW3I.mjs.map +0 -7
- package/dist/lib/browser/chunk-SMIVXXAI.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-X6IREJN3.mjs +0 -155
- package/dist/lib/browser/compute-runtime-X6IREJN3.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-JNEB355N.mjs +0 -22
- package/dist/lib/browser/edge-model-resolver-JNEB355N.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-I6M3ZDAS.mjs.map +0 -7
- package/dist/lib/browser/local-model-resolver-EUXSRZ7X.mjs +0 -21
- package/dist/lib/browser/local-model-resolver-EUXSRZ7X.mjs.map +0 -7
- package/dist/lib/browser/react-surface-WNLA2636.mjs.map +0 -7
- package/dist/lib/browser/toolkit-Y5OYX5PO.mjs.map +0 -7
- package/dist/lib/node-esm/ChatCompanion-PUAFRIEC.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-XUMZVFCK.mjs +0 -23
- package/dist/lib/node-esm/ai-service-XUMZVFCK.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-NM3JDLQ2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4WLFSXZG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7YOGZI66.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LVTG5JTW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QG2KT3AT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VFY2JG62.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VH3LTD76.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XD4CDA4R.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZIDP7HBI.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-NRHLLTSC.mjs +0 -156
- package/dist/lib/node-esm/compute-runtime-NRHLLTSC.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-UE5TLLJZ.mjs +0 -23
- package/dist/lib/node-esm/edge-model-resolver-UE5TLLJZ.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-VIINHFMT.mjs.map +0 -7
- package/dist/lib/node-esm/local-model-resolver-JBEFVVZA.mjs +0 -22
- package/dist/lib/node-esm/local-model-resolver-JBEFVVZA.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-GP3LU6DX.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs.map +0 -7
- package/dist/types/src/capabilities/compute-runtime.d.ts +0 -5
- package/dist/types/src/capabilities/compute-runtime.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/execution-graph/execution-graph.d.ts +0 -21
- package/dist/types/src/execution-graph/execution-graph.d.ts.map +0 -1
- package/dist/types/src/execution-graph/index.d.ts +0 -2
- package/dist/types/src/execution-graph/index.d.ts.map +0 -1
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +0 -8
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +0 -1
- package/dist/types/src/hooks/useExecutionGraph.d.ts +0 -6
- package/dist/types/src/hooks/useExecutionGraph.d.ts.map +0 -1
- package/dist/types/src/stories/Chat.stories.d.ts +0 -30
- package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/stories/components/BlueprintContainer.d.ts +0 -4
- package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/ChatContainer.d.ts +0 -4
- package/dist/types/src/stories/components/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/ChessContainer.d.ts +0 -4
- package/dist/types/src/stories/components/ChessContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/CommentsContainer.d.ts +0 -4
- package/dist/types/src/stories/components/CommentsContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/DebugCard.d.ts +0 -8
- package/dist/types/src/stories/components/DebugCard.d.ts.map +0 -1
- package/dist/types/src/stories/components/GraphContainer.d.ts +0 -6
- package/dist/types/src/stories/components/GraphContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/InvocationsContainer.d.ts +0 -4
- package/dist/types/src/stories/components/InvocationsContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/LoggingContainer.d.ts +0 -7
- package/dist/types/src/stories/components/LoggingContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/MessageContainer.d.ts +0 -4
- package/dist/types/src/stories/components/MessageContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/PromptContainer.d.ts +0 -6
- package/dist/types/src/stories/components/PromptContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/ResearchInputStack.d.ts +0 -4
- package/dist/types/src/stories/components/ResearchInputStack.d.ts.map +0 -1
- package/dist/types/src/stories/components/ResearchOutputStack.d.ts +0 -4
- package/dist/types/src/stories/components/ResearchOutputStack.d.ts.map +0 -1
- package/dist/types/src/stories/components/TasksContainer.d.ts +0 -4
- package/dist/types/src/stories/components/TasksContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/TokenManagerContainer.d.ts +0 -3
- package/dist/types/src/stories/components/TokenManagerContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/TriggersContainer.d.ts +0 -14
- package/dist/types/src/stories/components/TriggersContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/index.d.ts +0 -16
- package/dist/types/src/stories/components/index.d.ts.map +0 -1
- package/dist/types/src/stories/components/types.d.ts +0 -7
- package/dist/types/src/stories/components/types.d.ts.map +0 -1
- package/dist/types/src/stories/testing/data.d.ts +0 -9
- package/dist/types/src/stories/testing/data.d.ts.map +0 -1
- package/dist/types/src/stories/testing/index.d.ts +0 -3
- package/dist/types/src/stories/testing/index.d.ts.map +0 -1
- package/dist/types/src/stories/testing/schema.d.ts +0 -7
- package/dist/types/src/stories/testing/schema.d.ts.map +0 -1
- package/dist/types/src/stories/testing/testing.d.ts +0 -48
- package/dist/types/src/stories/testing/testing.d.ts.map +0 -1
- package/dist/types/src/testing/test-data.d.ts +0 -14
- package/dist/types/src/testing/test-data.d.ts.map +0 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -6
- package/dist/types/src/testing/test-functions.d.ts.map +0 -1
- package/src/capabilities/compute-runtime.ts +0 -124
- package/src/components/PromptSettings.tsx +0 -90
- package/src/execution-graph/execution-graph.ts +0 -211
- package/src/execution-graph/index.ts +0 -5
- package/src/hooks/useComputeRuntimeCallback.ts +0 -25
- package/src/hooks/useExecutionGraph.ts +0 -20
- package/src/stories/Chat.stories.tsx +0 -657
- package/src/stories/components/BlueprintContainer.tsx +0 -34
- package/src/stories/components/ChatContainer.tsx +0 -74
- package/src/stories/components/ChessContainer.tsx +0 -17
- package/src/stories/components/CommentsContainer.tsx +0 -25
- package/src/stories/components/DebugCard.tsx +0 -61
- package/src/stories/components/GraphContainer.tsx +0 -119
- package/src/stories/components/InvocationsContainer.tsx +0 -17
- package/src/stories/components/LoggingContainer.tsx +0 -33
- package/src/stories/components/MessageContainer.tsx +0 -22
- package/src/stories/components/PromptContainer.tsx +0 -52
- package/src/stories/components/ResearchInputStack.tsx +0 -30
- package/src/stories/components/ResearchOutputStack.tsx +0 -29
- package/src/stories/components/TasksContainer.tsx +0 -49
- package/src/stories/components/TokenManagerContainer.tsx +0 -14
- package/src/stories/components/TriggersContainer.tsx +0 -75
- package/src/stories/components/index.ts +0 -20
- package/src/stories/components/types.ts +0 -11
- package/src/stories/testing/data.ts +0 -142
- package/src/stories/testing/index.ts +0 -6
- package/src/stories/testing/schema.ts +0 -17
- package/src/stories/testing/testing.tsx +0 -279
- package/src/testing/test-data.ts +0 -245
- package/src/testing/test-functions.ts +0 -16
- /package/dist/lib/browser/{blueprint-definition-VHFSRTEJ.mjs.map → blueprint-definition-NSJARW5U.mjs.map} +0 -0
- /package/dist/lib/node-esm/{blueprint-definition-4E6XTLVN.mjs.map → blueprint-definition-WD2IVMAI.mjs.map} +0 -0
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
AssistantCapabilities
|
|
4
|
-
} from "./chunk-XD4CDA4R.mjs";
|
|
5
2
|
import {
|
|
6
3
|
meta
|
|
7
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-73ABYRYX.mjs";
|
|
8
5
|
|
|
9
6
|
// src/hooks/useBlueprintRegistry.ts
|
|
10
7
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
@@ -13,16 +10,31 @@ import { useCallback, useMemo, useState } from "react";
|
|
|
13
10
|
import { Capabilities, useCapabilities } from "@dxos/app-framework";
|
|
14
11
|
import { Blueprint } from "@dxos/blueprints";
|
|
15
12
|
import { Filter, Obj, Ref } from "@dxos/echo";
|
|
16
|
-
import {
|
|
13
|
+
import { useQuery } from "@dxos/react-client/echo";
|
|
14
|
+
import { distinctBy, isNonNullable } from "@dxos/util";
|
|
17
15
|
var useBlueprintRegistry = () => {
|
|
18
16
|
const blueprints = useCapabilities(Capabilities.BlueprintDefinition);
|
|
19
17
|
return useMemo(() => new Blueprint.Registry(blueprints), [
|
|
20
18
|
blueprints
|
|
21
19
|
]);
|
|
22
20
|
};
|
|
23
|
-
var useBlueprints = ({ blueprintRegistry }) =>
|
|
24
|
-
blueprintRegistry
|
|
25
|
-
|
|
21
|
+
var useBlueprints = ({ blueprintRegistry, space }) => {
|
|
22
|
+
const staticBlueprints = useMemo(() => blueprintRegistry?.query() ?? [], [
|
|
23
|
+
blueprintRegistry
|
|
24
|
+
]);
|
|
25
|
+
const spaceBlueprints = useQuery(space, Filter.type(Blueprint.Blueprint));
|
|
26
|
+
return useMemo(() => {
|
|
27
|
+
const blueprints = distinctBy([
|
|
28
|
+
...staticBlueprints,
|
|
29
|
+
...spaceBlueprints
|
|
30
|
+
], (b) => b.key);
|
|
31
|
+
blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
|
|
32
|
+
return blueprints;
|
|
33
|
+
}, [
|
|
34
|
+
staticBlueprints,
|
|
35
|
+
spaceBlueprints
|
|
36
|
+
]);
|
|
37
|
+
};
|
|
26
38
|
var useActiveBlueprints = ({ context }) => {
|
|
27
39
|
var _effect = _useSignals();
|
|
28
40
|
try {
|
|
@@ -81,12 +93,13 @@ var useBlueprintHandlers = ({ space, context, blueprintRegistry }) => {
|
|
|
81
93
|
|
|
82
94
|
// src/hooks/useChatProcessor.ts
|
|
83
95
|
import { RegistryContext } from "@effect-rx/rx-react";
|
|
84
|
-
import { useContext, useMemo as useMemo2 } from "react";
|
|
96
|
+
import { useContext, useMemo as useMemo2, useState as useState2 } from "react";
|
|
85
97
|
import { AiConversation } from "@dxos/assistant";
|
|
86
98
|
import { log as log2 } from "@dxos/log";
|
|
99
|
+
import { useAsyncEffect } from "@dxos/react-ui";
|
|
87
100
|
|
|
88
101
|
// src/processor/presets.ts
|
|
89
|
-
import
|
|
102
|
+
import * as Schema from "effect/Schema";
|
|
90
103
|
var ModelProviders = [
|
|
91
104
|
"dxos-local",
|
|
92
105
|
"dxos-remote",
|
|
@@ -131,14 +144,56 @@ var AiServicePresets = [
|
|
|
131
144
|
|
|
132
145
|
// src/processor/processor.ts
|
|
133
146
|
import { Registry, Rx } from "@effect-rx/rx-react";
|
|
134
|
-
import
|
|
135
|
-
import
|
|
136
|
-
import
|
|
147
|
+
import * as Cause from "effect/Cause";
|
|
148
|
+
import * as Effect2 from "effect/Effect";
|
|
149
|
+
import * as Exit2 from "effect/Exit";
|
|
150
|
+
import * as Fiber2 from "effect/Fiber";
|
|
151
|
+
import * as Option from "effect/Option";
|
|
152
|
+
import * as Runtime2 from "effect/Runtime";
|
|
153
|
+
import { AiService as AiService2, DEFAULT_EDGE_MODEL as DEFAULT_EDGE_MODEL2 } from "@dxos/ai";
|
|
154
|
+
import { ArtifactDiffResolver, GenerationObserver, createSystemPrompt } from "@dxos/assistant";
|
|
137
155
|
import { Obj as Obj2 } from "@dxos/echo";
|
|
138
|
-
import { throwCause } from "@dxos/effect";
|
|
156
|
+
import { throwCause as throwCause2 } from "@dxos/effect";
|
|
139
157
|
import { log } from "@dxos/log";
|
|
140
158
|
import { DataType } from "@dxos/schema";
|
|
159
|
+
|
|
160
|
+
// src/processor/update-name.ts
|
|
161
|
+
import * as Effect from "effect/Effect";
|
|
162
|
+
import * as Exit from "effect/Exit";
|
|
163
|
+
import * as Fiber from "effect/Fiber";
|
|
164
|
+
import * as Runtime from "effect/Runtime";
|
|
165
|
+
import { AiService, DEFAULT_EDGE_MODEL } from "@dxos/ai";
|
|
166
|
+
import { AiSession } from "@dxos/assistant";
|
|
167
|
+
import { throwCause } from "@dxos/effect";
|
|
141
168
|
import { trim } from "@dxos/util";
|
|
169
|
+
var updateName = async (runtime2, conversation, chat, model = DEFAULT_EDGE_MODEL) => {
|
|
170
|
+
const history = await conversation.getHistory();
|
|
171
|
+
const system = trim`
|
|
172
|
+
It is extremely important that you respond only with the title and nothing else.
|
|
173
|
+
If you cannot do this effectively respond with "New Chat".
|
|
174
|
+
`;
|
|
175
|
+
const prompt = "Suggest a name for this chat";
|
|
176
|
+
const fiber = Effect.gen(void 0, function* () {
|
|
177
|
+
const session = new AiSession();
|
|
178
|
+
return yield* session.run({
|
|
179
|
+
system,
|
|
180
|
+
prompt,
|
|
181
|
+
history
|
|
182
|
+
});
|
|
183
|
+
}).pipe(Effect.provide(AiService.model(model)), Effect.tap((messages) => {
|
|
184
|
+
const message = messages.find((message2) => message2.sender.role === "assistant");
|
|
185
|
+
const title = message?.blocks.find((block) => block._tag === "text")?.text;
|
|
186
|
+
if (title) {
|
|
187
|
+
chat.name = title;
|
|
188
|
+
}
|
|
189
|
+
}), Runtime.runFork(runtime2));
|
|
190
|
+
const response = await fiber.pipe(Fiber.join, Effect.runPromiseExit);
|
|
191
|
+
if (!Exit.isSuccess(response)) {
|
|
192
|
+
throwCause(response.cause);
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
// src/processor/processor.ts
|
|
142
197
|
function _define_property(obj, key, value) {
|
|
143
198
|
if (key in obj) {
|
|
144
199
|
Object.defineProperty(obj, key, {
|
|
@@ -154,7 +209,7 @@ function _define_property(obj, key, value) {
|
|
|
154
209
|
}
|
|
155
210
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/processor/processor.ts";
|
|
156
211
|
var defaultOptions = {
|
|
157
|
-
model:
|
|
212
|
+
model: DEFAULT_EDGE_MODEL2
|
|
158
213
|
};
|
|
159
214
|
var AiChatProcessor = class {
|
|
160
215
|
get context() {
|
|
@@ -182,43 +237,32 @@ var AiChatProcessor = class {
|
|
|
182
237
|
prompt: requestParam.message,
|
|
183
238
|
observer: this._observer
|
|
184
239
|
});
|
|
185
|
-
const
|
|
240
|
+
const runtime2 = await this._services();
|
|
186
241
|
this._fiber = request.pipe(
|
|
187
|
-
|
|
242
|
+
Effect2.provide(AiService2.model(this._options.model ?? DEFAULT_EDGE_MODEL2)),
|
|
188
243
|
// TODO(dmaretskyi): Move ArtifactDiffResolver upstream.
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
log.error("request failed", {
|
|
193
|
-
cause
|
|
194
|
-
}, {
|
|
195
|
-
F: __dxlog_file,
|
|
196
|
-
L: 170,
|
|
197
|
-
S: this,
|
|
198
|
-
C: (f, a) => f(...a)
|
|
199
|
-
});
|
|
200
|
-
return Effect.void;
|
|
201
|
-
}),
|
|
202
|
-
Runtime.runFork(runtime)
|
|
244
|
+
Effect2.provideService(ArtifactDiffResolver, this._artifactDiffResolver),
|
|
245
|
+
Effect2.asVoid,
|
|
246
|
+
Runtime2.runFork(runtime2)
|
|
203
247
|
);
|
|
204
|
-
const response = await this._fiber.pipe(
|
|
205
|
-
if (!
|
|
206
|
-
|
|
248
|
+
const response = await this._fiber.pipe(Fiber2.join, Effect2.runPromiseExit);
|
|
249
|
+
if (!Exit2.isSuccess(response) && !Cause.isInterruptedOnly(response.cause)) {
|
|
250
|
+
throwCause2(response.cause);
|
|
207
251
|
}
|
|
208
252
|
this._rx.set(this.error, Option.none());
|
|
209
253
|
this._lastRequest = void 0;
|
|
210
254
|
this._fiber = void 0;
|
|
211
|
-
} catch (
|
|
255
|
+
} catch (error) {
|
|
212
256
|
log.error("request failed", {
|
|
213
|
-
|
|
257
|
+
error
|
|
214
258
|
}, {
|
|
215
259
|
F: __dxlog_file,
|
|
216
|
-
L:
|
|
260
|
+
L: 187,
|
|
217
261
|
S: this,
|
|
218
262
|
C: (f, a) => f(...a)
|
|
219
263
|
});
|
|
220
264
|
this._rx.set(this.error, Option.some(new Error("AI service error", {
|
|
221
|
-
cause:
|
|
265
|
+
cause: error
|
|
222
266
|
})));
|
|
223
267
|
} finally {
|
|
224
268
|
this._fiber = void 0;
|
|
@@ -229,9 +273,9 @@ var AiChatProcessor = class {
|
|
|
229
273
|
* Cancels the current request.
|
|
230
274
|
*/
|
|
231
275
|
async cancel() {
|
|
232
|
-
await
|
|
276
|
+
await Effect2.runPromise(Effect2.gen(this, function* () {
|
|
233
277
|
if (this._fiber) {
|
|
234
|
-
yield* this._fiber.pipe(
|
|
278
|
+
yield* this._fiber.pipe(Fiber2.interrupt);
|
|
235
279
|
}
|
|
236
280
|
}));
|
|
237
281
|
this._fiber = void 0;
|
|
@@ -249,35 +293,8 @@ var AiChatProcessor = class {
|
|
|
249
293
|
* Update the current chat's name.
|
|
250
294
|
*/
|
|
251
295
|
async updateName(chat) {
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
It is extremely important that you respond only with the title and nothing else.
|
|
255
|
-
If you cannot do this effectively respond with "New Chat".
|
|
256
|
-
`;
|
|
257
|
-
const history = await this._conversation.getHistory();
|
|
258
|
-
const fiber = Effect.gen(this, function* () {
|
|
259
|
-
const session = new AiSession();
|
|
260
|
-
return yield* session.run({
|
|
261
|
-
system,
|
|
262
|
-
prompt: "Suggest a name for this chat",
|
|
263
|
-
history
|
|
264
|
-
});
|
|
265
|
-
}).pipe(
|
|
266
|
-
// TODO(burdon): Use simpler model.
|
|
267
|
-
Effect.provide(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL)),
|
|
268
|
-
Effect.tap((messages) => {
|
|
269
|
-
const message = messages.find((message2) => message2.sender.role === "assistant");
|
|
270
|
-
const title = message?.blocks.find((b) => b._tag === "text")?.text;
|
|
271
|
-
if (title) {
|
|
272
|
-
chat.name = title;
|
|
273
|
-
}
|
|
274
|
-
}),
|
|
275
|
-
Runtime.runFork(runtime)
|
|
276
|
-
);
|
|
277
|
-
const response = await fiber.pipe(Fiber.join, Effect.runPromiseExit);
|
|
278
|
-
if (!Exit.isSuccess(response)) {
|
|
279
|
-
throwCause(response.cause);
|
|
280
|
-
}
|
|
296
|
+
const runtime2 = await this._services();
|
|
297
|
+
await updateName(runtime2, this._conversation, chat, this._options.model);
|
|
281
298
|
}
|
|
282
299
|
constructor(_conversation, _services, _options = defaultOptions) {
|
|
283
300
|
_define_property(this, "_conversation", void 0);
|
|
@@ -317,14 +334,14 @@ var AiChatProcessor = class {
|
|
|
317
334
|
return versions;
|
|
318
335
|
}
|
|
319
336
|
};
|
|
320
|
-
this._onMessage =
|
|
337
|
+
this._onMessage = Effect2.fn((function* (message) {
|
|
321
338
|
this._rx.set(this._streaming, Option.none());
|
|
322
339
|
this._rx.update(this._pending, (pending) => [
|
|
323
340
|
...pending,
|
|
324
341
|
message
|
|
325
342
|
]);
|
|
326
|
-
}.bind(this));
|
|
327
|
-
this._onBlock =
|
|
343
|
+
}).bind(this));
|
|
344
|
+
this._onBlock = Effect2.fn((function* (block) {
|
|
328
345
|
this._rx.update(this._streaming, (streaming) => {
|
|
329
346
|
const blocks = streaming.pipe(Option.map((streaming2) => streaming2.blocks.filter((b) => !b.pending)), Option.getOrElse(() => []));
|
|
330
347
|
return Option.some(Obj2.make(DataType.Message, {
|
|
@@ -338,7 +355,7 @@ var AiChatProcessor = class {
|
|
|
338
355
|
]
|
|
339
356
|
}));
|
|
340
357
|
});
|
|
341
|
-
}.bind(this));
|
|
358
|
+
}).bind(this));
|
|
342
359
|
this._rx = this._options.observableRegistry ?? Registry.make();
|
|
343
360
|
this._observer = GenerationObserver.make({
|
|
344
361
|
onBlock: this._onBlock,
|
|
@@ -355,13 +372,17 @@ var AiChatProcessor = class {
|
|
|
355
372
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/hooks/useChatProcessor.ts";
|
|
356
373
|
var useChatProcessor = ({ chat, preset, services, blueprintRegistry, settings }) => {
|
|
357
374
|
const observableRegistry = useContext(RegistryContext);
|
|
358
|
-
const conversation =
|
|
375
|
+
const [conversation, setConversation] = useState2();
|
|
376
|
+
useAsyncEffect(async () => {
|
|
359
377
|
if (!chat?.queue.target) {
|
|
360
378
|
return;
|
|
361
379
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
380
|
+
const conversation2 = new AiConversation(chat.queue.target);
|
|
381
|
+
await conversation2.open();
|
|
382
|
+
setConversation(conversation2);
|
|
383
|
+
return () => {
|
|
384
|
+
void conversation2.close();
|
|
385
|
+
};
|
|
365
386
|
}, [
|
|
366
387
|
chat?.queue.target
|
|
367
388
|
]);
|
|
@@ -375,7 +396,7 @@ var useChatProcessor = ({ chat, preset, services, blueprintRegistry, settings })
|
|
|
375
396
|
settings
|
|
376
397
|
}, {
|
|
377
398
|
F: __dxlog_file2,
|
|
378
|
-
L:
|
|
399
|
+
L: 60,
|
|
379
400
|
S: void 0,
|
|
380
401
|
C: (f, a) => f(...a)
|
|
381
402
|
});
|
|
@@ -394,35 +415,20 @@ var useChatProcessor = ({ chat, preset, services, blueprintRegistry, settings })
|
|
|
394
415
|
};
|
|
395
416
|
|
|
396
417
|
// src/hooks/useChatServices.ts
|
|
397
|
-
import
|
|
418
|
+
import * as Effect3 from "effect/Effect";
|
|
398
419
|
import { useMemo as useMemo3 } from "react";
|
|
399
420
|
import { useCapability } from "@dxos/app-framework";
|
|
400
421
|
import { TracingService } from "@dxos/functions";
|
|
422
|
+
import { AutomationCapabilities } from "@dxos/plugin-automation";
|
|
401
423
|
import { useClient } from "@dxos/react-client";
|
|
402
|
-
|
|
403
|
-
// src/capabilities/index.ts
|
|
404
|
-
import { lazy } from "@dxos/app-framework";
|
|
405
|
-
var AiService2 = lazy(() => import("./ai-service-XUMZVFCK.mjs"));
|
|
406
|
-
var AppGraphBuilder = lazy(() => import("./app-graph-builder-NM3JDLQ2.mjs"));
|
|
407
|
-
var AssistantState = lazy(() => import("./state-EQS5KP6M.mjs"));
|
|
408
|
-
var BlueprintDefinition = lazy(() => import("./blueprint-definition-4E6XTLVN.mjs"));
|
|
409
|
-
var EdgeModelResolver = lazy(() => import("./edge-model-resolver-UE5TLLJZ.mjs"));
|
|
410
|
-
var IntentResolver = lazy(() => import("./intent-resolver-VIINHFMT.mjs"));
|
|
411
|
-
var LocalModelResolver = lazy(() => import("./local-model-resolver-JBEFVVZA.mjs"));
|
|
412
|
-
var ReactSurface = lazy(() => import("./react-surface-GP3LU6DX.mjs"));
|
|
413
|
-
var Settings = lazy(() => import("./settings-7ZCZ6AS5.mjs"));
|
|
414
|
-
var Toolkit = lazy(() => import("./toolkit-2F2OL6WB.mjs"));
|
|
415
|
-
var ComputeRuntime = lazy(() => import("./compute-runtime-NRHLLTSC.mjs"));
|
|
416
|
-
|
|
417
|
-
// src/hooks/useChatServices.ts
|
|
418
424
|
var useChatServices = ({ space, chat }) => {
|
|
419
425
|
const client = useClient();
|
|
420
426
|
space ?? (space = client.spaces.default);
|
|
421
|
-
const computeRuntimeResolver = useCapability(
|
|
427
|
+
const computeRuntimeResolver = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
422
428
|
return useMemo3(() => {
|
|
423
|
-
const
|
|
424
|
-
return () =>
|
|
425
|
-
return yield*
|
|
429
|
+
const runtime2 = computeRuntimeResolver.getRuntime(space.id);
|
|
430
|
+
return () => runtime2.runPromise(Effect3.gen(function* () {
|
|
431
|
+
return yield* Effect3.runtime().pipe(Effect3.provide(chat?.traceQueue?.target ? TracingService.layerQueue(chat.traceQueue?.target) : TracingService.layerNoop));
|
|
426
432
|
}));
|
|
427
433
|
}, [
|
|
428
434
|
space,
|
|
@@ -431,64 +437,30 @@ var useChatServices = ({ space, chat }) => {
|
|
|
431
437
|
};
|
|
432
438
|
|
|
433
439
|
// src/hooks/useContextBinder.ts
|
|
434
|
-
import {
|
|
440
|
+
import { useState as useState3 } from "react";
|
|
435
441
|
import { AiContextBinder } from "@dxos/assistant";
|
|
442
|
+
import { useAsyncEffect as useAsyncEffect2 } from "@dxos/react-ui";
|
|
436
443
|
var useContextBinder = (chat) => {
|
|
437
|
-
const binder =
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
chat
|
|
442
|
-
]);
|
|
443
|
-
return binder;
|
|
444
|
-
};
|
|
445
|
-
|
|
446
|
-
// src/hooks/useOnline.ts
|
|
447
|
-
import { useState as useState2 } from "react";
|
|
448
|
-
var useOnline = () => {
|
|
449
|
-
const [online, setOnline] = useState2(true);
|
|
450
|
-
return [
|
|
451
|
-
online,
|
|
452
|
-
setOnline
|
|
453
|
-
];
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
// src/hooks/usePresets.ts
|
|
457
|
-
import { useCallback as useCallback2, useEffect, useMemo as useMemo5, useState as useState3 } from "react";
|
|
458
|
-
var usePresets = (online) => {
|
|
459
|
-
const [preset, setPreset] = useState3();
|
|
460
|
-
const presets = useMemo5(() => AiServicePresets.filter((preset2) => online === (preset2.provider === "dxos-remote")), [
|
|
461
|
-
online
|
|
462
|
-
]);
|
|
463
|
-
const presetOptions = useMemo5(() => presets.map(({ id, model, label }) => ({
|
|
464
|
-
id,
|
|
465
|
-
label: label ?? model
|
|
466
|
-
})), [
|
|
467
|
-
presets
|
|
468
|
-
]);
|
|
469
|
-
useEffect(() => {
|
|
470
|
-
setPreset(presets[0]);
|
|
471
|
-
}, [
|
|
472
|
-
presets
|
|
473
|
-
]);
|
|
474
|
-
const handlePresetChange = useCallback2((id) => {
|
|
475
|
-
const preset2 = presets.find((preset3) => preset3.id === id);
|
|
476
|
-
if (preset2) {
|
|
477
|
-
setPreset(preset2);
|
|
444
|
+
const [binder, setBinder] = useState3();
|
|
445
|
+
useAsyncEffect2(async () => {
|
|
446
|
+
if (!chat?.queue.target) {
|
|
447
|
+
return;
|
|
478
448
|
}
|
|
449
|
+
const binder2 = new AiContextBinder(chat.queue.target);
|
|
450
|
+
await binder2.open();
|
|
451
|
+
setBinder(binder2);
|
|
452
|
+
return () => {
|
|
453
|
+
void binder2.close();
|
|
454
|
+
};
|
|
479
455
|
}, [
|
|
480
|
-
|
|
456
|
+
chat?.queue.target
|
|
481
457
|
]);
|
|
482
|
-
return
|
|
483
|
-
preset,
|
|
484
|
-
presets: presetOptions,
|
|
485
|
-
onPresetChange: handlePresetChange
|
|
486
|
-
};
|
|
458
|
+
return binder;
|
|
487
459
|
};
|
|
488
460
|
|
|
489
461
|
// src/hooks/useContextObjects.ts
|
|
490
462
|
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
491
|
-
import { useCallback as
|
|
463
|
+
import { useCallback as useCallback2 } from "react";
|
|
492
464
|
import { Ref as Ref2 } from "@dxos/echo";
|
|
493
465
|
import { log as log3 } from "@dxos/log";
|
|
494
466
|
import { isNonNullable as isNonNullable2 } from "@dxos/util";
|
|
@@ -497,7 +469,7 @@ var useContextObjects = ({ space, context }) => {
|
|
|
497
469
|
var _effect = _useSignals2();
|
|
498
470
|
try {
|
|
499
471
|
const objects = context?.objects.value.map((ref) => ref.target).filter(isNonNullable2) ?? [];
|
|
500
|
-
const handleUpdateObject =
|
|
472
|
+
const handleUpdateObject = useCallback2(async (dxn, checked) => {
|
|
501
473
|
if (!space || !context) {
|
|
502
474
|
return;
|
|
503
475
|
}
|
|
@@ -542,218 +514,43 @@ var useContextObjects = ({ space, context }) => {
|
|
|
542
514
|
}
|
|
543
515
|
};
|
|
544
516
|
|
|
545
|
-
// src/hooks/
|
|
546
|
-
import {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
import { MESSAGE_PROPERTY_TOOL_CALL_ID } from "@dxos/functions";
|
|
554
|
-
import { LogLevel } from "@dxos/log";
|
|
555
|
-
import { ContentBlock, DataType as DataType2 } from "@dxos/schema";
|
|
556
|
-
import { isNotFalsy } from "@dxos/util";
|
|
557
|
-
function _define_property2(obj, key, value) {
|
|
558
|
-
if (key in obj) {
|
|
559
|
-
Object.defineProperty(obj, key, {
|
|
560
|
-
value,
|
|
561
|
-
enumerable: true,
|
|
562
|
-
configurable: true,
|
|
563
|
-
writable: true
|
|
564
|
-
});
|
|
565
|
-
} else {
|
|
566
|
-
obj[key] = value;
|
|
567
|
-
}
|
|
568
|
-
return obj;
|
|
569
|
-
}
|
|
570
|
-
var ExecutionGraph = class {
|
|
571
|
-
/**
|
|
572
|
-
* Adds events to the graph.
|
|
573
|
-
*/
|
|
574
|
-
addEvents(events) {
|
|
575
|
-
for (const event of events) {
|
|
576
|
-
if (Obj3.instanceOf(DataType2.Message, event)) {
|
|
577
|
-
const messageCommits = messageToCommit(event);
|
|
578
|
-
this._commits.push(...messageCommits);
|
|
579
|
-
messageCommits.map((c) => c.branch).forEach((branch) => this._branchNames.add(branch));
|
|
580
|
-
} else if (Obj3.instanceOf(AgentStatus, event)) {
|
|
581
|
-
const branch = getBranchName({
|
|
582
|
-
parentMessage: event.parentMessage,
|
|
583
|
-
toolCallId: event.toolCallId
|
|
584
|
-
});
|
|
585
|
-
this._branchNames.add(branch);
|
|
586
|
-
this._commits.push({
|
|
587
|
-
id: event.id,
|
|
588
|
-
branch,
|
|
589
|
-
message: event.message,
|
|
590
|
-
icon: "ph--flag--regular",
|
|
591
|
-
parents: event.parentMessage && event.toolCallId ? [
|
|
592
|
-
getToolCallId(event.parentMessage, event.toolCallId)
|
|
593
|
-
] : void 0
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
/**
|
|
599
|
-
* Returns the current state of the graph.
|
|
600
|
-
*/
|
|
601
|
-
getGraph(lastRequest = false) {
|
|
602
|
-
const idx = lastRequest ? this._commits.findLastIndex((c) => c.tags?.includes("user")) : -1;
|
|
603
|
-
const commits = idx === -1 ? this._commits : this._commits.slice(idx);
|
|
604
|
-
return {
|
|
605
|
-
branches: Array.from(this._branchNames),
|
|
606
|
-
commits
|
|
607
|
-
};
|
|
608
|
-
}
|
|
609
|
-
constructor() {
|
|
610
|
-
_define_property2(this, "_commits", []);
|
|
611
|
-
_define_property2(this, "_branchNames", /* @__PURE__ */ new Set());
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
|
-
var messageToCommit = (message) => {
|
|
615
|
-
return message.blocks.map((block, idx) => {
|
|
616
|
-
const branch = getMessageBranch(message);
|
|
617
|
-
const parent = getParentId(message);
|
|
618
|
-
const parents = parent ? [
|
|
619
|
-
parent
|
|
620
|
-
] : [];
|
|
621
|
-
switch (block._tag) {
|
|
622
|
-
case "text":
|
|
623
|
-
if (!block.text.trim().length) {
|
|
624
|
-
return null;
|
|
625
|
-
}
|
|
626
|
-
return {
|
|
627
|
-
id: getGenericBlockId(message.id, idx),
|
|
628
|
-
branch,
|
|
629
|
-
parents,
|
|
630
|
-
...message.sender.role === "user" ? {
|
|
631
|
-
icon: "ph--user--regular",
|
|
632
|
-
tags: [
|
|
633
|
-
"user"
|
|
634
|
-
],
|
|
635
|
-
message: "Processing request..."
|
|
636
|
-
} : {
|
|
637
|
-
icon: "ph--robot--regular",
|
|
638
|
-
message: `Response (${block.text.split(" ").length} words)`
|
|
639
|
-
}
|
|
640
|
-
};
|
|
641
|
-
case "toolCall":
|
|
642
|
-
return {
|
|
643
|
-
id: getToolCallId(message.id, block.toolCallId),
|
|
644
|
-
branch,
|
|
645
|
-
parents,
|
|
646
|
-
icon: "ph--wrench--regular",
|
|
647
|
-
level: LogLevel.INFO,
|
|
648
|
-
// TODO(burdon): Lookup tool name/description?
|
|
649
|
-
message: `Calling tool (${block.name})`
|
|
650
|
-
};
|
|
651
|
-
case "toolResult":
|
|
652
|
-
return {
|
|
653
|
-
id: getToolResultId(message.id, block.toolCallId),
|
|
654
|
-
branch,
|
|
655
|
-
parents,
|
|
656
|
-
icon: block.error ? "ph--x-circle--regular" : "ph--check-circle--regular",
|
|
657
|
-
level: block.error ? LogLevel.ERROR : LogLevel.INFO,
|
|
658
|
-
message: block.error ? "Tool error: " + block.error : "Tool call succeeded"
|
|
659
|
-
};
|
|
660
|
-
case "summary":
|
|
661
|
-
return {
|
|
662
|
-
id: getGenericBlockId(message.id, idx),
|
|
663
|
-
branch,
|
|
664
|
-
parents,
|
|
665
|
-
icon: "ph--rocket--regular",
|
|
666
|
-
level: LogLevel.INFO,
|
|
667
|
-
message: ContentBlock.createSummaryMessage(block)
|
|
668
|
-
};
|
|
669
|
-
case "status":
|
|
670
|
-
return {
|
|
671
|
-
id: getGenericBlockId(message.id, idx),
|
|
672
|
-
branch,
|
|
673
|
-
parents,
|
|
674
|
-
message: block.statusText,
|
|
675
|
-
level: LogLevel.INFO,
|
|
676
|
-
icon: "ph--flag--regular"
|
|
677
|
-
};
|
|
678
|
-
case "reasoning":
|
|
679
|
-
return {
|
|
680
|
-
id: getGenericBlockId(message.id, idx),
|
|
681
|
-
branch,
|
|
682
|
-
parents,
|
|
683
|
-
message: block.reasoningText ?? "Thinking...",
|
|
684
|
-
icon: "ph--brain--regular"
|
|
685
|
-
};
|
|
686
|
-
case "reference":
|
|
687
|
-
return {
|
|
688
|
-
id: getGenericBlockId(message.id, idx),
|
|
689
|
-
branch,
|
|
690
|
-
parents,
|
|
691
|
-
icon: "ph--link--regular",
|
|
692
|
-
message: stringifyRef(block.reference)
|
|
693
|
-
};
|
|
694
|
-
default:
|
|
695
|
-
return null;
|
|
517
|
+
// src/hooks/useFlush.ts
|
|
518
|
+
import { useCallback as useCallback3, useRef, useState as useState4 } from "react";
|
|
519
|
+
var useFlush = (space) => {
|
|
520
|
+
const [state, setState] = useState4("idle");
|
|
521
|
+
const resetTimer = useRef(null);
|
|
522
|
+
const handleFlush = useCallback3(() => {
|
|
523
|
+
if (!space) {
|
|
524
|
+
return;
|
|
696
525
|
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
}
|
|
710
|
-
};
|
|
711
|
-
var getMessageBranch = (message) => {
|
|
712
|
-
return getBranchName({
|
|
713
|
-
parentMessage: message.parentMessage,
|
|
714
|
-
toolCallId: message.properties?.[MESSAGE_PROPERTY_TOOL_CALL_ID]
|
|
715
|
-
});
|
|
716
|
-
};
|
|
717
|
-
var getParentId = (message) => {
|
|
718
|
-
if (message.parentMessage && message.properties?.[MESSAGE_PROPERTY_TOOL_CALL_ID]) {
|
|
719
|
-
return getToolCallId(message.parentMessage, message.properties[MESSAGE_PROPERTY_TOOL_CALL_ID]);
|
|
720
|
-
} else {
|
|
721
|
-
return void 0;
|
|
722
|
-
}
|
|
723
|
-
};
|
|
724
|
-
var stringifyRef = (ref) => {
|
|
725
|
-
if (ref.target) {
|
|
726
|
-
return stringifyObject(ref.target);
|
|
727
|
-
}
|
|
728
|
-
return ref.dxn.asEchoDXN()?.echoId ?? ref.dxn.asQueueDXN()?.objectId ?? "";
|
|
729
|
-
};
|
|
730
|
-
var stringifyObject = (obj) => {
|
|
731
|
-
return Obj3.getLabel(obj) ?? Obj3.getTypename(obj) ?? obj.id;
|
|
732
|
-
};
|
|
733
|
-
|
|
734
|
-
// src/hooks/useExecutionGraph.ts
|
|
735
|
-
var useExecutionGraph = (queueRef, lastRequest = false) => {
|
|
736
|
-
const queue = useQueue(queueRef?.dxn);
|
|
737
|
-
return useMemo6(() => {
|
|
738
|
-
const graph = new ExecutionGraph();
|
|
739
|
-
graph.addEvents(queue?.objects.filter(Obj4.isObject) ?? []);
|
|
740
|
-
return graph.getGraph(lastRequest);
|
|
526
|
+
queueMicrotask(async () => {
|
|
527
|
+
if (resetTimer.current) {
|
|
528
|
+
clearTimeout(resetTimer.current);
|
|
529
|
+
}
|
|
530
|
+
setState("flushing");
|
|
531
|
+
await space.db.flush();
|
|
532
|
+
setState("flushed");
|
|
533
|
+
resetTimer.current = setTimeout(() => {
|
|
534
|
+
setState("idle");
|
|
535
|
+
resetTimer.current = null;
|
|
536
|
+
}, 1e3);
|
|
537
|
+
});
|
|
741
538
|
}, [
|
|
742
|
-
|
|
743
|
-
lastRequest
|
|
539
|
+
space
|
|
744
540
|
]);
|
|
541
|
+
return {
|
|
542
|
+
state,
|
|
543
|
+
handleFlush
|
|
544
|
+
};
|
|
745
545
|
};
|
|
746
546
|
|
|
747
|
-
// src/hooks/useFlush.ts
|
|
748
|
-
import { useCallback as useCallback4, useRef, useState as useState4 } from "react";
|
|
749
|
-
|
|
750
547
|
// src/hooks/useItemTypes.ts
|
|
751
|
-
import
|
|
752
|
-
import { useEffect
|
|
548
|
+
import * as Option2 from "effect/Option";
|
|
549
|
+
import { useEffect, useState as useState5 } from "react";
|
|
753
550
|
import { ItemAnnotation } from "@dxos/schema";
|
|
754
551
|
var useItemTypes = (space) => {
|
|
755
552
|
const [types, setTypes] = useState5([]);
|
|
756
|
-
|
|
553
|
+
useEffect(() => {
|
|
757
554
|
if (!space) {
|
|
758
555
|
return;
|
|
759
556
|
}
|
|
@@ -772,29 +569,72 @@ var useItemTypes = (space) => {
|
|
|
772
569
|
return types;
|
|
773
570
|
};
|
|
774
571
|
|
|
572
|
+
// src/hooks/useOnline.ts
|
|
573
|
+
import { useState as useState6 } from "react";
|
|
574
|
+
var useOnline = () => {
|
|
575
|
+
const [online, setOnline] = useState6(true);
|
|
576
|
+
return [
|
|
577
|
+
online,
|
|
578
|
+
setOnline
|
|
579
|
+
];
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
// src/hooks/usePresets.ts
|
|
583
|
+
import { useCallback as useCallback4, useEffect as useEffect2, useMemo as useMemo4, useState as useState7 } from "react";
|
|
584
|
+
var usePresets = (online) => {
|
|
585
|
+
const [preset, setPreset] = useState7();
|
|
586
|
+
const presets = useMemo4(() => AiServicePresets.filter((preset2) => online === (preset2.provider === "dxos-remote")), [
|
|
587
|
+
online
|
|
588
|
+
]);
|
|
589
|
+
const presetOptions = useMemo4(() => presets.map(({ id, model, label }) => ({
|
|
590
|
+
id,
|
|
591
|
+
label: label ?? model
|
|
592
|
+
})), [
|
|
593
|
+
presets
|
|
594
|
+
]);
|
|
595
|
+
useEffect2(() => {
|
|
596
|
+
setPreset(presets[0]);
|
|
597
|
+
}, [
|
|
598
|
+
presets
|
|
599
|
+
]);
|
|
600
|
+
const handlePresetChange = useCallback4((id) => {
|
|
601
|
+
const preset2 = presets.find((preset3) => preset3.id === id);
|
|
602
|
+
if (preset2) {
|
|
603
|
+
setPreset(preset2);
|
|
604
|
+
}
|
|
605
|
+
}, [
|
|
606
|
+
presets
|
|
607
|
+
]);
|
|
608
|
+
return {
|
|
609
|
+
preset,
|
|
610
|
+
presets: presetOptions,
|
|
611
|
+
onPresetChange: handlePresetChange
|
|
612
|
+
};
|
|
613
|
+
};
|
|
614
|
+
|
|
775
615
|
// src/hooks/useReferencesProvider.ts
|
|
776
|
-
import { useMemo as
|
|
616
|
+
import { useMemo as useMemo5 } from "react";
|
|
777
617
|
import { Capabilities as Capabilities2, useCapabilities as useCapabilities2 } from "@dxos/app-framework";
|
|
778
|
-
import { Filter as Filter2, Obj as
|
|
618
|
+
import { Filter as Filter2, Obj as Obj3 } from "@dxos/echo";
|
|
779
619
|
var useReferencesProvider = (space) => {
|
|
780
620
|
const blueprints = useCapabilities2(Capabilities2.BlueprintDefinition);
|
|
781
|
-
return
|
|
621
|
+
return useMemo5(() => {
|
|
782
622
|
if (!space) {
|
|
783
623
|
return void 0;
|
|
784
624
|
}
|
|
785
625
|
return {
|
|
786
626
|
getReferences: async ({ query }) => {
|
|
787
627
|
const { objects } = await space.db.query(Filter2.everything()).run();
|
|
788
|
-
return objects.filter((object) => stringMatch(query,
|
|
789
|
-
uri:
|
|
790
|
-
label:
|
|
628
|
+
return objects.filter((object) => stringMatch(query, Obj3.getLabel(object) ?? "")).filter((object) => !!Obj3.getDXN(object)).map((object) => ({
|
|
629
|
+
uri: Obj3.getDXN(object).toString(),
|
|
630
|
+
label: Obj3.getLabel(object) ?? ""
|
|
791
631
|
}));
|
|
792
632
|
},
|
|
793
633
|
resolveReference: async ({ uri }) => {
|
|
794
634
|
const object = await space.db.query(Filter2.ids(uri)).first();
|
|
795
635
|
return {
|
|
796
636
|
uri,
|
|
797
|
-
label:
|
|
637
|
+
label: Obj3.getLabel(object) ?? ""
|
|
798
638
|
};
|
|
799
639
|
}
|
|
800
640
|
};
|
|
@@ -805,28 +645,25 @@ var useReferencesProvider = (space) => {
|
|
|
805
645
|
};
|
|
806
646
|
var stringMatch = (query, label) => label.toLowerCase().startsWith(query.toLowerCase());
|
|
807
647
|
|
|
808
|
-
// src/hooks/useComputeRuntimeCallback.ts
|
|
809
|
-
import { useCallback as useCallback5 } from "react";
|
|
810
|
-
import { useCapability as useCapability2 } from "@dxos/app-framework";
|
|
811
|
-
|
|
812
648
|
// src/components/Chat/Chat.tsx
|
|
813
649
|
import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
|
|
814
650
|
import { Prec } from "@codemirror/state";
|
|
815
651
|
import { keymap } from "@codemirror/view";
|
|
816
652
|
import { useRxValue } from "@effect-rx/rx-react";
|
|
817
653
|
import { createContext } from "@radix-ui/react-context";
|
|
818
|
-
import
|
|
819
|
-
import
|
|
654
|
+
import * as Array2 from "effect/Array";
|
|
655
|
+
import * as Option3 from "effect/Option";
|
|
656
|
+
import React9, { useCallback as useCallback6, useEffect as useEffect6, useMemo as useMemo9, useRef as useRef3, useState as useState12 } from "react";
|
|
820
657
|
import { Event } from "@dxos/async";
|
|
821
|
-
import { Obj as
|
|
658
|
+
import { Obj as Obj6 } from "@dxos/echo";
|
|
822
659
|
import { useVoiceInput } from "@dxos/plugin-transcription";
|
|
823
|
-
import { getSpace, useQueue
|
|
660
|
+
import { getSpace, useQueue } from "@dxos/react-client/echo";
|
|
824
661
|
import { useIdentity } from "@dxos/react-client/halo";
|
|
825
662
|
import { Input, useDynamicRef, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
826
663
|
import { ChatEditor, references } from "@dxos/react-ui-chat";
|
|
827
664
|
import { mx as mx5 } from "@dxos/react-ui-theme";
|
|
828
|
-
import { DataType as
|
|
829
|
-
import {
|
|
665
|
+
import { DataType as DataType2 } from "@dxos/schema";
|
|
666
|
+
import { isTruthy } from "@dxos/util";
|
|
830
667
|
|
|
831
668
|
// src/components/ChatPrompt/ChatActions.tsx
|
|
832
669
|
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
@@ -878,13 +715,13 @@ var ChatActions = ({ classNames, children, microphone, recording, processing, on
|
|
|
878
715
|
|
|
879
716
|
// src/components/ChatPrompt/ChatOptions.tsx
|
|
880
717
|
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
881
|
-
import React2, { useMemo as
|
|
882
|
-
import { Filter as Filter3, Obj as
|
|
883
|
-
import { useQuery } from "@dxos/react-client/echo";
|
|
718
|
+
import React2, { useMemo as useMemo6, useState as useState8 } from "react";
|
|
719
|
+
import { Filter as Filter3, Obj as Obj4, Type } from "@dxos/echo";
|
|
720
|
+
import { useQuery as useQuery2 } from "@dxos/react-client/echo";
|
|
884
721
|
import { Icon, IconButton as IconButton2, Popover, Select, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
885
|
-
import { SearchList } from "@dxos/react-ui-searchlist";
|
|
722
|
+
import { Listbox, SearchList } from "@dxos/react-ui-searchlist";
|
|
886
723
|
import { Tabs } from "@dxos/react-ui-tabs";
|
|
887
|
-
var panelClassNames = "is-[calc(100dvw-.5rem)] sm:is-max md:is-
|
|
724
|
+
var panelClassNames = "is-[calc(100dvw-.5rem)] sm:is-max md:is-72 max-is-[--text-content]";
|
|
888
725
|
var ChatOptions = ({ space, context, blueprintRegistry, presets, preset, onPresetChange }) => {
|
|
889
726
|
var _effect = _useSignals4();
|
|
890
727
|
try {
|
|
@@ -920,17 +757,22 @@ var ChatOptions = ({ space, context, blueprintRegistry, presets, preset, onPrese
|
|
|
920
757
|
}, /* @__PURE__ */ React2.createElement(Tabs.Root, {
|
|
921
758
|
orientation: "horizontal",
|
|
922
759
|
defaultValue: "blueprints",
|
|
923
|
-
defaultActivePart: "list"
|
|
760
|
+
defaultActivePart: "list",
|
|
761
|
+
tabIndex: -1
|
|
924
762
|
}, /* @__PURE__ */ React2.createElement(Tabs.Viewport, {
|
|
925
763
|
classNames: 'max-bs-[--radix-popover-content-available-height] grid grid-rows-[1fr_min-content] [&_[cmdk-root]]:contents [&_[role="tabpanel"]]:grid [&_[role="tabpanel"]]:grid-rows-[1fr_min-content] [&_[role="listbox"]]:min-bs-0 [&_[role="listbox"]]:overflow-y-auto [&_[role="tabpanel"]]:min-bs-0 [&_[role="tabpanel"]]:pli-cardSpacingChrome [&_[role="tabpanel"][data-state="active"]]:order-first [&_[role="tabpanel"][data-state="inactive"]]:hidden'
|
|
926
764
|
}, /* @__PURE__ */ React2.createElement(Tabs.Tabpanel, {
|
|
927
|
-
value: "blueprints"
|
|
765
|
+
value: "blueprints",
|
|
766
|
+
tabIndex: -1,
|
|
767
|
+
classNames: "dx-focus-ring-inset"
|
|
928
768
|
}, /* @__PURE__ */ React2.createElement(BlueprintsPanel, {
|
|
929
769
|
blueprintRegistry,
|
|
930
770
|
space,
|
|
931
771
|
context
|
|
932
772
|
})), /* @__PURE__ */ React2.createElement(Tabs.Tabpanel, {
|
|
933
|
-
value: "model"
|
|
773
|
+
value: "model",
|
|
774
|
+
tabIndex: -1,
|
|
775
|
+
classNames: "dx-focus-ring-inset !pli-0"
|
|
934
776
|
}, /* @__PURE__ */ React2.createElement(ModelsPanel, {
|
|
935
777
|
presets,
|
|
936
778
|
preset,
|
|
@@ -955,7 +797,8 @@ var BlueprintsPanel = ({ blueprintRegistry, space, context }) => {
|
|
|
955
797
|
try {
|
|
956
798
|
const { t } = useTranslation2(meta.id);
|
|
957
799
|
const blueprints = useBlueprints({
|
|
958
|
-
blueprintRegistry
|
|
800
|
+
blueprintRegistry,
|
|
801
|
+
space
|
|
959
802
|
});
|
|
960
803
|
const activeBlueprints = useActiveBlueprints({
|
|
961
804
|
context
|
|
@@ -984,7 +827,8 @@ var BlueprintsPanel = ({ blueprintRegistry, space, context }) => {
|
|
|
984
827
|
}));
|
|
985
828
|
})), /* @__PURE__ */ React2.createElement(SearchList.Input, {
|
|
986
829
|
placeholder: t("search placeholder"),
|
|
987
|
-
classNames: "mbe-cardSpacingChrome"
|
|
830
|
+
classNames: "mbe-cardSpacingChrome",
|
|
831
|
+
autoFocus: true
|
|
988
832
|
}));
|
|
989
833
|
} finally {
|
|
990
834
|
_effect.f();
|
|
@@ -993,26 +837,15 @@ var BlueprintsPanel = ({ blueprintRegistry, space, context }) => {
|
|
|
993
837
|
var ModelsPanel = ({ presets, preset, onPresetChange }) => {
|
|
994
838
|
var _effect = _useSignals4();
|
|
995
839
|
try {
|
|
996
|
-
return /* @__PURE__ */ React2.createElement(
|
|
997
|
-
|
|
998
|
-
|
|
840
|
+
return /* @__PURE__ */ React2.createElement(Listbox.Root, {
|
|
841
|
+
value: preset,
|
|
842
|
+
onValueChange: onPresetChange,
|
|
843
|
+
autoFocus: true
|
|
999
844
|
}, presets?.map(({ id, label }) => {
|
|
1000
|
-
|
|
1001
|
-
return /* @__PURE__ */ React2.createElement("li", {
|
|
1002
|
-
role: "option",
|
|
845
|
+
return /* @__PURE__ */ React2.createElement(Listbox.Option, {
|
|
1003
846
|
key: id,
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
className: "overflow-hidden dx-focus-ring flex gap-2 p-1 pis-2 pie-2 items-center rounded-sm select-none cursor-pointer hover:bg-hoverOverlay",
|
|
1007
|
-
onClick: () => onPresetChange?.(id)
|
|
1008
|
-
}, /* @__PURE__ */ React2.createElement("div", {
|
|
1009
|
-
className: "grow truncate"
|
|
1010
|
-
}, label), /* @__PURE__ */ React2.createElement(Icon, {
|
|
1011
|
-
icon: "ph--check--regular",
|
|
1012
|
-
classNames: [
|
|
1013
|
-
!isActive && "invisible"
|
|
1014
|
-
]
|
|
1015
|
-
}));
|
|
847
|
+
value: id
|
|
848
|
+
}, /* @__PURE__ */ React2.createElement(Listbox.OptionLabel, null, label), /* @__PURE__ */ React2.createElement(Listbox.OptionIndicator, null));
|
|
1016
849
|
}));
|
|
1017
850
|
} finally {
|
|
1018
851
|
_effect.f();
|
|
@@ -1024,7 +857,7 @@ var ObjectsPanel = ({ space, context }) => {
|
|
|
1024
857
|
try {
|
|
1025
858
|
const { t } = useTranslation2(meta.id);
|
|
1026
859
|
const types = useItemTypes(space);
|
|
1027
|
-
const typenames =
|
|
860
|
+
const typenames = useMemo6(() => {
|
|
1028
861
|
const typenames2 = types.map((type) => {
|
|
1029
862
|
const typename2 = Type.getTypename(type);
|
|
1030
863
|
return {
|
|
@@ -1040,27 +873,25 @@ var ObjectsPanel = ({ space, context }) => {
|
|
|
1040
873
|
}, [
|
|
1041
874
|
types
|
|
1042
875
|
]);
|
|
1043
|
-
const [typename, setTypename] =
|
|
1044
|
-
const anyFilter =
|
|
876
|
+
const [typename, setTypename] = useState8(ANY);
|
|
877
|
+
const anyFilter = useMemo6(() => Filter3.or(...typenames.map(({ typename: typename2 }) => Filter3.typename(typename2))), [
|
|
1045
878
|
typenames
|
|
1046
879
|
]);
|
|
1047
|
-
const objects =
|
|
880
|
+
const objects = useQuery2(space, typename === ANY ? anyFilter : Filter3.typename(typename));
|
|
1048
881
|
const { objects: contextObjects, onUpdateObject } = useContextObjects({
|
|
1049
882
|
space,
|
|
1050
883
|
context
|
|
1051
884
|
});
|
|
1052
|
-
return /* @__PURE__ */ React2.createElement(SearchList.Root, {
|
|
1053
|
-
classNames: "
|
|
1054
|
-
}, /* @__PURE__ */ React2.createElement(SearchList.Content, {
|
|
1055
|
-
classNames: "plb-cardSpacingChrome [&:has([cmdk-list-sizer]:empty)]:plb-0"
|
|
885
|
+
return /* @__PURE__ */ React2.createElement(SearchList.Root, null, /* @__PURE__ */ React2.createElement(SearchList.Content, {
|
|
886
|
+
classNames: "p-cardSpacingChrome [&:has([cmdk-list-sizer]:empty)]:plb-0"
|
|
1056
887
|
}, objects.length ? objects.map((object) => {
|
|
1057
|
-
const label =
|
|
888
|
+
const label = Obj4.getLabel(object) ?? Obj4.getTypename(object) ?? object.id;
|
|
1058
889
|
const isActive = contextObjects.findIndex((obj) => obj.id === object.id) !== -1;
|
|
1059
890
|
return /* @__PURE__ */ React2.createElement(SearchList.Item, {
|
|
1060
891
|
classNames: "flex items-center overflow-hidden",
|
|
1061
892
|
key: object.id,
|
|
1062
893
|
value: object.id,
|
|
1063
|
-
onSelect: () => onUpdateObject?.(
|
|
894
|
+
onSelect: () => onUpdateObject?.(Obj4.getDXN(object), !isActive)
|
|
1064
895
|
}, /* @__PURE__ */ React2.createElement("div", {
|
|
1065
896
|
className: "grow truncate"
|
|
1066
897
|
}, label), /* @__PURE__ */ React2.createElement(Icon, {
|
|
@@ -1071,7 +902,7 @@ var ObjectsPanel = ({ space, context }) => {
|
|
|
1071
902
|
}));
|
|
1072
903
|
}) : /* @__PURE__ */ React2.createElement(SearchList.Item, null, t("no results"))), /* @__PURE__ */ React2.createElement("div", {
|
|
1073
904
|
role: "none",
|
|
1074
|
-
className: "grid grid-cols-[min-content_1fr] gap-2 mbe-cardSpacingChrome"
|
|
905
|
+
className: "grid grid-cols-[min-content_1fr] gap-2 pli-cardSpacingChrome mbe-cardSpacingChrome"
|
|
1075
906
|
}, /* @__PURE__ */ React2.createElement(Select.Root, {
|
|
1076
907
|
value: typename === ANY ? void 0 : typename,
|
|
1077
908
|
onValueChange: setTypename
|
|
@@ -1085,7 +916,8 @@ var ObjectsPanel = ({ space, context }) => {
|
|
|
1085
916
|
value: typename2
|
|
1086
917
|
}, label))), /* @__PURE__ */ React2.createElement(Select.ScrollDownButton, null), /* @__PURE__ */ React2.createElement(Select.Arrow, null)))), /* @__PURE__ */ React2.createElement(SearchList.Input, {
|
|
1087
918
|
placeholder: t("search placeholder"),
|
|
1088
|
-
classNames: "mbe-0"
|
|
919
|
+
classNames: "mbe-0",
|
|
920
|
+
autoFocus: true
|
|
1089
921
|
})));
|
|
1090
922
|
} finally {
|
|
1091
923
|
_effect.f();
|
|
@@ -1100,7 +932,7 @@ import { Select as Select2 } from "@dxos/react-ui";
|
|
|
1100
932
|
// src/components/ChatPrompt/ChatReferences.tsx
|
|
1101
933
|
import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
|
|
1102
934
|
import React4 from "react";
|
|
1103
|
-
import { Obj as
|
|
935
|
+
import { Obj as Obj5 } from "@dxos/echo";
|
|
1104
936
|
import { IconButton as IconButton3, toLocalizedString, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
1105
937
|
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
1106
938
|
var ChatReferences = ({ classNames, context, space }) => {
|
|
@@ -1114,9 +946,9 @@ var ChatReferences = ({ classNames, context, space }) => {
|
|
|
1114
946
|
return /* @__PURE__ */ React4.createElement("ul", {
|
|
1115
947
|
className: mx2("flex flex-wrap", classNames)
|
|
1116
948
|
}, objects.map((obj) => {
|
|
1117
|
-
const dxn =
|
|
1118
|
-
const typename =
|
|
1119
|
-
const label =
|
|
949
|
+
const dxn = Obj5.getDXN(obj);
|
|
950
|
+
const typename = Obj5.getTypename(obj);
|
|
951
|
+
const label = Obj5.getLabel(obj) ?? (typename ? [
|
|
1120
952
|
"object name placeholder",
|
|
1121
953
|
{
|
|
1122
954
|
ns: typename
|
|
@@ -1143,7 +975,7 @@ var ChatReferences = ({ classNames, context, space }) => {
|
|
|
1143
975
|
|
|
1144
976
|
// src/components/ChatPrompt/ChatStatusIndicator.tsx
|
|
1145
977
|
import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
|
|
1146
|
-
import React5, { useEffect as useEffect3, useState as
|
|
978
|
+
import React5, { useEffect as useEffect3, useState as useState9 } from "react";
|
|
1147
979
|
import { Tooltip, useTimeout } from "@dxos/react-ui";
|
|
1148
980
|
import { Spinner } from "@dxos/react-ui-sfx";
|
|
1149
981
|
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
@@ -1151,7 +983,7 @@ var period = 3e3;
|
|
|
1151
983
|
var ChatStatusIndicator = ({ classNames, preset, processing, error, ...props }) => {
|
|
1152
984
|
var _effect = _useSignals7();
|
|
1153
985
|
try {
|
|
1154
|
-
const [init, setInit] =
|
|
986
|
+
const [init, setInit] = useState9(false);
|
|
1155
987
|
useEffect3(() => setInit(false), [
|
|
1156
988
|
preset
|
|
1157
989
|
]);
|
|
@@ -1180,7 +1012,7 @@ var ChatStatusIndicator = ({ classNames, preset, processing, error, ...props })
|
|
|
1180
1012
|
|
|
1181
1013
|
// src/components/ChatThread/ChatThread.tsx
|
|
1182
1014
|
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
1183
|
-
import React8, { forwardRef, useCallback as
|
|
1015
|
+
import React8, { forwardRef, useCallback as useCallback5, useEffect as useEffect5, useImperativeHandle, useMemo as useMemo8, useState as useState11 } from "react";
|
|
1184
1016
|
import { PublicKey } from "@dxos/keys";
|
|
1185
1017
|
import { MarkdownStream } from "@dxos/react-ui-components";
|
|
1186
1018
|
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
@@ -1191,17 +1023,17 @@ import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking"
|
|
|
1191
1023
|
import React7 from "react";
|
|
1192
1024
|
import { log as log4 } from "@dxos/log";
|
|
1193
1025
|
import { PromptWidget, ReferenceWidget, SelectWidget, SuggestionWidget, SummaryWidget, ToggleContainer as ToggleContainer2 } from "@dxos/react-ui-components";
|
|
1026
|
+
import { getXmlTextChild } from "@dxos/react-ui-editor";
|
|
1194
1027
|
import { Json as Json2 } from "@dxos/react-ui-syntax-highlighter";
|
|
1195
|
-
import { ContentBlock
|
|
1028
|
+
import { ContentBlock } from "@dxos/schema";
|
|
1196
1029
|
|
|
1197
1030
|
// src/components/ToolBlock/ToolBlock.tsx
|
|
1198
1031
|
import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
|
|
1199
|
-
import React6, { useEffect as useEffect4, useMemo as
|
|
1032
|
+
import React6, { useEffect as useEffect4, useMemo as useMemo7, useRef as useRef2, useState as useState10 } from "react";
|
|
1200
1033
|
import { useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
1201
1034
|
import { NumericTabs, TextCrawl, ToggleContainer, chatMessageJson, chatMessagePanel, chatMessagePanelContent, chatMessagePanelHeader } from "@dxos/react-ui-components";
|
|
1202
1035
|
import { Json } from "@dxos/react-ui-syntax-highlighter";
|
|
1203
|
-
import { isNonNullable as isNonNullable3 } from "@dxos/util";
|
|
1204
|
-
import { safeParseJson } from "@dxos/util";
|
|
1036
|
+
import { isNonNullable as isNonNullable3, safeParseJson } from "@dxos/util";
|
|
1205
1037
|
var ToolBlock = ({ blocks = [] }) => {
|
|
1206
1038
|
var _effect = _useSignals8();
|
|
1207
1039
|
try {
|
|
@@ -1215,7 +1047,7 @@ var ToolBlock = ({ blocks = [] }) => {
|
|
|
1215
1047
|
tool.name
|
|
1216
1048
|
].join(" ");
|
|
1217
1049
|
};
|
|
1218
|
-
const items =
|
|
1050
|
+
const items = useMemo7(() => {
|
|
1219
1051
|
let lastToolCall;
|
|
1220
1052
|
const tools = [];
|
|
1221
1053
|
return blocks.filter((block) => block._tag === "toolCall" || block._tag === "toolResult" || block._tag === "summary").map((block) => {
|
|
@@ -1283,8 +1115,8 @@ var ToolContainer = ({ items }) => {
|
|
|
1283
1115
|
var _effect = _useSignals8();
|
|
1284
1116
|
try {
|
|
1285
1117
|
const tabsRef = useRef2(null);
|
|
1286
|
-
const [selected, setSelected] =
|
|
1287
|
-
const [open, setOpen] =
|
|
1118
|
+
const [selected, setSelected] = useState10(0);
|
|
1119
|
+
const [open, setOpen] = useState10(false);
|
|
1288
1120
|
useEffect4(() => {
|
|
1289
1121
|
if (open) {
|
|
1290
1122
|
tabsRef.current?.focus();
|
|
@@ -1349,10 +1181,6 @@ var Fallback = ({ _tag, ...props }) => {
|
|
|
1349
1181
|
_effect.f();
|
|
1350
1182
|
}
|
|
1351
1183
|
};
|
|
1352
|
-
var getTextChild = (children) => {
|
|
1353
|
-
const child = children?.[0];
|
|
1354
|
-
return typeof child === "string" ? child : null;
|
|
1355
|
-
};
|
|
1356
1184
|
var componentRegistry = {
|
|
1357
1185
|
//
|
|
1358
1186
|
// Widgets
|
|
@@ -1360,35 +1188,35 @@ var componentRegistry = {
|
|
|
1360
1188
|
["prompt"]: {
|
|
1361
1189
|
block: true,
|
|
1362
1190
|
factory: (props) => {
|
|
1363
|
-
const text =
|
|
1191
|
+
const text = getXmlTextChild(props.children);
|
|
1364
1192
|
return text ? new PromptWidget(text) : null;
|
|
1365
1193
|
}
|
|
1366
1194
|
},
|
|
1367
1195
|
["reference"]: {
|
|
1368
1196
|
block: false,
|
|
1369
1197
|
factory: (props) => {
|
|
1370
|
-
const text =
|
|
1198
|
+
const text = getXmlTextChild(props.children);
|
|
1371
1199
|
return text && props.ref ? new ReferenceWidget(text, props.ref) : null;
|
|
1372
1200
|
}
|
|
1373
1201
|
},
|
|
1374
1202
|
["select"]: {
|
|
1375
1203
|
block: true,
|
|
1376
1204
|
factory: (props) => {
|
|
1377
|
-
const options = props.children?.map((option) => option._tag === "option" &&
|
|
1205
|
+
const options = props.children?.map((option) => option._tag === "option" && getXmlTextChild(option.children)).filter(Boolean);
|
|
1378
1206
|
return options?.length ? new SelectWidget(options) : null;
|
|
1379
1207
|
}
|
|
1380
1208
|
},
|
|
1381
1209
|
["suggestion"]: {
|
|
1382
1210
|
block: true,
|
|
1383
1211
|
factory: (props) => {
|
|
1384
|
-
const text =
|
|
1212
|
+
const text = getXmlTextChild(props.children);
|
|
1385
1213
|
return text ? new SuggestionWidget(text) : null;
|
|
1386
1214
|
}
|
|
1387
1215
|
},
|
|
1388
1216
|
["summary"]: {
|
|
1389
1217
|
block: true,
|
|
1390
1218
|
factory: (props) => {
|
|
1391
|
-
const text =
|
|
1219
|
+
const text = getXmlTextChild(props.children);
|
|
1392
1220
|
return text ? new SummaryWidget(text) : null;
|
|
1393
1221
|
}
|
|
1394
1222
|
},
|
|
@@ -1427,7 +1255,7 @@ var _blockToMarkdown = (context, message, block) => {
|
|
|
1427
1255
|
block: JSON.stringify(block)
|
|
1428
1256
|
}, {
|
|
1429
1257
|
F: __dxlog_file4,
|
|
1430
|
-
L:
|
|
1258
|
+
L: 125,
|
|
1431
1259
|
S: void 0,
|
|
1432
1260
|
C: (f, a) => f(...a)
|
|
1433
1261
|
});
|
|
@@ -1482,7 +1310,7 @@ var _blockToMarkdown = (context, message, block) => {
|
|
|
1482
1310
|
break;
|
|
1483
1311
|
}
|
|
1484
1312
|
case "summary": {
|
|
1485
|
-
return `<summary>${
|
|
1313
|
+
return `<summary>${ContentBlock.createSummaryMessage(block)}</summary>`;
|
|
1486
1314
|
}
|
|
1487
1315
|
// TODO(burdon): Need stable ID.
|
|
1488
1316
|
default: {
|
|
@@ -1495,7 +1323,7 @@ ${JSON.stringify(block)}
|
|
|
1495
1323
|
|
|
1496
1324
|
// src/components/ChatThread/sync.ts
|
|
1497
1325
|
import { log as log5 } from "@dxos/log";
|
|
1498
|
-
function
|
|
1326
|
+
function _define_property2(obj, key, value) {
|
|
1499
1327
|
if (key in obj) {
|
|
1500
1328
|
Object.defineProperty(obj, key, {
|
|
1501
1329
|
value,
|
|
@@ -1514,7 +1342,7 @@ var MessageThreadContext = class {
|
|
|
1514
1342
|
this._widgetState?.updateWidget(id, value);
|
|
1515
1343
|
}
|
|
1516
1344
|
constructor(_widgetState) {
|
|
1517
|
-
|
|
1345
|
+
_define_property2(this, "_widgetState", void 0);
|
|
1518
1346
|
this._widgetState = _widgetState;
|
|
1519
1347
|
}
|
|
1520
1348
|
};
|
|
@@ -1537,7 +1365,7 @@ var MessageSyncer = class {
|
|
|
1537
1365
|
}
|
|
1538
1366
|
sync(messages) {
|
|
1539
1367
|
log5("sync", {
|
|
1540
|
-
messages: messages.map((
|
|
1368
|
+
messages: messages.map((message) => message.blocks.length),
|
|
1541
1369
|
currentMessageIndex: this._currentMessageIndex,
|
|
1542
1370
|
currentBlockIndex: this._currentBlockIndex,
|
|
1543
1371
|
currentBlockContent: this._currentBlockContent
|
|
@@ -1593,13 +1421,13 @@ var MessageSyncer = class {
|
|
|
1593
1421
|
}
|
|
1594
1422
|
}
|
|
1595
1423
|
constructor(_model, _blockRenderer) {
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1424
|
+
_define_property2(this, "_model", void 0);
|
|
1425
|
+
_define_property2(this, "_blockRenderer", void 0);
|
|
1426
|
+
_define_property2(this, "_initialMessageId", void 0);
|
|
1427
|
+
_define_property2(this, "_currentMessageIndex", void 0);
|
|
1428
|
+
_define_property2(this, "_currentBlockIndex", void 0);
|
|
1429
|
+
_define_property2(this, "_currentBlockContent", void 0);
|
|
1430
|
+
_define_property2(this, "_context", void 0);
|
|
1603
1431
|
this._model = _model;
|
|
1604
1432
|
this._blockRenderer = _blockRenderer;
|
|
1605
1433
|
this._currentMessageIndex = 0;
|
|
@@ -1609,15 +1437,15 @@ var MessageSyncer = class {
|
|
|
1609
1437
|
};
|
|
1610
1438
|
|
|
1611
1439
|
// src/components/ChatThread/ChatThread.tsx
|
|
1612
|
-
var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages = [], error, cursor = false, fadeIn = true, onEvent }, forwardedRef) => {
|
|
1440
|
+
var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages = [], error, cursor = false, fadeIn = true, overscroll, onEvent }, forwardedRef) => {
|
|
1613
1441
|
var _effect = _useSignals10();
|
|
1614
1442
|
try {
|
|
1615
|
-
const userHue =
|
|
1443
|
+
const userHue = useMemo8(() => {
|
|
1616
1444
|
return identity?.profile?.data?.hue || keyToFallback(identity?.identityKey ?? PublicKey.random()).hue;
|
|
1617
1445
|
}, [
|
|
1618
1446
|
identity
|
|
1619
1447
|
]);
|
|
1620
|
-
const [controller, setController] =
|
|
1448
|
+
const [controller, setController] = useState11(null);
|
|
1621
1449
|
useImperativeHandle(forwardedRef, () => controller ? controller : null, [
|
|
1622
1450
|
controller
|
|
1623
1451
|
]);
|
|
@@ -1627,7 +1455,7 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
|
|
|
1627
1455
|
controller,
|
|
1628
1456
|
error
|
|
1629
1457
|
]);
|
|
1630
|
-
const syncer =
|
|
1458
|
+
const syncer = useMemo8(() => controller && new MessageSyncer(controller, blockToMarkdown), [
|
|
1631
1459
|
controller
|
|
1632
1460
|
]);
|
|
1633
1461
|
useEffect5(() => {
|
|
@@ -1636,7 +1464,7 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
|
|
|
1636
1464
|
syncer,
|
|
1637
1465
|
messages
|
|
1638
1466
|
]);
|
|
1639
|
-
const handleEvent =
|
|
1467
|
+
const handleEvent = useCallback5((ev) => {
|
|
1640
1468
|
switch (ev.type) {
|
|
1641
1469
|
case "submit": {
|
|
1642
1470
|
ev.value && onEvent?.({
|
|
@@ -1656,10 +1484,10 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
|
|
|
1656
1484
|
}
|
|
1657
1485
|
}, /* @__PURE__ */ React8.createElement(MarkdownStream, {
|
|
1658
1486
|
ref: setController,
|
|
1659
|
-
classNames: "bs-full max-is-prose overflow-hidden",
|
|
1660
1487
|
registry: componentRegistry,
|
|
1661
1488
|
cursor,
|
|
1662
1489
|
fadeIn,
|
|
1490
|
+
overscroll,
|
|
1663
1491
|
onEvent: handleEvent
|
|
1664
1492
|
}));
|
|
1665
1493
|
} finally {
|
|
@@ -1672,14 +1500,14 @@ var [ChatContextProvider, useChatContext] = createContext("Chat");
|
|
|
1672
1500
|
var ChatRoot = ({ classNames, children, chat, processor, onEvent, ...props }) => {
|
|
1673
1501
|
var _effect = _useSignals11();
|
|
1674
1502
|
try {
|
|
1675
|
-
const [debug, setDebug] =
|
|
1503
|
+
const [debug, setDebug] = useState12(false);
|
|
1676
1504
|
const space = getSpace(chat);
|
|
1677
|
-
const queue =
|
|
1505
|
+
const queue = useQueue(chat?.queue.dxn);
|
|
1678
1506
|
const pending = useRxValue(processor.messages);
|
|
1679
1507
|
const streaming = useRxValue(processor.streaming);
|
|
1680
1508
|
const lastPrompt = useRef3(void 0);
|
|
1681
|
-
const messages =
|
|
1682
|
-
const queueMessages = queue?.objects?.filter(
|
|
1509
|
+
const messages = useMemo9(() => {
|
|
1510
|
+
const queueMessages = queue?.objects?.filter(Obj6.instanceOf(DataType2.Message)) ?? [];
|
|
1683
1511
|
return Array2.dedupeWith([
|
|
1684
1512
|
...queueMessages,
|
|
1685
1513
|
...pending
|
|
@@ -1688,7 +1516,7 @@ var ChatRoot = ({ classNames, children, chat, processor, onEvent, ...props }) =>
|
|
|
1688
1516
|
queue?.objects,
|
|
1689
1517
|
pending
|
|
1690
1518
|
]);
|
|
1691
|
-
const event =
|
|
1519
|
+
const event = useMemo9(() => new Event(), []);
|
|
1692
1520
|
useEffect6(() => {
|
|
1693
1521
|
return event.on((ev) => {
|
|
1694
1522
|
switch (ev.type) {
|
|
@@ -1748,14 +1576,14 @@ var ChatRoot = ({ classNames, children, chat, processor, onEvent, ...props }) =>
|
|
|
1748
1576
|
...props
|
|
1749
1577
|
}, /* @__PURE__ */ React9.createElement("div", {
|
|
1750
1578
|
role: "none",
|
|
1751
|
-
className: mx5("flex flex-col
|
|
1579
|
+
className: mx5("flex flex-col bs-full is-full", classNames)
|
|
1752
1580
|
}, children));
|
|
1753
1581
|
} finally {
|
|
1754
1582
|
_effect.f();
|
|
1755
1583
|
}
|
|
1756
1584
|
};
|
|
1757
1585
|
ChatRoot.displayName = "Chat.Root";
|
|
1758
|
-
var ChatPrompt = ({ classNames, outline, placeholder, expandable, online, presets, preset, onPresetChange, onOnlineChange }) => {
|
|
1586
|
+
var ChatPrompt = ({ classNames, outline, settings = true, placeholder, expandable, online, presets, preset, onPresetChange, onOnlineChange }) => {
|
|
1759
1587
|
var _effect = _useSignals11();
|
|
1760
1588
|
try {
|
|
1761
1589
|
const { t } = useTranslation5(meta.id);
|
|
@@ -1765,7 +1593,7 @@ var ChatPrompt = ({ classNames, outline, placeholder, expandable, online, preset
|
|
|
1765
1593
|
const active = useRxValue(processor.active);
|
|
1766
1594
|
const activeRef = useDynamicRef(active);
|
|
1767
1595
|
const editorRef = useRef3(null);
|
|
1768
|
-
const [recordingState, setRecordingState] =
|
|
1596
|
+
const [recordingState, setRecordingState] = useState12(false);
|
|
1769
1597
|
useEffect6(() => {
|
|
1770
1598
|
return event.on((event2) => {
|
|
1771
1599
|
switch (event2.type) {
|
|
@@ -1794,7 +1622,7 @@ var ChatPrompt = ({ classNames, outline, placeholder, expandable, online, preset
|
|
|
1794
1622
|
}
|
|
1795
1623
|
});
|
|
1796
1624
|
const referencesProvider = useReferencesProvider(space);
|
|
1797
|
-
const extensions =
|
|
1625
|
+
const extensions = useMemo9(() => {
|
|
1798
1626
|
return [
|
|
1799
1627
|
referencesProvider && references({
|
|
1800
1628
|
provider: referencesProvider
|
|
@@ -1830,14 +1658,14 @@ var ChatPrompt = ({ classNames, outline, placeholder, expandable, online, preset
|
|
|
1830
1658
|
return true;
|
|
1831
1659
|
}
|
|
1832
1660
|
}
|
|
1833
|
-
].filter(
|
|
1834
|
-
].filter(
|
|
1661
|
+
].filter(isTruthy)))
|
|
1662
|
+
].filter(isTruthy);
|
|
1835
1663
|
}, [
|
|
1836
1664
|
event,
|
|
1837
1665
|
expandable,
|
|
1838
1666
|
referencesProvider
|
|
1839
1667
|
]);
|
|
1840
|
-
const handleSubmit =
|
|
1668
|
+
const handleSubmit = useCallback6((text) => {
|
|
1841
1669
|
if (!activeRef.current) {
|
|
1842
1670
|
event.emit({
|
|
1843
1671
|
type: "submit",
|
|
@@ -1848,16 +1676,18 @@ var ChatPrompt = ({ classNames, outline, placeholder, expandable, online, preset
|
|
|
1848
1676
|
}, [
|
|
1849
1677
|
event
|
|
1850
1678
|
]);
|
|
1851
|
-
const handleEvent =
|
|
1679
|
+
const handleEvent = useCallback6((ev) => {
|
|
1852
1680
|
event.emit(ev);
|
|
1853
1681
|
}, [
|
|
1854
1682
|
event
|
|
1855
1683
|
]);
|
|
1856
1684
|
return /* @__PURE__ */ React9.createElement("div", {
|
|
1857
|
-
|
|
1685
|
+
role: "group",
|
|
1686
|
+
className: mx5("flex flex-col is-full density-fine", outline && [
|
|
1858
1687
|
"p-2 bg-groupSurface border border-subduedSeparator transition transition-border [&:has(.cm-content:focus)]:border-separator rounded"
|
|
1859
1688
|
], classNames)
|
|
1860
1689
|
}, /* @__PURE__ */ React9.createElement("div", {
|
|
1690
|
+
role: "none",
|
|
1861
1691
|
className: "flex gap-2"
|
|
1862
1692
|
}, /* @__PURE__ */ React9.createElement(ChatStatusIndicator, {
|
|
1863
1693
|
classNames: "p-1",
|
|
@@ -1872,7 +1702,8 @@ var ChatPrompt = ({ classNames, outline, placeholder, expandable, online, preset
|
|
|
1872
1702
|
placeholder: placeholder ?? t("prompt placeholder"),
|
|
1873
1703
|
extensions,
|
|
1874
1704
|
onSubmit: handleSubmit
|
|
1875
|
-
})), /* @__PURE__ */ React9.createElement("div", {
|
|
1705
|
+
})), settings && /* @__PURE__ */ React9.createElement("div", {
|
|
1706
|
+
role: "none",
|
|
1876
1707
|
className: "flex pbs-2 items-center"
|
|
1877
1708
|
}, /* @__PURE__ */ React9.createElement(ChatOptions, {
|
|
1878
1709
|
space,
|
|
@@ -1893,7 +1724,9 @@ var ChatPrompt = ({ classNames, outline, placeholder, expandable, online, preset
|
|
|
1893
1724
|
recording,
|
|
1894
1725
|
processing: streaming,
|
|
1895
1726
|
onEvent: handleEvent
|
|
1896
|
-
}, online !== void 0 && /* @__PURE__ */ React9.createElement(Input.Root, null, /* @__PURE__ */ React9.createElement(Input.
|
|
1727
|
+
}, online !== void 0 && /* @__PURE__ */ React9.createElement(Input.Root, null, /* @__PURE__ */ React9.createElement(Input.Label, {
|
|
1728
|
+
srOnly: true
|
|
1729
|
+
}, t("online switch label")), /* @__PURE__ */ React9.createElement(Input.Switch, {
|
|
1897
1730
|
classNames: "mis-2 mie-2",
|
|
1898
1731
|
checked: online,
|
|
1899
1732
|
onCheckedChange: onOnlineChange
|
|
@@ -1922,7 +1755,7 @@ var ChatThread2 = (props) => {
|
|
|
1922
1755
|
}, [
|
|
1923
1756
|
event
|
|
1924
1757
|
]);
|
|
1925
|
-
const handleEvent =
|
|
1758
|
+
const handleEvent = useCallback6((ev) => {
|
|
1926
1759
|
event.emit(ev);
|
|
1927
1760
|
}, [
|
|
1928
1761
|
event
|
|
@@ -1951,25 +1784,20 @@ var Chat = {
|
|
|
1951
1784
|
|
|
1952
1785
|
export {
|
|
1953
1786
|
useBlueprintRegistry,
|
|
1787
|
+
useBlueprints,
|
|
1788
|
+
useActiveBlueprints,
|
|
1789
|
+
useBlueprintHandlers,
|
|
1954
1790
|
useChatProcessor,
|
|
1955
1791
|
useChatServices,
|
|
1956
1792
|
useContextBinder,
|
|
1957
|
-
|
|
1793
|
+
useContextObjects,
|
|
1794
|
+
useFlush,
|
|
1795
|
+
useItemTypes,
|
|
1958
1796
|
useOnline,
|
|
1959
1797
|
usePresets,
|
|
1798
|
+
useReferencesProvider,
|
|
1960
1799
|
ChatContextProvider,
|
|
1961
1800
|
useChatContext,
|
|
1962
|
-
Chat
|
|
1963
|
-
AiService2 as AiService,
|
|
1964
|
-
AppGraphBuilder,
|
|
1965
|
-
AssistantState,
|
|
1966
|
-
BlueprintDefinition,
|
|
1967
|
-
EdgeModelResolver,
|
|
1968
|
-
IntentResolver,
|
|
1969
|
-
LocalModelResolver,
|
|
1970
|
-
ReactSurface,
|
|
1971
|
-
Settings,
|
|
1972
|
-
Toolkit,
|
|
1973
|
-
ComputeRuntime
|
|
1801
|
+
Chat
|
|
1974
1802
|
};
|
|
1975
|
-
//# sourceMappingURL=chunk-
|
|
1803
|
+
//# sourceMappingURL=chunk-YZYGXFVG.mjs.map
|