claude-flow 3.7.0-alpha.12 → 3.7.0-alpha.13
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 +1 -1
- package/v3/@claude-flow/cli/dist/src/services/worker-daemon.d.ts +11 -0
- package/v3/@claude-flow/cli/dist/src/services/worker-daemon.js +58 -0
- package/v3/@claude-flow/cli/package.json +1 -1
- package/v3/@claude-flow/guidance/dist/analyzer.js +9 -0
- package/v3/@claude-flow/guidance/package.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-flow",
|
|
3
|
-
"version": "3.7.0-alpha.
|
|
3
|
+
"version": "3.7.0-alpha.13",
|
|
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",
|
|
@@ -182,6 +182,17 @@ export declare class WorkerDaemon extends EventEmitter {
|
|
|
182
182
|
* Run the actual worker logic
|
|
183
183
|
*/
|
|
184
184
|
private runWorkerLogic;
|
|
185
|
+
/**
|
|
186
|
+
* #1793: persist a headless worker result to the same metrics file the
|
|
187
|
+
* local fallback writes to. Without this, AI-mode workers produced rich
|
|
188
|
+
* structured output (audit findings, perf signals, test-gap analysis)
|
|
189
|
+
* that lived only in `.claude-flow/logs/headless/*_result.log` and was
|
|
190
|
+
* invisible to `npx ruflo memory stats` or the metrics consumers.
|
|
191
|
+
*
|
|
192
|
+
* The mapping mirrors the `*Local` worker implementations below so a
|
|
193
|
+
* single consumer path works regardless of execution mode.
|
|
194
|
+
*/
|
|
195
|
+
private persistHeadlessResult;
|
|
185
196
|
private runMapWorker;
|
|
186
197
|
/**
|
|
187
198
|
* Local audit worker (fallback when headless unavailable)
|
|
@@ -725,6 +725,17 @@ export class WorkerDaemon extends EventEmitter {
|
|
|
725
725
|
try {
|
|
726
726
|
this.log('info', `Running ${workerConfig.type} in headless mode (Claude Code AI)`);
|
|
727
727
|
const result = await this.headlessExecutor.execute(workerConfig.type);
|
|
728
|
+
// #1793: persist the headless result to the same metrics files the
|
|
729
|
+
// local workers write to. Without this, AI-mode runs produced rich
|
|
730
|
+
// parsedOutput that lived only in `.claude-flow/logs/headless/*` and
|
|
731
|
+
// never reached `.claude-flow/metrics/<name>.json` — `memory stats`
|
|
732
|
+
// and downstream consumers saw nothing despite successful runs.
|
|
733
|
+
try {
|
|
734
|
+
this.persistHeadlessResult(workerConfig.type, result);
|
|
735
|
+
}
|
|
736
|
+
catch (persistError) {
|
|
737
|
+
this.log('warn', `Failed to persist headless result for ${workerConfig.type}: ${persistError.message}`);
|
|
738
|
+
}
|
|
728
739
|
return {
|
|
729
740
|
mode: 'headless',
|
|
730
741
|
...result,
|
|
@@ -769,6 +780,53 @@ export class WorkerDaemon extends EventEmitter {
|
|
|
769
780
|
return { status: 'unknown worker type', mode: 'local' };
|
|
770
781
|
}
|
|
771
782
|
}
|
|
783
|
+
/**
|
|
784
|
+
* #1793: persist a headless worker result to the same metrics file the
|
|
785
|
+
* local fallback writes to. Without this, AI-mode workers produced rich
|
|
786
|
+
* structured output (audit findings, perf signals, test-gap analysis)
|
|
787
|
+
* that lived only in `.claude-flow/logs/headless/*_result.log` and was
|
|
788
|
+
* invisible to `npx ruflo memory stats` or the metrics consumers.
|
|
789
|
+
*
|
|
790
|
+
* The mapping mirrors the `*Local` worker implementations below so a
|
|
791
|
+
* single consumer path works regardless of execution mode.
|
|
792
|
+
*/
|
|
793
|
+
persistHeadlessResult(workerType, result) {
|
|
794
|
+
const metricsDir = join(this.projectRoot, '.claude-flow', 'metrics');
|
|
795
|
+
if (!existsSync(metricsDir))
|
|
796
|
+
mkdirSync(metricsDir, { recursive: true });
|
|
797
|
+
// Filename mirrors the local-mode worker writes (security-audit.json,
|
|
798
|
+
// performance.json, test-gaps.json) so a downstream reader doesn't
|
|
799
|
+
// care which mode produced the data.
|
|
800
|
+
const filenameMap = {
|
|
801
|
+
audit: 'security-audit.json',
|
|
802
|
+
optimize: 'performance.json',
|
|
803
|
+
testgaps: 'test-gaps.json',
|
|
804
|
+
document: 'documentation.json',
|
|
805
|
+
refactor: 'refactor.json',
|
|
806
|
+
deepdive: 'deepdive.json',
|
|
807
|
+
ultralearn: 'ultralearn.json',
|
|
808
|
+
predict: 'predictions.json',
|
|
809
|
+
};
|
|
810
|
+
const filename = filenameMap[workerType] ?? `${workerType}.json`;
|
|
811
|
+
const metricsFile = join(metricsDir, filename);
|
|
812
|
+
const persisted = {
|
|
813
|
+
timestamp: result.timestamp instanceof Date ? result.timestamp.toISOString() : new Date().toISOString(),
|
|
814
|
+
mode: 'headless',
|
|
815
|
+
workerType,
|
|
816
|
+
model: result.model,
|
|
817
|
+
durationMs: result.durationMs,
|
|
818
|
+
tokensUsed: result.tokensUsed,
|
|
819
|
+
executionId: result.executionId,
|
|
820
|
+
success: result.success,
|
|
821
|
+
// Structured findings live here when the worker emits JSON (e.g. the
|
|
822
|
+
// audit worker's vulnerability list). Fall back to a raw-output
|
|
823
|
+
// pointer so consumers can still locate the full log.
|
|
824
|
+
findings: result.parsedOutput ?? null,
|
|
825
|
+
rawOutputPreview: typeof result.output === 'string' ? result.output.slice(0, 2000) : undefined,
|
|
826
|
+
rawOutputLength: typeof result.output === 'string' ? result.output.length : 0,
|
|
827
|
+
};
|
|
828
|
+
writeFileSync(metricsFile, JSON.stringify(persisted, null, 2));
|
|
829
|
+
}
|
|
772
830
|
// Worker implementations
|
|
773
831
|
async runMapWorker() {
|
|
774
832
|
// Scan project structure and update metrics
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claude-flow/cli",
|
|
3
|
-
"version": "3.7.0-alpha.
|
|
3
|
+
"version": "3.7.0-alpha.13",
|
|
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",
|
|
@@ -2461,6 +2461,15 @@ function pad(value) {
|
|
|
2461
2461
|
export async function abBenchmark(claudeMdContent, options = {}) {
|
|
2462
2462
|
const { executor = new DefaultHeadlessExecutor(), tasks = getABTasks(), proofKey, workDir = process.cwd(), } = options;
|
|
2463
2463
|
const contentAware = isContentAwareExecutor(executor);
|
|
2464
|
+
// #1652: a non-content-aware executor reads CLAUDE.md from disk for both
|
|
2465
|
+
// configs, so the delta is architecturally guaranteed to be zero — yet
|
|
2466
|
+
// the verdict implies the user's CLAUDE.md is ineffective. Detect and
|
|
2467
|
+
// abort with a clear, actionable message before spending ~$23 in tokens
|
|
2468
|
+
// on a meaningless run. The default executor IS content-aware, so this
|
|
2469
|
+
// only triggers when callers inject a bare IHeadlessExecutor.
|
|
2470
|
+
if (!contentAware) {
|
|
2471
|
+
throw new Error('abBenchmark requires a content-aware executor. The provided IHeadlessExecutor lacks `setContext()`, so Config A and Config B will both read the same on-disk CLAUDE.md and the delta is guaranteed to be zero. Either use the DefaultHeadlessExecutor (content-aware as of @claude-flow/guidance@3.0.0-alpha.2) or implement IContentAwareExecutor on your custom executor.');
|
|
2472
|
+
}
|
|
2464
2473
|
// ── Config A: No control plane ──────────────────────────────────────
|
|
2465
2474
|
// For content-aware executors, set empty context (simulating no guidance)
|
|
2466
2475
|
if (contentAware)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claude-flow/guidance",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.3",
|
|
4
4
|
"description": "Guidance Control Plane - Compiles, retrieves, enforces, and evolves guidance rules for Claude Code sessions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|