claude-flow 3.56.9 → 3.57.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.
- package/.claude/.proven-config-version +1 -0
- package/.claude/helpers/intelligence.cjs +51 -9
- package/.claude/proven-config.json +42 -0
- package/.claude/skills/verification-quality/SKILL.md +14 -11
- package/README.md +1 -1
- package/node_modules/@claude-flow/codex/dist/cli.js +0 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +0 -0
- package/node_modules/@claude-flow/security/dist/policy/engine.d.ts +17 -1
- package/node_modules/@claude-flow/security/dist/policy/engine.d.ts.map +1 -1
- package/node_modules/@claude-flow/security/dist/policy/engine.js +99 -24
- package/node_modules/@claude-flow/security/dist/policy/engine.js.map +1 -1
- package/node_modules/@claude-flow/security/dist/policy/types.d.ts +14 -1
- package/node_modules/@claude-flow/security/dist/policy/types.d.ts.map +1 -1
- package/node_modules/@claude-flow/security/dist/policy/types.js +3 -1
- package/node_modules/@claude-flow/security/dist/policy/types.js.map +1 -1
- package/package.json +2 -2
- package/v3/@claude-flow/cli/README.md +164 -62
- package/v3/@claude-flow/cli/catalog-manifest.json +5 -5
- package/v3/@claude-flow/cli/dist/src/autopilot-state.d.ts +2 -0
- package/v3/@claude-flow/cli/dist/src/autopilot-state.js +36 -8
- package/v3/@claude-flow/cli/dist/src/command-resolution.d.ts +15 -0
- package/v3/@claude-flow/cli/dist/src/command-resolution.js +25 -0
- package/v3/@claude-flow/cli/dist/src/commands/agent.js +17 -17
- package/v3/@claude-flow/cli/dist/src/commands/claims.js +6 -8
- package/v3/@claude-flow/cli/dist/src/commands/daemon.js +94 -33
- package/v3/@claude-flow/cli/dist/src/commands/doctor.js +95 -18
- package/v3/@claude-flow/cli/dist/src/commands/memory.js +14 -2
- package/v3/@claude-flow/cli/dist/src/commands/policy.js +6 -1
- package/v3/@claude-flow/cli/dist/src/commands/security-code-patterns.d.ts +2 -2
- package/v3/@claude-flow/cli/dist/src/commands/security-code-patterns.js +61 -3
- package/v3/@claude-flow/cli/dist/src/commands/security.d.ts +24 -0
- package/v3/@claude-flow/cli/dist/src/commands/security.js +81 -35
- package/v3/@claude-flow/cli/dist/src/commands/tui.d.ts +9 -0
- package/v3/@claude-flow/cli/dist/src/commands/tui.js +29 -3
- package/v3/@claude-flow/cli/dist/src/config/proven-config-refresh.d.ts +9 -0
- package/v3/@claude-flow/cli/dist/src/config/proven-config-refresh.js +24 -3
- package/v3/@claude-flow/cli/dist/src/funnel/local-signals.js +2 -1
- package/v3/@claude-flow/cli/dist/src/index.js +11 -47
- package/v3/@claude-flow/cli/dist/src/init/settings-generator.js +4 -58
- package/v3/@claude-flow/cli/dist/src/init/types.js +1 -1
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-execute-core.d.ts +2 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-execute-core.js +15 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-health-metrics.d.ts +22 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-health-metrics.js +33 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-tools.js +45 -22
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agentbbs-federation.d.ts +1 -1
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agentbbs-federation.js +7 -2
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.js +25 -2
- package/v3/@claude-flow/cli/dist/src/mcp-tools/aidefence-known-misses.d.ts +22 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/aidefence-known-misses.js +57 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/analyze-tools.js +10 -11
- package/v3/@claude-flow/cli/dist/src/mcp-tools/autopilot-tools.js +2 -2
- package/v3/@claude-flow/cli/dist/src/mcp-tools/browser-intent-tools.js +6 -2
- package/v3/@claude-flow/cli/dist/src/mcp-tools/embeddings-tools.js +29 -7
- package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +4 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.d.ts +1 -1
- package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +100 -25
- package/v3/@claude-flow/cli/dist/src/mcp-tools/metaharness-tools.js +1 -1
- package/v3/@claude-flow/cli/dist/src/mcp-tools/neural-tools.js +48 -54
- package/v3/@claude-flow/cli/dist/src/mcp-tools/policy-tools.js +5 -3
- package/v3/@claude-flow/cli/dist/src/mcp-tools/ruvllm-tools.js +6 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/security-tools.js +55 -17
- package/v3/@claude-flow/cli/dist/src/mcp-tools/workflow-tools.js +66 -17
- package/v3/@claude-flow/cli/dist/src/memory/intelligence.d.ts +5 -1
- package/v3/@claude-flow/cli/dist/src/memory/intelligence.js +158 -35
- package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.js +10 -3
- package/v3/@claude-flow/cli/dist/src/memory/memory-initializer.js +2 -1
- package/v3/@claude-flow/cli/dist/src/memory/search-defaults.d.ts +54 -0
- package/v3/@claude-flow/cli/dist/src/memory/search-defaults.js +37 -0
- package/v3/@claude-flow/cli/dist/src/memory/sona-optimizer.d.ts +28 -0
- package/v3/@claude-flow/cli/dist/src/memory/sona-optimizer.js +59 -2
- package/v3/@claude-flow/cli/dist/src/memory/stats-file-lock.d.ts +7 -0
- package/v3/@claude-flow/cli/dist/src/memory/stats-file-lock.js +53 -0
- package/v3/@claude-flow/cli/dist/src/mods/command-registry/schema.d.ts +24 -24
- package/v3/@claude-flow/cli/dist/src/ruvector/agent-wasm.d.ts +10 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/agent-wasm.js +27 -1
- package/v3/@claude-flow/cli/dist/src/ruvector/diff-classifier.d.ts +2 -4
- package/v3/@claude-flow/cli/dist/src/ruvector/diff-classifier.js +202 -69
- package/v3/@claude-flow/cli/dist/src/ruvector/ruvllm-wasm.d.ts +4 -0
- package/v3/@claude-flow/cli/dist/src/ruvector/ruvllm-wasm.js +12 -1
- package/v3/@claude-flow/cli/dist/src/services/distill-oracle.d.ts +1 -1
- package/v3/@claude-flow/cli/dist/src/services/distill-oracle.js +2 -2
- package/v3/@claude-flow/cli/dist/src/services/policy-anchor-log.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/services/policy-anchor-log.js +242 -0
- package/v3/@claude-flow/cli/dist/src/services/policy-archive-scan.d.ts +7 -0
- package/v3/@claude-flow/cli/dist/src/services/policy-archive-scan.js +50 -0
- package/v3/@claude-flow/cli/dist/src/services/policy-ledger-anchor.d.ts +14 -8
- package/v3/@claude-flow/cli/dist/src/services/policy-ledger-anchor.js +356 -40
- package/v3/@claude-flow/cli/dist/src/services/policy-ledger-audit.d.ts +22 -0
- package/v3/@claude-flow/cli/dist/src/services/policy-ledger-audit.js +260 -0
- package/v3/@claude-flow/cli/dist/src/services/policy-ledger-record.d.ts +3 -0
- package/v3/@claude-flow/cli/dist/src/services/policy-ledger-record.js +22 -0
- package/v3/@claude-flow/cli/dist/src/services/policy-runtime.d.ts +2 -1
- package/v3/@claude-flow/cli/dist/src/services/policy-runtime.js +267 -40
- 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 +37 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/discovery.js +16 -17
- package/v3/@claude-flow/cli/dist/src/transfer/store/types.d.ts +4 -0
- package/v3/@claude-flow/cli/package.json +5 -5
|
@@ -93,6 +93,8 @@ export interface SONAStats {
|
|
|
93
93
|
agents: number;
|
|
94
94
|
} | 'unavailable';
|
|
95
95
|
}
|
|
96
|
+
/** The routing gate in getRoutingSuggestion: confidence x matchRatio must reach this for a learned pattern to be used. */
|
|
97
|
+
export declare const SONA_ROUTING_GATE = 0.6;
|
|
96
98
|
/** Agent roles supported by the SONA routing optimizer. */
|
|
97
99
|
export declare function isSupportedSonaAgent(agent: string): boolean;
|
|
98
100
|
/**
|
|
@@ -101,6 +103,17 @@ export declare function isSupportedSonaAgent(agent: string): boolean;
|
|
|
101
103
|
* Learns from past task outcomes to improve future routing decisions.
|
|
102
104
|
* Integrates with Q-learning router for hybrid routing strategy.
|
|
103
105
|
*/
|
|
106
|
+
/**
|
|
107
|
+
* How close a pattern's confidence is to the routing gate. `successesNeeded`
|
|
108
|
+
* assumes a perfect keyword match (matchRatio 1) and the 0.1 success increment;
|
|
109
|
+
* a partial match needs more.
|
|
110
|
+
*/
|
|
111
|
+
export declare function routingGateStatus(confidence: number): {
|
|
112
|
+
threshold: number;
|
|
113
|
+
confidence: number;
|
|
114
|
+
reached: boolean;
|
|
115
|
+
successesNeeded: number;
|
|
116
|
+
};
|
|
104
117
|
export declare class SONAOptimizer {
|
|
105
118
|
private patterns;
|
|
106
119
|
private trajectoriesProcessed;
|
|
@@ -140,6 +153,15 @@ export declare class SONAOptimizer {
|
|
|
140
153
|
patternKey: string;
|
|
141
154
|
confidence: number;
|
|
142
155
|
keywordsExtracted: string[];
|
|
156
|
+
/** True when this trajectory reinforced an existing near-identical pattern instead of creating a new one (#4134). */
|
|
157
|
+
reinforcedNeighbour?: boolean;
|
|
158
|
+
/** How far the pattern is from influencing routing, so a user can see learning has not kicked in yet (#4134). */
|
|
159
|
+
routingGate?: {
|
|
160
|
+
threshold: number;
|
|
161
|
+
confidence: number;
|
|
162
|
+
reached: boolean;
|
|
163
|
+
successesNeeded: number;
|
|
164
|
+
};
|
|
143
165
|
};
|
|
144
166
|
/**
|
|
145
167
|
* Get routing suggestion based on learned patterns.
|
|
@@ -202,6 +224,12 @@ export declare class SONAOptimizer {
|
|
|
202
224
|
* Create a unique pattern key from keywords and agent
|
|
203
225
|
*/
|
|
204
226
|
private createPatternKey;
|
|
227
|
+
/**
|
|
228
|
+
* The key of the existing pattern for `agent` whose keyword set overlaps
|
|
229
|
+
* `keywords` the most, if that overlap (Jaccard) reaches NEIGHBOUR_MIN_JACCARD.
|
|
230
|
+
* Ties go to the more confident pattern. Linear in the pattern count (<= 1000).
|
|
231
|
+
*/
|
|
232
|
+
private findNeighbourPattern;
|
|
205
233
|
/**
|
|
206
234
|
* Find the best matching pattern for given keywords
|
|
207
235
|
*/
|
|
@@ -26,6 +26,10 @@ const CONFIDENCE_INCREMENT = 0.1;
|
|
|
26
26
|
const CONFIDENCE_DECREMENT = 0.15;
|
|
27
27
|
const DECAY_RATE = 0.01; // Per day
|
|
28
28
|
const MAX_PATTERNS = 1000;
|
|
29
|
+
/** #4134: a trajectory reinforces an existing pattern of the same agent whose keyword set overlaps at least this much (Jaccard). */
|
|
30
|
+
const NEIGHBOUR_MIN_JACCARD = 0.6;
|
|
31
|
+
/** The routing gate in getRoutingSuggestion: confidence x matchRatio must reach this for a learned pattern to be used. */
|
|
32
|
+
export const SONA_ROUTING_GATE = 0.6;
|
|
29
33
|
// ============================================================================
|
|
30
34
|
// Contrastive Trainer (lazy-loaded from @ruvector/ruvllm)
|
|
31
35
|
// ============================================================================
|
|
@@ -119,6 +123,18 @@ const KEYWORD_CATEGORIES = {
|
|
|
119
123
|
* Learns from past task outcomes to improve future routing decisions.
|
|
120
124
|
* Integrates with Q-learning router for hybrid routing strategy.
|
|
121
125
|
*/
|
|
126
|
+
/**
|
|
127
|
+
* How close a pattern's confidence is to the routing gate. `successesNeeded`
|
|
128
|
+
* assumes a perfect keyword match (matchRatio 1) and the 0.1 success increment;
|
|
129
|
+
* a partial match needs more.
|
|
130
|
+
*/
|
|
131
|
+
export function routingGateStatus(confidence) {
|
|
132
|
+
const reached = confidence >= SONA_ROUTING_GATE;
|
|
133
|
+
const successesNeeded = reached || confidence >= MAX_CONFIDENCE
|
|
134
|
+
? 0
|
|
135
|
+
: Math.ceil(Math.log((1 - SONA_ROUTING_GATE) / (1 - confidence)) / Math.log(1 - CONFIDENCE_INCREMENT));
|
|
136
|
+
return { threshold: SONA_ROUTING_GATE, confidence, reached, successesNeeded };
|
|
137
|
+
}
|
|
122
138
|
export class SONAOptimizer {
|
|
123
139
|
patterns = new Map();
|
|
124
140
|
trajectoriesProcessed = 0;
|
|
@@ -210,7 +226,18 @@ export class SONAOptimizer {
|
|
|
210
226
|
};
|
|
211
227
|
}
|
|
212
228
|
// Create pattern key from sorted keywords
|
|
213
|
-
|
|
229
|
+
let patternKey = this.createPatternKey(keywords, agent);
|
|
230
|
+
// #4134: near-identical tasks ("Verify the X plugin ..." / "Verify the Y plugin ...")
|
|
231
|
+
// used to create a separate pattern each at confidence 0.5, so none ever reached
|
|
232
|
+
// the routing gate. Reinforce the closest existing pattern of the same agent instead.
|
|
233
|
+
let reinforcedNeighbour = false;
|
|
234
|
+
if (!this.patterns.has(patternKey)) {
|
|
235
|
+
const neighbour = this.findNeighbourPattern(keywords, agent);
|
|
236
|
+
if (neighbour) {
|
|
237
|
+
patternKey = neighbour;
|
|
238
|
+
reinforcedNeighbour = true;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
214
241
|
// Get or create pattern
|
|
215
242
|
let pattern = this.patterns.get(patternKey);
|
|
216
243
|
if (!pattern) {
|
|
@@ -264,6 +291,8 @@ export class SONAOptimizer {
|
|
|
264
291
|
patternKey,
|
|
265
292
|
confidence: pattern.confidence,
|
|
266
293
|
keywordsExtracted: keywords,
|
|
294
|
+
reinforcedNeighbour,
|
|
295
|
+
routingGate: routingGateStatus(pattern.confidence),
|
|
267
296
|
};
|
|
268
297
|
}
|
|
269
298
|
/**
|
|
@@ -305,7 +334,7 @@ export class SONAOptimizer {
|
|
|
305
334
|
const keywords = this.extractKeywords(task);
|
|
306
335
|
// Priority 2: Try SONA learned pattern matching
|
|
307
336
|
const sonaResult = this.findBestPatternMatch(keywords);
|
|
308
|
-
if (sonaResult && sonaResult.confidence >=
|
|
337
|
+
if (sonaResult && sonaResult.confidence >= SONA_ROUTING_GATE) {
|
|
309
338
|
return {
|
|
310
339
|
agent: sonaResult.agent,
|
|
311
340
|
confidence: sonaResult.confidence,
|
|
@@ -532,6 +561,34 @@ export class SONAOptimizer {
|
|
|
532
561
|
const sortedKeywords = [...keywords].sort();
|
|
533
562
|
return `${agent}:${sortedKeywords.join('+')}`;
|
|
534
563
|
}
|
|
564
|
+
/**
|
|
565
|
+
* The key of the existing pattern for `agent` whose keyword set overlaps
|
|
566
|
+
* `keywords` the most, if that overlap (Jaccard) reaches NEIGHBOUR_MIN_JACCARD.
|
|
567
|
+
* Ties go to the more confident pattern. Linear in the pattern count (<= 1000).
|
|
568
|
+
*/
|
|
569
|
+
findNeighbourPattern(keywords, agent) {
|
|
570
|
+
const wanted = new Set(keywords);
|
|
571
|
+
let bestKey = null;
|
|
572
|
+
let bestJaccard = 0;
|
|
573
|
+
let bestConfidence = -1;
|
|
574
|
+
for (const [key, pattern] of this.patterns) {
|
|
575
|
+
if (pattern.agent !== agent)
|
|
576
|
+
continue;
|
|
577
|
+
let shared = 0;
|
|
578
|
+
for (const k of pattern.keywords)
|
|
579
|
+
if (wanted.has(k))
|
|
580
|
+
shared++;
|
|
581
|
+
const union = wanted.size + pattern.keywords.length - shared;
|
|
582
|
+
const jaccard = union === 0 ? 0 : shared / union;
|
|
583
|
+
if (jaccard >= NEIGHBOUR_MIN_JACCARD &&
|
|
584
|
+
(jaccard > bestJaccard || (jaccard === bestJaccard && pattern.confidence > bestConfidence))) {
|
|
585
|
+
bestKey = key;
|
|
586
|
+
bestJaccard = jaccard;
|
|
587
|
+
bestConfidence = pattern.confidence;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
return bestKey;
|
|
591
|
+
}
|
|
535
592
|
/**
|
|
536
593
|
* Find the best matching pattern for given keywords
|
|
537
594
|
*/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialize cooperating local writers without stealing a paused writer's lock.
|
|
3
|
+
* Abnormal termination can leave an orphan: recovery requires confirming that
|
|
4
|
+
* no writer still owns the directory before removing it. Never age-reap it.
|
|
5
|
+
*/
|
|
6
|
+
export declare function withStatsFileLock<T>(file: string, write: (canonicalFile: string) => T): T;
|
|
7
|
+
//# sourceMappingURL=stats-file-lock.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { mkdirSync, realpathSync, rmdirSync } from 'node:fs';
|
|
2
|
+
import { basename, dirname, join } from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* Serialize cooperating local writers without stealing a paused writer's lock.
|
|
5
|
+
* Abnormal termination can leave an orphan: recovery requires confirming that
|
|
6
|
+
* no writer still owns the directory before removing it. Never age-reap it.
|
|
7
|
+
*/
|
|
8
|
+
export function withStatsFileLock(file, write) {
|
|
9
|
+
const canonicalFile = join(realpathSync(dirname(file)), basename(file));
|
|
10
|
+
const lock = `${canonicalFile}.lock`;
|
|
11
|
+
const deadline = performance.now() + 1000;
|
|
12
|
+
const sleeper = new Int32Array(new SharedArrayBuffer(4));
|
|
13
|
+
for (;;) {
|
|
14
|
+
try {
|
|
15
|
+
mkdirSync(lock, { mode: 0o700 });
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
if (error.code !== 'EEXIST')
|
|
20
|
+
throw error;
|
|
21
|
+
const remaining = deadline - performance.now();
|
|
22
|
+
if (remaining <= 0) {
|
|
23
|
+
throw Object.assign(new Error('Learning stats lock is busy'), { code: 'ELOCKED', path: lock });
|
|
24
|
+
}
|
|
25
|
+
Atomics.wait(sleeper, 0, 0, Math.min(10, remaining));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const cleanup = () => {
|
|
29
|
+
// Only remove our empty directory. Never recursively remove foreign data.
|
|
30
|
+
rmdirSync(lock);
|
|
31
|
+
};
|
|
32
|
+
const onExit = () => {
|
|
33
|
+
try {
|
|
34
|
+
cleanup();
|
|
35
|
+
}
|
|
36
|
+
catch { /* abnormal exits may require deliberate recovery */ }
|
|
37
|
+
};
|
|
38
|
+
process.once('exit', onExit);
|
|
39
|
+
try {
|
|
40
|
+
return write(canonicalFile);
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
process.removeListener('exit', onExit);
|
|
44
|
+
try {
|
|
45
|
+
cleanup();
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
const code = error.code || 'UNKNOWN';
|
|
49
|
+
console.warn(`[intelligence] Could not release learning stats lock at ${lock} (${code}); verify ownership before recovery`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=stats-file-lock.js.map
|
|
@@ -63,19 +63,19 @@ export declare const commandDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
63
63
|
path: z.ZodString;
|
|
64
64
|
}, "strict", z.ZodTypeAny, {
|
|
65
65
|
path: string;
|
|
66
|
-
commit: string;
|
|
67
66
|
repository: string;
|
|
67
|
+
commit: string;
|
|
68
68
|
}, {
|
|
69
69
|
path: string;
|
|
70
|
-
commit: string;
|
|
71
70
|
repository: string;
|
|
71
|
+
commit: string;
|
|
72
72
|
}>;
|
|
73
73
|
}, "strict", z.ZodTypeAny, {
|
|
74
74
|
id: string;
|
|
75
75
|
source: {
|
|
76
76
|
path: string;
|
|
77
|
-
commit: string;
|
|
78
77
|
repository: string;
|
|
78
|
+
commit: string;
|
|
79
79
|
};
|
|
80
80
|
schemaVersion: 1;
|
|
81
81
|
kind: "help" | "query" | "prompt" | "workflow" | "mutation";
|
|
@@ -100,8 +100,8 @@ export declare const commandDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
100
100
|
id: string;
|
|
101
101
|
source: {
|
|
102
102
|
path: string;
|
|
103
|
-
commit: string;
|
|
104
103
|
repository: string;
|
|
104
|
+
commit: string;
|
|
105
105
|
};
|
|
106
106
|
schemaVersion: 1;
|
|
107
107
|
kind: "help" | "query" | "prompt" | "workflow" | "mutation";
|
|
@@ -126,8 +126,8 @@ export declare const commandDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
126
126
|
id: string;
|
|
127
127
|
source: {
|
|
128
128
|
path: string;
|
|
129
|
-
commit: string;
|
|
130
129
|
repository: string;
|
|
130
|
+
commit: string;
|
|
131
131
|
};
|
|
132
132
|
schemaVersion: 1;
|
|
133
133
|
kind: "help" | "query" | "prompt" | "workflow" | "mutation";
|
|
@@ -152,8 +152,8 @@ export declare const commandDefinitionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
152
152
|
id: string;
|
|
153
153
|
source: {
|
|
154
154
|
path: string;
|
|
155
|
-
commit: string;
|
|
156
155
|
repository: string;
|
|
156
|
+
commit: string;
|
|
157
157
|
};
|
|
158
158
|
schemaVersion: 1;
|
|
159
159
|
kind: "help" | "query" | "prompt" | "workflow" | "mutation";
|
|
@@ -244,19 +244,19 @@ export declare const catalogEntrySchema: z.ZodObject<{
|
|
|
244
244
|
path: z.ZodString;
|
|
245
245
|
}, "strict", z.ZodTypeAny, {
|
|
246
246
|
path: string;
|
|
247
|
-
commit: string;
|
|
248
247
|
repository: string;
|
|
248
|
+
commit: string;
|
|
249
249
|
}, {
|
|
250
250
|
path: string;
|
|
251
|
-
commit: string;
|
|
252
251
|
repository: string;
|
|
252
|
+
commit: string;
|
|
253
253
|
}>;
|
|
254
254
|
}, "strict", z.ZodTypeAny, {
|
|
255
255
|
id: string;
|
|
256
256
|
source: {
|
|
257
257
|
path: string;
|
|
258
|
-
commit: string;
|
|
259
258
|
repository: string;
|
|
259
|
+
commit: string;
|
|
260
260
|
};
|
|
261
261
|
schemaVersion: 1;
|
|
262
262
|
kind: "help" | "query" | "prompt" | "workflow" | "mutation";
|
|
@@ -281,8 +281,8 @@ export declare const catalogEntrySchema: z.ZodObject<{
|
|
|
281
281
|
id: string;
|
|
282
282
|
source: {
|
|
283
283
|
path: string;
|
|
284
|
-
commit: string;
|
|
285
284
|
repository: string;
|
|
285
|
+
commit: string;
|
|
286
286
|
};
|
|
287
287
|
schemaVersion: 1;
|
|
288
288
|
kind: "help" | "query" | "prompt" | "workflow" | "mutation";
|
|
@@ -307,8 +307,8 @@ export declare const catalogEntrySchema: z.ZodObject<{
|
|
|
307
307
|
id: string;
|
|
308
308
|
source: {
|
|
309
309
|
path: string;
|
|
310
|
-
commit: string;
|
|
311
310
|
repository: string;
|
|
311
|
+
commit: string;
|
|
312
312
|
};
|
|
313
313
|
schemaVersion: 1;
|
|
314
314
|
kind: "help" | "query" | "prompt" | "workflow" | "mutation";
|
|
@@ -333,8 +333,8 @@ export declare const catalogEntrySchema: z.ZodObject<{
|
|
|
333
333
|
id: string;
|
|
334
334
|
source: {
|
|
335
335
|
path: string;
|
|
336
|
-
commit: string;
|
|
337
336
|
repository: string;
|
|
337
|
+
commit: string;
|
|
338
338
|
};
|
|
339
339
|
schemaVersion: 1;
|
|
340
340
|
kind: "help" | "query" | "prompt" | "workflow" | "mutation";
|
|
@@ -404,8 +404,8 @@ export declare const catalogEntrySchema: z.ZodObject<{
|
|
|
404
404
|
id: string;
|
|
405
405
|
source: {
|
|
406
406
|
path: string;
|
|
407
|
-
commit: string;
|
|
408
407
|
repository: string;
|
|
408
|
+
commit: string;
|
|
409
409
|
};
|
|
410
410
|
schemaVersion: 1;
|
|
411
411
|
kind: "help" | "query" | "prompt" | "workflow" | "mutation";
|
|
@@ -445,8 +445,8 @@ export declare const catalogEntrySchema: z.ZodObject<{
|
|
|
445
445
|
id: string;
|
|
446
446
|
source: {
|
|
447
447
|
path: string;
|
|
448
|
-
commit: string;
|
|
449
448
|
repository: string;
|
|
449
|
+
commit: string;
|
|
450
450
|
};
|
|
451
451
|
schemaVersion: 1;
|
|
452
452
|
kind: "help" | "query" | "prompt" | "workflow" | "mutation";
|
|
@@ -510,19 +510,19 @@ export declare const commandCatalogSchema: z.ZodObject<{
|
|
|
510
510
|
path: z.ZodString;
|
|
511
511
|
}, "strict", z.ZodTypeAny, {
|
|
512
512
|
path: string;
|
|
513
|
-
commit: string;
|
|
514
513
|
repository: string;
|
|
514
|
+
commit: string;
|
|
515
515
|
}, {
|
|
516
516
|
path: string;
|
|
517
|
-
commit: string;
|
|
518
517
|
repository: string;
|
|
518
|
+
commit: string;
|
|
519
519
|
}>;
|
|
520
520
|
}, "strict", z.ZodTypeAny, {
|
|
521
521
|
id: string;
|
|
522
522
|
source: {
|
|
523
523
|
path: string;
|
|
524
|
-
commit: string;
|
|
525
524
|
repository: string;
|
|
525
|
+
commit: string;
|
|
526
526
|
};
|
|
527
527
|
schemaVersion: 1;
|
|
528
528
|
kind: "help" | "query" | "prompt" | "workflow" | "mutation";
|
|
@@ -547,8 +547,8 @@ export declare const commandCatalogSchema: z.ZodObject<{
|
|
|
547
547
|
id: string;
|
|
548
548
|
source: {
|
|
549
549
|
path: string;
|
|
550
|
-
commit: string;
|
|
551
550
|
repository: string;
|
|
551
|
+
commit: string;
|
|
552
552
|
};
|
|
553
553
|
schemaVersion: 1;
|
|
554
554
|
kind: "help" | "query" | "prompt" | "workflow" | "mutation";
|
|
@@ -573,8 +573,8 @@ export declare const commandCatalogSchema: z.ZodObject<{
|
|
|
573
573
|
id: string;
|
|
574
574
|
source: {
|
|
575
575
|
path: string;
|
|
576
|
-
commit: string;
|
|
577
576
|
repository: string;
|
|
577
|
+
commit: string;
|
|
578
578
|
};
|
|
579
579
|
schemaVersion: 1;
|
|
580
580
|
kind: "help" | "query" | "prompt" | "workflow" | "mutation";
|
|
@@ -599,8 +599,8 @@ export declare const commandCatalogSchema: z.ZodObject<{
|
|
|
599
599
|
id: string;
|
|
600
600
|
source: {
|
|
601
601
|
path: string;
|
|
602
|
-
commit: string;
|
|
603
602
|
repository: string;
|
|
603
|
+
commit: string;
|
|
604
604
|
};
|
|
605
605
|
schemaVersion: 1;
|
|
606
606
|
kind: "help" | "query" | "prompt" | "workflow" | "mutation";
|
|
@@ -670,8 +670,8 @@ export declare const commandCatalogSchema: z.ZodObject<{
|
|
|
670
670
|
id: string;
|
|
671
671
|
source: {
|
|
672
672
|
path: string;
|
|
673
|
-
commit: string;
|
|
674
673
|
repository: string;
|
|
674
|
+
commit: string;
|
|
675
675
|
};
|
|
676
676
|
schemaVersion: 1;
|
|
677
677
|
kind: "help" | "query" | "prompt" | "workflow" | "mutation";
|
|
@@ -711,8 +711,8 @@ export declare const commandCatalogSchema: z.ZodObject<{
|
|
|
711
711
|
id: string;
|
|
712
712
|
source: {
|
|
713
713
|
path: string;
|
|
714
|
-
commit: string;
|
|
715
714
|
repository: string;
|
|
715
|
+
commit: string;
|
|
716
716
|
};
|
|
717
717
|
schemaVersion: 1;
|
|
718
718
|
kind: "help" | "query" | "prompt" | "workflow" | "mutation";
|
|
@@ -754,8 +754,8 @@ export declare const commandCatalogSchema: z.ZodObject<{
|
|
|
754
754
|
id: string;
|
|
755
755
|
source: {
|
|
756
756
|
path: string;
|
|
757
|
-
commit: string;
|
|
758
757
|
repository: string;
|
|
758
|
+
commit: string;
|
|
759
759
|
};
|
|
760
760
|
schemaVersion: 1;
|
|
761
761
|
kind: "help" | "query" | "prompt" | "workflow" | "mutation";
|
|
@@ -800,8 +800,8 @@ export declare const commandCatalogSchema: z.ZodObject<{
|
|
|
800
800
|
id: string;
|
|
801
801
|
source: {
|
|
802
802
|
path: string;
|
|
803
|
-
commit: string;
|
|
804
803
|
repository: string;
|
|
804
|
+
commit: string;
|
|
805
805
|
};
|
|
806
806
|
schemaVersion: 1;
|
|
807
807
|
kind: "help" | "query" | "prompt" | "workflow" | "mutation";
|
|
@@ -70,6 +70,16 @@ export interface ToolResult {
|
|
|
70
70
|
success: boolean;
|
|
71
71
|
output: string;
|
|
72
72
|
}
|
|
73
|
+
/** Shown wherever the optional @ruvector/rvagent-wasm package cannot be loaded. */
|
|
74
|
+
export declare const AGENT_WASM_NOT_INSTALLED_MESSAGE: string;
|
|
75
|
+
/**
|
|
76
|
+
* True when err is the module-resolution failure for @ruvector/rvagent-wasm itself.
|
|
77
|
+
* Decided by the error code OR its text, because wrappers (loaders, test harnesses)
|
|
78
|
+
* can drop `code` while keeping the message.
|
|
79
|
+
*/
|
|
80
|
+
export declare function isMissingAgentWasm(err: unknown): boolean;
|
|
81
|
+
/** The error initAgentWasm() throws for a load failure: "not installed" with the fix, or a genuine init failure. */
|
|
82
|
+
export declare function agentWasmLoadError(err: unknown): Error;
|
|
73
83
|
/**
|
|
74
84
|
* Check if @ruvector/rvagent-wasm is installed and loadable.
|
|
75
85
|
*/
|
|
@@ -14,6 +14,30 @@ import { readFileSync } from 'node:fs';
|
|
|
14
14
|
import { createRequire } from 'node:module';
|
|
15
15
|
// ── WASM Module Detection & Init ─────────────────────────────
|
|
16
16
|
let _wasmReady = false;
|
|
17
|
+
/** Shown wherever the optional @ruvector/rvagent-wasm package cannot be loaded. */
|
|
18
|
+
export const AGENT_WASM_NOT_INSTALLED_MESSAGE = '@ruvector/rvagent-wasm is not installed.\n' +
|
|
19
|
+
'Install it with: npm install @ruvector/rvagent-wasm (or npm install -g @ruvector/rvagent-wasm for a global ruflo)';
|
|
20
|
+
/**
|
|
21
|
+
* True when err is the module-resolution failure for @ruvector/rvagent-wasm itself.
|
|
22
|
+
* Decided by the error code OR its text, because wrappers (loaders, test harnesses)
|
|
23
|
+
* can drop `code` while keeping the message.
|
|
24
|
+
*/
|
|
25
|
+
export function isMissingAgentWasm(err) {
|
|
26
|
+
const e = err;
|
|
27
|
+
const code = typeof e?.code === 'string' ? e.code : '';
|
|
28
|
+
const message = typeof e?.message === 'string' ? e.message : String(err);
|
|
29
|
+
if (!message.includes('@ruvector/rvagent-wasm'))
|
|
30
|
+
return false;
|
|
31
|
+
return (code === 'ERR_MODULE_NOT_FOUND' ||
|
|
32
|
+
code === 'MODULE_NOT_FOUND' ||
|
|
33
|
+
/ERR_MODULE_NOT_FOUND|MODULE_NOT_FOUND|Cannot find (package|module)/.test(message));
|
|
34
|
+
}
|
|
35
|
+
/** The error initAgentWasm() throws for a load failure: "not installed" with the fix, or a genuine init failure. */
|
|
36
|
+
export function agentWasmLoadError(err) {
|
|
37
|
+
return isMissingAgentWasm(err)
|
|
38
|
+
? new Error(AGENT_WASM_NOT_INSTALLED_MESSAGE)
|
|
39
|
+
: new Error(`Failed to initialize @ruvector/rvagent-wasm: ${err}`);
|
|
40
|
+
}
|
|
17
41
|
/**
|
|
18
42
|
* Check if @ruvector/rvagent-wasm is installed and loadable.
|
|
19
43
|
*/
|
|
@@ -43,7 +67,9 @@ export async function initAgentWasm() {
|
|
|
43
67
|
_wasmReady = true;
|
|
44
68
|
}
|
|
45
69
|
catch (err) {
|
|
46
|
-
|
|
70
|
+
// #3979 item 1: a missing optional package is "not installed", with the fix,
|
|
71
|
+
// not a raw ERR_MODULE_NOT_FOUND trace dressed up as an initialization failure.
|
|
72
|
+
throw agentWasmLoadError(err);
|
|
47
73
|
}
|
|
48
74
|
}
|
|
49
75
|
// ── Agent Registry ───────────────────────────────────────────
|
|
@@ -145,10 +145,8 @@ export declare function assessFileRisk(file: DiffFile): FileRisk;
|
|
|
145
145
|
* Assess overall risk from files and file risks
|
|
146
146
|
*/
|
|
147
147
|
export declare function assessOverallRisk(files: DiffFile[], fileRisks: FileRisk[]): OverallRisk;
|
|
148
|
-
/**
|
|
149
|
-
|
|
150
|
-
*/
|
|
151
|
-
export declare function classifyDiff(files: DiffFile[]): DiffClassification;
|
|
148
|
+
/** Classify file metadata with the actual patch and, for one-commit ranges, its subject. */
|
|
149
|
+
export declare function classifyDiff(files: DiffFile[], patch?: string, commitSubject?: string): DiffClassification;
|
|
152
150
|
/**
|
|
153
151
|
* Suggest reviewers based on files and risks
|
|
154
152
|
*/
|