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