Archived
E04 修到零被拒线,harness 补七刀:跨进程租约与广播桥、原子写、引用墙、对话区按序号排
活动侧(E04 2.1.0 → 2.1.9,I01 1.2.2): - 覆盖闭合成为机检:基座新增 distinct 读数,「计划盖住的客户数 = 候选行数」钉进 S3 收步 / S4 哨兵 / 放行 L2;人加的候选客户不再被整单无视 - 「关键人待识别」占位句式全链退役:查无联系人先发数据录入卡收人;契约新增 refersTo, 计划/回执的 contact_code 只许引用真实存在的联系人(安装期核引用目标) - 台账更新确认摆全落库面:客户档案/联系人档案两张落库预览(touched: 数据源, 正式现值 + 草稿叠加),可补改、可加行(自增主键由基座续号);姓名升必填 - 更新明细:update_key 位置键 + 「同一处只留一条」L2;依据写人话不带机器键; 标题旁不摆单号;判据与文案不夹字段名;行标识去掉单标识那一段 - 回执骨架 = 计划行数钉进 S3 收步与 S4 哨兵;重做分支不许删计划凑数 - 阶段刻度对齐文档 7 步;起单样例预填满 基座侧: - 两个后端连同一个库:task-claim 跨进程租约(迁移 0030)+ Postgres LISTEN/NOTIFY 广播桥;对话区按任务内记忆序号排,不按墙上时钟;并卡「刚说过话」按记忆序列判紧邻 - 多行 write 整批先验后写(dryRun),被拒 = 一行都没落 - 决策卡意见与本单草稿字面比对,归属以观察进轨迹(note-anchors) - 括号栈补「补闭括号」两形(少一个 } / 行对象没关直接跟下一行) - 件上加行:空着的自增主键直进续号,不从别的行借号;未落下的行点名回给前端 - 人答复落库那一刻就把 runtime 翻 running(task.wake),两块同帧变脸 - 试跑单可落真库(land_master,迁移 0031,默认开);数据域按活动分组; JSON 列不再是 [object Object];按钮键感 + 在办进度条 + 防抖 - 报价链 A1–A7 从系统卸载(只卸不删源码),种子只装 E04/I01 契约变更(api-report 已刷新):FieldDeclaration.distinct / refersTo, objectDeclaration.file,landMaster,unkeyed,assetFiles,ledgerByActivityRoute。 1700 测 / typecheck / lint / depcruise / api:check 绿。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EEJX8Z7CHejvwmDQyPQuBX
This commit is contained in:
@@ -83,6 +83,8 @@ import type { AppConfig } from './config.ts';
|
||||
import { createIdGenerator, systemClock } from './runtime.ts';
|
||||
import { createSecretBox, loadSecretKey } from './secret-box.ts';
|
||||
import { createBroadcaster } from './broadcast.ts';
|
||||
import { noteAnchors, noteAnchorTitle } from './note-anchors.ts';
|
||||
import { bridgeBroadcaster } from './broadcast-bridge.ts';
|
||||
import type { Broadcaster } from './broadcast.ts';
|
||||
|
||||
export type Container = {
|
||||
@@ -188,6 +190,12 @@ export async function createContainer(config: AppConfig): Promise<Container> {
|
||||
process.stderr.write(`[pg] 空闲连接异常(已剔除,下次取用自动重连):${error.message}\n`);
|
||||
});
|
||||
const db = drizzle(pool);
|
||||
/*
|
||||
* **广播接到库上** —— 多个后端连同一个库时,别的进程动了同一张单,
|
||||
* 这边的浏览器也得知道(不然就停在「AI 推进中」直到人手动刷新,2026-08-24 用户实测)。
|
||||
* 单进程部署时它只是空转一条 LISTEN 连接,没有副作用。
|
||||
*/
|
||||
const bridge = bridgeBroadcaster(pool, broadcaster);
|
||||
const ids = createIdGenerator();
|
||||
const secrets = createSecretBox(loadSecretKey());
|
||||
|
||||
@@ -259,10 +267,18 @@ export async function createContainer(config: AppConfig): Promise<Container> {
|
||||
simulation: {
|
||||
isSimulated: async (taskId) => {
|
||||
const res = await pool.query<{ simulated: boolean }>(
|
||||
/*
|
||||
* **勾了「落真库」的试跑单不算试跑** —— 这道判断只服务一件事:
|
||||
* 放行合并时主数据要不要挡下来(见 `ledger-service`)。
|
||||
* 2026-08-24 用户要的正是这个:演示时要看见 `customer.contact` 的亲密度真的变了,
|
||||
* 而不是单据里写着「3 → 10」、主数据还是 3。默认仍然挡 —— 破例得有人按一下。
|
||||
*/
|
||||
`select exists (
|
||||
select 1 from sys.task t
|
||||
left join sys.workflow w on w.id = t.workflow_id
|
||||
where t.id = $1 and (t.origin = 'testbed' or w.source->>'ref' = 'testbed')
|
||||
where t.id = $1
|
||||
and (t.origin = 'testbed' or w.source->>'ref' = 'testbed')
|
||||
and coalesce(t.land_master, false) = false
|
||||
) as simulated`,
|
||||
[taskId],
|
||||
);
|
||||
@@ -408,11 +424,31 @@ export async function createContainer(config: AppConfig): Promise<Container> {
|
||||
},
|
||||
},
|
||||
memory: {
|
||||
append: async (input) =>
|
||||
void (await memory.append({
|
||||
...input,
|
||||
stamp: { contractVersion: '1', businessModelVersion: '1', skillVersions: [] },
|
||||
})),
|
||||
append: async (input) => {
|
||||
const stamp = { contractVersion: '1', businessModelVersion: '1', skillVersions: [] };
|
||||
await memory.append({ ...input, stamp });
|
||||
/*
|
||||
* **驳回意见点了谁,基座当场比对好摆进轨迹**(2026-08-24 柴浩实测:意见写
|
||||
* 「测试111建议动作改成拜访CTO」,模型把改动落到了 Itelma 那一行)。
|
||||
* 归属是纯字符串包含 —— 引擎有现成事实的,不让模型从一句没标点的话里自己抠。
|
||||
* 观察挂了不拦回传:它是给下一拍的路标,不是这一笔的门。
|
||||
*/
|
||||
if (input.kind === 'card-reply') {
|
||||
const detail = (input.detail ?? {}) as { note?: unknown; value?: unknown };
|
||||
const custom = typeof detail.value === 'string' && detail.value.startsWith('custom:') ? detail.value.slice('custom:'.length) : '';
|
||||
const note = typeof detail.note === 'string' && detail.note.trim() !== '' ? detail.note : custom;
|
||||
if (note.trim() !== '') {
|
||||
try {
|
||||
const hits = noteAnchors(note, await ledger.taskDrafts(input.taskId));
|
||||
if (hits.length > 0) {
|
||||
await memory.append({ taskId: input.taskId, kind: 'observation', title: noteAnchorTitle(hits), stamp });
|
||||
}
|
||||
} catch {
|
||||
/* 比对失败只是少一条路标 */
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
events: {
|
||||
publishHumanEvent: async (input) => {
|
||||
@@ -703,6 +739,7 @@ export async function createContainer(config: AppConfig): Promise<Container> {
|
||||
report: deskElements.report,
|
||||
trace,
|
||||
async close() {
|
||||
bridge.stop();
|
||||
await pool.end();
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user