claude-flow 3.54.1 → 3.56.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 (120) hide show
  1. package/.claude/settings.json +0 -1
  2. package/node_modules/@claude-flow/codex/dist/cli.js +0 -0
  3. package/node_modules/@claude-flow/mcp/dist/connection-pool.d.ts.map +1 -1
  4. package/node_modules/@claude-flow/mcp/dist/connection-pool.js +5 -2
  5. package/node_modules/@claude-flow/mcp/dist/connection-pool.js.map +1 -1
  6. package/node_modules/@claude-flow/mcp/dist/transport/http.d.ts +7 -1
  7. package/node_modules/@claude-flow/mcp/dist/transport/http.d.ts.map +1 -1
  8. package/node_modules/@claude-flow/mcp/dist/transport/http.js +60 -47
  9. package/node_modules/@claude-flow/mcp/dist/transport/http.js.map +1 -1
  10. package/node_modules/@claude-flow/mcp/package.json +1 -1
  11. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js +1 -1
  12. package/node_modules/@claude-flow/plugin-agent-federation/dist/application/federation-coordinator.js.map +1 -1
  13. package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +0 -0
  14. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts +3 -0
  15. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.d.ts.map +1 -1
  16. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js +4 -1
  17. package/node_modules/@claude-flow/plugin-agent-federation/dist/domain/services/routing-service.js.map +1 -1
  18. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.d.ts.map +1 -1
  19. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js +1 -0
  20. package/node_modules/@claude-flow/plugin-agent-federation/dist/plugin.js.map +1 -1
  21. package/node_modules/@claude-flow/plugin-agent-federation/package.json +1 -1
  22. package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts +2 -1
  23. package/node_modules/@claude-flow/security/dist/oauth/callback-server.d.ts.map +1 -1
  24. package/node_modules/@claude-flow/security/dist/oauth/callback-server.js +48 -16
  25. package/node_modules/@claude-flow/security/dist/oauth/callback-server.js.map +1 -1
  26. package/node_modules/@claude-flow/security/dist/path-validator.d.ts +2 -2
  27. package/node_modules/@claude-flow/security/dist/path-validator.d.ts.map +1 -1
  28. package/node_modules/@claude-flow/security/dist/path-validator.js +15 -4
  29. package/node_modules/@claude-flow/security/dist/path-validator.js.map +1 -1
  30. package/node_modules/@claude-flow/security/dist/policy/engine.d.ts +11 -1
  31. package/node_modules/@claude-flow/security/dist/policy/engine.d.ts.map +1 -1
  32. package/node_modules/@claude-flow/security/dist/policy/engine.js +19 -3
  33. package/node_modules/@claude-flow/security/dist/policy/engine.js.map +1 -1
  34. package/node_modules/@claude-flow/security/dist/policy/types.d.ts +4 -2
  35. package/node_modules/@claude-flow/security/dist/policy/types.d.ts.map +1 -1
  36. package/node_modules/@claude-flow/security/package.json +1 -1
  37. package/package.json +5 -5
  38. package/v3/@claude-flow/cli/bin/cli.js +1 -1
  39. package/v3/@claude-flow/cli/bin/mcp-server.js +1 -1
  40. package/v3/@claude-flow/cli/catalog-manifest.json +2 -2
  41. package/v3/@claude-flow/cli/dist/src/auth/client.js +40 -24
  42. package/v3/@claude-flow/cli/dist/src/commands/agent.js +12 -0
  43. package/v3/@claude-flow/cli/dist/src/commands/analyze.js +18 -14
  44. package/v3/@claude-flow/cli/dist/src/commands/autopilot.js +2 -2
  45. package/v3/@claude-flow/cli/dist/src/commands/daemon.js +15 -3
  46. package/v3/@claude-flow/cli/dist/src/commands/doctor.js +65 -58
  47. package/v3/@claude-flow/cli/dist/src/commands/hive-mind.js +7 -0
  48. package/v3/@claude-flow/cli/dist/src/commands/mcp.js +35 -1
  49. package/v3/@claude-flow/cli/dist/src/commands/memory-backup.d.ts +1 -1
  50. package/v3/@claude-flow/cli/dist/src/commands/memory-backup.js +23 -9
  51. package/v3/@claude-flow/cli/dist/src/commands/memory.d.ts +0 -4
  52. package/v3/@claude-flow/cli/dist/src/commands/memory.js +10 -2
  53. package/v3/@claude-flow/cli/dist/src/commands/plugins.js +13 -1
  54. package/v3/@claude-flow/cli/dist/src/commands/policy.js +10 -2
  55. package/v3/@claude-flow/cli/dist/src/commands/task.js +12 -0
  56. package/v3/@claude-flow/cli/dist/src/init/settings-generator.js +3 -3
  57. package/v3/@claude-flow/cli/dist/src/mcp-server.d.ts +33 -0
  58. package/v3/@claude-flow/cli/dist/src/mcp-server.js +96 -4
  59. package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-execute-core.js +244 -188
  60. package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-tools.js +15 -16
  61. package/v3/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.js +22 -3
  62. package/v3/@claude-flow/cli/dist/src/mcp-tools/claims-tools.js +3 -11
  63. package/v3/@claude-flow/cli/dist/src/mcp-tools/hive-mind-tools.d.ts +2 -4
  64. package/v3/@claude-flow/cli/dist/src/mcp-tools/hive-mind-tools.js +214 -40
  65. package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +47 -2
  66. package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +29 -10
  67. package/v3/@claude-flow/cli/dist/src/mcp-tools/record-store.d.ts +3 -0
  68. package/v3/@claude-flow/cli/dist/src/mcp-tools/record-store.js +21 -0
  69. package/v3/@claude-flow/cli/dist/src/mcp-tools/session-tools.js +47 -13
  70. package/v3/@claude-flow/cli/dist/src/mcp-tools/task-tools.js +5 -11
  71. package/v3/@claude-flow/cli/dist/src/mcp-tools/workflow-tools.js +78 -29
  72. package/v3/@claude-flow/cli/dist/src/memory/append-conditions.d.ts +28 -0
  73. package/v3/@claude-flow/cli/dist/src/memory/append-conditions.js +56 -0
  74. package/v3/@claude-flow/cli/dist/src/memory/graph-edge-writer.d.ts +9 -0
  75. package/v3/@claude-flow/cli/dist/src/memory/graph-edge-writer.js +90 -0
  76. package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.d.ts +4 -0
  77. package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.js +50 -9
  78. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.d.ts +4 -0
  79. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +95 -61
  80. package/v3/@claude-flow/cli/dist/src/memory/memory-root.d.ts +2 -0
  81. package/v3/@claude-flow/cli/dist/src/memory/memory-root.js +28 -0
  82. package/v3/@claude-flow/cli/dist/src/memory/sona-optimizer.d.ts +2 -0
  83. package/v3/@claude-flow/cli/dist/src/memory/sona-optimizer.js +4 -0
  84. package/v3/@claude-flow/cli/dist/src/missions/schemas.d.ts +125 -125
  85. package/v3/@claude-flow/cli/dist/src/mods/command-registry/schema.d.ts +199 -199
  86. package/v3/@claude-flow/cli/dist/src/parser.d.ts +3 -0
  87. package/v3/@claude-flow/cli/dist/src/parser.js +71 -13
  88. package/v3/@claude-flow/cli/dist/src/plugins/store/discovery.d.ts +6 -0
  89. package/v3/@claude-flow/cli/dist/src/plugins/store/discovery.js +7 -3
  90. package/v3/@claude-flow/cli/dist/src/production/retry.js +1 -1
  91. package/v3/@claude-flow/cli/dist/src/ruvector/neural-router.js +7 -2
  92. package/v3/@claude-flow/cli/dist/src/services/bounded-worker-pool.js +3 -0
  93. package/v3/@claude-flow/cli/dist/src/services/claim-service.js +39 -18
  94. package/v3/@claude-flow/cli/dist/src/services/claims-store.d.ts +3 -0
  95. package/v3/@claude-flow/cli/dist/src/services/claims-store.js +40 -0
  96. package/v3/@claude-flow/cli/dist/src/services/config-file-manager.d.ts +3 -0
  97. package/v3/@claude-flow/cli/dist/src/services/config-file-manager.js +24 -7
  98. package/v3/@claude-flow/cli/dist/src/services/distill-tuning.js +17 -10
  99. package/v3/@claude-flow/cli/dist/src/services/memory-backup.d.ts +7 -0
  100. package/v3/@claude-flow/cli/dist/src/services/memory-backup.js +29 -2
  101. package/v3/@claude-flow/cli/dist/src/services/memory-distillation.js +2 -2
  102. package/v3/@claude-flow/cli/dist/src/services/policy-ledger-anchor.d.ts +42 -0
  103. package/v3/@claude-flow/cli/dist/src/services/policy-ledger-anchor.js +163 -0
  104. package/v3/@claude-flow/cli/dist/src/services/policy-runtime.d.ts +11 -5
  105. package/v3/@claude-flow/cli/dist/src/services/policy-runtime.js +70 -15
  106. package/v3/@claude-flow/cli/dist/src/services/worker-daemon.d.ts +5 -2
  107. package/v3/@claude-flow/cli/dist/src/services/worker-daemon.js +26 -6
  108. package/v3/@claude-flow/cli/dist/src/services/worker-queue.js +11 -2
  109. package/v3/@claude-flow/cli/package.json +7 -7
  110. package/v3/@claude-flow/shared/dist/events/event-store-pagination.test.d.ts +2 -0
  111. package/v3/@claude-flow/shared/dist/events/event-store-pagination.test.js +32 -0
  112. package/v3/@claude-flow/shared/dist/events/event-store.js +6 -2
  113. package/v3/@claude-flow/shared/dist/mcp/connection-pool.js +5 -2
  114. package/v3/@claude-flow/shared/dist/resilience/bulkhead-sync-throw.test.d.ts +2 -0
  115. package/v3/@claude-flow/shared/dist/resilience/bulkhead-sync-throw.test.js +33 -0
  116. package/v3/@claude-flow/shared/dist/resilience/bulkhead.js +2 -1
  117. package/v3/@claude-flow/shared/dist/resilience/retry-timeout-cleanup.test.d.ts +2 -0
  118. package/v3/@claude-flow/shared/dist/resilience/retry-timeout-cleanup.test.js +38 -0
  119. package/v3/@claude-flow/shared/dist/resilience/retry.js +9 -2
  120. package/v3/@claude-flow/shared/package.json +1 -1
