forked from ChaiHao/BPOS-MVP
三面拆分⑬:触发确认链路 + 运营中心「工作流」区 —— 设计只管设计,运营管细节
**触发确认链路**(用户口述五步的第 4/5 步):
接收邮件 → 分类识别 → 命中 RFQ 事件 → ④(可选,运营勾)系统消息到指定人
工作台(带邮件内容)→ ⑤ 工作台点「确认起单」,流程才起。
· 命中不等于必起:勾了「需人工确认」,装配好的入参存成待确认单
(sys.trigger_pending,migration 0019),ConfirmDesk 端口把带来件内容的
系统消息送指定人(eventRef 挂票号,消息列表就地贴确认状态与那枚钮)。
· 先认领后起单:consumed_at 空才认得到 —— 两人同时点、一人点两次,都只起一条流;
起单失败退回认领,不留死票。确认人记进 source.by,留痕可查。
· 登记触发不走确认(登记那一下本身就是人在确认);勾了没指定人 = 配置错误入死信。
· 4 条单测 + 全链实测:投信 → triggersHit=1 且零直起 → AI 工作台收到确认消息
→ 确认起单 → 二次确认幂等回同一流号 → source.by = AI。
**运营中心重排**(区名即运行时:工作流是流程包的运行时,任务是活动的运行时):
· 新「工作流」区:在途看板(从任务区迁入)+ 运行配置 —— 每包的触发器
起单开关 / 确认打勾 / 确认人,和节点负责人(sys.node_owner)。
· 负责人三层:显式指派 > 运营配置 > 轮值 —— 合并点在 process.start,
复用既有派发链一行不改。
· 任务区瘦身成活动运行时(任务/审批/需处置);知识库区改名「数据」
(与设计中心的知识库解开同名);系统区只剩通道实例。
· 设计中心触发器详情页摘掉启停按钮 —— 设计只管设计,启停/确认全在运营。
· 旧深链有改嫁:tasks/board → runs/board,tasks/trg → runs/conf。
reset-runs 补 sys.trigger_pending(待确认单是运行痕 —— 和上回漏 trace_span 同类洞)。
邮件分类 Agent(第 ② 步)现由抽键正则 + S-FEEL 代位,升级路径记进 debt.md。
产品设计.md 运营章、trigger/process 两份 CONTRACT.md 同步。
五闸绿;契约快照随本提交入库。
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
This commit is contained in:
@@ -25,6 +25,7 @@ import { domainShort, sortDomains } from '@web-shared/gov/domains.ts';
|
||||
import { queryKeys } from './query.ts';
|
||||
import { BlueprintHome } from '@features/gov-blueprint';
|
||||
import { TasksHome, TaskLogPage, TaskPage, WfPage } from '@features/gov-task';
|
||||
import { RunsHome } from '@features/gov-runs';
|
||||
import { EmpPage, PeopleHome, RolePage } from '@features/gov-staff';
|
||||
import { PkgPage, WorkflowsHome } from '@features/gov-process';
|
||||
import { TriggerPage, TriggerRulesHome } from '@features/gov-trigger';
|
||||
@@ -293,6 +294,7 @@ function ZoneHome({ zone, tab, nav }: { zone: GovZone; tab: string; nav: Nav })
|
||||
testbed: TestbedHome,
|
||||
// 运营中心
|
||||
cockpit: CockpitHome,
|
||||
runs: RunsHome,
|
||||
tasks: TasksHome,
|
||||
people: PeopleHome,
|
||||
ledgers: LedgersHome,
|
||||
|
||||
@@ -665,6 +665,21 @@
|
||||
.g-maprow > .g-btn { grid-column: 6; justify-self: stretch; padding: 4px 0; display: inline-flex; align-items: center; justify-content: center; }
|
||||
.g-maparr { color: var(--sh-steel, #46586a); font-weight: 700; text-align: center; }
|
||||
|
||||
/* ── 运营中心 · 工作流 · 运行配置:一包一卡,里面两节(触发器 / 节点负责人)── */
|
||||
.g-runconf { display: flex; flex-direction: column; gap: 4px; padding: 10px 14px 12px; }
|
||||
.g-runconf + .g-runconf { border-top: 1px dashed var(--line-soft); }
|
||||
.g-runconf-h { display: flex; align-items: center; gap: 7px; padding-bottom: 6px; font: 600 9.5px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
|
||||
.g-runconf-none { margin: 0; font-size: 11.5px; line-height: 1.8; color: var(--ink-3); }
|
||||
.g-runconf-r { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 7px 0; border-bottom: 1px dashed var(--line-soft); }
|
||||
.g-runconf-r:last-child { border-bottom: 0; }
|
||||
.g-runconf-k { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); cursor: pointer; user-select: none; }
|
||||
.g-runconf-k input { accent-color: var(--brand); width: 14px; height: 14px; cursor: pointer; }
|
||||
.g-runconf-r .g-select { width: 180px; }
|
||||
.g-runconf-own { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 4px 24px; }
|
||||
.g-runconf-node { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto minmax(140px, 170px); align-items: center; gap: 9px; padding: 5px 0; }
|
||||
.g-runconf-node .nid { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--ink); }
|
||||
.g-runconf-node .lb { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--ink-2); }
|
||||
|
||||
/* ═══════════ 测试台 · 仿真试跑(2026-07-30 重制)═══════════
|
||||
概念:**浅色桌面上的一台仪器**。整台机器是页面里唯一的暗色区 —— 有边、有圆角、
|
||||
有台面,不是把纸刷黑。机器说 mono(读数、灯、编号、TRACE),
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
import { useState } from 'react';
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import type { FormField, ListMessagesOutput, SystemMessageView } from '@contracts';
|
||||
import { answerMessageRoute, listMessagesRoute, markMessageReadRoute } from '@contracts';
|
||||
import { answerMessageRoute, confirmTriggerPendingRoute, listMessagesRoute, markMessageReadRoute } from '@contracts';
|
||||
import { Ico } from '@web-shared/Ico.tsx';
|
||||
import ScrollArea from '@web-shared/ScrollArea.tsx';
|
||||
import { call } from '@web-shared/typed-fetch.ts';
|
||||
@@ -63,7 +63,7 @@ export function MessageDesk() {
|
||||
<ScrollArea className="jc-sa--fill" vpClassName="task-list">
|
||||
{visible.map((m) => {
|
||||
const meta = metaOf(m.kind);
|
||||
const pending = m.card !== undefined && !m.card.answered;
|
||||
const pending = (m.card !== undefined && !m.card.answered) || (m.confirm !== undefined && !m.confirm.consumed);
|
||||
return (
|
||||
<button
|
||||
key={m.id}
|
||||
@@ -77,7 +77,7 @@ export function MessageDesk() {
|
||||
<span className="jc-mcard-top">
|
||||
<em>{meta.kicker}</em>
|
||||
{pending ? (
|
||||
<Chip tone="todo" label="待作答" pulse />
|
||||
<Chip tone="todo" label={m.confirm !== undefined ? '待确认' : '待作答'} pulse />
|
||||
) : (
|
||||
<Chip tone={m.read ? 'done' : 'brand'} label={m.read ? '已读' : '未读'} pulse={!m.read} />
|
||||
)}
|
||||
@@ -122,6 +122,12 @@ export function MessageDesk() {
|
||||
<div className="jc-summary">{sel.body}</div>
|
||||
</Section>
|
||||
|
||||
{sel.confirm !== undefined && (
|
||||
<Section icon="zap" title="确认起单" extra="触发器命中,按运营配置须你点头才起单">
|
||||
<ConfirmFire confirm={sel.confirm} />
|
||||
</Section>
|
||||
)}
|
||||
|
||||
{sel.card !== undefined && (
|
||||
<Section icon="messages-square" title="就地作答" extra={`来源任务 ${sel.card.sourceTaskId.slice(0, 8)}`}>
|
||||
{sel.card.rejectedReason !== undefined && (
|
||||
@@ -228,3 +234,37 @@ function ElicitationForm({
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认起单(触发确认链路第 5 步)—— 点一下,那条流才真的起。
|
||||
* 幂等:已被确认过服务端回同一条流的号,这里如实显示,绝不催人再点。
|
||||
*/
|
||||
function ConfirmFire({ confirm }: { confirm: NonNullable<SystemMessageView['confirm']> }) {
|
||||
const queryClient = useQueryClient();
|
||||
const fire = useMutation({
|
||||
mutationFn: () => call<{ workflowId: string; alreadyStarted: boolean }>(confirmTriggerPendingRoute, { params: { id: confirm.pendingId } }),
|
||||
onSuccess: () => {
|
||||
void queryClient.invalidateQueries({ queryKey: ['desk'] });
|
||||
},
|
||||
});
|
||||
const done = confirm.consumed || fire.isSuccess;
|
||||
const wfId = fire.data?.workflowId ?? confirm.workflowId;
|
||||
if (done) {
|
||||
return (
|
||||
<div className="jc-mod-donehint">
|
||||
<Ico name="circle-check" s={15} />
|
||||
已确认起单{wfId === undefined ? '' : ` · 工作流 ${wfId.slice(0, 8)}`} —— 任务会按负责人配置落到各工作台
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<NoteBand>这封来件命中了触发器,但运营配置要求人工确认 —— 你点了,流程才起;不点,它就停在这儿。</NoteBand>
|
||||
<button className="jc-btn primary" disabled={fire.isPending} onClick={() => fire.mutate()}>
|
||||
<Ico name="play" s={13} />
|
||||
{fire.isPending ? '起单中…' : '确认起单'}
|
||||
</button>
|
||||
{fire.isError && <NoteBand>没起成:{(fire.error as { message?: string }).message ?? '未知原因'}</NoteBand>}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* feature `gov-runs` —— 运营中心 · 工作流:**流程包的运行时**。
|
||||
* 在途实例的监控,和每个包的运行配置(起单开关 / 人工确认 / 节点负责人)。
|
||||
*/
|
||||
export { RunsHome } from './internal/panel.tsx';
|
||||
@@ -0,0 +1,211 @@
|
||||
/**
|
||||
* 运营中心 · 工作流 —— **流程包的运行时**(设计中心只负责设计,运营中心管细节)。
|
||||
*
|
||||
* 两页签:
|
||||
* · 在途:工作流看板(从任务区迁入 —— 工作流一级归这儿,任务区只留活动一级);
|
||||
* · 运行配置:每个包**今天怎么跑**的细节,设计一个字不碰 ——
|
||||
* 触发器:起单开关 / 命中后要不要人工确认 / 谁来确认(触发确认链路第 4 步的配置面)
|
||||
* 节点负责人:流程包的哪个节点归谁 —— 显式指派 > 这里 > 轮值
|
||||
*/
|
||||
import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
|
||||
import type { TriggerConfig } from '@contracts';
|
||||
import {
|
||||
listNodeOwnersRoute,
|
||||
setNodeOwnerRoute,
|
||||
setTriggerConfirmRoute,
|
||||
toggleTriggerRoute,
|
||||
} from '@contracts';
|
||||
import { call } from '@web-shared/typed-fetch.ts';
|
||||
import { Ico } from '@web-shared/Ico.tsx';
|
||||
import { Card, Chip, Clear, QueryGate, St } from '@web-shared/gov/primitives.tsx';
|
||||
import type { Nav } from '@web-shared/gov/gov-route.ts';
|
||||
import { useGovPackages, useGovStaff, useGovTriggers } from '@web-shared/gov/gov-api.ts';
|
||||
import { WorkflowBoard } from '@features/gov-task';
|
||||
|
||||
export function RunsHome({ tab, nav }: { tab: string; nav: Nav }) {
|
||||
if (tab === 'conf') return <RunConfig />;
|
||||
return <WorkflowBoard nav={nav} />;
|
||||
}
|
||||
|
||||
/** 治理写动作统一入口:成功即失效相关查询,画面由服务端重投影 */
|
||||
function useGovAction<TInput>(mutate: (input: TInput) => Promise<unknown>, keys: readonly string[]) {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: mutate,
|
||||
onSuccess: () => {
|
||||
for (const key of keys) void queryClient.invalidateQueries({ queryKey: ['gov', key] });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/* ==================== 运行配置:一包一节 ==================== */
|
||||
|
||||
function RunConfig() {
|
||||
const pkgQ = useGovPackages();
|
||||
const trgQ = useGovTriggers();
|
||||
const staffQ = useGovStaff();
|
||||
const packages = (pkgQ.data?.packages ?? []).filter((p) => p.state === 'active');
|
||||
const triggers = trgQ.data?.triggers ?? [];
|
||||
const staff = (staffQ.data?.staff ?? []).filter((s) => s.state === 'active');
|
||||
|
||||
return (
|
||||
<QueryGate query={pkgQ}>
|
||||
{packages.length === 0 ? (
|
||||
<Clear>没有生效的流程包 —— 设计中心激活一版,这里就有它的运行配置。</Clear>
|
||||
) : (
|
||||
<>
|
||||
{packages.map((p) => (
|
||||
<PackageConfig
|
||||
key={p.id}
|
||||
packageId={p.id}
|
||||
name={p.name}
|
||||
nodes={p.nodes
|
||||
.filter((n) => n.kind === 'activity' || n.kind === 'approval')
|
||||
.map((n) => ({ id: n.id, label: n.label, kind: n.kind }))}
|
||||
triggers={triggers.filter((t) => t.processPackageId === p.id)}
|
||||
staff={staff.map((s) => ({ id: s.id, name: s.name, code: s.position.code }))}
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</QueryGate>
|
||||
);
|
||||
}
|
||||
|
||||
type StaffOpt = { id: string; name: string; code: string };
|
||||
|
||||
function PackageConfig({
|
||||
packageId,
|
||||
name,
|
||||
nodes,
|
||||
triggers,
|
||||
staff,
|
||||
}: {
|
||||
packageId: string;
|
||||
name: string;
|
||||
nodes: ReadonlyArray<{ id: string; label: string; kind: string }>;
|
||||
triggers: readonly TriggerConfig[];
|
||||
staff: readonly StaffOpt[];
|
||||
}) {
|
||||
const ownersQ = useQuery({
|
||||
queryKey: ['gov', 'node-owners', packageId],
|
||||
queryFn: () => call<{ owners: Array<{ nodeId: string; staffId: string }> }>(listNodeOwnersRoute, { params: { id: packageId } }),
|
||||
});
|
||||
const owners = new Map((ownersQ.data?.owners ?? []).map((o) => [o.nodeId, o.staffId]));
|
||||
|
||||
const toggle = useGovAction(
|
||||
(input: { id: string; enabled: boolean }) =>
|
||||
call(toggleTriggerRoute, { params: { id: input.id }, body: { enabled: input.enabled } }),
|
||||
['triggers'],
|
||||
);
|
||||
const confirm = useGovAction(
|
||||
(input: { id: string; required: boolean; staffId?: string }) =>
|
||||
call(setTriggerConfirmRoute, {
|
||||
params: { id: input.id },
|
||||
body: { required: input.required, ...(input.staffId === undefined ? {} : { staffId: input.staffId }) },
|
||||
}),
|
||||
['triggers'],
|
||||
);
|
||||
const setOwner = useGovAction(
|
||||
(input: { nodeId: string; staffId: string | null }) =>
|
||||
call(setNodeOwnerRoute, { params: { id: packageId, nodeId: input.nodeId }, body: { staffId: input.staffId } }),
|
||||
['node-owners'],
|
||||
);
|
||||
|
||||
return (
|
||||
<Card ico="workflow" title={name} extra={<span className="g-mono">{packageId}</span>}>
|
||||
{/* ── 触发器的运营面:开不开 · 要不要人点头 · 谁点头 —— 规则本身在设计中心改 ── */}
|
||||
<div className="g-runconf">
|
||||
<div className="g-runconf-h">
|
||||
<Ico name="zap" s={11} />
|
||||
触发器 —— 起单开关与人工确认
|
||||
</div>
|
||||
{triggers.length === 0 ? (
|
||||
<p className="g-runconf-none">这个包还没有调起规则 —— 去设计中心 · 触发器配一条。</p>
|
||||
) : (
|
||||
triggers.map((t) => {
|
||||
const confirmed = t.confirm.required;
|
||||
return (
|
||||
<div key={t.id} className="g-runconf-r">
|
||||
<St tone={t.enabled ? 'ok' : 'mute'} ico="zap">
|
||||
{t.name}
|
||||
</St>
|
||||
<label className="g-runconf-k">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={t.enabled}
|
||||
onChange={(e) => toggle.mutate({ id: t.id, enabled: e.target.checked })}
|
||||
/>
|
||||
起单
|
||||
</label>
|
||||
<label className="g-runconf-k" title="勾了:命中后先发系统消息到指定人工作台,他点「确认起单」流程才起">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={confirmed}
|
||||
onChange={(e) =>
|
||||
confirm.mutate({
|
||||
id: t.id,
|
||||
required: e.target.checked,
|
||||
// 勾上时没选过人就先落到第一位 —— 服务端要求勾必有人,界面不递交半份配置
|
||||
...(e.target.checked && (t.confirm.staffId ?? staff[0]?.id) !== undefined
|
||||
? { staffId: t.confirm.staffId ?? staff[0]!.id }
|
||||
: {}),
|
||||
})
|
||||
}
|
||||
/>
|
||||
命中后须人工确认
|
||||
</label>
|
||||
<select
|
||||
className="g-select"
|
||||
aria-label={`${t.name} 的确认人`}
|
||||
disabled={!confirmed}
|
||||
value={t.confirm.staffId ?? ''}
|
||||
onChange={(e) => confirm.mutate({ id: t.id, required: true, staffId: e.target.value })}
|
||||
>
|
||||
<option value="" disabled>
|
||||
确认人…
|
||||
</option>
|
||||
{staff.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{s.name} · {s.code}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{confirmed && t.confirm.staffId === undefined && <Chip tone="warn">还没指定确认人</Chip>}
|
||||
</div>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* ── 节点负责人:显式指派 > 这里 > 轮值 ── */}
|
||||
<div className="g-runconf">
|
||||
<div className="g-runconf-h">
|
||||
<Ico name="user-check" s={11} />
|
||||
节点负责人 —— 留空即轮值(有员工组按组轮,没有按全员最闲者先)
|
||||
</div>
|
||||
<div className="g-runconf-own">
|
||||
{nodes.map((n) => (
|
||||
<label key={n.id} className="g-runconf-node">
|
||||
<span className="nid">{n.id}</span>
|
||||
<span className="lb">{n.label}</span>
|
||||
{n.kind === 'approval' && <Chip tone="warn">审批</Chip>}
|
||||
<select
|
||||
className="g-select"
|
||||
value={owners.get(n.id) ?? ''}
|
||||
onChange={(e) => setOwner.mutate({ nodeId: n.id, staffId: e.target.value === '' ? null : e.target.value })}
|
||||
>
|
||||
<option value="">轮值</option>
|
||||
{staff.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{s.name} · {s.code}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -2,4 +2,4 @@
|
||||
* feature `gov-task` 唯一出口(编码规范 §9.1)。
|
||||
* 任务管理:在途监控、控制事件(暂停/叫停/终止)、恢复、改派、任务日志查看
|
||||
*/
|
||||
export { TasksHome, WfPage, TaskPage, TaskLogPage } from './internal/panel.tsx';
|
||||
export { TasksHome, WfPage, TaskPage, TaskLogPage, WorkflowBoard } from './internal/panel.tsx';
|
||||
|
||||
@@ -23,7 +23,6 @@ import { Ava, Card, Chip, Clear, Entry, Facts, Kpi, NList, NRow, Note, PageHead,
|
||||
import type { ActSpec } from '@web-shared/gov/primitives.tsx';
|
||||
import { APR_ST, PARA, RUNTIME_ST, TERMINAL_ST, WF_ST } from '@web-shared/gov/tone.ts';
|
||||
import type { Nav } from '@web-shared/gov/gov-route.ts';
|
||||
import { TriggerOpsTab } from '@features/gov-trigger';
|
||||
import { FlowFigure } from '@web-shared/gov/flow/FlowFigure.tsx';
|
||||
import {
|
||||
useGovApprovals,
|
||||
@@ -36,14 +35,15 @@ import {
|
||||
export type HomeProps = { tab: string; nav: Nav };
|
||||
|
||||
export function TasksHome({ tab, nav }: HomeProps) {
|
||||
// 起单开关 = 触发器的**处置面**:今天开不开是当班主管的事,规则怎么写在设计中心改
|
||||
if (tab === 'trg') return <TriggerOpsTab nav={nav} />;
|
||||
return <RuntimeHome tab={tab} nav={nav} />;
|
||||
}
|
||||
|
||||
function RuntimeHome({ tab, nav }: HomeProps) {
|
||||
/**
|
||||
* 在途工作流看板 —— **工作流是流程包的运行时**,一级看板归「运营中心 · 工作流」区;
|
||||
* 任务区(活动的运行时)不再摆它。
|
||||
*/
|
||||
export function WorkflowBoard({ nav }: { nav: Nav }) {
|
||||
const q = useGovTasks();
|
||||
const approvals = useGovApprovals();
|
||||
const tasks = q.data?.tasks ?? [];
|
||||
const workflows = q.data?.workflows ?? [];
|
||||
|
||||
@@ -55,7 +55,6 @@ function RuntimeHome({ tab, nav }: HomeProps) {
|
||||
return stuck ? { name: stuck.ownerName, label: '最后经手 · 待处置' } : undefined;
|
||||
};
|
||||
|
||||
if (tab === 'board') {
|
||||
const lanes = [
|
||||
{ k: 'running', tone: 'brand' },
|
||||
{ k: 'waiting', tone: 'warn' },
|
||||
@@ -122,8 +121,14 @@ function RuntimeHome({ tab, nav }: HomeProps) {
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function RuntimeHome({ tab, nav }: HomeProps) {
|
||||
const q = useGovTasks();
|
||||
const approvals = useGovApprovals();
|
||||
const tasks = q.data?.tasks ?? [];
|
||||
const workflows = q.data?.workflows ?? [];
|
||||
|
||||
if (tab === 'apr') {
|
||||
const rows = approvals.data?.approvals ?? [];
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
* feature `gov-trigger` 唯一出口(编码规范 §9.1)。
|
||||
* 触发器的两副面孔:规则定义在设计中心(流程包 - 调起规则),启停在运营中心(任务 - 起单开关)。
|
||||
*/
|
||||
export { TriggerOpsTab, TriggerPage, TriggerRulesHome } from './internal/panel.tsx';
|
||||
export { TriggerPage, TriggerRulesHome } from './internal/panel.tsx';
|
||||
|
||||
@@ -17,7 +17,6 @@ import type { TriggerConfig } from '@contracts';
|
||||
import {
|
||||
TRIGGER_KIND_LABEL,
|
||||
processPackageIdSchema,
|
||||
toggleTriggerRoute,
|
||||
triggerKindOf,
|
||||
upsertTriggerRoute,
|
||||
} from '@contracts';
|
||||
@@ -29,8 +28,6 @@ import {
|
||||
Clear,
|
||||
Field,
|
||||
ListEdit,
|
||||
NList,
|
||||
NRow,
|
||||
Note,
|
||||
PageHead,
|
||||
Prop,
|
||||
@@ -394,62 +391,9 @@ function TriggerForm({
|
||||
|
||||
/* ==================== 运营侧:起单开关(处置面) ==================== */
|
||||
|
||||
export function TriggerOpsTab({ nav }: { nav: Nav }) {
|
||||
const q = useGovTriggers();
|
||||
const triggers = q.data?.triggers ?? [];
|
||||
const toggle = useGovAction(
|
||||
(input: { id: string; enabled: boolean }) =>
|
||||
call(toggleTriggerRoute, { params: { id: input.id }, body: { enabled: input.enabled } }),
|
||||
['triggers'],
|
||||
);
|
||||
|
||||
return (
|
||||
<QueryGate query={q}>
|
||||
<>
|
||||
<Note>
|
||||
开关管的是<b>今天起不起单</b>,不是规则本身。停用后此后不再起新单,<b>已起的照常跑完</b>;
|
||||
规则怎么写在设计中心 · 流程包 - 调起规则里改。
|
||||
</Note>
|
||||
{triggers.length === 0 ? (
|
||||
<Clear>还没有调起规则 —— 设计中心配好之后,开关会出现在这里。</Clear>
|
||||
) : (
|
||||
<NList>
|
||||
{triggers.map((t) => (
|
||||
<NRow
|
||||
key={t.id}
|
||||
tone={t.enabled ? 'brand' : 'mute'}
|
||||
ico="zap"
|
||||
title={t.name}
|
||||
sub={ruleText(t)}
|
||||
cols={[
|
||||
{ k: '类别', v: <Chip tone="brand">{TRIGGER_KIND_LABEL[triggerKindOf(t.spec)]}</Chip> },
|
||||
{ k: '调起', v: t.processPackageId },
|
||||
]}
|
||||
right={
|
||||
<St tone={t.enabled ? 'ok' : 'mute'} ico={t.enabled ? 'circle-check' : 'power'}>
|
||||
{t.enabled ? '已启用' : '已停用'}
|
||||
</St>
|
||||
}
|
||||
onClick={() => nav.push({ k: 'trigger', id: t.id })}
|
||||
/>
|
||||
))}
|
||||
</NList>
|
||||
)}
|
||||
{toggle.isError && <Note tone="warn">切换失败,请重试。</Note>}
|
||||
</>
|
||||
</QueryGate>
|
||||
);
|
||||
}
|
||||
|
||||
/* ==================== 触发器详情(两面共用) ==================== */
|
||||
|
||||
export function TriggerPage({ id }: { id: string }) {
|
||||
const q = useGovTriggers();
|
||||
const t = (q.data?.triggers ?? []).find((x) => x.id === id);
|
||||
const toggle = useGovAction(
|
||||
(enabled: boolean) => call(toggleTriggerRoute, { params: { id }, body: { enabled } }),
|
||||
['triggers'],
|
||||
);
|
||||
if (t === undefined) return <Note>触发器不存在。</Note>;
|
||||
return (
|
||||
<>
|
||||
@@ -462,27 +406,13 @@ export function TriggerPage({ id }: { id: string }) {
|
||||
<>
|
||||
<Chip tone="brand">{TRIGGER_KIND_LABEL[triggerKindOf(t.spec)]}</Chip>
|
||||
<Chip ico="boxes">调起 {t.processPackageId}</Chip>
|
||||
<Chip tone={t.enabled ? 'ok' : 'mute'} ico="power">
|
||||
{t.enabled ? '起单中' : '已停用'}
|
||||
</Chip>
|
||||
{t.confirm.required && <Chip tone="warn">命中须人工确认</Chip>}
|
||||
</>
|
||||
}
|
||||
desc="触发器与流程包平级——不入包结构、不随包版本,增删启停不改任何版本。规则在设计中心改,开关在运营中心拨。"
|
||||
acts={[
|
||||
{
|
||||
label: t.enabled ? '停用' : '启用',
|
||||
ico: 'power',
|
||||
danger: t.enabled,
|
||||
ask: {
|
||||
title: `${t.enabled ? '停用' : '启用'}触发器:${t.name}`,
|
||||
note: <Note>启停不改任何版本;已起的单不受影响。</Note>,
|
||||
impact: {
|
||||
who: t.enabled ? '此后不再自动起单,已在途工作流不受影响' : '此后按规则自动起单',
|
||||
undo: '可随时反向切换',
|
||||
when: '确认后即时',
|
||||
},
|
||||
okLabel: t.enabled ? '确认停用' : '确认启用',
|
||||
onOk: () => toggle.mutate(!t.enabled),
|
||||
},
|
||||
},
|
||||
]}
|
||||
desc="设计中心只负责设计:这里改的是规则与装配。启停开关、要不要人工确认、谁来确认,在运营中心 · 工作流的运行配置里。"
|
||||
/>
|
||||
<Card ico="settings" title="起单规则">
|
||||
<Rows
|
||||
|
||||
@@ -73,7 +73,8 @@ describe('legacyGovTarget —— 旧 #/gov 深链一条不死', () => {
|
||||
});
|
||||
|
||||
it('运行态区改写到 /ops', () => {
|
||||
expect(legacyGovTarget('#/gov/tasks/board')).toBe('/ops#/ops/tasks/board');
|
||||
// 看板已迁「工作流」区(2026-07-30):工作流是流程包的运行时,一级看板归它
|
||||
expect(legacyGovTarget('#/gov/tasks/board')).toBe('/ops#/ops/runs/board');
|
||||
});
|
||||
|
||||
it('已删的区落到对应新家', () => {
|
||||
|
||||
@@ -43,8 +43,9 @@ export const GOV_ZONES = [
|
||||
'archive',
|
||||
'models',
|
||||
'testbed',
|
||||
// 运营中心
|
||||
// 运营中心 —— 区名即运行时:工作流是流程包的运行时,任务是活动的运行时
|
||||
'cockpit',
|
||||
'runs',
|
||||
'tasks',
|
||||
'people',
|
||||
'ledgers',
|
||||
@@ -64,10 +65,11 @@ export const ZONES: ReadonlyArray<{ key: GovZone; label: string; icon: string }>
|
||||
{ key: 'models', label: '大模型', icon: 'cpu' },
|
||||
{ key: 'testbed', label: '测试台', icon: 'flask-conical' },
|
||||
{ key: 'cockpit', label: '驾驶舱', icon: 'gauge' },
|
||||
{ key: 'tasks', label: '任务', icon: 'activity' },
|
||||
{ key: 'runs', label: '工作流', icon: 'activity' },
|
||||
{ key: 'tasks', label: '任务', icon: 'list-checks' },
|
||||
{ key: 'people', label: '员工', icon: 'users' },
|
||||
{ key: 'ledgers', label: '台账', icon: 'table' },
|
||||
{ key: 'knowledge', label: '知识库', icon: 'layers' },
|
||||
{ key: 'knowledge', label: '数据', icon: 'layers' },
|
||||
{ key: 'system', label: '系统', icon: 'settings' },
|
||||
];
|
||||
|
||||
@@ -92,16 +94,22 @@ export const ZM: Readonly<Record<GovZone, { title: string; desc: string; accent:
|
||||
desc: '行数据 · 版本 · 引用——域的结构在设计中心改,这里做运营动作。域即页签,随数据域发布生长:设计侧一发布新域,台账里自动多一个域页签。',
|
||||
},
|
||||
knowledge: {
|
||||
title: '知识库',
|
||||
title: '数据',
|
||||
icon: 'layers',
|
||||
accent: 'linear-gradient(140deg,#f14ba9,#c92d86)',
|
||||
desc: '活动记忆四层 + 技能资产 + 候选增量的回放与放行。记忆的终点是成为模型——候选增量必经回放与人放行,这里是那道人工放行口。',
|
||||
desc: '运行沉淀的数据资产:活动记忆四层 + 技能资产 + 候选增量的回放与放行。记忆的终点是成为模型——候选增量必经回放与人放行,这里是那道人工放行口。',
|
||||
},
|
||||
runs: {
|
||||
title: '工作流',
|
||||
icon: 'activity',
|
||||
accent: 'linear-gradient(140deg,#3370ff,#245bdb)',
|
||||
desc: '流程包的运行时:在途工作流的监控,和每个包的运行配置——起单开关、命中后要不要人工确认、谁来确认、每个节点归谁负责。设计中心定义流程长什么样,这里管它今天怎么跑。',
|
||||
},
|
||||
tasks: {
|
||||
title: '任务管理',
|
||||
icon: 'activity',
|
||||
icon: 'list-checks',
|
||||
accent: 'linear-gradient(140deg,#3370ff,#245bdb)',
|
||||
desc: '运行态:任务与工作流两级运行时实例的在途监控、干预与控制——任务 = 活动被调起的一次运行,恰有一名负责人;工作流 = 流程包的一次运行,状态由流内各任务聚合投影而来。审批点卡到审批人工位,是流程层的人裁节点、不是任务。控制事件三种语义:暂停可恢复、叫停归负责人、终止级联作废。治理不改定义。',
|
||||
desc: '活动的运行时:任务 = 活动被调起的一次运行,恰有一名负责人。这里做任务与审批单的在途监控、干预与控制——暂停可恢复、叫停归负责人、终止级联作废。工作流一级去「工作流」区看。',
|
||||
},
|
||||
people: {
|
||||
title: '员工管理',
|
||||
@@ -181,11 +189,13 @@ export const TABS: Readonly<Record<GovZone, ReadonlyArray<{ key: string; label:
|
||||
tools: [{ key: 'catalog', label: '能力目录', ico: 'wrench' }],
|
||||
data: [{ key: 'domains', label: '数据对象', ico: 'database' }],
|
||||
cockpit: [{ key: 'dash', label: '驾驶舱', ico: 'gauge' }],
|
||||
runs: [
|
||||
{ key: 'board', label: '在途工作流', ico: 'activity' },
|
||||
{ key: 'conf', label: '运行配置', ico: 'settings' },
|
||||
],
|
||||
tasks: [
|
||||
{ key: 'board', label: '运行看板', ico: 'activity' },
|
||||
{ key: 'list', label: '任务', ico: 'list-checks' },
|
||||
{ key: 'apr', label: '审批单', ico: 'shield-check' },
|
||||
{ key: 'trg', label: '起单开关', ico: 'zap' },
|
||||
{ key: 'todo', label: '需处置', ico: 'flag' },
|
||||
],
|
||||
people: [
|
||||
|
||||
@@ -24,10 +24,10 @@ export const SURFACE_META: Readonly<Record<Surface, { path: string; brand: strin
|
||||
},
|
||||
};
|
||||
|
||||
/** 区归属:设计九区 + 运营六区,恰好铺满 `GOV_ZONES`(由测试守住) */
|
||||
/** 区归属:设计九区 + 运营七区,恰好铺满 `GOV_ZONES`(由测试守住) */
|
||||
export const SURFACE_ZONES: Readonly<Record<Surface, readonly GovZone[]>> = {
|
||||
design: ['blueprint', 'triggers', 'workflows', 'library', 'tools', 'data', 'archive', 'models', 'testbed'],
|
||||
ops: ['cockpit', 'tasks', 'people', 'ledgers', 'knowledge', 'system'],
|
||||
ops: ['cockpit', 'runs', 'tasks', 'people', 'ledgers', 'knowledge', 'system'],
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -66,6 +66,8 @@ function isGovZone(value: string): value is GovZone {
|
||||
* 精确到页签的先匹配 —— 记忆的两个旧页签各归其位(度量升驾驶舱,活动记忆归知识库)。
|
||||
*/
|
||||
const LEGACY_MOVES: Readonly<Record<string, string>> = {
|
||||
'tasks/board': 'ops/runs/board',
|
||||
'tasks/trg': 'ops/runs/conf',
|
||||
'workflows/rules': 'design/triggers/rules',
|
||||
'testbed/inbound': 'design/testbed/run',
|
||||
'system/llm': 'design/models/llm',
|
||||
|
||||
Reference in New Issue
Block a user