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,207 +0,0 @@
1
- /**
2
- * EventBus - Event dispatch system for AI Agent Harness
3
- *
4
- * @module event-bus
5
- *
6
- * Features:
7
- * - on(event, handler) register a listener
8
- * - once(event, handler) one-time listener
9
- * - off(event, handler) unregister a listener
10
- * - emit(event, data) dispatch an event
11
- * - History recording and query for debugging
12
- * - Subscription objects with unsubscribe() support
13
- */
14
-
15
- 'use strict';
16
-
17
- var Logger = require('./logger');
18
- var logger = new Logger();
19
-
20
- class EventBus {
21
- /**
22
- * @public
23
- * @param {object} [options]
24
- * @param {number} [options.maxHistory=100] - max event history entries
25
- */
26
- constructor(options) {
27
- options = options || {};
28
- /** @type {Map<string, Set<Function>>} event -> handlers */
29
- this._handlers = new Map();
30
- /** @type {object[]} */
31
- this._history = [];
32
- /** @type {number} */
33
- this._maxHistory = options.maxHistory || 100;
34
- }
35
-
36
- // --- public API ---
37
-
38
- /**
39
- * Register an event handler.
40
- * @public
41
- * @param {string} event - event name
42
- * @param {Function} handler - callback(eventData)
43
- * @returns {{ unsubscribe: Function }} subscription handle
44
- */
45
- on(event, handler) {
46
- if (typeof handler !== 'function') {
47
- throw new TypeError('EventBus.on(): handler must be a function');
48
- }
49
- if (!this._handlers.has(event)) {
50
- this._handlers.set(event, new Set());
51
- }
52
- this._handlers.get(event).add(handler);
53
-
54
- var self = this;
55
- var handlers = this._handlers.get(event);
56
- return {
57
- unsubscribe: function () {
58
- handlers.delete(handler);
59
- if (handlers.size === 0) {
60
- self._handlers.delete(event);
61
- }
62
- },
63
- };
64
- }
65
-
66
- /**
67
- * Register a one-time event handler. Automatically removed after first invocation.
68
- * @public
69
- * @param {string} event
70
- * @param {Function} handler - callback(eventData)
71
- * @returns {{ unsubscribe: Function }}
72
- */
73
- once(event, handler) {
74
- if (typeof handler !== 'function') {
75
- throw new TypeError('EventBus.once(): handler must be a function');
76
- }
77
- var self = this;
78
- var wrapped = function (data) {
79
- handler(data);
80
- innerSub.unsubscribe();
81
- };
82
- var innerSub = this.on(event, wrapped);
83
- return innerSub;
84
- }
85
-
86
- /**
87
- * Unregister a specific handler from an event.
88
- * @public
89
- * @param {string} event
90
- * @param {Function} handler - the exact function reference originally passed to on()
91
- */
92
- off(event, handler) {
93
- var handlers = this._handlers.get(event);
94
- if (!handlers) return;
95
- handlers.delete(handler);
96
- if (handlers.size === 0) {
97
- this._handlers.delete(event);
98
- }
99
- }
100
-
101
- /**
102
- * Emit an event, calling all registered handlers synchronously.
103
- * Errors in individual handlers are caught and logged, not propagated.
104
- * @public
105
- * @param {string} event
106
- * @param {*} data
107
- */
108
- emit(event, data) {
109
- // Record in history
110
- this._history.push({
111
- event: event,
112
- data: data,
113
- timestamp: Date.now(),
114
- });
115
- if (this._history.length > this._maxHistory) {
116
- this._history.shift();
117
- }
118
-
119
- // Dispatch to handlers
120
- var handlers = this._handlers.get(event);
121
- if (!handlers) return;
122
-
123
- handlers.forEach(function (handler) {
124
- try {
125
- handler(data);
126
- } catch (err) {
127
- logger.error('event-bus', 'Error in handler for event "' + event + '": ' + err.message);
128
- }
129
- });
130
- }
131
-
132
- /**
133
- * Query event history for debugging.
134
- * @public
135
- * @param {object} [filter]
136
- * @param {string} [filter.event] - substring match on event name
137
- * @param {number} [filter.since] - timestamp lower bound (ms)
138
- * @param {number} [filter.until] - timestamp upper bound (ms)
139
- * @param {number} [filter.limit] - max entries to return
140
- * @returns {object[]}
141
- */
142
- getHistory(filter) {
143
- filter = filter || {};
144
- var results = this._history;
145
-
146
- if (filter.event) {
147
- var substr = filter.event;
148
- results = results.filter(function (e) {
149
- return e.event.indexOf(substr) !== -1;
150
- });
151
- }
152
- if (filter.since) {
153
- results = results.filter(function (e) { return e.timestamp >= filter.since; });
154
- }
155
- if (filter.until) {
156
- results = results.filter(function (e) { return e.timestamp <= filter.until; });
157
- }
158
- if (filter.limit) {
159
- results = results.slice(-filter.limit);
160
- }
161
-
162
- return results;
163
- }
164
-
165
- /**
166
- * Clear all event history.
167
- * @public
168
- */
169
- clearHistory() {
170
- this._history = [];
171
- }
172
-
173
- /**
174
- * Remove all handlers for a specific event, or all events.
175
- * @public
176
- * @param {string} [event] - if omitted, clears all handlers
177
- */
178
- removeAllListeners(event) {
179
- if (event) {
180
- this._handlers.delete(event);
181
- } else {
182
- this._handlers.clear();
183
- }
184
- }
185
-
186
- /**
187
- * Get the number of handlers registered for a given event.
188
- * @public
189
- * @param {string} event
190
- * @returns {number}
191
- */
192
- listenerCount(event) {
193
- var handlers = this._handlers.get(event);
194
- return handlers ? handlers.size : 0;
195
- }
196
-
197
- /**
198
- * Getter for event history (for testing compatibility).
199
- * @internal Use getHistory() for public access
200
- * @returns {object[]}
201
- */
202
- get events() {
203
- return this._history;
204
- }
205
- }
206
-
207
- module.exports = EventBus;