From 57823d892062417613e7ff36c1482613e74b66d5 Mon Sep 17 00:00:00 2001 From: os-zhuang Date: Sat, 27 Jun 2026 04:12:56 +0800 Subject: [PATCH] =?UTF-8?q?feat(console):=20"Edit=20with=20AI"=20=E2=80=94?= =?UTF-8?q?=20open=20the=20build=20agent=20pre-scoped=20to=20an=20app's=20?= =?UTF-8?q?package?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ADR-0070 follow-up (UI half). Adds an "Edit with AI" action to each app in App Management that opens the build agent in a fresh conversation pre-scoped to that app's package: it navigates to `/ai/build?package=&new=1`, and the AI chat page forwards the package as `context.packageId`. The cloud agent seeds it as the conversation's active package, so the AI's metadata reads scope to THIS app and edits bind to it from the first message (no reliance on the model calling set_active_package). Shown only for apps that have a package id. - AppManagementPage: a Sparkles "Edit with AI" button beside "Edit app". - AiChatPage: read `?package=` and forward it as `context.packageId` (threaded into ChatPane, the component that builds the chat request context). Pairs with the cloud seeding mechanism (objectstack-ai/cloud#590). Type-check clean (app-shell + console); app-shell 927 + console 4656 tests pass, 0 regressions. Co-Authored-By: Claude Opus 4.8 --- .../src/pages/system/AppManagementPage.tsx | 18 ++++++++++++++++++ .../app-shell/src/console/ai/AiChatPage.tsx | 13 +++++++++++++ 2 files changed, 31 insertions(+) diff --git a/apps/console/src/pages/system/AppManagementPage.tsx b/apps/console/src/pages/system/AppManagementPage.tsx index bef5868b3..92205e8f9 100644 --- a/apps/console/src/pages/system/AppManagementPage.tsx +++ b/apps/console/src/pages/system/AppManagementPage.tsx @@ -25,6 +25,7 @@ import { Star, ExternalLink, Search, + Sparkles, } from 'lucide-react'; import { toast } from 'sonner'; import { useMetadata } from '@object-ui/app-shell'; @@ -241,6 +242,23 @@ export function AppManagementPage() { > + {app._packageId ? ( + + ) : null}