merge: integrate remote project scaffold updates

This commit is contained in:
inman
2026-09-05 12:42:00 +08:00
60 changed files with 2909 additions and 141 deletions

View File

@@ -166,7 +166,7 @@ export function Sidebar({ workspaceLayout = false, sidebarPeekOpen = false, onSi
const [newProjectName, setNewProjectName] = useState('');
const [newProjectSelectedPath, setNewProjectSelectedPath] = useState('');
const [newProjectDirectoryMode, setNewProjectDirectoryMode] = useState<ProjectDirectoryMode>('use-selected-directory');
const [newProjectType, setNewProjectType] = useState<ProjectType>('mini_game');
const [newProjectType, setNewProjectType] = useState<ProjectType>('interactive_ai_app');
const [newProjectIdentityKind, setNewProjectIdentityKind] = useState<ProjectIdentityKind>('create');
const [newProjectIdentityProjectId, setNewProjectIdentityProjectId] = useState('');
const [createProjectError, setCreateProjectError] = useState<string | null>(null);
@@ -397,7 +397,7 @@ export function Sidebar({ workspaceLayout = false, sidebarPeekOpen = false, onSi
setNewProjectName('');
setNewProjectSelectedPath('');
setNewProjectDirectoryMode('use-selected-directory');
setNewProjectType('mini_game');
setNewProjectType('interactive_ai_app');
setNewProjectIdentityKind('create');
setNewProjectIdentityProjectId('');
setCreateProjectError(null);
@@ -407,7 +407,7 @@ export function Sidebar({ workspaceLayout = false, sidebarPeekOpen = false, onSi
const closeCreateProject = () => {
if (creatingProject) return;
setCreateDialogOpen(false);
setNewProjectType('mini_game');
setNewProjectType('interactive_ai_app');
setNewProjectIdentityKind('create');
setNewProjectIdentityProjectId('');
setCreateProjectError(null);
@@ -852,10 +852,9 @@ export function Sidebar({ workspaceLayout = false, sidebarPeekOpen = false, onSi
<fieldset className="space-y-2">
<legend className="text-xs font-semibold"></legend>
<div className="grid gap-2 sm:grid-cols-3">
<div className="grid gap-2 sm:grid-cols-2">
{([
['mini_game', '小游戏', '适合实时互动、Canvas 和关卡玩法;创建后可直接提交审核。'],
['mini_program', '小程序', '适合页面、表单和轻量工具;创建后可直接提交审核。'],
['interactive_ai_app', '交互式 AI 应用', '创建可交互、可发布的 AI 应用项目;进入对话后可用项目初始化 Skill 生成工程骨架。'],
['custom', '自定义项目', '只创建项目空间,不配置默认发布方式。'],
] as const).map(([value, title, description]) => (
<label

View File

@@ -521,7 +521,7 @@ export function ProjectPublishAction({ project, projectType, buttonVariant = 'de
</div>
<p className="rounded-xl bg-muted/50 px-3 py-2 text-xs text-muted-foreground">
{projectType}
AI
</p>
</>}

View File

@@ -93,7 +93,7 @@ const PUBLISH_FAILURES: Record<string, WorksPublishFailure> = {
PROJECT_TYPE_UNPUBLISHABLE: {
title: '这个项目没有配置发布方式',
reason: '自定义项目只创建工作空间,不会自动生成平台发布模板。',
nextStep: '如需一键提交,请新建小游戏或小程序项目。',
nextStep: '如需一键提交,请新建交互式 AI 应用项目。',
},
PROJECT_FILE_INVALID: {
title: '项目配置无法读取',

View File

@@ -12,7 +12,11 @@ import {
DialogTitle,
} from '@/components/ui/dialog';
import type { DataServiceInstanceState } from '../../../shared/data-service';
import type { PluginWorkspaceCommand, PluginWorkspaceItem } from './plugin-workspace-model';
import {
isBundledOfficialPlugin,
type PluginWorkspaceCommand,
type PluginWorkspaceItem,
} from './plugin-workspace-model';
interface DetailOperation {
capabilityId: string;
@@ -286,7 +290,7 @@ export function PluginDetails(props: PluginDetailsProps) {
<dd className="mt-1 text-sm font-semibold">
{props.item.source === 'local'
? (props.item.localEnabled ? '本机全局已启用' : '本机全局已停用')
: installation?.version ? `官方包 ${installation.version}` : props.item.delivery === 'system_included' ? '随应用提供' : '未下载官方包'}
: installation?.version ? `官方包 ${installation.version}` : isBundledOfficialPlugin(props.item) ? '随应用提供' : '未下载官方包'}
</dd>
</div>
<div className="rounded-xl bg-surface-subtle p-3">
@@ -368,7 +372,14 @@ export function PluginDetails(props: PluginDetailsProps) {
<div className="mt-3 rounded-xl bg-surface-subtle p-4 text-sm">
<p>{props.item.local.kind === 'skill-only' ? 'Skill' : props.item.local.kind === 'pi-extension' ? 'Pi extension' : 'Skill + Pi extension'}</p>
<p className="mt-1 text-muted-foreground">{props.item.local.skillEntries.length} Skill · {props.item.local.extensionEntries.length} extension</p>
{props.item.local.confirmedExecutableCode ? <p className="mt-3 flex gap-2 text-warning"><AlertTriangle className="h-4 w-4 shrink-0" /> Pi extension</p> : null}
{props.item.local.confirmedExecutableCode ? (
<p className="mt-3 flex gap-2 text-warning">
<AlertTriangle className="h-4 w-4 shrink-0" />
{props.item.local.kind === 'skill-only'
? '包含可执行 Skill 脚本;调用时可能使用当前桌面用户可用的文件、网络和进程权限。'
: '包含可执行代码,运行时拥有完整桌面权限。'}
</p>
) : null}
</div>
) : <p className="mt-2 text-sm text-muted-foreground"></p>}
{detail?.permissions.length ? (

View File

@@ -21,7 +21,7 @@ import type {
PluginWorkspaceProjection,
PluginWorkspaceState,
} from './plugin-workspace-model';
import { buildPluginWorkspaceProjection } from './plugin-workspace-model';
import { buildPluginWorkspaceProjection, isBundledOfficialPlugin } from './plugin-workspace-model';
import { resolvePluginWorkspaceSearch, serializePluginWorkspaceSearch } from './plugin-workspace-query';
const DELIVERY_TEXT = {
@@ -111,7 +111,7 @@ function PluginCard({
<p className="mt-2 line-clamp-3 text-pretty text-sm leading-6 text-muted-foreground">{item.summary}</p>
<dl className="mt-4 space-y-2 text-sm">
<div className="flex justify-between gap-4"><dt className="text-muted-foreground"></dt><dd className="text-right font-medium">{PROJECT_TEXT[item.projectState]}</dd></div>
<div className="flex justify-between gap-4"><dt className="text-muted-foreground"></dt><dd className="text-right font-medium">{item.source === 'local' ? (item.localEnabled ? '本机全局已启用' : '本机全局已停用') : item.official?.installation?.version ? `官方包 ${item.official.installation.version}` : item.delivery === 'system_included' ? '随应用提供' : '未下载官方包'}</dd></div>
<div className="flex justify-between gap-4"><dt className="text-muted-foreground"></dt><dd className="text-right font-medium">{item.source === 'local' ? (item.localEnabled ? '本机全局已启用' : '本机全局已停用') : item.official?.installation?.version ? `官方包 ${item.official.installation.version}` : isBundledOfficialPlugin(item) ? '随应用提供' : '未下载官方包'}</dd></div>
<div className="flex justify-between gap-4"><dt className="text-muted-foreground"></dt><dd className="text-right font-medium">{agentText(item)}</dd></div>
<div className="flex justify-between gap-4"><dt className="text-muted-foreground"></dt><dd className="text-right font-medium">{BILLING_TEXT[item.billing]}</dd></div>
</dl>

View File

@@ -104,6 +104,11 @@ export interface PluginWorkspaceItem {
local: DevicePackageRecordV1 | null;
}
export function isBundledOfficialPlugin(item: PluginWorkspaceItem): boolean {
return item.source === 'official'
&& (item.delivery === 'system_included' || isCodeOwnedOptionalBundledPluginId(item.pluginId));
}
export type PluginWorkspaceNotice =
| { kind: 'scope_fallback'; message: string }
| { kind: 'source_unavailable'; source: 'catalog' | 'library' | 'device' | 'project'; message: string }

View File

@@ -460,7 +460,7 @@ export function ProjectConfiguration() {
<div data-testid="project-configuration-actions" className="glass-surface config-motion-actions sticky bottom-3 z-10 mt-auto flex shrink-0 flex-col gap-2 rounded-2xl border border-border/70 bg-background/85 p-2 shadow-float sm:flex-row sm:items-start sm:justify-between">
<Button type="button" variant="outline" size="sm" onClick={() => setDeleteDialogOpen(true)} className="h-9 w-full border-brand/25 bg-background px-3 font-semibold text-foreground shadow-none hover:border-brand/40 hover:bg-brand-soft sm:w-auto"><Trash2 className="mr-2 h-4 w-4" />删除项目</Button>
<div data-testid="project-configuration-primary-actions" className="flex w-full flex-col gap-2 sm:ml-auto sm:w-auto sm:flex-row sm:items-start sm:justify-end">
{draft.projectType === 'mini_game' || draft.projectType === 'mini_program' ? (
{draft.projectType === 'interactive_ai_app' ? (
<ProjectPublishAction
key={activeProject.id}
project={activeProject}