@dxos/plugin-assistant 0.8.4-main.67995b8 → 0.8.4-main.f5c0578
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-IZ4AK5EO.mjs → BlueprintContainer-H7H4BQ2C.mjs} +4 -3
- package/dist/lib/browser/{ChatContainer-RP3QEXYX.mjs → ChatContainer-SB7YC2XP.mjs} +37 -14
- package/dist/lib/browser/ChatContainer-SB7YC2XP.mjs.map +7 -0
- package/dist/lib/browser/{ChatDialog-ZVLXFHEY.mjs → ChatDialog-X6PFOQSQ.mjs} +23 -8
- package/dist/lib/browser/ChatDialog-X6PFOQSQ.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-XSEOKJLG.mjs → app-graph-builder-ERU5XY2S.mjs} +14 -12
- package/dist/lib/browser/app-graph-builder-ERU5XY2S.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-63GG6U6D.mjs → chunk-BVH6VK6Q.mjs} +817 -789
- package/dist/lib/browser/chunk-BVH6VK6Q.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-JBFDQMUJ.mjs +193 -0
- package/dist/lib/browser/chunk-JBFDQMUJ.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-KFXSBNZR.mjs → chunk-NZDCKQ6W.mjs} +3 -3
- package/dist/lib/{node-esm/chunk-VIIMA3XQ.mjs.map → browser/chunk-NZDCKQ6W.mjs.map} +2 -2
- package/dist/lib/browser/chunk-QB7OVS6Z.mjs +16 -0
- package/dist/lib/browser/chunk-QB7OVS6Z.mjs.map +7 -0
- package/dist/lib/browser/chunk-Y66UJUHV.mjs +280 -0
- package/dist/lib/browser/chunk-Y66UJUHV.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 +83 -48
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-MV3VSZLS.mjs → intent-resolver-DGRO2XSG.mjs} +20 -14
- package/dist/lib/browser/intent-resolver-DGRO2XSG.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-3GYEHQRP.mjs → react-surface-LPSIBHEJ.mjs} +36 -23
- package/dist/lib/browser/react-surface-LPSIBHEJ.mjs.map +7 -0
- package/dist/lib/browser/{settings-5GTTCVGD.mjs → settings-ZFNQYSYP.mjs} +6 -5
- package/dist/lib/{node-esm/settings-J2EXEM5H.mjs.map → browser/settings-ZFNQYSYP.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/{BlueprintContainer-RGTMNLNX.mjs → BlueprintContainer-VH4EE4CM.mjs} +4 -3
- package/dist/lib/{browser/BlueprintContainer-IZ4AK5EO.mjs.map → node-esm/BlueprintContainer-VH4EE4CM.mjs.map} +1 -1
- package/dist/lib/node-esm/{ChatContainer-W3W6FWV3.mjs → ChatContainer-7JLMWHMX.mjs} +37 -14
- package/dist/lib/node-esm/ChatContainer-7JLMWHMX.mjs.map +7 -0
- package/dist/lib/node-esm/{ChatDialog-QW4JRKVO.mjs → ChatDialog-QDD722F2.mjs} +23 -8
- package/dist/lib/node-esm/ChatDialog-QDD722F2.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-PANCJUHV.mjs → app-graph-builder-RCT4ANP2.mjs} +14 -12
- package/dist/lib/node-esm/app-graph-builder-RCT4ANP2.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-BFO3KHYL.mjs → chunk-ETS2CIDF.mjs} +817 -789
- package/dist/lib/node-esm/chunk-ETS2CIDF.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VIIMA3XQ.mjs → chunk-GAWXJ7K5.mjs} +3 -3
- package/dist/lib/{browser/chunk-KFXSBNZR.mjs.map → node-esm/chunk-GAWXJ7K5.mjs.map} +2 -2
- package/dist/lib/node-esm/chunk-GENVBE3B.mjs +194 -0
- package/dist/lib/node-esm/chunk-GENVBE3B.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-QS6GWTVA.mjs +281 -0
- package/dist/lib/node-esm/chunk-QS6GWTVA.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 +83 -48
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-3FMC3GHC.mjs → intent-resolver-7CKWG7TZ.mjs} +20 -14
- package/dist/lib/node-esm/intent-resolver-7CKWG7TZ.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-QDQWJ7FZ.mjs → react-surface-3EPAE4I4.mjs} +36 -23
- package/dist/lib/node-esm/react-surface-3EPAE4I4.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-J2EXEM5H.mjs → settings-UI4VQCWW.mjs} +6 -5
- package/dist/lib/{browser/settings-5GTTCVGD.mjs.map → node-esm/settings-UI4VQCWW.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/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 -6
- 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.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.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 +42 -0
- package/dist/types/src/components/Timeline/Timeline.d.ts.map +1 -0
- package/dist/types/src/components/Timeline/Timeline.stories.d.ts +11 -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 +2 -1
- 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/execution-graph/execution-graph.d.ts +21 -0
- package/dist/types/src/execution-graph/execution-graph.d.ts.map +1 -0
- package/dist/types/src/execution-graph/index.d.ts +2 -0
- package/dist/types/src/execution-graph/index.d.ts.map +1 -0
- 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 +6 -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 +4 -3
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useExecutionGraph.d.ts +7 -0
- package/dist/types/src/hooks/useExecutionGraph.d.ts.map +1 -0
- 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 +66 -5
- 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 +5 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +42 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -0
- package/dist/types/src/types/AssistantAction.d.ts +91 -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 +85 -79
- package/src/AssistantPlugin.tsx +37 -16
- package/src/capabilities/ai-service.ts +28 -0
- package/src/capabilities/app-graph-builder.ts +8 -8
- 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 +13 -12
- package/src/capabilities/react-surface.tsx +22 -15
- package/src/capabilities/toolkit.ts +106 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +1 -1
- package/src/components/Chat/Chat.tsx +77 -64
- package/src/components/ChatContainer.tsx +38 -14
- package/src/components/ChatDialog.tsx +10 -6
- 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 +141 -118
- package/src/components/ChatThread/ChatThread.stories.tsx +236 -104
- package/src/components/ChatThread/ChatThread.tsx +2 -2
- package/src/components/ChatThread/Link.tsx +23 -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 +9 -2
- package/src/components/TemplateEditor/TemplateEditor.tsx +3 -2
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +9 -2
- package/src/components/TemplateEditor/TemplateForm.tsx +2 -1
- package/src/components/Timeline/Timeline.stories.tsx +144 -0
- package/src/components/Timeline/Timeline.tsx +202 -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 +1 -4
- package/src/events.ts +2 -2
- package/src/execution-graph/execution-graph.ts +184 -0
- package/src/execution-graph/index.ts +5 -0
- 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 +6 -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 +29 -22
- package/src/hooks/useExecutionGraph.ts +16 -0
- 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 +236 -290
- 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 +29 -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 +163 -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 +7 -0
- package/src/types/Assistant.ts +62 -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-RP3QEXYX.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-ZVLXFHEY.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-XSEOKJLG.mjs.map +0 -7
- package/dist/lib/browser/chunk-63GG6U6D.mjs.map +0 -7
- package/dist/lib/browser/chunk-7W7LHTRH.mjs +0 -171
- package/dist/lib/browser/chunk-7W7LHTRH.mjs.map +0 -7
- package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
- package/dist/lib/browser/chunk-LERGF5YG.mjs +0 -108
- package/dist/lib/browser/chunk-LERGF5YG.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs.map +0 -7
- package/dist/lib/browser/react-surface-3GYEHQRP.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-W3W6FWV3.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-QW4JRKVO.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-PANCJUHV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BFO3KHYL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MS3PJARN.mjs +0 -109
- package/dist/lib/node-esm/chunk-MS3PJARN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs +0 -172
- package/dist/lib/node-esm/chunk-Z7PUODRT.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs.map +0 -7
- package/dist/types/src/capability-definitions.d.ts +0 -7
- package/dist/types/src/capability-definitions.d.ts.map +0 -1
- 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/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 -120
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capability-definitions.ts +0 -15
- package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
- package/src/hooks/chat-processor.test.ts +0 -16
- package/src/hooks/useBlueprints.ts +0 -57
- package/src/types/schema.ts +0 -108
- /package/dist/lib/{node-esm/BlueprintContainer-RGTMNLNX.mjs.map → browser/BlueprintContainer-H7H4BQ2C.mjs.map} +0 -0
|
@@ -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,9 +2,9 @@
|
|
|
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
9
|
import { type AiService, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';
|
|
10
10
|
import { Capabilities, useCapabilities } from '@dxos/app-framework';
|
|
@@ -20,13 +20,12 @@ import {
|
|
|
20
20
|
TracingService,
|
|
21
21
|
} from '@dxos/functions';
|
|
22
22
|
|
|
23
|
-
import { AssistantCapabilities } from '../
|
|
24
|
-
|
|
25
|
-
export * from '@dxos/assistant';
|
|
23
|
+
import { AssistantCapabilities } from '../capabilities';
|
|
24
|
+
import type { Assistant } from '../types';
|
|
26
25
|
|
|
27
26
|
// TODO(burdon): Deconstruct into separate layers?
|
|
28
|
-
export type
|
|
29
|
-
| AiService
|
|
27
|
+
export type AiChatServices =
|
|
28
|
+
| AiService.AiService
|
|
30
29
|
| CredentialsService
|
|
31
30
|
| DatabaseService
|
|
32
31
|
| QueueService
|
|
@@ -37,31 +36,39 @@ export type ChatServices =
|
|
|
37
36
|
|
|
38
37
|
export type UseChatServicesProps = {
|
|
39
38
|
space?: Space;
|
|
39
|
+
chat?: Assistant.Chat;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* Construct service layer.
|
|
44
44
|
*/
|
|
45
|
-
export const useChatServices = ({ space }: UseChatServicesProps): Layer.Layer<
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
const
|
|
45
|
+
export const useChatServices = ({ space, chat }: UseChatServicesProps): Layer.Layer<AiChatServices> | undefined => {
|
|
46
|
+
const serviceLayer = useCapabilities(AssistantCapabilities.AiServiceLayer).at(0) ?? Layer.die('AiService not found');
|
|
47
|
+
const functions = useCapabilities(Capabilities.Functions);
|
|
48
|
+
const toolkits = useCapabilities(Capabilities.Toolkit);
|
|
49
|
+
const handlers = useCapabilities(Capabilities.ToolkitHandler);
|
|
49
50
|
|
|
50
51
|
return useMemo(() => {
|
|
52
|
+
const allFunctions = functions.flat();
|
|
53
|
+
// TODO(wittjosiah): Don't cast.
|
|
54
|
+
const toolkit = AiToolkit.merge(...toolkits) as AiToolkit.Any as AiToolkit.AiToolkit<AiTool.Any>;
|
|
55
|
+
const handlersLayer = Layer.mergeAll(Layer.empty, ...handlers);
|
|
51
56
|
return Layer.mergeAll(
|
|
52
|
-
|
|
53
|
-
makeToolResolverFromFunctions(
|
|
54
|
-
makeToolExecutionServiceFromFunctions(
|
|
55
|
-
|
|
56
|
-
CredentialsService.configuredLayer([]),
|
|
57
|
-
space ? DatabaseService.makeLayer(space.db) : DatabaseService.notAvailable,
|
|
58
|
-
space ? QueueService.makeLayer(space.queues) : QueueService.notAvailable,
|
|
59
|
-
|
|
57
|
+
serviceLayer,
|
|
58
|
+
makeToolResolverFromFunctions(allFunctions, toolkit),
|
|
59
|
+
makeToolExecutionServiceFromFunctions(allFunctions, toolkit, handlersLayer),
|
|
60
|
+
CredentialsService.layerFromDatabase(),
|
|
60
61
|
ComputeEventLogger.layerFromTracing,
|
|
61
62
|
).pipe(
|
|
62
|
-
Layer.provideMerge(
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
Layer.provideMerge(
|
|
64
|
+
Layer.mergeAll(
|
|
65
|
+
space ? DatabaseService.layer(space.db) : DatabaseService.notAvailable,
|
|
66
|
+
space ? QueueService.layer(space.queues) : QueueService.notAvailable,
|
|
67
|
+
chat?.traceQueue?.target ? TracingService.layerQueue(chat.traceQueue?.target) : TracingService.layerNoop,
|
|
68
|
+
LocalFunctionExecutionService.layer,
|
|
69
|
+
RemoteFunctionExecutionService.mockLayer,
|
|
70
|
+
),
|
|
71
|
+
),
|
|
65
72
|
);
|
|
66
|
-
}, [space,
|
|
73
|
+
}, [space, functions, toolkits, handlers, chat?.traceQueue?.target]);
|
|
67
74
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Queue } from '@dxos/client/echo';
|
|
6
|
+
import { Obj, type Ref } from '@dxos/echo';
|
|
7
|
+
import { useQueue } from '@dxos/react-client/echo';
|
|
8
|
+
|
|
9
|
+
import { ExecutionGraph } from '../execution-graph/execution-graph';
|
|
10
|
+
|
|
11
|
+
export const useExecutionGraph = (traceQueueRef?: Ref.Ref<Queue>) => {
|
|
12
|
+
const traceQueue = useQueue(traceQueueRef?.dxn);
|
|
13
|
+
const graph = new ExecutionGraph();
|
|
14
|
+
graph.addEvents(traceQueue?.objects.filter(Obj.isObject) ?? []);
|
|
15
|
+
return graph.getGraph();
|
|
16
|
+
};
|
|
@@ -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(),
|