From 7e4c3c58a0ed1d1b9d579ad1d01d4bdff00e6882 Mon Sep 17 00:00:00 2001
From: ThearchyHelios
Date: Fri, 16 Oct 2026 10:54:30 +0800
Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E7=94=B1=E5=BD=A2=E8=93=9D=E5=9B=BE?=
=?UTF-8?q?=EF=BC=88=E5=89=8D=E7=AB=AF=EF=BC=89=EF=BC=9A=E3=80=8C=E8=B0=81?=
=?UTF-8?q?=E6=9D=A5=E5=81=9A=E3=80=8D=E5=8D=A1=E7=89=87=E6=8C=89=E6=9C=8D?=
=?UTF-8?q?=E5=8A=A1=E7=AB=AF=E7=9A=84=20derived=5Fpeople=20=E6=91=86?=
=?UTF-8?q?=EF=BC=8C=E5=8F=AA=E5=AE=9A=E6=AF=8F=E4=B8=80=E6=AD=A5=E7=94=B1?=
=?UTF-8?q?=E8=B0=81=E5=81=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
为什么:服务端已按导入的图列出「谁来做」(自由形蓝图后端那个提交),卡片要照那一份摆出来,发布摘要里「你来定」才指得到一张
真实存在的卡片(05-已知遗留 (d))。
做了什么:Blueprint 带 derived_people(typesBlueprint.DerivedPerson)。BlueprintCards 的 people 卡片对自由形按它一行一行画:
行名、每处用途只读;岗位行和「写入结果不明时谁去核实」一行复用 ItemRow 的人或组编辑(改了发 bp_set 到那一行的 path);发起人、
表达式、外部系统回调的步骤只读;不能加减步骤、不改会签和时限(卡片上写明在画布上改)。卡片上的问题按那几行的 path 归进来。
termsBlueprint 加四句。服务端 blueprint_out 对没有 graph 属性的对象(契约测试里的替身)按没有图算。
---
backend/app/blueprints/store.py | 4 +-
frontend/src/lib/termsBlueprint.ts | 7 +++
.../src/pages/blueprints/BlueprintCards.tsx | 43 ++++++++++++++++++-
frontend/src/typesBlueprint.ts | 20 +++++++++
4 files changed, 71 insertions(+), 3 deletions(-)
diff --git a/backend/app/blueprints/store.py b/backend/app/blueprints/store.py
index 700711bc..377a0b3f 100644
--- a/backend/app/blueprints/store.py
+++ b/backend/app/blueprints/store.py
@@ -379,7 +379,7 @@ def _derived_people(blueprint: Any) -> list[dict[str, Any]]:
from app.blueprints.templates import freeform
from app.blueprints.templates._common import with_graph
- return freeform.people_rows(with_graph(blueprint.spec or {}, blueprint.graph))
+ return freeform.people_rows(with_graph(blueprint.spec or {}, getattr(blueprint, "graph", None)))
def blueprint_out(blueprint: Any, *, issues: bool = True, extra: list[dict[str, Any]] | None = None) -> dict[str, Any]:
@@ -398,7 +398,7 @@ def blueprint_out(blueprint: Any, *, issues: bool = True, extra: list[dict[str,
"conversation_id": blueprint.conversation_id, "workflow_id": blueprint.workflow_id, "app_id": blueprint.app_id,
"last_trial_run_id": blueprint.last_trial_run_id, "graph_hash": blueprint.graph_hash, "joints": joints,
"copied_from": blueprint.copied_from,
- "reconciler_needed": needs_reconciler(with_graph(blueprint.spec or {}, blueprint.graph)),
+ "reconciler_needed": needs_reconciler(with_graph(blueprint.spec or {}, getattr(blueprint, "graph", None))),
"derived_people": _derived_people(blueprint) if is_freeform(blueprint.spec or {}) else None,
"created_at": blueprint.created_at.isoformat() if blueprint.created_at else None,
"updated_at": blueprint.updated_at.isoformat() if blueprint.updated_at else None,
diff --git a/frontend/src/lib/termsBlueprint.ts b/frontend/src/lib/termsBlueprint.ts
index 6970c069..bfa98369 100644
--- a/frontend/src/lib/termsBlueprint.ts
+++ b/frontend/src/lib/termsBlueprint.ts
@@ -356,6 +356,13 @@ export const BP_EDIT_TEXT = {
reconcilerHint: '这项写入能力没登记查询:写回的结果不明时(请求发出去了、没拿到答复),平台查不了,也不会自动重发,'
+ '要有人去目标系统里看写进去没有。只能由你来选。',
reconcilerUnused: '这项写入能力已经登记了查询,结果不明时平台自己去查:这一项用不上了,发布时不会派给他们。',
+ /**
+ * 自由形的「谁来做」(05-已知遗留 (d)):按导入的图列出,只定由谁做;行名、会签、时限、超时都来自图,要改回画布
+ */
+ freeformPeopleHint: '按导入的图列出:这里只定每一步由谁做,会签、时限、超时和步骤本身在画布上改。',
+ freeformPeopleEmpty: '导入的图里没有要指定由谁处理的步骤。',
+ freeformWho: '谁来做',
+ freeformReadOnly: '图上已经写定,这里不用选',
removeTitle: (where: string) => `删掉${where}?`,
removeConfirm: '删掉',
template: '换一个场景',
diff --git a/frontend/src/pages/blueprints/BlueprintCards.tsx b/frontend/src/pages/blueprints/BlueprintCards.tsx
index be72d9ed..86659199 100644
--- a/frontend/src/pages/blueprints/BlueprintCards.tsx
+++ b/frontend/src/pages/blueprints/BlueprintCards.tsx
@@ -7,6 +7,7 @@
* 哪些项必填(P7)。
*
* 写回卡片上「结果不明时谁去核实」只在目标能力没登记查询时摆(服务端 Blueprint.reconciler_needed),只能由人选(同「谁能看」)。
+ * 自由形的「谁来做」按服务端给的 derived_people 摆(FreeformPeople):骨架是导入的图,卡片只定每一步由谁做。
*
* 每一项可以点「修改」:改完发一个 bp_set(值是纯值,服务端记成来源「你」、已确认);待确认的可以直接点「确认」(只改状态,
* 来源不变),一张卡片上待确认的不止一项时卡头另有「确认全部」,一次修改带上这几项的状态(服务端整批落或整批不落)。
@@ -26,7 +27,7 @@ import {
} from '../../lib/terms'
import { chatBusy, useBlueprint } from '../../store/blueprint'
import type {
- Blueprint, BpDataItem, BpField, BpItem, BpOp, BpStep, ItemStatus, JointState, PlainIssue, TemplateInfo,
+ Blueprint, BpDataItem, BpField, BpItem, BpOp, BpStep, DerivedPerson, ItemStatus, JointState, PlainIssue, TemplateInfo,
} from '../../typesBlueprint'
import { SELF_RECORDS, ValueEditor, valueText, type EditorKind, type EditorScope } from './editors'
import { isItem, missingPaths, visibleCards, type CardKey } from './shared'
@@ -175,6 +176,7 @@ function CardFor({ card, ctx, template }: { card: CardKey; ctx: CardCtx; templat
)
case 'people': {
+ if (ctx.bp.derived_people) return
const items = spec.people.flatMap((s, i) => STEP_KEYS.map((k) => [`/people/${i}/${k}`, s[k] as BpItem] as [string, BpItem]))
return (
{BLUEPRINT_TEXT.empty}
}
+/**
+ * 自由形的「谁来做」(05-已知遗留 (d)):按服务端给的 derived_people 一行一行摆,不自己从图里推。岗位行、核实人那一行只定
+ * 由谁做(改了发 bp_set 到那一行的 path);发起人、表达式、外部系统回调的步骤只读。不能加减步骤、不能改会签和时限:骨架是
+ * 导入的图,要改回画布
+ */
+function FreeformPeople({ ctx, rows, note }: { ctx: CardCtx; rows: DerivedPerson[]; note?: string }) {
+ const spec = ctx.bp.spec
+ const itemOf = (row: DerivedPerson): BpItem | null => {
+ if (row.kind === 'reconciler') return spec.writeback?.reconciler ?? UNSET
+ if (row.kind !== 'slot') return null
+ return spec.people.find((s) => s.id === row.slot)?.who ?? UNSET
+ }
+ const items = rows.flatMap((r): [string, BpItem][] => {
+ const item = itemOf(r)
+ return r.path && item ? [[r.path, item]] : []
+ })
+ const paths = new Set(items.map(([p]) => p))
+ const issues = (ctx.bp.issues ?? []).filter((i) => i.path === '/people' || (i.path != null && paths.has(i.path)))
+ return (
+
+ {BP_EDIT_TEXT.freeformPeopleHint}
+ {rows.length === 0 && {BP_EDIT_TEXT.freeformPeopleEmpty}
}
+ {rows.map((row, i) => {
+ const item = itemOf(row)
+ return (
+
+
{row.label}
+
{row.detail}
+ {row.path && item
+ ?
+ :
{BP_EDIT_TEXT.freeformReadOnly}
}
+
+ )
+ })}
+
+ )
+}
+
function Card({ card, status, note, actions, issues, children }: {
card: CardKey; status: ItemStatus | null; note?: string; actions?: ReactNode; issues?: PlainIssue[]; children: ReactNode
}) {
diff --git a/frontend/src/typesBlueprint.ts b/frontend/src/typesBlueprint.ts
index 5e1a9fa7..b178d7e1 100644
--- a/frontend/src/typesBlueprint.ts
+++ b/frontend/src/typesBlueprint.ts
@@ -45,6 +45,21 @@ export interface BpStep {
export interface BpField { name: string; spec: BpItem>; sensitive: boolean }
+/**
+ * 自由形「谁来做」的一行。slot:图里引用的一个岗位(path 是 /people//who,只定由谁做);reconciler:写入能力没登记查询时
+ * 的核实人(path 是 /writeback/reconciler);initiator / expression / hook:不按岗位派的步骤,只读(path 为空)。
+ * label 是节点在图上的名字,detail 写全每一处用途
+ */
+export interface DerivedPerson {
+ kind: 'slot' | 'reconciler' | 'initiator' | 'expression' | 'hook'
+ slot: string | null
+ label: string
+ detail: string
+ path: string | null
+ who: BpPrincipal[] | null
+ uses: { node_id: string; title: string; role: string }[]
+}
+
export interface BpWriteback {
capability: BpItem
mapping: BpItem>
@@ -132,6 +147,11 @@ export interface Blueprint {
* templates/_common.needs_reconciler,界面不自己判)。老服务端不给时按不要
*/
reconciler_needed?: boolean
+ /**
+ * 自由形按导入的图列出的「谁来做」(服务端 templates/freeform.people_rows,05-已知遗留 (d)):界面照这一份画,不自己从图里推。
+ * 别的模板、老服务端为空
+ */
+ derived_people?: DerivedPerson[] | null
/** 蓝图检查(bp.* / tpl.*),带白话 */
issues?: PlainIssue[]
created_at: string