@dxos/plugin-assistant 0.8.4-main.c1de068 → 0.8.4-main.fd6878d
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/{TemplateContainer-RPJ2LBOB.mjs → BlueprintContainer-H7H4BQ2C.mjs} +11 -9
- package/dist/lib/browser/BlueprintContainer-H7H4BQ2C.mjs.map +7 -0
- package/dist/lib/browser/{ChatContainer-M3IHQLRS.mjs → ChatContainer-OUVSX5V5.mjs} +35 -13
- package/dist/lib/browser/ChatContainer-OUVSX5V5.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-X6VN6QZI.mjs → ChatDialog-P4FLEOHG.mjs} +21 -7
- package/dist/lib/browser/ChatDialog-P4FLEOHG.mjs.map +7 -0
- package/dist/lib/browser/{SequenceContainer-3UDVKWPA.mjs → SequenceContainer-627OQ557.mjs} +3 -2
- package/dist/lib/browser/SequenceContainer-627OQ557.mjs.map +7 -0
- package/dist/lib/browser/ai-service-7KJ5LXBT.mjs +22 -0
- package/dist/lib/browser/ai-service-7KJ5LXBT.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-JTXBKE7O.mjs → app-graph-builder-AVHHQ3KV.mjs} +17 -74
- package/dist/lib/browser/app-graph-builder-AVHHQ3KV.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs +146 -0
- package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs.map +7 -0
- package/dist/lib/browser/chunk-BRLHDHOF.mjs +244 -0
- package/dist/lib/browser/chunk-BRLHDHOF.mjs.map +7 -0
- package/dist/lib/browser/chunk-HRLMD35M.mjs +191 -0
- package/dist/lib/browser/chunk-HRLMD35M.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-LKP65RPA.mjs +20 -0
- package/dist/lib/browser/{chunk-FDCJSQYF.mjs.map → chunk-LKP65RPA.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-AEAEKWOC.mjs → chunk-NZDCKQ6W.mjs} +12 -21
- package/dist/lib/browser/chunk-NZDCKQ6W.mjs.map +7 -0
- package/dist/lib/browser/chunk-QB7OVS6Z.mjs +16 -0
- package/dist/lib/browser/chunk-QB7OVS6Z.mjs.map +7 -0
- package/dist/lib/browser/{chunk-OWY4CUQY.mjs → chunk-VEBVAHNM.mjs} +799 -813
- package/dist/lib/browser/chunk-VEBVAHNM.mjs.map +7 -0
- package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs +24 -0
- package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +96 -51
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-5RMMCMXG.mjs → intent-resolver-MVOIEJXZ.mjs} +33 -12
- package/dist/lib/browser/intent-resolver-MVOIEJXZ.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-66VY37YQ.mjs → react-surface-4HXS3YLT.mjs} +45 -32
- package/dist/lib/browser/react-surface-4HXS3YLT.mjs.map +7 -0
- package/dist/lib/browser/{settings-2DGP3UTS.mjs → settings-G2EZXMWT.mjs} +6 -5
- package/dist/lib/{node-esm/settings-47RYZOU4.mjs.map → browser/settings-G2EZXMWT.mjs.map} +1 -1
- package/dist/lib/browser/toolkit-IW4FBLLB.mjs +105 -0
- package/dist/lib/browser/toolkit-IW4FBLLB.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -4
- package/dist/lib/node-esm/{TemplateContainer-A3NAQCZE.mjs → BlueprintContainer-VH4EE4CM.mjs} +11 -9
- package/dist/lib/node-esm/BlueprintContainer-VH4EE4CM.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatContainer-VZT74PO2.mjs → ChatContainer-D5FABDNE.mjs} +35 -13
- package/dist/lib/node-esm/ChatContainer-D5FABDNE.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-RJ6FDX4Q.mjs → ChatDialog-NKWVXHJP.mjs} +21 -7
- package/dist/lib/node-esm/ChatDialog-NKWVXHJP.mjs.map +7 -0
- package/dist/lib/node-esm/{SequenceContainer-RQQH5XOC.mjs → SequenceContainer-EQ5NP2PG.mjs} +3 -2
- package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs.map +7 -0
- package/dist/lib/node-esm/ai-service-LDD32477.mjs +23 -0
- package/dist/lib/node-esm/ai-service-LDD32477.mjs.map +7 -0
- package/dist/lib/node-esm/{app-graph-builder-OWSOXFTD.mjs → app-graph-builder-RMOUJMMG.mjs} +17 -74
- package/dist/lib/node-esm/app-graph-builder-RMOUJMMG.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs +147 -0
- package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-SENTQAEO.mjs → chunk-3SOC5GOP.mjs} +799 -813
- package/dist/lib/node-esm/chunk-3SOC5GOP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-F7RXCX5Y.mjs +192 -0
- package/dist/lib/node-esm/chunk-F7RXCX5Y.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-2XL6MNPE.mjs → chunk-GAWXJ7K5.mjs} +12 -21
- package/dist/lib/node-esm/chunk-GAWXJ7K5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KOC6ESG7.mjs +22 -0
- package/dist/lib/node-esm/{chunk-QN2H2EHV.mjs.map → chunk-KOC6ESG7.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-RD755HN3.mjs +245 -0
- package/dist/lib/node-esm/chunk-RD755HN3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-X6AANUHZ.mjs +17 -0
- package/dist/lib/node-esm/chunk-X6AANUHZ.mjs.map +7 -0
- package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs +25 -0
- package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +96 -51
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-YPPYELY3.mjs → intent-resolver-DTDNCX3C.mjs} +33 -12
- package/dist/lib/node-esm/intent-resolver-DTDNCX3C.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-RJMRBR2M.mjs → react-surface-V6JNEZVO.mjs} +45 -32
- package/dist/lib/node-esm/react-surface-V6JNEZVO.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-47RYZOU4.mjs → settings-AIP5FOJG.mjs} +6 -5
- package/dist/lib/{browser/settings-2DGP3UTS.mjs.map → node-esm/settings-AIP5FOJG.mjs.map} +1 -1
- package/dist/lib/node-esm/toolkit-2VNUL77B.mjs +106 -0
- package/dist/lib/node-esm/toolkit-2VNUL77B.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +7 -4
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-service.d.ts +5 -0
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +11 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +5 -0
- 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/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts +5 -0
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/BlueprintContainer.d.ts +8 -0
- package/dist/types/src/components/BlueprintContainer.d.ts.map +1 -0
- package/dist/types/src/components/Chat/Chat.d.ts +6 -8
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer.d.ts +5 -4
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +13 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +3 -3
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +4 -3
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +2 -2
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +33 -48
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/SequenceContainer.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +1 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +2 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/Timeline/Timeline.d.ts +24 -0
- package/dist/types/src/components/Timeline/Timeline.d.ts.map +1 -0
- package/dist/types/src/components/Timeline/Timeline.stories.d.ts +9 -0
- package/dist/types/src/components/Timeline/Timeline.stories.d.ts.map +1 -0
- package/dist/types/src/components/Timeline/index.d.ts +2 -0
- package/dist/types/src/components/Timeline/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +4 -7
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +1 -2
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/functions/analysis.d.ts +5 -0
- package/dist/types/src/functions/analysis.d.ts.map +1 -0
- package/dist/types/src/functions/index.d.ts +4 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/list.d.ts +10 -0
- package/dist/types/src/functions/list.d.ts.map +1 -0
- package/dist/types/src/functions/load.d.ts +8 -0
- package/dist/types/src/functions/load.d.ts.map +1 -0
- package/dist/types/src/hooks/chat-processor.d.ts +28 -42
- package/dist/types/src/hooks/chat-processor.d.ts.map +1 -1
- package/dist/types/src/hooks/errors.d.ts +4 -0
- package/dist/types/src/hooks/errors.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +5 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/presets.d.ts +2 -2
- package/dist/types/src/hooks/presets.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +21 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +7 -14
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +3 -4
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useOnline.d.ts +3 -0
- package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
- package/dist/types/src/hooks/usePresets.d.ts +7 -0
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/hooks/useResolveRef.d.ts +4 -0
- package/dist/types/src/hooks/useResolveRef.d.ts.map +1 -0
- package/dist/types/src/parser/filter-generator.d.ts.map +1 -1
- package/dist/types/src/parser/query-parser.d.ts.map +1 -1
- package/dist/types/src/stories/Chat.stories.d.ts +68 -49
- package/dist/types/src/stories/Chat.stories.d.ts.map +1 -1
- package/dist/types/src/stories/components/BlueprintContainer.d.ts +5 -0
- package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/ChatContainer.d.ts +5 -0
- package/dist/types/src/stories/components/ChatContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/GraphContainer.d.ts +6 -0
- package/dist/types/src/stories/components/GraphContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/LoggingContainer.d.ts +5 -0
- package/dist/types/src/stories/components/LoggingContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/SurfaceContainer.d.ts +8 -0
- package/dist/types/src/stories/components/SurfaceContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/TasksContainer.d.ts +5 -0
- package/dist/types/src/stories/components/TasksContainer.d.ts.map +1 -0
- package/dist/types/src/stories/components/index.d.ts +8 -0
- package/dist/types/src/stories/components/index.d.ts.map +1 -0
- package/dist/types/src/stories/components/types.d.ts +7 -0
- package/dist/types/src/stories/components/types.d.ts.map +1 -0
- package/dist/types/src/stories/hooks/index.d.ts +3 -0
- package/dist/types/src/stories/hooks/index.d.ts.map +1 -0
- package/dist/types/src/stories/hooks/useFlush.d.ts +6 -0
- package/dist/types/src/stories/hooks/useFlush.d.ts.map +1 -0
- package/dist/types/src/stories/hooks/useMatcherExtension.d.ts +3 -0
- package/dist/types/src/stories/hooks/useMatcherExtension.d.ts.map +1 -0
- package/dist/types/src/stories/testing/data.d.ts +142 -0
- package/dist/types/src/stories/testing/data.d.ts.map +1 -0
- package/dist/types/src/stories/testing/index.d.ts +3 -0
- package/dist/types/src/stories/testing/index.d.ts.map +1 -0
- package/dist/types/src/stories/testing/testing.d.ts +26 -0
- package/dist/types/src/stories/testing/testing.d.ts.map +1 -0
- package/dist/types/src/testing/test-functions.d.ts +5 -2
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/tools/function.d.ts.map +1 -1
- package/dist/types/src/tools/openapi.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +6 -10
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +40 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -0
- package/dist/types/src/types/AssistantAction.d.ts +90 -0
- package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
- package/dist/types/src/types/defs.d.ts +2 -0
- package/dist/types/src/types/defs.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +6 -6
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +81 -75
- package/src/AssistantPlugin.tsx +59 -12
- package/src/capabilities/ai-service.ts +28 -0
- package/src/capabilities/app-graph-builder.ts +9 -93
- package/src/capabilities/blueprint-definition.ts +32 -0
- package/src/capabilities/capabilities.ts +22 -0
- package/src/capabilities/edge-model-resolver.ts +29 -0
- package/src/capabilities/index.ts +6 -0
- package/src/capabilities/intent-resolver.ts +24 -9
- package/src/capabilities/react-surface.tsx +29 -22
- package/src/capabilities/toolkit.ts +106 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +1 -1
- package/src/components/BlueprintContainer.tsx +24 -0
- package/src/components/Chat/Chat.tsx +77 -64
- package/src/components/ChatContainer.tsx +37 -13
- package/src/components/ChatDialog.tsx +9 -5
- package/src/components/ChatPrompt/ChatOptions.tsx +59 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +11 -9
- package/src/components/ChatPrompt/index.ts +1 -1
- package/src/components/ChatThread/ChatMessage.tsx +132 -118
- package/src/components/ChatThread/ChatThread.stories.tsx +220 -103
- package/src/components/ChatThread/ChatThread.tsx +2 -2
- package/src/components/ChatThread/Link.tsx +39 -0
- package/src/components/ChatThread/ToolBlock.tsx +20 -16
- package/src/components/SequenceContainer.tsx +2 -1
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +3 -2
- package/src/components/SequenceEditor/SequenceEditor.tsx +1 -1
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +12 -5
- package/src/components/TemplateEditor/TemplateEditor.tsx +15 -12
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +12 -5
- package/src/components/TemplateEditor/TemplateForm.tsx +5 -3
- package/src/components/Timeline/Timeline.stories.tsx +53 -0
- package/src/components/Timeline/Timeline.tsx +159 -0
- package/src/components/Timeline/index.ts +5 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +6 -12
- package/src/components/Toolbox/Toolbox.tsx +16 -40
- package/src/components/index.ts +2 -5
- package/src/events.ts +2 -2
- package/src/functions/analysis.ts +20 -0
- package/src/functions/index.ts +7 -0
- package/src/functions/list.ts +42 -0
- package/src/functions/load.ts +43 -0
- package/src/hooks/chat-processor.ts +123 -177
- package/src/hooks/errors.ts +8 -0
- package/src/hooks/index.ts +5 -1
- package/src/hooks/presets.ts +6 -5
- package/src/hooks/useBlueprintRegistry.ts +79 -0
- package/src/hooks/useChatProcessor.ts +21 -83
- package/src/hooks/useChatServices.ts +35 -54
- package/src/hooks/useOnline.ts +10 -0
- package/src/hooks/usePresets.ts +45 -0
- package/src/hooks/useReferencesProvider.ts +11 -9
- package/src/hooks/useResolveRef.ts +33 -0
- package/src/parser/filter-generator.ts +6 -13
- package/src/parser/query-parser.ts +1 -1
- package/src/queue-logger.ts +5 -5
- package/src/stories/Chat.stories.tsx +238 -299
- package/src/stories/components/BlueprintContainer.tsx +34 -0
- package/src/stories/components/ChatContainer.tsx +80 -0
- package/src/stories/components/GraphContainer.tsx +118 -0
- package/src/stories/components/LoggingContainer.tsx +22 -0
- package/src/stories/components/SurfaceContainer.tsx +62 -0
- package/src/stories/components/TasksContainer.tsx +51 -0
- package/src/stories/components/index.ts +12 -0
- package/src/stories/components/types.ts +11 -0
- package/src/stories/hooks/index.ts +6 -0
- package/src/stories/hooks/useFlush.ts +35 -0
- package/src/stories/hooks/useMatcherExtension.ts +45 -0
- package/src/stories/testing/data.ts +130 -0
- package/src/stories/testing/index.ts +6 -0
- package/src/stories/testing/testing.tsx +162 -0
- package/src/testing/test-functions.ts +8 -3
- package/src/testing/test-sequence.ts +1 -1
- package/src/tools/function.ts +4 -1
- package/src/tools/openapi.test.ts +7 -5
- package/src/tools/openapi.ts +4 -1
- package/src/translations.ts +8 -10
- package/src/types/Assistant.ts +59 -0
- package/src/types/AssistantAction.ts +54 -0
- package/src/types/defs.ts +5 -0
- package/src/types/index.ts +4 -1
- package/dist/lib/browser/ChatContainer-M3IHQLRS.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-X6VN6QZI.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
- package/dist/lib/browser/TemplateContainer-RPJ2LBOB.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-JTXBKE7O.mjs.map +0 -7
- package/dist/lib/browser/chunk-AEAEKWOC.mjs.map +0 -7
- package/dist/lib/browser/chunk-EQDW6BYQ.mjs +0 -108
- package/dist/lib/browser/chunk-EQDW6BYQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
- package/dist/lib/browser/chunk-JQBVLTM5.mjs +0 -158
- package/dist/lib/browser/chunk-JQBVLTM5.mjs.map +0 -7
- package/dist/lib/browser/chunk-OWY4CUQY.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs.map +0 -7
- package/dist/lib/browser/react-surface-66VY37YQ.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-VZT74PO2.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-RJ6FDX4Q.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
- package/dist/lib/node-esm/TemplateContainer-A3NAQCZE.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-OWSOXFTD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2XL6MNPE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BISJDTBK.mjs +0 -159
- package/dist/lib/node-esm/chunk-BISJDTBK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-E33DNNDW.mjs +0 -109
- package/dist/lib/node-esm/chunk-E33DNNDW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
- package/dist/lib/node-esm/chunk-SENTQAEO.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs.map +0 -7
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
- package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
- package/dist/types/src/components/TemplateContainer.d.ts +0 -8
- package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
- package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
- package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -88
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
- package/src/components/TemplateContainer.tsx +0 -24
- package/src/hooks/chat-processor.test.ts +0 -16
- package/src/hooks/useBlueprints.ts +0 -57
- package/src/types/schema.ts +0 -95
|
@@ -2,110 +2,52 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { RegistryContext } from '@effect-rx/rx-react';
|
|
5
6
|
import { type Layer } from 'effect';
|
|
6
|
-
import {
|
|
7
|
+
import { useContext, useMemo } from 'react';
|
|
7
8
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { type ArtifactDefinition, type AssociatedArtifact, type Blueprint } from '@dxos/blueprints';
|
|
12
|
-
import { FunctionType } from '@dxos/functions';
|
|
9
|
+
import { useIntentDispatcher } from '@dxos/app-framework';
|
|
10
|
+
import { AiConversation } from '@dxos/assistant';
|
|
11
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
13
12
|
import { log } from '@dxos/log';
|
|
14
|
-
import {
|
|
15
|
-
import { Filter, fullyQualifiedId, type Queue, type Space, useQuery } from '@dxos/react-client/echo';
|
|
16
|
-
import { isNonNullable } from '@dxos/util';
|
|
13
|
+
import { type Queue, type Space, fullyQualifiedId } from '@dxos/react-client/echo';
|
|
17
14
|
|
|
18
|
-
import { type
|
|
19
|
-
import {
|
|
20
|
-
import { type Assistant, ServiceType } from '../types';
|
|
15
|
+
import { AiChatProcessor, type AiChatServices, type AiServicePreset } from '../hooks';
|
|
16
|
+
import { type Assistant } from '../types';
|
|
21
17
|
|
|
22
|
-
type UseChatProcessorProps = {
|
|
23
|
-
preset?: AiServicePreset;
|
|
18
|
+
export type UseChatProcessorProps = {
|
|
24
19
|
space?: Space;
|
|
25
20
|
chat?: Assistant.Chat;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
services?: Layer.Layer<ChatServices>;
|
|
21
|
+
preset?: AiServicePreset;
|
|
22
|
+
services?: Layer.Layer<AiChatServices>;
|
|
29
23
|
blueprintRegistry?: Blueprint.Registry;
|
|
30
|
-
// TODO(burdon): Not currently used.
|
|
31
24
|
settings?: Assistant.Settings;
|
|
32
|
-
|
|
33
|
-
/** @deprecated */
|
|
34
|
-
instructions?: string;
|
|
35
|
-
/** @deprecated */
|
|
36
|
-
artifact?: AssociatedArtifact;
|
|
37
|
-
/** @deprecated */
|
|
38
|
-
noPluginArtifacts?: boolean;
|
|
39
25
|
};
|
|
40
26
|
|
|
41
27
|
/**
|
|
42
|
-
* Configure and create
|
|
28
|
+
* Configure and create AiChatProcessor.
|
|
43
29
|
*/
|
|
44
30
|
export const useChatProcessor = ({
|
|
45
|
-
preset,
|
|
46
31
|
space,
|
|
47
32
|
chat,
|
|
33
|
+
preset,
|
|
48
34
|
services,
|
|
49
35
|
blueprintRegistry,
|
|
50
36
|
settings,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
noPluginArtifacts,
|
|
54
|
-
}: UseChatProcessorProps): ChatProcessor | undefined => {
|
|
37
|
+
}: UseChatProcessorProps): AiChatProcessor | undefined => {
|
|
38
|
+
const observableRegistry = useContext(RegistryContext);
|
|
55
39
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
56
|
-
const globalTools = useCapabilities(Capabilities.Tools);
|
|
57
|
-
|
|
58
|
-
// TODO(burdon): Spec artifacts.
|
|
59
|
-
let artifacts: readonly ArtifactDefinition[] = useCapabilities(Capabilities.ArtifactDefinition);
|
|
60
|
-
if (noPluginArtifacts) {
|
|
61
|
-
artifacts = Stable.array;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Services.
|
|
65
|
-
const remoteServices = useQuery(space, Filter.type(ServiceType));
|
|
66
|
-
const [serviceTools, setServiceTools] = useState<ExecutableTool[]>([]);
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
log('creating service tools...');
|
|
69
|
-
queueMicrotask(async () => {
|
|
70
|
-
const tools = await Promise.all(remoteServices.map((service) => createToolsFromService(service)));
|
|
71
|
-
setServiceTools(tools.flat());
|
|
72
|
-
});
|
|
73
|
-
}, [remoteServices]);
|
|
74
40
|
|
|
75
41
|
// Tools and context.
|
|
76
|
-
const config = useConfig();
|
|
77
|
-
const functions = useQuery(space, Filter.type(FunctionType));
|
|
78
42
|
const chatId = useMemo(() => (chat ? fullyQualifiedId(chat) : undefined), [chat]);
|
|
79
|
-
const
|
|
80
|
-
log('creating tools...');
|
|
81
|
-
const tools: ExecutableTool[] = [
|
|
82
|
-
...globalTools.flat(),
|
|
83
|
-
...serviceTools,
|
|
84
|
-
...functions
|
|
85
|
-
.map((fn) => convertFunctionToTool(fn, config.values.runtime?.services?.edge?.url ?? '', space?.id))
|
|
86
|
-
.filter(isNonNullable),
|
|
87
|
-
];
|
|
88
|
-
const extensions = { space, dispatch, pivotId: chatId };
|
|
89
|
-
return [tools, extensions];
|
|
90
|
-
}, [dispatch, globalTools, space, chatId, serviceTools, functions]);
|
|
91
|
-
|
|
92
|
-
// TODO(burdon): Create from template.
|
|
93
|
-
const systemPrompt = useMemo(
|
|
94
|
-
() =>
|
|
95
|
-
createSystemPrompt({
|
|
96
|
-
artifacts: artifacts.map((definition) => `${definition.name}\n${definition.instructions}`),
|
|
97
|
-
artifact,
|
|
98
|
-
instructions,
|
|
99
|
-
}),
|
|
100
|
-
[artifacts, artifact, instructions],
|
|
101
|
-
);
|
|
43
|
+
const extensions = useMemo(() => ({ space, dispatch, pivotId: chatId }), [dispatch, space, chatId]);
|
|
102
44
|
|
|
103
45
|
const conversation = useMemo(() => {
|
|
104
46
|
if (!chat?.queue.target) {
|
|
105
47
|
return;
|
|
106
48
|
}
|
|
107
49
|
|
|
108
|
-
return new
|
|
50
|
+
return new AiConversation({ queue: chat.queue.target as Queue<any> });
|
|
109
51
|
}, [chat?.queue.target]);
|
|
110
52
|
|
|
111
53
|
// Create processor.
|
|
@@ -115,23 +57,19 @@ export const useChatProcessor = ({
|
|
|
115
57
|
return undefined;
|
|
116
58
|
}
|
|
117
59
|
|
|
118
|
-
log
|
|
60
|
+
log('creating processor', {
|
|
119
61
|
preset,
|
|
120
|
-
artifacts: artifacts.length,
|
|
121
|
-
systemPrompt: systemPrompt.length,
|
|
122
62
|
model: preset?.model,
|
|
123
63
|
settings,
|
|
124
64
|
});
|
|
125
65
|
|
|
126
|
-
return new
|
|
127
|
-
tools,
|
|
66
|
+
return new AiChatProcessor(services, conversation, {
|
|
128
67
|
extensions,
|
|
129
68
|
blueprintRegistry,
|
|
130
|
-
|
|
131
|
-
systemPrompt,
|
|
69
|
+
observableRegistry,
|
|
132
70
|
model: preset?.model,
|
|
133
71
|
});
|
|
134
|
-
}, [services, conversation,
|
|
72
|
+
}, [services, conversation, blueprintRegistry, extensions, preset]);
|
|
135
73
|
|
|
136
74
|
return processor;
|
|
137
75
|
};
|
|
@@ -2,38 +2,36 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type AiTool, AiToolkit } from '@effect/ai';
|
|
5
6
|
import { Layer } from 'effect';
|
|
6
7
|
import { useMemo } from 'react';
|
|
7
|
-
import { useDeepCompareMemoize } from 'use-deep-compare-effect';
|
|
8
8
|
|
|
9
|
-
import { type AiService, type ToolExecutionService,
|
|
10
|
-
import { AiServiceTestingPreset } from '@dxos/ai/testing';
|
|
9
|
+
import { type AiService, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';
|
|
11
10
|
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
12
11
|
import { makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '@dxos/assistant';
|
|
13
12
|
import { type Space } from '@dxos/client/echo';
|
|
14
13
|
import {
|
|
15
|
-
|
|
14
|
+
ComputeEventLogger,
|
|
16
15
|
CredentialsService,
|
|
17
16
|
DatabaseService,
|
|
18
|
-
|
|
19
|
-
FunctionCallService,
|
|
17
|
+
LocalFunctionExecutionService,
|
|
20
18
|
QueueService,
|
|
19
|
+
RemoteFunctionExecutionService,
|
|
21
20
|
TracingService,
|
|
22
21
|
} from '@dxos/functions';
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
import { AssistantCapabilities } from '../capabilities';
|
|
25
24
|
|
|
26
25
|
// TODO(burdon): Deconstruct into separate layers?
|
|
27
|
-
export type
|
|
28
|
-
| AiService
|
|
26
|
+
export type AiChatServices =
|
|
27
|
+
| AiService.AiService
|
|
29
28
|
| CredentialsService
|
|
30
29
|
| DatabaseService
|
|
31
30
|
| QueueService
|
|
32
|
-
|
|
|
31
|
+
| RemoteFunctionExecutionService
|
|
33
32
|
| ToolResolverService
|
|
34
33
|
| ToolExecutionService
|
|
35
|
-
| TracingService
|
|
36
|
-
| EventLogger;
|
|
34
|
+
| TracingService;
|
|
37
35
|
|
|
38
36
|
export type UseChatServicesProps = {
|
|
39
37
|
space?: Space;
|
|
@@ -42,50 +40,33 @@ export type UseChatServicesProps = {
|
|
|
42
40
|
/**
|
|
43
41
|
* Construct service layer.
|
|
44
42
|
*/
|
|
45
|
-
export const useChatServices = ({ space }: UseChatServicesProps): Layer.Layer<
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
const
|
|
43
|
+
export const useChatServices = ({ space }: UseChatServicesProps): Layer.Layer<AiChatServices> | undefined => {
|
|
44
|
+
const serviceLayer = useCapabilities(AssistantCapabilities.AiServiceLayer).at(0) ?? Layer.die('AiService not found');
|
|
45
|
+
const functions = useCapabilities(Capabilities.Functions);
|
|
46
|
+
const toolkits = useCapabilities(Capabilities.Toolkit);
|
|
47
|
+
const handlers = useCapabilities(Capabilities.ToolkitHandler);
|
|
50
48
|
|
|
51
49
|
return useMemo(() => {
|
|
50
|
+
const allFunctions = functions.flat();
|
|
51
|
+
// TODO(wittjosiah): Don't cast.
|
|
52
|
+
const toolkit = AiToolkit.merge(...toolkits) as AiToolkit.Any as AiToolkit.AiToolkit<AiTool.Any>;
|
|
53
|
+
const handlersLayer = Layer.mergeAll(Layer.empty, ...handlers);
|
|
52
54
|
return Layer.mergeAll(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Layer.
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
serviceLayer,
|
|
56
|
+
makeToolResolverFromFunctions(allFunctions, toolkit),
|
|
57
|
+
makeToolExecutionServiceFromFunctions(allFunctions, toolkit, handlersLayer),
|
|
58
|
+
CredentialsService.layerFromDatabase(),
|
|
59
|
+
ComputeEventLogger.layerFromTracing,
|
|
60
|
+
).pipe(
|
|
61
|
+
Layer.provideMerge(
|
|
62
|
+
Layer.mergeAll(
|
|
63
|
+
space ? DatabaseService.layer(space.db) : DatabaseService.notAvailable,
|
|
64
|
+
space ? QueueService.layer(space.queues) : QueueService.notAvailable,
|
|
65
|
+
TracingService.layerNoop,
|
|
66
|
+
LocalFunctionExecutionService.layer,
|
|
67
|
+
RemoteFunctionExecutionService.mockLayer,
|
|
68
|
+
),
|
|
69
|
+
),
|
|
62
70
|
);
|
|
63
|
-
}, [space,
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const useToolResolver = (): Layer.Layer<ToolResolverService> => {
|
|
67
|
-
const functions = useCapabilities(Capabilities.Functions).flat();
|
|
68
|
-
return useMemo(() => makeToolResolverFromFunctions(functions), [useDeepCompareMemoize(functions.map((f) => f.name))]);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const useToolExecutionService = (): Layer.Layer<ToolExecutionService> => {
|
|
72
|
-
const functions = useCapabilities(Capabilities.Functions).flat();
|
|
73
|
-
return useMemo(
|
|
74
|
-
() => makeToolExecutionServiceFromFunctions(functions),
|
|
75
|
-
[useDeepCompareMemoize(functions.map((f) => f.name))],
|
|
76
|
-
);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
// TODO(burdon): Factor out.
|
|
80
|
-
const useToolRegistry = (): ToolRegistry => {
|
|
81
|
-
const tools = useCapabilities(Capabilities.Tools).flat();
|
|
82
|
-
return useMemo(() => {
|
|
83
|
-
const toolRegistry = new ToolRegistry([]);
|
|
84
|
-
for (const tool of tools) {
|
|
85
|
-
if (!toolRegistry.has(tool)) {
|
|
86
|
-
toolRegistry.register(tool);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return toolRegistry;
|
|
90
|
-
}, [useDeepCompareMemoize(tools)]);
|
|
71
|
+
}, [space, functions, toolkits, handlers]);
|
|
91
72
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Dispatch, type SetStateAction, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
export const useOnline = (): [boolean, Dispatch<SetStateAction<boolean>>] => {
|
|
8
|
+
const [online, setOnline] = useState(true);
|
|
9
|
+
return [online, setOnline];
|
|
10
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type ChatPromptProps } from '../components';
|
|
8
|
+
|
|
9
|
+
import { type AiServicePreset, AiServicePresets } from './presets';
|
|
10
|
+
|
|
11
|
+
export type UsePresets = {
|
|
12
|
+
preset: AiServicePreset | undefined;
|
|
13
|
+
} & Pick<ChatPromptProps, 'presets' | 'onChangePreset'>;
|
|
14
|
+
|
|
15
|
+
export const usePresets = (online: boolean): UsePresets => {
|
|
16
|
+
// TODO(burdon): Memo preset for provider.
|
|
17
|
+
const [preset, setPreset] = useState<AiServicePreset>();
|
|
18
|
+
const presets = useMemo(
|
|
19
|
+
() => AiServicePresets.filter((preset) => online === (preset.provider === 'dxos-remote')),
|
|
20
|
+
[online],
|
|
21
|
+
);
|
|
22
|
+
const presetOptions = useMemo(
|
|
23
|
+
() => presets.map(({ id, model, label }) => ({ id, label: label ?? model })),
|
|
24
|
+
[presets],
|
|
25
|
+
);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
setPreset(presets[0]);
|
|
28
|
+
}, [presets]);
|
|
29
|
+
|
|
30
|
+
const handleChangePreset = useCallback<NonNullable<ChatPromptProps['onChangePreset']>>(
|
|
31
|
+
(id) => {
|
|
32
|
+
const preset = presets.find((preset) => preset.id === id);
|
|
33
|
+
if (preset) {
|
|
34
|
+
setPreset(preset);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
[presets],
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
preset: preset,
|
|
42
|
+
presets: presetOptions,
|
|
43
|
+
onChangePreset: handleChangePreset,
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -6,15 +6,14 @@ import { useMemo } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
8
8
|
import { type Space } from '@dxos/client/echo';
|
|
9
|
-
import { Filter, Obj
|
|
9
|
+
import { Filter, Obj } from '@dxos/echo';
|
|
10
10
|
import { type ReferencesProvider } from '@dxos/react-ui-chat';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Resolve references to objects in the space.
|
|
14
14
|
*/
|
|
15
15
|
export const useReferencesProvider = (space?: Space): ReferencesProvider | undefined => {
|
|
16
|
-
|
|
17
|
-
const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
|
|
16
|
+
const blueprints = useCapabilities(Capabilities.BlueprintDefinition);
|
|
18
17
|
|
|
19
18
|
return useMemo<ReferencesProvider | undefined>((): ReferencesProvider | undefined => {
|
|
20
19
|
if (!space) {
|
|
@@ -23,10 +22,13 @@ export const useReferencesProvider = (space?: Space): ReferencesProvider | undef
|
|
|
23
22
|
|
|
24
23
|
return {
|
|
25
24
|
getReferences: async ({ query }) => {
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
// TODO(burdon): Previously we filtered by types declared by the artifact definitions.
|
|
26
|
+
// const schemas = blueprints.map((blueprint) => blueprint.schema).flat();
|
|
27
|
+
// const { objects } = await space.db
|
|
28
|
+
// .query(Filter.or(...schemas.map((schema) => Filter.type(schema as Type.Schema))))
|
|
29
|
+
// .run();
|
|
30
|
+
|
|
31
|
+
const { objects } = await space.db.query(Filter.everything()).run();
|
|
30
32
|
|
|
31
33
|
return (
|
|
32
34
|
objects
|
|
@@ -39,7 +41,7 @@ export const useReferencesProvider = (space?: Space): ReferencesProvider | undef
|
|
|
39
41
|
// TODO(dmaretskyi): `Type.getDXN` (at the point of writing) didn't work here as it was schema-only.
|
|
40
42
|
.filter((object) => !!Obj.getDXN(object as Obj.Any))
|
|
41
43
|
.map((object) => ({
|
|
42
|
-
uri: Obj.getDXN(object as any)
|
|
44
|
+
uri: Obj.getDXN(object as any).toString(),
|
|
43
45
|
label: Obj.getLabel(object as any) ?? '',
|
|
44
46
|
}))
|
|
45
47
|
);
|
|
@@ -49,7 +51,7 @@ export const useReferencesProvider = (space?: Space): ReferencesProvider | undef
|
|
|
49
51
|
return { uri, label: Obj.getLabel(object) ?? '' };
|
|
50
52
|
},
|
|
51
53
|
} satisfies ReferencesProvider;
|
|
52
|
-
}, [space,
|
|
54
|
+
}, [space, blueprints]);
|
|
53
55
|
};
|
|
54
56
|
|
|
55
57
|
const stringMatch = (query: string, label: string) => label.toLowerCase().startsWith(query.toLowerCase());
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useMemo, useSyncExternalStore } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Space } from '@dxos/client/echo';
|
|
8
|
+
import { type Ref } from '@dxos/echo';
|
|
9
|
+
|
|
10
|
+
// TODO(burdon): Factor out.
|
|
11
|
+
export const useResolvedRef = <T>(space: Space, ref: Ref.Ref<T>): T | undefined => {
|
|
12
|
+
const { subscribe, getSnapshot } = useMemo(() => {
|
|
13
|
+
const resolver = space.db.graph.createRefResolver({});
|
|
14
|
+
let currentCallback: (() => void) | undefined = undefined;
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
subscribe: (cb: () => void) => {
|
|
18
|
+
currentCallback = cb;
|
|
19
|
+
return () => {
|
|
20
|
+
if (currentCallback === cb) {
|
|
21
|
+
currentCallback = undefined;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
getSnapshot: () =>
|
|
26
|
+
resolver?.resolveSync(ref.dxn, true, () => {
|
|
27
|
+
currentCallback?.();
|
|
28
|
+
}) as T | undefined,
|
|
29
|
+
};
|
|
30
|
+
}, [space, ref.dxn.toString()]);
|
|
31
|
+
|
|
32
|
+
return useSyncExternalStore<T | undefined>(subscribe, getSnapshot);
|
|
33
|
+
};
|
|
@@ -4,14 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { Filter } from '@dxos/echo';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
type BinaryExpression,
|
|
9
|
-
type Expression,
|
|
10
|
-
type Identifier,
|
|
11
|
-
type Literal,
|
|
12
|
-
type RelationalOperator,
|
|
13
|
-
type UnaryExpression,
|
|
14
|
-
} from './types';
|
|
7
|
+
import { type Expression, type Identifier, type Literal, type RelationalOperator } from './types';
|
|
15
8
|
|
|
16
9
|
const relationalOperators: Record<RelationalOperator, (value: any) => Filter<any>> = {
|
|
17
10
|
EQ: Filter.eq,
|
|
@@ -26,7 +19,7 @@ const specialPredicates: Record<string, (value: string) => Filter<any>> = {
|
|
|
26
19
|
export const createFilter = (ast: Expression): Filter<any> => {
|
|
27
20
|
switch (ast.type) {
|
|
28
21
|
case 'binary': {
|
|
29
|
-
const { operator, left, right } = ast
|
|
22
|
+
const { operator, left, right } = ast;
|
|
30
23
|
|
|
31
24
|
// Handle logical operators.
|
|
32
25
|
if (operator === 'AND') {
|
|
@@ -44,7 +37,7 @@ export const createFilter = (ast: Expression): Filter<any> => {
|
|
|
44
37
|
}
|
|
45
38
|
|
|
46
39
|
// Handle relational operators
|
|
47
|
-
const filterFn = relationalOperators[operator
|
|
40
|
+
const filterFn = relationalOperators[operator];
|
|
48
41
|
if (filterFn) {
|
|
49
42
|
return filterFn((right as Literal).value);
|
|
50
43
|
}
|
|
@@ -53,7 +46,7 @@ export const createFilter = (ast: Expression): Filter<any> => {
|
|
|
53
46
|
}
|
|
54
47
|
|
|
55
48
|
case 'unary': {
|
|
56
|
-
const { operator, argument } = ast
|
|
49
|
+
const { operator, argument } = ast;
|
|
57
50
|
if (operator === 'NOT') {
|
|
58
51
|
return Filter.not(createFilter(argument));
|
|
59
52
|
}
|
|
@@ -61,12 +54,12 @@ export const createFilter = (ast: Expression): Filter<any> => {
|
|
|
61
54
|
}
|
|
62
55
|
|
|
63
56
|
case 'identifier': {
|
|
64
|
-
const { name } = ast
|
|
57
|
+
const { name } = ast;
|
|
65
58
|
return Filter._props({ [name]: true });
|
|
66
59
|
}
|
|
67
60
|
|
|
68
61
|
case 'literal': {
|
|
69
|
-
const { value } = ast
|
|
62
|
+
const { value } = ast;
|
|
70
63
|
// Handle special '*' value for empty input.
|
|
71
64
|
if (value === '*') {
|
|
72
65
|
return Filter.everything();
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { invariant } from '@dxos/invariant';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type BinaryOperator, type Expression, type RelationalOperator } from './types';
|
|
8
8
|
|
|
9
9
|
// TODO(burdon): Move to echo-schema?
|
|
10
10
|
|
package/src/queue-logger.ts
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type Queue, Ref, type Space, getSpace } from '@dxos/client/echo';
|
|
6
6
|
import { type Sequence, type SequenceEvent, type SequenceLogger } from '@dxos/conductor';
|
|
7
7
|
import { DXN, Key, Obj } from '@dxos/echo';
|
|
8
8
|
import {
|
|
9
9
|
InvocationOutcome,
|
|
10
10
|
InvocationTraceEndEvent,
|
|
11
|
+
type InvocationTraceEvent,
|
|
11
12
|
InvocationTraceEventType,
|
|
12
13
|
InvocationTraceStartEvent,
|
|
13
14
|
TraceEvent,
|
|
14
|
-
type InvocationTraceEvent,
|
|
15
15
|
} from '@dxos/functions';
|
|
16
16
|
import { invariant } from '@dxos/invariant';
|
|
17
17
|
import { QueueSubspaceTags } from '@dxos/keys';
|
|
@@ -62,7 +62,7 @@ export class QueueLogger implements SequenceLogger {
|
|
|
62
62
|
Obj.make(TraceEvent, {
|
|
63
63
|
outcome: event.type,
|
|
64
64
|
truncated: false,
|
|
65
|
-
|
|
65
|
+
ingestionTimestamp: Date.now(),
|
|
66
66
|
logs: [
|
|
67
67
|
{
|
|
68
68
|
timestampMs: Date.now(),
|
|
@@ -80,7 +80,7 @@ export class QueueLogger implements SequenceLogger {
|
|
|
80
80
|
Obj.make(TraceEvent, {
|
|
81
81
|
outcome: event.type,
|
|
82
82
|
truncated: false,
|
|
83
|
-
|
|
83
|
+
ingestionTimestamp: Date.now(),
|
|
84
84
|
logs: [
|
|
85
85
|
{
|
|
86
86
|
timestampMs: Date.now(),
|
|
@@ -98,7 +98,7 @@ export class QueueLogger implements SequenceLogger {
|
|
|
98
98
|
Obj.make(TraceEvent, {
|
|
99
99
|
outcome: event.type,
|
|
100
100
|
truncated: false,
|
|
101
|
-
|
|
101
|
+
ingestionTimestamp: Date.now(),
|
|
102
102
|
logs: [
|
|
103
103
|
{
|
|
104
104
|
timestampMs: Date.now(),
|