agentic-flow-kit 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-flow-kit",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "AI-Native 闭环工作流 + wiki 知识层脚手架——flow-kit init 一条命令为新项目装好 .agents 工作流引擎(阶段命令/角色契约/门禁钩子/kb 检索/看板/规则面预算)+ workflow 文档闭环 + wiki 知识库,装完自包含、零运行时依赖",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -677,12 +677,15 @@ function verifyEvidenceTruth(evidenceStr, planBase, root) {
677
677
  // 过程证据(2026-10-03 check-evidence-process):执行器驱动的提交可作验收证据——提交信息带
678
678
  // 「pipeline-run <runId>」标记(docsCommit 四种格式共有段,runId 严格形态 日期8-时间4-主题-尾;
679
679
  // 与 run 事件流同源,git 历史留痕可对质)。只救 irrelevant:forged(SHA 不存在)在前已判,其余判据不动。
680
+ // 记录型标志(2026-10-06-v114-backflow-batch):docs 系 Conventional Commit(冒烟报告 / 留痕 / 关单台账)
681
+ // 不触 plan 声明面属预期——是否降级豁免由检查 8 聚合段判(须同文档存在可过检实现证据),此处只出标志。
680
682
  const subj = spawnGit(['log', '-1', '--format=%s', sha]);
683
+ const recordCommit = subj.status === 0 && /^docs[(:]/.test(subj.stdout.trim());
681
684
  if (subj.status === 0 && /pipeline-run [0-9]{8}-[0-9]{4}-[A-Za-z0-9-]+/.test(subj.stdout)) {
682
685
  warnEvidenceExempt('process', planBase);
683
686
  return { ok: true, type: 'process' };
684
687
  }
685
- return { ok: false, type: 'irrelevant', msg: `提交 ${sha} 未触及 plan 声明的任何文件` };
688
+ return { ok: false, type: 'irrelevant', msg: `提交 ${sha} 未触及 plan 声明的任何文件`, recordCommit };
686
689
  }
687
690
 
688
691
  return { ok: true, type: 'sha' };
