三面拆分⑬:触发确认链路 + 运营中心「工作流」区 —— 设计只管设计,运营管细节

**触发确认链路**(用户口述五步的第 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:
2026-07-29 13:09:16 +08:00
co-authored by Claude Opus 5
parent 70b261d067
commit f9b2c07731
45 changed files with 1176 additions and 115 deletions
+59
View File
@@ -1325,6 +1325,10 @@ export declare const listTriggersRoute: {
sfeel: z.ZodString;
}, z.core.$strip>], "from">;
}, z.core.$strip>>>;
confirm: z.ZodDefault<z.ZodObject<{
required: z.ZodDefault<z.ZodBoolean>;
staffId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "StaffId", "out">>;
}, z.core.$strip>>;
spec: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"periodic-calendar">;
calendar: z.ZodString;
@@ -1400,6 +1404,10 @@ export declare const upsertTriggerRoute: {
sfeel: z.ZodString;
}, z.core.$strip>], "from">;
}, z.core.$strip>>>;
confirm: z.ZodDefault<z.ZodObject<{
required: z.ZodDefault<z.ZodBoolean>;
staffId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "StaffId", "out">>;
}, z.core.$strip>>;
spec: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"periodic-calendar">;
calendar: z.ZodString;
@@ -1451,6 +1459,10 @@ export declare const upsertTriggerRoute: {
sfeel: z.ZodString;
}, z.core.$strip>], "from">;
}, z.core.$strip>>>;
confirm: z.ZodDefault<z.ZodObject<{
required: z.ZodDefault<z.ZodBoolean>;
staffId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "StaffId", "out">>;
}, z.core.$strip>>;
spec: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"periodic-calendar">;
calendar: z.ZodString;
@@ -2123,6 +2135,53 @@ export declare const listApprovalsRoute: {
* 起一条流(测试台专用):**带节点指派**把整条流定向到指定账号 ——
* 真实任务照旧落到那个人的工作台,测试台只管起单与观测。
*/
/**
* 触发器的**运营配置**:要不要人工确认、谁来确认 —— 与设计面的 upsert 分口,
* 设计动规则不碰这两项,运营动这两项不碰规则。
*/
export declare const setTriggerConfirmRoute: {
readonly method: "POST";
readonly path: "/api/gov/triggers/:id/confirm";
readonly params: z.ZodObject<{
id: z.ZodString;
}, z.core.$strip>;
readonly body: z.ZodObject<{
required: z.ZodBoolean;
staffId: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
readonly output: z.ZodObject<{
ok: z.ZodBoolean;
}, z.core.$strip>;
};
/** 节点负责人(运营配置):流程包的哪个节点归谁 —— 显式指派 > 这里 > 轮值 */
export declare const listNodeOwnersRoute: {
readonly method: "GET";
readonly path: "/api/gov/packages/:id/owners";
readonly params: z.ZodObject<{
id: z.ZodString;
}, z.core.$strip>;
readonly output: z.ZodObject<{
owners: z.ZodArray<z.ZodObject<{
nodeId: z.ZodString;
staffId: z.ZodString;
}, z.core.$strip>>;
}, z.core.$strip>;
};
export declare const setNodeOwnerRoute: {
readonly method: "PUT";
readonly path: "/api/gov/packages/:id/owners/:nodeId";
readonly params: z.ZodObject<{
id: z.ZodString;
nodeId: z.ZodString;
}, z.core.$strip>;
/** null = 撤掉运营指定,回到轮值 */
readonly body: z.ZodObject<{
staffId: z.ZodNullable<z.ZodString>;
}, z.core.$strip>;
readonly output: z.ZodObject<{
ok: z.ZodBoolean;
}, z.core.$strip>;
};
export declare const testRunRoute: {
readonly method: "POST";
readonly path: "/api/gov/testbed/run";
+22
View File
@@ -2352,6 +2352,11 @@ export declare const systemMessageSchema: z.ZodObject<{
rejectedReason: z.ZodOptional<z.ZodString>;
supersededBy: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
confirm: z.ZodOptional<z.ZodObject<{
pendingId: z.ZodString;
consumed: z.ZodBoolean;
workflowId: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
}, z.core.$strip>;
export type SystemMessageView = z.infer<typeof systemMessageSchema>;
export declare const listMessagesRoute: {
@@ -2400,6 +2405,11 @@ export declare const listMessagesRoute: {
rejectedReason: z.ZodOptional<z.ZodString>;
supersededBy: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
confirm: z.ZodOptional<z.ZodObject<{
pendingId: z.ZodString;
consumed: z.ZodBoolean;
workflowId: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
}, z.core.$strip>>;
}, z.core.$strip>;
};
@@ -2427,6 +2437,18 @@ export declare const answerMessageRoute: {
ok: z.ZodBoolean;
}, z.core.$strip>;
};
/** 确认起单 —— 幂等:已被确认过就如实说,并回那条流的号,绝不起第二条 */
export declare const confirmTriggerPendingRoute: {
readonly method: "POST";
readonly path: "/api/desk/trigger-pending/:id/confirm";
readonly params: z.ZodObject<{
id: z.ZodString;
}, z.core.$strip>;
readonly output: z.ZodObject<{
workflowId: z.ZodString;
alreadyStarted: z.ZodBoolean;
}, z.core.$strip>;
};
export type ListMessagesOutput = z.infer<typeof listMessagesRoute.output>;
export declare const minuteResolutionSchema: z.ZodObject<{
id: z.ZodString;