doukui 0.6.0 → 0.9.0

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.
Files changed (92) hide show
  1. package/README.en.md +85 -18
  2. package/README.md +32 -72
  3. package/bin/commands/help.js +2 -25
  4. package/bin/commands/plan-lint.js +105 -0
  5. package/bin/commands/verify.js +263 -0
  6. package/bin/doukui.js +3 -3
  7. package/package.json +2 -3
  8. package/plugins/core/hook-session-start/index.js +1 -1
  9. package/plugins/core/hook-skill-gate/index.js +64 -15
  10. package/plugins/core/hook-skill-gate/plugin.json +1 -1
  11. package/plugins/core/skill-agent-dispatcher/cleanup-reference.md +7 -28
  12. package/plugins/core/skill-agent-dispatcher/monitoring-reference.md +89 -0
  13. package/plugins/core/skill-agent-dispatcher/plugin.json +1 -1
  14. package/plugins/core/skill-agent-dispatcher/recovery-reference.md +132 -0
  15. package/plugins/core/skill-agent-dispatcher/roles-reference.md +9 -22
  16. package/plugins/core/skill-agent-dispatcher/skill.md +124 -796
  17. package/plugins/core/skill-agentic-loop/mirror-rules.md +95 -24
  18. package/plugins/core/skill-agentic-loop/plugin.json +2 -7
  19. package/plugins/core/skill-agentic-loop/skill.md +125 -354
  20. package/plugins/core/skill-batch-task-creator/plugin.json +1 -1
  21. package/plugins/core/skill-checklist/skill.md +15 -141
  22. package/plugins/core/skill-completion-report/plugin.json +1 -1
  23. package/plugins/core/skill-completion-report/skill.md +7 -1
  24. package/plugins/core/skill-doukui-plan/plugin.json +1 -1
  25. package/plugins/core/skill-doukui-plan/skill.md +24 -21
  26. package/plugins/core/skill-experience-logger/plugin.json +1 -1
  27. package/plugins/core/skill-human-checkpoint/skill.md +1 -0
  28. package/plugins/core/skill-split-work-package/plugin.json +1 -1
  29. package/plugins/core/skill-task-creator/plugin.json +1 -1
  30. package/plugins/core/skill-task-creator/skill.md +1 -139
  31. package/plugins/core/skill-workflow-orchestrator/plugin.json +1 -1
  32. package/plugins/plugin-registry.json +0 -48
  33. package/plugins/runtime/harness-build.js +5 -5
  34. package/plugins/runtime/plan-reader.js +54 -21
  35. package/plugins/runtime/resolve-plugin-path.js +2 -2
  36. package/templates/harness-config.yaml +0 -100
  37. package/bin/commands/loop-server.js +0 -357
  38. package/bin/commands/loop.js +0 -1508
  39. package/plugins/contracts/capabilities.js +0 -268
  40. package/plugins/contracts/checkresult-schema.json +0 -75
  41. package/plugins/core/provider-loop-engine/index.js +0 -1411
  42. package/plugins/core/provider-loop-engine/plugin.json +0 -15
  43. package/plugins/core/provider-memory-store/index.js +0 -510
  44. package/plugins/core/provider-memory-store/plugin.json +0 -9
  45. package/plugins/core/provider-state-store/index.js +0 -244
  46. package/plugins/core/provider-state-store/plugin.json +0 -9
  47. package/plugins/core/provider-watchdog/assets/daemon-config.template.json +0 -32
  48. package/plugins/core/provider-watchdog/assets/lib/watchdog-multi-window.js +0 -676
  49. package/plugins/core/provider-watchdog/assets/watchdog.js +0 -754
  50. package/plugins/core/provider-watchdog/index.js +0 -151
  51. package/plugins/core/provider-watchdog/plugin.json +0 -13
  52. package/plugins/core/skill-agent-dispatcher/daemon-helpers-reference.md +0 -249
  53. package/plugins/core/skill-watchdog-manager/plugin.json +0 -10
  54. package/plugins/core/skill-watchdog-manager/skill.md +0 -143
  55. package/plugins/core/validator-doc-sync/index.js +0 -248
  56. package/plugins/core/validator-doc-sync/plugin.json +0 -12
  57. package/plugins/core/validator-work-package/index.js +0 -300
  58. package/plugins/core/validator-work-package/plugin.json +0 -12
  59. package/plugins/runtime/audit-logger.js +0 -311
  60. package/plugins/runtime/build-cli.js +0 -89
  61. package/plugins/runtime/checkresult-validator.js +0 -131
  62. package/plugins/runtime/context-window.js +0 -81
  63. package/plugins/runtime/event-bus.js +0 -207
  64. package/plugins/runtime/executor-claude.js +0 -604
  65. package/plugins/runtime/executor-default.js +0 -448
  66. package/plugins/runtime/executor-local.js +0 -178
  67. package/plugins/runtime/executor-sdk.js +0 -415
  68. package/plugins/runtime/hook-dispatcher.js +0 -315
  69. package/plugins/runtime/loop-actuator.js +0 -292
  70. package/plugins/runtime/loop-coordinator.js +0 -347
  71. package/plugins/runtime/loop-defaults.js +0 -29
  72. package/plugins/runtime/loop-dispatch-batch.js +0 -351
  73. package/plugins/runtime/loop-executor.js +0 -120
  74. package/plugins/runtime/loop-report.js +0 -395
  75. package/plugins/runtime/loop-server-core.js +0 -750
  76. package/plugins/runtime/loop-snapshot.js +0 -581
  77. package/plugins/runtime/loop-trace.js +0 -242
  78. package/plugins/runtime/loop-worktree.js +0 -404
  79. package/plugins/runtime/multi-window-coordinator.js +0 -560
  80. package/plugins/runtime/objective-verifier.js +0 -136
  81. package/plugins/runtime/plan-lint.js +0 -106
  82. package/plugins/runtime/plugin-loader.js +0 -798
  83. package/plugins/runtime/plugin-trust.js +0 -182
  84. package/plugins/runtime/provider-failover.js +0 -114
  85. package/plugins/runtime/provider-resolver.js +0 -342
  86. package/plugins/runtime/reflection-evaluator.js +0 -545
  87. package/plugins/runtime/sandbox-context.js +0 -235
  88. package/plugins/runtime/sandbox-manager.js +0 -609
  89. package/plugins/runtime/sandbox-worker.js +0 -215
  90. package/plugins/runtime/self-rescue-ladder.js +0 -51
  91. package/plugins/runtime/text-tokenize.js +0 -25
  92. package/plugins/runtime/validator-pipeline.js +0 -475
