@dxos/plugin-assistant 0.8.4-main.fcfe5033a5 → 0.8.4-staging.60fe92afc8
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/PLUGIN.mdl +439 -0
- package/README.md +1 -1
- package/dist/lib/neutral/AgentArticle-K7XM46OQ.mjs +160 -0
- package/dist/lib/neutral/AgentArticle-K7XM46OQ.mjs.map +7 -0
- package/dist/lib/neutral/AgentProperties-LFTEYJ54.mjs +40 -0
- package/dist/lib/neutral/AgentProperties-LFTEYJ54.mjs.map +7 -0
- package/dist/lib/neutral/AssistantPlugin.mjs +10 -0
- package/dist/lib/neutral/AssistantPlugin.node.mjs +72 -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/AssistantSettings-GG52BLKS.mjs +40 -0
- package/dist/lib/neutral/AssistantSettings-GG52BLKS.mjs.map +7 -0
- package/dist/lib/neutral/BlueprintArticle-ZBOZNZM7.mjs +27 -0
- package/dist/lib/neutral/BlueprintArticle-ZBOZNZM7.mjs.map +7 -0
- package/dist/lib/neutral/ChatArticle-VNVZCDUR.mjs +8 -0
- package/dist/lib/neutral/ChatCompanion-LBUHYWQG.mjs +128 -0
- package/dist/lib/neutral/ChatCompanion-LBUHYWQG.mjs.map +7 -0
- package/dist/lib/neutral/ChatDialog-DCA6FLOV.mjs +73 -0
- package/dist/lib/neutral/ChatDialog-DCA6FLOV.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-5NYXHRG6.mjs +119 -0
- package/dist/lib/neutral/RoutineArticle-5NYXHRG6.mjs.map +7 -0
- package/dist/lib/neutral/RoutineList-SO5ETHNT.mjs +48 -0
- package/dist/lib/neutral/RoutineList-SO5ETHNT.mjs.map +7 -0
- package/dist/lib/neutral/RoutineProperties-FISLMW2R.mjs +17 -0
- package/dist/lib/neutral/RoutineProperties-FISLMW2R.mjs.map +7 -0
- package/dist/lib/neutral/TracePanel-KTZJ6JNR.mjs +167 -0
- package/dist/lib/neutral/TracePanel-KTZJ6JNR.mjs.map +7 -0
- package/dist/lib/neutral/TriggerStatus-X7Y5JFZJ.mjs +93 -0
- package/dist/lib/neutral/TriggerStatus-X7Y5JFZJ.mjs.map +7 -0
- package/dist/lib/neutral/agent-hydrator-PJBYVMBW.mjs +24 -0
- package/dist/lib/neutral/agent-hydrator-PJBYVMBW.mjs.map +7 -0
- package/dist/lib/neutral/agent-service-WCAP5MLI.mjs +32 -0
- package/dist/lib/neutral/agent-service-WCAP5MLI.mjs.map +7 -0
- package/dist/lib/neutral/ai-context-7WRHWYXY.mjs +42 -0
- package/dist/lib/neutral/ai-context-7WRHWYXY.mjs.map +7 -0
- package/dist/lib/neutral/ai-service-AADUIKBY.mjs +40 -0
- package/dist/lib/neutral/ai-service-AADUIKBY.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-WUFHQH3Y.mjs +232 -0
- package/dist/lib/neutral/app-graph-builder-WUFHQH3Y.mjs.map +7 -0
- package/dist/lib/neutral/automation-templates-M2XQWGR6.mjs +115 -0
- package/dist/lib/neutral/automation-templates-M2XQWGR6.mjs.map +7 -0
- package/dist/lib/neutral/blueprint-definition-MH2QLYQH.mjs +39 -0
- package/dist/lib/neutral/blueprint-definition-MH2QLYQH.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/blueprints/index.mjs +1 -1
- package/dist/lib/neutral/capabilities/index.mjs +45 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/{browser/chunk-EZRS3J25.mjs → neutral/chunk-5H6UJHLF.mjs} +3 -3
- package/dist/lib/neutral/chunk-5H6UJHLF.mjs.map +7 -0
- package/dist/lib/neutral/chunk-HLANPOBA.mjs +10 -0
- package/dist/lib/neutral/chunk-HLANPOBA.mjs.map +7 -0
- package/dist/lib/neutral/chunk-KLYLW4WH.mjs +9 -0
- package/dist/lib/neutral/chunk-KLYLW4WH.mjs.map +7 -0
- package/dist/lib/neutral/chunk-QAZMOFPI.mjs +130 -0
- package/dist/lib/neutral/chunk-QAZMOFPI.mjs.map +7 -0
- package/dist/lib/neutral/chunk-RKVVK3R3.mjs +110 -0
- package/dist/lib/neutral/chunk-RKVVK3R3.mjs.map +7 -0
- package/dist/lib/neutral/chunk-SMFJD7BP.mjs +8 -0
- package/dist/lib/neutral/chunk-SMFJD7BP.mjs.map +7 -0
- package/dist/lib/neutral/chunk-VTK5R4H3.mjs +9 -0
- package/dist/lib/neutral/chunk-VTK5R4H3.mjs.map +7 -0
- package/dist/lib/neutral/chunk-XYHPOGTK.mjs +43 -0
- package/dist/lib/neutral/chunk-XYHPOGTK.mjs.map +7 -0
- package/dist/lib/neutral/chunk-YXRGZYYH.mjs +392 -0
- package/dist/lib/neutral/chunk-YXRGZYYH.mjs.map +7 -0
- package/dist/lib/neutral/companion-chat-provisioner-YZZ73P6E.mjs +120 -0
- package/dist/lib/neutral/companion-chat-provisioner-YZZ73P6E.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +2410 -0
- 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/neutral/create-chat-SGGQ6HVN.mjs +54 -0
- package/dist/lib/neutral/create-chat-SGGQ6HVN.mjs.map +7 -0
- package/dist/lib/neutral/create-object-U2SOFZLR.mjs +92 -0
- package/dist/lib/neutral/create-object-U2SOFZLR.mjs.map +7 -0
- package/dist/lib/neutral/edge-model-resolver-BBVOJBGJ.mjs +55 -0
- package/dist/lib/neutral/edge-model-resolver-BBVOJBGJ.mjs.map +7 -0
- package/dist/lib/{browser/ensure-companion-chat-ZEZA34MZ.mjs → neutral/ensure-companion-chat-AMOF3C66.mjs} +14 -21
- package/dist/lib/neutral/ensure-companion-chat-AMOF3C66.mjs.map +7 -0
- package/dist/lib/neutral/execution-graph/index.mjs +703 -0
- package/dist/lib/neutral/execution-graph/index.mjs.map +7 -0
- package/dist/lib/neutral/fork-chat-34KEF4ZJ.mjs +95 -0
- package/dist/lib/neutral/fork-chat-34KEF4ZJ.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +992 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +38 -0
- package/dist/lib/neutral/integration-provider-RBD3AFJU.mjs +71 -0
- package/dist/lib/neutral/integration-provider-RBD3AFJU.mjs.map +7 -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-extension-YMIFDMYF.mjs +110 -0
- package/dist/lib/neutral/markdown-extension-YMIFDMYF.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/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/operations/index.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-XRTBW5OJ.mjs +174 -0
- package/dist/lib/neutral/react-surface-XRTBW5OJ.mjs.map +7 -0
- package/dist/lib/{browser/resolve-navigation-targets-NZOD66NY.mjs → neutral/resolve-navigation-targets-ZHIMMH7L.mjs} +6 -6
- package/dist/lib/neutral/resolve-navigation-targets-ZHIMMH7L.mjs.map +7 -0
- package/dist/lib/{browser/run-prompt-in-new-chat-THLK5YQC.mjs → neutral/run-prompt-in-new-chat-D5IIE2C7.mjs} +22 -56
- package/dist/lib/neutral/run-prompt-in-new-chat-D5IIE2C7.mjs.map +7 -0
- package/dist/lib/{browser/set-current-chat-LRS3VFSH.mjs → neutral/set-current-chat-VWBPSIMZ.mjs} +7 -13
- package/dist/lib/neutral/set-current-chat-VWBPSIMZ.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/testing.mjs.map +7 -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/neutral/translations.mjs +179 -0
- 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-3Y36KFAS.mjs → neutral/update-chat-name-Y7JWIP64.mjs} +26 -36
- package/dist/lib/neutral/update-chat-name-Y7JWIP64.mjs.map +7 -0
- package/dist/types/src/AssistantPlugin.d.ts +3 -1
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/AssistantPlugin.node.d.ts +5 -0
- package/dist/types/src/AssistantPlugin.node.d.ts.map +1 -0
- package/dist/types/src/AssistantPlugin.test.d.ts +2 -0
- package/dist/types/src/AssistantPlugin.test.d.ts.map +1 -0
- 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/blueprints/assistant/blueprint.d.ts +2 -2
- package/dist/types/src/blueprints/assistant/blueprint.d.ts.map +1 -1
- package/dist/types/src/blueprints/assistant/blueprint.node.test.d.ts +2 -0
- package/dist/types/src/blueprints/assistant/blueprint.node.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/agent-hydrator.d.ts +5 -0
- package/dist/types/src/capabilities/agent-hydrator.d.ts.map +1 -0
- package/dist/types/src/capabilities/agent-service.d.ts +6 -0
- package/dist/types/src/capabilities/agent-service.d.ts.map +1 -0
- package/dist/types/src/capabilities/ai-context.d.ts +6 -0
- package/dist/types/src/capabilities/ai-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/ai-service.d.ts +2 -2
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +2 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/automation-templates.d.ts +6 -0
- package/dist/types/src/capabilities/automation-templates.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- 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/edge-model-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +36 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/integration-provider.d.ts +5 -0
- package/dist/types/src/capabilities/integration-provider.d.ts.map +1 -0
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/{markdown.d.ts → markdown-extension.d.ts} +1 -1
- package/dist/types/src/capabilities/markdown-extension.d.ts.map +1 -0
- 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/capabilities/operation-handler.d.ts +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
- package/dist/types/src/components/AgentProperties/AgentProperties.d.ts +7 -0
- package/dist/types/src/components/AgentProperties/AgentProperties.d.ts.map +1 -0
- package/dist/types/src/{containers → components}/AgentProperties/AgentProperties.stories.d.ts +1 -2
- package/dist/types/src/components/AgentProperties/AgentProperties.stories.d.ts.map +1 -0
- package/dist/types/src/components/AgentProperties/index.d.ts +2 -0
- package/dist/types/src/components/AgentProperties/index.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.stories.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +44 -42
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/context.d.ts +29 -0
- package/dist/types/src/components/Chat/context.d.ts.map +1 -0
- package/dist/types/src/components/Chat/events.d.ts +3 -0
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts +1 -1
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatMcpErrors.d.ts +12 -0
- package/dist/types/src/components/ChatPrompt/ChatMcpErrors.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +10 -14
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts +2 -9
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatPrompt.d.ts +27 -0
- package/dist/types/src/components/ChatPrompt/ChatPrompt.d.ts.map +1 -0
- 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/ChatPrompt/ChatStatus.d.ts +20 -0
- package/dist/types/src/components/ChatPrompt/ChatStatus.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/index.d.ts +3 -0
- package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Anchor.stories.d.ts +14 -0
- package/dist/types/src/components/ChatThread/Anchor.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +6 -3
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +5 -5
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts +2 -2
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts +8 -1
- package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/registry.d.ts +18 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/sync.d.ts +42 -16
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/tool-widget-state.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/FallbackWidget.d.ts +4 -4
- package/dist/types/src/components/ChatThread/widgets/FallbackWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/ReferenceWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/SelectWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/StatsWidget.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/SuggestionWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/SummaryWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/widgets/defaults.d.ts +5 -0
- package/dist/types/src/components/ChatThread/widgets/defaults.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/index.d.ts +1 -2
- package/dist/types/src/components/ChatThread/widgets/index.d.ts.map +1 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts +4 -3
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts.map +1 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts +0 -1
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts.map +1 -1
- package/dist/types/src/components/RoutineProperties/RoutineProperties.d.ts +7 -0
- package/dist/types/src/components/RoutineProperties/RoutineProperties.d.ts.map +1 -0
- package/dist/types/src/components/RoutineProperties/RoutineProperties.stories.d.ts +15 -0
- package/dist/types/src/components/RoutineProperties/RoutineProperties.stories.d.ts.map +1 -0
- package/dist/types/src/components/RoutineProperties/index.d.ts +2 -0
- package/dist/types/src/components/RoutineProperties/index.d.ts.map +1 -0
- 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/TemplateEditor.d.ts +5 -3
- 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 +4 -5
- 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/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -1
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +4 -4
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +3 -3
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +5 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/containers/AgentArticle/AgentArticle.d.ts.map +1 -1
- package/dist/types/src/containers/AgentArticle/AgentArticle.stories.d.ts +0 -2
- package/dist/types/src/containers/AgentArticle/AgentArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/AgentProperties/AgentProperties.d.ts.map +1 -1
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts +1 -1
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts.map +1 -1
- package/dist/types/src/containers/ChatArticle/ChatArticle.d.ts +25 -0
- package/dist/types/src/containers/ChatArticle/ChatArticle.d.ts.map +1 -0
- package/dist/types/src/containers/ChatArticle/ChatArticle.stories.d.ts +15 -0
- package/dist/types/src/containers/ChatArticle/ChatArticle.stories.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 +11 -3
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts.map +1 -1
- package/dist/types/src/containers/ChatDialog/ChatDialog.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 +6 -0
- package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts.map +1 -0
- 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/RoutineArticle/index.d.ts +2 -0
- package/dist/types/src/containers/RoutineArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/RoutineList/RoutineList.d.ts +6 -0
- package/dist/types/src/containers/RoutineList/RoutineList.d.ts.map +1 -0
- package/dist/types/src/containers/{PromptList/PromptList.stories.d.ts → RoutineList/RoutineList.stories.d.ts} +1 -1
- package/dist/types/src/containers/RoutineList/RoutineList.stories.d.ts.map +1 -0
- package/dist/types/src/containers/RoutineList/index.d.ts +2 -0
- package/dist/types/src/containers/RoutineList/index.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts +4 -5
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts +4 -3
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts +6 -6
- package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/index.d.ts.map +1 -1
- package/dist/types/src/containers/TracePanel/testing/index.d.ts +3 -0
- package/dist/types/src/containers/TracePanel/testing/index.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/testing/simulated-agent.d.ts +14 -0
- package/dist/types/src/containers/TracePanel/testing/simulated-agent.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/testing/snapshot-playback.d.ts +12 -0
- package/dist/types/src/containers/TracePanel/testing/snapshot-playback.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts +3 -2
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts.map +1 -1
- package/dist/types/src/containers/TriggerStatus/index.d.ts +1 -1
- package/dist/types/src/containers/TriggerStatus/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +6 -5
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/execution-graph/execution-graph.d.ts +108 -0
- package/dist/types/src/execution-graph/execution-graph.d.ts.map +1 -0
- package/dist/types/src/execution-graph/execution-graph.test.d.ts +2 -0
- package/dist/types/src/execution-graph/execution-graph.test.d.ts.map +1 -0
- package/dist/types/src/execution-graph/index.d.ts +3 -0
- package/dist/types/src/execution-graph/index.d.ts.map +1 -0
- package/dist/types/src/execution-graph/remote-snapshot.test.d.ts +2 -0
- package/dist/types/src/execution-graph/remote-snapshot.test.d.ts.map +1 -0
- package/dist/types/src/execution-graph/span-tree.d.ts +76 -0
- package/dist/types/src/execution-graph/span-tree.d.ts.map +1 -0
- package/dist/types/src/execution-graph/span-tree.test.d.ts +2 -0
- package/dist/types/src/execution-graph/span-tree.test.d.ts.map +1 -0
- package/dist/types/src/execution-graph/sub-agent-delegation.test.d.ts +2 -0
- package/dist/types/src/execution-graph/sub-agent-delegation.test.d.ts.map +1 -0
- package/dist/types/src/execution-graph/testing/collect-trace-events.d.ts +40 -0
- package/dist/types/src/execution-graph/testing/collect-trace-events.d.ts.map +1 -0
- package/dist/types/src/execution-graph/testing/index.d.ts +2 -0
- package/dist/types/src/execution-graph/testing/index.d.ts.map +1 -0
- package/dist/types/src/extensions/prompt-extension.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/functions/services.test.d.ts +2 -0
- package/dist/types/src/functions/services.test.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +3 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +56 -15
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatKeymap.d.ts +12 -0
- package/dist/types/src/hooks/useChatKeymap.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +5 -5
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +7 -3
- 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 +5 -4
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -1
- package/dist/types/src/hooks/useDebug.d.ts +10 -0
- package/dist/types/src/hooks/useDebug.d.ts.map +1 -0
- package/dist/types/src/hooks/useFilteredTypes.d.ts +1 -1
- package/dist/types/src/hooks/useFilteredTypes.d.ts.map +1 -1
- package/dist/types/src/hooks/useFlush.d.ts +1 -1
- package/dist/types/src/hooks/useFlush.d.ts.map +1 -1
- package/dist/types/src/hooks/usePresets.d.ts +2 -2
- package/dist/types/src/hooks/usePresets.d.ts.map +1 -1
- package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +3 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create-chat.d.ts +3 -3
- package/dist/types/src/operations/create-chat.d.ts.map +1 -1
- package/dist/types/src/operations/ensure-companion-chat.d.ts +3 -3
- package/dist/types/src/operations/ensure-companion-chat.d.ts.map +1 -1
- package/dist/types/src/operations/fork-chat.d.ts +5 -0
- package/dist/types/src/operations/fork-chat.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +1 -2
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/prompt.node.test.d.ts +2 -0
- package/dist/types/src/operations/prompt.node.test.d.ts.map +1 -0
- package/dist/types/src/operations/resolve-navigation-targets.d.ts +4 -2
- package/dist/types/src/operations/resolve-navigation-targets.d.ts.map +1 -1
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts +3 -3
- 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 +3 -3
- 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 +3 -3
- package/dist/types/src/operations/update-chat-name.d.ts.map +1 -1
- package/dist/types/src/paths.d.ts +3 -0
- package/dist/types/src/paths.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/processor/presets.d.ts.map +1 -1
- package/dist/types/src/processor/processor.d.ts +263 -26
- package/dist/types/src/processor/processor.d.ts.map +1 -1
- package/dist/types/src/processor/processor.node.test.d.ts +2 -0
- package/dist/types/src/processor/processor.node.test.d.ts.map +1 -0
- package/dist/types/src/templates/automation-templates.test.d.ts +2 -0
- package/dist/types/src/templates/automation-templates.test.d.ts.map +1 -0
- package/dist/types/src/templates/daily-digest.d.ts +3 -0
- package/dist/types/src/templates/daily-digest.d.ts.map +1 -0
- package/dist/types/src/templates/index.d.ts +4 -0
- package/dist/types/src/templates/index.d.ts.map +1 -0
- package/dist/types/src/templates/research-brief.d.ts +3 -0
- package/dist/types/src/templates/research-brief.d.ts.map +1 -0
- package/dist/types/src/templates/scaffold.d.ts +17 -0
- package/dist/types/src/templates/scaffold.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/snapshot.d.ts +21 -0
- package/dist/types/src/testing/snapshot.d.ts.map +1 -0
- 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-generator.test.d.ts +2 -0
- package/dist/types/src/testing/test-generator.test.d.ts.map +1 -0
- package/dist/types/src/testing/test-sequence.d.ts +10 -3
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/testing/test-trace.d.ts +5 -0
- package/dist/types/src/testing/test-trace.d.ts.map +1 -0
- package/dist/types/src/testing/trace-timeline.node.test.d.ts +2 -0
- package/dist/types/src/testing/trace-timeline.node.test.d.ts.map +1 -0
- 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 +25 -8
- 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/types/AssistantOperation.d.ts +153 -0
- package/dist/types/src/types/AssistantOperation.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +21 -5
- package/dist/types/src/types/Settings.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +8 -3
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/preset.d.ts +12 -0
- package/dist/types/src/types/preset.d.ts.map +1 -0
- package/dist/types/src/types/service.d.ts +2 -3
- package/dist/types/src/types/service.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 +177 -146
- package/src/AssistantPlugin.conversations.json +1 -0
- package/src/AssistantPlugin.node.ts +90 -0
- package/src/AssistantPlugin.test.ts +213 -0
- package/src/AssistantPlugin.ts +158 -0
- package/src/AssistantPlugin.workerd.ts +41 -0
- package/src/blueprints/assistant/{blueprint.test.ts → blueprint.node.test.ts} +5 -5
- package/src/blueprints/assistant/blueprint.ts +4 -4
- package/src/capabilities/agent-hydrator.ts +37 -0
- package/src/capabilities/agent-service.ts +38 -0
- package/src/capabilities/ai-context.ts +48 -0
- package/src/capabilities/ai-service.ts +31 -11
- package/src/capabilities/app-graph-builder.ts +106 -86
- package/src/capabilities/automation-templates.ts +16 -0
- package/src/capabilities/blueprint-definition.ts +15 -8
- package/src/capabilities/companion-chat-provisioner.ts +5 -5
- package/src/capabilities/create-object.ts +100 -0
- package/src/capabilities/edge-model-resolver.ts +53 -16
- package/src/capabilities/index.ts +23 -3
- package/src/capabilities/integration-provider.ts +86 -0
- package/src/capabilities/{markdown.ts → markdown-extension.ts} +3 -3
- package/src/capabilities/migrations.ts +4 -11
- package/src/capabilities/operation-handler.ts +1 -1
- package/src/capabilities/react-surface.tsx +41 -21
- package/src/components/AgentProperties/AgentProperties.stories.tsx +74 -0
- package/src/components/AgentProperties/AgentProperties.tsx +103 -0
- package/src/components/AgentProperties/index.ts +5 -0
- package/src/components/AssistantSettings/AssistantSettings.stories.tsx +3 -2
- package/src/components/AssistantSettings/AssistantSettings.tsx +22 -111
- package/src/components/Chat/Chat.tsx +145 -277
- package/src/components/Chat/context.ts +39 -0
- package/src/components/Chat/events.ts +7 -0
- package/src/components/ChatPrompt/ChatActions.tsx +11 -11
- package/src/components/ChatPrompt/ChatMcpErrors.tsx +50 -0
- package/src/components/ChatPrompt/ChatOptions.stories.tsx +32 -18
- package/src/components/ChatPrompt/ChatOptions.tsx +121 -103
- package/src/components/ChatPrompt/ChatPresets.tsx +3 -7
- package/src/components/ChatPrompt/ChatPrompt.tsx +180 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +9 -13
- package/src/components/ChatPrompt/ChatStatus.tsx +123 -0
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +2 -2
- package/src/components/ChatPrompt/index.ts +3 -0
- package/src/components/ChatThread/Anchor.stories.tsx +95 -0
- package/src/components/ChatThread/ChatThread.stories.tsx +33 -37
- package/src/components/ChatThread/ChatThread.tsx +47 -23
- package/src/components/ChatThread/DEBUG.md +41 -0
- package/src/components/ChatThread/Link.tsx +5 -5
- package/src/components/ChatThread/MarkdownStream.stories.tsx +43 -5
- package/src/components/ChatThread/registry.tsx +80 -28
- package/src/components/ChatThread/sync.test.ts +180 -22
- package/src/components/ChatThread/sync.ts +89 -104
- package/src/components/ChatThread/testing/reasoning.md +25 -0
- package/src/components/ChatThread/widgets/FallbackWidget.tsx +8 -6
- package/src/components/ChatThread/widgets/ReasoningWidget.ts +13 -7
- package/src/components/ChatThread/widgets/ReferenceWidget.ts +3 -1
- package/src/components/ChatThread/widgets/SelectWidget.ts +4 -2
- package/src/components/ChatThread/widgets/StatsWidget.ts +3 -1
- package/src/components/ChatThread/widgets/StatusWidget.ts +6 -86
- package/src/components/ChatThread/widgets/SuggestionWidget.ts +2 -2
- package/src/components/ChatThread/widgets/SummaryWidget.tsx +7 -6
- package/src/components/ChatThread/widgets/ToolWidget.stories.tsx +2 -1
- package/src/components/ChatThread/widgets/ToolWidget.tsx +42 -25
- package/src/components/ChatThread/widgets/defaults.ts +8 -0
- package/src/components/ChatThread/widgets/index.ts +1 -2
- package/src/components/ProcessTree/ProcessTree.stories.tsx +13 -39
- package/src/components/ProcessTree/ProcessTree.tsx +101 -67
- package/src/components/RoutineProperties/RoutineProperties.stories.tsx +59 -0
- package/src/components/RoutineProperties/RoutineProperties.tsx +23 -0
- package/src/components/RoutineProperties/index.ts +5 -0
- package/src/components/TaskList/TaskList.stories.tsx +44 -0
- package/src/components/TaskList/TaskList.tsx +45 -0
- package/src/components/TaskList/index.ts +5 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +6 -5
- package/src/components/TemplateEditor/TemplateEditor.tsx +12 -10
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +6 -9
- package/src/components/TemplateEditor/TemplateForm.tsx +52 -73
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +2 -2
- package/src/components/ToolBlock/ToolBlock.tsx +25 -17
- package/src/components/Toolbox/Toolbox.stories.tsx +6 -5
- package/src/components/Toolbox/Toolbox.tsx +6 -5
- package/src/components/index.ts +6 -0
- package/src/constants.ts +9 -0
- package/src/containers/AgentArticle/AgentArticle.stories.tsx +19 -15
- package/src/containers/AgentArticle/AgentArticle.tsx +47 -53
- package/src/containers/AgentProperties/AgentProperties.tsx +20 -135
- package/src/containers/BlueprintArticle/BlueprintArticle.tsx +2 -2
- package/src/containers/ChatArticle/ChatArticle.stories.tsx +78 -0
- package/src/containers/ChatArticle/ChatArticle.tsx +112 -0
- package/src/containers/ChatArticle/index.ts +5 -0
- package/src/containers/ChatCompanion/ChatCompanion.tsx +94 -109
- package/src/containers/ChatDialog/ChatDialog.tsx +6 -11
- 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 +109 -0
- package/src/containers/RoutineArticle/index.ts +5 -0
- package/src/containers/{PromptList/PromptList.stories.tsx → RoutineList/RoutineList.stories.tsx} +14 -13
- package/src/containers/{PromptList/PromptList.tsx → RoutineList/RoutineList.tsx} +9 -8
- package/src/containers/RoutineList/index.ts +5 -0
- package/src/containers/TracePanel/TracePanel.stories.tsx +285 -168
- package/src/containers/TracePanel/TracePanel.tsx +220 -77
- package/src/containers/TracePanel/dxn-extractor.test.ts +32 -32
- package/src/containers/TracePanel/dxn-extractor.ts +52 -64
- package/src/containers/TracePanel/testing/index.ts +6 -0
- package/src/containers/TracePanel/testing/simulated-agent.ts +114 -0
- package/src/containers/TracePanel/testing/snapshot-playback.ts +45 -0
- package/src/containers/TriggerStatus/TriggerStatus.tsx +20 -34
- package/src/containers/TriggerStatus/index.ts +1 -1
- package/src/containers/index.ts +6 -5
- package/src/execution-graph/SPEC.md +690 -0
- package/src/execution-graph/execution-graph.test.ts +891 -0
- package/src/execution-graph/execution-graph.ts +777 -0
- package/src/execution-graph/index.ts +24 -0
- package/src/execution-graph/remote-snapshot.test.ts +116 -0
- package/src/execution-graph/span-tree.test.ts +249 -0
- package/src/execution-graph/span-tree.ts +269 -0
- package/src/execution-graph/sub-agent-delegation.test.ts +50 -0
- package/src/execution-graph/testing/collect-trace-events.ts +74 -0
- package/src/execution-graph/testing/index.ts +5 -0
- package/src/execution-graph/testing/sub-agent-delegation.json +1285 -0
- package/src/{queue-logger.ts → feed-logger.ts} +39 -25
- package/src/functions/services.test.ts +53 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/useBlueprintRegistry.ts +62 -46
- package/src/hooks/useChatKeymap.ts +52 -0
- package/src/hooks/useChatProcessor.ts +33 -17
- package/src/hooks/useChatServices.ts +8 -6
- package/src/hooks/useChatToolbarActions.ts +98 -96
- package/src/hooks/useContextBinder.ts +7 -7
- package/src/hooks/useContextObjects.ts +6 -5
- package/src/hooks/useDebug.ts +38 -0
- package/src/hooks/useFilteredTypes.ts +18 -16
- package/src/hooks/usePresets.ts +5 -3
- package/src/hooks/useReferencesProvider.ts +7 -15
- package/src/index.ts +1 -5
- package/src/meta.ts +27 -8
- package/src/operations/create-chat.ts +15 -38
- package/src/operations/ensure-companion-chat.ts +49 -47
- package/src/operations/fork-chat.ts +112 -0
- package/src/operations/index.ts +3 -4
- package/src/operations/prompt.node.test.ts +82 -0
- package/src/operations/resolve-navigation-targets.ts +8 -3
- package/src/operations/run-prompt-in-new-chat.ts +87 -87
- package/src/operations/set-current-chat.ts +6 -7
- package/src/operations/toggle-trace-panel-debug.ts +27 -0
- package/src/operations/update-chat-name.ts +24 -20
- package/src/paths.ts +10 -0
- package/src/plugin.ts +11 -0
- package/src/processor/presets.ts +15 -11
- package/src/processor/{processor.test.ts → processor.node.test.ts} +7 -7
- package/src/processor/processor.ts +160 -58
- package/src/templates/automation-templates.test.ts +66 -0
- package/src/templates/daily-digest.ts +37 -0
- package/src/templates/index.ts +11 -0
- package/src/templates/research-brief.ts +40 -0
- package/src/templates/scaffold.ts +74 -0
- package/src/testing/data/trace-timeline-multiple.dx.json +1 -0
- package/src/testing/data/trace-timeline-remote.dx.json +1 -0
- package/src/testing/data/trace-timeline.dx.json +4657 -0
- package/src/testing/index.ts +2 -0
- package/src/testing/snapshot.ts +35 -0
- package/src/testing/test-generator.test.ts +71 -0
- package/src/testing/test-generator.ts +196 -205
- package/src/testing/test-sequence.ts +3 -3
- package/src/testing/test-services.ts +1 -1
- package/src/testing/test-trace.ts +20 -0
- package/src/testing/trace-timeline.node.conversations.json +1 -0
- package/src/testing/{trace-timeline.test.ts → trace-timeline.node.test.ts} +45 -50
- package/src/testing.ts +9 -0
- package/src/translations.ts +40 -38
- package/src/types/Assistant.ts +13 -1
- package/src/types/AssistantCapabilities.ts +35 -0
- package/src/types/AssistantEvents.ts +11 -0
- package/src/{operations/definitions.ts → types/AssistantOperation.ts} +66 -29
- package/src/types/Settings.ts +68 -7
- package/src/types/index.ts +12 -3
- package/src/types/preset.ts +16 -0
- package/src/types/service.ts +5 -10
- package/src/util/suggestions.test.ts +52 -0
- package/src/util/suggestions.ts +42 -0
- package/src/vite-env.d.ts +5 -0
- package/dist/lib/browser/AssistantSettings-7QMO3LGF.mjs +0 -97
- package/dist/lib/browser/AssistantSettings-7QMO3LGF.mjs.map +0 -7
- package/dist/lib/browser/chunk-ATHYBVGN.mjs +0 -176
- package/dist/lib/browser/chunk-ATHYBVGN.mjs.map +0 -7
- package/dist/lib/browser/chunk-EZRS3J25.mjs.map +0 -7
- package/dist/lib/browser/chunk-LMVTXH54.mjs +0 -154
- package/dist/lib/browser/chunk-LMVTXH54.mjs.map +0 -7
- package/dist/lib/browser/create-chat-LBZHGVSN.mjs +0 -82
- package/dist/lib/browser/create-chat-LBZHGVSN.mjs.map +0 -7
- package/dist/lib/browser/ensure-companion-chat-ZEZA34MZ.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -3452
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/on-create-space-54RNX5JI.mjs +0 -22
- package/dist/lib/browser/on-create-space-54RNX5JI.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-NZOD66NY.mjs.map +0 -7
- package/dist/lib/browser/run-prompt-in-new-chat-THLK5YQC.mjs.map +0 -7
- package/dist/lib/browser/set-current-chat-LRS3VFSH.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -20
- package/dist/lib/browser/update-chat-name-3Y36KFAS.mjs.map +0 -7
- package/dist/lib/node-esm/AssistantSettings-UVUTKO7E.mjs +0 -98
- package/dist/lib/node-esm/AssistantSettings-UVUTKO7E.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -9
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-NZIKC7AN.mjs +0 -32
- package/dist/lib/node-esm/chunk-NZIKC7AN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PXAJSTGZ.mjs +0 -177
- package/dist/lib/node-esm/chunk-PXAJSTGZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-W3JZ2F4T.mjs +0 -155
- package/dist/lib/node-esm/chunk-W3JZ2F4T.mjs.map +0 -7
- package/dist/lib/node-esm/create-chat-3BEG4R6J.mjs +0 -83
- package/dist/lib/node-esm/create-chat-3BEG4R6J.mjs.map +0 -7
- package/dist/lib/node-esm/ensure-companion-chat-6K2WEWFP.mjs +0 -66
- package/dist/lib/node-esm/ensure-companion-chat-6K2WEWFP.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -3453
- 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-YRPZ6HZY.mjs +0 -23
- package/dist/lib/node-esm/on-create-space-YRPZ6HZY.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-3PPK7XLH.mjs +0 -23
- package/dist/lib/node-esm/resolve-navigation-targets-3PPK7XLH.mjs.map +0 -7
- package/dist/lib/node-esm/run-prompt-in-new-chat-OUYKCMQ7.mjs +0 -137
- package/dist/lib/node-esm/run-prompt-in-new-chat-OUYKCMQ7.mjs.map +0 -7
- package/dist/lib/node-esm/set-current-chat-SMXZJD3F.mjs +0 -55
- package/dist/lib/node-esm/set-current-chat-SMXZJD3F.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -21
- package/dist/lib/node-esm/update-chat-name-HM2P4NSI.mjs +0 -72
- package/dist/lib/node-esm/update-chat-name-HM2P4NSI.mjs.map +0 -7
- package/dist/types/src/blueprints/assistant/blueprint.test.d.ts +0 -2
- package/dist/types/src/blueprints/assistant/blueprint.test.d.ts.map +0 -1
- package/dist/types/src/capabilities/markdown.d.ts.map +0 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +0 -10
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +0 -1
- package/dist/types/src/components/ChatProgress/index.d.ts +0 -2
- package/dist/types/src/components/ChatProgress/index.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/widgets/PromptWidget.d.ts +0 -14
- package/dist/types/src/components/ChatThread/widgets/PromptWidget.d.ts.map +0 -1
- package/dist/types/src/containers/AgentProperties/AgentProperties.stories.d.ts.map +0 -1
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts +0 -12
- 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/containers/PromptArticle/PromptArticle.d.ts +0 -6
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts.map +0 -1
- package/dist/types/src/containers/PromptArticle/index.d.ts +0 -2
- package/dist/types/src/containers/PromptArticle/index.d.ts.map +0 -1
- package/dist/types/src/containers/PromptList/PromptList.d.ts +0 -6
- package/dist/types/src/containers/PromptList/PromptList.d.ts.map +0 -1
- package/dist/types/src/containers/PromptList/PromptList.stories.d.ts.map +0 -1
- package/dist/types/src/containers/PromptList/index.d.ts +0 -2
- package/dist/types/src/containers/PromptList/index.d.ts.map +0 -1
- package/dist/types/src/containers/TracePanel/execution-graph.d.ts +0 -17
- package/dist/types/src/containers/TracePanel/execution-graph.d.ts.map +0 -1
- package/dist/types/src/operations/definitions.d.ts +0 -135
- package/dist/types/src/operations/definitions.d.ts.map +0 -1
- package/dist/types/src/operations/on-create-space.d.ts +0 -5
- package/dist/types/src/operations/on-create-space.d.ts.map +0 -1
- package/dist/types/src/processor/processor.test.d.ts +0 -2
- package/dist/types/src/processor/processor.test.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/testing/trace-timeline.test.d.ts +0 -2
- package/dist/types/src/testing/trace-timeline.test.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/defs.d.ts +0 -2
- package/dist/types/src/types/defs.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 -233
- package/src/components/ChatProgress/ChatProgress.tsx +0 -56
- package/src/components/ChatProgress/index.ts +0 -5
- package/src/components/ChatThread/widgets/PromptWidget.ts +0 -28
- package/src/containers/AgentProperties/AgentProperties.stories.tsx +0 -100
- package/src/containers/ChatContainer/ChatContainer.tsx +0 -95
- package/src/containers/ChatContainer/index.ts +0 -5
- package/src/containers/PromptArticle/PromptArticle.tsx +0 -59
- package/src/containers/PromptArticle/index.ts +0 -5
- package/src/containers/PromptList/index.ts +0 -5
- package/src/containers/TracePanel/execution-graph.ts +0 -425
- package/src/operations/on-create-space.ts +0 -24
- package/src/testing/trace-timeline.conversations.json +0 -1
- package/src/types/capabilities.ts +0 -35
- package/src/types/defs.ts +0 -5
- package/src/types/events.ts +0 -11
- /package/dist/lib/{browser/blueprints/index.mjs.map → neutral/AssistantPlugin.mjs.map} +0 -0
- /package/dist/lib/{browser/chunk-J5LGTIGS.mjs.map → neutral/ChatArticle-VNVZCDUR.mjs.map} +0 -0
- /package/dist/lib/{browser/types → neutral/blueprints}/index.mjs.map +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{node-esm/blueprints/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/types → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/chunk-HSLMI22Q.mjs.map → neutral/meta.mjs.map} +0 -0
|
@@ -0,0 +1,777 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Array from 'effect/Array';
|
|
6
|
+
import * as Either from 'effect/Either';
|
|
7
|
+
import { pipe } from 'effect/Function';
|
|
8
|
+
import * as Pipeable from 'effect/Pipeable';
|
|
9
|
+
import * as Schema from 'effect/Schema';
|
|
10
|
+
import * as Struct from 'effect/Struct';
|
|
11
|
+
|
|
12
|
+
import { AgentRequestBegin, AgentRequestEnd, CompleteBlock } from '@dxos/assistant';
|
|
13
|
+
import { Process, Trace } from '@dxos/compute';
|
|
14
|
+
import { AGENT_PROCESS_KEY } from '@dxos/functions-runtime';
|
|
15
|
+
import { LogLevel, log } from '@dxos/log';
|
|
16
|
+
import { type Commit } from '@dxos/react-ui-components';
|
|
17
|
+
import { type ContentBlock } from '@dxos/types';
|
|
18
|
+
|
|
19
|
+
import { ROOT_SPAN_ID, type Span, buildSpanTree, isSpanBeginEvent, isSpanEndEvent, walkSpanTree } from './span-tree';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Branch name for top-level operation invocations.
|
|
23
|
+
*/
|
|
24
|
+
const MAIN_BRANCH = 'main';
|
|
25
|
+
|
|
26
|
+
const ICONS = {
|
|
27
|
+
agentRequestBegin: {
|
|
28
|
+
icon: 'ph--atom--regular',
|
|
29
|
+
level: LogLevel.VERBOSE,
|
|
30
|
+
},
|
|
31
|
+
agentRequestEndSuccess: {
|
|
32
|
+
icon: 'ph--atom--regular',
|
|
33
|
+
level: LogLevel.INFO,
|
|
34
|
+
},
|
|
35
|
+
agentRequestEndError: {
|
|
36
|
+
icon: 'ph--atom--regular',
|
|
37
|
+
level: LogLevel.ERROR,
|
|
38
|
+
},
|
|
39
|
+
agentRequestEndInterrupted: {
|
|
40
|
+
icon: 'ph--atom--regular',
|
|
41
|
+
level: LogLevel.WARN,
|
|
42
|
+
},
|
|
43
|
+
userMessage: {
|
|
44
|
+
icon: 'ph--user--regular',
|
|
45
|
+
level: LogLevel.VERBOSE,
|
|
46
|
+
},
|
|
47
|
+
statusMessage: {
|
|
48
|
+
icon: 'ph--info--regular',
|
|
49
|
+
level: LogLevel.VERBOSE,
|
|
50
|
+
},
|
|
51
|
+
operationStart: {
|
|
52
|
+
icon: 'ph--function--regular',
|
|
53
|
+
level: LogLevel.VERBOSE,
|
|
54
|
+
},
|
|
55
|
+
operationEndSuccess: {
|
|
56
|
+
icon: 'ph--function--regular',
|
|
57
|
+
level: LogLevel.INFO,
|
|
58
|
+
},
|
|
59
|
+
operationEndError: {
|
|
60
|
+
icon: 'ph--function--regular',
|
|
61
|
+
level: LogLevel.ERROR,
|
|
62
|
+
},
|
|
63
|
+
toolCall: {
|
|
64
|
+
icon: 'ph--wrench--regular',
|
|
65
|
+
level: LogLevel.VERBOSE,
|
|
66
|
+
},
|
|
67
|
+
toolResultSuccess: {
|
|
68
|
+
icon: 'ph--wrench--regular',
|
|
69
|
+
level: LogLevel.INFO,
|
|
70
|
+
},
|
|
71
|
+
toolResultError: {
|
|
72
|
+
icon: 'ph--wrench--regular',
|
|
73
|
+
level: LogLevel.ERROR,
|
|
74
|
+
},
|
|
75
|
+
agentRequestRunning: {
|
|
76
|
+
icon: 'ph--spinner-gap--regular',
|
|
77
|
+
level: LogLevel.VERBOSE,
|
|
78
|
+
},
|
|
79
|
+
processRunning: {
|
|
80
|
+
icon: 'ph--spinner-gap--regular',
|
|
81
|
+
level: LogLevel.VERBOSE,
|
|
82
|
+
},
|
|
83
|
+
} as const;
|
|
84
|
+
|
|
85
|
+
export interface BuildExecutionGraphParams {
|
|
86
|
+
traceMessages: readonly Trace.Message[];
|
|
87
|
+
activeProcesses?: readonly Process.Info[];
|
|
88
|
+
eventLimit?: number;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Builds a Timeline-compatible execution graph from trace messages and active processes.
|
|
93
|
+
*
|
|
94
|
+
* The conversion runs in two stages:
|
|
95
|
+
* 1. `buildSpanTree` converts the flat list of trace messages into a hierarchical
|
|
96
|
+
* tree of spans grouped by process id (pid). See `./span-tree.ts`.
|
|
97
|
+
* 2. `spanTreeToCommits` walks the tree and emits one commit per event, using the
|
|
98
|
+
* tree structure to decide which branch each commit belongs to and how to wire parents.
|
|
99
|
+
*
|
|
100
|
+
* Pure function — no signals or atoms.
|
|
101
|
+
*/
|
|
102
|
+
export type ExecutionGraph = {
|
|
103
|
+
branches: string[];
|
|
104
|
+
commits: Commit[];
|
|
105
|
+
spanTree: Span;
|
|
106
|
+
/** Commit id -> trace event. */
|
|
107
|
+
details: ExecutionGraphDetailsMap;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export type ExecutionGraphDetailsMap = Record<string, Trace.FlatEvent | undefined>;
|
|
111
|
+
|
|
112
|
+
export const buildExecutionGraph = ({
|
|
113
|
+
traceMessages,
|
|
114
|
+
activeProcesses = [],
|
|
115
|
+
eventLimit = 500,
|
|
116
|
+
}: BuildExecutionGraphParams): ExecutionGraph => {
|
|
117
|
+
const spanTree = buildSpanTree(traceMessages, { eventLimit });
|
|
118
|
+
const toolCallContext = buildToolCallContext(traceMessages);
|
|
119
|
+
const built = spanTreeToCommits(spanTree, activeProcesses, toolCallContext);
|
|
120
|
+
log('trace execution graph', {
|
|
121
|
+
traceMessages: traceMessages.length,
|
|
122
|
+
commits: built.commits.length,
|
|
123
|
+
branches: built.branches.length,
|
|
124
|
+
activeProcesses: activeProcesses.length,
|
|
125
|
+
});
|
|
126
|
+
return { ...built, spanTree };
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Lookup tables that pair `toolCall` blocks with their matching `toolResult` blocks so the
|
|
131
|
+
* renderer can collapse the two events into a single commit (mirroring how begin/end events of
|
|
132
|
+
* an empty operation span collapse). Indexed by the shared `toolCallId`.
|
|
133
|
+
*/
|
|
134
|
+
interface ToolCallContext {
|
|
135
|
+
callById: Map<string, ContentBlock.ToolCall>;
|
|
136
|
+
resultByCallId: Map<string, ContentBlock.ToolResult>;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const buildToolCallContext = (messages: readonly Trace.Message[]): ToolCallContext => {
|
|
140
|
+
const callById = new Map<string, ContentBlock.ToolCall>();
|
|
141
|
+
const resultByCallId = new Map<string, ContentBlock.ToolResult>();
|
|
142
|
+
for (const message of messages) {
|
|
143
|
+
for (const event of message.events) {
|
|
144
|
+
if (event.type !== CompleteBlock.key) {
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
const data = event.data as { block?: ContentBlock.Any } | undefined;
|
|
148
|
+
const block = data?.block;
|
|
149
|
+
if (!block) {
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (block._tag === 'toolCall') {
|
|
153
|
+
callById.set(block.toolCallId, block);
|
|
154
|
+
} else if (block._tag === 'toolResult') {
|
|
155
|
+
resultByCallId.set(block.toolCallId, block);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return { callById, resultByCallId };
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Visual representation of a single trace event — icon, log level, message string.
|
|
164
|
+
* `undefined` indicates that the event should not produce a commit.
|
|
165
|
+
*/
|
|
166
|
+
interface EventPresentation {
|
|
167
|
+
icon: string;
|
|
168
|
+
level: LogLevel;
|
|
169
|
+
message: string;
|
|
170
|
+
idSuffix?: string;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
type AgentRequestEndData = Schema.Schema.Type<typeof AgentRequestEnd.schema>;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Parses `AgentRequestEnd` payload, accepting legacy traces that omitted `status`.
|
|
177
|
+
*/
|
|
178
|
+
const parseAgentRequestEnd = (data: unknown): AgentRequestEndData | undefined => {
|
|
179
|
+
const validated = Schema.validateEither(AgentRequestEnd.schema)(data);
|
|
180
|
+
if (Either.isRight(validated)) {
|
|
181
|
+
return validated.right;
|
|
182
|
+
}
|
|
183
|
+
// Traces emitted before `status` was added wrote an empty object.
|
|
184
|
+
if (data != null && typeof data === 'object' && Object.keys(data).length === 0) {
|
|
185
|
+
return { status: 'success' };
|
|
186
|
+
}
|
|
187
|
+
log('invalid trace event', { type: AgentRequestEnd.key });
|
|
188
|
+
return undefined;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const presentAgentRequestEnd = (data: AgentRequestEndData): EventPresentation => {
|
|
192
|
+
switch (data.status) {
|
|
193
|
+
case 'error':
|
|
194
|
+
return {
|
|
195
|
+
icon: ICONS.agentRequestEndError.icon,
|
|
196
|
+
level: ICONS.agentRequestEndError.level,
|
|
197
|
+
message: data.error ? trimText(`Agent request failed: ${data.error}`) : 'Agent request failed',
|
|
198
|
+
};
|
|
199
|
+
case 'interrupted':
|
|
200
|
+
return {
|
|
201
|
+
icon: ICONS.agentRequestEndInterrupted.icon,
|
|
202
|
+
level: ICONS.agentRequestEndInterrupted.level,
|
|
203
|
+
message: 'Agent request interrupted',
|
|
204
|
+
};
|
|
205
|
+
default:
|
|
206
|
+
return {
|
|
207
|
+
icon: ICONS.agentRequestEndSuccess.icon,
|
|
208
|
+
level: ICONS.agentRequestEndSuccess.level,
|
|
209
|
+
message: 'Agent completed request',
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const presentEvent = (event: Trace.FlatEvent, toolCallContext: ToolCallContext): EventPresentation | undefined => {
|
|
215
|
+
if (Trace.isOfType(AgentRequestBegin, event)) {
|
|
216
|
+
if (Either.isLeft(Schema.validateEither(AgentRequestBegin.schema)(event.data))) {
|
|
217
|
+
log('invalid trace event', { type: event.type });
|
|
218
|
+
return undefined;
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
icon: ICONS.agentRequestBegin.icon,
|
|
222
|
+
level: ICONS.agentRequestBegin.level,
|
|
223
|
+
message: 'Agent processing request...',
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
if (Trace.isOfType(AgentRequestEnd, event)) {
|
|
227
|
+
const endData = parseAgentRequestEnd(event.data);
|
|
228
|
+
if (!endData) {
|
|
229
|
+
return undefined;
|
|
230
|
+
}
|
|
231
|
+
return presentAgentRequestEnd(endData);
|
|
232
|
+
}
|
|
233
|
+
if (Trace.isOfType(CompleteBlock, event)) {
|
|
234
|
+
if (Either.isLeft(Schema.validateEither(CompleteBlock.schema)(event.data))) {
|
|
235
|
+
log('invalid trace event', { type: event.type });
|
|
236
|
+
return undefined;
|
|
237
|
+
}
|
|
238
|
+
switch (event.data.block._tag) {
|
|
239
|
+
case 'text':
|
|
240
|
+
return event.data.role === 'user'
|
|
241
|
+
? {
|
|
242
|
+
icon: ICONS.userMessage.icon,
|
|
243
|
+
level: ICONS.userMessage.level,
|
|
244
|
+
message: trimText(event.data.block.text),
|
|
245
|
+
}
|
|
246
|
+
: undefined;
|
|
247
|
+
case 'status':
|
|
248
|
+
return {
|
|
249
|
+
icon: ICONS.statusMessage.icon,
|
|
250
|
+
level: ICONS.statusMessage.level,
|
|
251
|
+
message: trimText(event.data.block.statusText),
|
|
252
|
+
};
|
|
253
|
+
case 'toolCall': {
|
|
254
|
+
// Operation-backed tool calls already have a dedicated routine span (Trace.OperationStart /
|
|
255
|
+
// Trace.OperationEnd) that produces its own commits — skip the duplicate toolCall commit
|
|
256
|
+
// to avoid double-rendering.
|
|
257
|
+
if (event.data.block.operationKey) {
|
|
258
|
+
return undefined;
|
|
259
|
+
}
|
|
260
|
+
// Collapse the toolCall/toolResult pair: when the matching toolResult has arrived, the
|
|
261
|
+
// result event is the visible commit and carries the success/error state. The toolCall
|
|
262
|
+
// itself only renders while still pending (i.e. no result yet) — same intent as an
|
|
263
|
+
// operation span that collapses to a single end commit once both boundaries are present.
|
|
264
|
+
if (toolCallContext.resultByCallId.has(event.data.block.toolCallId)) {
|
|
265
|
+
return undefined;
|
|
266
|
+
}
|
|
267
|
+
return {
|
|
268
|
+
icon: ICONS.toolCall.icon,
|
|
269
|
+
level: ICONS.toolCall.level,
|
|
270
|
+
message: event.data.block.name,
|
|
271
|
+
idSuffix: `toolCall:${event.data.block.toolCallId}`,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
case 'toolResult': {
|
|
275
|
+
// Suppress results for operation-backed calls — those are covered by the routine span.
|
|
276
|
+
const call = toolCallContext.callById.get(event.data.block.toolCallId);
|
|
277
|
+
if (call?.operationKey) {
|
|
278
|
+
return undefined;
|
|
279
|
+
}
|
|
280
|
+
const success = event.data.block.error === undefined;
|
|
281
|
+
const name = call?.name ?? event.data.block.name;
|
|
282
|
+
return {
|
|
283
|
+
icon: success ? ICONS.toolResultSuccess.icon : ICONS.toolResultError.icon,
|
|
284
|
+
level: success ? ICONS.toolResultSuccess.level : ICONS.toolResultError.level,
|
|
285
|
+
message: `${name} - ${success ? 'Success' : 'Error'}`,
|
|
286
|
+
idSuffix: `toolResult:${event.data.block.toolCallId}`,
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
default:
|
|
290
|
+
return undefined;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (Trace.isOfType(Trace.OperationStart, event)) {
|
|
294
|
+
if (Either.isLeft(Schema.validateEither(Trace.OperationStart.schema)(event.data))) {
|
|
295
|
+
log('invalid trace event', { type: event.type });
|
|
296
|
+
return undefined;
|
|
297
|
+
}
|
|
298
|
+
return {
|
|
299
|
+
icon: event.data.icon ?? ICONS.operationStart.icon,
|
|
300
|
+
level: ICONS.operationStart.level,
|
|
301
|
+
message: event.data.name ?? event.data.key,
|
|
302
|
+
idSuffix: `${event.data.key}:start`,
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
if (Trace.isOfType(Trace.OperationEnd, event)) {
|
|
306
|
+
if (Either.isLeft(Schema.validateEither(Trace.OperationEnd.schema)(event.data))) {
|
|
307
|
+
log('invalid trace event', { type: event.type });
|
|
308
|
+
return undefined;
|
|
309
|
+
}
|
|
310
|
+
const success = event.data.outcome === 'success';
|
|
311
|
+
return {
|
|
312
|
+
icon: event.data.icon ?? (success ? ICONS.operationEndSuccess.icon : ICONS.operationEndError.icon),
|
|
313
|
+
level: success ? ICONS.operationEndSuccess.level : ICONS.operationEndError.level,
|
|
314
|
+
message: `${event.data.name ?? event.data.key} - ${success ? 'Success' : 'Error'}`,
|
|
315
|
+
idSuffix: `${event.data.key}:end`,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
return undefined;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* A span is "collapsible" when it would otherwise render as an empty fork-and-merge:
|
|
323
|
+
* exactly two events that form a begin/end pair and no child sub-spans. In that case
|
|
324
|
+
* we emit a single commit for the end event on the parent branch.
|
|
325
|
+
*
|
|
326
|
+
* A *pending* span (one whose end event has not yet been recorded) is never collapsed:
|
|
327
|
+
* its trailing events should keep rendering as middle commits on the span's own branch
|
|
328
|
+
* — never as a fake "end" commit on the parent branch.
|
|
329
|
+
*
|
|
330
|
+
* Both nested spans and top-level spans (whose parent is the synthetic root) are eligible
|
|
331
|
+
* once they have completed: a span with no inner activity is collapsed regardless of where
|
|
332
|
+
* it sits in the tree.
|
|
333
|
+
*/
|
|
334
|
+
const isCollapsibleSpan = (span: Span, parent: Span | null): boolean => {
|
|
335
|
+
if (span.id === ROOT_SPAN_ID) {
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
if (span.events.length !== 2) {
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
if (span.children.length > 0) {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
const firstEvent = span.events[0];
|
|
345
|
+
const lastEvent = span.events[span.events.length - 1];
|
|
346
|
+
if (!isSpanBeginEvent(firstEvent) || !isSpanEndEvent(lastEvent)) {
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
return parent !== null;
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Converts a span tree into a flat list of commits + branches suitable for `Timeline` rendering.
|
|
354
|
+
*
|
|
355
|
+
* For every span the algorithm:
|
|
356
|
+
* - emits the **first** event as a "begin" commit on the parent span's branch (fork);
|
|
357
|
+
* - emits **middle** events as commits on the span's own branch;
|
|
358
|
+
* - emits the **last** event as an "end" commit on the parent span's branch with two parents
|
|
359
|
+
* (the begin commit and the last commit on the span's own branch — a merge).
|
|
360
|
+
*
|
|
361
|
+
* Collapsible spans (`isCollapsibleSpan`) emit only the end commit on the parent branch with
|
|
362
|
+
* a single parent — a tidier rendering for sub-operations that have no inner detail.
|
|
363
|
+
*
|
|
364
|
+
* Events are processed in global chronological order so that sub-operations of a span interleave
|
|
365
|
+
* naturally with the span's own middle events.
|
|
366
|
+
*/
|
|
367
|
+
const spanTreeToCommits = (
|
|
368
|
+
root: Span,
|
|
369
|
+
activeProcesses: readonly Process.Info[],
|
|
370
|
+
toolCallContext: ToolCallContext,
|
|
371
|
+
): { branches: string[]; commits: Commit[]; details: ExecutionGraphDetailsMap } => {
|
|
372
|
+
const builder = new GraphBuilder();
|
|
373
|
+
const details: ExecutionGraphDetailsMap = {};
|
|
374
|
+
builder.addBranch(MAIN_BRANCH);
|
|
375
|
+
|
|
376
|
+
// Build a child → parent lookup using the tree's own structure (already correctly parented
|
|
377
|
+
// when the tree was constructed, including sequential spans of the same process).
|
|
378
|
+
const parentBySpan = new Map<Span, Span | null>();
|
|
379
|
+
parentBySpan.set(root, null);
|
|
380
|
+
const indexParents = (span: Span): void => {
|
|
381
|
+
for (const child of span.children) {
|
|
382
|
+
parentBySpan.set(child, span);
|
|
383
|
+
indexParents(child);
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
indexParents(root);
|
|
387
|
+
|
|
388
|
+
const findParentSpan = (span: Span): Span | null => parentBySpan.get(span) ?? null;
|
|
389
|
+
|
|
390
|
+
// The branch name for a span is its pid — multiple sequential spans of the same process
|
|
391
|
+
// (e.g. successive agent requests in one session) share a branch so they reuse a single lane.
|
|
392
|
+
const branchOf = (span: Span | null): string => {
|
|
393
|
+
if (!span || span.id === ROOT_SPAN_ID) {
|
|
394
|
+
return MAIN_BRANCH;
|
|
395
|
+
}
|
|
396
|
+
return span.meta.pid ?? span.id;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
// Selector that returns "the most recent commit in this span's structural context".
|
|
400
|
+
//
|
|
401
|
+
// The walk is structural (pid/parentPid), not topological: at each ancestor, we prefer
|
|
402
|
+
// 1) the last commit on that span's own branch, then
|
|
403
|
+
// 2) that span's begin commit (the fork point on its parent branch),
|
|
404
|
+
// 3) and only then recurse into the parent span.
|
|
405
|
+
//
|
|
406
|
+
// Crucially, we never silently slip onto a *sibling* span's commit on a shared ancestor
|
|
407
|
+
// branch. E.g. if a sub-span of agent A fires before A has any middle commits, we anchor
|
|
408
|
+
// to A.begin — not to whatever unrelated commit happens to be the latest on main.
|
|
409
|
+
// This keeps fork edges visually attached to the correct span even when sibling top-level
|
|
410
|
+
// spans (different pids) overlap in time on main.
|
|
411
|
+
const lastInSpanContext = (span: Span | null): CommitSelector => {
|
|
412
|
+
if (!span || span.id === ROOT_SPAN_ID) {
|
|
413
|
+
return CommitSelector.branch(MAIN_BRANCH).pipe(CommitSelector.compose(CommitSelector.last()));
|
|
414
|
+
}
|
|
415
|
+
const ownBranch = branchOf(span);
|
|
416
|
+
const beginId = beginCommitIdBySpan.get(span.id);
|
|
417
|
+
return CommitSelector.firstOf(
|
|
418
|
+
CommitSelector.branch(ownBranch).pipe(CommitSelector.compose(CommitSelector.last())),
|
|
419
|
+
beginId ? CommitSelector.id(beginId) : CommitSelector.filter(() => false),
|
|
420
|
+
lastInSpanContext(findParentSpan(span)),
|
|
421
|
+
);
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
// Flatten the tree into a chronological stream, recording each event's position within its span
|
|
425
|
+
// so we can detect begin/end events.
|
|
426
|
+
interface EventCursor {
|
|
427
|
+
span: Span;
|
|
428
|
+
event: Trace.FlatEvent;
|
|
429
|
+
eventIndex: number;
|
|
430
|
+
globalIndex: number;
|
|
431
|
+
}
|
|
432
|
+
const stream: EventCursor[] = [];
|
|
433
|
+
walkSpanTree(root, (span) => {
|
|
434
|
+
span.events.forEach((event, eventIndex) => {
|
|
435
|
+
stream.push({ span, event, eventIndex, globalIndex: stream.length });
|
|
436
|
+
});
|
|
437
|
+
});
|
|
438
|
+
stream.sort((a, b) => a.event.timestamp - b.event.timestamp || a.globalIndex - b.globalIndex);
|
|
439
|
+
|
|
440
|
+
// Track the id of the begin commit for each non-collapsible span so the end commit can merge into it.
|
|
441
|
+
const beginCommitIdBySpan = new Map<string, string>();
|
|
442
|
+
|
|
443
|
+
for (const { span, event, globalIndex } of stream) {
|
|
444
|
+
const presentation = presentEvent(event, toolCallContext);
|
|
445
|
+
if (!presentation) {
|
|
446
|
+
continue;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// Classify based on event TYPE, not array index. A pending span's trailing
|
|
450
|
+
// middle event (e.g. a user message awaiting an agent response) must not be
|
|
451
|
+
// mistaken for the span's end event — otherwise it would render on the
|
|
452
|
+
// parent branch instead of the span's own branch.
|
|
453
|
+
const isBeginEvent = isSpanBeginEvent(event);
|
|
454
|
+
const isEndEvent = isSpanEndEvent(event);
|
|
455
|
+
const parentSpan = findParentSpan(span);
|
|
456
|
+
const collapsible = isCollapsibleSpan(span, parentSpan);
|
|
457
|
+
|
|
458
|
+
// Collapsed spans: skip the begin event entirely; only the end event renders.
|
|
459
|
+
if (collapsible && isBeginEvent) {
|
|
460
|
+
continue;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
const parentBranch = branchOf(parentSpan);
|
|
464
|
+
const ownBranch = branchOf(span);
|
|
465
|
+
|
|
466
|
+
// A "process boundary" span is a concurrent child PROCESS (its own pid, differing from the
|
|
467
|
+
// parent's) with real sub-flow content (a middle event) — e.g. a delegated sub-agent. Such a
|
|
468
|
+
// span gets its own lane: it forks onto its own branch at begin and collapses back to main at
|
|
469
|
+
// end (so neither its lane nor its parent's lane dangles). A bare operation (begin+end only)
|
|
470
|
+
// collapses to a single commit and is NOT treated as a boundary — forking its transient begin
|
|
471
|
+
// mid-stream would flash a throwaway lane.
|
|
472
|
+
const ownPid = span.meta.pid;
|
|
473
|
+
const parentPid = parentSpan?.meta.pid;
|
|
474
|
+
const spanHasMiddle = span.events.some((event) => !isSpanBeginEvent(event) && !isSpanEndEvent(event));
|
|
475
|
+
const isProcessBoundary = ownPid != null && parentPid != null && ownPid !== parentPid && spanHasMiddle;
|
|
476
|
+
|
|
477
|
+
let branch: string;
|
|
478
|
+
let parents: string[];
|
|
479
|
+
|
|
480
|
+
if (span.id === ROOT_SPAN_ID) {
|
|
481
|
+
// Root-level events (no pid) attach sequentially to main.
|
|
482
|
+
branch = MAIN_BRANCH;
|
|
483
|
+
parents = builder.computeParents(lastInSpanContext(null));
|
|
484
|
+
} else if (collapsible) {
|
|
485
|
+
// Only the end event reaches here for collapsible spans.
|
|
486
|
+
// Anchor to the parent span's structural context so the fork attaches to the parent
|
|
487
|
+
// — not to a sibling span's commit that happens to be the latest on the shared ancestor.
|
|
488
|
+
branch = parentBranch;
|
|
489
|
+
parents = builder.computeParents(lastInSpanContext(parentSpan));
|
|
490
|
+
} else if (isBeginEvent) {
|
|
491
|
+
// Begin commit, anchored to the parent's structural context. A nested sub-span stays on the
|
|
492
|
+
// parent lane (only its middle events fork). A concurrent child process forks onto its own
|
|
493
|
+
// branch from this first event so it gets its own lane immediately.
|
|
494
|
+
branch = isProcessBoundary ? ownBranch : parentBranch;
|
|
495
|
+
parents = builder.computeParents(lastInSpanContext(parentSpan));
|
|
496
|
+
} else if (isEndEvent) {
|
|
497
|
+
// End commit: continues the parent branch chronologically and merges in own-branch work.
|
|
498
|
+
//
|
|
499
|
+
// Parent #1 is the *immediate predecessor* on the parent branch (not the matching begin
|
|
500
|
+
// commit). Pointing back to the begin commit creates a visual edge that skips over any
|
|
501
|
+
// sibling span's commits emitted between begin and end — e.g. when two top-level Routine
|
|
502
|
+
// spans overlap on main, R1.end would otherwise draw an arrow back to R1.begin that
|
|
503
|
+
// crosses over R2.begin. Anchoring to the previous main commit keeps main linear.
|
|
504
|
+
//
|
|
505
|
+
// A concurrent child process collapses all the way back to MAIN (merging its own branch),
|
|
506
|
+
// rather than to its parent's branch: the parent (e.g. a supervisor whose turn already merged
|
|
507
|
+
// to main) would otherwise gain commits after its own merge and never re-collapse — leaving a
|
|
508
|
+
// dangling lane after the child finishes.
|
|
509
|
+
branch = isProcessBoundary ? MAIN_BRANCH : parentBranch;
|
|
510
|
+
parents = builder.computeParents(
|
|
511
|
+
CommitSelector.unionAll(
|
|
512
|
+
CommitSelector.branch(branch).pipe(CommitSelector.compose(CommitSelector.last())),
|
|
513
|
+
CommitSelector.branch(ownBranch).pipe(CommitSelector.compose(CommitSelector.last())),
|
|
514
|
+
),
|
|
515
|
+
);
|
|
516
|
+
} else {
|
|
517
|
+
// Middle event: continue the span's own branch; fall back to span's own context so the
|
|
518
|
+
// first middle event of a span forks from the span's begin commit, not from a sibling's
|
|
519
|
+
// commit on an ancestor branch.
|
|
520
|
+
branch = ownBranch;
|
|
521
|
+
parents = builder.computeParents(lastInSpanContext(span));
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
const commitId = formatCommitId(span, globalIndex, presentation.idSuffix);
|
|
525
|
+
const commit: Commit = {
|
|
526
|
+
id: commitId,
|
|
527
|
+
branch,
|
|
528
|
+
parents,
|
|
529
|
+
timestamp: new Date(event.timestamp),
|
|
530
|
+
icon: presentation.icon,
|
|
531
|
+
level: presentation.level,
|
|
532
|
+
message: presentation.message,
|
|
533
|
+
};
|
|
534
|
+
builder.addCommit(commit);
|
|
535
|
+
details[commitId] = event;
|
|
536
|
+
|
|
537
|
+
// Record begin commit so a later end event can merge into it.
|
|
538
|
+
if (isBeginEvent && !collapsible && span.id !== ROOT_SPAN_ID) {
|
|
539
|
+
beginCommitIdBySpan.set(span.id, commitId);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
// Append "running" indicators for processes that are still active.
|
|
544
|
+
for (const process of activeProcesses) {
|
|
545
|
+
if (
|
|
546
|
+
process.key === AGENT_PROCESS_KEY &&
|
|
547
|
+
process.params.target &&
|
|
548
|
+
(process.state === Process.State.RUNNING || process.state === Process.State.HYBERNATING)
|
|
549
|
+
) {
|
|
550
|
+
builder.addCommit({
|
|
551
|
+
id: `running:${process.pid}`,
|
|
552
|
+
branch: process.pid,
|
|
553
|
+
parents: builder.computeParents(
|
|
554
|
+
CommitSelector.branch(process.pid).pipe(CommitSelector.compose(CommitSelector.last())),
|
|
555
|
+
),
|
|
556
|
+
icon: ICONS.agentRequestRunning.icon,
|
|
557
|
+
level: ICONS.agentRequestRunning.level,
|
|
558
|
+
message: 'Generating...',
|
|
559
|
+
timestamp: new Date(),
|
|
560
|
+
});
|
|
561
|
+
} else if (process.state === Process.State.RUNNING && builder.hasBranch(process.pid)) {
|
|
562
|
+
builder.addCommit({
|
|
563
|
+
id: `running:${process.pid}`,
|
|
564
|
+
branch: process.pid,
|
|
565
|
+
parents: builder.computeParents(
|
|
566
|
+
CommitSelector.branch(process.pid).pipe(CommitSelector.compose(CommitSelector.last())),
|
|
567
|
+
),
|
|
568
|
+
icon: ICONS.processRunning.icon,
|
|
569
|
+
level: ICONS.processRunning.level,
|
|
570
|
+
message: 'Running...',
|
|
571
|
+
timestamp: new Date(),
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
const { commits, branches } = builder.build();
|
|
577
|
+
return { commits, branches, details };
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
const formatCommitId = (span: Span, globalIndex: number, suffix?: string): string => {
|
|
581
|
+
const base = `${span.id}:${globalIndex}`;
|
|
582
|
+
return suffix ? `${base}:${suffix}` : base;
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
const trimText = (text: string) => text.slice(0, 100).trim().split('\n')[0];
|
|
586
|
+
|
|
587
|
+
type Falsy = false | null | undefined;
|
|
588
|
+
|
|
589
|
+
export interface CommitSelector extends Pipeable.Pipeable {
|
|
590
|
+
select: (commits: Commit[]) => Commit[];
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
export const CommitSelector = {
|
|
594
|
+
make: (select: CommitSelector['select']): CommitSelector => ({
|
|
595
|
+
select,
|
|
596
|
+
pipe(...args: any) {
|
|
597
|
+
return Pipeable.pipeArguments(this, args);
|
|
598
|
+
},
|
|
599
|
+
}),
|
|
600
|
+
|
|
601
|
+
identity: (): CommitSelector => CommitSelector.make((commits) => commits),
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Selects commits that match the given predicate.
|
|
605
|
+
*/
|
|
606
|
+
filter: (predicate: (commit: Commit) => unknown): CommitSelector =>
|
|
607
|
+
CommitSelector.make((commits) => commits.filter(predicate)),
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Selects commits by id.
|
|
611
|
+
*/
|
|
612
|
+
id: (id: string): CommitSelector => CommitSelector.filter((commit) => commit.id === id),
|
|
613
|
+
/**
|
|
614
|
+
* Selects commits by tag.
|
|
615
|
+
*/
|
|
616
|
+
tag: (tag: string | Falsy): CommitSelector => CommitSelector.filter((commit) => tag && commit.tags?.includes(tag)),
|
|
617
|
+
/**
|
|
618
|
+
* Selects commits by if any of the given tags are present.
|
|
619
|
+
*/
|
|
620
|
+
anyTags: (tags: (string | Falsy)[]): CommitSelector =>
|
|
621
|
+
CommitSelector.filter((commit) => tags.some((tag) => tag && commit.tags?.includes(tag))),
|
|
622
|
+
/**
|
|
623
|
+
* Selects commits by branch.
|
|
624
|
+
*/
|
|
625
|
+
branch: (branch: string | Falsy): CommitSelector =>
|
|
626
|
+
CommitSelector.filter((commit) => branch && commit.branch === branch),
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Chains two selectors together, applying the second selector to the result of the first.
|
|
630
|
+
*
|
|
631
|
+
* Example:
|
|
632
|
+
*
|
|
633
|
+
* ```
|
|
634
|
+
* CommitSelector.tag('tag').pipe(CommitSelector.compose(CommitSelector.branch('main')));
|
|
635
|
+
* ```
|
|
636
|
+
*/
|
|
637
|
+
compose:
|
|
638
|
+
(next: CommitSelector) =>
|
|
639
|
+
(prev: CommitSelector): CommitSelector =>
|
|
640
|
+
CommitSelector.make((commits) => next.select(prev.select(commits))),
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* If `prev` selector matches no commits, return `next` selector, otherwise return `prev` selector.
|
|
644
|
+
* Same as `CommitSelector.firstOf(prev, next)`.
|
|
645
|
+
*
|
|
646
|
+
* Example:
|
|
647
|
+
*
|
|
648
|
+
* ```
|
|
649
|
+
* CommitSelector.tag('tag').pipe(CommitSelector.orElse(CommitSelector.branch('main')));
|
|
650
|
+
* ```
|
|
651
|
+
*/
|
|
652
|
+
orElse:
|
|
653
|
+
(next: CommitSelector) =>
|
|
654
|
+
(prev: CommitSelector): CommitSelector =>
|
|
655
|
+
CommitSelector.make((commits) => {
|
|
656
|
+
const selected = prev.select(commits);
|
|
657
|
+
if (selected.length > 0) {
|
|
658
|
+
return selected;
|
|
659
|
+
}
|
|
660
|
+
return next.select(commits);
|
|
661
|
+
}),
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* Selects commits that match either of the given selectors.
|
|
665
|
+
*/
|
|
666
|
+
andAlso:
|
|
667
|
+
(next: CommitSelector) =>
|
|
668
|
+
(prev: CommitSelector): CommitSelector =>
|
|
669
|
+
CommitSelector.unionAll(prev, next),
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Selects the first n commits.
|
|
673
|
+
*/
|
|
674
|
+
first: (n: number = 1): CommitSelector => CommitSelector.make((commits) => commits.slice(0, n)),
|
|
675
|
+
/**
|
|
676
|
+
* Selects the last n commits (reverses the order of the commits).
|
|
677
|
+
*/
|
|
678
|
+
last: (n: number = 1): CommitSelector => CommitSelector.make((commits) => commits.toReversed().slice(0, n)),
|
|
679
|
+
/**
|
|
680
|
+
* Selects commits that do not match the given selector.
|
|
681
|
+
*/
|
|
682
|
+
not: (selector: CommitSelector): CommitSelector =>
|
|
683
|
+
CommitSelector.make((commits) => {
|
|
684
|
+
const selected = selector.select(commits);
|
|
685
|
+
return commits.filter((commit) => !selected.includes(commit));
|
|
686
|
+
}),
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Selects commits that match any of the given selectors.
|
|
690
|
+
*/
|
|
691
|
+
unionAll: (...selectors: CommitSelector[]): CommitSelector =>
|
|
692
|
+
CommitSelector.make((commits) => {
|
|
693
|
+
return Array.dedupeWith(
|
|
694
|
+
selectors.flatMap((selector) => selector.select(commits)),
|
|
695
|
+
(a, b) => a.id === b.id,
|
|
696
|
+
);
|
|
697
|
+
}),
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Selects commits that match all of the given selectors.
|
|
701
|
+
*/
|
|
702
|
+
intersectAll: (...selectors: CommitSelector[]): CommitSelector =>
|
|
703
|
+
CommitSelector.make((commits) => {
|
|
704
|
+
const selected = selectors.map((selector) => selector.select(commits));
|
|
705
|
+
if (selected.length === 0) {
|
|
706
|
+
return [];
|
|
707
|
+
}
|
|
708
|
+
return selected[0].filter((commit) => selected.every((selected) => selected.some((c) => c.id === commit.id)));
|
|
709
|
+
}),
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Returns the result of the first selector that matches any commits.
|
|
713
|
+
*/
|
|
714
|
+
firstOf: (...selectors: CommitSelector[]): CommitSelector =>
|
|
715
|
+
CommitSelector.make((commits) => {
|
|
716
|
+
for (const selector of selectors) {
|
|
717
|
+
const selected = selector.select(commits);
|
|
718
|
+
if (selected.length > 0) {
|
|
719
|
+
return selected;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
return [];
|
|
723
|
+
}),
|
|
724
|
+
};
|
|
725
|
+
|
|
726
|
+
class GraphBuilder {
|
|
727
|
+
#commits: Commit[] = [];
|
|
728
|
+
#branches = new Set<string>();
|
|
729
|
+
|
|
730
|
+
findCommits(selector: CommitSelector): Commit[] {
|
|
731
|
+
return selector.select(this.#commits);
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
hasBranch(branch: string): boolean {
|
|
735
|
+
return this.#branches.has(branch);
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
addCommit(commit: Commit) {
|
|
739
|
+
this.addBranch(commit.branch);
|
|
740
|
+
this.#commits.push(commit);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* Computes parents — picks first matching commit's id.
|
|
745
|
+
*/
|
|
746
|
+
computeParents(selector: CommitSelector): string[] {
|
|
747
|
+
return Array.dedupe(selector.select(this.#commits).map((commit) => commit.id));
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
addBranch(branch: string) {
|
|
751
|
+
this.#branches.add(branch);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* Removes duplicate commits and dangling parents.
|
|
756
|
+
*/
|
|
757
|
+
doctor() {
|
|
758
|
+
this.#commits = pipe(
|
|
759
|
+
this.#commits,
|
|
760
|
+
Array.dedupeWith((a, b) => a.id === b.id),
|
|
761
|
+
Array.map(
|
|
762
|
+
Struct.evolve({
|
|
763
|
+
parents: (parents) =>
|
|
764
|
+
parents ? Array.filter(parents, (id) => this.#commits.some((commit) => commit.id === id)) : undefined,
|
|
765
|
+
}),
|
|
766
|
+
),
|
|
767
|
+
);
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
build() {
|
|
771
|
+
this.doctor();
|
|
772
|
+
return {
|
|
773
|
+
commits: this.#commits,
|
|
774
|
+
branches: [...this.#branches],
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
}
|