claude-flow 3.32.1 → 3.32.8

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 (51) hide show
  1. package/.claude/helpers/statusline.cjs +24 -17
  2. package/.claude-plugin/scripts/ruflo-hook.cjs +2 -2
  3. package/.claude-plugin/scripts/ruflo-hook.sh +17 -2
  4. package/package.json +1 -1
  5. package/v3/@claude-flow/cli/catalog-manifest.json +2 -2
  6. package/v3/@claude-flow/cli/dist/src/auth/client.d.ts +89 -0
  7. package/v3/@claude-flow/cli/dist/src/auth/client.js +242 -0
  8. package/v3/@claude-flow/cli/dist/src/auth/constants.d.ts +7 -0
  9. package/v3/@claude-flow/cli/dist/src/auth/constants.js +7 -0
  10. package/v3/@claude-flow/cli/dist/src/auth/scopes.d.ts +14 -0
  11. package/v3/@claude-flow/cli/dist/src/auth/scopes.js +21 -0
  12. package/v3/@claude-flow/cli/dist/src/auth/security-bridge.d.ts +36 -0
  13. package/v3/@claude-flow/cli/dist/src/auth/security-bridge.js +42 -0
  14. package/v3/@claude-flow/cli/dist/src/auth/session.d.ts +20 -0
  15. package/v3/@claude-flow/cli/dist/src/auth/session.js +32 -0
  16. package/v3/@claude-flow/cli/dist/src/auth/state.d.ts +19 -0
  17. package/v3/@claude-flow/cli/dist/src/auth/state.js +53 -0
  18. package/v3/@claude-flow/cli/dist/src/auth/types.d.ts +27 -0
  19. package/v3/@claude-flow/cli/dist/src/auth/types.js +11 -0
  20. package/v3/@claude-flow/cli/dist/src/commands/auth.d.ts +15 -0
  21. package/v3/@claude-flow/cli/dist/src/commands/auth.js +244 -0
  22. package/v3/@claude-flow/cli/dist/src/commands/doctor.js +211 -4
  23. package/v3/@claude-flow/cli/dist/src/commands/hooks.js +20 -9
  24. package/v3/@claude-flow/cli/dist/src/commands/index.js +2 -0
  25. package/v3/@claude-flow/cli/dist/src/commands/proxy-lifecycle.d.ts +20 -0
  26. package/v3/@claude-flow/cli/dist/src/commands/proxy-lifecycle.js +277 -0
  27. package/v3/@claude-flow/cli/dist/src/commands/proxy.js +97 -4
  28. package/v3/@claude-flow/cli/dist/src/commands/security.js +16 -11
  29. package/v3/@claude-flow/cli/dist/src/funnel/insights.d.ts +1 -0
  30. package/v3/@claude-flow/cli/dist/src/funnel/insights.js +4 -4
  31. package/v3/@claude-flow/cli/dist/src/funnel/local-signals.d.ts +6 -1
  32. package/v3/@claude-flow/cli/dist/src/funnel/local-signals.js +29 -20
  33. package/v3/@claude-flow/cli/dist/src/init/executor.js +2 -2
  34. package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +13 -1
  35. package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +11 -3
  36. package/v3/@claude-flow/cli/dist/src/proxy/install.d.ts +29 -0
  37. package/v3/@claude-flow/cli/dist/src/proxy/install.js +135 -0
  38. package/v3/@claude-flow/cli/dist/src/proxy/lifecycle.d.ts +61 -0
  39. package/v3/@claude-flow/cli/dist/src/proxy/lifecycle.js +249 -0
  40. package/v3/@claude-flow/cli/dist/src/proxy/paths.d.ts +34 -0
  41. package/v3/@claude-flow/cli/dist/src/proxy/paths.js +70 -0
  42. package/v3/@claude-flow/cli/dist/src/proxy/release.d.ts +47 -0
  43. package/v3/@claude-flow/cli/dist/src/proxy/release.js +138 -0
  44. package/v3/@claude-flow/cli/dist/src/proxy/token-bridge.d.ts +5 -0
  45. package/v3/@claude-flow/cli/dist/src/proxy/token-bridge.js +61 -0
  46. package/v3/@claude-flow/cli/dist/src/proxy/verify.d.ts +44 -0
  47. package/v3/@claude-flow/cli/dist/src/proxy/verify.js +68 -0
  48. package/v3/@claude-flow/cli/dist/src/security/builtin-aidefence.d.ts +34 -0
  49. package/v3/@claude-flow/cli/dist/src/security/builtin-aidefence.js +86 -0
  50. package/v3/@claude-flow/cli/dist/src/services/fable-harness.d.ts +1 -0
  51. package/v3/@claude-flow/cli/package.json +2 -2
