Archived
手改是**兜 AI 的错**的那一手 —— 这一轮把它从「摆在那儿但落不了地」做成真的: 件上就地改 · 保存**按地址收**,不看当下那张卡:载荷从前借道工单的 `blocks[i]` 取列名, 于是熔断卡(没有 blocks)在屏上时,人补的那一格一个字都送不出去 —— 而他要补的恰恰是把这一单卡住的那个必填格。授权面改由活动清单的台账声明把关。 · **能增删行**:错不止「这一格填错了」,还有「这一行不该在」与「漏了一行」。 删挂记号不当场抹掉(看得见、可后悔),且**删要说出来**(`drops`)—— 「没回传就是删了」会把一次不完整的回传变成一次删表。 · **必填没填按不下提交**:与放行门 L1 同一个数同一套算法;闸上摆出差在哪一行哪一格。 · 只写真改了的那几行 —— 改一格却留「修订 4 行」的痕,那句话是假的。 判据与门 · 裁量判据带谓词时**谓词说了算**:「选填缺口已补齐」基座数得出来, 人填好的目标价它照样判「客户未提供」的毛病由此消掉。 · 验收卡判据**读时现算** —— 人在成果件上补一格,判据跟着变。 · 放行门认「**办完了没有**」不认「有人写过」:从前写个 `false` 就把门推开, 于是一单没打标就进了放行门。三个数全由基座现数。 · 拒回把「活没干完」说成「数或行对不上」的毛病:判据点名的表一行都没写时直说那一步没办。 **指向两扇打不开的门,比不指还糟。** 界面不撒谎 · 日志只有三色:负责人绿 · 智能体蓝 · 系统灰(归侧五种是度量的分法,不是给人看的)。 · 验收收口答两件事:落了什么(按**交付物**点名,一份成果的几张表并成一行)、 往哪儿去(转出哪一口、带过去哪些字段);一个口都没发就直说到此为止。 · 签完到收尾之间那一段有自己的话「字已签下,正在落地」—— 中间态本来就该说出来,只是要说对。 · 消息不再被内部事件刷屏:只有从通道进来的件才谈得上「无人认领」。 · 建客户公司与联系人**一次确认落两行**;联系人编码自增不问人;卡面摆表的人读名。 A1 三案例端到端全 released:全 A 类直通 12 拍 / 客户点名跳一条 10 拍 / 新客户缺必填 14 拍。 五道门禁全绿(971 passed)。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JsTDjoHovERXyy6Wmw1ALp
105 lines
4.2 KiB
TypeScript
105 lines
4.2 KiB
TypeScript
/**
|
|
* 落地预检 —— 纯判定,零 IO(编码规范 §5.3;语义出处 OS 7.3,AM 06)。
|
|
*
|
|
* 「**检查可落地,才允许放行**:发放行卡前,系统对全部动作意向执行预检 ——
|
|
* ①入参 schema 校验 ②工具可用(未停用)与授权有效 ③连接可达
|
|
* ④目标预校验(工具契约含 validate 能力时)⑤数据冲突检查。
|
|
* 预检全过才发放行卡,卡面呈现的即已验证的动作清单;预检不过的意向打回环内修正,**不发卡**。」
|
|
*/
|
|
import type { AcceptanceLevel } from '@contracts';
|
|
|
|
export const PRECHECK_ITEMS = [
|
|
'input-schema',
|
|
'tool-available',
|
|
'connection-reachable',
|
|
'target-validate',
|
|
'data-conflict',
|
|
] as const;
|
|
export type PrecheckItem = (typeof PRECHECK_ITEMS)[number];
|
|
|
|
export const PRECHECK_ITEM_LABEL: Readonly<Record<PrecheckItem, string>> = {
|
|
'input-schema': '入参 schema 校验',
|
|
'tool-available': '工具可用与授权有效',
|
|
'connection-reachable': '连接可达',
|
|
'target-validate': '目标预校验',
|
|
'data-conflict': '数据冲突检查',
|
|
};
|
|
|
|
export type PrecheckFinding = {
|
|
readonly item: PrecheckItem;
|
|
/** 关联的动作意向;数据冲突项无意向,留空 */
|
|
readonly intentId?: string;
|
|
readonly message: string;
|
|
};
|
|
|
|
export type PrecheckReport = {
|
|
/** 全过才可发卡 */
|
|
readonly passed: boolean;
|
|
readonly findings: readonly PrecheckFinding[];
|
|
/** 已验证的动作清单 —— 通过时即验收工单卡面呈现的那份 */
|
|
readonly verified: ReadonlyArray<{ id: string; label: string; effect: 'read' | 'write'; detail: string }>;
|
|
};
|
|
|
|
export function summarize(
|
|
findings: readonly PrecheckFinding[],
|
|
verified: PrecheckReport['verified'],
|
|
): PrecheckReport {
|
|
return { passed: findings.length === 0, findings, verified };
|
|
}
|
|
|
|
/* ── 必交付物与判据 ─────────────────────────────────────────────────── */
|
|
|
|
export type DeliverableCheck = { readonly key: string; readonly label: string; readonly present: boolean };
|
|
export type CriterionCheck = {
|
|
readonly key: string;
|
|
readonly label: string;
|
|
readonly level: AcceptanceLevel;
|
|
readonly pass: boolean;
|
|
/** 裁量项(L3/L4)裁过没有 —— 机检项与 L5 不带这一维 */
|
|
readonly settled?: boolean | undefined;
|
|
/** 裁断的理由:裁成「不满足」时,这句话才是签字的人要看的东西 */
|
|
readonly rationale?: string | undefined;
|
|
};
|
|
|
|
/** 必交付物**缺一不得提交放行**(AM 01) */
|
|
export function missingDeliverables(checks: readonly DeliverableCheck[]): DeliverableCheck[] {
|
|
return checks.filter((c) => !c.present);
|
|
}
|
|
|
|
/**
|
|
* 判据全绿只是**可提交**,完成只出自放行通过(AM 10.2)。
|
|
* L1/L2 由引擎预检;L3–L5 按分级执行 —— L5 是责任关,不参与「可提交」判定。
|
|
*/
|
|
export function submittable(checks: readonly CriterionCheck[]): boolean {
|
|
return checks.filter((c) => c.level !== 'L5').every((c) => c.pass);
|
|
}
|
|
|
|
/* ── 落地收敛 ───────────────────────────────────────────────────────── */
|
|
|
|
export type LandingOutcome = {
|
|
readonly id: string;
|
|
readonly ok: boolean;
|
|
readonly error?: string;
|
|
readonly retryable: boolean;
|
|
};
|
|
|
|
export type LandingVerdict =
|
|
/** 落地收敛 —— 输出口可发射,终态方成「放行完成」 */
|
|
| { readonly kind: 'converged' }
|
|
/** 落地受阻 —— **运行态**不是终态;走落地失败卡,处置后仍收敛于终态名录 */
|
|
| { readonly kind: 'blocked'; readonly failures: readonly LandingOutcome[] };
|
|
|
|
/**
|
|
* 「放行通过即刻执行(附幂等键);落地收敛,输出口才发射 —— 下游只见落地完成的任务。
|
|
* 已成动作留存**不回滚**。」
|
|
*/
|
|
export function landingVerdict(outcomes: readonly LandingOutcome[]): LandingVerdict {
|
|
const failures = outcomes.filter((o) => !o.ok);
|
|
return failures.length === 0 ? { kind: 'converged' } : { kind: 'blocked', failures };
|
|
}
|
|
|
|
/** 幂等键:任务 × 意向 —— 重放不重复触达世界(OS 7.3) */
|
|
export function idempotencyKey(taskId: string, intentId: string): string {
|
|
return `${taskId}:${intentId}`;
|
|
}
|