claude-flow 3.59.6 → 3.59.7
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/proven-config.json +1 -1
- package/package.json +1 -1
- package/v3/@claude-flow/cli/catalog-manifest.json +2 -2
- package/v3/@claude-flow/cli/dist/src/mcp-tools/session-tools.js +3 -1
- package/v3/@claude-flow/cli/dist/src/services/policy-runtime.js +29 -2
- package/v3/@claude-flow/cli/package.json +1 -1
package/package.json
CHANGED
|
@@ -502,6 +502,8 @@ export const sessionTools = [
|
|
|
502
502
|
else if (sortBy === 'size') {
|
|
503
503
|
sessions.sort((a, b) => (b.stats?.totalSize ?? 0) - (a.stats?.totalSize ?? 0));
|
|
504
504
|
}
|
|
505
|
+
// Count every session before applying the limit so callers can tell when the list was truncated
|
|
506
|
+
const total = sessions.length;
|
|
505
507
|
// Apply limit
|
|
506
508
|
const limit = input.limit || 10;
|
|
507
509
|
sessions = sessions.slice(0, limit);
|
|
@@ -522,7 +524,7 @@ export const sessionTools = [
|
|
|
522
524
|
projection.metrics = s.metrics;
|
|
523
525
|
return projection;
|
|
524
526
|
}),
|
|
525
|
-
total
|
|
527
|
+
total,
|
|
526
528
|
limit,
|
|
527
529
|
};
|
|
528
530
|
},
|
|
@@ -178,9 +178,13 @@ function reclaimDeadLock(lockPath) {
|
|
|
178
178
|
*/
|
|
179
179
|
export async function acquireLock(lockPath) {
|
|
180
180
|
const started = Date.now();
|
|
181
|
+
// O_NOFOLLOW closes the create-through-a-symlink path on platforms that
|
|
182
|
+
// support it; lstat below still rejects non-regular existing paths.
|
|
183
|
+
const createFlags = fsConstants.O_WRONLY | fsConstants.O_CREAT | fsConstants.O_EXCL
|
|
184
|
+
| (process.platform === 'win32' ? 0 : (fsConstants.O_NOFOLLOW ?? 0));
|
|
181
185
|
while (Date.now() - started < LOCK_WAIT_MS) {
|
|
182
186
|
try {
|
|
183
|
-
const fd = openSync(lockPath,
|
|
187
|
+
const fd = openSync(lockPath, createFlags, 0o600);
|
|
184
188
|
const ownership = JSON.stringify({
|
|
185
189
|
pid: process.pid,
|
|
186
190
|
acquiredAt: Date.now(),
|
|
@@ -204,7 +208,30 @@ export async function acquireLock(lockPath) {
|
|
|
204
208
|
catch { /* already released */ }
|
|
205
209
|
};
|
|
206
210
|
}
|
|
207
|
-
catch {
|
|
211
|
+
catch (error) {
|
|
212
|
+
const code = error?.code;
|
|
213
|
+
// Only EEXIST is normal lock contention. Permission/path/IO failures
|
|
214
|
+
// must not masquerade as a five-second timeout on every MCP call.
|
|
215
|
+
// ELOOP is O_NOFOLLOW rejecting a symlink at the lock path.
|
|
216
|
+
if (code === 'ELOOP') {
|
|
217
|
+
throw new Error('policy-state-lock-error: lock path is not a regular file');
|
|
218
|
+
}
|
|
219
|
+
if (code !== 'EEXIST') {
|
|
220
|
+
throw new Error(`policy-state-lock-error: ${code ?? (error instanceof Error ? error.message : String(error))}`);
|
|
221
|
+
}
|
|
222
|
+
// EEXIST can also mean a directory/FIFO/symlink was planted at the lock
|
|
223
|
+
// path. Those are never a live lock: fail immediately instead of
|
|
224
|
+
// waiting, and never follow/remove the non-regular target.
|
|
225
|
+
try {
|
|
226
|
+
if (!lstatSync(lockPath).isFile()) {
|
|
227
|
+
throw new Error('policy-state-lock-error: lock path is not a regular file');
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
catch (statError) {
|
|
231
|
+
if (statError instanceof Error && statError.message.startsWith('policy-state-lock-error:'))
|
|
232
|
+
throw statError;
|
|
233
|
+
// The lock vanished between open() and lstat(); retry immediately.
|
|
234
|
+
}
|
|
208
235
|
reclaimDeadLock(lockPath);
|
|
209
236
|
await sleep(10);
|
|
210
237
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claude-flow/cli",
|
|
3
|
-
"version": "3.59.
|
|
3
|
+
"version": "3.59.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
|
|
6
6
|
"main": "dist/src/index.js",
|