@dxos/plugin-assistant 0.8.4-main.f5c0578 → 0.8.4-main.fcfe5033a5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/AssistantSettings-7QMO3LGF.mjs +97 -0
- package/dist/lib/browser/AssistantSettings-7QMO3LGF.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/blueprints/index.mjs.map +7 -0
- package/dist/lib/browser/chunk-ATHYBVGN.mjs +176 -0
- package/dist/lib/browser/chunk-ATHYBVGN.mjs.map +7 -0
- package/dist/lib/browser/chunk-EZRS3J25.mjs +30 -0
- package/dist/lib/browser/chunk-EZRS3J25.mjs.map +7 -0
- package/dist/lib/browser/chunk-LMVTXH54.mjs +154 -0
- package/dist/lib/browser/chunk-LMVTXH54.mjs.map +7 -0
- package/dist/lib/browser/create-chat-LBZHGVSN.mjs +82 -0
- package/dist/lib/browser/create-chat-LBZHGVSN.mjs.map +7 -0
- package/dist/lib/browser/ensure-companion-chat-ZEZA34MZ.mjs +65 -0
- package/dist/lib/browser/ensure-companion-chat-ZEZA34MZ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3406 -249
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/on-create-space-54RNX5JI.mjs +22 -0
- package/dist/lib/browser/on-create-space-54RNX5JI.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +13 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/resolve-navigation-targets-NZOD66NY.mjs +22 -0
- package/dist/lib/browser/resolve-navigation-targets-NZOD66NY.mjs.map +7 -0
- package/dist/lib/browser/run-prompt-in-new-chat-THLK5YQC.mjs +136 -0
- package/dist/lib/browser/run-prompt-in-new-chat-THLK5YQC.mjs.map +7 -0
- package/dist/lib/browser/set-current-chat-LRS3VFSH.mjs +54 -0
- package/dist/lib/browser/set-current-chat-LRS3VFSH.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +5 -4
- package/dist/lib/browser/update-chat-name-3Y36KFAS.mjs +71 -0
- package/dist/lib/browser/update-chat-name-3Y36KFAS.mjs.map +7 -0
- package/dist/lib/node-esm/AssistantSettings-UVUTKO7E.mjs +98 -0
- package/dist/lib/node-esm/AssistantSettings-UVUTKO7E.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +9 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-NZIKC7AN.mjs +32 -0
- package/dist/lib/node-esm/chunk-NZIKC7AN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-PXAJSTGZ.mjs +177 -0
- package/dist/lib/node-esm/chunk-PXAJSTGZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-W3JZ2F4T.mjs +155 -0
- package/dist/lib/node-esm/chunk-W3JZ2F4T.mjs.map +7 -0
- package/dist/lib/node-esm/create-chat-3BEG4R6J.mjs +83 -0
- package/dist/lib/node-esm/create-chat-3BEG4R6J.mjs.map +7 -0
- package/dist/lib/node-esm/ensure-companion-chat-6K2WEWFP.mjs +66 -0
- package/dist/lib/node-esm/ensure-companion-chat-6K2WEWFP.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +3406 -249
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/on-create-space-YRPZ6HZY.mjs +23 -0
- package/dist/lib/node-esm/on-create-space-YRPZ6HZY.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +14 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/resolve-navigation-targets-3PPK7XLH.mjs +23 -0
- package/dist/lib/node-esm/resolve-navigation-targets-3PPK7XLH.mjs.map +7 -0
- package/dist/lib/node-esm/run-prompt-in-new-chat-OUYKCMQ7.mjs +137 -0
- package/dist/lib/node-esm/run-prompt-in-new-chat-OUYKCMQ7.mjs.map +7 -0
- package/dist/lib/node-esm/set-current-chat-SMXZJD3F.mjs +55 -0
- package/dist/lib/node-esm/set-current-chat-SMXZJD3F.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +5 -4
- package/dist/lib/node-esm/update-chat-name-HM2P4NSI.mjs +72 -0
- package/dist/lib/node-esm/update-chat-name-HM2P4NSI.mjs.map +7 -0
- package/dist/types/src/AssistantPlugin.d.ts +2 -1
- package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/assistant/blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/assistant/blueprint.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/blueprint.test.d.ts +2 -0
- package/dist/types/src/blueprints/assistant/blueprint.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/assistant/index.d.ts +2 -0
- package/dist/types/src/blueprints/assistant/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/ai-service.d.ts +4 -3
- package/dist/types/src/capabilities/ai-service.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +4 -2
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts +9 -0
- package/dist/types/src/capabilities/companion-chat-provisioner.d.ts.map +1 -0
- package/dist/types/src/capabilities/edge-model-resolver.d.ts +6 -4
- package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +29 -9
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/local-model-resolver.d.ts +16 -0
- package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/markdown.d.ts +5 -0
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
- package/dist/types/src/capabilities/migrations.d.ts +5 -0
- package/dist/types/src/capabilities/migrations.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +4 -2
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +21 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit.d.ts +4 -3
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +4 -4
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.stories.d.ts +15 -0
- package/dist/types/src/components/AssistantSettings/AssistantSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/AssistantSettings/index.d.ts +1 -1
- package/dist/types/src/components/AssistantSettings/index.d.ts.map +1 -1
- package/dist/types/src/components/Chat/Chat.d.ts +36 -17
- package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
- package/dist/types/src/components/Chat/events.d.ts +10 -1
- package/dist/types/src/components/Chat/events.d.ts.map +1 -1
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +10 -0
- package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
- package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
- package/dist/types/src/components/ChatProgress/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts +2 -1
- package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +13 -4
- package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts +19 -0
- package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +3 -4
- package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
- package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.d.ts +13 -11
- package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +24 -215
- package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -1
- package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts +35 -0
- package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/registry.d.ts +11 -0
- package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.d.ts +43 -0
- package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts +2 -0
- package/dist/types/src/components/ChatThread/sync.test.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/tool-widget-state.d.ts +18 -0
- package/dist/types/src/components/ChatThread/tool-widget-state.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/tool-widget-state.test.d.ts +2 -0
- package/dist/types/src/components/ChatThread/tool-widget-state.test.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/FallbackWidget.d.ts +8 -0
- package/dist/types/src/components/ChatThread/widgets/FallbackWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/PromptWidget.d.ts +14 -0
- package/dist/types/src/components/ChatThread/widgets/PromptWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.d.ts +25 -0
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.stories.d.ts +18 -0
- package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/ReferenceWidget.d.ts +9 -0
- package/dist/types/src/components/ChatThread/widgets/ReferenceWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/SelectWidget.d.ts +14 -0
- package/dist/types/src/components/ChatThread/widgets/SelectWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/StatsWidget.d.ts +12 -0
- package/dist/types/src/components/ChatThread/widgets/StatsWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/StatusWidget.d.ts +25 -0
- package/dist/types/src/components/ChatThread/widgets/StatusWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/SuggestionWidget.d.ts +11 -0
- package/dist/types/src/components/ChatThread/widgets/SuggestionWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/SummaryWidget.d.ts +5 -0
- package/dist/types/src/components/ChatThread/widgets/SummaryWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.d.ts +9 -0
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.stories.d.ts +15 -0
- package/dist/types/src/components/ChatThread/widgets/ToolWidget.stories.d.ts.map +1 -0
- package/dist/types/src/components/ChatThread/widgets/index.d.ts +11 -0
- package/dist/types/src/components/ChatThread/widgets/index.d.ts.map +1 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts +10 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.d.ts.map +1 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts +8 -0
- package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts.map +1 -0
- package/dist/types/src/components/ProcessTree/index.d.ts +2 -0
- package/dist/types/src/components/ProcessTree/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +6 -9
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +13 -7
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +12 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +10 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts +12 -0
- package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts +3 -0
- package/dist/types/src/components/TemplateEditor/extensions/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts +8 -0
- package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +12 -0
- package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts +2 -0
- package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts.map +1 -0
- package/dist/types/src/components/ToolBlock/index.d.ts +3 -0
- package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +14 -15
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +15 -5
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -9
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/AgentArticle/AgentArticle.d.ts +6 -0
- package/dist/types/src/containers/AgentArticle/AgentArticle.d.ts.map +1 -0
- package/dist/types/src/containers/AgentArticle/AgentArticle.stories.d.ts +21 -0
- package/dist/types/src/containers/AgentArticle/AgentArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/AgentArticle/index.d.ts +2 -0
- package/dist/types/src/containers/AgentArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/AgentProperties/AgentProperties.d.ts +6 -0
- package/dist/types/src/containers/AgentProperties/AgentProperties.d.ts.map +1 -0
- package/dist/types/src/containers/AgentProperties/AgentProperties.stories.d.ts +16 -0
- package/dist/types/src/containers/AgentProperties/AgentProperties.stories.d.ts.map +1 -0
- package/dist/types/src/containers/AgentProperties/index.d.ts +2 -0
- package/dist/types/src/containers/AgentProperties/index.d.ts.map +1 -0
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts +6 -0
- package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts.map +1 -0
- package/dist/types/src/containers/BlueprintArticle/index.d.ts +2 -0
- package/dist/types/src/containers/BlueprintArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts +18 -0
- package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts.map +1 -0
- package/dist/types/src/containers/ChatCompanion/index.d.ts +2 -0
- package/dist/types/src/containers/ChatCompanion/index.d.ts.map +1 -0
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts +12 -0
- package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts.map +1 -0
- package/dist/types/src/containers/ChatContainer/index.d.ts +2 -0
- package/dist/types/src/containers/ChatContainer/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/ChatDialog}/ChatDialog.d.ts +2 -3
- package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts.map +1 -0
- package/dist/types/src/containers/ChatDialog/index.d.ts +2 -0
- package/dist/types/src/containers/ChatDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts +6 -0
- package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts.map +1 -0
- package/dist/types/src/containers/PromptArticle/index.d.ts +2 -0
- package/dist/types/src/containers/PromptArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/PromptList/PromptList.d.ts +6 -0
- package/dist/types/src/containers/PromptList/PromptList.d.ts.map +1 -0
- package/dist/types/src/containers/PromptList/PromptList.stories.d.ts +21 -0
- package/dist/types/src/containers/PromptList/PromptList.stories.d.ts.map +1 -0
- package/dist/types/src/containers/PromptList/index.d.ts +2 -0
- package/dist/types/src/containers/PromptList/index.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts +9 -0
- package/dist/types/src/containers/TracePanel/TracePanel.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts +15 -0
- package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts +19 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.test.d.ts +2 -0
- package/dist/types/src/containers/TracePanel/dxn-extractor.test.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/execution-graph.d.ts +17 -0
- package/dist/types/src/containers/TracePanel/execution-graph.d.ts.map +1 -0
- package/dist/types/src/containers/TracePanel/index.d.ts +4 -0
- package/dist/types/src/containers/TracePanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts +4 -0
- package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerStatus/index.d.ts +2 -0
- package/dist/types/src/containers/TriggerStatus/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +12 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/extensions/index.d.ts +2 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -0
- package/dist/types/src/extensions/prompt-extension.d.ts +10 -0
- package/dist/types/src/extensions/prompt-extension.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +5 -5
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts +8 -4
- package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +7 -10
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatServices.d.ts +5 -10
- package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatToolbarActions.d.ts +8 -0
- package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextBinder.d.ts +5 -0
- package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
- package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
- package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
- package/dist/types/src/hooks/useFilteredTypes.d.ts +3 -0
- package/dist/types/src/hooks/useFilteredTypes.d.ts.map +1 -0
- package/dist/types/src/hooks/useFlush.d.ts.map +1 -0
- package/dist/types/src/hooks/usePresets.d.ts +3 -3
- 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 +3 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +5 -4
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create-chat.d.ts +5 -0
- package/dist/types/src/operations/create-chat.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +135 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/ensure-companion-chat.d.ts +5 -0
- package/dist/types/src/operations/ensure-companion-chat.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/on-create-space.d.ts +5 -0
- package/dist/types/src/operations/on-create-space.d.ts.map +1 -0
- package/dist/types/src/operations/resolve-navigation-targets.d.ts +15 -0
- package/dist/types/src/operations/resolve-navigation-targets.d.ts.map +1 -0
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts +5 -0
- package/dist/types/src/operations/run-prompt-in-new-chat.d.ts.map +1 -0
- package/dist/types/src/operations/set-current-chat.d.ts +5 -0
- package/dist/types/src/operations/set-current-chat.d.ts.map +1 -0
- package/dist/types/src/operations/update-chat-name.d.ts +5 -0
- package/dist/types/src/operations/update-chat-name.d.ts.map +1 -0
- package/dist/types/src/processor/index.d.ts +3 -0
- package/dist/types/src/processor/index.d.ts.map +1 -0
- package/dist/types/src/{hooks → processor}/presets.d.ts +2 -2
- package/dist/types/src/processor/presets.d.ts.map +1 -0
- package/dist/types/src/processor/processor.d.ts +80 -0
- package/dist/types/src/processor/processor.d.ts.map +1 -0
- package/dist/types/src/processor/processor.test.d.ts +2 -0
- package/dist/types/src/processor/processor.test.d.ts.map +1 -0
- package/dist/types/src/queue-logger.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-generator.d.ts +8 -0
- package/dist/types/src/testing/test-generator.d.ts.map +1 -0
- package/dist/types/src/testing/test-sequence.d.ts +0 -4
- package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
- package/dist/types/src/testing/test-services.d.ts +2 -2
- package/dist/types/src/testing/test-services.d.ts.map +1 -1
- package/dist/types/src/testing/trace-timeline.test.d.ts +2 -0
- package/dist/types/src/testing/trace-timeline.test.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +2 -76
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Assistant.d.ts +18 -40
- package/dist/types/src/types/Assistant.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +11 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +32 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +14 -213
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +148 -102
- package/src/AssistantPlugin.tsx +216 -128
- package/src/blueprints/assistant/blueprint.test.ts +46 -0
- package/src/blueprints/assistant/blueprint.ts +31 -0
- package/src/blueprints/assistant/index.ts +5 -0
- package/src/{components/Timeline → blueprints}/index.ts +1 -1
- package/src/capabilities/ai-service.ts +22 -20
- package/src/capabilities/app-graph-builder.ts +194 -146
- package/src/capabilities/blueprint-definition.ts +51 -25
- package/src/capabilities/companion-chat-provisioner.ts +164 -0
- package/src/capabilities/edge-model-resolver.ts +17 -13
- package/src/capabilities/index.ts +21 -11
- package/src/capabilities/local-model-resolver.ts +48 -0
- package/src/capabilities/markdown.ts +40 -0
- package/src/capabilities/migrations.ts +35 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +139 -130
- package/src/capabilities/settings.ts +24 -12
- package/src/capabilities/state.ts +35 -0
- package/src/capabilities/toolkit.ts +7 -100
- package/src/components/AssistantSettings/AssistantSettings.stories.tsx +34 -0
- package/src/components/AssistantSettings/AssistantSettings.tsx +102 -75
- package/src/components/AssistantSettings/index.ts +2 -2
- package/src/components/Chat/Chat.tsx +278 -205
- package/src/components/Chat/events.ts +14 -1
- package/src/components/ChatProgress/ChatProgress.tsx +56 -0
- package/src/components/{SequenceEditor → ChatProgress}/index.ts +1 -1
- package/src/components/ChatPrompt/ChatActions.tsx +34 -30
- package/src/components/ChatPrompt/ChatOptions.stories.tsx +122 -0
- package/src/components/ChatPrompt/ChatOptions.tsx +380 -35
- package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
- package/src/components/ChatPrompt/ChatReferences.tsx +40 -38
- package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
- package/src/components/ChatThread/ChatThread.stories.tsx +91 -223
- package/src/components/ChatThread/ChatThread.tsx +77 -36
- package/src/components/ChatThread/Link.tsx +11 -8
- package/src/components/ChatThread/MarkdownStream.stories.tsx +243 -0
- package/src/components/ChatThread/registry.tsx +238 -0
- package/src/components/ChatThread/sync.test.ts +99 -0
- package/src/components/ChatThread/sync.ts +165 -0
- package/src/components/ChatThread/testing/thinking.md +21 -0
- package/src/components/ChatThread/testing/thread-1.md +30 -0
- package/src/components/ChatThread/testing/thread-2.md +56 -0
- package/src/components/ChatThread/testing/thread-widgets.md +79 -0
- package/src/components/ChatThread/tool-widget-state.test.ts +34 -0
- package/src/components/ChatThread/tool-widget-state.ts +48 -0
- package/src/components/ChatThread/widgets/FallbackWidget.tsx +26 -0
- package/src/components/ChatThread/widgets/PromptWidget.ts +28 -0
- package/src/components/ChatThread/widgets/ReasoningWidget.stories.tsx +68 -0
- package/src/components/ChatThread/widgets/ReasoningWidget.ts +133 -0
- package/src/components/ChatThread/widgets/ReferenceWidget.ts +31 -0
- package/src/components/ChatThread/widgets/SelectWidget.ts +37 -0
- package/src/components/ChatThread/widgets/StatsWidget.ts +29 -0
- package/src/components/ChatThread/widgets/StatusWidget.ts +133 -0
- package/src/components/ChatThread/widgets/SuggestionWidget.ts +41 -0
- package/src/components/ChatThread/widgets/SummaryWidget.tsx +28 -0
- package/src/components/ChatThread/widgets/ToolWidget.stories.tsx +54 -0
- package/src/components/ChatThread/widgets/ToolWidget.tsx +156 -0
- package/src/components/ChatThread/widgets/index.ts +14 -0
- package/src/components/ProcessTree/ProcessTree.stories.tsx +109 -0
- package/src/components/ProcessTree/ProcessTree.tsx +86 -0
- package/src/components/ProcessTree/index.ts +5 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +27 -18
- package/src/components/TemplateEditor/TemplateEditor.tsx +55 -69
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +23 -16
- package/src/components/TemplateEditor/TemplateForm.tsx +85 -38
- package/src/components/TemplateEditor/extensions/handlebars-extension.ts +274 -0
- package/src/components/TemplateEditor/extensions/index.ts +6 -0
- package/src/components/TemplateEditor/extensions/xml-extension.ts +64 -0
- package/src/components/ToolBlock/ToolBlock.tsx +144 -0
- package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
- package/src/components/ToolBlock/index.ts +6 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +17 -23
- package/src/components/Toolbox/Toolbox.tsx +80 -81
- package/src/components/index.ts +3 -8
- package/src/containers/AgentArticle/AgentArticle.stories.tsx +120 -0
- package/src/containers/AgentArticle/AgentArticle.tsx +198 -0
- package/src/containers/AgentArticle/index.ts +5 -0
- package/src/containers/AgentProperties/AgentProperties.stories.tsx +100 -0
- package/src/containers/AgentProperties/AgentProperties.tsx +158 -0
- package/src/containers/AgentProperties/index.ts +5 -0
- package/src/containers/BlueprintArticle/BlueprintArticle.tsx +29 -0
- package/src/containers/BlueprintArticle/index.ts +5 -0
- package/src/containers/ChatCompanion/ChatCompanion.tsx +142 -0
- package/src/containers/ChatCompanion/index.ts +5 -0
- package/src/containers/ChatContainer/ChatContainer.tsx +95 -0
- package/src/containers/ChatContainer/index.ts +5 -0
- package/src/{components → containers/ChatDialog}/ChatDialog.tsx +27 -23
- package/src/containers/ChatDialog/index.ts +5 -0
- package/src/containers/PromptArticle/PromptArticle.tsx +59 -0
- package/src/containers/PromptArticle/index.ts +5 -0
- package/src/containers/PromptList/PromptList.stories.tsx +129 -0
- package/src/containers/PromptList/PromptList.tsx +49 -0
- package/src/containers/PromptList/index.ts +5 -0
- package/src/containers/TracePanel/TracePanel.stories.tsx +230 -0
- package/src/containers/TracePanel/TracePanel.tsx +114 -0
- package/src/containers/TracePanel/dxn-extractor.test.ts +153 -0
- package/src/containers/TracePanel/dxn-extractor.ts +178 -0
- package/src/containers/TracePanel/execution-graph.ts +425 -0
- package/src/containers/TracePanel/index.ts +9 -0
- package/src/containers/TriggerStatus/TriggerStatus.tsx +144 -0
- package/src/containers/TriggerStatus/index.ts +5 -0
- package/src/containers/index.ts +16 -0
- package/src/extensions/index.ts +5 -0
- package/src/extensions/prompt-extension.ts +111 -0
- package/src/hooks/index.ts +5 -6
- package/src/hooks/useBlueprintRegistry.ts +52 -22
- package/src/hooks/useChatProcessor.ts +47 -38
- package/src/hooks/useChatServices.ts +12 -60
- package/src/hooks/useChatToolbarActions.ts +122 -0
- package/src/hooks/useContextBinder.ts +43 -0
- package/src/hooks/useContextObjects.ts +50 -0
- package/src/hooks/useFilteredTypes.ts +37 -0
- package/src/hooks/usePresets.ts +5 -5
- package/src/hooks/useReferencesProvider.ts +5 -8
- package/src/index.ts +3 -2
- package/src/meta.ts +15 -9
- package/src/operations/create-chat.ts +80 -0
- package/src/operations/definitions.ts +127 -0
- package/src/operations/ensure-companion-chat.ts +61 -0
- package/src/operations/index.ts +17 -0
- package/src/operations/on-create-space.ts +24 -0
- package/src/operations/resolve-navigation-targets.ts +26 -0
- package/src/operations/run-prompt-in-new-chat.ts +113 -0
- package/src/operations/set-current-chat.ts +50 -0
- package/src/operations/update-chat-name.ts +61 -0
- package/src/processor/index.ts +6 -0
- package/src/{hooks → processor}/presets.ts +21 -6
- package/src/processor/processor.test.ts +40 -0
- package/src/processor/processor.ts +321 -0
- package/src/queue-logger.ts +29 -19
- package/src/testing/index.ts +1 -1
- package/src/testing/test-generator.ts +293 -0
- package/src/testing/test-sequence.ts +4 -29
- package/src/testing/test-services.ts +10 -14
- package/src/testing/trace-timeline.conversations.json +1 -0
- package/src/testing/trace-timeline.test.ts +246 -0
- package/src/translations.ts +161 -66
- package/src/types/Assistant.ts +8 -56
- package/src/types/Settings.ts +21 -0
- package/src/types/capabilities.ts +35 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +5 -1
- package/src/types/service.ts +27 -16
- package/src/vite-env.d.ts +30 -0
- package/dist/lib/browser/BlueprintContainer-H7H4BQ2C.mjs +0 -29
- package/dist/lib/browser/BlueprintContainer-H7H4BQ2C.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-SB7YC2XP.mjs +0 -77
- package/dist/lib/browser/ChatContainer-SB7YC2XP.mjs.map +0 -7
- package/dist/lib/browser/ChatDialog-X6PFOQSQ.mjs +0 -87
- package/dist/lib/browser/ChatDialog-X6PFOQSQ.mjs.map +0 -7
- package/dist/lib/browser/SequenceContainer-627OQ557.mjs +0 -163
- package/dist/lib/browser/SequenceContainer-627OQ557.mjs.map +0 -7
- package/dist/lib/browser/ai-service-7KJ5LXBT.mjs +0 -22
- package/dist/lib/browser/ai-service-7KJ5LXBT.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-ERU5XY2S.mjs +0 -166
- package/dist/lib/browser/app-graph-builder-ERU5XY2S.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs +0 -146
- package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs.map +0 -7
- package/dist/lib/browser/chunk-BVH6VK6Q.mjs +0 -2254
- package/dist/lib/browser/chunk-BVH6VK6Q.mjs.map +0 -7
- package/dist/lib/browser/chunk-JBFDQMUJ.mjs +0 -193
- package/dist/lib/browser/chunk-JBFDQMUJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-LKP65RPA.mjs +0 -20
- package/dist/lib/browser/chunk-LKP65RPA.mjs.map +0 -7
- package/dist/lib/browser/chunk-NZDCKQ6W.mjs +0 -89
- package/dist/lib/browser/chunk-NZDCKQ6W.mjs.map +0 -7
- package/dist/lib/browser/chunk-QB7OVS6Z.mjs +0 -16
- package/dist/lib/browser/chunk-QB7OVS6Z.mjs.map +0 -7
- package/dist/lib/browser/chunk-Y66UJUHV.mjs +0 -280
- package/dist/lib/browser/chunk-Y66UJUHV.mjs.map +0 -7
- package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs +0 -24
- package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-DGRO2XSG.mjs +0 -81
- package/dist/lib/browser/intent-resolver-DGRO2XSG.mjs.map +0 -7
- package/dist/lib/browser/react-surface-LPSIBHEJ.mjs +0 -163
- package/dist/lib/browser/react-surface-LPSIBHEJ.mjs.map +0 -7
- package/dist/lib/browser/settings-ZFNQYSYP.mjs +0 -23
- package/dist/lib/browser/settings-ZFNQYSYP.mjs.map +0 -7
- package/dist/lib/browser/toolkit-IW4FBLLB.mjs +0 -105
- package/dist/lib/browser/toolkit-IW4FBLLB.mjs.map +0 -7
- package/dist/lib/node-esm/BlueprintContainer-VH4EE4CM.mjs +0 -30
- package/dist/lib/node-esm/BlueprintContainer-VH4EE4CM.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-7JLMWHMX.mjs +0 -78
- package/dist/lib/node-esm/ChatContainer-7JLMWHMX.mjs.map +0 -7
- package/dist/lib/node-esm/ChatDialog-QDD722F2.mjs +0 -88
- package/dist/lib/node-esm/ChatDialog-QDD722F2.mjs.map +0 -7
- package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs +0 -164
- package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs.map +0 -7
- package/dist/lib/node-esm/ai-service-LDD32477.mjs +0 -23
- package/dist/lib/node-esm/ai-service-LDD32477.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-RCT4ANP2.mjs +0 -167
- package/dist/lib/node-esm/app-graph-builder-RCT4ANP2.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs +0 -147
- package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ETS2CIDF.mjs +0 -2255
- package/dist/lib/node-esm/chunk-ETS2CIDF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GAWXJ7K5.mjs +0 -90
- package/dist/lib/node-esm/chunk-GAWXJ7K5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GENVBE3B.mjs +0 -194
- package/dist/lib/node-esm/chunk-GENVBE3B.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KOC6ESG7.mjs +0 -22
- package/dist/lib/node-esm/chunk-KOC6ESG7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QS6GWTVA.mjs +0 -281
- package/dist/lib/node-esm/chunk-QS6GWTVA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-X6AANUHZ.mjs +0 -17
- package/dist/lib/node-esm/chunk-X6AANUHZ.mjs.map +0 -7
- package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs +0 -25
- package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-7CKWG7TZ.mjs +0 -82
- package/dist/lib/node-esm/intent-resolver-7CKWG7TZ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-3EPAE4I4.mjs +0 -164
- package/dist/lib/node-esm/react-surface-3EPAE4I4.mjs.map +0 -7
- package/dist/lib/node-esm/settings-UI4VQCWW.mjs +0 -24
- package/dist/lib/node-esm/settings-UI4VQCWW.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-2VNUL77B.mjs +0 -106
- package/dist/lib/node-esm/toolkit-2VNUL77B.mjs.map +0 -7
- package/dist/types/src/capabilities/capabilities.d.ts +0 -11
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/BlueprintContainer.d.ts +0 -8
- package/dist/types/src/components/BlueprintContainer.d.ts.map +0 -1
- package/dist/types/src/components/ChatContainer.d.ts +0 -12
- package/dist/types/src/components/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/components/ChatDialog.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -18
- package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts +0 -19
- package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +0 -1
- package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
- package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
- package/dist/types/src/components/PromptSettings.d.ts +0 -6
- package/dist/types/src/components/PromptSettings.d.ts.map +0 -1
- package/dist/types/src/components/SequenceContainer.d.ts +0 -8
- package/dist/types/src/components/SequenceContainer.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +0 -13
- package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +0 -8
- package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/SequenceEditor/index.d.ts +0 -2
- package/dist/types/src/components/SequenceEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/Timeline/Timeline.d.ts +0 -42
- package/dist/types/src/components/Timeline/Timeline.d.ts.map +0 -1
- package/dist/types/src/components/Timeline/Timeline.stories.d.ts +0 -11
- package/dist/types/src/components/Timeline/Timeline.stories.d.ts.map +0 -1
- package/dist/types/src/components/Timeline/index.d.ts +0 -2
- package/dist/types/src/components/Timeline/index.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/execution-graph/execution-graph.d.ts +0 -21
- package/dist/types/src/execution-graph/execution-graph.d.ts.map +0 -1
- package/dist/types/src/execution-graph/index.d.ts +0 -2
- package/dist/types/src/execution-graph/index.d.ts.map +0 -1
- package/dist/types/src/functions/analysis.d.ts +0 -5
- package/dist/types/src/functions/analysis.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -4
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/list.d.ts +0 -10
- package/dist/types/src/functions/list.d.ts.map +0 -1
- package/dist/types/src/functions/load.d.ts +0 -8
- package/dist/types/src/functions/load.d.ts.map +0 -1
- package/dist/types/src/hooks/chat-processor.d.ts +0 -72
- package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
- package/dist/types/src/hooks/errors.d.ts +0 -4
- package/dist/types/src/hooks/errors.d.ts.map +0 -1
- package/dist/types/src/hooks/presets.d.ts.map +0 -1
- package/dist/types/src/hooks/useExecutionGraph.d.ts +0 -7
- package/dist/types/src/hooks/useExecutionGraph.d.ts.map +0 -1
- package/dist/types/src/hooks/useResolveRef.d.ts +0 -4
- package/dist/types/src/hooks/useResolveRef.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.d.ts +0 -4
- package/dist/types/src/parser/filter-generator.d.ts.map +0 -1
- package/dist/types/src/parser/filter-generator.test.d.ts +0 -2
- package/dist/types/src/parser/filter-generator.test.d.ts.map +0 -1
- package/dist/types/src/parser/index.d.ts +0 -4
- package/dist/types/src/parser/index.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.d.ts +0 -15
- package/dist/types/src/parser/query-parser.d.ts.map +0 -1
- package/dist/types/src/parser/query-parser.test.d.ts +0 -2
- package/dist/types/src/parser/query-parser.test.d.ts.map +0 -1
- package/dist/types/src/parser/types.d.ts +0 -24
- package/dist/types/src/parser/types.d.ts.map +0 -1
- package/dist/types/src/stories/Chat.stories.d.ts +0 -268
- package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
- package/dist/types/src/stories/components/BlueprintContainer.d.ts +0 -5
- package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/ChatContainer.d.ts +0 -5
- package/dist/types/src/stories/components/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/GraphContainer.d.ts +0 -6
- package/dist/types/src/stories/components/GraphContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/LoggingContainer.d.ts +0 -5
- package/dist/types/src/stories/components/LoggingContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/SurfaceContainer.d.ts +0 -8
- package/dist/types/src/stories/components/SurfaceContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/TasksContainer.d.ts +0 -5
- package/dist/types/src/stories/components/TasksContainer.d.ts.map +0 -1
- package/dist/types/src/stories/components/index.d.ts +0 -8
- package/dist/types/src/stories/components/index.d.ts.map +0 -1
- package/dist/types/src/stories/components/types.d.ts +0 -7
- package/dist/types/src/stories/components/types.d.ts.map +0 -1
- package/dist/types/src/stories/hooks/index.d.ts +0 -3
- package/dist/types/src/stories/hooks/index.d.ts.map +0 -1
- package/dist/types/src/stories/hooks/useFlush.d.ts.map +0 -1
- package/dist/types/src/stories/hooks/useMatcherExtension.d.ts +0 -3
- package/dist/types/src/stories/hooks/useMatcherExtension.d.ts.map +0 -1
- package/dist/types/src/stories/testing/data.d.ts +0 -142
- package/dist/types/src/stories/testing/data.d.ts.map +0 -1
- package/dist/types/src/stories/testing/index.d.ts +0 -3
- package/dist/types/src/stories/testing/index.d.ts.map +0 -1
- package/dist/types/src/stories/testing/testing.d.ts +0 -26
- package/dist/types/src/stories/testing/testing.d.ts.map +0 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -6
- package/dist/types/src/testing/test-functions.d.ts.map +0 -1
- package/dist/types/src/tools/function.d.ts +0 -5
- package/dist/types/src/tools/function.d.ts.map +0 -1
- package/dist/types/src/tools/index.d.ts +0 -3
- package/dist/types/src/tools/index.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.d.ts +0 -10
- package/dist/types/src/tools/openapi.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.test.d.ts +0 -2
- package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
- package/dist/types/src/types/AssistantAction.d.ts +0 -91
- package/dist/types/src/types/AssistantAction.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -22
- package/src/capabilities/intent-resolver.ts +0 -73
- package/src/components/BlueprintContainer.tsx +0 -24
- package/src/components/ChatContainer.tsx +0 -69
- package/src/components/ChatThread/ChatMessage.tsx +0 -291
- package/src/components/ChatThread/ToolBlock.tsx +0 -125
- package/src/components/ChatThread/reducer.ts +0 -52
- package/src/components/PromptSettings.tsx +0 -89
- package/src/components/SequenceContainer.tsx +0 -133
- package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -33
- package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
- package/src/components/Timeline/Timeline.stories.tsx +0 -144
- package/src/components/Timeline/Timeline.tsx +0 -202
- package/src/events.ts +0 -11
- package/src/execution-graph/execution-graph.ts +0 -184
- package/src/execution-graph/index.ts +0 -5
- package/src/functions/analysis.ts +0 -20
- package/src/functions/index.ts +0 -7
- package/src/functions/list.ts +0 -42
- package/src/functions/load.ts +0 -43
- package/src/hooks/chat-processor.ts +0 -260
- package/src/hooks/errors.ts +0 -8
- package/src/hooks/useExecutionGraph.ts +0 -16
- package/src/hooks/useResolveRef.ts +0 -33
- package/src/parser/filter-generator.test.ts +0 -32
- package/src/parser/filter-generator.ts +0 -74
- package/src/parser/index.ts +0 -7
- package/src/parser/query-parser.test.ts +0 -139
- package/src/parser/query-parser.ts +0 -199
- package/src/parser/types.ts +0 -34
- package/src/shims.d.ts +0 -8
- package/src/stories/Chat.stories.tsx +0 -317
- package/src/stories/components/BlueprintContainer.tsx +0 -34
- package/src/stories/components/ChatContainer.tsx +0 -80
- package/src/stories/components/GraphContainer.tsx +0 -118
- package/src/stories/components/LoggingContainer.tsx +0 -29
- package/src/stories/components/SurfaceContainer.tsx +0 -62
- package/src/stories/components/TasksContainer.tsx +0 -51
- package/src/stories/components/index.ts +0 -12
- package/src/stories/components/types.ts +0 -11
- package/src/stories/hooks/index.ts +0 -6
- package/src/stories/hooks/useMatcherExtension.ts +0 -45
- package/src/stories/testing/data.ts +0 -130
- package/src/stories/testing/index.ts +0 -6
- package/src/stories/testing/testing.tsx +0 -163
- package/src/testing/test-functions.ts +0 -16
- package/src/tools/function.ts +0 -49
- package/src/tools/index.ts +0 -6
- package/src/tools/openapi.test.ts +0 -219
- package/src/tools/openapi.ts +0 -341
- package/src/types/AssistantAction.ts +0 -54
- package/src/typings.d.ts +0 -9
- /package/dist/types/src/{stories/hooks → hooks}/useFlush.d.ts +0 -0
- /package/src/{stories/hooks → hooks}/useFlush.ts +0 -0
package/src/tools/function.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// ISSUE(burdon): deprecated types: ToolResult
|
|
6
|
-
|
|
7
|
-
import { type ExecutableTool, ToolResult, createTool } from '@dxos/ai';
|
|
8
|
-
import { Type } from '@dxos/echo';
|
|
9
|
-
import { getInvocationUrl, getUserFunctionUrlInMetadata } from '@dxos/functions';
|
|
10
|
-
import { type FunctionType } from '@dxos/functions';
|
|
11
|
-
import { log } from '@dxos/log';
|
|
12
|
-
import { type SpaceId } from '@dxos/react-client/echo';
|
|
13
|
-
import { getMeta } from '@dxos/react-client/echo';
|
|
14
|
-
|
|
15
|
-
// TODO(burdon): Move to @dxos/ai.
|
|
16
|
-
export const convertFunctionToTool = (
|
|
17
|
-
fn: FunctionType,
|
|
18
|
-
edgeUrl: string,
|
|
19
|
-
spaceId?: SpaceId | undefined,
|
|
20
|
-
): ExecutableTool | undefined => {
|
|
21
|
-
if (!fn.description || !fn.inputSchema) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
const existingFunctionUrl = getUserFunctionUrlInMetadata(getMeta(fn));
|
|
25
|
-
if (!existingFunctionUrl) {
|
|
26
|
-
return undefined;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const url = getInvocationUrl(existingFunctionUrl, edgeUrl, { spaceId });
|
|
30
|
-
|
|
31
|
-
// TODO(burdon): Should be DXN?
|
|
32
|
-
return createTool('user-function', {
|
|
33
|
-
name: fn.name,
|
|
34
|
-
description: fn.description,
|
|
35
|
-
schema: Type.toEffectSchema(fn.inputSchema),
|
|
36
|
-
execute: async (input) => {
|
|
37
|
-
log.info('execute function tool', { name: fn.name, url, input });
|
|
38
|
-
const response = await fetch(url, {
|
|
39
|
-
method: 'POST',
|
|
40
|
-
headers: {
|
|
41
|
-
'Content-Type': 'application/json',
|
|
42
|
-
},
|
|
43
|
-
body: JSON.stringify(input),
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
return ToolResult.Success(await response.text());
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
};
|
package/src/tools/index.ts
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { describe, expect, test } from 'vitest';
|
|
6
|
-
|
|
7
|
-
import { log } from '@dxos/log';
|
|
8
|
-
|
|
9
|
-
import { AiChatProcessor } from '../hooks';
|
|
10
|
-
import { type ApiAuthorization } from '../types';
|
|
11
|
-
|
|
12
|
-
import { createToolsFromApi, resolveAuthorization } from './openapi';
|
|
13
|
-
|
|
14
|
-
describe.skip('openapi', () => {
|
|
15
|
-
describe.skip('mapping', () => {
|
|
16
|
-
test('amadeus flight availabilities', async () => {
|
|
17
|
-
const tools = await createToolsFromApi(FLIGHT_SEARCH_API);
|
|
18
|
-
log.info('tools', { tools });
|
|
19
|
-
// for (const tool of tools) {
|
|
20
|
-
// const schema = tool.parameters;
|
|
21
|
-
// // log.info('schema', { schema });
|
|
22
|
-
// }
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
test('amadeus hotel search', async () => {
|
|
26
|
-
const tools = await createToolsFromApi(HOTEL_SEARCH_API);
|
|
27
|
-
log.info('tools', { tools });
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('amadeus hotel name autocomplete', async () => {
|
|
31
|
-
const tools = await createToolsFromApi(HOTEL_NAME_AUTOCOMPLETE_API);
|
|
32
|
-
log.info('tools', { tools });
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
test('weather', async () => {
|
|
36
|
-
const tools = await createToolsFromApi(WEATHER_API, { authorization: VISUAL_CROSSING_CREDENTIALS });
|
|
37
|
-
log.info('tools', { tools });
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
describe.skip('invoke tools', () => {
|
|
42
|
-
test('amadeus hotel name autocomplete', async () => {
|
|
43
|
-
const tools = await createToolsFromApi(HOTEL_NAME_AUTOCOMPLETE_API, { authorization: AMADEUS_AUTH });
|
|
44
|
-
const result = await tools[0].execute(
|
|
45
|
-
{
|
|
46
|
-
keyword: 'William Vale Brooklyn',
|
|
47
|
-
subType: ['HOTEL_LEISURE', 'HOTEL_GDS'],
|
|
48
|
-
countryCode: 'US',
|
|
49
|
-
},
|
|
50
|
-
{},
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
log.info('result', { result });
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
test('weather API', async () => {
|
|
57
|
-
const tools = await createToolsFromApi(WEATHER_API, { authorization: VISUAL_CROSSING_CREDENTIALS });
|
|
58
|
-
const forecastTool = tools.find((tool) => tool.name.includes('forecast'));
|
|
59
|
-
const result = await forecastTool?.execute(
|
|
60
|
-
{
|
|
61
|
-
locations: 'Brooklyn, NY',
|
|
62
|
-
aggregateHours: '24',
|
|
63
|
-
},
|
|
64
|
-
{},
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
log.info('result', { result });
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
// ISSUE(burdon): tools
|
|
72
|
-
describe.skip('AI uses tools', () => {
|
|
73
|
-
test('amadeus flight availabilities', { timeout: 60_000 }, async () => {
|
|
74
|
-
const tools = await createToolsFromApi(FLIGHT_SEARCH_API, { authorization: AMADEUS_AUTH });
|
|
75
|
-
// const aiClient = new Edge AiServiceClient({ endpoint: AI_SERVICE_ENDPOINT.LOCAL });
|
|
76
|
-
// TODO(dmaretskyi): FIX ME.
|
|
77
|
-
const processor = new AiChatProcessor(null as any, null as any);
|
|
78
|
-
const reply = await processor.request(
|
|
79
|
-
`What is the cheapest flight from New York to Paris? going on ${new Date().toISOString()} and returning after a week. 1 adult traveler`,
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
log.info('reply', { reply });
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
// TODO(dmaretskyi): Doesn't work.
|
|
86
|
-
test('amadeus hotel name autocomplete', { timeout: 60_000 }, async () => {
|
|
87
|
-
const tools = await createToolsFromApi(HOTEL_NAME_AUTOCOMPLETE_API, { authorization: AMADEUS_AUTH });
|
|
88
|
-
// const aiClient = new Edge AiServiceClient({ endpoint: AI_SERVICE_ENDPOINT.LOCAL });
|
|
89
|
-
// TODO(dmaretskyi): FIX ME.
|
|
90
|
-
const processor = new AiChatProcessor(null as any, null as any);
|
|
91
|
-
const reply = await processor.request('Find me the William Wale in Brooklyn New York');
|
|
92
|
-
|
|
93
|
-
log.info('reply', { reply });
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
test.only('weather forecast', { timeout: 60_000 }, async () => {
|
|
97
|
-
const tools = await createToolsFromApi(WEATHER_API, {
|
|
98
|
-
authorization: VISUAL_CROSSING_CREDENTIALS,
|
|
99
|
-
instructions: WEATHER_INSTRUCTIONS,
|
|
100
|
-
});
|
|
101
|
-
// const aiClient = new Edge AiServiceClient({ endpoint: AI_SERVICE_ENDPOINT.LOCAL });
|
|
102
|
-
// TODO(dmaretskyi): FIX ME.
|
|
103
|
-
const processor = new AiChatProcessor(null as any, null as any);
|
|
104
|
-
const reply = await processor.request(
|
|
105
|
-
`Today's date is ${new Date().toISOString().split('T')[0]}. Give me weather forecast for Warsaw for next 5 days.`,
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
log.info('reply', { reply });
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
describe.skip('invoke api directly', { timeout: 10_000 }, () => {
|
|
113
|
-
test('amadeus flight availabilities', async () => {
|
|
114
|
-
const response = await fetch('https://test.api.amadeus.com/v1/shopping/availability/flight-availabilities', {
|
|
115
|
-
method: 'POST',
|
|
116
|
-
headers: {
|
|
117
|
-
accept: 'application/vnd.amadeus+json',
|
|
118
|
-
'X-HTTP-Method-Override': 'GET',
|
|
119
|
-
'Content-Type': 'application/vnd.amadeus+json',
|
|
120
|
-
Authorization: await resolveAuthorization(AMADEUS_AUTH),
|
|
121
|
-
},
|
|
122
|
-
body: JSON.stringify({
|
|
123
|
-
originDestinations: [
|
|
124
|
-
{
|
|
125
|
-
departureDateTime: {
|
|
126
|
-
date: new Date().toISOString().split('T')[0],
|
|
127
|
-
time: new Date().toTimeString().split(' ')[0],
|
|
128
|
-
},
|
|
129
|
-
destinationLocationCode: 'MAD',
|
|
130
|
-
id: '1',
|
|
131
|
-
originLocationCode: 'BOS',
|
|
132
|
-
},
|
|
133
|
-
],
|
|
134
|
-
sources: ['GDS'],
|
|
135
|
-
travelers: [
|
|
136
|
-
{
|
|
137
|
-
id: '1',
|
|
138
|
-
travelerType: 'ADULT',
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
}),
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
log.info('response', { status: response.status, body: await response.json() });
|
|
145
|
-
expect(response.status).toBe(200);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
test.only('amadeus hotel name autocomplete', async () => {
|
|
149
|
-
const response = await fetch(
|
|
150
|
-
'https://test.api.amadeus.com/v1/reference-data/locations/hotel?keyword=PARI&subtype=HOTEL_LEISURE,HOTEL_GDS',
|
|
151
|
-
{
|
|
152
|
-
method: 'GET',
|
|
153
|
-
headers: {
|
|
154
|
-
// accept: 'application/vnd.amadeus+json',
|
|
155
|
-
// 'X-HTTP-Method-Override': 'GET',
|
|
156
|
-
Authorization: await resolveAuthorization(AMADEUS_AUTH),
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
log.info('response', { status: response.status, body: await response.json() });
|
|
162
|
-
expect(response.status).toBe(200);
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
describe.skip('rapidapi', () => {
|
|
167
|
-
test('amadeus flight availabilities', async () => {
|
|
168
|
-
const departureDate = new Date().toISOString().split('T')[0];
|
|
169
|
-
const arrivalDate = new Date(new Date().getTime() + 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0];
|
|
170
|
-
|
|
171
|
-
const url = `https://amadeus-api2.p.rapidapi.com/serpapi-flight-search?departure_id=PEK&arrival_id=AUS&outbound_date=${departureDate}&return_date=${arrivalDate}¤cy=USD&hl=en`;
|
|
172
|
-
const options = {
|
|
173
|
-
method: 'GET',
|
|
174
|
-
headers: {
|
|
175
|
-
'x-rapidapi-key': RAPID_API_CREDENTIALS.key,
|
|
176
|
-
'x-rapidapi-host': 'amadeus-api2.p.rapidapi.com',
|
|
177
|
-
},
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
const response = await fetch(url, options);
|
|
181
|
-
log.info('response', { status: response.status, body: await response.json() });
|
|
182
|
-
expect(response.status).toBe(200);
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
const FLIGHT_SEARCH_API =
|
|
188
|
-
'https://api.apis.guru/v2/specs/amadeus.com/amadeus-flight-availabilities-search/1.0.2/swagger.json';
|
|
189
|
-
const HOTEL_SEARCH_API = 'https://api.apis.guru/v2/specs/amadeus.com/amadeus-hotel-search/3.0.8/swagger.json';
|
|
190
|
-
const HOTEL_NAME_AUTOCOMPLETE_API =
|
|
191
|
-
'https://api.apis.guru/v2/specs/amadeus.com/amadeus-hotel-name-autocomplete/1.0.3/swagger.json';
|
|
192
|
-
const WEATHER_API = 'https://api.apis.guru/v2/specs/visualcrossing.com/weather/4.6/openapi.json';
|
|
193
|
-
|
|
194
|
-
const WEATHER_INSTRUCTIONS = `
|
|
195
|
-
If the user doesn't provide a date, use today's date.
|
|
196
|
-
Make sure to provide the start and end dates when possible to reduce the amount of data returned.
|
|
197
|
-
Use the tool that accepts the date parameters.
|
|
198
|
-
`;
|
|
199
|
-
|
|
200
|
-
const AMADEUS_AUTH: ApiAuthorization = {
|
|
201
|
-
type: 'oauth',
|
|
202
|
-
clientId: 'BOEnpLd1sMyKjAPGKYeAPFFy60u53QEG',
|
|
203
|
-
clientSecret: 'n4qldSN7usvD57gm',
|
|
204
|
-
tokenUrl: 'https://test.api.amadeus.com/v1/security/oauth2/token',
|
|
205
|
-
grantType: 'client_credentials',
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
const VISUAL_CROSSING_CREDENTIALS: ApiAuthorization = {
|
|
209
|
-
type: 'api-key',
|
|
210
|
-
key: 'FDPRVS953KB4GQQLD25GRT975',
|
|
211
|
-
placement: {
|
|
212
|
-
type: 'query',
|
|
213
|
-
name: 'key',
|
|
214
|
-
},
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
const RAPID_API_CREDENTIALS = {
|
|
218
|
-
key: '92271b6740msh32fd821d70f050dp16665bjsna69195c9e838',
|
|
219
|
-
};
|
package/src/tools/openapi.ts
DELETED
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// ISSUE(burdon): tools
|
|
6
|
-
// @ts-ignore
|
|
7
|
-
|
|
8
|
-
import { Schema } from 'effect';
|
|
9
|
-
import jsonpointer from 'jsonpointer';
|
|
10
|
-
import { type OpenAPIV2, type OpenAPIV3_1 } from 'openapi-types';
|
|
11
|
-
|
|
12
|
-
import { type ExecutableTool, ToolResult, createRawTool } from '@dxos/ai';
|
|
13
|
-
import { Type } from '@dxos/echo';
|
|
14
|
-
import { normalizeSchema } from '@dxos/echo-schema';
|
|
15
|
-
import { invariant } from '@dxos/invariant';
|
|
16
|
-
import { log } from '@dxos/log';
|
|
17
|
-
import { deepMapValues } from '@dxos/util';
|
|
18
|
-
|
|
19
|
-
import type { ApiAuthorization, ServiceType } from '../types';
|
|
20
|
-
|
|
21
|
-
export type CreateToolsFromApiOptions = {
|
|
22
|
-
authorization?: ApiAuthorization;
|
|
23
|
-
instructions?: string;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const createToolsFromService = async (service: ServiceType): Promise<ExecutableTool[]> => {
|
|
27
|
-
invariant(service.interfaces?.length === 1 && service.interfaces[0].kind === 'api');
|
|
28
|
-
const iface = service.interfaces[0];
|
|
29
|
-
invariant(iface.schemaUrl);
|
|
30
|
-
invariant(iface.schemaUrl);
|
|
31
|
-
return createToolsFromApi(iface.schemaUrl, { authorization: iface.authorization });
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const createToolsFromApi = async (
|
|
35
|
-
url: string,
|
|
36
|
-
options?: CreateToolsFromApiOptions,
|
|
37
|
-
): Promise<ExecutableTool[]> => {
|
|
38
|
-
const res = await fetch(url);
|
|
39
|
-
const spec = (await res.json()) as OpenAPIV2.Document;
|
|
40
|
-
log('spec', { spec });
|
|
41
|
-
|
|
42
|
-
const tools: ExecutableTool[] = [];
|
|
43
|
-
for (const [path, pathItem] of Object.entries(spec.paths)) {
|
|
44
|
-
if (typeof pathItem !== 'object') {
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const { ...methods } = pathItem;
|
|
49
|
-
for (const [method, m] of Object.entries(methods)) {
|
|
50
|
-
const methodItem: OpenAPIV2.OperationObject = m as OpenAPIV2.OperationObject;
|
|
51
|
-
log('methodItem', { path, method, methodItem });
|
|
52
|
-
|
|
53
|
-
const parametersResolved: OpenAPIV2.ParameterObject[] =
|
|
54
|
-
methodItem.parameters?.map((parameter: any) => {
|
|
55
|
-
const resolved = resolveJsonSchema(parameter, spec);
|
|
56
|
-
return resolved;
|
|
57
|
-
}) ?? [];
|
|
58
|
-
|
|
59
|
-
const inputSchema: Type.JsonSchema = {
|
|
60
|
-
type: 'object',
|
|
61
|
-
properties: {},
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const endpointParameters: OpenAPIV2.ParameterObject[] = [];
|
|
65
|
-
for (const parameter of parametersResolved) {
|
|
66
|
-
log('parameter', { parameter });
|
|
67
|
-
|
|
68
|
-
if (
|
|
69
|
-
options?.authorization?.type === 'api-key' &&
|
|
70
|
-
options.authorization.placement.type === 'query' &&
|
|
71
|
-
parameter.in === 'query' &&
|
|
72
|
-
parameter.name === options.authorization.placement.name
|
|
73
|
-
) {
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
endpointParameters.push(parameter);
|
|
78
|
-
|
|
79
|
-
if (parameter.schema) {
|
|
80
|
-
inputSchema.properties![parameter.name] = normalizeSchema(parameter.schema);
|
|
81
|
-
} else if (typeof parameter.type === 'string') {
|
|
82
|
-
const { name, in: _in, required, ...schema } = parameter;
|
|
83
|
-
inputSchema.properties![name] = normalizeSchema(schema);
|
|
84
|
-
if (required) {
|
|
85
|
-
inputSchema.required ??= [];
|
|
86
|
-
inputSchema.required.push(name);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
log('inputSchema', { inputSchema });
|
|
92
|
-
Schema.validateSync(Type.JsonSchema)(inputSchema);
|
|
93
|
-
|
|
94
|
-
const description = methodItem.description ?? methodItem.summary;
|
|
95
|
-
if (!description) {
|
|
96
|
-
log.warn('no description', { path, method });
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const endpoint: EndpointDescriptor = {
|
|
101
|
-
document: spec,
|
|
102
|
-
path,
|
|
103
|
-
method,
|
|
104
|
-
parameters: endpointParameters,
|
|
105
|
-
authorization: options?.authorization,
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
tools.push(
|
|
109
|
-
// TODO(burdon): Namespace?
|
|
110
|
-
createRawTool('openapi', {
|
|
111
|
-
name: getToolName(path, method, methodItem),
|
|
112
|
-
description: options?.instructions ? `${options.instructions}\n\n${description}` : description,
|
|
113
|
-
parameters: inputSchema,
|
|
114
|
-
execute: async (input) => {
|
|
115
|
-
const response = await callApiEndpoint(endpoint, input);
|
|
116
|
-
return ToolResult.Success(response);
|
|
117
|
-
},
|
|
118
|
-
}),
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return tools;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const getToolName = (path: string, method: string, methodItem: OpenAPIV2.OperationObject) => {
|
|
127
|
-
if (methodItem.operationId) {
|
|
128
|
-
return methodItem.operationId;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Generate a name from the path and method.
|
|
132
|
-
let name = `${method.toLowerCase()}_${path.replaceAll(/[{}/]/g, '_')}`;
|
|
133
|
-
while (name.length > MAX_TOOL_NAME_LENGTH) {
|
|
134
|
-
const lengthBefore = name.length;
|
|
135
|
-
|
|
136
|
-
for (const word of GENERIC_WORDS) {
|
|
137
|
-
if (name.includes(word)) {
|
|
138
|
-
name = name.replace(word, '');
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
name = name.replaceAll('__', '_').replace(/_$/, '');
|
|
143
|
-
|
|
144
|
-
const lengthAfter = name.length;
|
|
145
|
-
if (lengthBefore === lengthAfter) {
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
name = name.replaceAll('__', '_').replace(/_$/, '').replace(/^_/, '');
|
|
150
|
-
|
|
151
|
-
return name.slice(0, MAX_TOOL_NAME_LENGTH);
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const MAX_TOOL_NAME_LENGTH = 64;
|
|
155
|
-
const GENERIC_WORDS = [
|
|
156
|
-
'services',
|
|
157
|
-
'service',
|
|
158
|
-
'api',
|
|
159
|
-
'rest',
|
|
160
|
-
'endpoint',
|
|
161
|
-
'get',
|
|
162
|
-
'post',
|
|
163
|
-
'put',
|
|
164
|
-
'delete',
|
|
165
|
-
'patch',
|
|
166
|
-
'head',
|
|
167
|
-
'options',
|
|
168
|
-
'trace',
|
|
169
|
-
'service',
|
|
170
|
-
'api',
|
|
171
|
-
'endpoint',
|
|
172
|
-
];
|
|
173
|
-
|
|
174
|
-
type EndpointDescriptor = {
|
|
175
|
-
document: OpenAPIV3_1.Document | OpenAPIV2.Document;
|
|
176
|
-
path: string;
|
|
177
|
-
method: string;
|
|
178
|
-
parameters: OpenAPIV2.ParameterObject[];
|
|
179
|
-
authorization?: ApiAuthorization;
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
const callApiEndpoint = async (endpoint: EndpointDescriptor, input: any) => {
|
|
183
|
-
log.info('endpoint', { method: endpoint.method, name: endpoint.path, input });
|
|
184
|
-
|
|
185
|
-
let url = getEndpointUrl(endpoint);
|
|
186
|
-
const request: RequestInit = {
|
|
187
|
-
method: endpoint.method,
|
|
188
|
-
headers: {},
|
|
189
|
-
};
|
|
190
|
-
const query = new URLSearchParams();
|
|
191
|
-
let body: any;
|
|
192
|
-
for (const parameter of endpoint.parameters) {
|
|
193
|
-
if (input[parameter.name] === undefined) {
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
switch (parameter.in) {
|
|
198
|
-
case 'header': {
|
|
199
|
-
if (parameter.example) {
|
|
200
|
-
(request.headers as any)[parameter.name] = parameter.default;
|
|
201
|
-
}
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
|
-
case 'path': {
|
|
205
|
-
url = url.replace(`{${parameter.name}}`, encodeURIComponent(input[parameter.name]));
|
|
206
|
-
break;
|
|
207
|
-
}
|
|
208
|
-
case 'body': {
|
|
209
|
-
const value = input[parameter.name];
|
|
210
|
-
|
|
211
|
-
// Client-side validation
|
|
212
|
-
const effectSchema = Type.toEffectSchema(parameter.schema);
|
|
213
|
-
Schema.validateSync(effectSchema)(value);
|
|
214
|
-
|
|
215
|
-
if (body) {
|
|
216
|
-
throw new Error(`Duplicate body parameter: ${parameter.name}`);
|
|
217
|
-
}
|
|
218
|
-
body = value;
|
|
219
|
-
break;
|
|
220
|
-
}
|
|
221
|
-
case 'query': {
|
|
222
|
-
query.set(parameter.name, input[parameter.name]);
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
if (
|
|
229
|
-
(endpoint.authorization?.type === 'api-key' && endpoint.authorization.placement.type === 'authorization-header') ||
|
|
230
|
-
endpoint.authorization?.type === 'oauth'
|
|
231
|
-
) {
|
|
232
|
-
(request.headers as any).Authorization = await resolveAuthorization(endpoint.authorization);
|
|
233
|
-
} else if (endpoint.authorization?.type === 'api-key' && endpoint.authorization.placement.type === 'query') {
|
|
234
|
-
query.set(endpoint.authorization.placement.name, endpoint.authorization.key);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
if (query.size > 0) {
|
|
238
|
-
url += `?${query.toString()}`;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
if (body) {
|
|
242
|
-
request.body = JSON.stringify(body);
|
|
243
|
-
(request.headers as any)['Content-Type'] = 'application/json';
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
log.info('request', { url, request });
|
|
247
|
-
const response = await fetch(url, request);
|
|
248
|
-
|
|
249
|
-
log.info('response', { ok: response.ok, status: response.status, statusText: response.statusText });
|
|
250
|
-
|
|
251
|
-
if (response.ok) {
|
|
252
|
-
const contentType = response.headers.get('Content-Type');
|
|
253
|
-
if (contentType?.includes('application/json')) {
|
|
254
|
-
return await response.json();
|
|
255
|
-
} else {
|
|
256
|
-
return await response.text();
|
|
257
|
-
}
|
|
258
|
-
} else {
|
|
259
|
-
if (response.headers.get('Content-Type')?.includes('application/json')) {
|
|
260
|
-
const responseBody = await response.text();
|
|
261
|
-
let error: any;
|
|
262
|
-
try {
|
|
263
|
-
error = JSON.parse(responseBody);
|
|
264
|
-
} catch {
|
|
265
|
-
error = responseBody;
|
|
266
|
-
}
|
|
267
|
-
log.error('error', { error });
|
|
268
|
-
throw new Error(error.message);
|
|
269
|
-
} else {
|
|
270
|
-
const error = await response.text();
|
|
271
|
-
log.error('error', { error });
|
|
272
|
-
throw new Error(error);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
const getEndpointUrl = (endpoint: EndpointDescriptor) => {
|
|
278
|
-
let url = '';
|
|
279
|
-
if (isV3_1(endpoint.document) && endpoint.document.servers && endpoint.document.servers.length > 0) {
|
|
280
|
-
url = endpoint.document.servers[0].url;
|
|
281
|
-
} else {
|
|
282
|
-
invariant(!isV3_1(endpoint.document));
|
|
283
|
-
url = `${endpoint.document.schemes?.[0] ?? 'https'}://${endpoint.document.host}`;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
if (!isV3_1(endpoint.document) && endpoint.document.basePath) {
|
|
287
|
-
url += endpoint.document.basePath;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
url += endpoint.path;
|
|
291
|
-
|
|
292
|
-
return url;
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
export const resolveAuthorization = async (authorization: ApiAuthorization): Promise<string> => {
|
|
296
|
-
switch (authorization.type) {
|
|
297
|
-
case 'api-key': {
|
|
298
|
-
invariant(authorization.placement.type === 'authorization-header');
|
|
299
|
-
return `Bearer ${authorization.key}`;
|
|
300
|
-
}
|
|
301
|
-
case 'oauth': {
|
|
302
|
-
const response = await fetch(authorization.tokenUrl, {
|
|
303
|
-
method: 'POST',
|
|
304
|
-
headers: {
|
|
305
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
306
|
-
},
|
|
307
|
-
body: `grant_type=${authorization.grantType}&client_id=${authorization.clientId}&client_secret=${authorization.clientSecret}`,
|
|
308
|
-
});
|
|
309
|
-
const data = await response.json();
|
|
310
|
-
return `Bearer ${data.access_token}`;
|
|
311
|
-
}
|
|
312
|
-
default: {
|
|
313
|
-
throw new Error(`Unknown authorization type: ${(authorization as any).type}`);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* Resolves all $ref properties in a JSON schema.
|
|
320
|
-
* Doesn't assume the structure of the schema.
|
|
321
|
-
* The function looks from $ref properties in the schema and resolves them to their values in the base object.
|
|
322
|
-
*/
|
|
323
|
-
const resolveJsonSchema = (schema: any, base: any) => {
|
|
324
|
-
return deepMapValues(schema, (value, recurse) => {
|
|
325
|
-
if (typeof value === 'object' && value !== null && '$ref' in value && typeof value.$ref === 'string') {
|
|
326
|
-
if (value.$ref.startsWith('#')) {
|
|
327
|
-
const resolved = jsonpointer.get(base, value.$ref.slice(1));
|
|
328
|
-
if (resolved) {
|
|
329
|
-
return recurse(resolved);
|
|
330
|
-
} else {
|
|
331
|
-
log.warn('unresolved', { ref: value.$ref, base });
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
return recurse(value);
|
|
336
|
-
});
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
const isV3_1 = (document: OpenAPIV3_1.Document | OpenAPIV2.Document): document is OpenAPIV3_1.Document => {
|
|
340
|
-
return (document as any).openapi === '3.0.1';
|
|
341
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Schema } from 'effect';
|
|
6
|
-
|
|
7
|
-
import { Blueprint } from '@dxos/blueprints';
|
|
8
|
-
import { SpaceSchema } from '@dxos/client/echo';
|
|
9
|
-
import { Sequence } from '@dxos/conductor';
|
|
10
|
-
import { DataType } from '@dxos/schema';
|
|
11
|
-
|
|
12
|
-
import { meta } from '../meta';
|
|
13
|
-
|
|
14
|
-
import { Chat } from './Assistant';
|
|
15
|
-
|
|
16
|
-
export class OnSpaceCreated extends Schema.TaggedClass<OnSpaceCreated>()(`${meta.id}/on-space-created`, {
|
|
17
|
-
input: Schema.Struct({
|
|
18
|
-
space: SpaceSchema,
|
|
19
|
-
rootCollection: DataType.Collection,
|
|
20
|
-
}),
|
|
21
|
-
output: Schema.Void,
|
|
22
|
-
}) {}
|
|
23
|
-
|
|
24
|
-
export class CreateChat extends Schema.TaggedClass<CreateChat>()(`${meta.id}/action/create-chat`, {
|
|
25
|
-
input: Schema.Struct({
|
|
26
|
-
space: SpaceSchema,
|
|
27
|
-
name: Schema.optional(Schema.String),
|
|
28
|
-
}),
|
|
29
|
-
output: Schema.Struct({
|
|
30
|
-
object: Chat,
|
|
31
|
-
}),
|
|
32
|
-
}) {}
|
|
33
|
-
|
|
34
|
-
export const BlueprintForm = Schema.Struct({
|
|
35
|
-
key: Schema.String,
|
|
36
|
-
name: Schema.String,
|
|
37
|
-
description: Schema.optional(Schema.String),
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
export class CreateBlueprint extends Schema.TaggedClass<CreateBlueprint>()(`${meta.id}/action/create-blueprint`, {
|
|
41
|
-
input: BlueprintForm,
|
|
42
|
-
output: Schema.Struct({
|
|
43
|
-
object: Blueprint.Blueprint,
|
|
44
|
-
}),
|
|
45
|
-
}) {}
|
|
46
|
-
|
|
47
|
-
export class CreateSequence extends Schema.TaggedClass<CreateSequence>()(`${meta.id}/action/create-sequence`, {
|
|
48
|
-
input: Schema.Struct({
|
|
49
|
-
name: Schema.optional(Schema.String),
|
|
50
|
-
}),
|
|
51
|
-
output: Schema.Struct({
|
|
52
|
-
object: Sequence,
|
|
53
|
-
}),
|
|
54
|
-
}) {}
|
package/src/typings.d.ts
DELETED
|
File without changes
|
|
File without changes
|