forked from ChaiHao/BPOS-MVP
三面拆分⑫:网关去节点化 —— 分支即条件出边,汇合即多入边异或
模型(与 Mastra .branch 同构,条件挂在步与步之间): - routing.selectEdges:多出边一律异或,不分节点种类 —— 条件命中优先(按声明序), 无条件边作默认兜底,恰取一条;单出边直通保留(历史并行网关的遗留通道) - closure:含网关即 gateway-deprecated(历史版本仅可读、不可激活); 「隐式合并」禁令删除(多入边=异或汇合,上游互斥无歧义); 新规:多出边节点的无条件边至多一条,超出报 multi-default-edge - contracts:CLOSURE_VIOLATION_KINDS 去 gateway-unbalanced/join-ambiguous-source, 进 multi-default-edge/gateway-deprecated(下游零引用,api-report 随行) 种子(按用户要求:只留一条流一个版本,图/节点/边全部对账): - MVP_PACKAGE 重写:10 节点 14 边零网关 —— G1/G2 展开为 A1 的三条出边 (选型/直接寻源/默认直接定价)+ A2 的两条,G2J/G3 整颗删除, A5 审批点的两个去向就是自己的两条 verdict 条件出边(驳回边与 reject 声明字字对齐) - 手绘图:顶车道 y30 补画 A1→A3「直接寻源」—— 画布保存只认画出来的边, 不画这条语义边会在首次存盘被静默丢掉(新增图边对账测试卡死这类漏画); 「供应商底价表」标注钉进 y190 车道空档,不再被卡点压住 - 开发库外科手术:清运行数据 + 删 v1–v4,重种为唯一生效版 v1(闭合过闸) UI 与文案同步: - 元素盘/追加盘不再有网关件(画布仍认得历史图);图例删「判断/并行网关」「菱形=网关」 - 新建流程补激活一跳(保存不生效模型下,不激活「建出来就能起单」就是谎言) - 总览四种编排要素、「画图不检查,激活才查完整」贯穿 blueprint/memory/process 文案 测试:closure 43 通过(gateway-deprecated + multi-default-edge 两用例), seed-mvp-flow 8 通过(含图边对账),端到端八例真库全绿(网关从不建实例,断言原样存活); 五闸 typecheck/lint/depcruise/api:check/test 全过(退出码验)。 债:M5-4 AND 并行待「并行组」声明(Mastra .parallel);M5-5 网关运行时兼容三处, 含网关在途流清零后随 schema 一并摘除。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
This commit is contained in:
+4
-4
@@ -1051,8 +1051,8 @@ export declare const saveProcessRoute: {
|
|||||||
"required-unmapped": "required-unmapped";
|
"required-unmapped": "required-unmapped";
|
||||||
"type-conflict": "type-conflict";
|
"type-conflict": "type-conflict";
|
||||||
"dangling-node": "dangling-node";
|
"dangling-node": "dangling-node";
|
||||||
"gateway-unbalanced": "gateway-unbalanced";
|
"multi-default-edge": "multi-default-edge";
|
||||||
"join-ambiguous-source": "join-ambiguous-source";
|
"gateway-deprecated": "gateway-deprecated";
|
||||||
"tolerate-required-dependency": "tolerate-required-dependency";
|
"tolerate-required-dependency": "tolerate-required-dependency";
|
||||||
"unknown-activity": "unknown-activity";
|
"unknown-activity": "unknown-activity";
|
||||||
"missing-owner-position": "missing-owner-position";
|
"missing-owner-position": "missing-owner-position";
|
||||||
@@ -1481,8 +1481,8 @@ export declare const validateProcessRoute: {
|
|||||||
"required-unmapped": "required-unmapped";
|
"required-unmapped": "required-unmapped";
|
||||||
"type-conflict": "type-conflict";
|
"type-conflict": "type-conflict";
|
||||||
"dangling-node": "dangling-node";
|
"dangling-node": "dangling-node";
|
||||||
"gateway-unbalanced": "gateway-unbalanced";
|
"multi-default-edge": "multi-default-edge";
|
||||||
"join-ambiguous-source": "join-ambiguous-source";
|
"gateway-deprecated": "gateway-deprecated";
|
||||||
"tolerate-required-dependency": "tolerate-required-dependency";
|
"tolerate-required-dependency": "tolerate-required-dependency";
|
||||||
"unknown-activity": "unknown-activity";
|
"unknown-activity": "unknown-activity";
|
||||||
"missing-owner-position": "missing-owner-position";
|
"missing-owner-position": "missing-owner-position";
|
||||||
|
|||||||
+7
-7
@@ -488,14 +488,14 @@ export declare const processPackageSchema: z.ZodObject<{
|
|||||||
diagram: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
diagram: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
||||||
}, z.core.$strip>;
|
}, z.core.$strip>;
|
||||||
export type ProcessPackage = z.infer<typeof processPackageSchema>;
|
export type ProcessPackage = z.infer<typeof processPackageSchema>;
|
||||||
export declare const CLOSURE_VIOLATION_KINDS: readonly ["edge-unmapped", "required-unmapped", "type-conflict", "dangling-node", "gateway-unbalanced", "join-ambiguous-source", "tolerate-required-dependency", "unknown-activity", "missing-owner-position"];
|
export declare const CLOSURE_VIOLATION_KINDS: readonly ["edge-unmapped", "required-unmapped", "type-conflict", "dangling-node", "multi-default-edge", "gateway-deprecated", "tolerate-required-dependency", "unknown-activity", "missing-owner-position"];
|
||||||
export declare const closureViolationKindSchema: z.ZodEnum<{
|
export declare const closureViolationKindSchema: z.ZodEnum<{
|
||||||
"edge-unmapped": "edge-unmapped";
|
"edge-unmapped": "edge-unmapped";
|
||||||
"required-unmapped": "required-unmapped";
|
"required-unmapped": "required-unmapped";
|
||||||
"type-conflict": "type-conflict";
|
"type-conflict": "type-conflict";
|
||||||
"dangling-node": "dangling-node";
|
"dangling-node": "dangling-node";
|
||||||
"gateway-unbalanced": "gateway-unbalanced";
|
"multi-default-edge": "multi-default-edge";
|
||||||
"join-ambiguous-source": "join-ambiguous-source";
|
"gateway-deprecated": "gateway-deprecated";
|
||||||
"tolerate-required-dependency": "tolerate-required-dependency";
|
"tolerate-required-dependency": "tolerate-required-dependency";
|
||||||
"unknown-activity": "unknown-activity";
|
"unknown-activity": "unknown-activity";
|
||||||
"missing-owner-position": "missing-owner-position";
|
"missing-owner-position": "missing-owner-position";
|
||||||
@@ -507,8 +507,8 @@ export declare const closureViolationSchema: z.ZodObject<{
|
|||||||
"required-unmapped": "required-unmapped";
|
"required-unmapped": "required-unmapped";
|
||||||
"type-conflict": "type-conflict";
|
"type-conflict": "type-conflict";
|
||||||
"dangling-node": "dangling-node";
|
"dangling-node": "dangling-node";
|
||||||
"gateway-unbalanced": "gateway-unbalanced";
|
"multi-default-edge": "multi-default-edge";
|
||||||
"join-ambiguous-source": "join-ambiguous-source";
|
"gateway-deprecated": "gateway-deprecated";
|
||||||
"tolerate-required-dependency": "tolerate-required-dependency";
|
"tolerate-required-dependency": "tolerate-required-dependency";
|
||||||
"unknown-activity": "unknown-activity";
|
"unknown-activity": "unknown-activity";
|
||||||
"missing-owner-position": "missing-owner-position";
|
"missing-owner-position": "missing-owner-position";
|
||||||
@@ -527,8 +527,8 @@ export declare const closureReportSchema: z.ZodObject<{
|
|||||||
"required-unmapped": "required-unmapped";
|
"required-unmapped": "required-unmapped";
|
||||||
"type-conflict": "type-conflict";
|
"type-conflict": "type-conflict";
|
||||||
"dangling-node": "dangling-node";
|
"dangling-node": "dangling-node";
|
||||||
"gateway-unbalanced": "gateway-unbalanced";
|
"multi-default-edge": "multi-default-edge";
|
||||||
"join-ambiguous-source": "join-ambiguous-source";
|
"gateway-deprecated": "gateway-deprecated";
|
||||||
"tolerate-required-dependency": "tolerate-required-dependency";
|
"tolerate-required-dependency": "tolerate-required-dependency";
|
||||||
"unknown-activity": "unknown-activity";
|
"unknown-activity": "unknown-activity";
|
||||||
"missing-owner-position": "missing-owner-position";
|
"missing-owner-position": "missing-owner-position";
|
||||||
|
|||||||
@@ -1,135 +1,109 @@
|
|||||||
/**
|
/**
|
||||||
* 流程包 —— 守四件事:拓扑齐、**审批点后面跟网关且两个去向都真的走**、
|
* 流程包(无网关版)—— 守四件事:拓扑齐且零网关、分支即条件出边、
|
||||||
* 网关条件读得到判据、回边标了 reopen。
|
* 审批点两个去向都由图表达、回边标了 reopen。
|
||||||
*/
|
*/
|
||||||
import { describe, expect, it } from 'vitest';
|
import { describe, expect, it } from 'vitest';
|
||||||
import { MVP_PACKAGE } from '../seed-mvp-flow.ts';
|
import { MVP_PACKAGE } from '../seed-mvp-flow.ts';
|
||||||
|
|
||||||
describe('MVP_PACKAGE', () => {
|
describe('MVP_PACKAGE', () => {
|
||||||
it('15 语义节点 · 18 边 · 五网关一审批点双终点', () => {
|
it('10 语义节点 · 14 边 · 零网关 · 一审批点双终点', () => {
|
||||||
expect(MVP_PACKAGE.nodes).toHaveLength(15);
|
expect(MVP_PACKAGE.nodes).toHaveLength(10);
|
||||||
expect(MVP_PACKAGE.edges).toHaveLength(18);
|
expect(MVP_PACKAGE.edges).toHaveLength(14);
|
||||||
expect(MVP_PACKAGE.nodes.filter((n) => n.kind === 'end')).toHaveLength(2);
|
expect(MVP_PACKAGE.nodes.filter((n) => n.kind === 'gateway')).toHaveLength(0);
|
||||||
expect(MVP_PACKAGE.nodes.filter((n) => n.kind === 'gateway')).toHaveLength(5);
|
|
||||||
expect(MVP_PACKAGE.nodes.filter((n) => n.kind === 'approval')).toHaveLength(1);
|
expect(MVP_PACKAGE.nodes.filter((n) => n.kind === 'approval')).toHaveLength(1);
|
||||||
});
|
expect(MVP_PACKAGE.nodes.filter((n) => n.kind === 'end')).toHaveLength(2);
|
||||||
|
|
||||||
it('分叉必有汇合:G2 的两条互斥分支并回 G2J —— 不给汇合点,A4 会被判隐式合并', () => {
|
|
||||||
const g2j = MVP_PACKAGE.nodes.find((n) => n.id === 'G2J');
|
|
||||||
expect(g2j?.kind).toBe('gateway');
|
|
||||||
if (g2j?.kind !== 'gateway') return;
|
|
||||||
expect(g2j.gateway).toBe('exclusive');
|
|
||||||
expect(g2j.mode).toBe('join');
|
|
||||||
expect(MVP_PACKAGE.edges.filter((e) => e.to === 'G2J')).toHaveLength(2);
|
|
||||||
/*
|
|
||||||
* A4 的**非回边**入边只剩一条 —— 这是发布闸能过的关键。
|
|
||||||
* A4 一共三条入边(G2J 正常来、G3 驳回、G4 有异议),后两条都是 reopen;
|
|
||||||
* 闭合校验的「汇合同名字段来源不明」只看并发入边(回边是重新入场、不参与判定),
|
|
||||||
* 所以 concurrent 长度 1、不触发。任一条回边漏标 reopen,发布立刻被拦。
|
|
||||||
*/
|
|
||||||
expect(MVP_PACKAGE.edges.filter((e) => e.to === 'A4' && !e.reopen)).toHaveLength(1);
|
|
||||||
expect(MVP_PACKAGE.edges.filter((e) => e.to === 'A4')).toHaveLength(3);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 审批点后面必然跟一个网关(BPMN 的常规)。
|
* 分支 = 源节点的多条条件出边,恰取一条;无条件边作默认兜底,至多一条。
|
||||||
*
|
* 原 G1/G2 合并展开成 A1 的三条出边:选型 / 直接寻源(复合条件)/ 直接定价(默认)。
|
||||||
* 这条曾经不成立:G3 被我做掉了,通过走 A5 的唯一出边、驳回藏在 `reject` 声明里,
|
|
||||||
* 图上只有一枚牌子。补回 G3 时还有个坑 —— 若引擎不把裁决放进载荷,
|
|
||||||
* G3 的条件就没东西可读,只能在边上喂一枚常量 `verdict: "pass"` 骗过它;
|
|
||||||
* 那样条件恒真、驳回边永不可达,网关成了摆设。所以这里连**没有常量**一起守。
|
|
||||||
*/
|
*/
|
||||||
it('A5 后面跟着 G3,两个去向都由图表达,且判据不是喂进去的常量', () => {
|
it('A1 三条出边:两条带条件 + 一条默认兜底 —— 原 G1+G2 的展开', () => {
|
||||||
|
const outs = MVP_PACKAGE.edges.filter((e) => e.from === 'A1');
|
||||||
|
expect(outs.map((e) => `${e.to}:${e.condition ?? '(默认)'}`).sort()).toEqual([
|
||||||
|
'A2:needAlternative = true',
|
||||||
|
'A3:needAlternative = false and needSourcing = true',
|
||||||
|
'A4:(默认)',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('A5 审批点的两个去向就是它自己的两条条件出边;驳回边与 reject 声明字字对齐', () => {
|
||||||
const a5 = MVP_PACKAGE.nodes.find((n) => n.id === 'A5');
|
const a5 = MVP_PACKAGE.nodes.find((n) => n.id === 'A5');
|
||||||
expect(a5?.kind).toBe('approval');
|
expect(a5?.kind).toBe('approval');
|
||||||
if (a5?.kind !== 'approval') return;
|
if (a5?.kind !== 'approval' || a5.reject.kind !== 'reopen') return;
|
||||||
expect(a5.approver.position).toBe('PM');
|
|
||||||
|
|
||||||
// A5 的唯一出边指向网关,而不是直接指向下一个活动
|
const outs = MVP_PACKAGE.edges.filter((e) => e.from === 'A5');
|
||||||
const outOfA5 = MVP_PACKAGE.edges.filter((e) => e.from === 'A5');
|
expect(outs.map((e) => `${e.to}:${e.condition ?? ''}`).sort()).toEqual([
|
||||||
expect(outOfA5).toHaveLength(1);
|
|
||||||
expect(outOfA5[0]?.to).toBe('G3');
|
|
||||||
// 这条边不许带映射:判据由引擎在裁决时放进载荷,不是边喂的常量
|
|
||||||
expect(outOfA5[0]?.mapping).toEqual([]);
|
|
||||||
|
|
||||||
const g3 = MVP_PACKAGE.nodes.find((n) => n.id === 'G3');
|
|
||||||
expect(g3?.kind).toBe('gateway');
|
|
||||||
if (g3?.kind !== 'gateway') return;
|
|
||||||
expect(g3.gateway).toBe('exclusive');
|
|
||||||
expect(g3.mode).toBe('fork');
|
|
||||||
|
|
||||||
const outOfG3 = MVP_PACKAGE.edges.filter((e) => e.from === 'G3');
|
|
||||||
expect(outOfG3).toHaveLength(2);
|
|
||||||
// 异或分叉的每条出边都要带条件 —— 没有无条件兜底边可用
|
|
||||||
for (const e of outOfG3) expect(e.condition, `${e.id} 缺条件`).toBeDefined();
|
|
||||||
expect(outOfG3.map((e) => `${e.to}:${e.condition ?? ''}`).sort()).toEqual([
|
|
||||||
'A4:verdict = "reject"',
|
'A4:verdict = "reject"',
|
||||||
'A6:verdict = "pass"',
|
'A6:verdict = "pass"',
|
||||||
]);
|
]);
|
||||||
|
const rejectEdge = outs.find((e) => e.to === 'A4')!;
|
||||||
|
expect(rejectEdge.reopen).toBe(true);
|
||||||
|
expect(rejectEdge.to).toBe(a5.reject.nodeId);
|
||||||
|
expect(rejectEdge.mapping).toEqual(a5.reject.mapping);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('G3 的驳回出边与 A5 的 reject 声明字字对齐 —— 引擎先看图,没画边的包才退回声明', () => {
|
/*
|
||||||
const a5 = MVP_PACKAGE.nodes.find((n) => n.id === 'A5');
|
* A4 的多入边是**异或汇合**:上游互斥(A1/A2/A3 的条件路径),只会来一条,
|
||||||
const edge = MVP_PACKAGE.edges.find((e) => e.id === 'e-g3-a4');
|
* 同名映射天然无歧义 —— 这正是显式汇合点(G2J)被删掉的原因。
|
||||||
expect(a5?.kind).toBe('approval');
|
* 回边(A5 驳回 / A6 有异议)不算并发入边。
|
||||||
if (a5?.kind !== 'approval' || a5.reject.kind !== 'reopen') return;
|
*/
|
||||||
expect(edge?.to).toBe(a5.reject.nodeId);
|
it('A4 三条正向入边互斥合法,两条回边都标 reopen', () => {
|
||||||
expect(edge?.reopen).toBe(true);
|
const ins = MVP_PACKAGE.edges.filter((e) => e.to === 'A4');
|
||||||
expect(edge?.mapping).toEqual(a5.reject.mapping);
|
expect(ins.filter((e) => !e.reopen).map((e) => e.from).sort()).toEqual(['A1', 'A2', 'A3']);
|
||||||
|
expect(ins.filter((e) => e.reopen).map((e) => e.from).sort()).toEqual(['A5', 'A6']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('两条回边都标了 reopen:审批驳回与议价有异议,都回 A4 重开', () => {
|
it('A6 三条条件出边 —— outcome 由放行选口给出', () => {
|
||||||
expect(MVP_PACKAGE.edges.filter((e) => e.reopen).map((e) => `${e.from}→${e.to}`).sort()).toEqual([
|
const outs = MVP_PACKAGE.edges.filter((e) => e.from === 'A6');
|
||||||
'G3→A4',
|
expect(outs.map((e) => `${e.to}:${e.condition ?? ''}`).sort()).toEqual([
|
||||||
'G4→A4',
|
'A4:outcome = "revise"',
|
||||||
|
'A7:outcome = "lost"',
|
||||||
|
'end_won:outcome = "won"',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('网关条件按判据写:G1/G2 读旗,G3 读裁决,G4 读 outcome', () => {
|
it('手绘图存证:10 语义节点 + 4 卡点(直达两枚是正向边的呈现,回跳两枚照旧)', () => {
|
||||||
const cond = (from: string, to: string) => MVP_PACKAGE.edges.find((e) => e.from === from && e.to === to)?.condition;
|
|
||||||
expect(cond('G1', 'A2')).toBe('needAlternative = true');
|
|
||||||
expect(cond('G2', 'G2J')).toBe('needSourcing = false');
|
|
||||||
expect(cond('G3', 'A6')).toBe('verdict = "pass"');
|
|
||||||
expect(cond('G4', 'A7')).toBe('outcome = "lost"');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('手绘图存证在包上 —— 15 语义节点 + 两枚卡点', () => {
|
|
||||||
expect(MVP_PACKAGE.diagram).toBeDefined();
|
|
||||||
const nodes = (MVP_PACKAGE.diagram as { nodes: { id: string; kind: string }[] }).nodes;
|
const nodes = (MVP_PACKAGE.diagram as { nodes: { id: string; kind: string }[] }).nodes;
|
||||||
expect(nodes.filter((n) => n.kind === 'callout')).toHaveLength(2);
|
expect(nodes.filter((n) => n.kind === 'callout')).toHaveLength(4);
|
||||||
expect(nodes).toHaveLength(17);
|
expect(nodes).toHaveLength(14);
|
||||||
// 语义节点在图上一个不少(卡点是呈现,不入语义)
|
|
||||||
const drawn = new Set(nodes.map((n) => n.id));
|
const drawn = new Set(nodes.map((n) => n.id));
|
||||||
for (const n of MVP_PACKAGE.nodes) expect(drawn.has(n.id), `图上缺 ${n.id}`).toBe(true);
|
for (const n of MVP_PACKAGE.nodes) expect(drawn.has(n.id), `图上缺 ${n.id}`).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 几何自查:重排的收益要能验证,不能只写在注释里。
|
* 语义边必须**每条都画在图上**(直连线,或指向带 `to` 卡点的线)——
|
||||||
* 手绘尺寸见 `apps/web/src/shared/gov/flow/flow-layout.ts` 的 MANUAL_SIZES。
|
* 画布保存由画出来的边反推语义边,没画的那条会在第一次存盘时被静默丢掉
|
||||||
|
* (实测:A1→A3「直接寻源」漏画,mergeGraphIntoPackage 一过就没了)。
|
||||||
*/
|
*/
|
||||||
it('几何:坐标吸附 10px 珊格,同带内框不重叠', () => {
|
it('图边对账:每条语义边都有画出来的对应(直连或经卡点)', () => {
|
||||||
|
const dia = MVP_PACKAGE.diagram as {
|
||||||
|
nodes: { id: string; kind: string; to?: string }[];
|
||||||
|
edges: { from: string; to: string }[];
|
||||||
|
};
|
||||||
|
const calloutTo = new Map(dia.nodes.filter((n) => n.kind === 'callout').map((n) => [n.id, n.to]));
|
||||||
|
const drawnPairs = new Set(dia.edges.map((e) => `${e.from}→${calloutTo.get(e.to) ?? e.to}`));
|
||||||
|
for (const e of MVP_PACKAGE.edges) {
|
||||||
|
expect(drawnPairs.has(`${e.from}→${e.to}`), `语义边 ${e.id}(${e.from}→${e.to})没画在图上`).toBe(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('几何:坐标吸附 10px 珊格,框不重叠', () => {
|
||||||
const nodes = (MVP_PACKAGE.diagram as { nodes: { id: string; kind: string; x: number; y: number }[] }).nodes;
|
const nodes = (MVP_PACKAGE.diagram as { nodes: { id: string; kind: string; x: number; y: number }[] }).nodes;
|
||||||
const size = (kind: string) =>
|
const size = (kind: string) =>
|
||||||
kind === 'gateway' ? { w: 40, h: 40 }
|
kind === 'callout' ? { w: 100, h: 30 } : kind === 'activity' ? { w: 100, h: 40 } : { w: 20, h: 20 };
|
||||||
: kind === 'callout' ? { w: 100, h: 30 }
|
|
||||||
: kind === 'activity' ? { w: 100, h: 40 }
|
|
||||||
: { w: 20, h: 20 };
|
|
||||||
|
|
||||||
for (const n of nodes) {
|
for (const n of nodes) {
|
||||||
expect(n.x % 10, `${n.id} 的 x 未吸附珊格`).toBe(0);
|
expect(n.x % 10, `${n.id} x`).toBe(0);
|
||||||
expect(n.y % 10, `${n.id} 的 y 未吸附珊格`).toBe(0);
|
expect(n.y % 10, `${n.id} y`).toBe(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 两两不重叠(轴对齐矩形相交判定)
|
|
||||||
for (let i = 0; i < nodes.length; i += 1) {
|
for (let i = 0; i < nodes.length; i += 1) {
|
||||||
for (let j = i + 1; j < nodes.length; j += 1) {
|
for (let j = i + 1; j < nodes.length; j += 1) {
|
||||||
const a = nodes[i]!;
|
const a = nodes[i]!;
|
||||||
const b = nodes[j]!;
|
const b = nodes[j]!;
|
||||||
const sa = size(a.kind);
|
const sa = size(a.kind);
|
||||||
const sb = size(b.kind);
|
const sb = size(b.kind);
|
||||||
const overlap =
|
const overlap = a.x < b.x + sb.w && a.x + sa.w > b.x && a.y < b.y + sb.h && a.y + sa.h > b.y;
|
||||||
a.x < b.x + sb.w && a.x + sa.w > b.x && a.y < b.y + sb.h && a.y + sa.h > b.y;
|
expect(overlap, `${a.id} 与 ${b.id} 重叠`).toBe(false);
|
||||||
expect(overlap, `${a.id} 与 ${b.id} 的框重叠`).toBe(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+121
-207
@@ -1,25 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* 「统一报价」流程包 —— 语义取自 `docs/MVP示例工作流.html` 的 FIG.1,几何**重排过**。
|
* 「统一报价」流程包 —— **无网关**:语义取自 `docs/MVP示例工作流.html`,结构按新模型展开。
|
||||||
*
|
*
|
||||||
* 语义 15 节点:起点 · A1 · G1 · A2 · G2 · A3 · G2J · A4 · **A5 审批点** · G3 · A6 · G4 · A7 · 双终点。
|
* 分支 = 源节点的条件出边(恰取一条,无条件边作默认兜底);汇合 = 多入边异或。
|
||||||
|
* FIG.1 的 G1/G2/G4 各自消失成 A1/A2/A6 的条件出边;G2J 与 G3 整颗不再需要。
|
||||||
|
* 10 节点 14 边;审批点 A5 的两个去向就是它自己的两条条件出边(verdict 由引擎注入)。
|
||||||
*
|
*
|
||||||
* 与 FIG.1 的两处语义差异:
|
* 几何:两带换行、零交叉;直达与回跳都用**卡点**表达(不画长线)——
|
||||||
* · **多一颗 G2J**:G2 的两条互斥分支必须显式汇合 —— FIG.1 把它画成两条线各扎进 A4,
|
* 卡点带 `to`,`mergeGraphIntoPackage` 只认语义边已存在的还原,编辑器保存不丢边。
|
||||||
* 语义上那是隐式合并,闭合校验不收(见下 joinNode 注释)。
|
|
||||||
* · **A5 是内置审批点**(审批不是任务,零开发、不入活动库),而 FIG.1 给它配了作业指导书。
|
|
||||||
*
|
|
||||||
* G3「审批结果」曾被我做掉过,理由是「审批点把它吸收了:通过走出边、驳回走 reject 声明」。
|
|
||||||
* **那是错的** —— 审批点的两个去向本该由图决定(BPMN 的常规,也是用户要的)。
|
|
||||||
* 现已补回,并且引擎跟着改成**先看图**:`onApprovalVerdict` 把裁决放进载荷,
|
|
||||||
* 通过与驳回都先试出边,只有没画驳回边的包才退回 `reject` 声明。
|
|
||||||
* 所以 G3 的两条出边都是**真的会走**的,不是摆设 —— 没有给条件喂常量。
|
|
||||||
*
|
|
||||||
* `reject` 声明仍保留:schema 必填,且它是通用机制(不是每个包都把驳回画成边)。
|
|
||||||
* 它与 `e-g3-a4` 必须字字对齐,有测试守着。
|
|
||||||
*
|
|
||||||
* 几何是**重排**,不再逐点等于 SVG:两带换行(受理·选型·寻源 → 定价·审批·议价·成交),
|
|
||||||
* 每带内 x 随推进次序单调递增,全图零连线交叉、零穿框。回跳仍用**卡点**表示(不画长线),
|
|
||||||
* 卡点带 `to`,`mergeGraphIntoPackage` 会把「X → 卡点(to: Y)」还原成语义边,编辑器保存不丢回边。
|
|
||||||
*/
|
*/
|
||||||
import { processPackageSchema, triggerConfigSchema } from '@contracts';
|
import { processPackageSchema, triggerConfigSchema } from '@contracts';
|
||||||
import type { ProcessPackage } from '@contracts';
|
import type { ProcessPackage } from '@contracts';
|
||||||
@@ -46,32 +33,6 @@ const activityNode = (
|
|||||||
layout: { row, col, x, y },
|
layout: { row, col, x, y },
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 判断网关:异或分叉,判据人读、条件在出边 */
|
|
||||||
const gatewayNode = (id: string, label: string, basis: string, col: number, row: number, x: number, y: number) => ({
|
|
||||||
id,
|
|
||||||
kind: 'gateway' as const,
|
|
||||||
label,
|
|
||||||
gateway: 'exclusive' as const,
|
|
||||||
mode: 'fork' as const,
|
|
||||||
basis,
|
|
||||||
layout: { row, col, x, y },
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 异或汇合点 —— 两条互斥分支重新并回一条路。
|
|
||||||
*
|
|
||||||
* MVP 图上这里是两条线各自扎进 A4(隐式合并);语义上必须显式:
|
|
||||||
* 不给汇合点,A4 就有两条同名映射的入边,闭合校验按「不做隐式合并」拦下(实测)。
|
|
||||||
* 分叉必有汇合是 BPMN 的正解,本仓 v1 的 G2/G2J 即此先例。
|
|
||||||
*/
|
|
||||||
const joinNode = (id: string, label: string, col: number, row: number, x: number, y: number) => ({
|
|
||||||
id,
|
|
||||||
kind: 'gateway' as const,
|
|
||||||
label,
|
|
||||||
gateway: 'exclusive' as const,
|
|
||||||
mode: 'join' as const,
|
|
||||||
layout: { row, col, x, y },
|
|
||||||
});
|
|
||||||
|
|
||||||
/** 受理口的两枚去向旗与记录 —— A4 重新入场(回边 / 驳回)时照此装配 */
|
/** 受理口的两枚去向旗与记录 —— A4 重新入场(回边 / 驳回)时照此装配 */
|
||||||
const REENTER_A4 = [
|
const REENTER_A4 = [
|
||||||
@@ -99,27 +60,21 @@ export const MVP_PACKAGE: ProcessPackage = processPackageSchema.parse({
|
|||||||
output: { type: 'object', properties: { landingRate: { type: 'number' } } },
|
output: { type: 'object', properties: { landingRate: { type: 'number' } } },
|
||||||
},
|
},
|
||||||
/*
|
/*
|
||||||
* 版式:**两带换行**,不回形。`col` 用全局最长路径层级(0..13),每一带内 x 随 col 单调递增,
|
* **无网关**(产品决策 2026-07-28):分支 = 源节点的多条条件出边(恰取一条,
|
||||||
* 所以「左→右、上→下」读出来就是推进次序 —— 图纸不再需要被当成次序的依据
|
* 无条件边作默认兜底),汇合 = 多入边异或(上游互斥,只会来一条)。
|
||||||
* (`advanceOrder` 早已改按边拓扑排,这里让两者一致只是为了不误导人)。
|
* 与 Mastra 同构:条件挂在步与步之间,步保持纯粹。
|
||||||
|
* FIG.1 的 G1/G2/G4 于是各自消失成 A1/A2/A6 的条件出边;
|
||||||
|
* G2J(当年为绕「隐式合并」禁令而生的显式汇合点)与 G3(审批结果)整颗不再需要 ——
|
||||||
|
* A4 的三条正向入边互斥即合法,A5 的裁决就是它自己的两条条件出边。
|
||||||
*
|
*
|
||||||
* 带 0(y 60..100) start → A1 → G1 → A2 → G2 → A3 → G2J 受理 · 选型 · 寻源
|
* 10 节点:start · A1 受理 · A2 选型 · A3 寻源 · A4 定价 · A5 审批 · A6 议价 · A7 归档 · 双终点。
|
||||||
* 换行车道 y=190 G2J 右探 40 再降下来,横扫回左,落 A4 北口
|
|
||||||
* 带 1(y 310..350) A4 → A5 → G3 → A6 → G4 → end_won 定价 · 审批 · 议价 · 成交
|
|
||||||
* 卡点车道 y=250..280 两枚回 A4 的牌子同朝向(向上 = 回退)
|
|
||||||
* 带 2(y 410..450) A7 → end_arch 未成交闭环
|
|
||||||
*
|
|
||||||
* 注:工厂的参数序是 **col 在 row 前**(activityNode(..., col, row, x, y))。
|
|
||||||
*/
|
*/
|
||||||
nodes: [
|
nodes: [
|
||||||
{ id: 'start', kind: 'start', label: '客户RFQ询价', layout: { row: 0, col: 0, x: 30, y: 70 } },
|
{ id: 'start', kind: 'start', label: '客户RFQ询价', layout: { row: 0, col: 0, x: 30, y: 70 } },
|
||||||
activityNode('A1', '客户RFQ受理', 'rfq-intake', 'BD', 1, 0, 90, 60),
|
activityNode('A1', '客户RFQ受理', 'rfq-intake', 'BD', 1, 0, 110, 60),
|
||||||
gatewayNode('G1', '是否需要选型', '受理判定:该条是否要先选替代料(needAlternative)', 2, 0, 250, 60),
|
activityNode('A2', '替代选型', 'alt-selection', 'FAE', 2, 0, 290, 60),
|
||||||
activityNode('A2', '替代选型', 'alt-selection', 'FAE', 3, 0, 350, 60),
|
activityNode('A3', '寻源询价', 'sourcing-inquiry', 'PRM', 3, 0, 470, 60),
|
||||||
gatewayNode('G2', '是否需要寻源', '受理判定:该条是否要向渠道询底价(needSourcing)', 4, 0, 510, 60),
|
activityNode('A4', '成本定价', 'cost-pricing', 'BD', 4, 1, 110, 310),
|
||||||
activityNode('A3', '寻源询价', 'sourcing-inquiry', 'PRM', 5, 0, 610, 60),
|
|
||||||
joinNode('G2J', '寻源汇合', 6, 0, 770, 60),
|
|
||||||
activityNode('A4', '成本定价', 'cost-pricing', 'BD', 7, 1, 60, 310),
|
|
||||||
{
|
{
|
||||||
id: 'A5',
|
id: 'A5',
|
||||||
kind: 'approval',
|
kind: 'approval',
|
||||||
@@ -128,21 +83,18 @@ export const MVP_PACKAGE: ProcessPackage = processPackageSchema.parse({
|
|||||||
approver: { position: 'PM', strategy: 'sole' },
|
approver: { position: 'PM', strategy: 'sole' },
|
||||||
/*
|
/*
|
||||||
* 驳回走向声明式,不由临场决定:退回 A4 重新定价。
|
* 驳回走向声明式,不由临场决定:退回 A4 重新定价。
|
||||||
* 图上由 G3「审批结果」的 `verdict = "reject"` 出边**显式表达同一件事**,
|
* 图上由 A5 自己的 `verdict = "reject"` 条件出边**显式表达同一件事**,
|
||||||
* 而引擎现在是**先看图**(见 `onApprovalVerdict`):有这条边就走边,没有才退回本声明。
|
* 引擎先看图(有边走边,没边才退回本声明),两处须字字对齐 —— 有测试守着。
|
||||||
* 两处必须字字对齐 —— 有测试守着。本声明不能删:schema 必填,
|
* 本声明不能删:schema 必填,且它是通用机制(不是每条流都把驳回画成边)。
|
||||||
* 且它是通用机制(不是每个流程包都把驳回画成边)。
|
|
||||||
*/
|
*/
|
||||||
reject: { kind: 'reopen', nodeId: 'A4', mapping: REENTER_A4 },
|
reject: { kind: 'reopen', nodeId: 'A4', mapping: REENTER_A4 },
|
||||||
nudge: { steps: [{ after: 'PT20M', action: 'nudge' }], deadline: 'PT30M' },
|
nudge: { steps: [{ after: 'PT20M', action: 'nudge' }], deadline: 'PT30M' },
|
||||||
layout: { row: 1, col: 8, x: 240, y: 310 },
|
layout: { row: 1, col: 5, x: 290, y: 310 },
|
||||||
},
|
},
|
||||||
gatewayNode('G3', '审批结果', 'A5 裁决的去向:通过 / 不通过(verdict)—— 偏离底价 ≤±20% 才放行(底价门禁P-02)', 9, 1, 380, 310),
|
activityNode('A6', '报价议价', 'quote-negotiation', 'BD', 6, 1, 470, 310),
|
||||||
activityNode('A6', '报价议价', 'quote-negotiation', 'BD', 10, 1, 460, 310),
|
activityNode('A7', '情报归档', 'intel-archive', 'BD', 7, 2, 630, 410),
|
||||||
gatewayNode('G4', '议价结果', 'A6 办结的去向:成交 / 有异议 / 拒绝或超时(outcome)', 11, 1, 620, 310),
|
{ id: 'end_won', kind: 'end', label: '转订单履约', layout: { row: 1, col: 7, x: 630, y: 320 } },
|
||||||
activityNode('A7', '情报归档', 'intel-archive', 'BD', 12, 2, 590, 410),
|
{ id: 'end_arch', kind: 'end', label: '归档闭环', layout: { row: 2, col: 8, x: 790, y: 420 } },
|
||||||
{ id: 'end_won', kind: 'end', label: '转订单履约', layout: { row: 1, col: 12, x: 700, y: 320 } },
|
|
||||||
{ id: 'end_arch', kind: 'end', label: '归档闭环', layout: { row: 2, col: 13, x: 730, y: 420 } },
|
|
||||||
],
|
],
|
||||||
edges: [
|
edges: [
|
||||||
{
|
{
|
||||||
@@ -152,80 +104,73 @@ export const MVP_PACKAGE: ProcessPackage = processPackageSchema.parse({
|
|||||||
mapping: [
|
mapping: [
|
||||||
{ target: 'customerCode', source: { from: 'initiation', path: 'customerCode' } },
|
{ target: 'customerCode', source: { from: 'initiation', path: 'customerCode' } },
|
||||||
{ target: 'rfqRef', source: { from: 'initiation', path: 'rfqRef' } },
|
{ target: 'rfqRef', source: { from: 'initiation', path: 'rfqRef' } },
|
||||||
// 主题与正文是归一步唯一的原始素材:只给单号,模型没有可拆解的东西
|
|
||||||
{ target: 'subject', source: { from: 'initiation', path: 'subject' } },
|
{ target: 'subject', source: { from: 'initiation', path: 'subject' } },
|
||||||
{ target: 'body', source: { from: 'initiation', path: 'body' } },
|
{ target: 'body', source: { from: 'initiation', path: 'body' } },
|
||||||
{ target: 'quotedAt', source: { from: 'initiation', path: 'quotedAt' } },
|
{ target: 'quotedAt', source: { from: 'initiation', path: 'quotedAt' } },
|
||||||
],
|
],
|
||||||
reopen: false,
|
reopen: false,
|
||||||
},
|
},
|
||||||
{ id: 'e-a1-g1', from: 'A1', to: 'G1', mapping: [], label: '统一受理记录', reopen: false },
|
|
||||||
|
/* A1 的三条出边 —— 原 G1「是否需要选型」+ G2「是否需要寻源」在直达路径上的合并展开 */
|
||||||
{
|
{
|
||||||
id: 'e-g1-a2',
|
id: 'e-a1-a2',
|
||||||
from: 'G1',
|
from: 'A1',
|
||||||
to: 'A2',
|
to: 'A2',
|
||||||
condition: 'needAlternative = true',
|
condition: 'needAlternative = true',
|
||||||
label: '需要选型',
|
label: '需要选型',
|
||||||
mapping: [
|
mapping: [
|
||||||
{ target: 'material', source: { from: 'output-port', port: 'intake', path: 'pn' } },
|
{ target: 'material', source: { from: 'output-port', port: 'intake', path: 'pn' } },
|
||||||
// 选型完了还要不要寻源,这枚旗得跟着走 —— G2 在本路径上读的是 A2 的载荷
|
|
||||||
{ target: 'needSourcing', source: { from: 'output-port', port: 'intake', path: 'needSourcing' } },
|
{ target: 'needSourcing', source: { from: 'output-port', port: 'intake', path: 'needSourcing' } },
|
||||||
/*
|
|
||||||
* 询价单号也要带上:A2 办结时要把 `needSourcing` 回写「受理结论」那一行,
|
|
||||||
* 而那一行的主键就是询价单号。不带,A2 就只能另起一行(或写出无主键的行,
|
|
||||||
* 合并进正式版时被非空约束挡下)—— 去向便有了两个出处,G2 读哪个都不对。
|
|
||||||
*/
|
|
||||||
{ target: 'rfqRef', source: { from: 'initiation', path: 'rfqRef' } },
|
{ target: 'rfqRef', source: { from: 'initiation', path: 'rfqRef' } },
|
||||||
],
|
],
|
||||||
reopen: false,
|
reopen: false,
|
||||||
},
|
},
|
||||||
{ id: 'e-g1-g2', from: 'G1', to: 'G2', condition: 'needAlternative = false', label: '不需要选型', mapping: [], reopen: false },
|
|
||||||
{ id: 'e-a2-g2', from: 'A2', to: 'G2', mapping: [], label: '替代对标表', reopen: false },
|
|
||||||
{
|
{
|
||||||
id: 'e-g2-a3',
|
id: 'e-a1-a3',
|
||||||
from: 'G2',
|
from: 'A1',
|
||||||
to: 'A3',
|
to: 'A3',
|
||||||
condition: 'needSourcing = true',
|
condition: 'needAlternative = false and needSourcing = true',
|
||||||
label: '需要寻源',
|
label: '直接寻源',
|
||||||
mapping: [{ target: 'pn', source: { from: 'output-port', port: 'intake', path: 'pn' } }],
|
mapping: [{ target: 'pn', source: { from: 'output-port', port: 'intake', path: 'pn' } }],
|
||||||
reopen: false,
|
reopen: false,
|
||||||
},
|
},
|
||||||
|
// 默认兜底:不选型不寻源 → 直接定价(条件全不中时走它,旗齐时它就是第三种情形)
|
||||||
|
{ id: 'e-a1-a4', from: 'A1', to: 'A4', label: '直接定价', mapping: REENTER_A4, reopen: false },
|
||||||
|
|
||||||
|
/* A2 的两条出边 —— 原 G2 在选型路径上的那一问 */
|
||||||
{
|
{
|
||||||
id: 'e-g2-j',
|
id: 'e-a2-a3',
|
||||||
from: 'G2',
|
from: 'A2',
|
||||||
to: 'G2J',
|
to: 'A3',
|
||||||
condition: 'needSourcing = false',
|
condition: 'needSourcing = true',
|
||||||
label: '不需要寻源',
|
label: '仍需寻源',
|
||||||
mapping: [],
|
mapping: [{ target: 'pn', source: { from: 'output-port', port: 'intake', path: 'pn' } }],
|
||||||
reopen: false,
|
reopen: false,
|
||||||
},
|
},
|
||||||
{ id: 'e-a3-j', from: 'A3', to: 'G2J', mapping: [], label: '供应商底价表', reopen: false },
|
{ id: 'e-a2-a4', from: 'A2', to: 'A4', label: '选型后定价', mapping: REENTER_A4, reopen: false },
|
||||||
|
|
||||||
{
|
{
|
||||||
id: 'e-j-a4',
|
id: 'e-a3-a4',
|
||||||
from: 'G2J',
|
from: 'A3',
|
||||||
to: 'A4',
|
to: 'A4',
|
||||||
|
label: '供应商底价表',
|
||||||
mapping: [
|
mapping: [
|
||||||
...REENTER_A4,
|
...REENTER_A4,
|
||||||
// 底价只在寻源那条路上有;直通路径取不到即为空,A4 的 floors 非必填
|
// 底价只在寻源路径上有;A1/A2 直达的两条边不带它,A4 的 floors 非必填
|
||||||
{ target: 'floors', source: { from: 'output-port', port: 'compare', path: 'floors' } },
|
{ target: 'floors', source: { from: 'output-port', port: 'compare', path: 'floors' } },
|
||||||
],
|
],
|
||||||
reopen: false,
|
reopen: false,
|
||||||
},
|
},
|
||||||
{ id: 'e-a4-a5', from: 'A4', to: 'A5', mapping: [], label: '报价草案提审', reopen: false },
|
{ id: 'e-a4-a5', from: 'A4', to: 'A5', mapping: [], label: '报价草案提审', reopen: false },
|
||||||
/*
|
|
||||||
* 审批点 → 网关:**审批的两个去向都由图决定**(BPMN 的常规)。
|
/* A5 审批点自己的两条条件出边 —— 裁决(verdict)由引擎在裁决时放进载荷 */
|
||||||
* 判据 `verdict` 由引擎在裁决时放进载荷(`onApprovalVerdict`),不是这条边喂的常量 ——
|
|
||||||
* 喂常量能让闸过、让流跑,但那样 G3 的条件恒真、驳回边永不可达,网关就成了摆设。
|
|
||||||
*/
|
|
||||||
{ id: 'e-a5-g3', from: 'A5', to: 'G3', mapping: [], reopen: false },
|
|
||||||
{
|
{
|
||||||
id: 'e-g3-a6',
|
id: 'e-a5-a6',
|
||||||
from: 'G3',
|
from: 'A5',
|
||||||
to: 'A6',
|
to: 'A6',
|
||||||
condition: 'verdict = "pass"',
|
condition: 'verdict = "pass"',
|
||||||
label: '通过',
|
label: '通过',
|
||||||
tone: 'ok',
|
tone: 'ok',
|
||||||
// 原 e-a5-a6 的装配原样搬来:draft 口是 A4 落的,一直在 record.ports 里
|
|
||||||
mapping: [
|
mapping: [
|
||||||
{ target: 'rows', source: { from: 'output-port', port: 'draft', path: 'rows' } },
|
{ target: 'rows', source: { from: 'output-port', port: 'draft', path: 'rows' } },
|
||||||
{ target: 'quote_no', source: { from: 'output-port', port: 'draft', path: 'quote_no' } },
|
{ target: 'quote_no', source: { from: 'output-port', port: 'draft', path: 'quote_no' } },
|
||||||
@@ -234,25 +179,21 @@ export const MVP_PACKAGE: ProcessPackage = processPackageSchema.parse({
|
|||||||
reopen: false,
|
reopen: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'e-g3-a4',
|
id: 'e-a5-a4',
|
||||||
from: 'G3',
|
from: 'A5',
|
||||||
to: 'A4',
|
to: 'A4',
|
||||||
condition: 'verdict = "reject"',
|
condition: 'verdict = "reject"',
|
||||||
label: '不通过',
|
label: '不通过',
|
||||||
tone: 'bad',
|
tone: 'bad',
|
||||||
mapping: REENTER_A4,
|
mapping: REENTER_A4,
|
||||||
/*
|
// 回边:与 A5 的 reject 声明同一去向;reopen 必标,否则成环、拓扑序崩
|
||||||
* 回边:与 A5 的 `reject` 声明同一去向(回 A4 重开新实例),两处须一致。
|
|
||||||
* `reopen` 必须为 true —— 标 false 则 A4 有两条**并发**入边(G2J 与 G3),
|
|
||||||
* records / customerCode 同名双源,闭合校验按「汇合同名字段来源不明」拦下发布;
|
|
||||||
* 拓扑序也会成环,流程链会读反。
|
|
||||||
*/
|
|
||||||
reopen: true,
|
reopen: true,
|
||||||
},
|
},
|
||||||
{ id: 'e-a6-g4', from: 'A6', to: 'G4', mapping: [], label: '正式报价单', reopen: false },
|
|
||||||
|
/* A6 的三条条件出边 —— outcome 由放行选口给出(选择组恰选一口) */
|
||||||
{
|
{
|
||||||
id: 'e-g4-won',
|
id: 'e-a6-won',
|
||||||
from: 'G4',
|
from: 'A6',
|
||||||
to: 'end_won',
|
to: 'end_won',
|
||||||
condition: 'outcome = "won"',
|
condition: 'outcome = "won"',
|
||||||
label: '成交',
|
label: '成交',
|
||||||
@@ -261,25 +202,24 @@ export const MVP_PACKAGE: ProcessPackage = processPackageSchema.parse({
|
|||||||
reopen: false,
|
reopen: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'e-g4-a4',
|
id: 'e-a6-a4',
|
||||||
from: 'G4',
|
from: 'A6',
|
||||||
to: 'A4',
|
to: 'A4',
|
||||||
condition: 'outcome = "revise"',
|
condition: 'outcome = "revise"',
|
||||||
label: '有异议',
|
label: '有异议',
|
||||||
tone: 'bad',
|
tone: 'bad',
|
||||||
mapping: REENTER_A4,
|
mapping: REENTER_A4,
|
||||||
// 回边:人裁决后重开新任务实例(同节点、新任务 ID、留痕关联)
|
|
||||||
reopen: true,
|
reopen: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'e-g4-a7',
|
id: 'e-a6-a7',
|
||||||
from: 'G4',
|
from: 'A6',
|
||||||
to: 'A7',
|
to: 'A7',
|
||||||
condition: 'outcome = "lost"',
|
condition: 'outcome = "lost"',
|
||||||
label: '拒绝/超时',
|
label: '拒绝/超时',
|
||||||
tone: 'bad',
|
tone: 'bad',
|
||||||
mapping: [
|
mapping: [
|
||||||
// outcome 不是 formal 口声明的字段 —— 它由放行选口注入落地事实,随每个发射口的载荷同行
|
// outcome 由放行选口注入落地事实,随每个发射口的载荷同行(不是 formal 声明的字段)
|
||||||
{ target: 'outcome', source: { from: 'output-port', port: 'formal', path: 'outcome' } },
|
{ target: 'outcome', source: { from: 'output-port', port: 'formal', path: 'outcome' } },
|
||||||
{ target: 'quote_no', source: { from: 'output-port', port: 'formal', path: 'quote_no' } },
|
{ target: 'quote_no', source: { from: 'output-port', port: 'formal', path: 'quote_no' } },
|
||||||
{ target: 'customer_code', source: { from: 'output-port', port: 'formal', path: 'customer_code' } },
|
{ target: 'customer_code', source: { from: 'output-port', port: 'formal', path: 'customer_code' } },
|
||||||
@@ -291,9 +231,13 @@ export const MVP_PACKAGE: ProcessPackage = processPackageSchema.parse({
|
|||||||
],
|
],
|
||||||
variables: [],
|
variables: [],
|
||||||
/*
|
/*
|
||||||
* 手绘几何存证 —— 呈现以它为真相(不走自动布局)。
|
* 手绘几何存证 —— 呈现以它为真相。两带换行、零交叉:
|
||||||
* 几何是重排后的两带换行(见 nodes 上方的版式说明),不再逐点等于 MVP 的 SVG;
|
* 顶车道 y30:A1「直接寻源」跨过 A2 直达 A3(带上方,不碰任何框)
|
||||||
* 卡点是回跳的呈现(带 to,不画长线)。
|
* 带 0(y60) start → A1 → A2 → A3 受理 · 选型 · 寻源
|
||||||
|
* 换行车道 y190:A3 右探下折横扫回左,进 A4 北口
|
||||||
|
* 带 1(y310) A4 → A5 → A6 → end_won 定价 · 审批 · 议价 · 成交
|
||||||
|
* 带 2(y410) A7 → end_arch 未成交闭环
|
||||||
|
* 直达与回跳都用**卡点**表达(不画长线):A1/A2 的「直接定价」牌与 A5/A6 的回 A4 牌。
|
||||||
*/
|
*/
|
||||||
diagram: {
|
diagram: {
|
||||||
manual: true,
|
manual: true,
|
||||||
@@ -301,93 +245,63 @@ export const MVP_PACKAGE: ProcessPackage = processPackageSchema.parse({
|
|||||||
anchors: [],
|
anchors: [],
|
||||||
nodes: [
|
nodes: [
|
||||||
{ id: 'start', kind: 'start', label: '客户RFQ询价', x: 30, y: 70, lx: 44, ly: 104 },
|
{ id: 'start', kind: 'start', label: '客户RFQ询价', x: 30, y: 70, lx: 44, ly: 104 },
|
||||||
{ id: 'A1', kind: 'activity', label: '客户RFQ受理', code: 'A1', owner: 'BD', x: 90, y: 60 },
|
{ id: 'A1', kind: 'activity', label: '客户RFQ受理', code: 'A1', owner: 'BD', x: 110, y: 60 },
|
||||||
{ id: 'G1', kind: 'gateway', label: '是否需要选型', mode: 'x', x: 250, y: 60, lx: 270, ly: 112 },
|
{ id: 'A2', kind: 'activity', label: '替代选型', code: 'A2', owner: 'FAE', flavor: 'case', x: 290, y: 60 },
|
||||||
{ id: 'A2', kind: 'activity', label: '替代选型', code: 'A2', owner: 'FAE', flavor: 'case', x: 350, y: 60 },
|
{ id: 'A3', kind: 'activity', label: '寻源询价', code: 'A3', owner: 'PRM', flavor: 'case', x: 470, y: 60 },
|
||||||
// 旁注左偏:正下方 x=530 有「不需要寻源」的竖段穿过
|
{ id: 'A4', kind: 'activity', label: '成本定价', code: 'A4', owner: 'BD', x: 110, y: 310 },
|
||||||
{ id: 'G2', kind: 'gateway', label: '是否需要寻源', mode: 'x', x: 510, y: 60, lx: 480, ly: 112 },
|
{ id: 'A5', kind: 'activity', label: '定价审批', code: 'A5', owner: 'PM', flavor: 'approval', x: 290, y: 310 },
|
||||||
{ id: 'A3', kind: 'activity', label: '寻源询价', code: 'A3', owner: 'PRM', flavor: 'case', x: 610, y: 60 },
|
{ id: 'A6', kind: 'activity', label: '报价议价', code: 'A6', owner: 'BD', flavor: 'case', x: 470, y: 310 },
|
||||||
{ id: 'G2J', kind: 'gateway', label: '寻源汇合', mode: 'x', x: 770, y: 60, lx: 750, ly: 112 },
|
{ id: 'A7', kind: 'activity', label: '情报归档', code: 'A7', owner: 'BD', x: 630, y: 410 },
|
||||||
{ id: 'A4', kind: 'activity', label: '成本定价', code: 'A4', owner: 'BD', x: 60, y: 310 },
|
{ id: 'end_won', kind: 'end', label: '转订单履约', x: 630, y: 320, lx: 640, ly: 352 },
|
||||||
{ id: 'A5', kind: 'activity', label: '定价审批', code: 'A5', owner: 'PM', flavor: 'approval', x: 240, y: 310 },
|
{ id: 'end_arch', kind: 'end-bad', label: '归档闭环', x: 790, y: 420, lx: 800, ly: 452 },
|
||||||
{ id: 'G3', kind: 'gateway', label: '审批结果', mode: 'x', x: 380, y: 310, lx: 400, ly: 368 },
|
/* 四枚卡点:直达两枚(正向,语义边真实存在)、回跳两枚 —— 全在各自源节点的上下车道 */
|
||||||
{ id: 'A6', kind: 'activity', label: '报价议价', code: 'A6', owner: 'BD', flavor: 'case', x: 460, y: 310 },
|
{ id: 'c_d1', kind: 'callout', label: '直接定价', to: 'A4', x: 110, y: 170 },
|
||||||
// 旁注斜下:G4 四个口全占着线
|
{ id: 'c_d2', kind: 'callout', label: '选型后定价', to: 'A4', x: 290, y: 170 },
|
||||||
{ id: 'G4', kind: 'gateway', label: '议价结果', mode: 'x', x: 620, y: 310, lx: 590, ly: 368 },
|
{ id: 'c_reject', kind: 'callout', label: '退回调整', to: 'A4', x: 290, y: 240 },
|
||||||
{ id: 'A7', kind: 'activity', label: '情报归档', code: 'A7', owner: 'BD', x: 590, y: 410 },
|
{ id: 'c_revise', kind: 'callout', label: '返回调整', to: 'A4', x: 470, y: 240 },
|
||||||
{ id: 'end_won', kind: 'end', label: '转订单履约', x: 700, y: 320, lx: 710, ly: 352 },
|
|
||||||
{ id: 'end_arch', kind: 'end-bad', label: '归档闭环', x: 730, y: 420, lx: 740, ly: 452 },
|
|
||||||
// 两枚回 A4 的牌子同一条车道、同朝向(向上 = 回退):G3 上方与 G4 上方
|
|
||||||
{ id: 'c_reject', kind: 'callout', label: '退回调整', to: 'A4', x: 350, y: 250 },
|
|
||||||
{ id: 'c_revise', kind: 'callout', label: '返回调整', to: 'A4', x: 590, y: 250 },
|
|
||||||
],
|
],
|
||||||
edges: [
|
edges: [
|
||||||
{ from: 'start', to: 'A1', points: [{ x: 50, y: 80 }, { x: 90, y: 80 }] },
|
{ from: 'start', to: 'A1', points: [{ x: 50, y: 80 }, { x: 110, y: 80 }] },
|
||||||
{ from: 'A1', to: 'G1', label: '统一受理记录', points: [{ x: 190, y: 80 }, { x: 250, y: 80 }] },
|
{ from: 'A1', to: 'A2', label: '需要选型', points: [{ x: 210, y: 80 }, { x: 290, y: 80 }] },
|
||||||
{ from: 'G1', to: 'A2', label: '需要选型', points: [{ x: 290, y: 80 }, { x: 350, y: 80 }] },
|
// 直接寻源走顶车道 y30(A1 北口 → A3 北口):画布保存只认画出来的边,这条不画就会丢
|
||||||
// 不需要选型:从 G1 北口翻过 A2 头顶(y=20 车道)
|
|
||||||
{
|
{
|
||||||
from: 'G1',
|
from: 'A1',
|
||||||
to: 'G2',
|
to: 'A3',
|
||||||
label: '不需要选型',
|
label: '直接寻源',
|
||||||
points: [{ x: 270, y: 60 }, { x: 270, y: 20 }, { x: 530, y: 20 }, { x: 530, y: 60 }],
|
|
||||||
},
|
|
||||||
{ from: 'A2', to: 'G2', label: '替代对标表', points: [{ x: 450, y: 80 }, { x: 510, y: 80 }] },
|
|
||||||
{ from: 'G2', to: 'A3', label: '需要寻源', points: [{ x: 550, y: 80 }, { x: 610, y: 80 }] },
|
|
||||||
// 不需要寻源:从 G2 南口穿过 A3 脚下(y=150 车道)扎进 G2J 南口
|
|
||||||
{
|
|
||||||
from: 'G2',
|
|
||||||
to: 'G2J',
|
|
||||||
label: '不需要寻源',
|
|
||||||
points: [{ x: 530, y: 100 }, { x: 530, y: 150 }, { x: 790, y: 150 }, { x: 790, y: 100 }],
|
|
||||||
},
|
|
||||||
{ from: 'A3', to: 'G2J', label: '供应商底价表', points: [{ x: 710, y: 80 }, { x: 770, y: 80 }] },
|
|
||||||
// 换行那一笔:右探 40 → 降到 190 车道 → 横扫回左 → 落 A4 北口
|
|
||||||
{
|
|
||||||
from: 'G2J',
|
|
||||||
to: 'A4',
|
|
||||||
points: [
|
points: [
|
||||||
{ x: 810, y: 80 },
|
{ x: 160, y: 60 },
|
||||||
{ x: 850, y: 80 },
|
{ x: 160, y: 30 },
|
||||||
{ x: 850, y: 190 },
|
{ x: 520, y: 30 },
|
||||||
{ x: 110, y: 190 },
|
{ x: 520, y: 60 },
|
||||||
{ x: 110, y: 310 },
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{ from: 'A4', to: 'A5', label: '报价草案提审', points: [{ x: 160, y: 330 }, { x: 240, y: 330 }] },
|
{ from: 'A2', to: 'A3', label: '仍需寻源', points: [{ x: 390, y: 80 }, { x: 470, y: 80 }] },
|
||||||
{ from: 'A5', to: 'G3', points: [{ x: 340, y: 330 }, { x: 380, y: 330 }] },
|
// 换行那一笔:A3 右探 → 降到 190 车道 → 横扫回左 → 落 A4 北口
|
||||||
{ from: 'G3', to: 'A6', label: '通过', tone: 'ok', points: [{ x: 420, y: 330 }, { x: 460, y: 330 }] },
|
|
||||||
// 驳回:卡点(不画长线);语义边 e-g3-a4 在包里,存盘会被 mergeGraphIntoPackage 认回
|
|
||||||
{
|
{
|
||||||
from: 'G3',
|
from: 'A3',
|
||||||
to: 'c_reject',
|
to: 'A4',
|
||||||
label: '不通过',
|
label: '供应商底价表',
|
||||||
tone: 'bad',
|
// 标注钉在 y190 车道的空档(x390–610)—— 默认取折线中点,会被「选型后定价→A4」卡点压住
|
||||||
points: [{ x: 400, y: 310 }, { x: 400, y: 280 }],
|
lx: 450,
|
||||||
lx: 370,
|
ly: 183,
|
||||||
ly: 296,
|
points: [
|
||||||
|
{ x: 570, y: 80 },
|
||||||
|
{ x: 610, y: 80 },
|
||||||
|
{ x: 610, y: 190 },
|
||||||
|
{ x: 160, y: 190 },
|
||||||
|
{ x: 160, y: 310 },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{ from: 'A6', to: 'G4', label: '正式报价单', points: [{ x: 560, y: 330 }, { x: 620, y: 330 }] },
|
// 直达两枚卡点(正向):不选不寻 → 直接定价;选完不寻 → 定价
|
||||||
{ from: 'G4', to: 'end_won', label: '成交', tone: 'ok', points: [{ x: 660, y: 330 }, { x: 700, y: 330 }] },
|
{ from: 'A1', to: 'c_d1', label: '不选不寻', points: [{ x: 160, y: 100 }, { x: 160, y: 170 }] },
|
||||||
{
|
{ from: 'A2', to: 'c_d2', label: '不再寻源', points: [{ x: 340, y: 100 }, { x: 340, y: 170 }] },
|
||||||
from: 'G4',
|
{ from: 'A4', to: 'A5', label: '报价草案提审', points: [{ x: 210, y: 330 }, { x: 290, y: 330 }] },
|
||||||
to: 'c_revise',
|
{ from: 'A5', to: 'A6', label: '通过', tone: 'ok', points: [{ x: 390, y: 330 }, { x: 470, y: 330 }] },
|
||||||
label: '有异议',
|
{ from: 'A5', to: 'c_reject', label: '不通过', tone: 'bad', points: [{ x: 340, y: 310 }, { x: 340, y: 270 }], lx: 310, ly: 292 },
|
||||||
tone: 'bad',
|
{ from: 'A6', to: 'end_won', label: '成交', tone: 'ok', points: [{ x: 570, y: 330 }, { x: 630, y: 330 }] },
|
||||||
points: [{ x: 640, y: 310 }, { x: 640, y: 280 }],
|
{ from: 'A6', to: 'c_revise', label: '有异议', tone: 'bad', points: [{ x: 520, y: 310 }, { x: 520, y: 270 }], lx: 545, ly: 292 },
|
||||||
lx: 610,
|
{ from: 'A6', to: 'A7', label: '拒绝/超时', tone: 'bad', points: [{ x: 520, y: 350 }, { x: 520, y: 430 }, { x: 630, y: 430 }], lx: 545, ly: 388 },
|
||||||
ly: 296,
|
{ from: 'A7', to: 'end_arch', label: '归档闭环', points: [{ x: 730, y: 430 }, { x: 790, y: 430 }] },
|
||||||
},
|
|
||||||
{
|
|
||||||
from: 'G4',
|
|
||||||
to: 'A7',
|
|
||||||
label: '拒绝/超时',
|
|
||||||
tone: 'bad',
|
|
||||||
points: [{ x: 640, y: 350 }, { x: 640, y: 410 }],
|
|
||||||
lx: 670,
|
|
||||||
ly: 380,
|
|
||||||
},
|
|
||||||
{ from: 'A7', to: 'end_arch', label: '归档闭环', points: [{ x: 690, y: 430 }, { x: 730, y: 430 }] },
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -25,10 +25,16 @@
|
|||||||
被依赖: trigger, app(治理台 · 工作流管理)
|
被依赖: trigger, app(治理台 · 工作流管理)
|
||||||
|
|
||||||
不变量(OS 03 / 3.2):
|
不变量(OS 03 / 3.2):
|
||||||
- **不闭合不得保存**:未完成边、必填未映射、类型冲突、孤立节点、异或出边缺条件、
|
- **画图不检查,激活才查完整**(产品决策 2026-07-28):`savePackage` 不跑闭合校验,
|
||||||
汇合同名字段来源不明、容忍分支被下游必填依赖 —— 任一即 `closed = false`,`savePackage` 抛 `NotClosedError`
|
随手画的半成品也存得进来(存出来即 `retired`,不生效);`setPackageState` 激活时
|
||||||
- **严格检查 + 保存即生效,没有发布机制**(产品决策 2026-07-28):
|
跑 `checkClosure`,不闭合抛 `NotClosedError`(HTTP 412 带整份报告)。
|
||||||
没有草稿态、没有发布门。保存 = 存为新版 + 即刻生效。
|
违规项:未完成边、必填未映射、类型冲突、孤立节点、多默认出边、含网关、
|
||||||
|
容忍分支被下游必填依赖 —— 任一即 `closed = false`,激活被拒。
|
||||||
|
- **无网关**(产品决策 2026-07-28):分支 = 源节点的多条条件出边(恰取一条,
|
||||||
|
无条件边作默认兜底、至多一条),汇合 = 多入边异或(上游互斥,只会来一条)。
|
||||||
|
schema 仍收 `kind: 'gateway'` 只为读历史版本 —— 在途工作流照走(运行时兼容),
|
||||||
|
但含网关的定义激活即 `gateway-deprecated` 违规,**仅可读,不可激活**。
|
||||||
|
AND 并行暂无声明机制,将来以「并行组」加回(对应 Mastra `.parallel`,见 debt.md)。
|
||||||
- **一条流恰一个生效版本**(产品决策 2026-07-28):`setPackageState` 激活即独占
|
- **一条流恰一个生效版本**(产品决策 2026-07-28):`setPackageState` 激活即独占
|
||||||
(同流其余版本一并停用);停用生效版 = 整条流下线,新起单被拒。
|
(同流其余版本一并停用);停用生效版 = 整条流下线,新起单被拒。
|
||||||
起单取**生效版**;在途工作流按启动时钉住的版本号读定义 —— 启停对它们零影响。
|
起单取**生效版**;在途工作流按启动时钉住的版本号读定义 —— 启停对它们零影响。
|
||||||
@@ -45,10 +51,12 @@
|
|||||||
|
|
||||||
其它不变量:
|
其它不变量:
|
||||||
- **流转零 LLM**:选边与条件求值全部经 `@sfeel`;判定依据入事件记录
|
- **流转零 LLM**:选边与条件求值全部经 `@sfeel`;判定依据入事件记录
|
||||||
- **XOR 恰取一条**:条件命中优先,无条件的边作默认分支兜底;
|
- **多出边一律异或,不分节点种类**:条件命中优先(按声明序),无条件的边作默认兜底;
|
||||||
一条都没中而该节点确有出边 = **死路**,发 `route-dead-end` 事件
|
一条都没中而该节点确有出边 = **死路**,发 `route-dead-end` 事件
|
||||||
(哪个节点、各出边的条件、判据里当时有哪些键 —— 只记键名不记值)
|
(哪个节点、各出边的条件、判据里当时有哪些键 —— 只记键名不记值)。
|
||||||
- **AND 汇合要回齐**:未回齐就不进汇合节点;容忍分支以「已消化」计,不阻汇合
|
审批点的裁决(`verdict`)由引擎注入判据,两个去向就是它自己的两条条件出边
|
||||||
|
- **异或汇合不等**(`joinReady`):互斥分支结构上只会来一条,等齐 = 等一个不可能
|
||||||
|
到来的分支,流会无声卡死;AND 回齐逻辑仅剩历史版本的并行网关在用,容忍分支以「已消化」计
|
||||||
- **流程层不自动重试活动**(过程内重试归 Harness);
|
- **流程层不自动重试活动**(过程内重试归 Harness);
|
||||||
流级重做一律人裁决后**重开新任务实例**
|
流级重做一律人裁决后**重开新任务实例**
|
||||||
- **驳回走向声明式**:审批点的驳回按 `reject` 声明回指定节点重开新实例,不由临场决定
|
- **驳回走向声明式**:审批点的驳回按 `reject` 声明回指定节点重开新实例,不由临场决定
|
||||||
|
|||||||
@@ -126,7 +126,11 @@ describe('checkClosure —— 不闭合不得激活', () => {
|
|||||||
expect(violations.filter((v) => v.kind === 'dangling-node').length).toBeGreaterThan(0);
|
expect(violations.filter((v) => v.kind === 'dangling-node').length).toBeGreaterThan(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('异或网关的出边必须有条件 —— 声明式、静态可检', () => {
|
/*
|
||||||
|
* 网关已废除(2026-07-28):含网关的定义一律违规 —— 历史版本仅可读,不可激活。
|
||||||
|
* 分支改由源节点的条件出边表达,见下一用例。
|
||||||
|
*/
|
||||||
|
it('网关节点即违规 —— gateway-deprecated,历史版本不可激活', () => {
|
||||||
const withGateway = pkg({
|
const withGateway = pkg({
|
||||||
nodes: [
|
nodes: [
|
||||||
...pkg().nodes,
|
...pkg().nodes,
|
||||||
@@ -136,11 +140,32 @@ describe('checkClosure —— 不闭合不得激活', () => {
|
|||||||
...pkg().edges,
|
...pkg().edges,
|
||||||
{ id: 'g1', from: 'A4' as never, to: 'G2' as never, mapping: [], reopen: false },
|
{ id: 'g1', from: 'A4' as never, to: 'G2' as never, mapping: [], reopen: false },
|
||||||
{ id: 'g2', from: 'G2' as never, to: 'end' as never, mapping: [], reopen: false },
|
{ id: 'g2', from: 'G2' as never, to: 'end' as never, mapping: [], reopen: false },
|
||||||
{ id: 'g3', from: 'G2' as never, to: 'end' as never, mapping: [], reopen: false },
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
const violations = checkClosure({ pkg: withGateway, contracts, positions }).violations;
|
const violations = checkClosure({ pkg: withGateway, contracts, positions }).violations;
|
||||||
expect(violations.some((v) => v.message.includes('缺条件'))).toBe(true);
|
expect(violations.filter((v) => v.kind === 'gateway-deprecated').map((v) => v.nodeId)).toEqual(['G2']);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('多出边异或分支:两条无条件出边 = 都想当默认 —— multi-default-edge', () => {
|
||||||
|
const twoDefaults = pkg({
|
||||||
|
nodes: [...pkg().nodes, { id: 'end2' as never, kind: 'end', label: '另一终点' }],
|
||||||
|
edges: [
|
||||||
|
...pkg().edges,
|
||||||
|
// A4 已有一条无条件出边 A4→end;再加一条无条件出边即违规
|
||||||
|
{ id: 'e9', from: 'A4' as never, to: 'end2' as never, mapping: [], reopen: false },
|
||||||
|
],
|
||||||
|
});
|
||||||
|
const violations = checkClosure({ pkg: twoDefaults, contracts, positions }).violations;
|
||||||
|
expect(violations.filter((v) => v.kind === 'multi-default-edge').map((v) => v.nodeId)).toEqual(['A4']);
|
||||||
|
|
||||||
|
// 其中一条补上条件即闭合 —— 条件命中优先,无条件边只作默认兜底
|
||||||
|
const oneDefault = pkg({
|
||||||
|
nodes: twoDefaults.nodes,
|
||||||
|
edges: twoDefaults.edges.map((e) => (e.id === 'e9' ? { ...e, condition: 'ok = true' } : e)),
|
||||||
|
});
|
||||||
|
expect(
|
||||||
|
checkClosure({ pkg: oneDefault, contracts, positions }).violations.filter((v) => v.kind === 'multi-default-edge'),
|
||||||
|
).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('容忍分支的输出不得被下游必填依赖', () => {
|
it('容忍分支的输出不得被下游必填依赖', () => {
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
* 「**连线即映射,画图即校验,不闭合不得保存。**
|
* 「**连线即映射,画图即校验,不闭合不得保存。**
|
||||||
* 连一条边即须完成该边映射(必填未映射 = 边未完成),类型兼容依两端契约 schema 当场校验;
|
* 连一条边即须完成该边映射(必填未映射 = 边未完成),类型兼容依两端契约 schema 当场校验;
|
||||||
* 存在未完成边、未满足必填或类型冲突的流程包**存不进来**。
|
* 存在未完成边、未满足必填或类型冲突的流程包**存不进来**。
|
||||||
* AND 汇合后的同名字段必须**显式指定来源分支**,不做隐式合并。」
|
* 多出边即异或分支(恰取一条,默认兜底至多一条);多入边即异或汇合。」
|
||||||
|
*
|
||||||
|
* 网关已废除(2026-07-28):schema 仍收 gateway 只为读历史 —— 见 checkGateway。
|
||||||
*
|
*
|
||||||
* 原文是「可存草稿、不得发布」——**已不成立**:没有草稿态也没有发布门,
|
* 原文是「可存草稿、不得发布」——**已不成立**:没有草稿态也没有发布门,
|
||||||
* 闸落在保存上(严格检查 + 保存即生效)。画布上的半成品留在浏览器里,存不进库。
|
* 闸落在保存上(严格检查 + 保存即生效)。画布上的半成品留在浏览器里,存不进库。
|
||||||
@@ -69,6 +71,24 @@ export function checkClosure(input: ClosureInput): ClosureReport {
|
|||||||
if (node.kind === 'gateway') {
|
if (node.kind === 'gateway') {
|
||||||
violations.push(...checkGateway(node, incoming.get(node.id) ?? [], outgoing.get(node.id) ?? []));
|
violations.push(...checkGateway(node, incoming.get(node.id) ?? [], outgoing.get(node.id) ?? []));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 多出边 = 异或分支(恰取一条):条件命中优先,无条件边作默认兜底。
|
||||||
|
* 默认兜底**至多一条** —— 两条无条件出边就是「都想当默认」,运行时按声明序
|
||||||
|
* 静默取先者,另一条永远走不到:图上画着、结构上死路,必须在定义期拦下。
|
||||||
|
* 条件不必全覆盖(全不中走默认;连默认都没有则运行时报 route-dead-end)。
|
||||||
|
*/
|
||||||
|
const outs = outgoing.get(node.id) ?? [];
|
||||||
|
if (outs.length > 1) {
|
||||||
|
const defaults = outs.filter((e) => e.condition === undefined || e.condition.trim() === '');
|
||||||
|
if (defaults.length > 1) {
|
||||||
|
violations.push({
|
||||||
|
kind: 'multi-default-edge',
|
||||||
|
nodeId: node.id,
|
||||||
|
message: `节点「${node.label}」有 ${defaults.length} 条无条件出边 —— 默认兜底至多一条,其余必须带条件`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
violations.push(...checkTolerateDependencies(pkg, contracts, byId));
|
violations.push(...checkTolerateDependencies(pkg, contracts, byId));
|
||||||
@@ -139,22 +159,12 @@ function checkActivityNode(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// AND 汇合后的同名字段必须显式指定来源分支,不做隐式合并。
|
/*
|
||||||
// 回边(reopen)是**重新入场**不是并发汇合 —— 不参与此判定(OS 03 失败走向 / 议价回环)。
|
* 多入边**不再判「隐式合并」**(产品决策 2026-07-28:网关去节点化)。
|
||||||
const concurrent = inbound.filter((e) => !e.reopen);
|
* 多入边即异或汇合:上游是互斥的条件分支,结构上只会来一条,同名映射天然无歧义 ——
|
||||||
const targets = concurrent.flatMap((e) => e.mapping.map((m) => m.target));
|
* 从前为绕开这条禁令而生的显式汇合点(G2J 之类)正是被删掉的东西。
|
||||||
const seen = new Set<string>();
|
* AND 并行没有声明机制,不存在「并发汇合」;将来加「并行组」时再回来立汇合规则。
|
||||||
for (const target of targets) {
|
*/
|
||||||
if (seen.has(target) && concurrent.length > 1) {
|
|
||||||
out.push({
|
|
||||||
kind: 'join-ambiguous-source',
|
|
||||||
nodeId: node.id,
|
|
||||||
field: target,
|
|
||||||
message: `汇合处字段 ${target} 有多个来源分支,须显式指定 —— 不做隐式合并`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
seen.add(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
@@ -164,22 +174,21 @@ function checkGateway(
|
|||||||
inbound: readonly Edge[],
|
inbound: readonly Edge[],
|
||||||
outbound: readonly Edge[],
|
outbound: readonly Edge[],
|
||||||
): ClosureViolation[] {
|
): ClosureViolation[] {
|
||||||
const out: ClosureViolation[] = [];
|
void inbound;
|
||||||
if (node.mode === 'fork' && outbound.length < 2) {
|
void outbound;
|
||||||
out.push({ kind: 'gateway-unbalanced', nodeId: node.id, message: `分叉网关「${node.label}」出边少于两条` });
|
/*
|
||||||
}
|
* **网关已废除**(产品决策 2026-07-28):分支 = 源节点的条件出边,汇合 = 多入边异或。
|
||||||
if (node.mode === 'join' && inbound.length < 2) {
|
* schema 仍收 gateway 只为**读历史版本** —— 在途工作流照走(运行时兼容),
|
||||||
out.push({ kind: 'gateway-unbalanced', nodeId: node.id, message: `汇合网关「${node.label}」入边少于两条` });
|
* 但含网关的定义不再可激活:这里判违规,激活闸(不闭合不得激活)就会拦下。
|
||||||
}
|
* 想复用旧图,在生效版上把网关的出边改画成源活动的条件出边即可。
|
||||||
// XOR 的每条出边必须有条件(声明式、静态可检,不得内嵌自由逻辑)
|
*/
|
||||||
if (node.gateway === 'exclusive' && node.mode === 'fork') {
|
return [
|
||||||
for (const edge of outbound) {
|
{
|
||||||
if (edge.condition === undefined || edge.condition.trim() === '') {
|
kind: 'gateway-deprecated',
|
||||||
out.push({ kind: 'edge-unmapped', edgeId: edge.id, nodeId: node.id, message: `异或网关的出边 ${edge.id} 缺条件` });
|
nodeId: node.id,
|
||||||
}
|
message: `网关「${node.label}」已废除 —— 把分支写成上游节点的条件出边(历史版本仅可读,不可激活)`,
|
||||||
}
|
},
|
||||||
}
|
];
|
||||||
return out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -75,16 +75,27 @@ export function selectEdges(
|
|||||||
const node = pkg.nodes.find((n) => n.id === fromNodeId);
|
const node = pkg.nodes.find((n) => n.id === fromNodeId);
|
||||||
const outgoing = pkg.edges.filter((e) => e.from === fromNodeId);
|
const outgoing = pkg.edges.filter((e) => e.from === fromNodeId);
|
||||||
|
|
||||||
if (node?.kind === 'gateway' && node.gateway === 'exclusive' && node.mode === 'fork') {
|
/*
|
||||||
// 判定依据入事件记录;无条件的边作默认分支兜底
|
* **多出边一律异或,不分节点种类**(产品决策 2026-07-28:网关去节点化)。
|
||||||
|
*
|
||||||
|
* 分支不再是网关节点的专利 —— 活动/审批点自己的多条条件出边就是分支,
|
||||||
|
* 判据读的是它自己的出参(与 Mastra 的 `.branch` 同构:条件挂在步与步之间)。
|
||||||
|
* 语义与从前的异或网关逐字相同:条件命中优先(按声明序),无条件边作默认兜底,
|
||||||
|
* 恰取一条。并行(AND)没有节点了也没有声明机制 —— 要并行时以「并行组」声明加回
|
||||||
|
* (对应 Mastra 的 `.parallel` 结构块),见债务簿。
|
||||||
|
*
|
||||||
|
* 遗留的网关节点(历史版本里还有)走同一条逻辑 —— 异或网关的语义本来就是这个;
|
||||||
|
* 并行网关分叉的「全发」不再支持,历史包若有,激活时已被闭合校验拦下。
|
||||||
|
*/
|
||||||
|
if (outgoing.length <= 1) {
|
||||||
|
// 并行网关的遗留直通不受损:单出边不判条件,原样走
|
||||||
|
void node;
|
||||||
|
return outgoing;
|
||||||
|
}
|
||||||
const hit = outgoing.find((e) => e.condition !== undefined && evaluate(e.condition, scope));
|
const hit = outgoing.find((e) => e.condition !== undefined && evaluate(e.condition, scope));
|
||||||
const fallback = outgoing.find((e) => e.condition === undefined);
|
const fallback = outgoing.find((e) => e.condition === undefined);
|
||||||
const chosen = hit ?? fallback;
|
const chosen = hit ?? fallback;
|
||||||
return chosen === undefined ? [] : [chosen];
|
return chosen === undefined ? [] : [chosen];
|
||||||
}
|
|
||||||
|
|
||||||
// 并行网关分叉、活动节点、审批点:全部出边
|
|
||||||
return outgoing;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ export function BlueprintHome({ nav }: HomeProps) {
|
|||||||
const packages = pkgs.data?.packages ?? [];
|
const packages = pkgs.data?.packages ?? [];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 没有「草稿」也没有「未闭合」可数了 —— 严格检查 + 保存即生效:不闭合的包**存不进来**。
|
* 「未闭合」不值得单摆一个计数 —— 画图不检查,半成品版本本来就该存在;
|
||||||
* 硬摆这两个计数就是摆两个恒为 0 的假指标。改数真能说话的:每条流有几版、最新是第几版。
|
* 激活才查完整,异常在包详情的看板里逐条看。这里改数真能说话的:每条流有几版。
|
||||||
*/
|
*/
|
||||||
const flowCount = new Set(packages.map((p) => p.id)).size;
|
const flowCount = new Set(packages.map((p) => p.id)).size;
|
||||||
const activities = acts.data?.activities ?? [];
|
const activities = acts.data?.activities ?? [];
|
||||||
@@ -73,7 +73,7 @@ export function BlueprintHome({ nav }: HomeProps) {
|
|||||||
</span>
|
</span>
|
||||||
<span className="g-chain-v">{flowCount}</span>
|
<span className="g-chain-v">{flowCount}</span>
|
||||||
<span className="g-chain-h">
|
<span className="g-chain-h">
|
||||||
企业以哪些流转运转 —— 共 {packages.length} 个版本,保存即生效
|
企业以哪些流转运转 —— 共 {packages.length} 个版本,恰一个生效版
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
<span className="g-chain-arr">
|
<span className="g-chain-arr">
|
||||||
|
|||||||
@@ -66,9 +66,9 @@ export function CockpitHome({ nav }: HomeProps) {
|
|||||||
sub="失败走向未消化,待人工处置"
|
sub="失败走向未消化,待人工处置"
|
||||||
/>
|
/>
|
||||||
{/*
|
{/*
|
||||||
* 「未闭合草稿」这张卡撤了 —— 严格检查 + 保存即生效之后,不闭合的包**存不进来**,
|
* 「未闭合草稿」这张卡撤了 —— 未闭合是**定义面**的常态(画图不检查,激活才查),
|
||||||
* 这个数结构上恒为 0。摆一个永远是 0 的卡位就是在占地方装样子。
|
* 归流程包详情的异常看板管,不是运营指标。
|
||||||
* 天然的第三张是「死路」(网关一条边都判不中而卡住的流,已有 route-dead-end 事件),
|
* 天然的第三张是「死路」(条件出边一条都判不中而卡住的流,已有 route-dead-end 事件),
|
||||||
* 但那需要一条按事件类型聚合的查询路由 —— 没有之前不摆(同死信卡的规矩)。
|
* 但那需要一条按事件类型聚合的查询路由 —— 没有之前不摆(同死信卡的规矩)。
|
||||||
*/}
|
*/}
|
||||||
<Kpi ico="activity" tone="brand" label="在途任务" value={running} sub="尚未落终态的任务" />
|
<Kpi ico="activity" tone="brand" label="在途任务" value={running} sub="尚未落终态的任务" />
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* feature `gov-process` 唯一出口(编码规范 §9.1)。
|
* feature `gov-process` 唯一出口(编码规范 §9.1)。
|
||||||
* 流程包编排画布(diagram-js 画布件平移):连线即映射、画图即校验、不闭合不得发布
|
* 流程包编排画布(diagram-js 画布件平移):连线即映射;画图不检查,激活才查完整
|
||||||
*/
|
*/
|
||||||
export { WorkflowsHome, PkgPage } from './internal/panel.tsx';
|
export { WorkflowsHome, PkgPage } from './internal/panel.tsx';
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* 图下是节点属性,再往下才是声明式的契约细节(调用接口 · 边映射 · 触发器)。
|
* 图下是节点属性,再往下才是声明式的契约细节(调用接口 · 边映射 · 触发器)。
|
||||||
*
|
*
|
||||||
* 版本是**运行时开关**,不是发布流程:
|
* 版本是**运行时开关**,不是发布流程:
|
||||||
* · 保存 = 严格检查 + 存为新版 + 即刻生效(不闭合存不进来)
|
* · 画图不检查:保存 = 存为新版,**不生效**;激活才跑闭合校验(异常清零方可)
|
||||||
* · 一条流恰一个生效版本;可把生效切回旧版,也可全部停用让整条流下线
|
* · 一条流恰一个生效版本;可把生效切回旧版,也可全部停用让整条流下线
|
||||||
* · 在途工作流按启动时钉住的版本跑完 —— 启停对它们零影响
|
* · 在途工作流按启动时钉住的版本跑完 —— 启停对它们零影响
|
||||||
*/
|
*/
|
||||||
@@ -95,13 +95,15 @@ function OverviewHome() {
|
|||||||
label="边闭合率"
|
label="边闭合率"
|
||||||
value={totalEdges === 0 ? 100 : Math.round((closedEdges / totalEdges) * 100)}
|
value={totalEdges === 0 ? 100 : Math.round((closedEdges / totalEdges) * 100)}
|
||||||
unit="%"
|
unit="%"
|
||||||
sub="不闭合存不进来"
|
sub="不闭合不得激活"
|
||||||
/>
|
/>
|
||||||
<Kpi ico="boxes" label="编排要素" value="五种" sub="活动 · 审批 · 网关 · 触发器 · 流程包" />
|
{/* 网关已废除:分支 = 条件出边,不再是一种要素 */}
|
||||||
|
<Kpi ico="boxes" label="编排要素" value="四种" sub="活动 · 审批 · 触发器 · 流程包" />
|
||||||
</div>
|
</div>
|
||||||
<Note>
|
<Note>
|
||||||
保存即生效:严格检查过了才存得进来,存下来即刻对<b>新起的</b>工作流生效;
|
画图不检查,激活才查完整:随手画的都存得下(存出来不生效),异常清零后激活,
|
||||||
在途的按启动时版本跑完。要回退,去流程包里把生效切回旧版本 —— 一条流一次只有一个生效版本。
|
即刻对<b>新起的</b>工作流生效;在途的按启动时版本跑完。要回退,把生效切回旧版本 ——
|
||||||
|
一条流一次只有一个生效版本。
|
||||||
</Note>
|
</Note>
|
||||||
</QueryGate>
|
</QueryGate>
|
||||||
);
|
);
|
||||||
@@ -111,7 +113,7 @@ function OverviewHome() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 新建的流程 = 一张**最小可生效**的图:开始 → 结束。
|
* 新建的流程 = 一张**最小可生效**的图:开始 → 结束。
|
||||||
* 空图也要过闭合校验(不闭合存不进来),这张最小图天然闭合 —— 建出来就能起单
|
* 激活要过闭合校验,这张最小图天然闭合,建完即激活 —— 建出来就能起单
|
||||||
* (起了直接走完,没业务意义,但机制是通的);进详情画上活动再存,即成下一版。
|
* (起了直接走完,没业务意义,但机制是通的);进详情画上活动再存,即成下一版。
|
||||||
*/
|
*/
|
||||||
function minimalFlow(id: string, name: string): ProcessPackage {
|
function minimalFlow(id: string, name: string): ProcessPackage {
|
||||||
@@ -146,10 +148,20 @@ function FlowShelf({ nav }: { nav: Nav }) {
|
|||||||
const idTaken = flows.some((f) => f.id === nfId);
|
const idTaken = flows.some((f) => f.id === nfId);
|
||||||
|
|
||||||
const create = useMutation({
|
const create = useMutation({
|
||||||
mutationFn: () =>
|
/*
|
||||||
call<{ pkg: ProcessPackage; report: ClosureReport }>(saveProcessRoute, {
|
* 保存不生效(存出来一律 retired)—— 新建要兑现「建出来就能起单」,
|
||||||
|
* 得跟一记激活。最小图天然闭合,激活闸必过;真有 412 就让它抛,onError 如实报。
|
||||||
|
*/
|
||||||
|
mutationFn: async () => {
|
||||||
|
const out = await call<{ pkg: ProcessPackage; report: ClosureReport }>(saveProcessRoute, {
|
||||||
body: { pkg: minimalFlow(nfId, nfName.trim()) },
|
body: { pkg: minimalFlow(nfId, nfName.trim()) },
|
||||||
}),
|
});
|
||||||
|
await call<{ packages: ProcessPackage[] }>(setProcessStateRoute, {
|
||||||
|
params: { id: out.pkg.id, version: String(out.pkg.version) },
|
||||||
|
body: { state: 'active' },
|
||||||
|
});
|
||||||
|
return out;
|
||||||
|
},
|
||||||
onSuccess: (out) => {
|
onSuccess: (out) => {
|
||||||
void queryClient.invalidateQueries({ queryKey: ['gov', 'process'] });
|
void queryClient.invalidateQueries({ queryKey: ['gov', 'process'] });
|
||||||
setCreating(false);
|
setCreating(false);
|
||||||
@@ -441,7 +453,7 @@ function FlowLab({
|
|||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新建版本 = **以当前看的版本为底克隆一版**(服务端定版号并即刻生效)。
|
* 新建版本 = **以当前看的版本为底克隆一版**(服务端定版号,**不生效**)。
|
||||||
* 与「激活」分工明确:激活只是把生效指针切过去,不产生新版本;
|
* 与「激活」分工明确:激活只是把生效指针切过去,不产生新版本;
|
||||||
* 新建版本才长一版 —— 把旧定义复活成最新版、或在现状上另起一版接着画,都走这儿。
|
* 新建版本才长一版 —— 把旧定义复活成最新版、或在现状上另起一版接着画,都走这儿。
|
||||||
*/
|
*/
|
||||||
@@ -682,7 +694,7 @@ function FlowLab({
|
|||||||
<FlowFigureBlock
|
<FlowFigureBlock
|
||||||
key={`${pkg.id}@${pkg.version}`}
|
key={`${pkg.id}@${pkg.version}`}
|
||||||
title={`${pkg.name} v${pkg.version}`}
|
title={`${pkg.name} v${pkg.version}`}
|
||||||
oneLiner={`蓝 = 标准活动 · 绿 = 案例活动 · 琥珀 = 审批点 · 菱形 = 网关 · 红 = 卡点`}
|
oneLiner={`蓝 = 标准活动 · 绿 = 案例活动 · 琥珀 = 审批点 · 红 = 卡点`}
|
||||||
graph={graph}
|
graph={graph}
|
||||||
drilledIds={nodes.filter((n) => n.kind === 'activity').map((n) => n.id)}
|
drilledIds={nodes.filter((n) => n.kind === 'activity').map((n) => n.id)}
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -105,8 +105,7 @@ export function FlowFigureBlock({
|
|||||||
<span><i className="lg-i fe-pi-sop" aria-hidden /> 标准活动</span>
|
<span><i className="lg-i fe-pi-sop" aria-hidden /> 标准活动</span>
|
||||||
<span><i className="lg-i fe-pi-case" aria-hidden /> 案例活动</span>
|
<span><i className="lg-i fe-pi-case" aria-hidden /> 案例活动</span>
|
||||||
<span><i className="lg-i fe-pi-approval" aria-hidden /> 审批点</span>
|
<span><i className="lg-i fe-pi-approval" aria-hidden /> 审批点</span>
|
||||||
<span><i className="lg-i fe-pi-gwx" aria-hidden /> 判断网关</span>
|
{/* 网关已废除(2026-07-28):分支 = 条件出边,图例不再教它 */}
|
||||||
<span><i className="lg-i fe-pi-gwand" aria-hidden /> 并行网关</span>
|
|
||||||
<span><i className="lg-i fe-pi-callout" aria-hidden /> 卡点</span>
|
<span><i className="lg-i fe-pi-callout" aria-hidden /> 卡点</span>
|
||||||
<span><i className="lg-i lg-flow" aria-hidden /> 顺序流</span>
|
<span><i className="lg-i lg-flow" aria-hidden /> 顺序流</span>
|
||||||
<span className="sep">|</span>
|
<span className="sep">|</span>
|
||||||
|
|||||||
@@ -429,12 +429,14 @@ const modelingModule = {
|
|||||||
|
|
||||||
/* ---------- 元素盘(palette):拖放/点击落子 ---------- */
|
/* ---------- 元素盘(palette):拖放/点击落子 ---------- */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 网关不再入盘(产品决策 2026-07-28):分支 = 源节点的多条条件出边,汇合 = 多入边异或。
|
||||||
|
* 画布仍**认得** gateway(渲染/序列化都留着)—— 历史版本要能看;只是不给新画。
|
||||||
|
*/
|
||||||
export const PALETTE_SPECS: Array<{ key: string; label: string; className: string; spec: NewNodeSpec }> = [
|
export const PALETTE_SPECS: Array<{ key: string; label: string; className: string; spec: NewNodeSpec }> = [
|
||||||
{ key: "create.sop", label: "标准活动 · flow(蓝 · 照谱执行)", className: "fe-pi fe-pi-sop", spec: { kind: "activity" } },
|
{ key: "create.sop", label: "标准活动 · flow(蓝 · 照谱执行)", className: "fe-pi fe-pi-sop", spec: { kind: "activity" } },
|
||||||
{ key: "create.case", label: "案例活动 · loop(绿 · 临场演绎)", className: "fe-pi fe-pi-case", spec: { kind: "activity", flavor: "case" } },
|
{ key: "create.case", label: "案例活动 · loop(绿 · 临场演绎)", className: "fe-pi fe-pi-case", spec: { kind: "activity", flavor: "case" } },
|
||||||
{ key: "create.approval", label: "审批点(琥珀 · 人裁节点)", className: "fe-pi fe-pi-approval", spec: { kind: "activity", flavor: "approval" } },
|
{ key: "create.approval", label: "审批点(琥珀 · 人裁节点)", className: "fe-pi fe-pi-approval", spec: { kind: "activity", flavor: "approval" } },
|
||||||
{ key: "create.gw-x", label: "判断网关 ×(按判据走一条)", className: "fe-pi fe-pi-gwx", spec: { kind: "gateway", mode: "x" } },
|
|
||||||
{ key: "create.gw-and", label: "并行网关 +(全部同时走)", className: "fe-pi fe-pi-gwand", spec: { kind: "gateway", mode: "and" } },
|
|
||||||
{ key: "create.start", label: "起始事件", className: "fe-pi fe-pi-start", spec: { kind: "start" } },
|
{ key: "create.start", label: "起始事件", className: "fe-pi fe-pi-start", spec: { kind: "start" } },
|
||||||
{ key: "create.end", label: "结束事件", className: "fe-pi fe-pi-end", spec: { kind: "end" } },
|
{ key: "create.end", label: "结束事件", className: "fe-pi fe-pi-end", spec: { kind: "end" } },
|
||||||
{ key: "create.callout", label: "卡点(红 · 标去向)", className: "fe-pi fe-pi-callout", spec: { kind: "callout" } },
|
{ key: "create.callout", label: "卡点(红 · 标去向)", className: "fe-pi fe-pi-callout", spec: { kind: "callout" } },
|
||||||
@@ -607,7 +609,7 @@ class FlowContextPad {
|
|||||||
appendEntry("append.sop", "后接标准活动(自动连线)", "fe-ci fe-pi-sop", { kind: "activity" });
|
appendEntry("append.sop", "后接标准活动(自动连线)", "fe-ci fe-pi-sop", { kind: "activity" });
|
||||||
appendEntry("append.case", "后接案例活动(自动连线)", "fe-ci fe-pi-case", { kind: "activity", flavor: "case" });
|
appendEntry("append.case", "后接案例活动(自动连线)", "fe-ci fe-pi-case", { kind: "activity", flavor: "case" });
|
||||||
appendEntry("append.approval", "后接审批点(自动连线)", "fe-ci fe-pi-approval", { kind: "activity", flavor: "approval" });
|
appendEntry("append.approval", "后接审批点(自动连线)", "fe-ci fe-pi-approval", { kind: "activity", flavor: "approval" });
|
||||||
appendEntry("append.gw", "后接判断网关 ×(自动连线)", "fe-ci fe-pi-gwx", { kind: "gateway", mode: "x" });
|
// 网关已废除,不再可追加 —— 分支画成本节点的多条条件出边即可
|
||||||
appendEntry("append.end", "后接结束事件(自动连线)", "fe-ci fe-pi-end", { kind: "end" });
|
appendEntry("append.end", "后接结束事件(自动连线)", "fe-ci fe-pi-end", { kind: "end" });
|
||||||
|
|
||||||
entries["connect"] = {
|
entries["connect"] = {
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export const ZM: Readonly<Record<GovZone, { title: string; desc: string; accent:
|
|||||||
title: '流程包管理',
|
title: '流程包管理',
|
||||||
icon: 'workflow',
|
icon: 'workflow',
|
||||||
accent: 'linear-gradient(140deg,#4954e6,#3a44c9)',
|
accent: 'linear-gradient(140deg,#4954e6,#3a44c9)',
|
||||||
desc: '战略——企业以哪些流转运转。一条流一个包,版本收在包内部:保存即生效、恰一个生效版本、在途按启动版本跑完。编排即定契约:连线即映射、画图即校验,边不闭合存不进来。触发器(谁调起这条流)也在本区定义;启停在运营中心。',
|
desc: '战略——企业以哪些流转运转。一条流一个包,版本收在包内部:画图不检查、激活才查完整,恰一个生效版本、在途按启动版本跑完。编排即定契约:连线即映射,分支就是条件出边。触发器(谁调起这条流)也在本区定义;启停在运营中心。',
|
||||||
},
|
},
|
||||||
library: {
|
library: {
|
||||||
title: '活动库',
|
title: '活动库',
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
| M5-2 | loop 的 Agent 回路直接经 `ModelGateway`,未用 Mastra `Agent` | 编码规范 §6.1 规定用 Mastra Agent;`AgentPort` 端口不变,换实现时 usecase 不动;当前实现仍过两缝(录制回放可见) | M6 前 | 进行中 |
|
| M5-2 | loop 的 Agent 回路直接经 `ModelGateway`,未用 Mastra `Agent` | 编码规范 §6.1 规定用 Mastra Agent;`AgentPort` 端口不变,换实现时 usecase 不动;当前实现仍过两缝(录制回放可见) | M6 前 | 进行中 |
|
||||||
| M5-1 | `process` 未用 Mastra workflow 编译器,流转由自持确定性状态机 + `sys.node_instance` 承担 | 编码规范 §6.1 规定流程包编译为 Mastra 图;二者语义等价(挂起/恢复由节点实例表承担),先落可测的自持实现,Mastra 编译器作为可替换 adapter 后补 —— usecase 不动 | M5 收尾 | 进行中 |
|
| M5-1 | `process` 未用 Mastra workflow 编译器,流转由自持确定性状态机 + `sys.node_instance` 承担 | 编码规范 §6.1 规定流程包编译为 Mastra 图;二者语义等价(挂起/恢复由节点实例表承担),先落可测的自持实现,Mastra 编译器作为可替换 adapter 后补 —— usecase 不动 | M5 收尾 | 进行中 |
|
||||||
| M2-2 | pg-boss 已装未用 | 定时作业(监听时限扫描、周期触发器)随 M5 落地;当下派发器用 setInterval | M5 | 进行中 |
|
| M2-2 | pg-boss 已装未用 | 定时作业(监听时限扫描、周期触发器)随 M5 落地;当下派发器用 setInterval | M5 | 进行中 |
|
||||||
|
| M5-4 | AND 并行没有声明机制 —— 网关废除后(2026-07-28)多出边一律异或,画不出并行分叉 | 分支=条件出边、汇合=多入边异或已够 MVP;真要并行时以「并行组」声明加回(对应 Mastra `.parallel` 结构块),与 M5-1 编译器同批设计 | 需要并行的第一条流 | 进行中 |
|
||||||
|
| M5-5 | 含网关的历史版本**仅可读,不可激活**(激活报 `gateway-deprecated`);运行时留了三处网关兼容(`selectEdges` 单出边直通、`joinReady` 网关分支、`dispatchOf` 网关无调度) | 在途工作流按钉住版本读定义,老图还得走得动;等最后一条含网关的在途流走完、历史版本无人再看,兼容路径与 schema 的 `kind: 'gateway'` 一起摘除 | 含网关在途流清零后 | 进行中 |
|
||||||
|
|
||||||
## 鉴权(ADR-010 落地后的已知欠账)
|
## 鉴权(ADR-010 落地后的已知欠账)
|
||||||
|
|
||||||
@@ -121,6 +123,10 @@ intel-archive)只有契约面,入口产物是抛「未实现」的占位 ——
|
|||||||
并让 `needAlternative` / `needSourcing` 成为落地事实 —— 否则 G1 永远判不了。A2…A7 同理:
|
并让 `needAlternative` / `needSourcing` 成为落地事实 —— 否则 G1 永远判不了。A2…A7 同理:
|
||||||
先看自己出口的必填字段能不能由落地事实推出来。
|
先看自己出口的必填字段能不能由落地事实推出来。
|
||||||
|
|
||||||
|
> 后记(2026-07-28 稍后):占位骨架落地后整条流已在真库上八例端到端全绿;
|
||||||
|
> 且**网关已废除**(G1…G4 不再是节点,上表按当日图记述)—— 判据不变,只是「G1 判不了」
|
||||||
|
> 如今读作「A1 的条件出边判不了」:要 `needAlternative` 的还是那两条边,只是边挂在 A1 身上了。
|
||||||
|
|
||||||
## api:check 的盲点(2026-07-28)
|
## api:check 的盲点(2026-07-28)
|
||||||
|
|
||||||
契约面只收 `index.d.ts` / `contract.d.ts` / `port.d.ts`,而 `index.d.ts` 是 re-export **名单**。
|
契约面只收 `index.d.ts` / `contract.d.ts` / `port.d.ts`,而 `index.d.ts` 是 re-export **名单**。
|
||||||
|
|||||||
@@ -240,8 +240,10 @@ export const CLOSURE_VIOLATION_KINDS = [
|
|||||||
'required-unmapped',
|
'required-unmapped',
|
||||||
'type-conflict',
|
'type-conflict',
|
||||||
'dangling-node',
|
'dangling-node',
|
||||||
'gateway-unbalanced',
|
/** 多出边的无条件默认兜底超过一条 —— 第二条默认永远走不到 */
|
||||||
'join-ambiguous-source',
|
'multi-default-edge',
|
||||||
|
/** 网关已废除:历史版本仅可读,不可激活(2026-07-28) */
|
||||||
|
'gateway-deprecated',
|
||||||
'tolerate-required-dependency',
|
'tolerate-required-dependency',
|
||||||
'unknown-activity',
|
'unknown-activity',
|
||||||
'missing-owner-position',
|
'missing-owner-position',
|
||||||
|
|||||||
Reference in New Issue
Block a user