forked from ChaiHao/BPOS-MVP
汇报流:活动按步序位置推视图,容器沙箱渲染
「flow:按**步序位置**推送声明的模版」(AM 07)。原先这条链只有写面没有读面,
活动的 viewTemplates 是一行占位字符串,工作台视图区永远只显示一份硬编码概览。
补齐整条链:
· 步声明新增 `view`:这一步呈现哪张模版 —— 推什么由声明给定,不由临场决定。
· 新增模版填数的纯函数(interaction/domain):`data-slot` 取值、`data-rows` 逐条展开。
**填数只做取值与转义**,没有表达式、没有分支、没有循环 —— 一旦模版能算,
它就成了代码,容器的「无脚本执行权」也就形同虚设。填充**消费槽位**,
交出去的是干净 HTML,不是带模板属性的半成品。
· interaction 补读面 `viewOf`;desk 路由把推送的 HTML 交给前端;
ViewRegion 经 `@ui` 的 ViewContainer(sandbox="" 的 iframe)渲染 —— feature 不碰 innerHTML。
· A1 写了三张真模版(事态全景 / 打标判据 / 成果预览),内联自带样式
(沙箱页面不继承工作台 CSS),按步序位置挂在 S3 / S5 / S6 上。
沿路两处修:
① 取值路径遇到**本身带点号的键**(台账地址 `域.对象`)会被拆成两级、永远取不到。
改为整键优先、找不到再下行;`view-render` 与 `step-sequence` 两处同修。
② 「本单交付」不能画成台账全表:任务视图是正式版 + 我的草稿的合并结果,
直接拿来列会把**别单**放行过的记录一并列出。本单自己写下的行单独放在
`mine:域.对象` 下(整键,取值不歧义)。
另:视图推送失败原先静默吞掉 —— 会让「视图区一直空着」变成查不出原因的怪事;
改为留痕(仍不影响步序推进,呈现是投影)。
实测:一封 RFQ 入站 → 放行前那一屏列出本单交付 LM358DR / TI / 12000 / 8.2 / 10周,
以及 Type A「直接快答」的分类结论与四项打标判据。
gates: tsc / eslint / depcruise(321 模块)/ api-report / 423 测试 全绿
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeDBx2PHLavbURXB8LJJ7m
This commit is contained in:
@@ -77,6 +77,19 @@ export type SchemaValidator = {
|
||||
errors: string[];
|
||||
};
|
||||
};
|
||||
/**
|
||||
* 视图流控 —— app 注入 `interaction`(L3)。
|
||||
* flow 按步序位置推声明的模版;推的是**填好数的 HTML**,容器只渲染不执行。
|
||||
*/
|
||||
export type ViewGateway = {
|
||||
/** 按模版名取模版、以任务视图填数、推给前端;模版不存在就什么都不做 */
|
||||
push(input: {
|
||||
taskId: TaskId;
|
||||
activityId: string;
|
||||
template: string;
|
||||
scope: Record<string, unknown>;
|
||||
}): Promise<void>;
|
||||
};
|
||||
/** 人类工具步 —— app 注入 `human-tool`(L3) */
|
||||
export type CardGateway = {
|
||||
issue(input: {
|
||||
|
||||
@@ -51,6 +51,11 @@ export type InteractionService = {
|
||||
pushView(taskId: TaskId, blocks: readonly ViewBlock[]): Promise<void>;
|
||||
/** 视图流控:活动推 HTML 模版 —— 过净化门,不过即抛 */
|
||||
pushViewHtml(taskId: TaskId, html: string): Promise<void>;
|
||||
/** 视图区当前呈现什么 —— 只读投影,刷新即重建(前端零过程状态) */
|
||||
viewOf(taskId: TaskId): Promise<{
|
||||
blocks?: readonly ViewBlock[];
|
||||
html?: string;
|
||||
} | undefined>;
|
||||
/** 控制权转交 —— 随引擎的激活 / 完成事件自动发生 */
|
||||
setPhase(taskId: TaskId, phase: InteractionPhase): Promise<ControlHolder>;
|
||||
phaseOf(taskId: TaskId): Promise<InteractionPhase>;
|
||||
|
||||
@@ -7,5 +7,6 @@ export type { Audience, Clock, HumanEventPublisher, IdGenerator, InteractionStor
|
||||
export type { InteractionServiceDeps } from './internal/usecase/interaction-service.ts';
|
||||
export { createInteractionService, visibleTo } from './internal/usecase/interaction-service.ts';
|
||||
export { CONTROL_HOLDERS, checkTemplate, handoverHappens, inputControl, INTERACTION_PHASES, outputControl, templateIsSafe, } from './internal/domain/control-handover.ts';
|
||||
export { renderView, renderTemplate, renderRows, escapeHtml, displayValue } from './internal/domain/view-render.ts';
|
||||
export { createInteractionStore } from './internal/adapter/interaction-store.ts';
|
||||
export { chatMessageTable, taskViewTable } from './internal/adapter/interaction-schema.ts';
|
||||
|
||||
@@ -16,6 +16,10 @@ export type InteractionStore = {
|
||||
blocks?: readonly ViewBlock[];
|
||||
html?: string;
|
||||
}): Promise<void>;
|
||||
getView(taskId: TaskId): Promise<{
|
||||
blocks?: readonly ViewBlock[];
|
||||
html?: string;
|
||||
} | undefined>;
|
||||
setPhase(taskId: TaskId, phase: InteractionPhase): Promise<void>;
|
||||
phaseOf(taskId: TaskId): Promise<InteractionPhase | undefined>;
|
||||
};
|
||||
|
||||
@@ -1000,6 +1000,7 @@ export declare const taskDetailSchema: z.ZodObject<{
|
||||
}, z.core.$strip>], "kind">;
|
||||
}, z.core.$strip>>;
|
||||
}, z.core.$strip>], "t">>;
|
||||
viewHtml: z.ZodOptional<z.ZodString>;
|
||||
log: z.ZodArray<z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
at: z.ZodString;
|
||||
@@ -1883,6 +1884,7 @@ export declare const taskDetailRoute: {
|
||||
}, z.core.$strip>], "kind">;
|
||||
}, z.core.$strip>>;
|
||||
}, z.core.$strip>], "t">>;
|
||||
viewHtml: z.ZodOptional<z.ZodString>;
|
||||
log: z.ZodArray<z.ZodObject<{
|
||||
id: z.ZodString;
|
||||
at: z.ZodString;
|
||||
|
||||
+20
@@ -150,6 +150,7 @@ export declare const flowStepSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -180,6 +181,7 @@ export declare const flowStepSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -213,6 +215,7 @@ export declare const flowStepSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -241,6 +244,7 @@ export declare const flowStepSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -273,6 +277,7 @@ export declare const flowModelSchema: z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -303,6 +308,7 @@ export declare const flowModelSchema: z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -336,6 +342,7 @@ export declare const flowModelSchema: z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -364,6 +371,7 @@ export declare const flowModelSchema: z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -526,6 +534,7 @@ export declare const businessModelSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -556,6 +565,7 @@ export declare const businessModelSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -589,6 +599,7 @@ export declare const businessModelSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -617,6 +628,7 @@ export declare const businessModelSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -702,6 +714,7 @@ export declare const manifestAssetsSchema: z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -732,6 +745,7 @@ export declare const manifestAssetsSchema: z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -765,6 +779,7 @@ export declare const manifestAssetsSchema: z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -793,6 +808,7 @@ export declare const manifestAssetsSchema: z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -1054,6 +1070,7 @@ export declare const activityManifestSchema: z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -1084,6 +1101,7 @@ export declare const activityManifestSchema: z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -1117,6 +1135,7 @@ export declare const activityManifestSchema: z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
@@ -1145,6 +1164,7 @@ export declare const activityManifestSchema: z.ZodObject<{
|
||||
fields: z.ZodRecord<z.ZodString, z.ZodString>;
|
||||
}, z.core.$strip>>;
|
||||
when: z.ZodOptional<z.ZodString>;
|
||||
view: z.ZodOptional<z.ZodString>;
|
||||
failure: z.ZodObject<{
|
||||
retry: z.ZodObject<{
|
||||
times: z.ZodNumber;
|
||||
|
||||
Reference in New Issue
Block a user