feat(desktop): drop parked review flow, add publish management

SaaS 侧人工审核后才创建 publish job,desktop 不再做二次审核:移除
manual/waiting_user/parked/from_parked 状态机与 LeaseFromParked 查询,
desktop client 只执行发布并新增"发布管理"页(待发布队列 / 历史 / 再次
发送)。同时抽离 @geo/publisher-platforms 共享适配器包、新增 Redis-based
desktop_presence 与 publish_record_support,刷新 admin-web 发布弹窗与
媒体库;plan A / spec 文档同步口径。
This commit is contained in:
2026-04-20 09:52:48 +08:00
parent b16e9f0bd1
commit a617d39a4a
93 changed files with 5519 additions and 3594 deletions
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { computed, ref } from "vue";
import { computed } from "vue";
import { DesktopOutlined, LinkOutlined, ClockCircleOutlined, AlertOutlined } from "@ant-design/icons-vue";
import MetricCard from "../components/MetricCard.vue";
import StatusBadge from "../components/StatusBadge.vue";
@@ -8,23 +9,52 @@ import { useDesktopRuntime } from "../composables/useDesktopRuntime";
import { formatClock, formatRelativeTime, titleCaseToken } from "../lib/formatters";
import { healthTone, taskTone } from "../lib/runtime-ui";
function translatePlatform(platform: string) {
const map: Record<string, string> = {
toutiaohao: "头条号",
bilibili: "哔哩哔哩",
xiaohongshu: "小红书",
douyin: "抖音",
kuaishou: "快手",
wechat_oa: "微信公众号",
baijiahao: "百家号",
zhihu: "知乎",
};
return map[platform?.toLowerCase()] || titleCaseToken(platform);
}
function translateHealth(status: string) {
const map: Record<string, string> = {
live: "正常",
expired: "已过期",
disconnected: "已断开",
risk_control: "风控中",
needs_captcha: "需验证码",
};
return map[status?.toLowerCase()] || status;
}
function translateEventTitle(title: string) {
const map: Record<string, string> = {
"Accounts Synced": "本地账号同步",
"Heartbeat Healthy": "心跳连接正常",
"Desktop Stream Connected": "单点事件流已连接",
"Desktop Runtime Started": "调度节点已启动",
"Desktop Runtime Armed": "任务消费端已就绪",
};
return map[title] || title;
}
function formatUid(uid: string) {
return (uid || "").replace(/^(?:platform:)+/gi, "");
}
const { snapshot, loading, refresh } = useDesktopRuntime();
const spotlightActionPending = ref(false);
const spotlightActionError = ref<string | null>(null);
const tasks = computed(() => snapshot.value?.tasks ?? []);
const accounts = computed(() => snapshot.value?.accounts ?? []);
const activity = computed(() => snapshot.value?.activity ?? []);
const spotlightTask = computed(() => {
return (
tasks.value.find((item) => item.status === "waiting_user") ??
tasks.value.find((item) => item.status === "in_progress") ??
tasks.value[0] ??
null
);
});
const riskyAccounts = computed(() => accounts.value.filter((item) => item.health !== "live"));
const subsystemCards = computed(() => {
@@ -44,166 +74,56 @@ const subsystemCards = computed(() => {
},
];
});
async function openSpotlightReview() {
if (!spotlightTask.value) {
return;
}
spotlightActionPending.value = true;
spotlightActionError.value = null;
try {
await window.desktopBridge.app.openTaskReview(spotlightTask.value.id);
} catch (error) {
spotlightActionError.value = error instanceof Error ? error.message : "打开审核页失败";
} finally {
spotlightActionPending.value = false;
}
}
async function resolveSpotlightTask(status: "succeeded" | "failed") {
if (!spotlightTask.value) {
return;
}
spotlightActionPending.value = true;
spotlightActionError.value = null;
try {
await window.desktopBridge.app.resolveParkedTask(spotlightTask.value.id, status);
await refresh();
} catch (error) {
spotlightActionError.value = error instanceof Error ? error.message : "回写审核结果失败";
} finally {
spotlightActionPending.value = false;
}
}
</script>
<template>
<section class="page">
<header class="hero">
<div class="hero-copy">
<p class="eyebrow">RUNTIME COCKPIT</p>
<h2>运行控制台</h2>
<p class="hero-summary">
桌面客户端本地调度与运行时指标大盘全局观测实时在线客户端关联账号状态MQ 任务分发健康度及错误拦截告警
</p>
</div>
<SurfaceCard
class="spotlight"
eyebrow="Spotlight Task"
title="当前最需要人工关注的任务"
description="优先把会阻断队列流转的 waiting_user 或 in_progress 任务顶到最前。"
>
<template #action>
<button class="refresh-button" @click="refresh">刷新快照</button>
</template>
<div v-if="spotlightTask" class="spotlight-body">
<div class="spotlight-headline">
<div>
<strong>{{ spotlightTask.title }}</strong>
<p>{{ spotlightTask.summary }}</p>
</div>
<StatusBadge :tone="taskTone(spotlightTask.status)" :label="spotlightTask.status" />
</div>
<dl class="spotlight-grid">
<div>
<dt>Account</dt>
<dd>{{ spotlightTask.accountName }}</dd>
</div>
<div>
<dt>Routing</dt>
<dd>{{ spotlightTask.routing }}</dd>
</div>
<div>
<dt>Lease</dt>
<dd>
{{
spotlightTask.leaseExpiresAt
? `expires ${formatRelativeTime(spotlightTask.leaseExpiresAt)}`
: "released"
}}
</dd>
</div>
<div>
<dt>Updated</dt>
<dd>{{ formatClock(spotlightTask.updatedAt) }}</dd>
</div>
</dl>
<div v-if="spotlightTask.status === 'waiting_user'" class="spotlight-actions">
<button
type="button"
class="spotlight-button secondary"
:disabled="spotlightActionPending"
@click="openSpotlightReview"
>
打开审核页
</button>
<button
type="button"
class="spotlight-button success"
:disabled="spotlightActionPending"
@click="resolveSpotlightTask('succeeded')"
>
标记已发布
</button>
<button
type="button"
class="spotlight-button danger"
:disabled="spotlightActionPending"
@click="resolveSpotlightTask('failed')"
>
标记失败
</button>
</div>
<p v-if="spotlightActionError" class="spotlight-error">{{ spotlightActionError }}</p>
</div>
</SurfaceCard>
</header>
<div class="metric-grid">
<MetricCard
eyebrow="Clients"
eyebrow="在线节点"
:value="snapshot?.summary.onlineClients ?? 0"
label="当前在线 desktop clients"
label="当前处于活跃状态的桌面客户端"
tone="brand"
:icon="DesktopOutlined"
/>
<MetricCard
eyebrow="Accounts"
eyebrow="已绑账号"
:value="snapshot?.summary.accountsBound ?? 0"
label="已经绑定到 workspace 的账号"
label="已授权挂载至本空间的媒体账号"
tone="info"
:icon="LinkOutlined"
/>
<MetricCard
eyebrow="Queue"
eyebrow="排队任务"
:value="snapshot?.summary.queuedTasks ?? 0"
label="仍在等待租约领取的任务"
label="当前积压等待端侧领取的发布任务"
tone="warn"
:icon="ClockCircleOutlined"
/>
<MetricCard
eyebrow="Issues"
eyebrow="异常干预"
:value="snapshot?.summary.issuesOpen ?? 0"
label="待人工介入或 reconcile 的事项"
label="执行失败或需人工排查的阻断事项"
tone="danger"
:icon="AlertOutlined"
/>
</div>
<div class="panel-grid">
<SurfaceCard
eyebrow="Risk Watch"
eyebrow="风险巡检"
title="账号健康看板"
description="把需要修复登录态、验证码或风险确认的账号单独拉出来。"
>
<div v-if="riskyAccounts.length > 0" class="list-stack">
<article v-for="account in riskyAccounts" :key="account.id" class="list-row">
<div>
<div class="list-head-content">
<strong>{{ account.displayName }}</strong>
<p>{{ titleCaseToken(account.platform) }} · {{ account.platformUid }}</p>
<p>{{ translatePlatform(account.platform) }} · {{ formatUid(account.platformUid) }}</p>
</div>
<div class="list-side">
<StatusBadge :tone="healthTone(account.health)" :label="account.health" />
<StatusBadge :tone="healthTone(account.health)" :label="translateHealth(account.health)" />
<small>{{ formatRelativeTime(account.lastSyncAt) }}</small>
</div>
</article>
@@ -212,20 +132,20 @@ async function resolveSpotlightTask(status: "succeeded" | "failed") {
</SurfaceCard>
<SurfaceCard
eyebrow="Event Feed"
eyebrow="事件追踪"
title="最近事件"
description="这里会先承接 MQ 广播和主进程的关键状态变化,后面再接真实 SSE。"
description="系统底层状态流转的历史快照,主要用作诊断上下文。"
>
<div v-if="activity.length > 0" class="timeline">
<article v-for="entry in activity" :key="entry.id" class="timeline-item">
<div class="timeline-marker" :class="entry.severity"></div>
<div class="timeline-copy">
<div class="timeline-head">
<strong>{{ entry.title }}</strong>
<small>{{ formatRelativeTime(entry.at) }}</small>
<article v-for="entry in activity" :key="entry.id" class="feed-card">
<div class="feed-head">
<div class="feed-title">
<span class="feed-dot" :class="entry.severity"></span>
<strong>{{ translateEventTitle(entry.title) }}</strong>
</div>
<p>{{ entry.detail }}</p>
<small>{{ formatRelativeTime(entry.at) }}</small>
</div>
<p>{{ entry.detail }}</p>
</article>
</div>
<p v-else class="empty-text" style="margin-top: 16px;">当前没有最近事件记录</p>
@@ -233,8 +153,8 @@ async function resolveSpotlightTask(status: "succeeded" | "failed") {
</div>
<SurfaceCard
eyebrow="Subsystem Snapshot"
title="核心子系统快照"
eyebrow="核心子系统"
title="引擎状态快照"
description="用于快速确认 transport、lease manager 和 vault 这三段是否处在可工作状态。"
>
<div class="subsystem-grid">
@@ -255,147 +175,6 @@ async function resolveSpotlightTask(status: "succeeded" | "failed") {
gap: 22px;
}
.hero {
display: grid;
grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
gap: 20px;
align-items: stretch;
}
.hero-copy {
padding: 24px;
border-radius: 12px;
border: 1px solid #e6edf5;
background: #ffffff;
}
.eyebrow,
.hero-summary,
h2 {
margin: 0;
}
.eyebrow {
color: var(--geo-color-text-tertiary);
font-size: 11px;
letter-spacing: 0.14em;
text-transform: uppercase;
}
h2 {
margin-top: 8px;
font-size: 24px;
font-weight: 600;
color: #1a1a1a;
line-height: 1.4;
}
.hero-summary {
margin-top: 12px;
max-width: 720px;
color: #8c8c8c;
line-height: 1.6;
font-size: 13px;
}
.spotlight :deep(.description) {
max-width: 420px;
}
.refresh-button {
padding: 10px 14px;
border: 1px solid var(--geo-color-border);
border-radius: 999px;
background: rgba(255, 255, 255, 0.45);
color: var(--geo-color-text-primary);
cursor: pointer;
}
.spotlight-body {
margin-top: 18px;
display: grid;
gap: 18px;
}
.spotlight-headline {
display: flex;
justify-content: space-between;
gap: 16px;
}
.spotlight-headline strong {
display: block;
font-size: 15px;
font-weight: 600;
color: #1a1a1a;
}
.spotlight-headline p {
margin: 4px 0 0;
color: #8c8c8c;
font-size: 12px;
line-height: 1.5;
}
.spotlight-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 14px;
margin: 0;
}
.spotlight-grid dt {
color: #8c8c8c;
font-size: 12px;
}
.spotlight-grid dd {
margin: 4px 0 0;
color: #1a1a1a;
font-weight: 500;
font-size: 13px;
}
.spotlight-actions {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.spotlight-button {
border: 0;
border-radius: 999px;
padding: 10px 14px;
font: inherit;
cursor: pointer;
}
.spotlight-button:disabled {
opacity: 0.55;
cursor: not-allowed;
}
.spotlight-button.secondary {
background: rgba(15, 23, 42, 0.08);
color: var(--geo-color-text-primary);
}
.spotlight-button.success {
background: rgba(5, 150, 105, 0.14);
color: #047857;
}
.spotlight-button.danger {
background: rgba(220, 38, 38, 0.12);
color: #b91c1c;
}
.spotlight-error {
margin: 0;
color: #b91c1c;
}
.metric-grid,
.panel-grid,
.subsystem-grid {
@@ -441,8 +220,9 @@ h2 {
.list-row p {
margin: 6px 0 0;
color: var(--geo-color-text-secondary);
color: #8c8c8c;
line-height: 1.55;
font-size: 13px;
}
.list-side {
@@ -462,46 +242,63 @@ h2 {
color: var(--geo-color-text-secondary);
}
.timeline-item {
display: grid;
grid-template-columns: auto 1fr;
gap: 12px;
.feed-card {
padding: 12px 14px;
border-radius: 8px;
border: 1px solid #e6edf5;
background: #fafafb;
display: flex;
flex-direction: column;
gap: 6px;
}
.timeline-marker {
width: 10px;
height: 10px;
margin-top: 7px;
border-radius: 999px;
background: var(--geo-color-info);
box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.1);
}
.timeline-marker.success {
background: var(--geo-color-success);
box-shadow: 0 0 0 6px rgba(21, 128, 61, 0.1);
}
.timeline-marker.warn {
background: var(--geo-color-warn);
box-shadow: 0 0 0 6px rgba(180, 83, 9, 0.1);
}
.timeline-marker.danger {
background: var(--geo-color-danger);
box-shadow: 0 0 0 6px rgba(185, 28, 28, 0.1);
}
.timeline-head {
.feed-head {
display: flex;
justify-content: space-between;
gap: 12px;
align-items: center;
}
.timeline-copy p {
margin: 6px 0 0;
color: var(--geo-color-text-secondary);
line-height: 1.65;
.feed-title {
display: flex;
align-items: center;
gap: 8px;
}
.feed-dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: #1677ff;
}
.feed-dot.success {
background: #52c41a;
}
.feed-dot.warn {
background: #faad14;
}
.feed-dot.danger {
background: #ff4d4f;
}
.feed-title strong {
font-size: 13px;
font-weight: 600;
color: #1a1a1a;
}
.feed-head small {
font-size: 12px;
color: #8c8c8c;
}
.feed-card p {
margin: 0 0 0 14px;
color: #595959;
font-size: 13px;
line-height: 1.5;
}
.subsystem-grid {
@@ -530,46 +327,21 @@ h2 {
}
html[data-theme="dark"] .list-row,
html[data-theme="dark"] .subsystem-card,
html[data-theme="dark"] .refresh-button {
html[data-theme="dark"] .subsystem-card {
background: rgba(255, 255, 255, 0.03);
}
html[data-theme="dark"] .spotlight-button.secondary {
background: rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] .spotlight-button.success {
color: #6ee7b7;
}
html[data-theme="dark"] .spotlight-button.danger {
color: #fca5a5;
}
@media (max-width: 1240px) {
.hero,
.panel-grid,
.subsystem-grid,
.metric-grid {
grid-template-columns: 1fr;
}
.spotlight-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (max-width: 720px) {
.hero-copy {
padding: 22px;
}
.spotlight-grid {
grid-template-columns: 1fr;
}
.spotlight-headline,
.timeline-head {
flex-direction: column;
}