claude-flow 3.77.2 → 3.78.1

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 (38) hide show
  1. package/.claude/helpers/learning-loop.cjs +21 -5
  2. package/README.md +1 -1
  3. package/node_modules/@claude-flow/mcp/dist/transport/http.d.ts +7 -0
  4. package/node_modules/@claude-flow/mcp/dist/transport/http.d.ts.map +1 -1
  5. package/node_modules/@claude-flow/mcp/dist/transport/http.js +33 -29
  6. package/node_modules/@claude-flow/mcp/dist/transport/http.js.map +1 -1
  7. package/node_modules/@claude-flow/mcp/package.json +1 -1
  8. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts +4 -0
  9. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.d.ts.map +1 -1
  10. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js +5 -1
  11. package/node_modules/@claude-flow/plugin-agent-federation/dist/transport/midstream-aware-loader.js.map +1 -1
  12. package/node_modules/@claude-flow/security/dist/input-validator.d.ts +2 -2
  13. package/node_modules/@claude-flow/security/dist/input-validator.d.ts.map +1 -1
  14. package/node_modules/@claude-flow/security/dist/input-validator.js +4 -2
  15. package/node_modules/@claude-flow/security/dist/input-validator.js.map +1 -1
  16. package/node_modules/@claude-flow/security/package.json +1 -1
  17. package/package.json +7 -7
  18. package/v3/@claude-flow/cli/README.md +202 -81
  19. package/v3/@claude-flow/cli/catalog-manifest.json +6 -6
  20. package/v3/@claude-flow/cli/dist/src/init/executor.js +10 -4
  21. package/v3/@claude-flow/cli/dist/src/init/helper-companions.d.ts +1 -1
  22. package/v3/@claude-flow/cli/dist/src/init/helper-companions.js +25 -3
  23. package/v3/@claude-flow/cli/dist/src/init/helper-refresh.js +7 -0
  24. package/v3/@claude-flow/cli/dist/src/mcp-tools/agentbbs-federation.d.ts +5 -0
  25. package/v3/@claude-flow/cli/dist/src/mcp-tools/agentbbs-federation.js +36 -5
  26. package/v3/@claude-flow/cli/dist/src/mcp-tools/capability-brain.js +9 -2
  27. package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +37 -1
  28. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.d.ts +4 -2
  29. package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +239 -26
  30. package/v3/@claude-flow/cli/dist/src/memory/verified-outcomes.d.ts +10 -1
  31. package/v3/@claude-flow/cli/dist/src/memory/verified-outcomes.js +37 -3
  32. package/v3/@claude-flow/cli/dist/src/missions/schemas.d.ts +105 -561
  33. package/v3/@claude-flow/cli/dist/src/mods/command-registry/schema.d.ts +168 -729
  34. package/v3/@claude-flow/cli/dist/src/mods/command-registry/schema.js +1 -1
  35. package/v3/@claude-flow/cli/package.json +9 -9
  36. package/v3/@claude-flow/shared/dist/mcp/transport/http.d.ts +10 -0
  37. package/v3/@claude-flow/shared/dist/mcp/transport/http.js +44 -6
  38. package/v3/@claude-flow/shared/package.json +1 -1
