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.
- package/README.en.md +85 -18
- package/README.md +32 -72
- package/bin/commands/help.js +2 -25
- package/bin/commands/plan-lint.js +105 -0
- package/bin/commands/verify.js +263 -0
- package/bin/doukui.js +3 -3
- package/package.json +2 -3
- package/plugins/core/hook-session-start/index.js +1 -1
- package/plugins/core/hook-skill-gate/index.js +64 -15
- package/plugins/core/hook-skill-gate/plugin.json +1 -1
- package/plugins/core/skill-agent-dispatcher/cleanup-reference.md +7 -28
- package/plugins/core/skill-agent-dispatcher/monitoring-reference.md +89 -0
- package/plugins/core/skill-agent-dispatcher/plugin.json +1 -1
- package/plugins/core/skill-agent-dispatcher/recovery-reference.md +132 -0
- package/plugins/core/skill-agent-dispatcher/roles-reference.md +9 -22
- package/plugins/core/skill-agent-dispatcher/skill.md +124 -796
- package/plugins/core/skill-agentic-loop/mirror-rules.md +95 -24
- package/plugins/core/skill-agentic-loop/plugin.json +2 -7
- package/plugins/core/skill-agentic-loop/skill.md +125 -354
- package/plugins/core/skill-batch-task-creator/plugin.json +1 -1
- package/plugins/core/skill-checklist/skill.md +15 -141
- package/plugins/core/skill-completion-report/plugin.json +1 -1
- package/plugins/core/skill-completion-report/skill.md +7 -1
- package/plugins/core/skill-doukui-plan/plugin.json +1 -1
- package/plugins/core/skill-doukui-plan/skill.md +24 -21
- package/plugins/core/skill-experience-logger/plugin.json +1 -1
- package/plugins/core/skill-human-checkpoint/skill.md +1 -0
- package/plugins/core/skill-split-work-package/plugin.json +1 -1
- package/plugins/core/skill-task-creator/plugin.json +1 -1
- package/plugins/core/skill-task-creator/skill.md +1 -139
- package/plugins/core/skill-workflow-orchestrator/plugin.json +1 -1
- package/plugins/plugin-registry.json +0 -48
- package/plugins/runtime/harness-build.js +5 -5
- package/plugins/runtime/plan-reader.js +54 -21
- package/plugins/runtime/resolve-plugin-path.js +2 -2
- package/templates/harness-config.yaml +0 -100
- package/bin/commands/loop-server.js +0 -357
- package/bin/commands/loop.js +0 -1508
- package/plugins/contracts/capabilities.js +0 -268
- package/plugins/contracts/checkresult-schema.json +0 -75
- package/plugins/core/provider-loop-engine/index.js +0 -1411
- package/plugins/core/provider-loop-engine/plugin.json +0 -15
- package/plugins/core/provider-memory-store/index.js +0 -510
- package/plugins/core/provider-memory-store/plugin.json +0 -9
- package/plugins/core/provider-state-store/index.js +0 -244
- package/plugins/core/provider-state-store/plugin.json +0 -9
- package/plugins/core/provider-watchdog/assets/daemon-config.template.json +0 -32
- package/plugins/core/provider-watchdog/assets/lib/watchdog-multi-window.js +0 -676
- package/plugins/core/provider-watchdog/assets/watchdog.js +0 -754
- package/plugins/core/provider-watchdog/index.js +0 -151
- package/plugins/core/provider-watchdog/plugin.json +0 -13
- package/plugins/core/skill-agent-dispatcher/daemon-helpers-reference.md +0 -249
- package/plugins/core/skill-watchdog-manager/plugin.json +0 -10
- package/plugins/core/skill-watchdog-manager/skill.md +0 -143
- package/plugins/core/validator-doc-sync/index.js +0 -248
- package/plugins/core/validator-doc-sync/plugin.json +0 -12
- package/plugins/core/validator-work-package/index.js +0 -300
- package/plugins/core/validator-work-package/plugin.json +0 -12
- package/plugins/runtime/audit-logger.js +0 -311
- package/plugins/runtime/build-cli.js +0 -89
- package/plugins/runtime/checkresult-validator.js +0 -131
- package/plugins/runtime/context-window.js +0 -81
- package/plugins/runtime/event-bus.js +0 -207
- package/plugins/runtime/executor-claude.js +0 -604
- package/plugins/runtime/executor-default.js +0 -448
- package/plugins/runtime/executor-local.js +0 -178
- package/plugins/runtime/executor-sdk.js +0 -415
- package/plugins/runtime/hook-dispatcher.js +0 -315
- package/plugins/runtime/loop-actuator.js +0 -292
- package/plugins/runtime/loop-coordinator.js +0 -347
- package/plugins/runtime/loop-defaults.js +0 -29
- package/plugins/runtime/loop-dispatch-batch.js +0 -351
- package/plugins/runtime/loop-executor.js +0 -120
- package/plugins/runtime/loop-report.js +0 -395
- package/plugins/runtime/loop-server-core.js +0 -750
- package/plugins/runtime/loop-snapshot.js +0 -581
- package/plugins/runtime/loop-trace.js +0 -242
- package/plugins/runtime/loop-worktree.js +0 -404
- package/plugins/runtime/multi-window-coordinator.js +0 -560
- package/plugins/runtime/objective-verifier.js +0 -136
- package/plugins/runtime/plan-lint.js +0 -106
- package/plugins/runtime/plugin-loader.js +0 -798
- package/plugins/runtime/plugin-trust.js +0 -182
- package/plugins/runtime/provider-failover.js +0 -114
- package/plugins/runtime/provider-resolver.js +0 -342
- package/plugins/runtime/reflection-evaluator.js +0 -545
- package/plugins/runtime/sandbox-context.js +0 -235
- package/plugins/runtime/sandbox-manager.js +0 -609
- package/plugins/runtime/sandbox-worker.js +0 -215
- package/plugins/runtime/self-rescue-ladder.js +0 -51
- package/plugins/runtime/text-tokenize.js +0 -25
- package/plugins/runtime/validator-pipeline.js +0 -475
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Loop Coordinator — 多 Agentic Loop 实例全局协调
|
|
3
|
-
*
|
|
4
|
-
* @module loop-coordinator
|
|
5
|
-
*
|
|
6
|
-
* 复用 multi-window-coordinator.aggregateWindowStates 的聚合模式(design.md §2.1.5、
|
|
7
|
-
* §10 WP-174-5 提示),把每个 loop 实例当作"逻辑窗口",聚合各 loop 的
|
|
8
|
-
* iteration/proximity/verdict/health,产出全局收敛视角。
|
|
9
|
-
*
|
|
10
|
-
* 职责边界(design.md §6.5 / §7.1):
|
|
11
|
-
* - 只读聚合各 loop 状态(不写各 loop 自身状态,避免多进程并发写——state-store.js:19-23
|
|
12
|
-
* 明确不支持多进程并发写)。
|
|
13
|
-
* - 提供全局 verdict:所有 loop achieved → global_achieved(可进 P4);
|
|
14
|
-
* 任一 loop circuit_broken/terminated → global_circuit_broken(全局回退);
|
|
15
|
-
* 任一 loop diverged/timeout → global_failed(回 P1);否则 global_running。
|
|
16
|
-
* - 不越界:coordinator 不调度、不拆分、不干预各 loop 内部状态机;仅作全局判定与汇总。
|
|
17
|
-
*
|
|
18
|
-
* 并发策略(design.md §8.3 / state-store CONCURRENCY NOTES):
|
|
19
|
-
* - 每 loop 独立 namespace `loop.{loopId}`,由各 loop 进程单写。
|
|
20
|
-
* - coordinator 通过注入的 store 查询多 loop 状态(listKeys 前缀扫描 + get),
|
|
21
|
-
* 读取失败的单 loop 降级为 disconnected,不阻断聚合。
|
|
22
|
-
*
|
|
23
|
-
* Work package: WP-174-5-impl-converge
|
|
24
|
-
* Design ref: docs/reports/agentic-loop-design.md §2.1.5、§6、§10
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
'use strict';
|
|
28
|
-
|
|
29
|
-
// ---------------------------------------------------------------------------
|
|
30
|
-
// 常量
|
|
31
|
-
// ---------------------------------------------------------------------------
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* 终止类 verdict(design.md §6.1-6.3)。running/continue 视为仍在迭代。
|
|
35
|
-
* 状态字符串与 loop-engine createLoopState().status 对齐。
|
|
36
|
-
*/
|
|
37
|
-
var TERMINAL_VERDICTS = {
|
|
38
|
-
achieved: true,
|
|
39
|
-
timeout: true,
|
|
40
|
-
diverged: true,
|
|
41
|
-
circuit_broken: true,
|
|
42
|
-
aborted: true,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* 熔断类 verdict(任一出现即触发全局回退,最高优先级)。
|
|
47
|
-
*/
|
|
48
|
-
var CIRCUIT_VERDICTS = {
|
|
49
|
-
circuit_broken: true,
|
|
50
|
-
aborted: true,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* 失败回退类 verdict(回 P1 人介入,但非熔断)。
|
|
55
|
-
*/
|
|
56
|
-
var FAILED_VERDICTS = {
|
|
57
|
-
timeout: true,
|
|
58
|
-
diverged: true,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
// ---------------------------------------------------------------------------
|
|
62
|
-
// 工具函数
|
|
63
|
-
// ---------------------------------------------------------------------------
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* ISO 时间戳。
|
|
67
|
-
* @returns {string}
|
|
68
|
-
*/
|
|
69
|
-
function nowIso() {
|
|
70
|
-
return new Date().toISOString();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* 从单个 loop 状态提取协调器所需摘要视图(仿 multi-window aggregateSingleWindow)。
|
|
75
|
-
*
|
|
76
|
-
* @param {string} loopId
|
|
77
|
-
* @param {object|null} state - loop-engine 的 LoopState(state-store 中 loop.{loopId})
|
|
78
|
-
* @returns {object} 单 loop 协调摘要
|
|
79
|
-
*/
|
|
80
|
-
function summarizeLoop(loopId, state) {
|
|
81
|
-
if (!state) {
|
|
82
|
-
return {
|
|
83
|
-
loopId: loopId,
|
|
84
|
-
status: 'disconnected',
|
|
85
|
-
iteration: 0,
|
|
86
|
-
proximity: 0,
|
|
87
|
-
verdict: null,
|
|
88
|
-
health: 'unknown',
|
|
89
|
-
diverged: false,
|
|
90
|
-
updatedAt: null,
|
|
91
|
-
error: 'state-missing',
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
var verdict = state.lastVerdict && state.lastVerdict.verdict
|
|
96
|
-
? state.lastVerdict.verdict
|
|
97
|
-
: null;
|
|
98
|
-
var evalResult = state.lastEval || {};
|
|
99
|
-
var snapshot = state.lastSnapshot || {};
|
|
100
|
-
var watchdog = snapshot.watchdog || {};
|
|
101
|
-
|
|
102
|
-
// health 优先取 watchdog 健康字段,回退 status 推断
|
|
103
|
-
var health = watchdog.health || (state.status === 'circuit_broken' ? 'terminated' : 'healthy');
|
|
104
|
-
|
|
105
|
-
return {
|
|
106
|
-
loopId: loopId,
|
|
107
|
-
status: state.status || 'unknown',
|
|
108
|
-
iteration: state.iteration || 0,
|
|
109
|
-
proximity: typeof evalResult.proximity === 'number' ? evalResult.proximity : 0,
|
|
110
|
-
verdict: verdict,
|
|
111
|
-
health: health,
|
|
112
|
-
diverged: !!(evalResult.diverged),
|
|
113
|
-
divergenceStreak: evalResult.divergenceStreak || state.divergenceStreak || 0,
|
|
114
|
-
updatedAt: state.lastUpdatedAt || null,
|
|
115
|
-
error: null,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// ---------------------------------------------------------------------------
|
|
120
|
-
// 聚合器
|
|
121
|
-
// ---------------------------------------------------------------------------
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* 聚合多 loop 实例状态为全局协调视图(复用 aggregateWindowStates 模式)。
|
|
125
|
-
*
|
|
126
|
-
* 数据来源:
|
|
127
|
-
* - 首选 `loopStates` 数组(调用方已通过 state-store.get('loop.{loopId}') 拉取,
|
|
128
|
-
* 适用于明确知道 loopId 集合的场景,跨进程读最安全)。
|
|
129
|
-
* - 若传入 `store`(state-store 实例)且未提供 loopStates,则尝试前缀扫描
|
|
130
|
-
* `loop.` 开头的 key 聚合(依赖 store.listKeys/listByPrefix 能力,能力缺失时
|
|
131
|
-
* 返回空聚合,不报错)。
|
|
132
|
-
*
|
|
133
|
-
* @param {object} opts
|
|
134
|
-
* @param {Array<object>} [opts.loopStates] - 各 loop 的 LoopState 数组(loopId 字段必填)
|
|
135
|
-
* @param {object} [opts.store] - state-store 实例(提供 listKeys/get)
|
|
136
|
-
* @param {string} [opts.sessionId] - 可选会话 ID(多 loop 会话标识)
|
|
137
|
-
* @returns {Promise<object>} 全局协调视图(global verdict + 各 loop 摘要 + 全局计数)
|
|
138
|
-
*/
|
|
139
|
-
async function aggregateLoopStates(opts) {
|
|
140
|
-
opts = opts || {};
|
|
141
|
-
var now = nowIso();
|
|
142
|
-
|
|
143
|
-
// 收集 loopState 列表
|
|
144
|
-
var states = [];
|
|
145
|
-
if (Array.isArray(opts.loopStates)) {
|
|
146
|
-
states = opts.loopStates;
|
|
147
|
-
} else if (opts.store) {
|
|
148
|
-
states = await collectLoopStatesFromStore(opts.store);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// 构建 loop 摘要映射
|
|
152
|
-
var loops = {};
|
|
153
|
-
var loopIds = [];
|
|
154
|
-
for (var i = 0; i < states.length; i++) {
|
|
155
|
-
var st = states[i] || {};
|
|
156
|
-
var lid = st.loopId;
|
|
157
|
-
if (!lid) continue; // 无 loopId 的脏数据跳过
|
|
158
|
-
loops[lid] = summarizeLoop(lid, st);
|
|
159
|
-
loopIds.push(lid);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// 全局计数
|
|
163
|
-
var global = computeGlobalState(loops, loopIds);
|
|
164
|
-
|
|
165
|
-
return {
|
|
166
|
-
session_id: opts.sessionId || ('loop-session-' + now.replace(/[:.]/g, '').slice(0, 15)),
|
|
167
|
-
aggregated_at: now,
|
|
168
|
-
total_loops: loopIds.length,
|
|
169
|
-
loops: loops,
|
|
170
|
-
global: global,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* 从 state-store 收集所有 `loop.` 前缀的 loop 状态(跨 loop 进程的只读聚合)。
|
|
176
|
-
*
|
|
177
|
-
* state-store 不支持 listKeys 时返回空数组(降级,不阻断)。
|
|
178
|
-
* @private
|
|
179
|
-
* @param {object} store
|
|
180
|
-
* @returns {Promise<Array<object>>}
|
|
181
|
-
*/
|
|
182
|
-
async function collectLoopStatesFromStore(store) {
|
|
183
|
-
if (!store) return [];
|
|
184
|
-
// 优先用显式 listByPrefix(若 store 提供),否则尝试通用 listKeys 过滤
|
|
185
|
-
var keys = [];
|
|
186
|
-
try {
|
|
187
|
-
if (typeof store.listByPrefix === 'function') {
|
|
188
|
-
keys = await store.listByPrefix('loop.');
|
|
189
|
-
} else if (typeof store.listKeys === 'function') {
|
|
190
|
-
var all = await store.listKeys();
|
|
191
|
-
keys = (all || []).filter(function (k) { return String(k).indexOf('loop.') === 0; });
|
|
192
|
-
} else {
|
|
193
|
-
return [];
|
|
194
|
-
}
|
|
195
|
-
} catch (_e) {
|
|
196
|
-
return [];
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
var states = [];
|
|
200
|
-
for (var i = 0; i < keys.length; i++) {
|
|
201
|
-
try {
|
|
202
|
-
var st = await store.get(keys[i]);
|
|
203
|
-
if (st && st.loopId) states.push(st);
|
|
204
|
-
} catch (_e2) {
|
|
205
|
-
// 单 loop 读取失败,跳过(不阻断聚合)
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
return states;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* 计算全局协调状态(仿 multi-window computeSessionStatus,但语义对齐 loop 终止判定)。
|
|
213
|
-
*
|
|
214
|
-
* 全局 verdict 优先级(与 design.md §6.5 单 loop 优先级一致:熔断 > 失败 > 达成 > 运行):
|
|
215
|
-
* 1) 任一 loop circuit_broken/aborted/health=terminated → 'global_circuit_broken'
|
|
216
|
-
* 2) 任一 loop timeout/diverged → 'global_failed'
|
|
217
|
-
* 3) 全部 loop achieved → 'global_achieved'
|
|
218
|
-
* 4) 否则 → 'global_running'
|
|
219
|
-
*
|
|
220
|
-
* @param {object} loops - { loopId: summary }
|
|
221
|
-
* @param {string[]} loopIds
|
|
222
|
-
* @returns {object} { verdict, reason, achievedCount, circuitCount, failedCount, runningCount, minProximity, maxIteration }
|
|
223
|
-
*/
|
|
224
|
-
function computeGlobalState(loops, loopIds) {
|
|
225
|
-
var achievedCount = 0;
|
|
226
|
-
var circuitCount = 0;
|
|
227
|
-
var failedCount = 0;
|
|
228
|
-
var runningCount = 0;
|
|
229
|
-
var disconnectedCount = 0;
|
|
230
|
-
var minProximity = 1;
|
|
231
|
-
var maxIteration = 0;
|
|
232
|
-
var minProximitySet = false;
|
|
233
|
-
|
|
234
|
-
for (var i = 0; i < loopIds.length; i++) {
|
|
235
|
-
var s = loops[loopIds[i]];
|
|
236
|
-
if (!s) continue;
|
|
237
|
-
|
|
238
|
-
if (s.status === 'disconnected') {
|
|
239
|
-
disconnectedCount++;
|
|
240
|
-
continue;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// 熔断判定(health terminated 优先,其次 verdict)
|
|
244
|
-
var isCircuit = CIRCUIT_VERDICTS[s.verdict] || s.health === 'terminated' || s.status === 'circuit_broken' || s.status === 'aborted';
|
|
245
|
-
var isFailed = FAILED_VERDICTS[s.verdict] || s.verdict === 'timeout' || s.verdict === 'diverged' || s.status === 'timeout' || s.status === 'diverged';
|
|
246
|
-
var isAchieved = s.verdict === 'achieved' || s.status === 'achieved';
|
|
247
|
-
|
|
248
|
-
if (isCircuit) circuitCount++;
|
|
249
|
-
else if (isFailed) failedCount++;
|
|
250
|
-
else if (isAchieved) achievedCount++;
|
|
251
|
-
else runningCount++;
|
|
252
|
-
|
|
253
|
-
if (typeof s.proximity === 'number') {
|
|
254
|
-
if (!minProximitySet || s.proximity < minProximity) {
|
|
255
|
-
minProximity = s.proximity;
|
|
256
|
-
minProximitySet = true;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
if (s.iteration > maxIteration) maxIteration = s.iteration;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (!minProximitySet) minProximity = 0;
|
|
263
|
-
|
|
264
|
-
// 全局 verdict(优先级:熔断 > 失败 > 达成 > 运行)
|
|
265
|
-
var verdict;
|
|
266
|
-
var reason;
|
|
267
|
-
if (circuitCount > 0) {
|
|
268
|
-
verdict = 'global_circuit_broken';
|
|
269
|
-
reason = circuitCount + ' 个 loop 熔断/终止,全局回退';
|
|
270
|
-
} else if (failedCount > 0) {
|
|
271
|
-
verdict = 'global_failed';
|
|
272
|
-
reason = failedCount + ' 个 loop 触顶/发散,回 P1 人介入';
|
|
273
|
-
} else if (loopIds.length > 0 && achievedCount === (loopIds.length - disconnectedCount) && achievedCount > 0) {
|
|
274
|
-
// 所有非 disconnected 的 loop 均达成
|
|
275
|
-
verdict = 'global_achieved';
|
|
276
|
-
reason = '全部 ' + achievedCount + ' 个 loop 达成,可进 P4';
|
|
277
|
-
} else {
|
|
278
|
-
verdict = 'global_running';
|
|
279
|
-
reason = runningCount + ' 个 loop 迭代中';
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
return {
|
|
283
|
-
verdict: verdict,
|
|
284
|
-
reason: reason,
|
|
285
|
-
achievedCount: achievedCount,
|
|
286
|
-
circuitCount: circuitCount,
|
|
287
|
-
failedCount: failedCount,
|
|
288
|
-
runningCount: runningCount,
|
|
289
|
-
disconnectedCount: disconnectedCount,
|
|
290
|
-
minProximity: minProximity,
|
|
291
|
-
maxIteration: maxIteration,
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// ---------------------------------------------------------------------------
|
|
296
|
-
// 全局判定辅助
|
|
297
|
-
// ---------------------------------------------------------------------------
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* 判定全局是否达成(所有 loop achieved,可进 P4)。
|
|
301
|
-
* @param {object} aggregated - aggregateLoopStates 返回值
|
|
302
|
-
* @returns {boolean}
|
|
303
|
-
*/
|
|
304
|
-
function isGlobalAchieved(aggregated) {
|
|
305
|
-
return !!(aggregated && aggregated.global && aggregated.global.verdict === 'global_achieved');
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* 判定全局是否熔断(任一 loop 熔断,应全局回退)。
|
|
310
|
-
* @param {object} aggregated
|
|
311
|
-
* @returns {boolean}
|
|
312
|
-
*/
|
|
313
|
-
function isGlobalCircuitBroken(aggregated) {
|
|
314
|
-
return !!(aggregated && aggregated.global && aggregated.global.verdict === 'global_circuit_broken');
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* 判定全局是否需要回 P1(熔断或失败)。
|
|
319
|
-
* @param {object} aggregated
|
|
320
|
-
* @returns {boolean}
|
|
321
|
-
*/
|
|
322
|
-
function needsHumanIntervention(aggregated) {
|
|
323
|
-
if (!aggregated || !aggregated.global) return false;
|
|
324
|
-
var v = aggregated.global.verdict;
|
|
325
|
-
return v === 'global_circuit_broken' || v === 'global_failed';
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
// ---------------------------------------------------------------------------
|
|
329
|
-
// Exports
|
|
330
|
-
// ---------------------------------------------------------------------------
|
|
331
|
-
|
|
332
|
-
module.exports = {
|
|
333
|
-
// 常量(暴露供测试)
|
|
334
|
-
TERMINAL_VERDICTS: TERMINAL_VERDICTS,
|
|
335
|
-
CIRCUIT_VERDICTS: CIRCUIT_VERDICTS,
|
|
336
|
-
FAILED_VERDICTS: FAILED_VERDICTS,
|
|
337
|
-
|
|
338
|
-
// 聚合
|
|
339
|
-
aggregateLoopStates: aggregateLoopStates,
|
|
340
|
-
summarizeLoop: summarizeLoop,
|
|
341
|
-
computeGlobalState: computeGlobalState,
|
|
342
|
-
|
|
343
|
-
// 全局判定
|
|
344
|
-
isGlobalAchieved: isGlobalAchieved,
|
|
345
|
-
isGlobalCircuitBroken: isGlobalCircuitBroken,
|
|
346
|
-
needsHumanIntervention: needsHumanIntervention,
|
|
347
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// ---------------------------------------------------------------------------
|
|
4
|
-
// Agentic Loop 决策阈值 —— 唯一默认源(单源化,Phase B-1)
|
|
5
|
-
// ---------------------------------------------------------------------------
|
|
6
|
-
// 历史问题:同一组阈值曾在两处独立定义——provider-loop-engine 的 DEFAULT_CONFIG
|
|
7
|
-
// (5 个全量)与 reflection-evaluator 的 DEFAULT_THRESHOLDS(2 个子集)。engine
|
|
8
|
-
// 内部曾因此出现「evaluator 用自己的默认阈值绕过 engine init() override」的漂移
|
|
9
|
-
// bug(见 engine _decide 历史注释)。本文件即唯一真相源,两处一律 require 此表。
|
|
10
|
-
//
|
|
11
|
-
// 注意:plugins/core/skill-agentic-loop/plugin.json 的 config 段是本表的**静态
|
|
12
|
-
// 镜像**(JSON 无法 require JS);修改任一默认值时必须同步该镜像,否则
|
|
13
|
-
// plugin loader 传入的旧值会覆盖 init() 前的默认路径。
|
|
14
|
-
// ---------------------------------------------------------------------------
|
|
15
|
-
|
|
16
|
-
var LOOP_DEFAULTS = Object.freeze({
|
|
17
|
-
// 迭代硬上限 → 超时终止(WP-177 由 10 改为 6)
|
|
18
|
-
max_iterations: 6,
|
|
19
|
-
// 单轮最长时间(ms)→ act 完成后即时校验(WP-177 新增)
|
|
20
|
-
max_round_time_ms: 600000,
|
|
21
|
-
// 总墙钟上限(ms)→ step() 开头与 _decide 校验
|
|
22
|
-
max_wall_time_ms: 3600000,
|
|
23
|
-
// 连续 N 轮无进展 → 发散终止
|
|
24
|
-
divergence_threshold: 3,
|
|
25
|
-
// proximity ≥ 此值且 checklist 全过 → 目标达成
|
|
26
|
-
proximity_goal: 0.9,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
module.exports = LOOP_DEFAULTS;
|