@dxos/plugin-assistant 0.8.4-main.abd8ff62ef → 0.8.4-main.bc2380dfbc
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/neutral/AgentArticle-5XDDEXMP.mjs +169 -0
- package/dist/lib/neutral/AgentArticle-5XDDEXMP.mjs.map +7 -0
- package/dist/lib/neutral/AgentProperties-CNH4JMDZ.mjs +100 -0
- package/dist/lib/neutral/AgentProperties-CNH4JMDZ.mjs.map +7 -0
- package/dist/lib/neutral/AssistantPlugin.mjs +10 -0
- package/dist/lib/neutral/AssistantPlugin.node.mjs +46 -0
- package/dist/lib/neutral/AssistantPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/AssistantPlugin.workerd.mjs +40 -0
- package/dist/lib/neutral/AssistantPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/BlueprintArticle-U7LUBFOS.mjs +27 -0
- package/dist/lib/neutral/BlueprintArticle-U7LUBFOS.mjs.map +7 -0
- package/dist/lib/neutral/ChatArticle-WVAFZPVI.mjs +8 -0
- package/dist/lib/neutral/ChatCompanion-DFRMRUK3.mjs +133 -0
- package/dist/lib/neutral/ChatCompanion-DFRMRUK3.mjs.map +7 -0
- package/dist/lib/neutral/ChatDialog-QKZLG7SQ.mjs +72 -0
- package/dist/lib/neutral/ChatDialog-QKZLG7SQ.mjs.map +7 -0
- package/dist/lib/neutral/PlanArticle-TS5ULWYS.mjs +28 -0
- package/dist/lib/neutral/PlanArticle-TS5ULWYS.mjs.map +7 -0
- package/dist/lib/neutral/RoutineArticle-H7ECM7AH.mjs +116 -0
- package/dist/lib/neutral/RoutineArticle-H7ECM7AH.mjs.map +7 -0
- package/dist/lib/neutral/RoutineList-CLDXGQUD.mjs +48 -0
- package/dist/lib/neutral/RoutineList-CLDXGQUD.mjs.map +7 -0
- package/dist/lib/neutral/TracePanel-C77SPEIS.mjs +672 -0
- package/dist/lib/neutral/TracePanel-C77SPEIS.mjs.map +7 -0
- package/dist/lib/neutral/TriggerStatus-WTFYUIG5.mjs +92 -0
- package/dist/lib/neutral/TriggerStatus-WTFYUIG5.mjs.map +7 -0
- package/dist/lib/neutral/ai-service-GJXMI5OI.mjs +22 -0
- package/dist/lib/neutral/ai-service-GJXMI5OI.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-5QBICPYP.mjs +200 -0
- package/dist/lib/neutral/app-graph-builder-5QBICPYP.mjs.map +7 -0
- package/dist/lib/neutral/blueprint-definition-VXJYQ5AE.mjs +32 -0
- package/dist/lib/neutral/blueprint-definition-VXJYQ5AE.mjs.map +7 -0
- package/dist/lib/neutral/blueprints/index.mjs +8 -0
- package/dist/lib/neutral/capabilities/index.mjs +35 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-3FIV362Z.mjs +8 -0
- package/dist/lib/neutral/chunk-3FIV362Z.mjs.map +7 -0
- package/dist/lib/neutral/chunk-4CQZCMRP.mjs +25 -0
- package/dist/lib/neutral/chunk-4CQZCMRP.mjs.map +7 -0
- package/dist/lib/{browser/blueprints/index.mjs → neutral/chunk-5H6UJHLF.mjs} +4 -5
- package/dist/lib/neutral/chunk-5H6UJHLF.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ITJX2YZZ.mjs +98 -0
- package/dist/lib/neutral/chunk-ITJX2YZZ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-IZQWGJNG.mjs +380 -0
- package/dist/lib/neutral/chunk-IZQWGJNG.mjs.map +7 -0
- package/dist/lib/neutral/chunk-SLIPV6NN.mjs +106 -0
- package/dist/lib/neutral/chunk-SLIPV6NN.mjs.map +7 -0
- package/dist/lib/neutral/companion-chat-provisioner-2Y6PRSDK.mjs +116 -0
- package/dist/lib/neutral/companion-chat-provisioner-2Y6PRSDK.mjs.map +7 -0
- package/dist/lib/{browser/chunk-VK53MITK.mjs → neutral/components/index.mjs} +139 -141
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +29 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/{browser/create-chat-E2ZLVTLP.mjs → neutral/create-chat-QQZURUBW.mjs} +10 -12
- package/dist/lib/neutral/create-chat-QQZURUBW.mjs.map +7 -0
- package/dist/lib/neutral/create-object-UZCJCPWM.mjs +93 -0
- package/dist/lib/neutral/create-object-UZCJCPWM.mjs.map +7 -0
- package/dist/lib/neutral/edge-model-resolver-XDNBZ3US.mjs +21 -0
- package/dist/lib/neutral/edge-model-resolver-XDNBZ3US.mjs.map +7 -0
- package/dist/lib/{browser/ensure-companion-chat-7GDMXSQW.mjs → neutral/ensure-companion-chat-5S4LZM2H.mjs} +9 -16
- package/dist/lib/neutral/ensure-companion-chat-5S4LZM2H.mjs.map +7 -0
- package/dist/lib/{browser/chunk-M55MBYG7.mjs → neutral/hooks/index.mjs} +106 -111
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +32 -0
- package/dist/lib/neutral/local-model-resolver-I2BENFFS.mjs +24 -0
- package/dist/lib/neutral/local-model-resolver-I2BENFFS.mjs.map +7 -0
- package/dist/lib/neutral/markdown-KTBFOMFM.mjs +110 -0
- package/dist/lib/neutral/markdown-KTBFOMFM.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +12 -0
- package/dist/lib/neutral/migrations-7DEMVBOG.mjs +28 -0
- package/dist/lib/neutral/migrations-7DEMVBOG.mjs.map +7 -0
- package/dist/lib/{browser/on-create-space-4J3KTNAJ.mjs → neutral/on-create-space-Q2R7OSP6.mjs} +4 -7
- package/dist/lib/neutral/on-create-space-Q2R7OSP6.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-SF36MOB5.mjs +13 -0
- package/dist/lib/neutral/operation-handler-SF36MOB5.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-T4R65UJU.mjs +174 -0
- package/dist/lib/neutral/react-surface-T4R65UJU.mjs.map +7 -0
- package/dist/lib/{browser/resolve-navigation-targets-3ZPQE6SZ.mjs → neutral/resolve-navigation-targets-VXBSWV5L.mjs} +3 -5
- package/dist/lib/neutral/resolve-navigation-targets-VXBSWV5L.mjs.map +7 -0
- package/dist/lib/{browser/run-prompt-in-new-chat-AA3KPBDN.mjs → neutral/run-prompt-in-new-chat-VJXXZ6SI.mjs} +16 -19
- package/dist/lib/neutral/run-prompt-in-new-chat-VJXXZ6SI.mjs.map +7 -0
- package/dist/lib/{browser/set-current-chat-P4VHI3YF.mjs → neutral/set-current-chat-ZFDCYK5I.mjs} +4 -10
- package/dist/lib/neutral/set-current-chat-ZFDCYK5I.mjs.map +7 -0
- package/dist/lib/neutral/settings-W4BLWQ53.mjs +28 -0
- package/dist/lib/neutral/settings-W4BLWQ53.mjs.map +7 -0
- package/dist/lib/neutral/state-H3G7QCU6.mjs +28 -0
- package/dist/lib/neutral/state-H3G7QCU6.mjs.map +7 -0
- package/dist/lib/neutral/testing.mjs +8 -0
- package/dist/lib/neutral/toggle-trace-panel-debug-JGTB6KVJ.mjs +21 -0
- package/dist/lib/neutral/toggle-trace-panel-debug-JGTB6KVJ.mjs.map +7 -0
- package/dist/lib/neutral/toolkit-GVWXPDLJ.mjs +14 -0
- package/dist/lib/neutral/toolkit-GVWXPDLJ.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/translations.mjs +5 -2
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +20 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/lib/{browser/update-chat-name-VWKNUON7.mjs → neutral/update-chat-name-ENXRUMDJ.mjs} +3 -5
- package/dist/lib/neutral/update-chat-name-ENXRUMDJ.mjs.map +7 -0
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/AssistantPlugin.node.d.ts.map +1 -1
- package/dist/types/src/AssistantPlugin.workerd.d.ts +4 -0
- package/dist/types/src/AssistantPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts.map +1 -1
- package/dist/types/src/capabilities/create-object.d.ts +31 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +27 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts +1 -1
- package/dist/types/src/capabilities/migrations.d.ts +2 -1
- package/dist/types/src/capabilities/migrations.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +11 -5
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +2 -2
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +2 -2
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +2 -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/ChatThread/widgets/StatusWidget.d.ts +2 -15
- package/dist/types/src/components/ChatThread/widgets/StatusWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/SummaryWidget.d.ts.map +1 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts.map +1 -1
- package/dist/types/src/components/TaskList/TaskList.d.ts +10 -0
- package/dist/types/src/components/TaskList/TaskList.d.ts.map +1 -0
- package/dist/types/src/components/TaskList/TaskList.stories.d.ts +16 -0
- package/dist/types/src/components/TaskList/TaskList.stories.d.ts.map +1 -0
- package/dist/types/src/components/TaskList/index.d.ts +2 -0
- package/dist/types/src/components/TaskList/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +1 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/AgentArticle/AgentArticle.d.ts.map +1 -1
- package/dist/types/src/containers/{ChatContainer/ChatContainer.d.ts → ChatArticle/ChatArticle.d.ts} +3 -3
- package/dist/types/src/containers/ChatArticle/ChatArticle.d.ts.map +1 -0
- package/dist/types/src/containers/ChatArticle/index.d.ts +2 -0
- package/dist/types/src/containers/ChatArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts.map +1 -1
- package/dist/types/src/containers/PlanArticle/PlanArticle.d.ts +6 -0
- package/dist/types/src/containers/PlanArticle/PlanArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PlanArticle/index.d.ts +2 -0
- package/dist/types/src/containers/PlanArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts.map +1 -1
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.stories.d.ts +15 -0
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/execution-graph.d.ts +11 -2
- package/dist/types/src/containers/TracePanel/execution-graph.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/span-tree.d.ts +73 -0
- package/dist/types/src/containers/TracePanel/span-tree.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/span-tree.test.d.ts +2 -0
- package/dist/types/src/containers/TracePanel/span-tree.test.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +4 -3
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/feed-logger.d.ts +13 -0
- package/dist/types/src/feed-logger.d.ts.map +1 -0
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +3 -3
- 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/useChatToolbarActions.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextBinder.d.ts +2 -2
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextObjects.d.ts +2 -2
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/create-chat.d.ts +2 -2
- package/dist/types/src/operations/create-chat.d.ts.map +1 -1
- package/dist/types/src/operations/ensure-companion-chat.d.ts +2 -2
- package/dist/types/src/operations/ensure-companion-chat.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +0 -1
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/on-create-space.d.ts +2 -2
- package/dist/types/src/operations/on-create-space.d.ts.map +1 -1
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts +2 -2
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts.map +1 -1
- package/dist/types/src/operations/set-current-chat.d.ts +2 -2
- package/dist/types/src/operations/set-current-chat.d.ts.map +1 -1
- package/dist/types/src/operations/toggle-trace-panel-debug.d.ts +5 -0
- package/dist/types/src/operations/toggle-trace-panel-debug.d.ts.map +1 -0
- package/dist/types/src/operations/update-chat-name.d.ts +2 -2
- package/dist/types/src/operations/update-chat-name.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +11 -11
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +2 -3
- package/dist/types/src/testing/test-generator.d.ts.map +1 -1
- package/dist/types/src/testing/test-sequence.d.ts +3 -3
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts +2 -0
- package/dist/types/src/testing.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +1 -0
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/AssistantCapabilities.d.ts +30 -0
- package/dist/types/src/types/AssistantCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/AssistantEvents.d.ts +3 -0
- package/dist/types/src/types/AssistantEvents.d.ts.map +1 -0
- package/dist/types/src/{operations/definitions.d.ts → types/AssistantOperation.d.ts} +10 -6
- package/dist/types/src/types/AssistantOperation.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +1 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +3 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util/suggestions.d.ts +9 -0
- package/dist/types/src/util/suggestions.d.ts.map +1 -0
- package/dist/types/src/util/suggestions.test.d.ts +2 -0
- package/dist/types/src/util/suggestions.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +152 -128
- package/src/AssistantPlugin.node.ts +7 -88
- package/src/AssistantPlugin.test.ts +3 -3
- package/src/AssistantPlugin.ts +126 -0
- package/src/AssistantPlugin.workerd.ts +41 -0
- package/src/blueprints/assistant/blueprint.ts +1 -1
- package/src/capabilities/app-graph-builder.ts +48 -9
- package/src/capabilities/companion-chat-provisioner.ts +4 -5
- package/src/capabilities/create-object.ts +107 -0
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/markdown.ts +2 -2
- package/src/capabilities/migrations.ts +3 -3
- package/src/capabilities/react-surface.tsx +15 -7
- package/src/components/Chat/Chat.tsx +35 -5
- package/src/components/ChatPrompt/ChatMcpErrors.tsx +1 -1
- package/src/components/ChatPrompt/ChatOptions.stories.tsx +4 -4
- package/src/components/ChatPrompt/ChatOptions.tsx +12 -11
- package/src/components/ChatPrompt/ChatPrompt.tsx +3 -3
- package/src/components/ChatPrompt/ChatReferences.tsx +3 -3
- package/src/components/ChatPrompt/ChatStatus.tsx +1 -1
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +1 -1
- package/src/components/ChatThread/Anchor.stories.tsx +3 -3
- package/src/components/ChatThread/ChatThread.stories.tsx +25 -29
- package/src/components/ChatThread/ChatThread.tsx +1 -1
- package/src/components/ChatThread/registry.tsx +8 -4
- package/src/components/ChatThread/sync.test.ts +4 -6
- package/src/components/ChatThread/widgets/ReasoningWidget.ts +2 -2
- package/src/components/ChatThread/widgets/StatusWidget.ts +3 -83
- package/src/components/ChatThread/widgets/SummaryWidget.tsx +1 -3
- package/src/components/ProcessTree/ProcessTree.tsx +2 -1
- package/src/components/TaskList/TaskList.stories.tsx +44 -0
- package/src/components/TaskList/TaskList.tsx +45 -0
- package/src/{cli → components/TaskList}/index.ts +1 -1
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +1 -1
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +2 -6
- package/src/components/TemplateEditor/TemplateForm.tsx +48 -69
- package/src/components/Toolbox/Toolbox.stories.tsx +4 -4
- package/src/components/Toolbox/Toolbox.tsx +2 -2
- package/src/components/index.ts +1 -0
- package/src/containers/AgentArticle/AgentArticle.stories.tsx +7 -7
- package/src/containers/AgentArticle/AgentArticle.tsx +11 -7
- package/src/containers/AgentProperties/AgentProperties.stories.tsx +4 -4
- package/src/containers/AgentProperties/AgentProperties.tsx +4 -4
- package/src/containers/{ChatContainer/ChatContainer.tsx → ChatArticle/ChatArticle.tsx} +11 -9
- package/src/containers/ChatArticle/index.ts +5 -0
- package/src/containers/ChatCompanion/ChatCompanion.tsx +20 -29
- package/src/containers/PlanArticle/PlanArticle.tsx +33 -0
- package/src/containers/PlanArticle/index.ts +5 -0
- package/src/containers/RoutineArticle/RoutineArticle.stories.tsx +75 -0
- package/src/containers/RoutineArticle/RoutineArticle.tsx +74 -24
- package/src/containers/RoutineList/RoutineList.stories.tsx +3 -3
- package/src/containers/RoutineList/RoutineList.tsx +3 -3
- package/src/containers/TracePanel/TracePanel.stories.tsx +33 -26
- package/src/containers/TracePanel/TracePanel.tsx +72 -33
- package/src/containers/TracePanel/dxn-extractor.ts +7 -7
- package/src/containers/TracePanel/execution-graph.test.ts +218 -213
- package/src/containers/TracePanel/execution-graph.ts +316 -271
- package/src/containers/TracePanel/span-tree.test.ts +166 -0
- package/src/containers/TracePanel/span-tree.ts +214 -0
- package/src/containers/index.ts +4 -3
- package/src/{queue-logger.ts → feed-logger.ts} +37 -27
- package/src/hooks/useBlueprintRegistry.ts +12 -6
- package/src/hooks/useChatProcessor.ts +3 -3
- package/src/hooks/useChatServices.ts +1 -1
- package/src/hooks/useChatToolbarActions.ts +86 -88
- package/src/hooks/useContextBinder.ts +4 -4
- package/src/hooks/useContextObjects.ts +2 -2
- package/src/index.ts +2 -9
- package/src/operations/create-chat.ts +16 -11
- package/src/operations/ensure-companion-chat.ts +47 -45
- package/src/operations/index.ts +1 -2
- package/src/operations/on-create-space.ts +3 -3
- package/src/operations/prompt.test.ts +5 -5
- package/src/operations/resolve-navigation-targets.ts +2 -2
- package/src/operations/run-prompt-in-new-chat.ts +85 -84
- package/src/operations/set-current-chat.ts +3 -4
- package/src/operations/toggle-trace-panel-debug.ts +27 -0
- package/src/operations/update-chat-name.ts +2 -2
- package/src/plugin.ts +11 -0
- package/src/processor/processor.test.ts +1 -1
- package/src/processor/processor.ts +15 -15
- package/src/testing/test-generator.test.ts +41 -52
- package/src/testing/test-generator.ts +174 -189
- package/src/testing/test-sequence.ts +3 -3
- package/src/testing/trace-timeline.conversations.json +1 -1
- package/src/testing/trace-timeline.test.ts +3 -5
- package/src/testing.ts +7 -0
- package/src/translations.ts +5 -2
- package/src/types/Assistant.ts +2 -1
- package/src/types/AssistantCapabilities.ts +35 -0
- package/src/types/AssistantEvents.ts +11 -0
- package/src/{operations/definitions.ts → types/AssistantOperation.ts} +15 -0
- package/src/types/Settings.ts +6 -0
- package/src/types/index.ts +5 -2
- package/src/util/suggestions.test.ts +52 -0
- package/src/util/suggestions.ts +42 -0
- package/dist/lib/browser/blueprints/index.mjs.map +0 -7
- package/dist/lib/browser/chunk-DVOOFAWU.mjs +0 -175
- package/dist/lib/browser/chunk-DVOOFAWU.mjs.map +0 -7
- package/dist/lib/browser/chunk-M55MBYG7.mjs.map +0 -7
- package/dist/lib/browser/chunk-SEMCG4ZK.mjs +0 -195
- package/dist/lib/browser/chunk-SEMCG4ZK.mjs.map +0 -7
- package/dist/lib/browser/chunk-VK53MITK.mjs.map +0 -7
- package/dist/lib/browser/cli/index.mjs +0 -73
- package/dist/lib/browser/cli/index.mjs.map +0 -7
- package/dist/lib/browser/components/index.mjs +0 -20
- package/dist/lib/browser/create-chat-E2ZLVTLP.mjs.map +0 -7
- package/dist/lib/browser/ensure-companion-chat-7GDMXSQW.mjs.map +0 -7
- package/dist/lib/browser/hooks/index.mjs +0 -39
- package/dist/lib/browser/index.mjs +0 -84
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/on-create-space-4J3KTNAJ.mjs.map +0 -7
- package/dist/lib/browser/operations/index.mjs +0 -13
- package/dist/lib/browser/operations/index.mjs.map +0 -7
- package/dist/lib/browser/resolve-navigation-targets-3ZPQE6SZ.mjs.map +0 -7
- package/dist/lib/browser/run-prompt-in-new-chat-AA3KPBDN.mjs.map +0 -7
- package/dist/lib/browser/set-current-chat-P4VHI3YF.mjs.map +0 -7
- package/dist/lib/browser/translations.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -18
- package/dist/lib/browser/update-chat-name-VWKNUON7.mjs.map +0 -7
- package/dist/lib/node-esm/AssistantSettings-23A5IMHS.mjs +0 -41
- package/dist/lib/node-esm/AssistantSettings-23A5IMHS.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -32
- package/dist/lib/node-esm/blueprints/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FWC3ZGPH.mjs +0 -933
- package/dist/lib/node-esm/chunk-FWC3ZGPH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-JKEB3NFZ.mjs +0 -2302
- package/dist/lib/node-esm/chunk-JKEB3NFZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MBDVPB4V.mjs +0 -176
- package/dist/lib/node-esm/chunk-MBDVPB4V.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XAFVSEUJ.mjs +0 -196
- package/dist/lib/node-esm/chunk-XAFVSEUJ.mjs.map +0 -7
- package/dist/lib/node-esm/cli/index.mjs +0 -74
- package/dist/lib/node-esm/cli/index.mjs.map +0 -7
- package/dist/lib/node-esm/components/index.mjs +0 -21
- package/dist/lib/node-esm/create-chat-UQQ3542N.mjs +0 -74
- package/dist/lib/node-esm/create-chat-UQQ3542N.mjs.map +0 -7
- package/dist/lib/node-esm/ensure-companion-chat-LVCPD4DJ.mjs +0 -66
- package/dist/lib/node-esm/ensure-companion-chat-LVCPD4DJ.mjs.map +0 -7
- package/dist/lib/node-esm/hooks/index.mjs +0 -40
- package/dist/lib/node-esm/index.mjs +0 -85
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/on-create-space-M63UBTTT.mjs +0 -23
- package/dist/lib/node-esm/on-create-space-M63UBTTT.mjs.map +0 -7
- package/dist/lib/node-esm/operations/index.mjs +0 -14
- package/dist/lib/node-esm/operations/index.mjs.map +0 -7
- package/dist/lib/node-esm/resolve-navigation-targets-HO77CAFT.mjs +0 -23
- package/dist/lib/node-esm/resolve-navigation-targets-HO77CAFT.mjs.map +0 -7
- package/dist/lib/node-esm/run-prompt-in-new-chat-RIRYYYPK.mjs +0 -107
- package/dist/lib/node-esm/run-prompt-in-new-chat-RIRYYYPK.mjs.map +0 -7
- package/dist/lib/node-esm/set-current-chat-Z7GJ52VX.mjs +0 -55
- package/dist/lib/node-esm/set-current-chat-Z7GJ52VX.mjs.map +0 -7
- package/dist/lib/node-esm/translations.mjs +0 -173
- package/dist/lib/node-esm/translations.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -19
- package/dist/lib/node-esm/update-chat-name-GV4HX32Z.mjs +0 -57
- package/dist/lib/node-esm/update-chat-name-GV4HX32Z.mjs.map +0 -7
- package/dist/types/src/cli/index.d.ts +0 -2
- package/dist/types/src/cli/index.d.ts.map +0 -1
- package/dist/types/src/cli/plugin.d.ts +0 -10
- package/dist/types/src/cli/plugin.d.ts.map +0 -1
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/containers/ChatContainer/index.d.ts +0 -2
- package/dist/types/src/containers/ChatContainer/index.d.ts.map +0 -1
- package/dist/types/src/operations/definitions.d.ts.map +0 -1
- package/dist/types/src/queue-logger.d.ts +0 -11
- package/dist/types/src/queue-logger.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -32
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/dist/types/src/types/events.d.ts +0 -5
- package/dist/types/src/types/events.d.ts.map +0 -1
- package/src/AssistantPlugin.tsx +0 -238
- package/src/cli/plugin.ts +0 -83
- package/src/containers/ChatContainer/index.ts +0 -5
- package/src/types/capabilities.ts +0 -35
- package/src/types/events.ts +0 -11
- /package/dist/lib/{browser/chunk-J5LGTIGS.mjs.map → neutral/AssistantPlugin.mjs.map} +0 -0
- /package/dist/lib/{browser → neutral}/AssistantSettings-GG52BLKS.mjs +0 -0
- /package/dist/lib/{browser → neutral}/AssistantSettings-GG52BLKS.mjs.map +0 -0
- /package/dist/lib/{browser/components/index.mjs.map → neutral/ChatArticle-WVAFZPVI.mjs.map} +0 -0
- /package/dist/lib/{browser/hooks → neutral/blueprints}/index.mjs.map +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{browser/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/components → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/chunk-HSLMI22Q.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/hooks → neutral/operations}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/types/index.mjs.map → neutral/testing.mjs.map} +0 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { AgentRequestBegin, AgentRequestEnd } from '@dxos/assistant';
|
|
8
|
+
import { Trace } from '@dxos/compute';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
|
|
11
|
+
import { ROOT_SPAN_ID, buildSpanTree, flattenSpanTree } from './span-tree';
|
|
12
|
+
|
|
13
|
+
const makeMessage = (
|
|
14
|
+
meta: Trace.Meta,
|
|
15
|
+
events: Array<{ type: string; timestamp: number; data?: unknown }>,
|
|
16
|
+
isEphemeral = false,
|
|
17
|
+
): Trace.Message =>
|
|
18
|
+
Obj.make(Trace.Message, {
|
|
19
|
+
meta,
|
|
20
|
+
isEphemeral,
|
|
21
|
+
events: events.map((event) => ({
|
|
22
|
+
type: event.type,
|
|
23
|
+
timestamp: event.timestamp,
|
|
24
|
+
data: event.data ?? {},
|
|
25
|
+
})),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const opStart = (key: string, name?: string) => ({
|
|
29
|
+
type: Trace.OperationStart.key,
|
|
30
|
+
data: { key, name },
|
|
31
|
+
});
|
|
32
|
+
const opEnd = (key: string, name?: string, outcome: 'success' | 'failure' = 'success') => ({
|
|
33
|
+
type: Trace.OperationEnd.key,
|
|
34
|
+
data: { key, name, outcome },
|
|
35
|
+
});
|
|
36
|
+
const agentBegin = () => ({ type: AgentRequestBegin.key, data: {} });
|
|
37
|
+
const agentEnd = () => ({ type: AgentRequestEnd.key, data: {} });
|
|
38
|
+
|
|
39
|
+
describe('buildSpanTree', () => {
|
|
40
|
+
test('returns a root span for empty input', ({ expect }) => {
|
|
41
|
+
const tree = buildSpanTree([]);
|
|
42
|
+
expect(tree.id).toBe(ROOT_SPAN_ID);
|
|
43
|
+
expect(tree.children).toEqual([]);
|
|
44
|
+
expect(tree.events).toEqual([]);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('events without pid attach to root span', ({ expect }) => {
|
|
48
|
+
const tree = buildSpanTree([makeMessage({}, [{ type: 'foo', timestamp: 1 }])]);
|
|
49
|
+
expect(tree.children).toEqual([]);
|
|
50
|
+
expect(tree.events).toHaveLength(1);
|
|
51
|
+
expect(tree.events[0].type).toBe('foo');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('a single operation start/end pair produces one span under root', ({ expect }) => {
|
|
55
|
+
const tree = buildSpanTree([
|
|
56
|
+
makeMessage({ pid: 'op-1' }, [{ ...opStart('reply', 'Reply'), timestamp: 1 }]),
|
|
57
|
+
makeMessage({ pid: 'op-1' }, [{ ...opEnd('reply', 'Reply'), timestamp: 2 }]),
|
|
58
|
+
]);
|
|
59
|
+
expect(tree.children).toHaveLength(1);
|
|
60
|
+
expect(tree.children[0].meta.pid).toBe('op-1');
|
|
61
|
+
expect(tree.children[0].events).toHaveLength(2);
|
|
62
|
+
expect(tree.children[0].children).toEqual([]);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('a nested operation attaches to its open parent', ({ expect }) => {
|
|
66
|
+
const tree = buildSpanTree([
|
|
67
|
+
makeMessage({ pid: 'agent-1' }, [{ ...agentBegin(), timestamp: 1 }]),
|
|
68
|
+
makeMessage({ pid: 'op-1', parentPid: 'agent-1' }, [{ ...opStart('lookup', 'Lookup'), timestamp: 2 }]),
|
|
69
|
+
makeMessage({ pid: 'op-1', parentPid: 'agent-1' }, [{ ...opEnd('lookup', 'Lookup'), timestamp: 3 }]),
|
|
70
|
+
makeMessage({ pid: 'agent-1' }, [{ ...agentEnd(), timestamp: 4 }]),
|
|
71
|
+
]);
|
|
72
|
+
expect(tree.children).toHaveLength(1);
|
|
73
|
+
const agentSpan = tree.children[0];
|
|
74
|
+
expect(agentSpan.meta.pid).toBe('agent-1');
|
|
75
|
+
expect(agentSpan.children).toHaveLength(1);
|
|
76
|
+
expect(agentSpan.children[0].meta.pid).toBe('op-1');
|
|
77
|
+
expect(agentSpan.children[0].events).toHaveLength(2);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test('sequential agent requests in one process become sibling spans', ({ expect }) => {
|
|
81
|
+
const tree = buildSpanTree([
|
|
82
|
+
makeMessage({ pid: 'agent-1' }, [{ ...agentBegin(), timestamp: 1 }]),
|
|
83
|
+
makeMessage({ pid: 'agent-1' }, [{ ...agentEnd(), timestamp: 2 }]),
|
|
84
|
+
makeMessage({ pid: 'agent-1' }, [{ ...agentBegin(), timestamp: 3 }]),
|
|
85
|
+
makeMessage({ pid: 'agent-1' }, [{ ...agentEnd(), timestamp: 4 }]),
|
|
86
|
+
]);
|
|
87
|
+
expect(tree.children).toHaveLength(2);
|
|
88
|
+
expect(tree.children.every((child) => child.meta.pid === 'agent-1')).toBe(true);
|
|
89
|
+
// Span ids are distinct even though pids are shared.
|
|
90
|
+
expect(tree.children[0].id).not.toBe(tree.children[1].id);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('non-boundary events attach to the currently-open span', ({ expect }) => {
|
|
94
|
+
const tree = buildSpanTree([
|
|
95
|
+
makeMessage({ pid: 'agent-1' }, [{ ...agentBegin(), timestamp: 1 }]),
|
|
96
|
+
makeMessage({ pid: 'agent-1' }, [{ type: 'note', timestamp: 2 }]),
|
|
97
|
+
makeMessage({ pid: 'agent-1' }, [{ ...agentEnd(), timestamp: 3 }]),
|
|
98
|
+
]);
|
|
99
|
+
expect(tree.children[0].events).toHaveLength(3);
|
|
100
|
+
expect(tree.children[0].events.map((event) => event.type)).toEqual([
|
|
101
|
+
AgentRequestBegin.key,
|
|
102
|
+
'note',
|
|
103
|
+
AgentRequestEnd.key,
|
|
104
|
+
]);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test('non-boundary event without an open span lands on root', ({ expect }) => {
|
|
108
|
+
const tree = buildSpanTree([makeMessage({ pid: 'orphan-pid' }, [{ type: 'note', timestamp: 1 }])]);
|
|
109
|
+
expect(tree.children).toEqual([]);
|
|
110
|
+
expect(tree.events).toHaveLength(1);
|
|
111
|
+
expect(tree.events[0].type).toBe('note');
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test('end event without a matching begin attaches to root', ({ expect }) => {
|
|
115
|
+
const tree = buildSpanTree([makeMessage({ pid: 'op-1' }, [{ ...opEnd('reply', 'Reply'), timestamp: 1 }])]);
|
|
116
|
+
expect(tree.children).toEqual([]);
|
|
117
|
+
expect(tree.events).toHaveLength(1);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test('sorts sibling spans chronologically by their first event', ({ expect }) => {
|
|
121
|
+
const tree = buildSpanTree([
|
|
122
|
+
makeMessage({ pid: 'op-late' }, [
|
|
123
|
+
{ ...opStart('b'), timestamp: 10 },
|
|
124
|
+
{ ...opEnd('b'), timestamp: 11 },
|
|
125
|
+
]),
|
|
126
|
+
makeMessage({ pid: 'op-early' }, [
|
|
127
|
+
{ ...opStart('a'), timestamp: 1 },
|
|
128
|
+
{ ...opEnd('a'), timestamp: 2 },
|
|
129
|
+
]),
|
|
130
|
+
]);
|
|
131
|
+
expect(tree.children.map((child) => child.meta.pid)).toEqual(['op-early', 'op-late']);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test('respects eventLimit by dropping oldest events', ({ expect }) => {
|
|
135
|
+
const tree = buildSpanTree(
|
|
136
|
+
[
|
|
137
|
+
makeMessage({ pid: 'op-old' }, [
|
|
138
|
+
{ ...opStart('a'), timestamp: 1 },
|
|
139
|
+
{ ...opEnd('a'), timestamp: 2 },
|
|
140
|
+
]),
|
|
141
|
+
makeMessage({ pid: 'op-new' }, [
|
|
142
|
+
{ ...opStart('b'), timestamp: 3 },
|
|
143
|
+
{ ...opEnd('b'), timestamp: 4 },
|
|
144
|
+
]),
|
|
145
|
+
],
|
|
146
|
+
{ eventLimit: 2 },
|
|
147
|
+
);
|
|
148
|
+
expect(tree.children.map((child) => child.meta.pid)).toEqual(['op-new']);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
test('flattenSpanTree returns root + all descendants in depth-first order', ({ expect }) => {
|
|
152
|
+
const tree = buildSpanTree([
|
|
153
|
+
makeMessage({ pid: 'agent-1' }, [{ ...agentBegin(), timestamp: 1 }]),
|
|
154
|
+
makeMessage({ pid: 'op-1', parentPid: 'agent-1' }, [
|
|
155
|
+
{ ...opStart('a'), timestamp: 2 },
|
|
156
|
+
{ ...opEnd('a'), timestamp: 3 },
|
|
157
|
+
]),
|
|
158
|
+
makeMessage({ pid: 'agent-1' }, [{ ...agentEnd(), timestamp: 4 }]),
|
|
159
|
+
]);
|
|
160
|
+
const order = flattenSpanTree(tree);
|
|
161
|
+
expect(order[0].id).toBe(ROOT_SPAN_ID);
|
|
162
|
+
expect(order[1].meta.pid).toBe('agent-1');
|
|
163
|
+
expect(order[2].meta.pid).toBe('op-1');
|
|
164
|
+
expect(order).toHaveLength(3);
|
|
165
|
+
});
|
|
166
|
+
});
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { AgentRequestBegin, AgentRequestEnd } from '@dxos/assistant';
|
|
6
|
+
import { Trace } from '@dxos/compute';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Synthetic id assigned to the root span.
|
|
10
|
+
* The root is a virtual container for top-level spans (those without a parent in the captured trace).
|
|
11
|
+
*/
|
|
12
|
+
export const ROOT_SPAN_ID = '<main>';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Computed metadata for a span.
|
|
16
|
+
* Derived from the meta of the begin event that opened the span.
|
|
17
|
+
*/
|
|
18
|
+
export interface SpanMeta {
|
|
19
|
+
readonly pid?: string;
|
|
20
|
+
readonly parentPid?: string;
|
|
21
|
+
readonly processName?: string;
|
|
22
|
+
readonly conversationId?: string;
|
|
23
|
+
readonly triggerId?: string;
|
|
24
|
+
readonly toolCallId?: string;
|
|
25
|
+
readonly runtimeName?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A span in the trace hierarchy.
|
|
30
|
+
*
|
|
31
|
+
* Each span represents a single bounded unit of work — an operation invocation or an
|
|
32
|
+
* agent request. Spans are opened by `OperationStart` / `AgentRequestBegin` events and
|
|
33
|
+
* closed by their matching `OperationEnd` / `AgentRequestEnd` events. A single process
|
|
34
|
+
* (pid) may produce multiple sequential spans (for example, an agent session that serves
|
|
35
|
+
* three prompts produces three sibling spans sharing the agent's pid).
|
|
36
|
+
*
|
|
37
|
+
* `events` contains the bounded events for this span only — child spans' events are not
|
|
38
|
+
* duplicated here. `children` contains sub-spans that opened while this span was active.
|
|
39
|
+
*/
|
|
40
|
+
export interface Span {
|
|
41
|
+
readonly id: string;
|
|
42
|
+
readonly meta: SpanMeta;
|
|
43
|
+
readonly events: Trace.FlatEvent[];
|
|
44
|
+
readonly children: Span[];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const BEGIN_EVENT_TYPES = new Set<string>([Trace.OperationStart.key, AgentRequestBegin.key]);
|
|
48
|
+
export const END_EVENT_TYPES = new Set<string>([Trace.OperationEnd.key, AgentRequestEnd.key]);
|
|
49
|
+
|
|
50
|
+
export const isSpanBeginEvent = (event: Trace.FlatEvent): boolean => BEGIN_EVENT_TYPES.has(event.type);
|
|
51
|
+
export const isSpanEndEvent = (event: Trace.FlatEvent): boolean => END_EVENT_TYPES.has(event.type);
|
|
52
|
+
|
|
53
|
+
const computeMeta = (rawMeta: Trace.Meta): SpanMeta => ({
|
|
54
|
+
pid: rawMeta.pid,
|
|
55
|
+
parentPid: rawMeta.parentPid,
|
|
56
|
+
processName: rawMeta.processName,
|
|
57
|
+
conversationId: rawMeta.conversationId,
|
|
58
|
+
triggerId: rawMeta.triggerId,
|
|
59
|
+
toolCallId: rawMeta.toolCallId,
|
|
60
|
+
runtimeName: rawMeta.runtimeName,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
interface MutableSpan {
|
|
64
|
+
id: string;
|
|
65
|
+
meta: SpanMeta;
|
|
66
|
+
events: Trace.FlatEvent[];
|
|
67
|
+
children: MutableSpan[];
|
|
68
|
+
firstTimestamp: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const makeMutableSpan = (id: string, meta: SpanMeta): MutableSpan => ({
|
|
72
|
+
id,
|
|
73
|
+
meta,
|
|
74
|
+
events: [],
|
|
75
|
+
children: [],
|
|
76
|
+
firstTimestamp: Number.POSITIVE_INFINITY,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const freezeSpan = (span: MutableSpan): Span => ({
|
|
80
|
+
id: span.id,
|
|
81
|
+
meta: span.meta,
|
|
82
|
+
events: span.events,
|
|
83
|
+
children: span.children.map(freezeSpan),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export interface BuildSpanTreeOptions {
|
|
87
|
+
/**
|
|
88
|
+
* If provided, only the last `eventLimit` flat events (after flattening and chronological sort)
|
|
89
|
+
* are placed into the tree. Spans with no remaining events are dropped from the result.
|
|
90
|
+
*/
|
|
91
|
+
eventLimit?: number;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Builds a hierarchical span tree from a list of trace messages.
|
|
96
|
+
*
|
|
97
|
+
* Algorithm:
|
|
98
|
+
* 1. Flatten messages into events and sort them chronologically.
|
|
99
|
+
* 2. For each event:
|
|
100
|
+
* - Begin events (`OperationStart`, `AgentRequestBegin`) open a new span whose parent
|
|
101
|
+
* is the currently-open span of the event's `meta.parentPid`, or the root if there is
|
|
102
|
+
* none. The begin event itself becomes the first event of the new span.
|
|
103
|
+
* - End events (`OperationEnd`, `AgentRequestEnd`) close the currently-open span for
|
|
104
|
+
* the event's `meta.pid` and become its last event.
|
|
105
|
+
* - Other events attach to the currently-open span for their `meta.pid`, or to the
|
|
106
|
+
* root span if no span is currently open for that pid (or the event has no pid).
|
|
107
|
+
* 3. Sort each span's children by their earliest event timestamp.
|
|
108
|
+
*/
|
|
109
|
+
export const buildSpanTree = (messages: Trace.Message[], options: BuildSpanTreeOptions = {}): Span => {
|
|
110
|
+
const allEvents = messages.flatMap((message) => Trace.flatten(message));
|
|
111
|
+
allEvents.sort((a, b) => a.timestamp - b.timestamp);
|
|
112
|
+
|
|
113
|
+
const events =
|
|
114
|
+
options.eventLimit !== undefined && allEvents.length > options.eventLimit
|
|
115
|
+
? allEvents.slice(-options.eventLimit)
|
|
116
|
+
: allEvents;
|
|
117
|
+
|
|
118
|
+
const root = makeMutableSpan(ROOT_SPAN_ID, {});
|
|
119
|
+
|
|
120
|
+
// Currently-open span for each pid.
|
|
121
|
+
// A process may host multiple sequential spans (e.g. successive agent requests), so we
|
|
122
|
+
// track the active one and start a new span on the next begin event.
|
|
123
|
+
const openSpans = new Map<string, MutableSpan>();
|
|
124
|
+
|
|
125
|
+
let spanCounter = 0;
|
|
126
|
+
const allocSpanId = (pid: string): string => {
|
|
127
|
+
const id = `${pid}#${spanCounter}`;
|
|
128
|
+
spanCounter += 1;
|
|
129
|
+
return id;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const noteTimestamp = (span: MutableSpan, timestamp: number): void => {
|
|
133
|
+
if (timestamp < span.firstTimestamp) {
|
|
134
|
+
span.firstTimestamp = timestamp;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
for (const event of events) {
|
|
139
|
+
const pid = event.meta.pid;
|
|
140
|
+
|
|
141
|
+
if (!pid) {
|
|
142
|
+
// Events without a pid attach to the root.
|
|
143
|
+
root.events.push(event);
|
|
144
|
+
noteTimestamp(root, event.timestamp);
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (BEGIN_EVENT_TYPES.has(event.type)) {
|
|
149
|
+
const parentPid = event.meta.parentPid;
|
|
150
|
+
const parent = (parentPid && openSpans.get(parentPid)) || root;
|
|
151
|
+
const span = makeMutableSpan(allocSpanId(pid), computeMeta(event.meta));
|
|
152
|
+
span.events.push(event);
|
|
153
|
+
noteTimestamp(span, event.timestamp);
|
|
154
|
+
parent.children.push(span);
|
|
155
|
+
// The new span supersedes any previously-open span for this pid.
|
|
156
|
+
openSpans.set(pid, span);
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (END_EVENT_TYPES.has(event.type)) {
|
|
161
|
+
const span = openSpans.get(pid);
|
|
162
|
+
if (span) {
|
|
163
|
+
span.events.push(event);
|
|
164
|
+
noteTimestamp(span, event.timestamp);
|
|
165
|
+
openSpans.delete(pid);
|
|
166
|
+
} else {
|
|
167
|
+
// End event without a matching begin — attach to root so the event isn't lost.
|
|
168
|
+
root.events.push(event);
|
|
169
|
+
noteTimestamp(root, event.timestamp);
|
|
170
|
+
}
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Non-boundary event: attach to the currently-open span for this pid if any.
|
|
175
|
+
const open = openSpans.get(pid);
|
|
176
|
+
if (open) {
|
|
177
|
+
open.events.push(event);
|
|
178
|
+
noteTimestamp(open, event.timestamp);
|
|
179
|
+
} else {
|
|
180
|
+
root.events.push(event);
|
|
181
|
+
noteTimestamp(root, event.timestamp);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Sort children chronologically for deterministic output.
|
|
186
|
+
const sortChildren = (span: MutableSpan): void => {
|
|
187
|
+
span.children.sort((a, b) => a.firstTimestamp - b.firstTimestamp);
|
|
188
|
+
for (const child of span.children) {
|
|
189
|
+
sortChildren(child);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
sortChildren(root);
|
|
193
|
+
|
|
194
|
+
return freezeSpan(root);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Walks the span tree in depth-first pre-order, invoking `visit` for each span (root included).
|
|
199
|
+
*/
|
|
200
|
+
export const walkSpanTree = (root: Span, visit: (span: Span, depth: number) => void, depth = 0): void => {
|
|
201
|
+
visit(root, depth);
|
|
202
|
+
for (const child of root.children) {
|
|
203
|
+
walkSpanTree(child, visit, depth + 1);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Returns all spans in the tree in depth-first pre-order, root first.
|
|
209
|
+
*/
|
|
210
|
+
export const flattenSpanTree = (root: Span): Span[] => {
|
|
211
|
+
const result: Span[] = [];
|
|
212
|
+
walkSpanTree(root, (span) => result.push(span));
|
|
213
|
+
return result;
|
|
214
|
+
};
|
package/src/containers/index.ts
CHANGED
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import { type ComponentType, lazy } from 'react';
|
|
6
6
|
|
|
7
|
+
export const AgentArticle: ComponentType<any> = lazy(() => import('./AgentArticle'));
|
|
8
|
+
export const AgentProperties: ComponentType<any> = lazy(() => import('./AgentProperties'));
|
|
7
9
|
export const BlueprintArticle: ComponentType<any> = lazy(() => import('./BlueprintArticle'));
|
|
8
10
|
export const ChatCompanion: ComponentType<any> = lazy(() => import('./ChatCompanion'));
|
|
9
|
-
export const
|
|
11
|
+
export const ChatArticle: ComponentType<any> = lazy(() => import('./ChatArticle'));
|
|
10
12
|
export const ChatDialog: ComponentType<any> = lazy(() => import('./ChatDialog'));
|
|
11
|
-
export const
|
|
12
|
-
export const AgentProperties: ComponentType<any> = lazy(() => import('./AgentProperties'));
|
|
13
|
+
export const PlanArticle: ComponentType<any> = lazy(() => import('./PlanArticle'));
|
|
13
14
|
export const RoutineArticle: ComponentType<any> = lazy(() => import('./RoutineArticle'));
|
|
14
15
|
export const RoutineList: ComponentType<any> = lazy(() => import('./RoutineList'));
|
|
15
16
|
export const TracePanel: ComponentType<any> = lazy(() => import('./TracePanel'));
|
|
@@ -2,62 +2,63 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Layer from 'effect/Layer';
|
|
7
|
+
|
|
8
|
+
import { createFeedServiceLayer, type Space, getSpace } from '@dxos/client/echo';
|
|
9
|
+
import { Sequence, type SequenceEvent, type SequenceLogger } from '@dxos/conductor';
|
|
10
|
+
import { DXN, Feed, Obj, Ref } from '@dxos/echo';
|
|
11
|
+
import { runAndForwardErrors } from '@dxos/effect';
|
|
8
12
|
import { InvocationTraceEndEvent, InvocationTraceEventType, InvocationTraceStartEvent } from '@dxos/functions-runtime';
|
|
9
13
|
import { TraceEvent } from '@dxos/functions-runtime';
|
|
10
14
|
import { InvocationOutcome } from '@dxos/functions-runtime';
|
|
11
|
-
import { type InvocationTraceEvent } from '@dxos/functions-runtime';
|
|
12
15
|
import { invariant } from '@dxos/invariant';
|
|
13
16
|
import { QueueSubspaceTags } from '@dxos/keys';
|
|
14
17
|
|
|
15
|
-
export class
|
|
18
|
+
export class FeedLogger implements SequenceLogger {
|
|
16
19
|
private _space: Space;
|
|
17
|
-
private
|
|
20
|
+
private _invocationTraceFeed: Feed.Feed;
|
|
21
|
+
private _feedServiceLayer: Layer.Layer<Feed.FeedService>;
|
|
18
22
|
|
|
19
|
-
constructor(private readonly sequence: Sequence) {
|
|
23
|
+
constructor(private readonly sequence: Sequence.Sequence) {
|
|
20
24
|
const space = getSpace(sequence);
|
|
21
25
|
invariant(space, 'Space not found');
|
|
22
26
|
this._space = space;
|
|
27
|
+
this._feedServiceLayer = createFeedServiceLayer(space.queues);
|
|
23
28
|
|
|
24
29
|
const existingFeedRef = this._space.properties.invocationTraceFeed;
|
|
25
|
-
let queueDxn: DXN | undefined;
|
|
26
|
-
|
|
27
30
|
if (existingFeedRef) {
|
|
28
|
-
// A feed reference exists;
|
|
29
|
-
//
|
|
31
|
+
// A feed reference exists; ensure its target is loaded. If not, fail loudly
|
|
32
|
+
// rather than silently creating a new feed and orphaning existing traces.
|
|
30
33
|
invariant(existingFeedRef.target, 'invocationTraceFeed reference is not yet loaded');
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
invariant(Feed.getQueueDxn(existingFeedRef.target), 'invocationTraceFeed has no DXN');
|
|
35
|
+
this._invocationTraceFeed = existingFeedRef.target;
|
|
33
36
|
} else {
|
|
34
37
|
const feed = space.db.add(Feed.make({ namespace: 'trace' }));
|
|
35
|
-
|
|
36
|
-
invariant(queueDxn, 'New invocationTraceFeed has no queue DXN');
|
|
38
|
+
invariant(Feed.getQueueDxn(feed), 'New invocationTraceFeed has no DXN');
|
|
37
39
|
Obj.update(this._space.properties, (obj) => {
|
|
38
40
|
obj.invocationTraceFeed = Ref.make(feed);
|
|
39
41
|
});
|
|
42
|
+
this._invocationTraceFeed = feed;
|
|
40
43
|
}
|
|
41
|
-
|
|
42
|
-
this._invocationTraceQueue = this._space.queues.get(queueDxn);
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
log(event: SequenceEvent) {
|
|
46
47
|
switch (event.type) {
|
|
47
48
|
case 'begin':
|
|
48
|
-
void this.
|
|
49
|
+
void this._appendToTraceFeed([
|
|
49
50
|
Obj.make(InvocationTraceStartEvent, {
|
|
50
51
|
type: InvocationTraceEventType.START,
|
|
51
52
|
invocationId: event.invocationId,
|
|
52
53
|
timestamp: Date.now(),
|
|
53
54
|
input: {},
|
|
54
|
-
|
|
55
|
+
invocationTraceFeed: Ref.fromDXN(this._getTraceFeedDXN(event.invocationId)),
|
|
55
56
|
invocationTarget: Ref.make(this.sequence),
|
|
56
57
|
}),
|
|
57
58
|
]);
|
|
58
59
|
break;
|
|
59
60
|
case 'end':
|
|
60
|
-
void this.
|
|
61
|
+
void this._appendToTraceFeed([
|
|
61
62
|
Obj.make(InvocationTraceEndEvent, {
|
|
62
63
|
type: InvocationTraceEventType.END,
|
|
63
64
|
invocationId: event.invocationId,
|
|
@@ -68,7 +69,7 @@ export class QueueLogger implements SequenceLogger {
|
|
|
68
69
|
break;
|
|
69
70
|
case 'step-start':
|
|
70
71
|
case 'step-complete':
|
|
71
|
-
void this.
|
|
72
|
+
void this._appendTraceEvent(event.invocationId, [
|
|
72
73
|
Obj.make(TraceEvent, {
|
|
73
74
|
outcome: event.type,
|
|
74
75
|
truncated: false,
|
|
@@ -86,7 +87,7 @@ export class QueueLogger implements SequenceLogger {
|
|
|
86
87
|
]);
|
|
87
88
|
break;
|
|
88
89
|
case 'message':
|
|
89
|
-
void this.
|
|
90
|
+
void this._appendTraceEvent(event.invocationId, [
|
|
90
91
|
Obj.make(TraceEvent, {
|
|
91
92
|
outcome: event.type,
|
|
92
93
|
truncated: false,
|
|
@@ -104,7 +105,7 @@ export class QueueLogger implements SequenceLogger {
|
|
|
104
105
|
]);
|
|
105
106
|
break;
|
|
106
107
|
case 'block':
|
|
107
|
-
void this.
|
|
108
|
+
void this._appendTraceEvent(event.invocationId, [
|
|
108
109
|
Obj.make(TraceEvent, {
|
|
109
110
|
outcome: event.type,
|
|
110
111
|
truncated: false,
|
|
@@ -124,12 +125,21 @@ export class QueueLogger implements SequenceLogger {
|
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
private
|
|
128
|
+
private _getTraceFeedDXN(invocationId: string): DXN {
|
|
128
129
|
return DXN.fromQueue(QueueSubspaceTags.TRACE, this._space.id, invocationId);
|
|
129
130
|
}
|
|
130
131
|
|
|
131
|
-
private
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
private _appendToTraceFeed(items: any[]): Promise<void> {
|
|
133
|
+
return Feed.append(this._invocationTraceFeed, items).pipe(
|
|
134
|
+
Effect.provide(this._feedServiceLayer),
|
|
135
|
+
runAndForwardErrors,
|
|
136
|
+
);
|
|
134
137
|
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Per-invocation trace event feeds are deprecated and no longer functional;
|
|
141
|
+
* this is a no-op until a replacement tracing data structure lands.
|
|
142
|
+
*/
|
|
143
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
144
|
+
private async _appendTraceEvent(_invocationId: string, _items: TraceEvent[]): Promise<void> {}
|
|
135
145
|
}
|
|
@@ -6,7 +6,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { useCapabilities } from '@dxos/app-framework/ui';
|
|
8
8
|
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
-
import { type
|
|
9
|
+
import { type AiContext } from '@dxos/assistant';
|
|
10
10
|
import { Blueprint } from '@dxos/compute';
|
|
11
11
|
import { type Database, Filter, Obj, Ref } from '@dxos/echo';
|
|
12
12
|
import { useQuery } from '@dxos/react-client/echo';
|
|
@@ -35,7 +35,7 @@ export const useBlueprints = ({
|
|
|
35
35
|
const staticBlueprints = useMemo(() => blueprintRegistry?.query() ?? [], [blueprintRegistry]);
|
|
36
36
|
const spaceBlueprints = useQuery(db, Filter.type(Blueprint.Blueprint));
|
|
37
37
|
return useMemo(() => {
|
|
38
|
-
const blueprints = distinctBy([...staticBlueprints, ...spaceBlueprints], (b) => b.key);
|
|
38
|
+
const blueprints = distinctBy([...staticBlueprints, ...spaceBlueprints], (b) => Obj.getMeta(b).key);
|
|
39
39
|
blueprints.sort(({ name: a }, { name: b }) => a.localeCompare(b));
|
|
40
40
|
return blueprints;
|
|
41
41
|
}, [staticBlueprints, spaceBlueprints]);
|
|
@@ -44,7 +44,7 @@ export const useBlueprints = ({
|
|
|
44
44
|
/**
|
|
45
45
|
* Create reactive map of active blueprints (by key).
|
|
46
46
|
*/
|
|
47
|
-
export const useActiveBlueprints = ({ context }: { context?:
|
|
47
|
+
export const useActiveBlueprints = ({ context }: { context?: AiContext.Binder }) => {
|
|
48
48
|
const [active, setActive] = useState<Map<string, Blueprint.Blueprint>>(new Map());
|
|
49
49
|
|
|
50
50
|
useEffect(() => {
|
|
@@ -55,7 +55,13 @@ export const useActiveBlueprints = ({ context }: { context?: AiContextBinder })
|
|
|
55
55
|
|
|
56
56
|
const updateActive = () => {
|
|
57
57
|
const blueprints = context.getBlueprints();
|
|
58
|
-
setActive(
|
|
58
|
+
setActive(
|
|
59
|
+
new Map(
|
|
60
|
+
blueprints
|
|
61
|
+
.map((blueprint) => [Obj.getMeta(blueprint).key, blueprint] as const)
|
|
62
|
+
.filter((entry): entry is readonly [string, Blueprint.Blueprint] => entry[0] !== undefined),
|
|
63
|
+
),
|
|
64
|
+
);
|
|
59
65
|
};
|
|
60
66
|
|
|
61
67
|
// Set initial value.
|
|
@@ -75,7 +81,7 @@ export const useBlueprintHandlers = ({
|
|
|
75
81
|
blueprintRegistry,
|
|
76
82
|
}: {
|
|
77
83
|
db: Database.Database;
|
|
78
|
-
context?:
|
|
84
|
+
context?: AiContext.Binder;
|
|
79
85
|
blueprintRegistry?: Blueprint.Registry;
|
|
80
86
|
}) => {
|
|
81
87
|
const onUpdateBlueprint = useCallback(
|
|
@@ -86,7 +92,7 @@ export const useBlueprintHandlers = ({
|
|
|
86
92
|
|
|
87
93
|
// Find existing cloned blueprint.
|
|
88
94
|
const objects = await db.query(Filter.type(Blueprint.Blueprint)).run();
|
|
89
|
-
let storedBlueprint = objects.find((blueprint) => blueprint.key === key);
|
|
95
|
+
let storedBlueprint = objects.find((blueprint) => Obj.getMeta(blueprint).key === key);
|
|
90
96
|
if (checked) {
|
|
91
97
|
if (!storedBlueprint) {
|
|
92
98
|
const blueprint = blueprintRegistry.getByKey(key);
|
|
@@ -13,7 +13,7 @@ import { Feed, Ref } from '@dxos/echo';
|
|
|
13
13
|
import { createFeedServiceLayer } from '@dxos/echo-db';
|
|
14
14
|
import { runAndForwardErrors } from '@dxos/effect';
|
|
15
15
|
import { log } from '@dxos/log';
|
|
16
|
-
import { type AutomationCapabilities } from '@dxos/plugin-automation
|
|
16
|
+
import { type AutomationCapabilities } from '@dxos/plugin-automation';
|
|
17
17
|
import { type Space } from '@dxos/react-client/echo';
|
|
18
18
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
19
19
|
|
|
@@ -43,7 +43,7 @@ export const useChatProcessor = ({
|
|
|
43
43
|
}: UseChatProcessorProps): AiChatProcessor | undefined => {
|
|
44
44
|
const observableRegistry = useContext(RegistryContext);
|
|
45
45
|
|
|
46
|
-
const [session, setSession] = useState<AiSession>();
|
|
46
|
+
const [session, setSession] = useState<AiSession.Session>();
|
|
47
47
|
useAsyncEffect(async () => {
|
|
48
48
|
if (!space || !chat) {
|
|
49
49
|
return;
|
|
@@ -57,7 +57,7 @@ export const useChatProcessor = ({
|
|
|
57
57
|
const runtime = await runAndForwardErrors(
|
|
58
58
|
Effect.runtime<Feed.FeedService>().pipe(Effect.provide(feedServiceLayer)),
|
|
59
59
|
);
|
|
60
|
-
const session = new AiSession({
|
|
60
|
+
const session = new AiSession.Session({
|
|
61
61
|
feed: feedTarget,
|
|
62
62
|
runtime,
|
|
63
63
|
registry: observableRegistry as Registry.Registry,
|
|
@@ -7,7 +7,7 @@ import { useMemo } from 'react';
|
|
|
7
7
|
import { useCapability } from '@dxos/app-framework/ui';
|
|
8
8
|
import { getPersonalSpace } from '@dxos/app-toolkit';
|
|
9
9
|
import { type Key } from '@dxos/echo';
|
|
10
|
-
import { AutomationCapabilities } from '@dxos/plugin-automation
|
|
10
|
+
import { AutomationCapabilities } from '@dxos/plugin-automation';
|
|
11
11
|
import { useClient } from '@dxos/react-client';
|
|
12
12
|
|
|
13
13
|
export type UseChatServicesProps = {
|