@@ -225,11 +225,15 @@ export class EventStore extends EventEmitter {
225
225
  // Order by timestamp
226
226
  sql += ' ORDER BY timestamp ASC';
227
227
  // Pagination
228
- if (filter.limit) {
228
+ if (filter.limit !== undefined) {
229
229
  sql += ' LIMIT ?';
230
230
  params.push(filter.limit);
231
231
  }
232
- if (filter.offset) {
232
+ else if (filter.offset !== undefined) {
233
+ // SQLite requires LIMIT before OFFSET; -1 means no upper bound.
234
+ sql += ' LIMIT -1';
235
+ }
236
+ if (filter.offset !== undefined) {
233
237
  sql += ' OFFSET ?';
234
238
  params.push(filter.offset);
235
239
  }
@@ -119,9 +119,12 @@ export class ConnectionPool extends EventEmitter {
119
119
  /**
120
120
  * Create a new connection
121
121
  */
122
- async createConnection() {
122
+ async createConnection(reserved = false) {
123
123
  const id = `conn-${++this.connectionCounter}-${Date.now()}`;
124
124
  const connection = new ManagedConnection(id, this.transportType);
125
+ // Reserve before exposing it in the map or yielding to another acquirer.
126
+ if (reserved)
127
+ connection.state = 'busy';
125
128
  this.connections.set(id, connection);
126
129
  this.stats.totalCreated++;
127
130
  this.emit('pool:connection:created', { connectionId: id });
@@ -149,7 +152,7 @@ export class ConnectionPool extends EventEmitter {
149
152
  }
150
153
  // Create new connection if under limit
151
154
  if (this.connections.size < this.config.maxConnections) {
152
- const connection = await this.createConnection();
155
+ const connection = await this.createConnection(true);
153
156
  connection.acquire();
154
157
  this.stats.totalAcquired++;
155
158
  this.recordAcquireTime(startTime);
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=bulkhead-sync-throw.test.d.ts.map
@@ -0,0 +1,33 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { Bulkhead } from './bulkhead.js';
3
+ describe('queued bulkhead failures', () => {
4
+ it('rejects the throwing task and preserves the previous result and remaining capacity', async () => {
5
+ const bulkhead = new Bulkhead({
6
+ name: 'test',
7
+ maxConcurrent: 1,
8
+ maxQueue: 2,
9
+ queueTimeout: 100,
10
+ });
11
+ let release;
12
+ const first = bulkhead.execute(() => new Promise((resolve) => {
13
+ release = resolve;
14
+ }));
15
+ const failure = new Error('synchronous callback failure');
16
+ const second = bulkhead.execute(() => {
17
+ throw failure;
18
+ });
19
+ const secondResult = second.catch((error) => error);
20
+ const third = bulkhead.execute(async () => 'third');
21
+ release('first');
22
+ await expect(first).resolves.toBe('first');
23
+ expect(await secondResult).toBe(failure);
24
+ await expect(third).resolves.toBe('third');
25
+ await Promise.resolve();
26
+ expect(bulkhead.getStats()).toMatchObject({
27
+ active: 0,
28
+ queued: 0,
29
+ completed: 2,
30
+ });
31
+ });
32
+ });
33
+ //# sourceMappingURL=bulkhead-sync-throw.test.js.map
@@ -158,7 +158,8 @@ export class Bulkhead extends EventEmitter {
158
158
  // Execute the queued function
159
159
  this.active++;
160
160
  this.emit('acquire');
161
- item.fn()
161
+ Promise.resolve()
162
+ .then(() => item.fn())
162
163
  .then((result) => {
163
164
  this.completed++;
164
165
  item.resolve(result);
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=retry-timeout-cleanup.test.d.ts.map
@@ -0,0 +1,38 @@
1
+ import { afterEach, describe, it, expect, vi } from 'vitest';
2
+ import { retry } from './retry.js';
3
+ afterEach(() => vi.useRealTimers());
4
+ describe('retry timeout lifetime', () => {
5
+ it('does not keep a success timer alive after an attempt settles', async () => {
6
+ vi.useFakeTimers();
7
+ const result = await retry(async () => 42, {
8
+ maxAttempts: 1,
9
+ timeout: 30000,
10
+ });
11
+ expect(result.success).toBe(true);
12
+ expect(result.result).toBe(42);
13
+ expect(vi.getTimerCount()).toBe(0);
14
+ });
15
+ it('releases timers for rejected attempts without suppressing their errors', async () => {
16
+ vi.useFakeTimers();
17
+ const err = new Error('no');
18
+ const result = await retry(async () => {
19
+ throw err;
20
+ }, { maxAttempts: 1 });
21
+ expect(result.success).toBe(false);
22
+ expect(result.errors).toEqual([err]);
23
+ expect(vi.getTimerCount()).toBe(0);
24
+ });
25
+ it('still bounds a pending operation and reports the timeout', async () => {
26
+ vi.useFakeTimers();
27
+ const promise = retry(() => new Promise(() => { }), {
28
+ maxAttempts: 1,
29
+ timeout: 10,
30
+ });
31
+ await vi.advanceTimersByTimeAsync(10);
32
+ const result = await promise;
33
+ expect(result.success).toBe(false);
34
+ expect(result.errors[0].message).toContain('timed out');
35
+ expect(vi.getTimerCount()).toBe(0);
36
+ });
37
+ });
38
+ //# sourceMappingURL=retry-timeout-cleanup.test.js.map
@@ -117,12 +117,19 @@ export function withRetry(fn, options = {}) {
117
117
  * Execute with timeout
118
118
  */
119
119
  async function withTimeout(promise, timeout, attempt) {
120
+ let timer;
120
121
  const timeoutPromise = new Promise((_, reject) => {
121
- setTimeout(() => {
122
+ timer = setTimeout(() => {
122
123
  reject(new Error(`Attempt ${attempt} timed out after ${timeout}ms`));
123
124
  }, timeout);
124
125
  });
125
- return Promise.race([promise, timeoutPromise]);
126
+ try {
127
+ return await Promise.race([promise, timeoutPromise]);
128
+ }
129
+ finally {
130
+ if (timer !== undefined)
131
+ clearTimeout(timer);
132
+ }
126
133
  }
127
134
  /**
128
135
  * Sleep for specified milliseconds
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/shared",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "type": "module",
5
5
  "description": "Shared module - common types, events, utilities, core interfaces",
6
6
  "main": "dist/index.js",