三面拆分⑭:纯编排第三轮 —— 活动卸岗位、卡点废除全真边、边号 E1–En 图上可选

活动契约不带负责人岗位(用户定):
- schema:活动节点删 owner(审批点的 approver 是「卡到人的工位」的功能语义,保留)
- 运行时:活动任务默认**全员轮值**(在岗候选并集、最闲者先、staffId 稳定排序,
  owner-resolved 事件岗位记「(全员轮值)」);运营分派机制落地后让位 —— 债已记
- closure:活动点不核岗位,missing-owner-position 只出自审批点
- 员工面链条:活动点报**实际承接人**(实例→任务→人),没起的如实报「轮值待派」;
  NodeInstance 公开 taskId/approvalId(店面读回,与端口型合流)
- 画布/导出依赖文件/属性卡全线摘岗位;属性卡活动点明说「分派归运营」

卡点画法废除,顺序流一律真边(用户定):
- 种子图重画:四条回跳/直达(E4 直接定价、E6 选型后定价、E10 不通过、E12 有异议)
  全部画成折线真边,车道分层零交叉(顶 y30 / y190 / y230 / 缝隙对开 / 底 y380);
  卡点节点删净,图=恰 10 语义节点 + 14 真边一一对应(测试守着)
- graph-to-pkg 卡点认亲机制删除;pkg-to-graph 直接按 from→to 认亲
- 元素盘删卡点件;图例、属性卡卡点分支、kindLabel/kindTone 随删

边号 E1、E2…(用户定):
- 语义边 id 即边号:种子 E1–E14;合并器铸号(旧边保号、新边取下一空号,回归测试守着)
- 画布线标带号(`E3 直接寻源`,无注记的边也标 `E1`);拣选条以边号立牌,
  **条件不再上按钮** —— 条件/映射只住属性面
- 边在图上可选中:FlowDiagram 连线加宽透明命中垫(边可点时注解层提到形状层上),
  点线即切属性卡到该边(实测 E4 命中)