@@ -1,106 +0,0 @@
1
- 'use strict';
2
-
3
- // ---------------------------------------------------------------------------
4
- // Plan Lint(v0.3.1 T4——plan 质量前置闸)
5
- // ---------------------------------------------------------------------------
6
- // 北极星:① 失败前置暴露(verify 命令拼错要等 dispatch 后 15min 超时才炸,
7
- // 人得盯着第一轮翻车)② 废轮清零(一轮全额 input 白付)。
8
- //
9
- // parsePlanToGoal 之后、loop 启动之前跑三道检查:
10
- // ERROR(拒启):
11
- // - WP checklist 为空(isExecutableSection 靠动词放行的 section——
12
- // executor 自报判定无依据,proximity 语义失效)
13
- // WARNING(放行但告警):
14
- // - [verify: cmd] 命令的首 token 在本机 PATH 上不可见(拼错如 npm tset
15
- // 提前暴露;只探测可执行名存在性,不实跑命令)
16
- // - 整份 plan 零 verify 覆盖(S5 客观验证缺位,全靠 LLM 自报)
17
- // ---------------------------------------------------------------------------
18
-
19
- var spawnSync = require('child_process').spawnSync;
20
-
21
- /**
22
- * 探测命令首 token 在本机是否可见(where/which,3s 超时;探测失败视为可见——
23
- * 探测机制本身不可靠时不误杀)。
24
- * @param {string} command
25
- * @returns {boolean|null} true=可见 false=不可见 null=无法判定
26
- */
27
- function commandResolvable(command) {
28
- var first = String(command || '').trim().split(/\s+|&&|\|\||;/)[0].replace(/^["']|["']$/g, '');
29
- if (!first || !/^[\w.\-/]+$/.test(first)) return null; // 复合/特殊命令无法静态判定
30
- try {
31
- var res = process.platform === 'win32'
32
- ? spawnSync('where', [first], { timeout: 3000, stdio: ['ignore', 'pipe', 'pipe'] })
33
- : spawnSync('which', [first], { timeout: 3000, stdio: ['ignore', 'pipe', 'pipe'] });
34
- if (res.status === 0) return true;
35
- if (res.status === 1) return false;
36
- return null; // where/which 自身异常 → 不判定
37
- } catch (_e) {
38
- return null;
39
- }
40
- }
41
-
42
- /**
43
- * lint 一份解析后的 plan。
44
- * @param {object} parsed parsePlanToGoal 产物(含 workPackages/goal)
45
- * @param {object} [opts] { skipCommandProbe } 测试/CI 可关探测
46
- * @returns {{ errors: string[], warnings: string[], verifyTotal: number, verifyWithCommand: number }}
47
- */
48
- function lintPlan(parsed, opts) {
49
- opts = opts || {};
50
- var errors = [];
51
- var warnings = [];
52
- var wps = (parsed && parsed.workPackages) || [];
53
- var verifyTotal = 0;
54
- var verifyWithCommand = 0;
55
-
56
- for (var i = 0; i < wps.length; i++) {
57
- var wp = wps[i];
58
- var checklist = wp.checklist || [];
59
- if (checklist.length === 0) {
60
- // 语义章节(成功标准/验收标准/背景/目标)被历史 WP 编号行为编入 workPackages
61
- // 属契约模糊而非 plan 缺陷——降级 warning 不拒启(实测 todo-cli-smoke fixture
62
- // 的「## 成功标准」即此形态)。执行型章节空 checklist 才是 ERROR。
63
- var semantic = /^(成功标准|验收标准|背景|目标|success|acceptance|background|goal)/i.test(wp.title || '');
64
- var msg = 'WP ' + wp.wpId + '(' + (wp.title || '') + ')checklist 为空';
65
- if (semantic) {
66
- warnings.push(msg + '(语义章节,非执行单元)');
67
- } else {
68
- errors.push(msg + '——executor 无判定依据,proximity 语义失效。' +
69
- '请在 plan 中为该章节补验收任务项(- [ ] ...),或将其改名/并入成功标准章节');
70
- }
71
- continue;
72
- }
73
- for (var j = 0; j < checklist.length; j++) {
74
- var item = checklist[j];
75
- if (!item.verify || !item.verify.command) continue;
76
- verifyTotal++;
77
- if (opts.skipCommandProbe) {
78
- verifyWithCommand++;
79
- continue;
80
- }
81
- // v0.4.0 CI flaky 修复:probeFn 注入点(DI-over-mocking 纪律,先例 spawnFn/gitStatusFn)。
82
- // 根因:真实 where/which 探测在 Windows CI 高负载下偶发超 3s → status null →
83
- // 不告警 → 测试断言挂(第一轮过第二轮挂的竞态)。测试注入 probeFn 确定性返回,
84
- // 不再赌系统命令速度;生产路径不变(null = 探测失败保守不告警,宁漏报不误报)。
85
- var resolvable = (typeof opts.probeFn === 'function')
86
- ? opts.probeFn(item.verify.command)
87
- : commandResolvable(item.verify.command);
88
- if (resolvable === false) {
89
- warnings.push('WP ' + wp.wpId + ' 验收项「' + item.item + '」的 verify 命令首个可执行名在本机 PATH 不可见: "' +
90
- item.verify.command + '"——请确认命令拼写或该依赖已安装(否则该验收项将在实跑时失败)');
91
- verifyWithCommand++;
92
- } else {
93
- verifyWithCommand++;
94
- }
95
- }
96
- }
97
-
98
- if (wps.length > 0 && verifyTotal === 0) {
99
- warnings.push('整份 plan 零 [verify: command] 验收项——S5 客观验证缺位,判定完全依赖 LLM 自报' +
100
- '(可靠性低且费 token)。建议为可命令化的验收项补 verify 标记');
101
- }
102
-
103
- return { errors: errors, warnings: warnings, verifyTotal: verifyTotal, verifyWithCommand: verifyWithCommand };
104
- }
105
-
106
- module.exports = { lintPlan: lintPlan, commandResolvable: commandResolvable };