claude-flow 3.5.69 → 3.5.71
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/commands/autopilot.js +1 -1
- package/v3/@claude-flow/cli/dist/src/commands/hooks.js +4 -7
- package/v3/@claude-flow/cli/dist/src/commands/init.js +0 -1
- package/v3/@claude-flow/cli/dist/src/commands/neural.js +1 -0
- package/v3/@claude-flow/cli/dist/src/commands/providers.js +228 -96
- package/v3/@claude-flow/cli/dist/src/commands/security.js +1 -1
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agent-tools.js +35 -1
- package/v3/@claude-flow/cli/dist/src/mcp-tools/agentdb-tools.js +81 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/analyze-tools.js +29 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/autopilot-tools.js +4 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/browser-tools.js +146 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/claims-tools.js +116 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/config-tools.js +53 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/coordination-tools.js +31 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/daa-tools.js +61 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/embeddings-tools.js +26 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/github-tools.js +96 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/guidance-tools.js +21 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/hive-mind-tools.js +56 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +176 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/memory-tools.js +18 -2
- package/v3/@claude-flow/cli/dist/src/mcp-tools/neural-tools.js +51 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/performance-tools.js +11 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/ruvllm-tools.js +31 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/security-tools.js +36 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/session-tools.js +29 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/swarm-tools.js +30 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/system-tools.js +6 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/task-tools.js +33 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/terminal-tools.js +31 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/transfer-tools.js +51 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/wasm-agent-tools.js +61 -0
- package/v3/@claude-flow/cli/dist/src/mcp-tools/workflow-tools.js +82 -0
- package/v3/@claude-flow/cli/dist/src/memory/intelligence.d.ts +6 -1
- package/v3/@claude-flow/cli/dist/src/memory/intelligence.js +51 -1
- package/v3/@claude-flow/cli/package.json +1 -1
- package/v3/@claude-flow/guidance/dist/adversarial.d.ts +284 -0
- package/v3/@claude-flow/guidance/dist/adversarial.js +572 -0
- package/v3/@claude-flow/guidance/dist/analyzer.d.ts +530 -0
- package/v3/@claude-flow/guidance/dist/analyzer.js +2518 -0
- package/v3/@claude-flow/guidance/dist/artifacts.d.ts +283 -0
- package/v3/@claude-flow/guidance/dist/artifacts.js +356 -0
- package/v3/@claude-flow/guidance/dist/authority.d.ts +290 -0
- package/v3/@claude-flow/guidance/dist/authority.js +558 -0
- package/v3/@claude-flow/guidance/dist/capabilities.d.ts +209 -0
- package/v3/@claude-flow/guidance/dist/capabilities.js +485 -0
- package/v3/@claude-flow/guidance/dist/coherence.d.ts +233 -0
- package/v3/@claude-flow/guidance/dist/coherence.js +372 -0
- package/v3/@claude-flow/guidance/dist/compiler.d.ts +87 -0
- package/v3/@claude-flow/guidance/dist/compiler.js +419 -0
- package/v3/@claude-flow/guidance/dist/conformance-kit.d.ts +225 -0
- package/v3/@claude-flow/guidance/dist/conformance-kit.js +629 -0
- package/v3/@claude-flow/guidance/dist/continue-gate.d.ts +214 -0
- package/v3/@claude-flow/guidance/dist/continue-gate.js +353 -0
- package/v3/@claude-flow/guidance/dist/crypto-utils.d.ts +17 -0
- package/v3/@claude-flow/guidance/dist/crypto-utils.js +24 -0
- package/v3/@claude-flow/guidance/dist/evolution.d.ts +282 -0
- package/v3/@claude-flow/guidance/dist/evolution.js +500 -0
- package/v3/@claude-flow/guidance/dist/gates.d.ts +79 -0
- package/v3/@claude-flow/guidance/dist/gates.js +302 -0
- package/v3/@claude-flow/guidance/dist/gateway.d.ts +206 -0
- package/v3/@claude-flow/guidance/dist/gateway.js +452 -0
- package/v3/@claude-flow/guidance/dist/generators.d.ts +153 -0
- package/v3/@claude-flow/guidance/dist/generators.js +682 -0
- package/v3/@claude-flow/guidance/dist/headless.d.ts +177 -0
- package/v3/@claude-flow/guidance/dist/headless.js +342 -0
- package/v3/@claude-flow/guidance/dist/hooks.d.ts +109 -0
- package/v3/@claude-flow/guidance/dist/hooks.js +347 -0
- package/v3/@claude-flow/guidance/dist/index.d.ts +205 -0
- package/v3/@claude-flow/guidance/dist/index.js +321 -0
- package/v3/@claude-flow/guidance/dist/ledger.d.ts +162 -0
- package/v3/@claude-flow/guidance/dist/ledger.js +375 -0
- package/v3/@claude-flow/guidance/dist/manifest-validator.d.ts +289 -0
- package/v3/@claude-flow/guidance/dist/manifest-validator.js +838 -0
- package/v3/@claude-flow/guidance/dist/memory-gate.d.ts +222 -0
- package/v3/@claude-flow/guidance/dist/memory-gate.js +382 -0
- package/v3/@claude-flow/guidance/dist/meta-governance.d.ts +265 -0
- package/v3/@claude-flow/guidance/dist/meta-governance.js +348 -0
- package/v3/@claude-flow/guidance/dist/optimizer.d.ts +104 -0
- package/v3/@claude-flow/guidance/dist/optimizer.js +329 -0
- package/v3/@claude-flow/guidance/dist/persistence.d.ts +189 -0
- package/v3/@claude-flow/guidance/dist/persistence.js +464 -0
- package/v3/@claude-flow/guidance/dist/proof.d.ts +185 -0
- package/v3/@claude-flow/guidance/dist/proof.js +238 -0
- package/v3/@claude-flow/guidance/dist/retriever.d.ts +116 -0
- package/v3/@claude-flow/guidance/dist/retriever.js +394 -0
- package/v3/@claude-flow/guidance/dist/ruvbot-integration.d.ts +370 -0
- package/v3/@claude-flow/guidance/dist/ruvbot-integration.js +738 -0
- package/v3/@claude-flow/guidance/dist/temporal.d.ts +426 -0
- package/v3/@claude-flow/guidance/dist/temporal.js +658 -0
- package/v3/@claude-flow/guidance/dist/trust.d.ts +283 -0
- package/v3/@claude-flow/guidance/dist/trust.js +473 -0
- package/v3/@claude-flow/guidance/dist/truth-anchors.d.ts +276 -0
- package/v3/@claude-flow/guidance/dist/truth-anchors.js +488 -0
- package/v3/@claude-flow/guidance/dist/types.d.ts +378 -0
- package/v3/@claude-flow/guidance/dist/types.js +10 -0
- package/v3/@claude-flow/guidance/dist/uncertainty.d.ts +372 -0
- package/v3/@claude-flow/guidance/dist/uncertainty.js +619 -0
- package/v3/@claude-flow/guidance/dist/wasm-kernel.d.ts +48 -0
- package/v3/@claude-flow/guidance/dist/wasm-kernel.js +158 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WASM Kernel Host Bridge
|
|
3
|
+
*
|
|
4
|
+
* Layer B: Node host runtime that calls into the Rust WASM kernel (Layer A).
|
|
5
|
+
* All WASM calls go through this bridge. If the WASM module fails to load,
|
|
6
|
+
* the bridge transparently falls back to the JavaScript implementations.
|
|
7
|
+
*
|
|
8
|
+
* Key rule: The host calls the kernel once per event with a batch payload,
|
|
9
|
+
* not thousands of tiny calls.
|
|
10
|
+
*
|
|
11
|
+
* @module @claude-flow/guidance/wasm-kernel
|
|
12
|
+
*/
|
|
13
|
+
import { createHash, createHmac } from 'node:crypto';
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// WASM Loader
|
|
16
|
+
// ============================================================================
|
|
17
|
+
let wasmModule = null;
|
|
18
|
+
let loadAttempted = false;
|
|
19
|
+
function tryLoadWasm() {
|
|
20
|
+
if (loadAttempted)
|
|
21
|
+
return wasmModule;
|
|
22
|
+
loadAttempted = true;
|
|
23
|
+
try {
|
|
24
|
+
// Dynamic require — works in Node.js, gracefully fails elsewhere
|
|
25
|
+
const path = new URL('../wasm-pkg/guidance_kernel.js', import.meta.url);
|
|
26
|
+
// Use createRequire for ESM compatibility
|
|
27
|
+
const { createRequire } = require('node:module');
|
|
28
|
+
const requireFn = createRequire(import.meta.url);
|
|
29
|
+
wasmModule = requireFn(path.pathname);
|
|
30
|
+
// Initialize kernel
|
|
31
|
+
if (wasmModule && typeof wasmModule.kernel_init === 'function') {
|
|
32
|
+
wasmModule.kernel_init();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// WASM not available — fall back to JS
|
|
37
|
+
wasmModule = null;
|
|
38
|
+
}
|
|
39
|
+
return wasmModule;
|
|
40
|
+
}
|
|
41
|
+
// ============================================================================
|
|
42
|
+
// JS Fallback Implementations
|
|
43
|
+
// ============================================================================
|
|
44
|
+
function jsSha256(input) {
|
|
45
|
+
return createHash('sha256').update(input).digest('hex');
|
|
46
|
+
}
|
|
47
|
+
function jsHmacSha256(key, input) {
|
|
48
|
+
return createHmac('sha256', key).update(input).digest('hex');
|
|
49
|
+
}
|
|
50
|
+
function jsContentHash(jsonInput) {
|
|
51
|
+
try {
|
|
52
|
+
const parsed = JSON.parse(jsonInput);
|
|
53
|
+
const sorted = sortKeys(parsed);
|
|
54
|
+
return jsSha256(JSON.stringify(sorted));
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return jsSha256(jsonInput);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function sortKeys(value) {
|
|
61
|
+
if (value === null || typeof value !== 'object')
|
|
62
|
+
return value;
|
|
63
|
+
if (Array.isArray(value))
|
|
64
|
+
return value.map(sortKeys);
|
|
65
|
+
const sorted = {};
|
|
66
|
+
for (const key of Object.keys(value).sort()) {
|
|
67
|
+
sorted[key] = sortKeys(value[key]);
|
|
68
|
+
}
|
|
69
|
+
return sorted;
|
|
70
|
+
}
|
|
71
|
+
// ============================================================================
|
|
72
|
+
// Kernel singleton
|
|
73
|
+
// ============================================================================
|
|
74
|
+
let kernelInstance = null;
|
|
75
|
+
/**
|
|
76
|
+
* Get the WASM kernel instance. Automatically falls back to JS if WASM is
|
|
77
|
+
* unavailable. Thread-safe (single initialization).
|
|
78
|
+
*/
|
|
79
|
+
export function getKernel() {
|
|
80
|
+
if (kernelInstance)
|
|
81
|
+
return kernelInstance;
|
|
82
|
+
const wasm = tryLoadWasm();
|
|
83
|
+
if (wasm) {
|
|
84
|
+
kernelInstance = {
|
|
85
|
+
available: true,
|
|
86
|
+
version: wasm.kernel_init(),
|
|
87
|
+
sha256: (input) => wasm.sha256(input),
|
|
88
|
+
hmacSha256: (key, input) => wasm.hmac_sha256(key, input),
|
|
89
|
+
contentHash: (jsonInput) => wasm.content_hash(jsonInput),
|
|
90
|
+
signEnvelope: (key, envelopeJson) => wasm.sign_envelope(key, envelopeJson),
|
|
91
|
+
verifyChain: (chainJson, key) => wasm.verify_chain(chainJson, key),
|
|
92
|
+
scanSecrets: (content) => {
|
|
93
|
+
const json = wasm.scan_secrets(content);
|
|
94
|
+
try {
|
|
95
|
+
return JSON.parse(json);
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return [];
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
detectDestructive: (command) => {
|
|
102
|
+
const result = wasm.detect_destructive(command);
|
|
103
|
+
return result === '' ? null : result;
|
|
104
|
+
},
|
|
105
|
+
batchProcess: (ops) => {
|
|
106
|
+
const json = wasm.batch_process(JSON.stringify(ops));
|
|
107
|
+
try {
|
|
108
|
+
return JSON.parse(json);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
return [];
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
// JS fallback — identical outputs, just slower
|
|
118
|
+
kernelInstance = {
|
|
119
|
+
available: false,
|
|
120
|
+
version: 'js-fallback',
|
|
121
|
+
sha256: jsSha256,
|
|
122
|
+
hmacSha256: jsHmacSha256,
|
|
123
|
+
contentHash: jsContentHash,
|
|
124
|
+
signEnvelope: jsHmacSha256,
|
|
125
|
+
verifyChain: () => {
|
|
126
|
+
// Chain verification requires full envelope parsing — not implemented
|
|
127
|
+
// in JS fallback because the ProofChain class already does it.
|
|
128
|
+
throw new Error('verifyChain not available in JS fallback; use ProofChain.verifyChain()');
|
|
129
|
+
},
|
|
130
|
+
scanSecrets: () => {
|
|
131
|
+
// Gate scanning in JS fallback defers to EnforcementGates class
|
|
132
|
+
throw new Error('scanSecrets not available in JS fallback; use EnforcementGates');
|
|
133
|
+
},
|
|
134
|
+
detectDestructive: () => {
|
|
135
|
+
throw new Error('detectDestructive not available in JS fallback; use EnforcementGates');
|
|
136
|
+
},
|
|
137
|
+
batchProcess: () => {
|
|
138
|
+
throw new Error('batchProcess requires WASM kernel');
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
return kernelInstance;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Check if the WASM kernel is available without initializing it.
|
|
146
|
+
*/
|
|
147
|
+
export function isWasmAvailable() {
|
|
148
|
+
return getKernel().available;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Reset the kernel instance (for testing).
|
|
152
|
+
*/
|
|
153
|
+
export function resetKernel() {
|
|
154
|
+
kernelInstance = null;
|
|
155
|
+
wasmModule = null;
|
|
156
|
+
loadAttempted = false;
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=wasm-kernel.js.map
|