Skip to content

Commit 053265f

Browse files
feat(mini-app): add "Send to AI" action for CDP-enabled apps
When a mini-app exposes a debug port and the AI agent dock is active, users had no direct way to hand off the CDP endpoint to the AI for browser automation tasks. - Resolves the missing bridge between CDP-enabled instances and the AI dock by injecting a pre-formatted connect prompt - Surfaces and raises the dock automatically so the user does not have to locate it manually
1 parent f09500a commit 053265f

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/MiniAppManager.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
*/
77

88
#include "MiniAppManager.h"
9+
#include "AiAgentDock.h"
910
#include "DockedEditor.h"
11+
#include "MainWindow.h"
1012
#include "MiniAppInstance.h"
1113
#include "MiniAppRegistry.h"
1214
#include "NotepadNextApplication.h"
@@ -143,6 +145,18 @@ void MiniAppManager::launchApp(const MiniAppDefinition &def)
143145
dlg.exec();
144146
});
145147
if (instance->definition().debugPort > 0) {
148+
auto *mainWin = qobject_cast<MainWindow *>(parent());
149+
AiAgentDock *aiDock = mainWin ? mainWin->activeAiDock() : nullptr;
150+
if (aiDock && !instance->cdpHttpUrl().isEmpty()) {
151+
menu.addAction(tr("Send to AI"), this, [instance, aiDock]() {
152+
const QString msg = QStringLiteral(
153+
"Connect to the browser via CDP at %1")
154+
.arg(instance->cdpHttpUrl());
155+
aiDock->insertTextToInput(msg);
156+
aiDock->setVisible(true);
157+
aiDock->raise();
158+
});
159+
}
146160
QAction *cdpAction = menu.addAction(tr("Copy CDP URL"), this, [instance]() {
147161
QApplication::clipboard()->setText(instance->cdpHttpUrl());
148162
});

0 commit comments

Comments
 (0)