@@ -38,7 +38,7 @@ export const modDispositionSchema = z.enum(['view', 'dispatch', 'delegate', 'leg
38
38
  const nameSchema = z.string().min(1).max(LIMITS.name).regex(COMMAND_NAME);
39
39
  const relPathSchema = z.string().min(1).max(LIMITS.path).regex(REL_PATH);
40
40
  const argumentsSchemaSchema = z
41
- .record(z.unknown())
41
+ .record(z.string(), z.unknown())
42
42
  .refine((value) => JSON.stringify(value).length <= LIMITS.argumentsSchemaBytes, {
43
43
  message: `argumentsSchema exceeds ${LIMITS.argumentsSchemaBytes} serialized bytes`,
44
44
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.77.2",
3
+ "version": "3.78.1",
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",
@@ -108,13 +108,13 @@
108
108
  },
109
109
  "dependencies": {
110
110
  "@electron/asar": "^4.3.1",
111
- "@claude-flow/cli-core": "3.7.7",
111
+ "@claude-flow/cli-core": "3.7.8",
112
112
  "@claude-flow/codex": "3.0.8",
113
- "@claude-flow/mcp": "3.1.7",
114
- "@claude-flow/neural": "3.0.3",
113
+ "@claude-flow/mcp": "3.1.8",
114
+ "@claude-flow/neural": "3.1.1",
115
115
  "@claude-flow/plugin-agent-federation": "1.0.7",
116
- "@claude-flow/security": "3.0.7",
117
- "@claude-flow/shared": "3.0.8",
116
+ "@claude-flow/security": "3.0.8",
117
+ "@claude-flow/shared": "3.0.10",
118
118
  "@iarna/toml": "^2.2.5",
119
119
  "@metaharness/darwin": "~0.14.0",
120
120
  "@noble/ed25519": "2.3.0",
@@ -136,13 +136,13 @@
136
136
  "typescript": "^5.3.0",
137
137
  "ws": "^8.21.0",
138
138
  "yaml": "^2.8.0",
139
- "zod": "^3.22.0",
140
- "@claude-flow/memory": "3.3.3"
139
+ "zod": "^4.6.7",
140
+ "@claude-flow/memory": "3.4.0"
141
141
  },
142
142
  "optionalDependencies": {
143
143
  "@agntcy/slim-bindings": "2.1.1",
144
144
  "@claude-flow/aidefence": "3.2.2",
145
- "@claude-flow/memory": "3.3.3",
145
+ "@claude-flow/memory": "3.4.0",
146
146
  "@metaharness/flywheel": "~0.1.10",
147
147
  "@metaharness/radio": "~0.1.0",
148
148
  "@metaharness/turn-credit": "~0.1.0",
@@ -28,6 +28,8 @@ export interface HttpTransportConfig {
28
28
  /** Accept a non-loopback bind with no token (the operator's own risk). */
29
29
  allowUnauthenticated?: boolean;
30
30
  maxRequestSize?: string;
31
+ /** Largest WebSocket frame accepted on /ws, in bytes (default 10 MiB). */
32
+ maxMessageSize?: number;
31
33
  requestTimeout?: number;
32
34
  }
33
35
  /**
@@ -98,6 +100,14 @@ export declare class HttpTransport extends EventEmitter implements ITransport {
98
100
  * Validate authentication
99
101
  */
100
102
  private validateAuth;
103
+ /** /ws upgrade: token from `Authorization: Bearer`, else from `?token=`. Never throws. */
104
+ private validateUpgradeAuth;
105
+ /**
106
+ * Fail closed: auth enabled with no configured token accepts nothing. Unset or
107
+ * empty entries match nothing. Comparison is constant-time over SHA-256 digests,
108
+ * with no early exit.
109
+ */
110
+ private matchesConfiguredToken;
101
111
  }
102
112
  /**
103
113
  * Create HTTP transport
@@ -16,8 +16,10 @@ import express from 'express';
16
16
  import { createServer } from 'http';
17
17
  import { assertSafeBind, refuseOpenRequest } from './guard.js';
18
18
  import { WebSocketServer, WebSocket } from 'ws';
19
+ import { createHash, timingSafeEqual } from 'crypto';
19
20
  import cors from 'cors';
20
21
  import helmet from 'helmet';
22
+ const DEFAULT_MAX_WS_PAYLOAD = 10 * 1024 * 1024;
21
23
  /**
22
24
  * HTTP Transport Implementation
23
25
  */
@@ -60,11 +62,18 @@ export class HttpTransport extends EventEmitter {
60
62
  assertSafeBind(this.config.host, this.config.auth?.enabled === true, this.config.allowUnauthenticated);
61
63
  // Create HTTP server
62
64
  this.server = createServer(this.app);
63
- // Create WebSocket server (CORS does not apply to upgrades, so a token-less server checks Host and Origin itself)
65
+ // Create WebSocket server. With auth enabled the token is checked before the upgrade
66
+ // (Authorization: Bearer, or ?token= for browsers); CORS does not apply to upgrades,
67
+ // so a token-less server checks Host and Origin itself.
64
68
  this.wss = new WebSocketServer({
65
69
  server: this.server,
66
70
  path: '/ws',
67
- verifyClient: (info) => this.config.auth?.enabled === true || refuseOpenRequest(info.req, this.config.host, this.config.corsOrigins) === undefined,
71
+ maxPayload: typeof this.config.maxMessageSize === 'number' && this.config.maxMessageSize > 0
72
+ ? this.config.maxMessageSize
73
+ : DEFAULT_MAX_WS_PAYLOAD,
74
+ verifyClient: (info) => this.config.auth?.enabled === true
75
+ ? this.validateUpgradeAuth(info.req)
76
+ : refuseOpenRequest(info.req, this.config.host, this.config.corsOrigins) === undefined,
68
77
  });
69
78
  this.setupWebSocketHandlers();
70
79
  // Start server
@@ -483,13 +492,42 @@ export class HttpTransport extends EventEmitter {
483
492
  return { valid: false, error: 'Invalid authorization format' };
484
493
  }
485
494
  const token = tokenMatch[1];
486
- if (this.config.auth?.tokens?.length) {
487
- if (!this.config.auth.tokens.includes(token)) {
488
- return { valid: false, error: 'Invalid token' };
489
- }
495
+ if (!this.matchesConfiguredToken(token)) {
496
+ return { valid: false, error: 'Invalid token' };
490
497
  }
491
498
  return { valid: true };
492
499
  }
500
+ /** /ws upgrade: token from `Authorization: Bearer`, else from `?token=`. Never throws. */
501
+ validateUpgradeAuth(req) {
502
+ try {
503
+ const header = req.headers.authorization;
504
+ const match = typeof header === 'string' ? header.match(/^Bearer\s+(.+)$/i) : null;
505
+ const fromQuery = new URL(req.url ?? '', 'http://localhost').searchParams.get('token') ?? undefined;
506
+ return this.matchesConfiguredToken(match?.[1] ?? fromQuery);
507
+ }
508
+ catch {
509
+ return false;
510
+ }
511
+ }
512
+ /**
513
+ * Fail closed: auth enabled with no configured token accepts nothing. Unset or
514
+ * empty entries match nothing. Comparison is constant-time over SHA-256 digests,
515
+ * with no early exit.
516
+ */
517
+ matchesConfiguredToken(given) {
518
+ if (!given)
519
+ return false;
520
+ const digest = createHash('sha256').update(given, 'utf8').digest();
521
+ let valid = false;
522
+ for (const candidate of this.config.auth?.tokens ?? []) {
523
+ if (typeof candidate !== 'string' || candidate.length === 0)
524
+ continue;
525
+ if (timingSafeEqual(digest, createHash('sha256').update(candidate, 'utf8').digest())) {
526
+ valid = true;
527
+ }
528
+ }
529
+ return valid;
530
+ }
493
531
  }
494
532
  /**
495
533
  * Create HTTP transport
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/shared",
3
- "version": "3.0.8",
3
+ "version": "3.0.10",
4
4
  "type": "module",
5
5
  "description": "Shared types, event bus, config schemas and validators, MCP transport helpers and resilience utilities used by the Ruflo (claude-flow) V3 packages.",
6
6
  "main": "dist/index.js",