测试:closure 28、advance-order 6、graph-to-pkg 5(新增铸号例)、seed 8、
端到端八例真库全绿(全员轮值下照跑);五闸退出码验过。
库:purge 后重种,唯一 unified-quote@v1 生效(双面判据齐)。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
This commit is contained in:
2026-07-28 19:02:07 +08:00
co-authored by Claude Fable 5
parent 281f4ef084
commit 7f0d25c337
21 changed files with 361 additions and 436 deletions
@@ -126,6 +126,8 @@ export function createProcessStore(db: Db): ProcessStore {
activated: r.activated,
...(r.terminal === null ? {} : { terminal: r.terminal as TerminalState }),
...(r.failureDigested === null ? {} : { failureDigested: r.failureDigested }),
...(r.taskId === null ? {} : { taskId: r.taskId }),
...(r.approvalId === null ? {} : { approvalId: r.approvalId }),
}),
);
},
@@ -57,8 +57,9 @@ export function checkClosure(input: ClosureInput): ClosureReport {
}
if (node.kind === 'activity') {
violations.push(...checkActivityNode(node, incoming.get(node.id) ?? [], contracts, positions));
violations.push(...checkActivityNode(node, incoming.get(node.id) ?? [], contracts));
}
// 活动点不核岗位(契约不带负责人 —— 分派归运营);审批点的岗位是功能语义,照核
if (node.kind === 'approval' && !positions.has(node.approver.position)) {
violations.push({
kind: 'missing-owner-position',
@@ -94,7 +95,6 @@ function checkActivityNode(
node: Extract<ProcessNode, { kind: 'activity' }>,
inbound: readonly Edge[],
contracts: ReadonlyMap<string, ActivityContractFace>,
positions: ReadonlySet<string>,
): ClosureViolation[] {
const out: ClosureViolation[] = [];
const face = contracts.get(node.activityId);
@@ -108,14 +108,6 @@ function checkActivityNode(
return out;
}
if (!positions.has(node.owner.position)) {
out.push({
kind: 'missing-owner-position',
nodeId: node.id,
message: `节点「${node.label}」的岗位不存在:${node.owner.position}`,
});
}
// 连一条边即须完成该边映射
for (const edge of inbound) {
if (edge.mapping.length === 0) {
@@ -120,6 +120,9 @@ export type NodeInstance = {
readonly failureDigested?: boolean;
/** XOR 未选分支从未激活 —— 不入集合 */
readonly activated: boolean;
/** 该实例派出的任务 / 审批(结构件与终点没有)—— 链条视图按它报实际承接人 */
readonly taskId?: string;
readonly approvalId?: string;
};
export function aggregateWorkflowState(
@@ -1,7 +1,7 @@
/**
* process 用例 —— 流程引擎:确定性流转,**零 LLM、零临场**(编码规范 §5.3;语义出处 OS 03 / 04)。
*
* 起单 · 调度节点 · 审批点卡工位 · 网关分合 · 每次流转记入事件。
* 起单 · 调度节点 · 审批点卡工位 · 条件出边选路 · 每次流转记入事件。
*/
import type { ProcessNode, ProcessPackage, StaffId, TerminalState, WorkflowState } from '@contracts';
import type { ProcessService, StartWorkflowInput } from '../../contract.ts';
@@ -87,7 +87,7 @@ export function createProcessService(deps: ProcessServiceDeps): ProcessService {
const dispatch = dispatchOf(node, payload);
if (dispatch === undefined) {
// 网关本身不是责任单元:直接继续流转
// 只剩起点会走到这(结构件无调度):被指为目标时直通,不建实例
await advanceFrom(record, pkg, node.id, payload);
return;
}
@@ -122,15 +122,31 @@ export function createProcessService(deps: ProcessServiceDeps): ProcessService {
return;
}
// 负责人 / 审批人:编排声明岗位,起单时确定性解析;结果与依据留痕
const spec = dispatch.kind === 'start-task' ? dispatch.node.owner : dispatch.node.approver;
const candidates = await deps.org.candidates(spec.position);
/*
* 绑定先于策略:工作组说了这个岗位是谁,策略就无从发问(ADR-011)。
* 在岗与否在这里核 —— 绑定是**跨岗位**指派,拿该岗位的候选集核不了它。
* 谁来干:**活动契约不带岗位**(纯编排,2026-07-28 第三轮)—— 分派是运营的事。
* 运营分派机制未建前,活动任务默认**全员轮值**(在岗候选并集,最闲者先,
* staffId 稳定排序保证同输入必同结果);审批点例外,「卡到人的工位」是它的
* 功能语义,仍按 approver 岗位解析,工作组绑定(ADR-011)也只对它生效。
*/
const boundTo = record.workGroup?.[spec.position];
const bound = boundTo !== undefined && (await deps.org.isActive(boundTo)) ? boundTo : undefined;
let spec;
let candidates;
let bound;
if (dispatch.kind === 'start-task') {
spec = { position: '(全员轮值)', strategy: 'sole' as const };
const seen = new Map<string, { staffId: string; name: string; openTasks: number }>();
for (const position of await deps.org.positions()) {
for (const c of await deps.org.candidates(position)) if (!seen.has(c.staffId)) seen.set(c.staffId, c);
}
candidates = [...seen.values()];
bound = undefined;
} else {
spec = dispatch.node.approver;
candidates = await deps.org.candidates(spec.position);
// 绑定先于策略:工作组说了这个岗位是谁,策略就无从发问(ADR-011)。
// 在岗与否在这里核 —— 绑定是**跨岗位**指派,拿该岗位的候选集核不了它。
const boundTo = record.workGroup?.[spec.position];
bound = boundTo !== undefined && (await deps.org.isActive(boundTo)) ? boundTo : undefined;
}
const resolution = resolveOwner(spec, { candidates, ...(bound === undefined ? {} : { bound }) });
if (resolution.kind === 'vacant') throw new PositionVacantError(spec.position);