feat(chat): one-click Publish for AI-staged drafts#1501
Merged
Conversation
Closes the magic-moment last mile: the AI authoring assistant stages a complete data model as drafts (ADR-0033 approval gate), but until now the publish step was unreachable from the conversation — a new user was left with drafts that never went live (data API 404s) while the assistant could over-claim success. - mapMessages: lift the draft envelope's packageId into draftReview (the cloud service-ai-studio tools now report it). - ChatbotEnhanced: render a one-click 'Publish' button next to 'Review' when a drafted tool result carries a packageId + onPublishDrafts is wired. The draft-affordance gate is relaxed so Publish shows even when onReviewDraft is absent. - ConsoleFloatingChatbot: wire onPublishDrafts → POST /api/v1/packages/:packageId/publish-drafts (cookie-auth, mirrors PackagesPage), with success/failure toasts + bilingual labels. The human still clicks Publish (ADR-0033 gate preserved) — it's just reachable from the conversation now. Type-clean; verified locally that publish-drafts materializes the objects (data API 404→200). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
xuyushun441-sys
added a commit
that referenced
this pull request
Jun 6, 2026
…#1502) The floating workspace chat got the in-chat Publish CTA in #1501, but the dedicated AiChatPage (/ai) — also a place users build via AI — had no draft affordance, leaving the same dead-end (staged drafts never reachable to publish). Wire onPublishDrafts there with the same publish-drafts call so both chat surfaces close the magic-moment loop. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景(本地 dogfood 实测)
AI 助手能从一句话生成完整数据模型(实测宠物医院:owner/pet/appointment/treatment + 关系),但工具按 ADR-0033 只把对象 stage 成草稿、发布步骤在聊天流里不可达 → 新用户拿到永不生效的草稿(data API 404),AI 还可能越权宣称"已启用 API"。手动
POST /packages/:id/publish-drafts后对象立刻 live(data API 404→200)。改动
packageId(cloud service-ai-studio 现已上报,见 objectstack-ai/cloud#130)提升进draftReview。onPublishDrafts时,在「Review」旁渲染一键「发布」按钮;放宽显隐门槛,使没传 onReviewDraft 时「发布」也显示。onPublishDrafts→POST /api/v1/packages/:packageId/publish-drafts(cookie 鉴权,镜像 PackagesPage),带成功/失败 toast + 中英文案。人仍点一下「发布」(ADR-0033 人工门保留),只是从对话可达了。type-clean。
依赖 / 验证