@@ -0,0 +1,68 @@
1
+ /**
2
+ * meta-proxy release verification (ADR-307) — mirrors src/init/helper-signing.ts's
3
+ * raw-EdDSA `crypto.verify(null, ...)` pattern almost exactly, and matches the
4
+ * exact scheme confirmed live 2026-07-16 against a real v0.1.0 release: ONE
5
+ * combined `SHA256SUMS.sig` (raw Ed25519 over the `SHA256SUMS` file's bytes,
6
+ * base64-encoded — not a per-binary signature), then a per-asset SHA-256
7
+ * check against the matching `SHA256SUMS` line. Refuse-all-or-nothing on any
8
+ * mismatch, same discipline as `writeCriticalHelpers()`.
9
+ *
10
+ * @module proxy/verify
11
+ */
12
+ import { createHash, createPublicKey, verify as cryptoVerify } from 'node:crypto';
13
+ /**
14
+ * meta-proxy's committed release-signing public key (SPKI PEM), confirmed
15
+ * live 2026-07-16 by verifying a real `SHA256SUMS.sig` from the v0.1.0
16
+ * release against it (crypto.verify -> true).
17
+ */
18
+ export const PROXY_RELEASE_PUBKEY_PEM = `-----BEGIN PUBLIC KEY-----
19
+ MCowBQYDK2VwAyEAjhLDomjIGdcltYC7j+aiESQFD4LWoHaULietG1PuDjw=
20
+ -----END PUBLIC KEY-----`;
21
+ export class ReleaseVerificationError extends Error {
22
+ constructor(message) {
23
+ super(message);
24
+ this.name = 'ReleaseVerificationError';
25
+ }
26
+ }
27
+ /** Raw EdDSA verify of `SHA256SUMS.sig` (base64) over `SHA256SUMS`'s exact bytes. */
28
+ export function verifySha256SumsSignature(sumsBytes, sigBase64, pubkeyPem = PROXY_RELEASE_PUBKEY_PEM) {
29
+ const pubkey = createPublicKey(pubkeyPem);
30
+ const sig = Buffer.from(sigBase64.trim(), 'base64');
31
+ return cryptoVerify(null, sumsBytes, pubkey, sig);
32
+ }
33
+ /** Parses `<sha256> <filename>` lines (sha256sum's own output format). */
34
+ export function parseSha256Sums(sumsText) {
35
+ const result = {};
36
+ for (const line of sumsText.split(/\r?\n/)) {
37
+ const match = line.match(/^([0-9a-f]{64})\s+(.+)$/i);
38
+ if (!match)
39
+ continue;
40
+ result[match[2]] = match[1].toLowerCase();
41
+ }
42
+ return result;
43
+ }
44
+ export function sha256Hex(bytes) {
45
+ return createHash('sha256').update(bytes).digest('hex');
46
+ }
47
+ /**
48
+ * Full verification: signature over SHA256SUMS, then the asset's own hash
49
+ * against the matching line. Throws `ReleaseVerificationError` on ANY
50
+ * failure — there is no partial-trust outcome, matching ADR-307's "refuses
51
+ * on any mismatch" requirement.
52
+ */
53
+ export function verifyRelease(input) {
54
+ if (!verifySha256SumsSignature(input.sumsBytes, input.sigBase64, input.pubkeyPem)) {
55
+ throw new ReleaseVerificationError('SHA256SUMS.sig failed Ed25519 verification — refusing to install');
56
+ }
57
+ const sums = parseSha256Sums(input.sumsBytes.toString('utf-8'));
58
+ const expected = sums[input.assetFilename];
59
+ if (!expected) {
60
+ throw new ReleaseVerificationError(`SHA256SUMS has no entry for ${input.assetFilename}`);
61
+ }
62
+ const actual = sha256Hex(input.assetBytes);
63
+ if (actual !== expected) {
64
+ throw new ReleaseVerificationError(`sha256 mismatch for ${input.assetFilename}: expected ${expected.slice(0, 12)}…, got ${actual.slice(0, 12)}…`);
65
+ }
66
+ return { sha256: actual };
67
+ }
68
+ //# sourceMappingURL=verify.js.map
@@ -0,0 +1,34 @@
1
+ export interface BuiltinThreat {
2
+ type: string;
3
+ severity: 'critical' | 'high' | 'medium' | 'low';
4
+ description: string;
5
+ confidence: number;
6
+ }
7
+ export interface DefenceResult {
8
+ safe: boolean;
9
+ threats: BuiltinThreat[];
10
+ piiFound: boolean;
11
+ detectionTimeMs: number;
12
+ inputHash: string;
13
+ }
14
+ export interface DefenceEngine {
15
+ detect(input: string): Promise<DefenceResult>;
16
+ quickScan(input: string): {
17
+ threat: boolean;
18
+ confidence: number;
19
+ type?: string;
20
+ };
21
+ getStats(): Promise<{
22
+ detectionCount: number;
23
+ avgDetectionTimeMs: number;
24
+ learnedPatterns: number;
25
+ mitigationStrategies: number;
26
+ avgMitigationEffectiveness: number;
27
+ }>;
28
+ getBestMitigation(type: string): Promise<{
29
+ strategy: string;
30
+ effectiveness: number;
31
+ } | null>;
32
+ }
33
+ export declare function createBuiltinAIDefence(): DefenceEngine;
34
+ //# sourceMappingURL=builtin-aidefence.d.ts.map
@@ -0,0 +1,86 @@
1
+ import { createHash } from 'node:crypto';
2
+ const THREAT_PATTERNS = [
3
+ {
4
+ type: 'prompt-injection',
5
+ severity: 'high',
6
+ confidence: 0.96,
7
+ description: 'Attempts to override or discard trusted instructions',
8
+ pattern: /\b(?:ignore|disregard|forget|override)\b[\s\S]{0,40}\b(?:previous|prior|system|developer|trusted)\b[\s\S]{0,24}\b(?:instructions?|prompts?|rules?|messages?)\b/i,
9
+ },
10
+ {
11
+ type: 'system-prompt-extraction',
12
+ severity: 'high',
13
+ confidence: 0.94,
14
+ description: 'Attempts to reveal hidden system or developer instructions',
15
+ pattern: /\b(?:reveal|show|print|repeat|dump|expose)\b[\s\S]{0,32}\b(?:system|developer|hidden|initial)\b[\s\S]{0,20}\b(?:prompt|message|instructions?)\b/i,
16
+ },
17
+ {
18
+ type: 'jailbreak',
19
+ severity: 'high',
20
+ confidence: 0.91,
21
+ description: 'Attempts to bypass model safeguards or enter an unrestricted mode',
22
+ pattern: /\b(?:developer mode|DAN mode|jailbreak|bypass (?:all )?(?:safeguards|restrictions|filters)|unrestricted mode)\b/i,
23
+ },
24
+ {
25
+ type: 'data-exfiltration',
26
+ severity: 'critical',
27
+ confidence: 0.93,
28
+ description: 'Attempts to transmit secrets or credentials to an external destination',
29
+ pattern: /\b(?:send|upload|post|exfiltrate|transmit)\b[\s\S]{0,48}\b(?:secret|credential|password|api key|token|private key)\b/i,
30
+ },
31
+ ];
32
+ const PII_PATTERNS = [
33
+ /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/i,
34
+ /\b\d{3}-\d{2}-\d{4}\b/,
35
+ /\b(?:sk-|ghp_|xox[baprs]-)[A-Za-z0-9_-]{16,}\b/,
36
+ /\bAKIA[A-Z0-9]{16}\b/,
37
+ ];
38
+ export function createBuiltinAIDefence() {
39
+ let detectionCount = 0;
40
+ let totalDetectionTimeMs = 0;
41
+ const scan = (input) => THREAT_PATTERNS
42
+ .filter(({ pattern }) => pattern.test(input))
43
+ .map(({ pattern: _pattern, ...threat }) => threat);
44
+ return {
45
+ async detect(input) {
46
+ const startedAt = performance.now();
47
+ const threats = scan(input);
48
+ const piiFound = PII_PATTERNS.some((pattern) => pattern.test(input));
49
+ const detectionTimeMs = performance.now() - startedAt;
50
+ detectionCount++;
51
+ totalDetectionTimeMs += detectionTimeMs;
52
+ return {
53
+ safe: threats.length === 0 && !piiFound,
54
+ threats,
55
+ piiFound,
56
+ detectionTimeMs,
57
+ inputHash: createHash('sha256').update(input).digest('hex'),
58
+ };
59
+ },
60
+ quickScan(input) {
61
+ const threat = scan(input)[0];
62
+ return threat
63
+ ? { threat: true, confidence: threat.confidence, type: threat.type }
64
+ : { threat: false, confidence: 0 };
65
+ },
66
+ async getStats() {
67
+ return {
68
+ detectionCount,
69
+ avgDetectionTimeMs: detectionCount === 0 ? 0 : totalDetectionTimeMs / detectionCount,
70
+ learnedPatterns: 0,
71
+ mitigationStrategies: 4,
72
+ avgMitigationEffectiveness: 0.9,
73
+ };
74
+ },
75
+ async getBestMitigation(type) {
76
+ const strategies = {
77
+ 'prompt-injection': 'Keep trusted instructions immutable and reject instruction overrides',
78
+ 'system-prompt-extraction': 'Do not disclose system or developer messages',
79
+ jailbreak: 'Apply the configured policy without adopting alternate personas',
80
+ 'data-exfiltration': 'Block external transmission and rotate exposed credentials',
81
+ };
82
+ return strategies[type] ? { strategy: strategies[type], effectiveness: 0.9 } : null;
83
+ },
84
+ };
85
+ }
86
+ //# sourceMappingURL=builtin-aidefence.js.map
@@ -90,6 +90,7 @@ export interface ReflectResult {
90
90
  export interface CoPilotSnapshot {
91
91
  security?: {
92
92
  status: string;
93
+ findings?: number;
93
94
  cvesFixed: number;
94
95
  totalCves: number;
95
96
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.32.1",
3
+ "version": "3.32.8",
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",
@@ -112,7 +112,7 @@
112
112
  },
113
113
  "optionalDependencies": {
114
114
  "@claude-flow/memory": "^3.0.0-alpha.21",
115
- "@claude-flow/security": "^3.0.0-alpha.10",
115
+ "@claude-flow/security": "^3.0.0-alpha.12",
116
116
  "agentdb": "^3.0.0-alpha.17",
117
117
  "agentic-flow": "^3.0.0-alpha.1",
118
118
  "ruvector": "^0.2.27"