@@ -705,6 +708,7 @@ function verifyEvidenceTruth(evidenceStr, planBase, root) {
705
708
  let insec = false, ex = false;
706
709
  let pendX = false; // 上一 [x] 项尚无证据,证据可能在紧随的续行
707
710
  let currentEvidence = ''; // 当前条目的证据内容,用于语义校验
711
+ const evidenceItems = []; // 逐条证据(2026-10-06-v114-backflow-batch:两遍裁决——先文档级判实现证据在场,再逐条落判)
708
712
  const evRe = /证据[::]/;
709
713
  const closeItem = () => {
710
714
  if (pendX) {
@@ -712,10 +716,7 @@ function verifyEvidenceTruth(evidenceStr, planBase, root) {
712
716
  pendX = false;
713
717
  }
714
718
  if (currentEvidence && !ex) {
715
- const truth = verifyEvidenceTruth(currentEvidence, base.replace(/\.md$/, ''), ROOT);
716
- if (!truth.ok) {
717
- blockers.push(`- [证据${truth.type === 'forged' ? '伪造' : '无关'}] ${base} 验收证据校验失败: ${truth.msg}`);
718
- }
719
+ evidenceItems.push(currentEvidence);
719
720
  }
720
721
  currentEvidence = '';
721
722
  };
@@ -740,6 +741,23 @@ function verifyEvidenceTruth(evidenceStr, planBase, root) {
740
741
  }
741
742
  }
742
743
  closeItem(); // 节末(或全文末)仍无证据 → 计缺证据
744
+ // 两遍裁决(2026-10-06-v114-backflow-batch 记录型提交豁免):文档级先判「存在可过检实现证据」
745
+ // (sha / process 型任一),记录型提交(subject=docs 系)证据仅在实现证据在场时降级豁免告警——
746
+ // 冒烟报告 / approved 留痕 / 关单提交不改 plan 声明面属预期;仅引记录型而无实现证据 → 维持 hard-block
747
+ //(豁免通道不得独立成立,防「只引 docs 提交洗白代码改动」)。
748
+ if (evidenceItems.length) {
749
+ const planBase = base.replace(/.md$/, '');
750
+ const results = evidenceItems.map((ev) => ({ t: verifyEvidenceTruth(ev, planBase, ROOT) }));
751
+ const hasImplEvidence = results.some((r) => r.t.ok && (r.t.type === 'sha' || r.t.type === 'process'));
752
+ for (const r of results) {
753
+ if (r.t.ok) continue;
754
+ if (r.t.type === 'irrelevant' && r.t.recordCommit && hasImplEvidence) {
755
+ warnEvidenceExempt('record', planBase);
756
+ continue;
757
+ }
758
+ blockers.push(`- [证据${r.t.type === 'forged' ? '伪造' : '无关'}] ${base} 验收证据校验失败: ${r.t.msg}`);
759
+ }
760
+ }
743
761
  // 生效日锚 = git 首次加入日期(2026-09-28 改;此前取文件名前 10 字符)。**准确收益**:关掉
744
762
  // 「改文件名日期(日常必写、零成本)即整段跳过 hard 门」这条通道;锚取 author date(%aI),
745
763
  // 刻意伪造(`git commit --date=`)仍可绕过——与伪造台账同属本地信任边界内,不宣称"通道已关闭"。
@@ -429,6 +429,8 @@ const mkConfirmedDoc = (root, rel, fmBody) => {
429
429
  fs.mkdirSync(path.join(T, '.agents', 'scripts'), { recursive: true });
430
430
  fs.copyFileSync(path.join(SCRIPT_DIR, 'rule-budget.sh'), path.join(T, '.agents', 'scripts', 'rule-budget.sh'));
431
431
  fs.copyFileSync(path.join(SCRIPT_DIR, '..', 'rule-budgets.txt'), path.join(T, '.agents', 'rule-budgets.txt'));
432
+ // 超限样本自校准:从拷入的预算表读 AGENTS.md 上限(预算可上调,硬编码样本会随上调失效——2026-10-06-v114-backflow-batch)
433
+ const agLimit = Number(fs.readFileSync(path.join(T, '.agents', 'rule-budgets.txt'), 'utf8').split(/\r?\n/).find((l) => l.startsWith('AGENTS.md ')).trim().split(' ').pop());
432
434
  w(T, 'AGENTS.md', '# AGENTS 小体积 fixture\n');
433
435
  fs.mkdirSync(path.join(T, '.agents', 'commands'), { recursive: true });
434
436
  w(T, '.agents/commands/plan.md', '# 小命令\n');
@@ -436,7 +438,7 @@ const mkConfirmedDoc = (root, rel, fmBody) => {
436
438
  w(T, 'workflow/plans/2026-09-22-budget-ok.md', PLAN('budget ok', '状态: approved\n级别: L1\n模块: pipeline'));
437
439
  let r = run(T);
438
440
  check('常驻面预算:合规 → 无超限告警且 exit 0', r.status === 0 && !outOf(r).includes('WARN 常驻面超限'), outOf(r));
439
- w(T, 'AGENTS.md', 'x'.repeat(8000));
441
+ w(T, 'AGENTS.md', 'x'.repeat(agLimit + 512));
440
442
  w(T, 'workflow/intents/2026-09-22-budget-bad.md', INTENT('budget bad', '状态: approved\n级别: L1\n日期: 2026-09-22\n模块: pipeline'));
441
443
  w(T, 'workflow/plans/2026-09-22-budget-bad.md', PLAN('budget bad', '状态: approved\n级别: L1\n模块: pipeline'));
442
444
  r = run(T);
@@ -455,8 +457,9 @@ const mkConfirmedDoc = (root, rel, fmBody) => {
455
457
  fs.mkdirSync(path.join(T, '.agents', 'scripts'), { recursive: true });
456
458
  fs.copyFileSync(path.join(SCRIPT_DIR, 'rule-budget.sh'), path.join(T, '.agents', 'scripts', 'rule-budget.sh'));
457
459
  fs.copyFileSync(path.join(SCRIPT_DIR, '..', 'rule-budgets.txt'), path.join(T, '.agents', 'rule-budgets.txt'));
460
+ const agLimit = Number(fs.readFileSync(path.join(T, '.agents', 'rule-budgets.txt'), 'utf8').split(/\r?\n/).find((l) => l.startsWith('AGENTS.md ')).trim().split(' ').pop());
458
461
  gitInit(T);
459
- w(T, 'AGENTS.md', 'x'.repeat(8000));
462
+ w(T, 'AGENTS.md', 'x'.repeat(agLimit + 512));
460
463
  gitRetry(['add', 'AGENTS.md'], T);
461
464
  let r = spawnSync('sh', ['.agents/scripts/rule-budget.sh', '--staged'], { cwd: T, encoding: 'utf8' });
462
465
  check('rule-budget --staged:暂存超限 → exit 1(硬拦路径)',
@@ -2563,5 +2566,26 @@ w(T, 'workflow/intents/2026-09-12-deep.md', INTENT('deep', '状态: draft\n级
2563
2566
  rmfix(T);
2564
2567
  }
2565
2568
 
2569
+ // ---- 场景:检查 8 记录型提交豁免——docs 系证据 + 实现证据在场 → 豁免;仅 docs 证据 → hard(2026-10-06-v114-backflow-batch)----
2570
+ {
2571
+ const T = mkfix();
2572
+ gitInit(T);
2573
+ w(T, 'workflow/plans/2026-09-12-rec.md', PLAN('rec', '状态: done\n级别: L1\n日期: 2026-09-12', '\n## 改动面\n- src/impl.txt: 实现改动\n'));
2574
+ fs.mkdirSync(path.join(T, 'src'), { recursive: true });
2575
+ w(T, 'src/impl.txt', 'impl\n');
2576
+ gitCommitAll(T, 'feat: impl change');
2577
+ const implSha = shortSha(T);
2578
+ w(T, 'record-note.md', 'record\n');
2579
+ gitCommitAll(T, 'docs: 记录留痕');
2580
+ const docsSha = shortSha(T);
2581
+ w(T, 'workflow/intents/2026-09-12-rec.md', INTENT('rec', '状态: done\n级别: L1\n日期: 2026-09-12', `\n## 验收标准(可测试)\n- [x] 实现(证据:commit ${implSha})\n- [x] 记录(证据:commit ${docsSha})\n`));
2582
+ let r = run(T);
2583
+ check('检查 8 记录型豁免:docs 证据 + 实现证据在场 → 豁免且 exit 0', r.status === 0 && outOf(r).includes('证据豁免 record'), outOf(r));
2584
+ w(T, 'workflow/intents/2026-09-12-rec.md', INTENT('rec', '状态: done\n级别: L1\n日期: 2026-09-12', `\n## 验收标准(可测试)\n- [x] 记录(证据:commit ${docsSha})\n`));
2585
+ r = run(T);
2586
+ check('检查 8 记录型豁免:仅 docs 证据无实现证据 → 仍 hard 证据无关', r.status === 1 && outOf(r).includes('证据无关'), outOf(r));
2587
+ rmfix(T);
2588
+ }
2589
+
2566
2590
  console.log(`\n合计: PASS ${pass} / FAIL ${fail}`);
2567
2591
  process.exit(fail ? 1 : 0);
@@ -25,6 +25,18 @@ export const POLICIES = {
25
25
  stageGateSince: '2026-09-29', // 检查 19 逐阶段审计的生效日(2026-09-30 stage-gate-machine);锚 = 台账 ts 的 UTC 日期(复核 P2-3:本批 ts 2026-09-29T17:33Z 落在受审范围,顺序合规故静默);v1 无此键 → 该检查整体跳过
26
26
  riskLevelSince: '2026-10-01', // intent risk_level 双字段协议生效日(2026-10-01 hybrid-governance 落地 fill-intent 双写;2026-10-02 caliber-convergence 方案 C 引入消费)——此日前建档的 intent 无该字段不判 suspect;v1 无此键 → 双字段协议视为从未生效(单字段判)
27
27
  },
28
+ // 版本 3 = 版本 1 的五个日期,仅确认门两锚后移至装户确认纪律全量执行日(2026-10-06)。
29
+ // 背景(2026-10-06-v114-backflow-batch):装户确认台账机制 09-27 上线但长期未运转——10-05 首次使用(demand-remain 链路),
30
+ // 同日后半夜的 pml 批次仍未过账,纪律全量执行实始于 10-06;故锚定 10-06(首用日 10-05 作废:同日边界拦不干净,装户实测)。
31
+ // 存量(< 2026-10-06)整体落入既有「存量豁免」,新档照常受管。以 v1 为基线、不夹带 v2 键激活;
32
+ // 装户经 kit.json policyVersion: 3 选入,kit 仓自身维持 v1。
33
+ 3: {
34
+ moduleSince: '2026-09-22',
35
+ check14Since: '2026-09-23',
36
+ confirmDocsEffective: '2026-10-06',
37
+ confirmIncidentsEffective: '2026-10-06',
38
+ bindingTs: '2026-09-28',
39
+ },
28
40
  };
29
41
 
30
42
  export function loadKitPolicy(root) {