三面拆分⑯:流程包详情改三栏 · 字段只声明 · 版本可删可改名
**字段只声明,不做任何要求**(用户定):编排层不再碰字段 ——
· 激活闸只剩两面:结构闭合(dangling-node / multi-default-edge)与活动装载
(unknown-activity);字段类的检查(同名不同型、容忍分支被必填依赖)全部退役。
· 节点属性卡的「数据接口」从「推来源」改成**纯声明**:照活动契约列出吃什么、吐什么,
不标必填、不推来源、不提补全 —— 缺了怎么补是**活动内实现**的事,不在这一层现形。
· 字段类型支持数组:统一写成 `T[]`(如 `any[]`),出口口的字段也带上类型
(原来只有字段名)。实测 A2 的 benchmark 口显示「rows any[] · needSourcing boolean」。
**详情页改三栏**:左窄轨版本(132px) | 中流程图 | 右节点属性。
· 版本条一版一行(v几 · 状态 · 点/边计数),动作只在**看着的那一版**上展开 ——
窄栏放不下每行一排钮,也不该让人误点别版。
· 删掉「激活 · 双判据」整卡:没选节点时,属性栏就地列出还差哪几条(点一条定位过去);
两面都齐时盖一枚小检验章,不再占一整张卡。
· 删掉节点拣选行 —— 直接在图上点节点。
· 属性卡用包壳绝对定位:行高由中栏的图定,属性长了在卡内滚,不把图拉长
(实测卡高 467、明细内容 1039、可滚,图框不受影响)。窄轨里属性小卡改单列竖排。
· 顺带校正:上一轮那条「图框下沿对齐左列底栏顶线」的 20px 留白,
三栏改版后左栏已无底栏,没有对齐对象了 —— 改回四边等距(18px)。
**版本可删可改名**(新):
· 删:生效版不可删(先停用,ActiveVersionError → 409)、在途钉版不可删
(那些单要按它跑完,PinnedVersionError → 409);删掉正看的那版会落到剩下的最新版,
一版不剩就回货架。
· 改名:名字是**这条流的身份**,一次改及于所有版本 —— 版本列表上只显示 v1/v2…,
若只改一版的名,列表上什么也看不见,人会以为没生效。
· 5 条单测守两道闸与改名口径;实测走查:改名落库 → 改回;生效版删 409、停用版删 200。
process CONTRACT.md 与产品设计.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:
@@ -35,6 +35,8 @@ import {
|
||||
resumeTaskRoute,
|
||||
staffIdSchema,
|
||||
taskIdSchema,
|
||||
deleteProcessVersionRoute,
|
||||
renameProcessRoute,
|
||||
setNodeOwnerRoute,
|
||||
setTriggerConfirmRoute,
|
||||
listNodeOwnersRoute,
|
||||
@@ -47,7 +49,7 @@ import { extractFields } from '@modules/channel';
|
||||
import { assembleInput, scopeOf } from '@modules/trigger';
|
||||
import { InstallRejectedError } from '@modules/activity-registry';
|
||||
import type { InstallVerdict } from '@modules/activity-registry';
|
||||
import { NotClosedError, PinnedVersionError, StaleVersionError } from '@modules/process';
|
||||
import { ActiveVersionError, NotClosedError, PinnedVersionError, StaleVersionError } from '@modules/process';
|
||||
import type { Container } from '../container.ts';
|
||||
import type { AppEnv } from '../http-env.ts';
|
||||
|
||||
@@ -486,6 +488,40 @@ export function registerGovernanceOpsRoutes(app: Hono<AppEnv>, container: Contai
|
||||
});
|
||||
|
||||
/** 版本启停:激活即独占,停用即下线 —— 在途按启动版本跑完,零影响 */
|
||||
/** 删一版:生效版先停用(409),在途钉版不许删(409)—— 那些单要按它跑完 */
|
||||
app.delete(deleteProcessVersionRoute.path, async (c) => {
|
||||
const denied = await governProcess(c.get('account'));
|
||||
if (denied) return c.json(denied, denyStatus(denied));
|
||||
try {
|
||||
const packages = await container.process.deleteVersion(c.req.param('id'), Number(c.req.param('version')));
|
||||
return c.json({ packages });
|
||||
} catch (error) {
|
||||
if (error instanceof ActiveVersionError || error instanceof PinnedVersionError) {
|
||||
const body: ApiError = { code: 'conflict', message: error.message };
|
||||
return c.json(body, 409);
|
||||
}
|
||||
const body: ApiError = { code: 'not-found', message: error instanceof Error ? error.message : String(error) };
|
||||
return c.json(body, 404);
|
||||
}
|
||||
});
|
||||
|
||||
/** 改名:名字是这条流的身份 —— 一次改及于所有版本;在途单不受影响(名字不参与流转) */
|
||||
app.post(renameProcessRoute.path, async (c) => {
|
||||
const denied = await governProcess(c.get('account'));
|
||||
if (denied) return c.json(denied, denyStatus(denied));
|
||||
const parsed = renameProcessRoute.body.safeParse(await c.req.json());
|
||||
if (!parsed.success) {
|
||||
const body: ApiError = { code: 'validation-failed', message: '流程名不合协议(1–40 字)' };
|
||||
return c.json(body, 400);
|
||||
}
|
||||
try {
|
||||
return c.json({ packages: await container.process.rename(c.req.param('id'), parsed.data.name.trim()) });
|
||||
} catch (error) {
|
||||
const body: ApiError = { code: 'not-found', message: error instanceof Error ? error.message : String(error) };
|
||||
return c.json(body, 404);
|
||||
}
|
||||
});
|
||||
|
||||
app.post(setProcessStateRoute.path, async (c) => {
|
||||
const denied = await governProcess(c.get('account'));
|
||||
if (denied) return c.json(denied, denyStatus(denied));
|
||||
@@ -661,21 +697,25 @@ export function registerGovernanceOpsRoutes(app: Hono<AppEnv>, container: Contai
|
||||
const faces = await Promise.all(
|
||||
cards.map(async (card) => {
|
||||
const manifest = await container.registry.manifestOf(card.activityId);
|
||||
type FieldSpec = { type?: string; items?: { type?: string } };
|
||||
const data = manifest.contract.input.data as {
|
||||
required?: string[];
|
||||
properties?: Record<string, { type?: string }>;
|
||||
properties?: Record<string, FieldSpec>;
|
||||
};
|
||||
const required = data.required ?? [];
|
||||
const props = data.properties ?? {};
|
||||
/** 类型的人读写法 —— **数组写成 `T[]`**:声明得看得出是一个还是一串 */
|
||||
const typeOf = (spec: FieldSpec | undefined): string =>
|
||||
spec?.type === 'array' ? `${spec.items?.type ?? 'any'}[]` : (spec?.type ?? 'unknown');
|
||||
const portFields = (payload: unknown) => {
|
||||
const p = payload as { properties?: Record<string, unknown> } | undefined;
|
||||
return Object.keys(p?.properties ?? {});
|
||||
const p = payload as { properties?: Record<string, FieldSpec> } | undefined;
|
||||
return Object.entries(p?.properties ?? {}).map(([name, spec]) => ({ name, type: typeOf(spec) }));
|
||||
};
|
||||
return {
|
||||
requiredInputs: required,
|
||||
inputFields: Object.entries(props).map(([name, spec]) => ({
|
||||
name,
|
||||
type: spec.type ?? 'unknown',
|
||||
type: typeOf(spec),
|
||||
required: required.includes(name),
|
||||
})),
|
||||
// 必发口与选择组一并列出:调用方只凭口名与 schema 就能衔接下游
|
||||
|
||||
Reference in New Issue
Block a user