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

@@ -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}