@kienntpixon/dieu-phoi 0.7.1 → 0.7.3
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/CHANGELOG.md +39 -0
- package/README.md +3 -0
- package/agents/dp-exec.md +2 -0
- package/agents/dp-helper.md +2 -0
- package/agents/dp-scout.md +2 -0
- package/agents/dp-verify.md +2 -0
- package/bin/dieu-phoi.cjs +30 -2
- package/hook.cjs +1218 -53
- package/lib/aggregate.cjs +5 -4
- package/lib/args.cjs +1 -1
- package/lib/cbm.cjs +8 -2
- package/lib/commands.cjs +417 -36
- package/lib/deps.cjs +162 -0
- package/lib/knowledge.cjs +3 -4
- package/lib/load.cjs +332 -0
- package/lib/procs.cjs +422 -0
- package/lib/profile-scan.cjs +85 -0
- package/lib/profile-seed.cjs +147 -0
- package/lib/profile.cjs +141 -1
- package/lib/prune.cjs +66 -9
- package/lib/setup.cjs +59 -12
- package/lib/worktree.cjs +417 -0
- package/package.json +3 -1
- package/profile/lessons.md +85 -0
- package/profile/unity-lanes.md +316 -0
package/lib/aggregate.cjs
CHANGED
|
@@ -125,6 +125,7 @@ function buildAgents(events) {
|
|
|
125
125
|
const userVerdicts = [];
|
|
126
126
|
const autoVerdicts = [];
|
|
127
127
|
const overrides = [];
|
|
128
|
+
const implicitOverrides = []; // core 0.7.2 (K4): deviations the hook logged; not the user's overrides
|
|
128
129
|
const steers = [];
|
|
129
130
|
const get = (id) => {
|
|
130
131
|
if (!map.has(id)) map.set(id, { agent_id: id, dispatch: null, completes: [], verdicts: [], steers: [] });
|
|
@@ -135,7 +136,7 @@ function buildAgents(events) {
|
|
|
135
136
|
if (!ev || typeof ev !== 'object') return;
|
|
136
137
|
if (isInternalComplete(ev, dispatched)) return;
|
|
137
138
|
const e = Object.assign({ _idx: idx }, ev);
|
|
138
|
-
if (ev.kind === 'override') { overrides.push(e); return; }
|
|
139
|
+
if (ev.kind === 'override') { (ev.source === 'implicit' ? implicitOverrides : overrides).push(e); return; }
|
|
139
140
|
if (ev.kind === 'verdict') {
|
|
140
141
|
const v = Object.assign(e, normalizeVerdict(ev));
|
|
141
142
|
if (v.by === 'user') { userVerdicts.push(v); return; }
|
|
@@ -202,7 +203,7 @@ function buildAgents(events) {
|
|
|
202
203
|
last_complete_ts: a.completes.length ? Math.max(...a.completes.map(tsOf)) : 0,
|
|
203
204
|
});
|
|
204
205
|
}
|
|
205
|
-
return { agents, userVerdicts, autoVerdicts, overrides, steers };
|
|
206
|
+
return { agents, userVerdicts, autoVerdicts, overrides, implicitOverrides, steers };
|
|
206
207
|
}
|
|
207
208
|
|
|
208
209
|
/** Group agents into tasks (sample unit = task_id; agents without task_id are their own task). */
|
|
@@ -563,11 +564,11 @@ function orchestrationSummary(events) {
|
|
|
563
564
|
}
|
|
564
565
|
|
|
565
566
|
function analyze(events, opts) {
|
|
566
|
-
const { agents, userVerdicts, autoVerdicts, overrides, steers } = buildAgents(withoutDiscarded(events));
|
|
567
|
+
const { agents, userVerdicts, autoVerdicts, overrides, implicitOverrides, steers } = buildAgents(withoutDiscarded(events));
|
|
567
568
|
const tasks = buildTasks(agents, userVerdicts, autoVerdicts);
|
|
568
569
|
const cells = buildCells(tasks, opts);
|
|
569
570
|
return {
|
|
570
|
-
agents, tasks, cells, overrides, userVerdicts, autoVerdicts, steerEvents: steers, steers: buildSteers(tasks, steers, agents),
|
|
571
|
+
agents, tasks, cells, overrides, implicitOverrides, userVerdicts, autoVerdicts, steerEvents: steers, steers: buildSteers(tasks, steers, agents),
|
|
571
572
|
orchestration: orchestrationSummary(events),
|
|
572
573
|
batch_verify: batchVerifyCells(agents),
|
|
573
574
|
};
|
package/lib/args.cjs
CHANGED
|
@@ -4,7 +4,7 @@ const fs = require('fs');
|
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const core = require('../hook.cjs');
|
|
6
6
|
|
|
7
|
-
const BOOLEAN_FLAGS = new Set(['json', 'help', 'h', 'purge', 'version', 'v', 'dry-run', 'no-sync', 'approve', 'yes', 'force', 'follow', 'remove', 'dirty', 'no-cache', 'untagged', 'no-knowledge', 'net', 'with-codebase-memory', 'cbm', 'allow-custom-source', 'auto']);
|
|
7
|
+
const BOOLEAN_FLAGS = new Set(['json', 'help', 'h', 'purge', 'version', 'v', 'dry-run', 'no-sync', 'approve', 'yes', 'force', 'follow', 'remove', 'dirty', 'no-cache', 'untagged', 'no-knowledge', 'net', 'with-codebase-memory', 'cbm', 'allow-custom-source', 'auto', 'include-local', 'orphans']);
|
|
8
8
|
|
|
9
9
|
/** Minimal argv parser: positionals, --k v, --k=v, boolean flags. */
|
|
10
10
|
function parseArgs(argv) {
|
package/lib/cbm.cjs
CHANGED
|
@@ -117,9 +117,15 @@ function binArgv(bin, args) {
|
|
|
117
117
|
return /\.c?js$/i.test(bin) ? [process.execPath, [bin, ...args]] : [bin, args];
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
/** Timeout (ms) of a cbm sub-process; env override DIEU_PHOI_CBM_<name>_TIMEOUT_MS (tests under heavy load), default unchanged. */
|
|
121
|
+
function cbmTimeout(name, dflt) {
|
|
122
|
+
const n = Number(process.env[`DIEU_PHOI_CBM_${name}_TIMEOUT_MS`]);
|
|
123
|
+
return Number.isFinite(n) && n > 0 ? n : dflt;
|
|
124
|
+
}
|
|
125
|
+
|
|
120
126
|
function probeVersion(bin, timeoutMs) {
|
|
121
127
|
const [cmd, args] = binArgv(bin, ['--version']);
|
|
122
|
-
const r = cp.spawnSync(cmd, args, { encoding: 'utf8', timeout: timeoutMs || 3000, windowsHide: true });
|
|
128
|
+
const r = cp.spawnSync(cmd, args, { encoding: 'utf8', timeout: timeoutMs || cbmTimeout('PROBE', 3000), windowsHide: true });
|
|
123
129
|
if (r.error || r.status !== 0) return null;
|
|
124
130
|
const m = /(\d+\.\d+\.\d+)/.exec(`${r.stdout || ''}`);
|
|
125
131
|
return m ? m[1] : null;
|
|
@@ -275,7 +281,7 @@ function doctorChecks({ claudeDir, repo, net, deep, cacheFile, env, now }) {
|
|
|
275
281
|
const version = probeVersion(found.path);
|
|
276
282
|
const wantDaemon = !!(deep || net);
|
|
277
283
|
const cached = wantDaemon ? null : readDaemonCache(cacheFile, found.path, version, nowMs);
|
|
278
|
-
const daemonP = wantDaemon ? daemonStatus(found.path, 5000) : Promise.resolve(null);
|
|
284
|
+
const daemonP = wantDaemon ? daemonStatus(found.path, cbmTimeout('DAEMON', 5000)) : Promise.resolve(null);
|
|
279
285
|
const latestP = net ? latestVersion(e).then((v) => ({ v }), (err) => ({ err: err.message })) : Promise.resolve(null);
|
|
280
286
|
return (async () => {
|
|
281
287
|
add(!!version && regs.length > 0, 'codebase-memory', `${version ? `v${version}` : 'không chạy được `--version`'} tại ${toSlash(found.path)} (${found.source})${regs.length
|