@claude-flow/cli 3.10.40 → 3.10.41
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/.claude/helpers/session.js +28 -6
- package/dist/src/commands/hive-mind.d.ts.map +1 -1
- package/dist/src/commands/hive-mind.js +14 -1
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +16 -0
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/init/statusline-generator.d.ts.map +1 -1
- package/dist/src/init/statusline-generator.js +53 -4
- package/dist/src/init/statusline-generator.js.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +22 -0
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/memory/memory-bridge.d.ts +2 -0
- package/dist/src/memory/memory-bridge.d.ts.map +1 -1
- package/dist/src/memory/memory-bridge.js +2 -0
- package/dist/src/memory/memory-bridge.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statusline-generator.d.ts","sourceRoot":"","sources":["../../../src/init/statusline-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"statusline-generator.d.ts","sourceRoot":"","sources":["../../../src/init/statusline-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAyrBrE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CA8BnE"}
|
|
@@ -65,10 +65,51 @@ const CONFIG = {
|
|
|
65
65
|
const CWD = process.cwd();
|
|
66
66
|
|
|
67
67
|
// ─── Delegation cache ───────────────────────────────────────────
|
|
68
|
-
// Cache the CLI JSON result for
|
|
69
|
-
// (
|
|
68
|
+
// Cache the CLI JSON result for 60s so rapid prompt re-renders
|
|
69
|
+
// (Claude Code refreshes the statusline several times a second while
|
|
70
|
+
// streaming) don't re-invoke the CLI each time. #2337: bumped 10s→60s
|
|
71
|
+
// because 10s was far too short for how often Claude Code re-renders.
|
|
70
72
|
const CACHE_FILE = path.join(os.tmpdir(), 'ruflo-statusline-cache-' + require('crypto').createHash('md5').update(CWD).digest('hex').slice(0, 8) + '.json');
|
|
71
|
-
const CACHE_TTL_MS =
|
|
73
|
+
const CACHE_TTL_MS = 60000;
|
|
74
|
+
|
|
75
|
+
// #2337: resolve an already-installed @claude-flow/cli (or ruflo) bin so we
|
|
76
|
+
// can invoke it directly via \`node\`. The previous version called
|
|
77
|
+
// \`npx --yes @claude-flow/cli@latest\` on every uncached render, which forces
|
|
78
|
+
// a registry resolution + cold-start of the entire CLI per render. With
|
|
79
|
+
// multiple concurrent Claude Code sessions this storms the host (reporter
|
|
80
|
+
// saw load average 40-65 on a 12-core box).
|
|
81
|
+
//
|
|
82
|
+
// Returns the absolute path to bin/cli.js or null. Mirrors getPkgVersion()'s
|
|
83
|
+
// path probing (project, monorepo, plugin marketplace, global node_modules
|
|
84
|
+
// including custom-prefix layouts like ~/.npm-global).
|
|
85
|
+
function resolveCliBin() {
|
|
86
|
+
try {
|
|
87
|
+
const home = os.homedir();
|
|
88
|
+
const candidates = [
|
|
89
|
+
path.join(home, '.claude', 'plugins', 'marketplaces', 'ruflo', 'bin', 'cli.js'),
|
|
90
|
+
path.join(CWD, 'node_modules', '@claude-flow', 'cli', 'bin', 'cli.js'),
|
|
91
|
+
path.join(CWD, 'node_modules', 'ruflo', 'bin', 'cli.js'),
|
|
92
|
+
path.join(CWD, 'v3', '@claude-flow', 'cli', 'bin', 'cli.js'),
|
|
93
|
+
];
|
|
94
|
+
try {
|
|
95
|
+
const binDir = path.dirname(process.execPath);
|
|
96
|
+
const globalModuleDirs = [path.join(binDir, '..', 'lib', 'node_modules'), path.join(binDir, 'node_modules')];
|
|
97
|
+
for (const prefix of [process.env.npm_config_prefix, process.env.PREFIX, path.join(home, '.npm-global')]) {
|
|
98
|
+
if (prefix) globalModuleDirs.push(path.join(prefix, 'lib', 'node_modules'));
|
|
99
|
+
}
|
|
100
|
+
for (const gm of globalModuleDirs) {
|
|
101
|
+
candidates.push(
|
|
102
|
+
path.join(gm, 'ruflo', 'bin', 'cli.js'),
|
|
103
|
+
path.join(gm, '@claude-flow', 'cli', 'bin', 'cli.js'),
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
} catch { /* ignore */ }
|
|
107
|
+
for (const p of candidates) {
|
|
108
|
+
if (fs.existsSync(p)) return p;
|
|
109
|
+
}
|
|
110
|
+
} catch { /* ignore */ }
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
72
113
|
|
|
73
114
|
function readCache() {
|
|
74
115
|
try {
|
|
@@ -99,8 +140,16 @@ function getStatuslineData() {
|
|
|
99
140
|
if (cached) return cached;
|
|
100
141
|
|
|
101
142
|
try {
|
|
143
|
+
// #2337: prefer an already-installed CLI bin via direct \`node\` invocation
|
|
144
|
+
// — no npx, no registry round-trip, no @latest re-resolve per render.
|
|
145
|
+
// Fall back to \`npx --prefer-offline @claude-flow/cli\` (no @latest) only
|
|
146
|
+
// when nothing is installed locally, so a cold environment still works.
|
|
147
|
+
const cliBin = resolveCliBin();
|
|
148
|
+
const cmd = cliBin
|
|
149
|
+
? '"' + process.execPath + '" "' + cliBin + '" hooks statusline --json 2>/dev/null'
|
|
150
|
+
: 'npx --prefer-offline @claude-flow/cli hooks statusline --json 2>/dev/null';
|
|
102
151
|
const raw = execSync(
|
|
103
|
-
|
|
152
|
+
cmd,
|
|
104
153
|
{ encoding: 'utf-8', timeout: 8000, stdio: ['pipe', 'pipe', 'pipe'], cwd: CWD }
|
|
105
154
|
).trim();
|
|
106
155
|
// The CLI may emit preamble lines before the JSON — find the first '{'.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statusline-generator.js","sourceRoot":"","sources":["../../../src/init/statusline-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAoB;IAC3D,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;IAE5C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eA6BM,SAAS
|
|
1
|
+
{"version":3,"file":"statusline-generator.js","sourceRoot":"","sources":["../../../src/init/statusline-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAoB;IAC3D,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;IAE5C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eA6BM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAO,MAAM,mBAAmB,EAAE,OAmEjC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,OAgMhC,CAAC;AAGF,eAAO,MAAM,iBAAiB,EAAE,OA4E/B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,OAwGhC,CAAC;AAGF,eAAO,MAAM,sBAAsB,EAAE,OAgNpC,CAAC;AAGF,eAAO,MAAM,sBAAsB,EAAE,OAiGpC,CAAC;AAGF,eAAO,MAAM,0BAA0B,EAAE,OA8MxC,CAAC;AAgQF,eAAO,MAAM,eAAe,EAAE,OA8C7B,CAAC;AAGF,eAAO,MAAM,mBAAmB,EAAE,OAwIjC,CAAC;AAGF,eAAO,MAAM,iBAAiB,EAAE,OAuD/B,CAAC;AAGF,eAAO,MAAM,iBAAiB,EAAE,OAkE/B,CAAC;AAiBF,eAAO,MAAM,eAAe,EAAE,OA+C7B,CAAC;AAGF,eAAO,MAAM,iBAAiB,EAAE,OAgC/B,CAAC;AAGF,eAAO,MAAM,eAAe,EAAE,OAuB7B,CAAC;AAeF,eAAO,MAAM,YAAY,EAAE,OAmI1B,CAAC;AAqBF,eAAO,MAAM,iBAAiB,EAAE,OA0C/B,CAAC;AAOF,eAAO,MAAM,iBAAiB,EAAE,OAwB/B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,OAoFhC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,EAAE,OAc3C,CAAC;AAGF,eAAO,MAAM,UAAU,EAAE,OAAO,EA6C/B,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1239,6 +1239,9 @@ export const hooksPostTask = {
|
|
|
1239
1239
|
quality: { type: 'number', description: 'Quality score (0-1)' },
|
|
1240
1240
|
task: { type: 'string', description: 'Task description text (used for learning keyword extraction)' },
|
|
1241
1241
|
storeDecisions: { type: 'boolean', description: 'Also store routing decision in memory DB' },
|
|
1242
|
+
// ADR-147 P2: nested-subagent spawn-tree capture
|
|
1243
|
+
parentAgentId: { type: 'string', description: 'ID of the parent agent (from Claude Code\'s parent_agent_id OTel span tag / x-claude-code-parent-agent-id header). Omit for top-level work.' },
|
|
1244
|
+
depth: { type: 'number', description: 'Chain depth from root lead session (0 = lead, 1+ = subagent). Used by ADR-147 P3 depth-aware guardrail.' },
|
|
1242
1245
|
},
|
|
1243
1246
|
required: ['taskId'],
|
|
1244
1247
|
},
|
|
@@ -1258,6 +1261,22 @@ export const hooksPostTask = {
|
|
|
1258
1261
|
if (!v.valid)
|
|
1259
1262
|
return { success: false, error: v.error };
|
|
1260
1263
|
}
|
|
1264
|
+
// ADR-147 P2: validate spawn-tree lineage if provided
|
|
1265
|
+
const parentAgentId = params.parentAgentId;
|
|
1266
|
+
if (parentAgentId !== undefined) {
|
|
1267
|
+
const v = validateIdentifier(parentAgentId, 'parentAgentId');
|
|
1268
|
+
if (!v.valid)
|
|
1269
|
+
return { success: false, error: v.error };
|
|
1270
|
+
}
|
|
1271
|
+
const depthRaw = params.depth;
|
|
1272
|
+
let depth;
|
|
1273
|
+
if (depthRaw !== undefined && depthRaw !== null) {
|
|
1274
|
+
const n = Number(depthRaw);
|
|
1275
|
+
if (!Number.isInteger(n) || n < 0 || n > 32) {
|
|
1276
|
+
return { success: false, error: 'depth must be a non-negative integer ≤ 32' };
|
|
1277
|
+
}
|
|
1278
|
+
depth = n;
|
|
1279
|
+
}
|
|
1261
1280
|
// Phase 3: Wire recordFeedback through bridge → LearningSystem + ReasoningBank
|
|
1262
1281
|
let feedbackResult = null;
|
|
1263
1282
|
try {
|
|
@@ -1269,6 +1288,9 @@ export const hooksPostTask = {
|
|
|
1269
1288
|
agent,
|
|
1270
1289
|
duration: params.duration || undefined,
|
|
1271
1290
|
patterns: params.patterns || undefined,
|
|
1291
|
+
// ADR-147 P2: forward spawn-tree lineage so it lands in feedback + memory
|
|
1292
|
+
parentAgentId,
|
|
1293
|
+
depth,
|
|
1272
1294
|
});
|
|
1273
1295
|
}
|
|
1274
1296
|
catch {
|