forked from ChaiHao/BPOS-MVP
编排层①:改图入口下沉画布 + 活动契约面全链打通
① 已发布包就地给「起草新版本并去编辑」,不用去页头找; ② 修一个我自己引入的 bug:卡点还原把审批点的「退回调整」牌子当成边,凭空造出 e-A5-A4 —— 卡点只认亲、不新建(旧包有这条边才认);实测编辑器往返 16 边 14 节点无损; ③ 活动契约面接进治理台:列表出参带必填入参/输出口/声明依赖,活动详情摆成一屏, 导出依赖文件一并带上 —— 开发一个活动要照着的东西,现在有一处能看全。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
This commit is contained in:
@@ -355,8 +355,50 @@ export function registerGovernanceOpsRoutes(app: Hono<AppEnv>, container: Contai
|
||||
const denied = await readActivity(c.get('account'));
|
||||
if (denied) return c.json(denied, denyStatus(denied));
|
||||
const cards = await container.registry.list();
|
||||
/*
|
||||
* 契约面随卡一起给 —— 开发一个活动要照着的东西全在清单里:
|
||||
* 七件契约的入参与出口、声明的工具/模型/域对象/岗位。
|
||||
* 编排的人也要看它:引用一个活动却不知道它吃什么,边映射就只能靠猜。
|
||||
*/
|
||||
const faces = await Promise.all(
|
||||
cards.map(async (card) => {
|
||||
const manifest = await container.registry.manifestOf(card.activityId);
|
||||
const data = manifest.contract.input.data as {
|
||||
required?: string[];
|
||||
properties?: Record<string, { type?: string }>;
|
||||
};
|
||||
const required = data.required ?? [];
|
||||
const props = data.properties ?? {};
|
||||
const portFields = (payload: unknown) => {
|
||||
const p = payload as { properties?: Record<string, unknown> } | undefined;
|
||||
return Object.keys(p?.properties ?? {});
|
||||
};
|
||||
return {
|
||||
requiredInputs: required,
|
||||
inputFields: Object.entries(props).map(([name, spec]) => ({
|
||||
name,
|
||||
type: spec.type ?? 'unknown',
|
||||
required: required.includes(name),
|
||||
})),
|
||||
// 必发口与选择组一并列出:调用方只凭口名与 schema 就能衔接下游
|
||||
outputPorts: [
|
||||
...manifest.contract.output.mandatory,
|
||||
...manifest.contract.output.selective.flatMap((g) => g.ports),
|
||||
].map((port) => ({
|
||||
name: port.name,
|
||||
...(port.description === undefined ? {} : { description: port.description }),
|
||||
fields: portFields(port.payload),
|
||||
})),
|
||||
tools: manifest.declarations.tools.map((t) => t.name),
|
||||
models: manifest.declarations.models,
|
||||
objects: manifest.declarations.ledger.map((o) => `${o.domain}.${o.object}`),
|
||||
roles: [...manifest.contract.resources.roles],
|
||||
humanCallBudget: manifest.contract.authorization.humanCallBudget,
|
||||
};
|
||||
}),
|
||||
);
|
||||
return c.json({
|
||||
activities: cards.map((card) => ({
|
||||
activities: cards.map((card, i) => ({
|
||||
activityId: card.activityId,
|
||||
name: card.name,
|
||||
category: card.category,
|
||||
@@ -372,6 +414,7 @@ export function registerGovernanceOpsRoutes(app: Hono<AppEnv>, container: Contai
|
||||
version: a.version,
|
||||
effective: a.effective,
|
||||
})),
|
||||
contract: faces[i]!,
|
||||
})),
|
||||
});
|
||||
});
|
||||
|
||||
@@ -35,3 +35,9 @@
|
||||
覆盖只能是显式的 `rollbackAsset` 治理动作
|
||||
- **进化必过治理**:候选 → 回放 → 人放行,状态机不许跳过回放
|
||||
- **安装恒为新增、版本并存**:卸载只置 state,在途任务按其启动时版本跑完
|
||||
|
||||
近变(2026-07-28):模块面未变。app 层的 `GET /api/gov/activities` 出参加 `contract` 面
|
||||
(必填入参 / 入参字段 / 输出口与载荷字段 / 声明的工具·模型·域对象·岗位 / 调人预算),
|
||||
由 `manifestOf` 逐个读清单组装。此前治理台看不到活动的契约:
|
||||
编排的人引用一个活动却不知道它吃什么,边映射只能靠猜;
|
||||
要开发一个活动的人也没有一处能照着看。
|
||||
|
||||
Reference in New Issue
Block a user