Add MindSpace page live edit, chat skills, and H5 deploy tooling.
Introduce page edit sessions with draft preview and patch API, chat skill picker, user memory profile, h5ApiBase resolution, voice WAV transport, and scripts for 105/g2 deployment and Plaza local dev. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { buildMindSpacePageSaveInstructions } from './mindspace-page-patch.mjs';
|
||||
|
||||
const VIEW_LABELS = {
|
||||
home: '空间首页',
|
||||
category: '分类列表',
|
||||
@@ -72,6 +74,10 @@ export function buildMindSpaceChatContext(input) {
|
||||
assets = [],
|
||||
focusedAsset = null,
|
||||
route,
|
||||
agentSessionId = null,
|
||||
h5ApiBase = null,
|
||||
pageEditMode = false,
|
||||
parentAgentSessionId = null,
|
||||
} = input;
|
||||
|
||||
const pageRecord = resolvePageRecord(selectedPageId, pages, pageLive);
|
||||
@@ -87,6 +93,10 @@ export function buildMindSpaceChatContext(input) {
|
||||
view,
|
||||
route,
|
||||
...(ownerUsername ? { ownerUsername } : {}),
|
||||
...(agentSessionId ? { agentSessionId } : {}),
|
||||
...(h5ApiBase ? { h5ApiBase } : {}),
|
||||
...(pageEditMode ? { pageEditMode: true } : {}),
|
||||
...(parentAgentSessionId ? { parentAgentSessionId } : {}),
|
||||
...(category
|
||||
? {
|
||||
category: {
|
||||
@@ -169,11 +179,30 @@ function buildLocationHint(context) {
|
||||
return '用户在 MindSpace 空间首页。指代「我的空间」时指整个个人空间。';
|
||||
}
|
||||
|
||||
export function buildContextPrefix(context) {
|
||||
export function buildPageEditSubAgentInstructions(context) {
|
||||
const pageTitle = context.page?.title ?? '当前页面';
|
||||
const lines = [
|
||||
'【页面编辑子 Agent(硬性)】',
|
||||
`- 你是专注修改页面「${pageTitle}」的子 Agent,用户正在全屏预览中编辑。`,
|
||||
'- 只做页面内容/标题/样式修改,不要跑题,不要 delegate / load_skill / 改其它文件。',
|
||||
'- 每次完成一处修改后必须让预览立刻更新(见下方页面实时修改说明)。',
|
||||
];
|
||||
if (context.parentAgentSessionId) {
|
||||
lines.push(`- 父对话 session:${context.parentAgentSessionId}(退出预览后摘要会合并回父对话记忆)。`);
|
||||
}
|
||||
lines.push('');
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
export function buildContextPrefix(context) {
|
||||
const lines = [];
|
||||
if (context.pageEditMode) {
|
||||
lines.push(...buildPageEditSubAgentInstructions(context).split('\n'));
|
||||
}
|
||||
lines.push(
|
||||
'[MindSpace 上下文]',
|
||||
`- 空间:${context.spaceName}(id: ${context.spaceId})`,
|
||||
];
|
||||
);
|
||||
|
||||
if (context.ownerUsername) {
|
||||
lines.push(`- 账号:${context.ownerUsername}`);
|
||||
@@ -228,6 +257,10 @@ export function buildContextPrefix(context) {
|
||||
lines.push(context.page.contentExcerpt);
|
||||
lines.push('"""');
|
||||
}
|
||||
lines.push(...buildMindSpacePageSaveInstructions(context.page, {
|
||||
sessionId: context.agentSessionId,
|
||||
h5ApiBase: context.h5ApiBase,
|
||||
}));
|
||||
}
|
||||
|
||||
if (context.focusedAsset) {
|
||||
@@ -261,6 +294,11 @@ export function buildContextPrefix(context) {
|
||||
}
|
||||
|
||||
export function formatContextChip(context) {
|
||||
if (context.pageEditMode && context.page) {
|
||||
const version =
|
||||
typeof context.page.versionNo === 'number' ? ` · v${context.page.versionNo}` : '';
|
||||
return `编辑 · ${context.page.title}${version}`;
|
||||
}
|
||||
if (context.page) {
|
||||
const version =
|
||||
typeof context.page.versionNo === 'number' ? ` · v${context.page.versionNo}` : '';
|
||||
|
||||
Reference in New Issue
Block a user