claude-flow 3.7.0-alpha.65 → 3.7.0-alpha.67

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "3.7.0-alpha.65",
3
+ "version": "3.7.0-alpha.67",
4
4
  "description": "Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -0,0 +1,21 @@
1
+ /**
2
+ * ADR-121 Phase 25 — `ruflo benchmark verify` CLI subcommand.
3
+ *
4
+ * Makes the Phase 15-24 witness story end-user-accessible. Anyone
5
+ * publishing benchmark numbers with a witness manifest (single
6
+ * `.json`) or a chained ledger (`bench-witness/ledger.json`) can
7
+ * tell consumers:
8
+ *
9
+ * npx ruflo benchmark verify ./ledger.json
10
+ *
11
+ * The command auto-detects whether the input is a single witness or
12
+ * a ledger (presence of `version` + `entries[]` → ledger), runs the
13
+ * appropriate verifier, and prints a human-readable or JSON report.
14
+ *
15
+ * For Phase 24 multi-signer entries, pass `--threshold N` to require
16
+ * N or more valid signatures per entry.
17
+ */
18
+ import type { Command } from '../types.js';
19
+ export declare const benchmarkVerifyCommand: Command;
20
+ export default benchmarkVerifyCommand;
21
+ //# sourceMappingURL=benchmark-verify.d.ts.map
@@ -0,0 +1,202 @@
1
+ /**
2
+ * ADR-121 Phase 25 — `ruflo benchmark verify` CLI subcommand.
3
+ *
4
+ * Makes the Phase 15-24 witness story end-user-accessible. Anyone
5
+ * publishing benchmark numbers with a witness manifest (single
6
+ * `.json`) or a chained ledger (`bench-witness/ledger.json`) can
7
+ * tell consumers:
8
+ *
9
+ * npx ruflo benchmark verify ./ledger.json
10
+ *
11
+ * The command auto-detects whether the input is a single witness or
12
+ * a ledger (presence of `version` + `entries[]` → ledger), runs the
13
+ * appropriate verifier, and prints a human-readable or JSON report.
14
+ *
15
+ * For Phase 24 multi-signer entries, pass `--threshold N` to require
16
+ * N or more valid signatures per entry.
17
+ */
18
+ import { promises as fs } from 'node:fs';
19
+ import { resolve } from 'node:path';
20
+ import { output } from '../output.js';
21
+ function isLedger(parsed) {
22
+ return typeof parsed.version === 'number' && Array.isArray(parsed.entries);
23
+ }
24
+ function isWrappedWitness(parsed) {
25
+ return parsed.witness !== undefined && typeof parsed.witness === 'object';
26
+ }
27
+ function isRawWitness(parsed) {
28
+ return typeof parsed.contentHash === 'string' && typeof parsed.signature === 'string';
29
+ }
30
+ export const benchmarkVerifyCommand = {
31
+ name: 'verify',
32
+ description: 'Verify a benchmark witness manifest or chained ledger via the published @claude-flow/embeddings cryptographic primitives',
33
+ options: [
34
+ {
35
+ name: 'threshold',
36
+ short: 't',
37
+ type: 'number',
38
+ description: 'Phase 24 M-of-N: minimum signatures required per entry. Default 1.',
39
+ default: '1',
40
+ },
41
+ {
42
+ name: 'json',
43
+ type: 'boolean',
44
+ description: 'Output JSON instead of human-readable',
45
+ default: 'false',
46
+ },
47
+ ],
48
+ examples: [
49
+ { command: 'ruflo benchmark verify ./bench-witness/ledger.json', description: 'Verify a chained ledger' },
50
+ { command: 'ruflo benchmark verify ./bench-witness/rag-real-text-*.json', description: 'Verify a single witness manifest' },
51
+ { command: 'ruflo benchmark verify ledger.json --threshold 3', description: 'Require ≥3 signatures per entry (M-of-N)' },
52
+ { command: 'ruflo benchmark verify ledger.json --json', description: 'Machine-readable output for CI gating' },
53
+ ],
54
+ action: async (ctx) => {
55
+ const pathArg = ctx.args[0];
56
+ const threshold = Number(ctx.flags.threshold ?? 1);
57
+ const asJson = ctx.flags.json === true || ctx.flags.json === 'true';
58
+ if (!pathArg || typeof pathArg !== 'string') {
59
+ const err = 'usage: ruflo benchmark verify <path-to-ledger.json-or-witness.json> [--threshold N] [--json]';
60
+ if (asJson)
61
+ output.printJson({ ok: false, error: err });
62
+ else
63
+ output.printError(err);
64
+ return { success: false, exitCode: 1 };
65
+ }
66
+ if (!Number.isFinite(threshold) || threshold < 1) {
67
+ const err = `--threshold must be a positive integer, got: ${ctx.flags.threshold}`;
68
+ if (asJson)
69
+ output.printJson({ ok: false, error: err });
70
+ else
71
+ output.printError(err);
72
+ return { success: false, exitCode: 1 };
73
+ }
74
+ const absPath = resolve(process.cwd(), pathArg);
75
+ let raw;
76
+ try {
77
+ raw = await fs.readFile(absPath, 'utf8');
78
+ }
79
+ catch (err) {
80
+ const msg = err instanceof Error ? err.message : String(err);
81
+ if (asJson)
82
+ output.printJson({ ok: false, error: `cannot read ${absPath}: ${msg}` });
83
+ else
84
+ output.printError(`Cannot read ${absPath}: ${msg}`);
85
+ return { success: false, exitCode: 1 };
86
+ }
87
+ let parsed;
88
+ try {
89
+ parsed = JSON.parse(raw);
90
+ }
91
+ catch (err) {
92
+ const msg = err instanceof Error ? err.message : String(err);
93
+ if (asJson)
94
+ output.printJson({ ok: false, error: `not valid JSON: ${msg}` });
95
+ else
96
+ output.printError(`Not valid JSON: ${msg}`);
97
+ return { success: false, exitCode: 1 };
98
+ }
99
+ // Lazy-import the embeddings verifiers so the CLI startup stays fast
100
+ // when this command isn't used.
101
+ const { verify } = await import('@claude-flow/embeddings/witness');
102
+ const { verifyLedger, verifyEntry } = await import('@claude-flow/embeddings/witness-ledger');
103
+ // === Path 1: chained ledger ===
104
+ if (isLedger(parsed)) {
105
+ const ledger = parsed;
106
+ const result = verifyLedger(ledger, { minSignatures: threshold });
107
+ if (asJson) {
108
+ output.printJson({
109
+ ok: result.valid,
110
+ kind: 'ledger',
111
+ entryCount: result.entryCount,
112
+ firstFailureAt: result.firstFailureAt,
113
+ reason: result.reason,
114
+ threshold,
115
+ path: absPath,
116
+ });
117
+ return { success: result.valid, exitCode: result.valid ? 0 : 1 };
118
+ }
119
+ output.writeln();
120
+ output.writeln(output.bold(`Ledger verification (${absPath})`));
121
+ output.writeln(output.dim('─'.repeat(60)));
122
+ output.writeln(` entries: ${result.entryCount}`);
123
+ output.writeln(` threshold: minSignatures = ${threshold}`);
124
+ output.writeln(` verifyLedger(): ${result.valid ? output.success('TRUE') : output.error('FALSE')}`);
125
+ if (!result.valid) {
126
+ output.writeln(` failure at: entry ${result.firstFailureAt}`);
127
+ output.writeln(` reason: ${result.reason}`);
128
+ }
129
+ // Per-entry summary table
130
+ const entries = ledger.entries;
131
+ output.writeln();
132
+ output.writeln(' per-entry:');
133
+ for (const e of entries) {
134
+ const cosigCount = Array.isArray(e.cosignatures) ? e.cosignatures.length : 0;
135
+ const ok = verifyEntry(e, { minSignatures: threshold });
136
+ const verdict = ok ? output.success('✓') : output.error('✗');
137
+ const hashShort = e.contentHash.slice(0, 12) + '…';
138
+ output.writeln(` [${String(e.sequence).padStart(2)}] ${e.benchmark.padEnd(28)} sigs=${1 + cosigCount} ${hashShort} ${verdict}`);
139
+ }
140
+ output.writeln();
141
+ return { success: result.valid, exitCode: result.valid ? 0 : 1 };
142
+ }
143
+ // === Path 2: wrapped single witness (the bench scripts' output shape) ===
144
+ if (isWrappedWitness(parsed)) {
145
+ const w = parsed.witness;
146
+ const ok = verify(w);
147
+ if (asJson) {
148
+ output.printJson({
149
+ ok,
150
+ kind: 'witness',
151
+ benchmark: w.benchmark,
152
+ contentHash: w.contentHash,
153
+ path: absPath,
154
+ });
155
+ return { success: ok, exitCode: ok ? 0 : 1 };
156
+ }
157
+ output.writeln();
158
+ output.writeln(output.bold(`Witness verification (${absPath})`));
159
+ output.writeln(output.dim('─'.repeat(60)));
160
+ output.writeln(` benchmark: ${w.benchmark}`);
161
+ output.writeln(` contentHash: ${w.contentHash}`);
162
+ output.writeln(` signature: ${w.signature.slice(0, 32)}...`);
163
+ output.writeln(` publicKey: ${w.publicKey.slice(0, 32)}...`);
164
+ output.writeln(` algorithm: ${w.signatureAlgorithm}`);
165
+ output.writeln(` verify(): ${ok ? output.success('TRUE') : output.error('FALSE')}`);
166
+ output.writeln();
167
+ return { success: ok, exitCode: ok ? 0 : 1 };
168
+ }
169
+ // === Path 3: raw single witness (top-level fields, no wrapper) ===
170
+ if (isRawWitness(parsed)) {
171
+ const w = parsed;
172
+ const ok = verify(w);
173
+ if (asJson) {
174
+ output.printJson({
175
+ ok,
176
+ kind: 'witness-raw',
177
+ benchmark: w.benchmark,
178
+ contentHash: w.contentHash,
179
+ path: absPath,
180
+ });
181
+ return { success: ok, exitCode: ok ? 0 : 1 };
182
+ }
183
+ output.writeln();
184
+ output.writeln(output.bold(`Witness verification (${absPath})`));
185
+ output.writeln(output.dim('─'.repeat(60)));
186
+ output.writeln(` benchmark: ${w.benchmark}`);
187
+ output.writeln(` contentHash: ${w.contentHash}`);
188
+ output.writeln(` verify(): ${ok ? output.success('TRUE') : output.error('FALSE')}`);
189
+ output.writeln();
190
+ return { success: ok, exitCode: ok ? 0 : 1 };
191
+ }
192
+ // === Path 4: unknown shape ===
193
+ const err = `unrecognized file shape — expected a benchmark ledger ({version, entries}), a wrapped witness ({witness: {...}}), or a raw witness ({contentHash, signature, publicKey})`;
194
+ if (asJson)
195
+ output.printJson({ ok: false, error: err, path: absPath });
196
+ else
197
+ output.printError(err);
198
+ return { success: false, exitCode: 1 };
199
+ },
200
+ };
201
+ export default benchmarkVerifyCommand;
202
+ //# sourceMappingURL=benchmark-verify.js.map
@@ -423,6 +423,8 @@ const allCommand = {
423
423
  // ============================================================================
424
424
  // Main Benchmark Command
425
425
  // ============================================================================
426
+ // ADR-121 Phase 25 — `benchmark verify` for the chained witness ledger.
427
+ import { benchmarkVerifyCommand } from './benchmark-verify.js';
426
428
  export const benchmarkCommand = {
427
429
  name: 'benchmark',
428
430
  description: 'Performance benchmarking for self-learning and neural systems',
@@ -431,12 +433,14 @@ export const benchmarkCommand = {
431
433
  neuralCommand,
432
434
  memoryCommand,
433
435
  allCommand,
436
+ benchmarkVerifyCommand,
434
437
  ],
435
438
  examples: [
436
439
  { command: 'claude-flow benchmark pretrain', description: 'Benchmark pre-training system' },
437
440
  { command: 'claude-flow benchmark neural', description: 'Benchmark neural operations' },
438
441
  { command: 'claude-flow benchmark memory', description: 'Benchmark memory operations' },
439
442
  { command: 'claude-flow benchmark all', description: 'Run all benchmarks' },
443
+ { command: 'claude-flow benchmark verify ./bench-witness/ledger.json', description: 'Cryptographically verify a published ledger (Phase 25)' },
440
444
  ],
441
445
  action: async (_ctx) => {
442
446
  output.writeln();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.7.0-alpha.65",
3
+ "version": "3.7.0-alpha.67",
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",
@@ -104,14 +104,14 @@
104
104
  "semver": "^7.6.0",
105
105
  "yaml": "^2.8.0",
106
106
  "@claude-flow/memory": "^3.0.0-alpha.17",
107
- "@claude-flow/embeddings": "^3.0.0-alpha.44",
107
+ "@claude-flow/embeddings": "^3.0.0-alpha.45",
108
108
  "@claude-flow/security": "^3.0.0-alpha.8",
109
109
  "@claude-flow/swarm": "^3.0.0-alpha.8"
110
110
  },
111
111
  "optionalDependencies": {
112
112
  "@claude-flow/aidefence": "^3.0.2",
113
113
  "@claude-flow/codex": "^3.0.0-alpha.8",
114
- "@claude-flow/embeddings": "^3.0.0-alpha.44",
114
+ "@claude-flow/embeddings": "^3.0.0-alpha.45",
115
115
  "@claude-flow/guidance": "^3.0.0-alpha.1",
116
116
  "@claude-flow/memory": "^3.0.0-alpha.17",
117
117
  "@claude-flow/plugin-gastown-bridge": "^0.1.3",