agentic-qe 3.7.10 → 3.7.12
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/skills/release/SKILL.md +44 -2
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +29 -0
- package/README.md +2 -1
- package/dist/agents/claim-verifier/verifiers/output-verifier.d.ts +1 -0
- package/dist/agents/claim-verifier/verifiers/output-verifier.d.ts.map +1 -1
- package/dist/agents/claim-verifier/verifiers/output-verifier.js +16 -3
- package/dist/agents/claim-verifier/verifiers/output-verifier.js.map +1 -1
- package/dist/cli/bundle.js +634 -203
- package/dist/domains/test-generation/services/pattern-matcher.js +1 -1
- package/dist/domains/test-generation/services/pattern-matcher.js.map +1 -1
- package/dist/domains/test-generation/services/test-generator.js +1 -1
- package/dist/domains/test-generation/services/test-generator.js.map +1 -1
- package/dist/governance/adversarial-defense-integration.d.ts +29 -0
- package/dist/governance/adversarial-defense-integration.d.ts.map +1 -1
- package/dist/governance/adversarial-defense-integration.js +85 -1
- package/dist/governance/adversarial-defense-integration.js.map +1 -1
- package/dist/governance/continue-gate-integration.d.ts +7 -5
- package/dist/governance/continue-gate-integration.d.ts.map +1 -1
- package/dist/governance/continue-gate-integration.js +72 -15
- package/dist/governance/continue-gate-integration.js.map +1 -1
- package/dist/governance/deterministic-gateway-integration.d.ts +5 -0
- package/dist/governance/deterministic-gateway-integration.d.ts.map +1 -1
- package/dist/governance/deterministic-gateway-integration.js +35 -1
- package/dist/governance/deterministic-gateway-integration.js.map +1 -1
- package/dist/governance/evolution-pipeline-integration.d.ts +5 -0
- package/dist/governance/evolution-pipeline-integration.d.ts.map +1 -1
- package/dist/governance/evolution-pipeline-integration.js +57 -1
- package/dist/governance/evolution-pipeline-integration.js.map +1 -1
- package/dist/governance/memory-write-gate-integration.d.ts +6 -3
- package/dist/governance/memory-write-gate-integration.d.ts.map +1 -1
- package/dist/governance/memory-write-gate-integration.js +48 -10
- package/dist/governance/memory-write-gate-integration.js.map +1 -1
- package/dist/governance/proof-envelope-integration.d.ts +1 -0
- package/dist/governance/proof-envelope-integration.d.ts.map +1 -1
- package/dist/governance/proof-envelope-integration.js +37 -0
- package/dist/governance/proof-envelope-integration.js.map +1 -1
- package/dist/governance/shard-retriever-integration.d.ts +10 -0
- package/dist/governance/shard-retriever-integration.d.ts.map +1 -1
- package/dist/governance/shard-retriever-integration.js +50 -1
- package/dist/governance/shard-retriever-integration.js.map +1 -1
- package/dist/governance/trust-accumulator-integration.d.ts +5 -0
- package/dist/governance/trust-accumulator-integration.d.ts.map +1 -1
- package/dist/governance/trust-accumulator-integration.js +35 -2
- package/dist/governance/trust-accumulator-integration.js.map +1 -1
- package/dist/mcp/bundle.js +642 -208
- package/dist/mcp/protocol-server.js +2 -2
- package/dist/mcp/tool-registry.d.ts.map +1 -1
- package/dist/mcp/tool-registry.js +1 -0
- package/dist/mcp/tool-registry.js.map +1 -1
- package/dist/shared/parsers/typescript-parser.d.ts +1 -1
- package/dist/shared/parsers/typescript-parser.d.ts.map +1 -1
- package/dist/shared/parsers/typescript-parser.js +1 -1
- package/dist/shared/parsers/typescript-parser.js.map +1 -1
- package/dist/shared/sql-safety.d.ts.map +1 -1
- package/dist/shared/sql-safety.js +7 -1
- package/dist/shared/sql-safety.js.map +1 -1
- package/package.json +6 -2
- package/scripts/build-cli.mjs +62 -11
- package/scripts/build-mcp.mjs +53 -11
package/dist/mcp/bundle.js
CHANGED
|
@@ -5956,12 +5956,20 @@ var init_sql_safety = __esm({
|
|
|
5956
5956
|
"coverage_sessions",
|
|
5957
5957
|
// Sync tables
|
|
5958
5958
|
"patterns",
|
|
5959
|
-
// Hypergraph tables
|
|
5959
|
+
// Hypergraph tables (actual table names from migration 20260120)
|
|
5960
|
+
"hypergraph_nodes",
|
|
5961
|
+
"hypergraph_edges",
|
|
5962
|
+
// Legacy allowlist aliases (hypergraph-schema.ts compat)
|
|
5960
5963
|
"hypergraph_vertices",
|
|
5961
5964
|
"hypergraph_hyperedges",
|
|
5962
5965
|
"hypergraph_edge_vertices",
|
|
5963
5966
|
"hypergraph_vertex_properties",
|
|
5964
|
-
"hypergraph_edge_properties"
|
|
5967
|
+
"hypergraph_edge_properties",
|
|
5968
|
+
// Learning experience tables
|
|
5969
|
+
"captured_experiences",
|
|
5970
|
+
"experience_applications",
|
|
5971
|
+
// Audit trail
|
|
5972
|
+
"witness_chain"
|
|
5965
5973
|
]);
|
|
5966
5974
|
}
|
|
5967
5975
|
});
|
|
@@ -7631,11 +7639,11 @@ function createLWWRegister(nodeId, initialValue, initialTimestamp) {
|
|
|
7631
7639
|
return state2.value;
|
|
7632
7640
|
},
|
|
7633
7641
|
set(value, timestamp) {
|
|
7634
|
-
const
|
|
7635
|
-
if (state2.timestamp === 0 || compareTimestamps(
|
|
7642
|
+
const ts = timestamp ?? Date.now();
|
|
7643
|
+
if (state2.timestamp === 0 || compareTimestamps(ts, nodeId, state2.timestamp, state2.nodeId) > 0) {
|
|
7636
7644
|
state2 = {
|
|
7637
7645
|
value,
|
|
7638
|
-
timestamp:
|
|
7646
|
+
timestamp: ts,
|
|
7639
7647
|
nodeId,
|
|
7640
7648
|
version: state2.version + 1,
|
|
7641
7649
|
lastUpdated: Date.now()
|
|
@@ -10506,6 +10514,47 @@ var init_domain_events = __esm({
|
|
|
10506
10514
|
}
|
|
10507
10515
|
});
|
|
10508
10516
|
|
|
10517
|
+
// typescript-lazy:typescript
|
|
10518
|
+
import { createRequire as createRequire4 } from "module";
|
|
10519
|
+
function _load() {
|
|
10520
|
+
if (!_ts) {
|
|
10521
|
+
const req = createRequire4(import.meta.url);
|
|
10522
|
+
try {
|
|
10523
|
+
_ts = req("typescript");
|
|
10524
|
+
} catch {
|
|
10525
|
+
try {
|
|
10526
|
+
_ts = req("typescript/lib/typescript.js");
|
|
10527
|
+
} catch {
|
|
10528
|
+
_ts = new Proxy({}, { get(_56, p74) {
|
|
10529
|
+
if (p74 === "__esModule" || typeof p74 === "symbol") return void 0;
|
|
10530
|
+
throw new Error("TypeScript is required for code analysis. Install it: npm install -g typescript");
|
|
10531
|
+
} });
|
|
10532
|
+
}
|
|
10533
|
+
}
|
|
10534
|
+
}
|
|
10535
|
+
return _ts;
|
|
10536
|
+
}
|
|
10537
|
+
var _ts, typescript_default;
|
|
10538
|
+
var init_typescript = __esm({
|
|
10539
|
+
"typescript-lazy:typescript"() {
|
|
10540
|
+
typescript_default = new Proxy({}, {
|
|
10541
|
+
get(_56, p74) {
|
|
10542
|
+
return _load()[p74];
|
|
10543
|
+
},
|
|
10544
|
+
has(_56, p74) {
|
|
10545
|
+
return p74 in _load();
|
|
10546
|
+
},
|
|
10547
|
+
ownKeys() {
|
|
10548
|
+
return Object.keys(_load());
|
|
10549
|
+
},
|
|
10550
|
+
getOwnPropertyDescriptor(_56, p74) {
|
|
10551
|
+
const v62 = _load()[p74];
|
|
10552
|
+
if (v62 !== void 0) return { configurable: true, enumerable: true, value: v62 };
|
|
10553
|
+
}
|
|
10554
|
+
});
|
|
10555
|
+
}
|
|
10556
|
+
});
|
|
10557
|
+
|
|
10509
10558
|
// src/shared/types/test-frameworks.ts
|
|
10510
10559
|
var test_frameworks_exports = {};
|
|
10511
10560
|
__export(test_frameworks_exports, {
|
|
@@ -26388,7 +26437,6 @@ var init_language_prompts = __esm({
|
|
|
26388
26437
|
// src/domains/test-generation/services/test-generator.ts
|
|
26389
26438
|
import * as fs4 from "fs";
|
|
26390
26439
|
import * as path5 from "path";
|
|
26391
|
-
import * as ts from "typescript/lib/typescript.js";
|
|
26392
26440
|
function createTestGeneratorService(memory, config = {}) {
|
|
26393
26441
|
return new TestGeneratorService({ memory }, config);
|
|
26394
26442
|
}
|
|
@@ -26397,6 +26445,7 @@ var init_test_generator = __esm({
|
|
|
26397
26445
|
"src/domains/test-generation/services/test-generator.ts"() {
|
|
26398
26446
|
"use strict";
|
|
26399
26447
|
init_esm_node();
|
|
26448
|
+
init_typescript();
|
|
26400
26449
|
init_types();
|
|
26401
26450
|
init_test_generator_factory();
|
|
26402
26451
|
init_tdd_generator();
|
|
@@ -26868,41 +26917,41 @@ ${sourceCode}
|
|
|
26868
26917
|
return PytestGenerator.convertParsedFile(parsed);
|
|
26869
26918
|
}
|
|
26870
26919
|
}
|
|
26871
|
-
const sourceFile =
|
|
26920
|
+
const sourceFile = typescript_default.createSourceFile(
|
|
26872
26921
|
path5.basename(fileName),
|
|
26873
26922
|
content,
|
|
26874
|
-
|
|
26923
|
+
typescript_default.ScriptTarget.Latest,
|
|
26875
26924
|
true,
|
|
26876
|
-
|
|
26925
|
+
typescript_default.ScriptKind.TS
|
|
26877
26926
|
);
|
|
26878
26927
|
const functions = [];
|
|
26879
26928
|
const classes = [];
|
|
26880
26929
|
const visit = (node) => {
|
|
26881
|
-
if (
|
|
26930
|
+
if (typescript_default.isFunctionDeclaration(node) && node.name) {
|
|
26882
26931
|
functions.push(this.extractFunctionInfo(node, sourceFile));
|
|
26883
|
-
} else if (
|
|
26932
|
+
} else if (typescript_default.isVariableStatement(node)) {
|
|
26884
26933
|
for (const declaration of node.declarationList.declarations) {
|
|
26885
|
-
if (
|
|
26934
|
+
if (typescript_default.isVariableDeclaration(declaration) && declaration.initializer && (typescript_default.isArrowFunction(declaration.initializer) || typescript_default.isFunctionExpression(declaration.initializer))) {
|
|
26886
26935
|
const name = declaration.name.getText(sourceFile);
|
|
26887
26936
|
functions.push(
|
|
26888
26937
|
this.extractArrowFunctionInfo(name, declaration.initializer, sourceFile, node)
|
|
26889
26938
|
);
|
|
26890
26939
|
}
|
|
26891
26940
|
}
|
|
26892
|
-
} else if (
|
|
26941
|
+
} else if (typescript_default.isClassDeclaration(node) && node.name) {
|
|
26893
26942
|
classes.push(this.extractClassInfo(node, sourceFile));
|
|
26894
26943
|
}
|
|
26895
|
-
|
|
26944
|
+
typescript_default.forEachChild(node, visit);
|
|
26896
26945
|
};
|
|
26897
|
-
|
|
26946
|
+
typescript_default.forEachChild(sourceFile, visit);
|
|
26898
26947
|
return { functions, classes };
|
|
26899
26948
|
}
|
|
26900
26949
|
extractFunctionInfo(node, sourceFile) {
|
|
26901
26950
|
const name = node.name?.getText(sourceFile) || "anonymous";
|
|
26902
26951
|
const parameters = this.extractParameters(node.parameters, sourceFile);
|
|
26903
26952
|
const returnType = node.type?.getText(sourceFile);
|
|
26904
|
-
const isAsync = node.modifiers?.some((m74) => m74.kind ===
|
|
26905
|
-
const isExported = node.modifiers?.some((m74) => m74.kind ===
|
|
26953
|
+
const isAsync = node.modifiers?.some((m74) => m74.kind === typescript_default.SyntaxKind.AsyncKeyword) ?? false;
|
|
26954
|
+
const isExported = node.modifiers?.some((m74) => m74.kind === typescript_default.SyntaxKind.ExportKeyword) ?? false;
|
|
26906
26955
|
const { line: startLine } = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));
|
|
26907
26956
|
const { line: endLine } = sourceFile.getLineAndCharacterOfPosition(node.getEnd());
|
|
26908
26957
|
return {
|
|
@@ -26920,8 +26969,8 @@ ${sourceCode}
|
|
|
26920
26969
|
extractArrowFunctionInfo(name, node, sourceFile, parentNode) {
|
|
26921
26970
|
const parameters = this.extractParameters(node.parameters, sourceFile);
|
|
26922
26971
|
const returnType = node.type?.getText(sourceFile);
|
|
26923
|
-
const isAsync = node.modifiers?.some((m74) => m74.kind ===
|
|
26924
|
-
const isExported =
|
|
26972
|
+
const isAsync = node.modifiers?.some((m74) => m74.kind === typescript_default.SyntaxKind.AsyncKeyword) ?? false;
|
|
26973
|
+
const isExported = typescript_default.isVariableStatement(parentNode) && (parentNode.modifiers?.some((m74) => m74.kind === typescript_default.SyntaxKind.ExportKeyword) ?? false);
|
|
26925
26974
|
const { line: startLine } = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));
|
|
26926
26975
|
const { line: endLine } = sourceFile.getLineAndCharacterOfPosition(node.getEnd());
|
|
26927
26976
|
return {
|
|
@@ -26942,13 +26991,13 @@ ${sourceCode}
|
|
|
26942
26991
|
const properties = [];
|
|
26943
26992
|
let hasConstructor = false;
|
|
26944
26993
|
let constructorParams;
|
|
26945
|
-
const isExported = node.modifiers?.some((m74) => m74.kind ===
|
|
26994
|
+
const isExported = node.modifiers?.some((m74) => m74.kind === typescript_default.SyntaxKind.ExportKeyword) ?? false;
|
|
26946
26995
|
for (const member of node.members) {
|
|
26947
|
-
if (
|
|
26996
|
+
if (typescript_default.isMethodDeclaration(member)) {
|
|
26948
26997
|
const methodName = member.name.getText(sourceFile);
|
|
26949
26998
|
const parameters = this.extractParameters(member.parameters, sourceFile);
|
|
26950
26999
|
const returnType = member.type?.getText(sourceFile);
|
|
26951
|
-
const isAsync = member.modifiers?.some((m74) => m74.kind ===
|
|
27000
|
+
const isAsync = member.modifiers?.some((m74) => m74.kind === typescript_default.SyntaxKind.AsyncKeyword) ?? false;
|
|
26952
27001
|
const { line: startLine } = sourceFile.getLineAndCharacterOfPosition(
|
|
26953
27002
|
member.getStart(sourceFile)
|
|
26954
27003
|
);
|
|
@@ -26964,14 +27013,14 @@ ${sourceCode}
|
|
|
26964
27013
|
endLine: endLine + 1,
|
|
26965
27014
|
body: member.body?.getText(sourceFile)
|
|
26966
27015
|
});
|
|
26967
|
-
} else if (
|
|
27016
|
+
} else if (typescript_default.isConstructorDeclaration(member)) {
|
|
26968
27017
|
hasConstructor = true;
|
|
26969
27018
|
constructorParams = this.extractParameters(member.parameters, sourceFile);
|
|
26970
|
-
} else if (
|
|
27019
|
+
} else if (typescript_default.isPropertyDeclaration(member)) {
|
|
26971
27020
|
const propName = member.name.getText(sourceFile);
|
|
26972
27021
|
const propType = member.type?.getText(sourceFile);
|
|
26973
|
-
const isPrivate = member.modifiers?.some((m74) => m74.kind ===
|
|
26974
|
-
const isReadonly = member.modifiers?.some((m74) => m74.kind ===
|
|
27022
|
+
const isPrivate = member.modifiers?.some((m74) => m74.kind === typescript_default.SyntaxKind.PrivateKeyword) ?? false;
|
|
27023
|
+
const isReadonly = member.modifiers?.some((m74) => m74.kind === typescript_default.SyntaxKind.ReadonlyKeyword) ?? false;
|
|
26975
27024
|
properties.push({
|
|
26976
27025
|
name: propName,
|
|
26977
27026
|
type: propType,
|
|
@@ -26995,14 +27044,14 @@ ${sourceCode}
|
|
|
26995
27044
|
return params.map((param) => {
|
|
26996
27045
|
let name = param.name.getText(sourceFile);
|
|
26997
27046
|
let type = param.type?.getText(sourceFile);
|
|
26998
|
-
if (
|
|
27047
|
+
if (typescript_default.isObjectBindingPattern(param.name)) {
|
|
26999
27048
|
objectDestructureCount++;
|
|
27000
27049
|
name = objectDestructureCount > 1 ? `options${objectDestructureCount}` : "options";
|
|
27001
27050
|
if (!type) {
|
|
27002
27051
|
const props = param.name.elements.map((el) => `${el.name.getText(sourceFile)}: unknown`).join(", ");
|
|
27003
27052
|
type = `{ ${props} }`;
|
|
27004
27053
|
}
|
|
27005
|
-
} else if (
|
|
27054
|
+
} else if (typescript_default.isArrayBindingPattern(param.name)) {
|
|
27006
27055
|
arrayDestructureCount++;
|
|
27007
27056
|
name = arrayDestructureCount > 1 ? `items${arrayDestructureCount}` : "items";
|
|
27008
27057
|
if (!type) {
|
|
@@ -27021,28 +27070,28 @@ ${sourceCode}
|
|
|
27021
27070
|
let complexity = 1;
|
|
27022
27071
|
const visit = (n61) => {
|
|
27023
27072
|
switch (n61.kind) {
|
|
27024
|
-
case
|
|
27025
|
-
case
|
|
27026
|
-
case
|
|
27027
|
-
case
|
|
27028
|
-
case
|
|
27029
|
-
case
|
|
27030
|
-
case
|
|
27031
|
-
case
|
|
27032
|
-
case
|
|
27073
|
+
case typescript_default.SyntaxKind.IfStatement:
|
|
27074
|
+
case typescript_default.SyntaxKind.ForStatement:
|
|
27075
|
+
case typescript_default.SyntaxKind.ForInStatement:
|
|
27076
|
+
case typescript_default.SyntaxKind.ForOfStatement:
|
|
27077
|
+
case typescript_default.SyntaxKind.WhileStatement:
|
|
27078
|
+
case typescript_default.SyntaxKind.DoStatement:
|
|
27079
|
+
case typescript_default.SyntaxKind.CaseClause:
|
|
27080
|
+
case typescript_default.SyntaxKind.CatchClause:
|
|
27081
|
+
case typescript_default.SyntaxKind.ConditionalExpression:
|
|
27033
27082
|
complexity++;
|
|
27034
27083
|
break;
|
|
27035
|
-
case
|
|
27084
|
+
case typescript_default.SyntaxKind.BinaryExpression: {
|
|
27036
27085
|
const binary = n61;
|
|
27037
|
-
if (binary.operatorToken.kind ===
|
|
27086
|
+
if (binary.operatorToken.kind === typescript_default.SyntaxKind.AmpersandAmpersandToken || binary.operatorToken.kind === typescript_default.SyntaxKind.BarBarToken) {
|
|
27038
27087
|
complexity++;
|
|
27039
27088
|
}
|
|
27040
27089
|
break;
|
|
27041
27090
|
}
|
|
27042
27091
|
}
|
|
27043
|
-
|
|
27092
|
+
typescript_default.forEachChild(n61, visit);
|
|
27044
27093
|
};
|
|
27045
|
-
|
|
27094
|
+
typescript_default.forEachChild(node, visit);
|
|
27046
27095
|
return complexity;
|
|
27047
27096
|
}
|
|
27048
27097
|
// ============================================================================
|
|
@@ -27910,7 +27959,6 @@ var init_embeddings = __esm({
|
|
|
27910
27959
|
});
|
|
27911
27960
|
|
|
27912
27961
|
// src/domains/test-generation/services/pattern-matcher.ts
|
|
27913
|
-
import * as ts2 from "typescript/lib/typescript.js";
|
|
27914
27962
|
import * as fs5 from "fs";
|
|
27915
27963
|
import * as path6 from "path";
|
|
27916
27964
|
var DEFAULT_CONFIG12, PatternMatcherService, TypeScriptASTParser;
|
|
@@ -27918,6 +27966,7 @@ var init_pattern_matcher = __esm({
|
|
|
27918
27966
|
"src/domains/test-generation/services/pattern-matcher.ts"() {
|
|
27919
27967
|
"use strict";
|
|
27920
27968
|
init_esm_node();
|
|
27969
|
+
init_typescript();
|
|
27921
27970
|
init_types();
|
|
27922
27971
|
init_embeddings();
|
|
27923
27972
|
init_error_utils();
|
|
@@ -28899,12 +28948,12 @@ var init_pattern_matcher = __esm({
|
|
|
28899
28948
|
} else {
|
|
28900
28949
|
this.sourceCode = fs5.readFileSync(filePath, "utf-8");
|
|
28901
28950
|
}
|
|
28902
|
-
this.sourceFile =
|
|
28951
|
+
this.sourceFile = typescript_default.createSourceFile(
|
|
28903
28952
|
path6.basename(filePath),
|
|
28904
28953
|
this.sourceCode,
|
|
28905
|
-
|
|
28954
|
+
typescript_default.ScriptTarget.Latest,
|
|
28906
28955
|
true,
|
|
28907
|
-
|
|
28956
|
+
typescript_default.ScriptKind.TS
|
|
28908
28957
|
);
|
|
28909
28958
|
return this.sourceFile;
|
|
28910
28959
|
}
|
|
@@ -28913,12 +28962,12 @@ var init_pattern_matcher = __esm({
|
|
|
28913
28962
|
*/
|
|
28914
28963
|
parseSource(source, fileName = "module.ts") {
|
|
28915
28964
|
this.sourceCode = source;
|
|
28916
|
-
this.sourceFile =
|
|
28965
|
+
this.sourceFile = typescript_default.createSourceFile(
|
|
28917
28966
|
fileName,
|
|
28918
28967
|
source,
|
|
28919
|
-
|
|
28968
|
+
typescript_default.ScriptTarget.Latest,
|
|
28920
28969
|
true,
|
|
28921
|
-
|
|
28970
|
+
typescript_default.ScriptKind.TS
|
|
28922
28971
|
);
|
|
28923
28972
|
return this.sourceFile;
|
|
28924
28973
|
}
|
|
@@ -28928,11 +28977,11 @@ var init_pattern_matcher = __esm({
|
|
|
28928
28977
|
extractFunctions(sourceFile) {
|
|
28929
28978
|
const functions = [];
|
|
28930
28979
|
const visit = (node) => {
|
|
28931
|
-
if (
|
|
28980
|
+
if (typescript_default.isFunctionDeclaration(node) && node.name) {
|
|
28932
28981
|
functions.push(this.extractFunctionInfo(node, sourceFile));
|
|
28933
|
-
} else if (
|
|
28982
|
+
} else if (typescript_default.isVariableStatement(node)) {
|
|
28934
28983
|
for (const declaration of node.declarationList.declarations) {
|
|
28935
|
-
if (
|
|
28984
|
+
if (typescript_default.isVariableDeclaration(declaration) && declaration.initializer && (typescript_default.isArrowFunction(declaration.initializer) || typescript_default.isFunctionExpression(declaration.initializer))) {
|
|
28936
28985
|
const name = declaration.name.getText(sourceFile);
|
|
28937
28986
|
functions.push(
|
|
28938
28987
|
this.extractArrowFunctionInfo(
|
|
@@ -28945,9 +28994,9 @@ var init_pattern_matcher = __esm({
|
|
|
28945
28994
|
}
|
|
28946
28995
|
}
|
|
28947
28996
|
}
|
|
28948
|
-
|
|
28997
|
+
typescript_default.forEachChild(node, visit);
|
|
28949
28998
|
};
|
|
28950
|
-
|
|
28999
|
+
typescript_default.forEachChild(sourceFile, visit);
|
|
28951
29000
|
return functions;
|
|
28952
29001
|
}
|
|
28953
29002
|
/**
|
|
@@ -28956,12 +29005,12 @@ var init_pattern_matcher = __esm({
|
|
|
28956
29005
|
extractClasses(sourceFile) {
|
|
28957
29006
|
const classes = [];
|
|
28958
29007
|
const visit = (node) => {
|
|
28959
|
-
if (
|
|
29008
|
+
if (typescript_default.isClassDeclaration(node) && node.name) {
|
|
28960
29009
|
classes.push(this.extractClassInfo(node, sourceFile));
|
|
28961
29010
|
}
|
|
28962
|
-
|
|
29011
|
+
typescript_default.forEachChild(node, visit);
|
|
28963
29012
|
};
|
|
28964
|
-
|
|
29013
|
+
typescript_default.forEachChild(sourceFile, visit);
|
|
28965
29014
|
return classes;
|
|
28966
29015
|
}
|
|
28967
29016
|
/**
|
|
@@ -28972,10 +29021,10 @@ var init_pattern_matcher = __esm({
|
|
|
28972
29021
|
const parameters = this.extractParameters(node.parameters, sourceFile);
|
|
28973
29022
|
const returnType = node.type?.getText(sourceFile);
|
|
28974
29023
|
const isAsync = node.modifiers?.some(
|
|
28975
|
-
(m74) => m74.kind ===
|
|
29024
|
+
(m74) => m74.kind === typescript_default.SyntaxKind.AsyncKeyword
|
|
28976
29025
|
) ?? false;
|
|
28977
29026
|
const isExported = node.modifiers?.some(
|
|
28978
|
-
(m74) => m74.kind ===
|
|
29027
|
+
(m74) => m74.kind === typescript_default.SyntaxKind.ExportKeyword
|
|
28979
29028
|
) ?? false;
|
|
28980
29029
|
const { line: startLine } = sourceFile.getLineAndCharacterOfPosition(
|
|
28981
29030
|
node.getStart(sourceFile)
|
|
@@ -29003,9 +29052,9 @@ var init_pattern_matcher = __esm({
|
|
|
29003
29052
|
const parameters = this.extractParameters(node.parameters, sourceFile);
|
|
29004
29053
|
const returnType = node.type?.getText(sourceFile);
|
|
29005
29054
|
const isAsync = node.modifiers?.some(
|
|
29006
|
-
(m74) => m74.kind ===
|
|
29055
|
+
(m74) => m74.kind === typescript_default.SyntaxKind.AsyncKeyword
|
|
29007
29056
|
) ?? false;
|
|
29008
|
-
const isExported =
|
|
29057
|
+
const isExported = typescript_default.isVariableStatement(parentNode) && (parentNode.modifiers?.some((m74) => m74.kind === typescript_default.SyntaxKind.ExportKeyword) ?? false);
|
|
29009
29058
|
const { line: startLine } = sourceFile.getLineAndCharacterOfPosition(
|
|
29010
29059
|
node.getStart(sourceFile)
|
|
29011
29060
|
);
|
|
@@ -29034,15 +29083,15 @@ var init_pattern_matcher = __esm({
|
|
|
29034
29083
|
const properties = [];
|
|
29035
29084
|
let hasConstructor = false;
|
|
29036
29085
|
const isExported = node.modifiers?.some(
|
|
29037
|
-
(m74) => m74.kind ===
|
|
29086
|
+
(m74) => m74.kind === typescript_default.SyntaxKind.ExportKeyword
|
|
29038
29087
|
) ?? false;
|
|
29039
29088
|
for (const member of node.members) {
|
|
29040
|
-
if (
|
|
29089
|
+
if (typescript_default.isMethodDeclaration(member)) {
|
|
29041
29090
|
const methodName = member.name.getText(sourceFile);
|
|
29042
29091
|
const parameters = this.extractParameters(member.parameters, sourceFile);
|
|
29043
29092
|
const returnType = member.type?.getText(sourceFile);
|
|
29044
29093
|
const isAsync = member.modifiers?.some(
|
|
29045
|
-
(m74) => m74.kind ===
|
|
29094
|
+
(m74) => m74.kind === typescript_default.SyntaxKind.AsyncKeyword
|
|
29046
29095
|
) ?? false;
|
|
29047
29096
|
const { line: startLine2 } = sourceFile.getLineAndCharacterOfPosition(
|
|
29048
29097
|
member.getStart(sourceFile)
|
|
@@ -29061,16 +29110,16 @@ var init_pattern_matcher = __esm({
|
|
|
29061
29110
|
endLine: endLine2 + 1,
|
|
29062
29111
|
body: member.body?.getText(sourceFile)
|
|
29063
29112
|
});
|
|
29064
|
-
} else if (
|
|
29113
|
+
} else if (typescript_default.isConstructorDeclaration(member)) {
|
|
29065
29114
|
hasConstructor = true;
|
|
29066
|
-
} else if (
|
|
29115
|
+
} else if (typescript_default.isPropertyDeclaration(member)) {
|
|
29067
29116
|
const propName = member.name.getText(sourceFile);
|
|
29068
29117
|
const propType = member.type?.getText(sourceFile);
|
|
29069
29118
|
const isPrivate = member.modifiers?.some(
|
|
29070
|
-
(m74) => m74.kind ===
|
|
29119
|
+
(m74) => m74.kind === typescript_default.SyntaxKind.PrivateKeyword
|
|
29071
29120
|
) ?? false;
|
|
29072
29121
|
const isReadonly = member.modifiers?.some(
|
|
29073
|
-
(m74) => m74.kind ===
|
|
29122
|
+
(m74) => m74.kind === typescript_default.SyntaxKind.ReadonlyKeyword
|
|
29074
29123
|
) ?? false;
|
|
29075
29124
|
properties.push({
|
|
29076
29125
|
name: propName,
|
|
@@ -29105,14 +29154,14 @@ var init_pattern_matcher = __esm({
|
|
|
29105
29154
|
return params.map((param) => {
|
|
29106
29155
|
let name = param.name.getText(sourceFile);
|
|
29107
29156
|
let type = param.type?.getText(sourceFile);
|
|
29108
|
-
if (
|
|
29157
|
+
if (typescript_default.isObjectBindingPattern(param.name)) {
|
|
29109
29158
|
objectDestructureCount++;
|
|
29110
29159
|
name = objectDestructureCount > 1 ? `options${objectDestructureCount}` : "options";
|
|
29111
29160
|
if (!type) {
|
|
29112
29161
|
const props = param.name.elements.map((el) => `${el.name.getText(sourceFile)}: unknown`).join(", ");
|
|
29113
29162
|
type = `{ ${props} }`;
|
|
29114
29163
|
}
|
|
29115
|
-
} else if (
|
|
29164
|
+
} else if (typescript_default.isArrayBindingPattern(param.name)) {
|
|
29116
29165
|
arrayDestructureCount++;
|
|
29117
29166
|
name = arrayDestructureCount > 1 ? `items${arrayDestructureCount}` : "items";
|
|
29118
29167
|
if (!type) {
|
|
@@ -29134,28 +29183,28 @@ var init_pattern_matcher = __esm({
|
|
|
29134
29183
|
let complexity = 1;
|
|
29135
29184
|
const visit = (n61) => {
|
|
29136
29185
|
switch (n61.kind) {
|
|
29137
|
-
case
|
|
29138
|
-
case
|
|
29139
|
-
case
|
|
29140
|
-
case
|
|
29141
|
-
case
|
|
29142
|
-
case
|
|
29143
|
-
case
|
|
29144
|
-
case
|
|
29145
|
-
case
|
|
29146
|
-
case
|
|
29186
|
+
case typescript_default.SyntaxKind.IfStatement:
|
|
29187
|
+
case typescript_default.SyntaxKind.ForStatement:
|
|
29188
|
+
case typescript_default.SyntaxKind.ForInStatement:
|
|
29189
|
+
case typescript_default.SyntaxKind.ForOfStatement:
|
|
29190
|
+
case typescript_default.SyntaxKind.WhileStatement:
|
|
29191
|
+
case typescript_default.SyntaxKind.DoStatement:
|
|
29192
|
+
case typescript_default.SyntaxKind.CaseClause:
|
|
29193
|
+
case typescript_default.SyntaxKind.CatchClause:
|
|
29194
|
+
case typescript_default.SyntaxKind.ConditionalExpression:
|
|
29195
|
+
case typescript_default.SyntaxKind.QuestionQuestionToken:
|
|
29147
29196
|
complexity++;
|
|
29148
29197
|
break;
|
|
29149
|
-
case
|
|
29198
|
+
case typescript_default.SyntaxKind.BinaryExpression:
|
|
29150
29199
|
const binary = n61;
|
|
29151
|
-
if (binary.operatorToken.kind ===
|
|
29200
|
+
if (binary.operatorToken.kind === typescript_default.SyntaxKind.AmpersandAmpersandToken || binary.operatorToken.kind === typescript_default.SyntaxKind.BarBarToken) {
|
|
29152
29201
|
complexity++;
|
|
29153
29202
|
}
|
|
29154
29203
|
break;
|
|
29155
29204
|
}
|
|
29156
|
-
|
|
29205
|
+
typescript_default.forEachChild(n61, visit);
|
|
29157
29206
|
};
|
|
29158
|
-
|
|
29207
|
+
typescript_default.forEachChild(node, visit);
|
|
29159
29208
|
return complexity;
|
|
29160
29209
|
}
|
|
29161
29210
|
};
|
|
@@ -33231,13 +33280,30 @@ var init_continue_gate_integration = __esm({
|
|
|
33231
33280
|
/**
|
|
33232
33281
|
* Initialize the ContinueGate integration
|
|
33233
33282
|
*
|
|
33234
|
-
*
|
|
33235
|
-
*
|
|
33236
|
-
*
|
|
33237
|
-
* which tracks action-level loop detection and rework ratios.
|
|
33283
|
+
* Attempts to load @claude-flow/guidance ContinueGate for step-level
|
|
33284
|
+
* evaluation with coherence/uncertainty scoring. Falls back to local
|
|
33285
|
+
* loop detection if the guidance package is unavailable.
|
|
33238
33286
|
*/
|
|
33239
33287
|
async initialize() {
|
|
33240
33288
|
if (this.initialized) return;
|
|
33289
|
+
try {
|
|
33290
|
+
const modulePath = "@claude-flow/guidance/continue-gate";
|
|
33291
|
+
const mod = await import(
|
|
33292
|
+
/* @vite-ignore */
|
|
33293
|
+
modulePath
|
|
33294
|
+
);
|
|
33295
|
+
if (mod && typeof mod.createContinueGate === "function") {
|
|
33296
|
+
const flags = governanceFlags.getFlags().continueGate;
|
|
33297
|
+
this.guidanceContinueGate = mod.createContinueGate({
|
|
33298
|
+
maxConsecutiveSteps: flags.maxConsecutiveRetries * 10,
|
|
33299
|
+
maxReworkRatio: flags.reworkRatioThreshold,
|
|
33300
|
+
checkpointIntervalSteps: 25
|
|
33301
|
+
});
|
|
33302
|
+
console.log("[ContinueGateIntegration] Guidance ContinueGate loaded");
|
|
33303
|
+
}
|
|
33304
|
+
} catch {
|
|
33305
|
+
this.guidanceContinueGate = null;
|
|
33306
|
+
}
|
|
33241
33307
|
try {
|
|
33242
33308
|
this.db = getUnifiedMemory();
|
|
33243
33309
|
if (!this.db.isInitialized()) await this.db.initialize();
|
|
@@ -33318,7 +33384,35 @@ var init_continue_gate_integration = __esm({
|
|
|
33318
33384
|
escalate: false
|
|
33319
33385
|
};
|
|
33320
33386
|
}
|
|
33321
|
-
|
|
33387
|
+
const localDecision = this.localEvaluation(agentId, history, flags);
|
|
33388
|
+
if (this.guidanceContinueGate && localDecision.shouldContinue && !localDecision.reason) {
|
|
33389
|
+
try {
|
|
33390
|
+
const reworkRatio = this.calculateReworkRatio(history.slice(-10));
|
|
33391
|
+
const stepContext = {
|
|
33392
|
+
stepNumber: history.length,
|
|
33393
|
+
totalToolCalls: history.length,
|
|
33394
|
+
reworkCount: history.filter((a37) => !a37.success).length,
|
|
33395
|
+
coherenceScore: 1 - reworkRatio,
|
|
33396
|
+
uncertaintyScore: reworkRatio,
|
|
33397
|
+
elapsedMs: history.length > 0 ? Date.now() - history[0].timestamp : 0,
|
|
33398
|
+
lastCheckpointStep: 0,
|
|
33399
|
+
totalTokensUsed: history.length * 500,
|
|
33400
|
+
// Estimate ~500 tokens per action
|
|
33401
|
+
budgetRemaining: {
|
|
33402
|
+
tokens: Math.max(0, flags.maxConsecutiveRetries * 10 * 500 - history.length * 500),
|
|
33403
|
+
toolCalls: Math.max(0, flags.maxConsecutiveRetries * 10 - history.length),
|
|
33404
|
+
timeMs: Math.max(0, flags.idleTimeoutMs - (history.length > 0 ? Date.now() - history[0].timestamp : 0))
|
|
33405
|
+
},
|
|
33406
|
+
recentDecisions: []
|
|
33407
|
+
};
|
|
33408
|
+
const decision = this.guidanceContinueGate.evaluateWithHistory(stepContext);
|
|
33409
|
+
if (decision.decision !== "continue") {
|
|
33410
|
+
return this.mapGuidanceDecision(decision, agentId);
|
|
33411
|
+
}
|
|
33412
|
+
} catch {
|
|
33413
|
+
}
|
|
33414
|
+
}
|
|
33415
|
+
return localDecision;
|
|
33322
33416
|
}
|
|
33323
33417
|
/**
|
|
33324
33418
|
* Local loop detection implementation
|
|
@@ -33395,21 +33489,25 @@ var init_continue_gate_integration = __esm({
|
|
|
33395
33489
|
return failedCount / actions.length;
|
|
33396
33490
|
}
|
|
33397
33491
|
/**
|
|
33398
|
-
* Map guidance
|
|
33492
|
+
* Map guidance ContinueDecision to our ContinueGateDecision format.
|
|
33493
|
+
*
|
|
33494
|
+
* ContinueDecision has: { decision, reasons, metrics, recommendedAction }
|
|
33495
|
+
* We map to: { shouldContinue, reason, throttleMs, escalate, reworkRatio }
|
|
33399
33496
|
*/
|
|
33400
33497
|
mapGuidanceDecision(decision, agentId) {
|
|
33401
33498
|
const flags = governanceFlags.getFlags().continueGate;
|
|
33402
|
-
|
|
33403
|
-
|
|
33499
|
+
const shouldContinue = decision.decision === "continue" || decision.decision === "checkpoint";
|
|
33500
|
+
const reason = decision.reasons.length > 0 ? decision.reasons.join("; ") : void 0;
|
|
33501
|
+
if (!shouldContinue && flags.throttleOnExceed) {
|
|
33502
|
+
const throttleMs = decision.decision === "stop" ? 3e4 : decision.decision === "pause" ? 15e3 : 5e3;
|
|
33404
33503
|
this.throttledAgents.set(agentId, Date.now() + throttleMs);
|
|
33405
33504
|
}
|
|
33406
33505
|
return {
|
|
33407
|
-
shouldContinue
|
|
33408
|
-
reason
|
|
33409
|
-
throttleMs: decision.
|
|
33410
|
-
escalate: decision.
|
|
33411
|
-
reworkRatio: decision.reworkRatio
|
|
33412
|
-
consecutiveCount: decision.consecutiveCount
|
|
33506
|
+
shouldContinue,
|
|
33507
|
+
reason,
|
|
33508
|
+
throttleMs: decision.decision === "throttle" ? 5e3 : decision.decision === "pause" ? 15e3 : decision.decision === "stop" ? 3e4 : void 0,
|
|
33509
|
+
escalate: decision.decision === "stop" || decision.decision === "pause",
|
|
33510
|
+
reworkRatio: decision.metrics.reworkRatio
|
|
33413
33511
|
};
|
|
33414
33512
|
}
|
|
33415
33513
|
/**
|
|
@@ -33487,12 +33585,27 @@ var init_memory_write_gate_integration = __esm({
|
|
|
33487
33585
|
/**
|
|
33488
33586
|
* Initialize the MemoryWriteGate integration
|
|
33489
33587
|
*
|
|
33490
|
-
*
|
|
33491
|
-
*
|
|
33588
|
+
* Attempts to load @claude-flow/guidance MemoryWriteGate for authority-scoped
|
|
33589
|
+
* writes and rate limiting. Falls back to local contradiction detection
|
|
33492
33590
|
* optimized for AQE's ReasoningBank pattern storage.
|
|
33493
33591
|
*/
|
|
33494
33592
|
async initialize() {
|
|
33495
33593
|
if (this.initialized) return;
|
|
33594
|
+
try {
|
|
33595
|
+
const modulePath = "@claude-flow/guidance/memory-gate";
|
|
33596
|
+
const mod = await import(
|
|
33597
|
+
/* @vite-ignore */
|
|
33598
|
+
modulePath
|
|
33599
|
+
);
|
|
33600
|
+
if (mod && typeof mod.createMemoryWriteGate === "function") {
|
|
33601
|
+
this.guidanceMemoryGate = mod.createMemoryWriteGate({
|
|
33602
|
+
enableContradictionTracking: true
|
|
33603
|
+
});
|
|
33604
|
+
console.log("[MemoryWriteGateIntegration] Guidance MemoryWriteGate loaded");
|
|
33605
|
+
}
|
|
33606
|
+
} catch {
|
|
33607
|
+
this.guidanceMemoryGate = null;
|
|
33608
|
+
}
|
|
33496
33609
|
this.initialized = true;
|
|
33497
33610
|
}
|
|
33498
33611
|
/**
|
|
@@ -33506,7 +33619,31 @@ var init_memory_write_gate_integration = __esm({
|
|
|
33506
33619
|
const flags = governanceFlags.getFlags().memoryWriteGate;
|
|
33507
33620
|
pattern.timestamp = pattern.timestamp || Date.now();
|
|
33508
33621
|
pattern.useCount = pattern.useCount || 0;
|
|
33509
|
-
|
|
33622
|
+
const localDecision = this.localEvaluation(pattern, flags);
|
|
33623
|
+
if (this.guidanceMemoryGate && localDecision.allowed && !localDecision.reason) {
|
|
33624
|
+
try {
|
|
33625
|
+
const authority = {
|
|
33626
|
+
agentId: pattern.agentId || "unknown",
|
|
33627
|
+
role: "worker",
|
|
33628
|
+
namespaces: [pattern.domain],
|
|
33629
|
+
maxWritesPerMinute: 60,
|
|
33630
|
+
canDelete: false,
|
|
33631
|
+
canOverwrite: true,
|
|
33632
|
+
trustLevel: 0.7
|
|
33633
|
+
};
|
|
33634
|
+
const decision = this.guidanceMemoryGate.evaluateWrite(
|
|
33635
|
+
authority,
|
|
33636
|
+
pattern.key,
|
|
33637
|
+
pattern.domain,
|
|
33638
|
+
pattern.value
|
|
33639
|
+
);
|
|
33640
|
+
if (!decision.allowed) {
|
|
33641
|
+
return this.mapGuidanceDecision(decision);
|
|
33642
|
+
}
|
|
33643
|
+
} catch {
|
|
33644
|
+
}
|
|
33645
|
+
}
|
|
33646
|
+
return localDecision;
|
|
33510
33647
|
}
|
|
33511
33648
|
/**
|
|
33512
33649
|
* Local contradiction detection implementation
|
|
@@ -33642,15 +33779,17 @@ var init_memory_write_gate_integration = __esm({
|
|
|
33642
33779
|
return [...keys].map((key) => this.patternIndex.get(key)).filter((p74) => p74 !== void 0);
|
|
33643
33780
|
}
|
|
33644
33781
|
/**
|
|
33645
|
-
* Map guidance
|
|
33782
|
+
* Map guidance WriteDecision to our MemoryWriteGateDecision format.
|
|
33783
|
+
*
|
|
33784
|
+
* WriteDecision has: { allowed, reason, contradictions, authorityCheck, rateCheck, overwriteCheck }
|
|
33785
|
+
* We map to: { allowed, reason, conflictingPatterns, suggestedResolution, requiresManualReview }
|
|
33646
33786
|
*/
|
|
33647
33787
|
mapGuidanceDecision(decision) {
|
|
33648
33788
|
return {
|
|
33649
|
-
allowed: decision.allowed
|
|
33789
|
+
allowed: decision.allowed,
|
|
33650
33790
|
reason: decision.reason,
|
|
33651
|
-
|
|
33652
|
-
suggestedResolution: decision.
|
|
33653
|
-
requiresManualReview: decision.requiresManualReview
|
|
33791
|
+
requiresManualReview: !decision.authorityCheck.passed || decision.contradictions.length > 0,
|
|
33792
|
+
suggestedResolution: decision.contradictions.length > 0 ? "reject" : void 0
|
|
33654
33793
|
};
|
|
33655
33794
|
}
|
|
33656
33795
|
/**
|
|
@@ -33767,12 +33906,38 @@ var init_trust_accumulator_integration = __esm({
|
|
|
33767
33906
|
agentMetrics = /* @__PURE__ */ new Map();
|
|
33768
33907
|
taskHistory = /* @__PURE__ */ new Map();
|
|
33769
33908
|
tierThresholds = { ...DEFAULT_TIER_THRESHOLDS };
|
|
33909
|
+
guidanceTrustSystem = null;
|
|
33770
33910
|
initialized = false;
|
|
33771
33911
|
/**
|
|
33772
33912
|
* Initialize the TrustAccumulator integration
|
|
33913
|
+
*
|
|
33914
|
+
* Attempts to load @claude-flow/guidance TrustSystem for gate-outcome-based
|
|
33915
|
+
* trust accumulation with exponential decay. Falls back to local
|
|
33916
|
+
* implementation optimized for AQE agent routing.
|
|
33773
33917
|
*/
|
|
33774
33918
|
async initialize() {
|
|
33775
33919
|
if (this.initialized) return;
|
|
33920
|
+
try {
|
|
33921
|
+
const modulePath = "@claude-flow/guidance/trust";
|
|
33922
|
+
const mod = await import(
|
|
33923
|
+
/* @vite-ignore */
|
|
33924
|
+
modulePath
|
|
33925
|
+
);
|
|
33926
|
+
if (mod && typeof mod.createTrustSystem === "function") {
|
|
33927
|
+
this.guidanceTrustSystem = mod.createTrustSystem({
|
|
33928
|
+
initialTrust: 0.7,
|
|
33929
|
+
allowDelta: 0.02,
|
|
33930
|
+
denyDelta: 0.05,
|
|
33931
|
+
warnDelta: 0.01,
|
|
33932
|
+
decayRate: 0.05,
|
|
33933
|
+
decayIntervalMs: 3e5
|
|
33934
|
+
// 5 minutes
|
|
33935
|
+
});
|
|
33936
|
+
console.log("[TrustAccumulatorIntegration] Guidance TrustSystem loaded");
|
|
33937
|
+
}
|
|
33938
|
+
} catch {
|
|
33939
|
+
this.guidanceTrustSystem = null;
|
|
33940
|
+
}
|
|
33776
33941
|
this.initialized = true;
|
|
33777
33942
|
}
|
|
33778
33943
|
/**
|
|
@@ -33796,6 +33961,13 @@ var init_trust_accumulator_integration = __esm({
|
|
|
33796
33961
|
}
|
|
33797
33962
|
this.taskHistory.set(agentId, history);
|
|
33798
33963
|
this.updateAgentMetrics(agentId, outcome);
|
|
33964
|
+
if (this.guidanceTrustSystem) {
|
|
33965
|
+
try {
|
|
33966
|
+
const gateOutcome = success ? "allow" : "deny";
|
|
33967
|
+
this.guidanceTrustSystem.recordOutcome(agentId, gateOutcome, `Task ${taskType}: ${success ? "success" : "failure"}`);
|
|
33968
|
+
} catch {
|
|
33969
|
+
}
|
|
33970
|
+
}
|
|
33799
33971
|
const flags = governanceFlags.getFlags().trustAccumulator;
|
|
33800
33972
|
if (flags.autoTierAdjustment) {
|
|
33801
33973
|
this.adjustTier(agentId);
|
|
@@ -34164,14 +34336,32 @@ var init_deterministic_gateway_integration = __esm({
|
|
|
34164
34336
|
requestHistory = /* @__PURE__ */ new Map();
|
|
34165
34337
|
resultCache = /* @__PURE__ */ new Map();
|
|
34166
34338
|
toolSchemas = /* @__PURE__ */ new Map();
|
|
34339
|
+
guidanceGateway = null;
|
|
34167
34340
|
initialized = false;
|
|
34168
34341
|
/**
|
|
34169
34342
|
* Initialize the DeterministicGateway integration
|
|
34343
|
+
*
|
|
34344
|
+
* Attempts to load @claude-flow/guidance DeterministicToolGateway for
|
|
34345
|
+
* idempotency keys, schema validation, and budget metering. Falls back
|
|
34346
|
+
* to local implementation.
|
|
34170
34347
|
*/
|
|
34171
34348
|
async initialize() {
|
|
34172
34349
|
if (this.initialized) return;
|
|
34173
34350
|
this.registerDefaultSchemas();
|
|
34174
34351
|
this.initialized = true;
|
|
34352
|
+
try {
|
|
34353
|
+
const modulePath = "@claude-flow/guidance/gateway";
|
|
34354
|
+
const mod = await import(
|
|
34355
|
+
/* @vite-ignore */
|
|
34356
|
+
modulePath
|
|
34357
|
+
);
|
|
34358
|
+
if (mod && typeof mod.createToolGateway === "function") {
|
|
34359
|
+
this.guidanceGateway = mod.createToolGateway();
|
|
34360
|
+
console.log("[DeterministicGateway] Guidance ToolGateway loaded");
|
|
34361
|
+
}
|
|
34362
|
+
} catch {
|
|
34363
|
+
this.guidanceGateway = null;
|
|
34364
|
+
}
|
|
34175
34365
|
}
|
|
34176
34366
|
/**
|
|
34177
34367
|
* Register default schemas for AQE tools
|
|
@@ -34296,6 +34486,23 @@ var init_deterministic_gateway_integration = __esm({
|
|
|
34296
34486
|
};
|
|
34297
34487
|
}
|
|
34298
34488
|
}
|
|
34489
|
+
if (this.guidanceGateway && typeof params === "object" && params !== null) {
|
|
34490
|
+
try {
|
|
34491
|
+
const guidanceDecision = this.guidanceGateway.evaluate(
|
|
34492
|
+
toolName,
|
|
34493
|
+
params
|
|
34494
|
+
);
|
|
34495
|
+
if (!guidanceDecision.allowed) {
|
|
34496
|
+
this.logEvent(toolName, "guidance_denied", key);
|
|
34497
|
+
return {
|
|
34498
|
+
allowed: !isStrictMode(),
|
|
34499
|
+
reason: `Guidance gateway: ${guidanceDecision.reason}`,
|
|
34500
|
+
idempotencyKey: key
|
|
34501
|
+
};
|
|
34502
|
+
}
|
|
34503
|
+
} catch {
|
|
34504
|
+
}
|
|
34505
|
+
}
|
|
34299
34506
|
return {
|
|
34300
34507
|
allowed: true,
|
|
34301
34508
|
idempotencyKey: key
|
|
@@ -34605,6 +34812,7 @@ var init_evolution_pipeline_integration = __esm({
|
|
|
34605
34812
|
rules = /* @__PURE__ */ new Map();
|
|
34606
34813
|
variantTests = /* @__PURE__ */ new Map();
|
|
34607
34814
|
taskOutcomes = /* @__PURE__ */ new Map();
|
|
34815
|
+
guidanceEvolution = null;
|
|
34608
34816
|
initialized = false;
|
|
34609
34817
|
// KV persistence
|
|
34610
34818
|
db = null;
|
|
@@ -34627,6 +34835,10 @@ var init_evolution_pipeline_integration = __esm({
|
|
|
34627
34835
|
};
|
|
34628
34836
|
/**
|
|
34629
34837
|
* Initialize the Evolution Pipeline integration
|
|
34838
|
+
*
|
|
34839
|
+
* Attempts to load @claude-flow/guidance EvolutionPipeline for
|
|
34840
|
+
* signed change proposals and staged rollout. Falls back to local
|
|
34841
|
+
* rule effectiveness tracking.
|
|
34630
34842
|
*/
|
|
34631
34843
|
async initialize() {
|
|
34632
34844
|
if (this.initialized) return;
|
|
@@ -34638,6 +34850,19 @@ var init_evolution_pipeline_integration = __esm({
|
|
|
34638
34850
|
console.warn("[EvolutionPipeline] DB init failed, using memory-only:", toErrorMessage(error));
|
|
34639
34851
|
this.db = null;
|
|
34640
34852
|
}
|
|
34853
|
+
try {
|
|
34854
|
+
const modulePath = "@claude-flow/guidance/evolution";
|
|
34855
|
+
const mod = await import(
|
|
34856
|
+
/* @vite-ignore */
|
|
34857
|
+
modulePath
|
|
34858
|
+
);
|
|
34859
|
+
if (mod && typeof mod.createEvolutionPipeline === "function") {
|
|
34860
|
+
this.guidanceEvolution = mod.createEvolutionPipeline();
|
|
34861
|
+
console.log("[EvolutionPipeline] Guidance EvolutionPipeline loaded");
|
|
34862
|
+
}
|
|
34863
|
+
} catch {
|
|
34864
|
+
this.guidanceEvolution = null;
|
|
34865
|
+
}
|
|
34641
34866
|
this.initialized = true;
|
|
34642
34867
|
this.logEvent("initialize", "Evolution Pipeline initialized");
|
|
34643
34868
|
}
|
|
@@ -34752,6 +34977,21 @@ var init_evolution_pipeline_integration = __esm({
|
|
|
34752
34977
|
timestamp: Date.now(),
|
|
34753
34978
|
reason
|
|
34754
34979
|
});
|
|
34980
|
+
if (this.guidanceEvolution) {
|
|
34981
|
+
try {
|
|
34982
|
+
this.guidanceEvolution.propose({
|
|
34983
|
+
kind: "rule-promote",
|
|
34984
|
+
title: `Promote rule ${ruleId}`,
|
|
34985
|
+
description: reason,
|
|
34986
|
+
author: "aqe-evolution-pipeline",
|
|
34987
|
+
targetPath: `rules/${ruleId}`,
|
|
34988
|
+
diff: { before: oldStatus, after: newStatus },
|
|
34989
|
+
rationale: reason,
|
|
34990
|
+
riskAssessment: { level: "low", factors: ["automated-promotion"] }
|
|
34991
|
+
});
|
|
34992
|
+
} catch {
|
|
34993
|
+
}
|
|
34994
|
+
}
|
|
34755
34995
|
this.logEvent("rule_promotion", `Rule ${ruleId} promoted: ${oldStatus} -> ${newStatus}. Reason: ${reason}`);
|
|
34756
34996
|
}
|
|
34757
34997
|
}
|
|
@@ -34781,6 +35021,24 @@ var init_evolution_pipeline_integration = __esm({
|
|
|
34781
35021
|
timestamp: Date.now(),
|
|
34782
35022
|
reason
|
|
34783
35023
|
});
|
|
35024
|
+
if (this.guidanceEvolution) {
|
|
35025
|
+
try {
|
|
35026
|
+
this.guidanceEvolution.propose({
|
|
35027
|
+
kind: "rule-remove",
|
|
35028
|
+
title: `Demote rule ${ruleId}`,
|
|
35029
|
+
description: reason,
|
|
35030
|
+
author: "aqe-evolution-pipeline",
|
|
35031
|
+
targetPath: `rules/${ruleId}`,
|
|
35032
|
+
diff: { before: oldStatus, after: newStatus },
|
|
35033
|
+
rationale: reason,
|
|
35034
|
+
riskAssessment: {
|
|
35035
|
+
level: newStatus === "deprecated" ? "medium" : "low",
|
|
35036
|
+
factors: ["automated-demotion"]
|
|
35037
|
+
}
|
|
35038
|
+
});
|
|
35039
|
+
} catch {
|
|
35040
|
+
}
|
|
35041
|
+
}
|
|
34784
35042
|
this.logEvent("rule_demotion", `Rule ${ruleId} demoted: ${oldStatus} -> ${newStatus}. Reason: ${reason}`);
|
|
34785
35043
|
}
|
|
34786
35044
|
}
|
|
@@ -35523,9 +35781,15 @@ var init_adversarial_defense_integration = __esm({
|
|
|
35523
35781
|
blocklist = /* @__PURE__ */ new Map();
|
|
35524
35782
|
stats = this.createEmptyStats();
|
|
35525
35783
|
assessmentHistory = [];
|
|
35784
|
+
guidanceThreatDetector = null;
|
|
35785
|
+
guidanceCollusionDetector = null;
|
|
35526
35786
|
initialized = false;
|
|
35527
35787
|
/**
|
|
35528
35788
|
* Initialize the AdversarialDefense integration
|
|
35789
|
+
*
|
|
35790
|
+
* Attempts to load @claude-flow/guidance adversarial defense for
|
|
35791
|
+
* ThreatDetector and CollusionDetector. Falls back to local
|
|
35792
|
+
* pattern-based detection.
|
|
35529
35793
|
*/
|
|
35530
35794
|
async initialize() {
|
|
35531
35795
|
if (this.initialized) return;
|
|
@@ -35533,6 +35797,24 @@ var init_adversarial_defense_integration = __esm({
|
|
|
35533
35797
|
this.patterns.set(pattern.name, pattern);
|
|
35534
35798
|
}
|
|
35535
35799
|
this.initialized = true;
|
|
35800
|
+
try {
|
|
35801
|
+
const modulePath = "@claude-flow/guidance/adversarial";
|
|
35802
|
+
const mod = await import(
|
|
35803
|
+
/* @vite-ignore */
|
|
35804
|
+
modulePath
|
|
35805
|
+
);
|
|
35806
|
+
if (mod && typeof mod.createThreatDetector === "function") {
|
|
35807
|
+
this.guidanceThreatDetector = mod.createThreatDetector();
|
|
35808
|
+
console.log("[AdversarialDefense] Guidance ThreatDetector loaded");
|
|
35809
|
+
}
|
|
35810
|
+
if (mod && typeof mod.createCollusionDetector === "function") {
|
|
35811
|
+
this.guidanceCollusionDetector = mod.createCollusionDetector();
|
|
35812
|
+
console.log("[AdversarialDefense] Guidance CollusionDetector loaded");
|
|
35813
|
+
}
|
|
35814
|
+
} catch {
|
|
35815
|
+
this.guidanceThreatDetector = null;
|
|
35816
|
+
this.guidanceCollusionDetector = null;
|
|
35817
|
+
}
|
|
35536
35818
|
}
|
|
35537
35819
|
/**
|
|
35538
35820
|
* Assess threat level of an input
|
|
@@ -35544,6 +35826,25 @@ var init_adversarial_defense_integration = __esm({
|
|
|
35544
35826
|
const flags = governanceFlags.getFlags().adversarialDefense;
|
|
35545
35827
|
const detectedPatterns = this.detectInjectionPatterns(input);
|
|
35546
35828
|
const blocklistMatches = this.checkBlocklist(input);
|
|
35829
|
+
if (this.guidanceThreatDetector && detectedPatterns.length === 0) {
|
|
35830
|
+
try {
|
|
35831
|
+
const guidanceContext = { agentId: context?.agentId || "", toolName: context?.taskType || "" };
|
|
35832
|
+
const signals = this.guidanceThreatDetector.analyzeInput(input, guidanceContext);
|
|
35833
|
+
if (signals && Array.isArray(signals) && signals.length > 0) {
|
|
35834
|
+
for (const signal of signals) {
|
|
35835
|
+
detectedPatterns.push({
|
|
35836
|
+
name: `guidance:${signal.category || "unknown"}`,
|
|
35837
|
+
category: signal.category || "custom",
|
|
35838
|
+
matched: signal.description || "",
|
|
35839
|
+
position: 0,
|
|
35840
|
+
severity: signal.severity || 0.5,
|
|
35841
|
+
description: signal.description || "Detected by guidance ThreatDetector"
|
|
35842
|
+
});
|
|
35843
|
+
}
|
|
35844
|
+
}
|
|
35845
|
+
} catch {
|
|
35846
|
+
}
|
|
35847
|
+
}
|
|
35547
35848
|
let threatScore = 0;
|
|
35548
35849
|
if (detectedPatterns.length > 0) {
|
|
35549
35850
|
const severities = detectedPatterns.map((p74) => p74.severity).sort((a37, b68) => b68 - a37);
|
|
@@ -35687,6 +35988,37 @@ var init_adversarial_defense_integration = __esm({
|
|
|
35687
35988
|
}
|
|
35688
35989
|
return matches;
|
|
35689
35990
|
}
|
|
35991
|
+
/**
|
|
35992
|
+
* Record an agent interaction for collusion detection
|
|
35993
|
+
*
|
|
35994
|
+
* Forwards to guidance CollusionDetector when available.
|
|
35995
|
+
* Call this whenever two agents interact during task execution.
|
|
35996
|
+
*/
|
|
35997
|
+
recordAgentInteraction(fromAgent, toAgent, contentHash) {
|
|
35998
|
+
if (!isAdversarialDefenseEnabled()) return;
|
|
35999
|
+
if (this.guidanceCollusionDetector) {
|
|
36000
|
+
try {
|
|
36001
|
+
this.guidanceCollusionDetector.recordInteraction(fromAgent, toAgent, contentHash);
|
|
36002
|
+
} catch {
|
|
36003
|
+
}
|
|
36004
|
+
}
|
|
36005
|
+
}
|
|
36006
|
+
/**
|
|
36007
|
+
* Check for collusion patterns among agents
|
|
36008
|
+
*
|
|
36009
|
+
* Delegates to guidance CollusionDetector when available.
|
|
36010
|
+
* Returns null if collusion detection is not available.
|
|
36011
|
+
*/
|
|
36012
|
+
detectCollusion() {
|
|
36013
|
+
if (!isAdversarialDefenseEnabled()) return null;
|
|
36014
|
+
if (this.guidanceCollusionDetector) {
|
|
36015
|
+
try {
|
|
36016
|
+
return this.guidanceCollusionDetector.detectCollusion();
|
|
36017
|
+
} catch {
|
|
36018
|
+
}
|
|
36019
|
+
}
|
|
36020
|
+
return null;
|
|
36021
|
+
}
|
|
35690
36022
|
/**
|
|
35691
36023
|
* Penalize an agent's trust score based on threat assessment
|
|
35692
36024
|
*/
|
|
@@ -36959,6 +37291,7 @@ var init_proof_envelope_integration = __esm({
|
|
|
36959
37291
|
kernel;
|
|
36960
37292
|
chain = [];
|
|
36961
37293
|
signingKey = "";
|
|
37294
|
+
guidanceProofChain = null;
|
|
36962
37295
|
initialized = false;
|
|
36963
37296
|
envelopeIndex = /* @__PURE__ */ new Map();
|
|
36964
37297
|
/**
|
|
@@ -36978,6 +37311,19 @@ var init_proof_envelope_integration = __esm({
|
|
|
36978
37311
|
if (this.initialized) return;
|
|
36979
37312
|
await this.kernel.initialize();
|
|
36980
37313
|
this.signingKey = signingKey;
|
|
37314
|
+
try {
|
|
37315
|
+
const modulePath = "@claude-flow/guidance/proof";
|
|
37316
|
+
const mod = await import(
|
|
37317
|
+
/* @vite-ignore */
|
|
37318
|
+
modulePath
|
|
37319
|
+
);
|
|
37320
|
+
if (mod && typeof mod.createProofChain === "function") {
|
|
37321
|
+
this.guidanceProofChain = mod.createProofChain({ signingKey });
|
|
37322
|
+
console.log("[ProofEnvelopeIntegration] Guidance ProofChain loaded");
|
|
37323
|
+
}
|
|
37324
|
+
} catch {
|
|
37325
|
+
this.guidanceProofChain = null;
|
|
37326
|
+
}
|
|
36981
37327
|
this.initialized = true;
|
|
36982
37328
|
}
|
|
36983
37329
|
/**
|
|
@@ -37081,6 +37427,31 @@ var init_proof_envelope_integration = __esm({
|
|
|
37081
37427
|
const index = this.chain.length;
|
|
37082
37428
|
this.chain.push(envelope);
|
|
37083
37429
|
this.envelopeIndex.set(envelope.id, index);
|
|
37430
|
+
if (this.guidanceProofChain) {
|
|
37431
|
+
try {
|
|
37432
|
+
const runEvent = {
|
|
37433
|
+
eventId: envelope.id,
|
|
37434
|
+
taskId: envelope.metadata?.taskId ? String(envelope.metadata.taskId) : envelope.id,
|
|
37435
|
+
guidanceHash: envelope.contentHash,
|
|
37436
|
+
retrievedRuleIds: [],
|
|
37437
|
+
toolsUsed: envelope.action ? [envelope.action] : [],
|
|
37438
|
+
filesTouched: [],
|
|
37439
|
+
diffSummary: { linesAdded: 0, linesRemoved: 0, filesChanged: 0 },
|
|
37440
|
+
testResults: { passed: 0, failed: 0, skipped: 0 },
|
|
37441
|
+
metrics: {},
|
|
37442
|
+
timestamp: new Date(envelope.timestamp).toISOString()
|
|
37443
|
+
};
|
|
37444
|
+
this.guidanceProofChain.append(
|
|
37445
|
+
runEvent,
|
|
37446
|
+
[],
|
|
37447
|
+
// toolCalls
|
|
37448
|
+
[],
|
|
37449
|
+
// memoryOps
|
|
37450
|
+
{ agentId: envelope.agentId, sessionId: envelope.metadata?.sessionId ? String(envelope.metadata.sessionId) : "aqe" }
|
|
37451
|
+
);
|
|
37452
|
+
} catch {
|
|
37453
|
+
}
|
|
37454
|
+
}
|
|
37084
37455
|
}
|
|
37085
37456
|
/**
|
|
37086
37457
|
* Get the current chain
|
|
@@ -39108,6 +39479,7 @@ var init_shard_retriever_integration = __esm({
|
|
|
39108
39479
|
cacheMisses = 0;
|
|
39109
39480
|
lastCacheCleanup = null;
|
|
39110
39481
|
parseErrors = [];
|
|
39482
|
+
guidanceRetriever = null;
|
|
39111
39483
|
initialized = false;
|
|
39112
39484
|
basePath;
|
|
39113
39485
|
constructor(basePath) {
|
|
@@ -39115,6 +39487,10 @@ var init_shard_retriever_integration = __esm({
|
|
|
39115
39487
|
}
|
|
39116
39488
|
/**
|
|
39117
39489
|
* Initialize the ShardRetrieverIntegration
|
|
39490
|
+
*
|
|
39491
|
+
* Attempts to load @claude-flow/guidance ShardRetriever for
|
|
39492
|
+
* embedding-based semantic shard matching. Falls back to local
|
|
39493
|
+
* filesystem-based loading with keyword matching.
|
|
39118
39494
|
*/
|
|
39119
39495
|
async initialize() {
|
|
39120
39496
|
if (this.initialized) return;
|
|
@@ -39122,6 +39498,19 @@ var init_shard_retriever_integration = __esm({
|
|
|
39122
39498
|
this.initialized = true;
|
|
39123
39499
|
return;
|
|
39124
39500
|
}
|
|
39501
|
+
try {
|
|
39502
|
+
const modulePath = "@claude-flow/guidance/retriever";
|
|
39503
|
+
const mod = await import(
|
|
39504
|
+
/* @vite-ignore */
|
|
39505
|
+
modulePath
|
|
39506
|
+
);
|
|
39507
|
+
if (mod && typeof mod.createRetriever === "function") {
|
|
39508
|
+
this.guidanceRetriever = mod.createRetriever();
|
|
39509
|
+
console.log("[ShardRetrieverIntegration] Guidance ShardRetriever loaded");
|
|
39510
|
+
}
|
|
39511
|
+
} catch {
|
|
39512
|
+
this.guidanceRetriever = null;
|
|
39513
|
+
}
|
|
39125
39514
|
await this.loadAllShards();
|
|
39126
39515
|
this.initialized = true;
|
|
39127
39516
|
}
|
|
@@ -39188,6 +39577,11 @@ var init_shard_retriever_integration = __esm({
|
|
|
39188
39577
|
}
|
|
39189
39578
|
/**
|
|
39190
39579
|
* Retrieve shards relevant to a task
|
|
39580
|
+
*
|
|
39581
|
+
* Local filesystem-based retrieval is authoritative. When guidance
|
|
39582
|
+
* ShardRetriever is available, its embedding-based results supplement
|
|
39583
|
+
* the local results by boosting relevance scores for shards that
|
|
39584
|
+
* guidance also considers relevant.
|
|
39191
39585
|
*/
|
|
39192
39586
|
async retrieveForTask(taskType, context) {
|
|
39193
39587
|
if (!isShardRetrieverEnabled()) {
|
|
@@ -39196,9 +39590,31 @@ var init_shard_retriever_integration = __esm({
|
|
|
39196
39590
|
await this.initialize();
|
|
39197
39591
|
const flags = getShardRetrieverFlags();
|
|
39198
39592
|
const allShards = await this.getAllCachedOrLoadedShards();
|
|
39593
|
+
const guidanceRelevantDomains = /* @__PURE__ */ new Set();
|
|
39594
|
+
if (this.guidanceRetriever) {
|
|
39595
|
+
try {
|
|
39596
|
+
const result = await this.guidanceRetriever.retrieve({
|
|
39597
|
+
taskDescription: `${taskType}: ${context.intent || ""} ${(context.keywords || []).join(" ")}`,
|
|
39598
|
+
maxShards: flags.maxShardsPerQuery
|
|
39599
|
+
});
|
|
39600
|
+
if (result && result.shards) {
|
|
39601
|
+
for (const s70 of result.shards) {
|
|
39602
|
+
if (s70.shard?.rule?.domains) {
|
|
39603
|
+
for (const d74 of s70.shard.rule.domains) {
|
|
39604
|
+
guidanceRelevantDomains.add(d74);
|
|
39605
|
+
}
|
|
39606
|
+
}
|
|
39607
|
+
}
|
|
39608
|
+
}
|
|
39609
|
+
} catch {
|
|
39610
|
+
}
|
|
39611
|
+
}
|
|
39199
39612
|
const scoredShards = [];
|
|
39200
39613
|
for (const shard of allShards.values()) {
|
|
39201
|
-
|
|
39614
|
+
let score = this.calculateRelevance(shard, { ...context, taskType });
|
|
39615
|
+
if (guidanceRelevantDomains.has(shard.domain)) {
|
|
39616
|
+
score = Math.min(1, score + 0.1);
|
|
39617
|
+
}
|
|
39202
39618
|
if (score >= flags.relevanceThreshold) {
|
|
39203
39619
|
scoredShards.push({ shard, score });
|
|
39204
39620
|
}
|
|
@@ -41688,11 +42104,11 @@ __export(sona_exports, {
|
|
|
41688
42104
|
init: () => init4,
|
|
41689
42105
|
pipeline: () => pipeline5
|
|
41690
42106
|
});
|
|
41691
|
-
import { createRequire as
|
|
42107
|
+
import { createRequire as createRequire5 } from "module";
|
|
41692
42108
|
var __require5, __mod4, sona_default, RuvectorLayer4, TensorCompress4, differentiableSearch4, hierarchicalForward4, getCompressionLevel4, init4, FlashAttention4, DotProductAttention4, MultiHeadAttention4, HyperbolicAttention4, LinearAttention4, MoEAttention4, SonaEngine4, pipeline5;
|
|
41693
42109
|
var init_sona = __esm({
|
|
41694
42110
|
"native-require:@ruvector/sona"() {
|
|
41695
|
-
__require5 =
|
|
42111
|
+
__require5 = createRequire5(import.meta.url);
|
|
41696
42112
|
__mod4 = __require5("@ruvector/sona");
|
|
41697
42113
|
sona_default = __mod4;
|
|
41698
42114
|
({
|
|
@@ -43126,11 +43542,11 @@ __export(attention_exports, {
|
|
|
43126
43542
|
init: () => init5,
|
|
43127
43543
|
pipeline: () => pipeline6
|
|
43128
43544
|
});
|
|
43129
|
-
import { createRequire as
|
|
43545
|
+
import { createRequire as createRequire6 } from "module";
|
|
43130
43546
|
var __require6, __mod5, attention_default, RuvectorLayer5, TensorCompress5, differentiableSearch5, hierarchicalForward5, getCompressionLevel5, init5, FlashAttention5, DotProductAttention5, MultiHeadAttention5, HyperbolicAttention5, LinearAttention5, MoEAttention5, SonaEngine5, pipeline6;
|
|
43131
43547
|
var init_attention = __esm({
|
|
43132
43548
|
"native-require:@ruvector/attention"() {
|
|
43133
|
-
__require6 =
|
|
43549
|
+
__require6 = createRequire6(import.meta.url);
|
|
43134
43550
|
__mod5 = __require6("@ruvector/attention");
|
|
43135
43551
|
attention_default = __mod5;
|
|
43136
43552
|
({
|
|
@@ -62259,20 +62675,20 @@ var init_quality_gate = __esm({
|
|
|
62259
62675
|
});
|
|
62260
62676
|
|
|
62261
62677
|
// src/shared/parsers/typescript-parser.ts
|
|
62262
|
-
import * as ts3 from "typescript/lib/typescript.js";
|
|
62263
62678
|
var TypeScriptParser, typescriptParser, TypeScriptLanguageParser, typescriptLanguageParser;
|
|
62264
62679
|
var init_typescript_parser = __esm({
|
|
62265
62680
|
"src/shared/parsers/typescript-parser.ts"() {
|
|
62266
62681
|
"use strict";
|
|
62682
|
+
init_typescript();
|
|
62267
62683
|
TypeScriptParser = class {
|
|
62268
62684
|
/**
|
|
62269
62685
|
* Parse a TypeScript file and return the AST SourceFile
|
|
62270
62686
|
*/
|
|
62271
62687
|
parseFile(filePath, content) {
|
|
62272
|
-
return
|
|
62688
|
+
return typescript_default.createSourceFile(
|
|
62273
62689
|
filePath,
|
|
62274
62690
|
content,
|
|
62275
|
-
|
|
62691
|
+
typescript_default.ScriptTarget.Latest,
|
|
62276
62692
|
true,
|
|
62277
62693
|
this.getScriptKind(filePath)
|
|
62278
62694
|
);
|
|
@@ -62283,14 +62699,14 @@ var init_typescript_parser = __esm({
|
|
|
62283
62699
|
extractFunctions(ast) {
|
|
62284
62700
|
const functions = [];
|
|
62285
62701
|
const visit = (node) => {
|
|
62286
|
-
if (
|
|
62702
|
+
if (typescript_default.isFunctionDeclaration(node) && node.name) {
|
|
62287
62703
|
functions.push(this.extractFunctionDeclaration(node, ast));
|
|
62288
|
-
} else if (
|
|
62704
|
+
} else if (typescript_default.isVariableStatement(node)) {
|
|
62289
62705
|
this.extractArrowFunctions(node, ast, functions);
|
|
62290
62706
|
}
|
|
62291
|
-
|
|
62707
|
+
typescript_default.forEachChild(node, visit);
|
|
62292
62708
|
};
|
|
62293
|
-
|
|
62709
|
+
typescript_default.forEachChild(ast, visit);
|
|
62294
62710
|
return functions;
|
|
62295
62711
|
}
|
|
62296
62712
|
/**
|
|
@@ -62299,12 +62715,12 @@ var init_typescript_parser = __esm({
|
|
|
62299
62715
|
extractClasses(ast) {
|
|
62300
62716
|
const classes = [];
|
|
62301
62717
|
const visit = (node) => {
|
|
62302
|
-
if (
|
|
62718
|
+
if (typescript_default.isClassDeclaration(node) && node.name) {
|
|
62303
62719
|
classes.push(this.extractClassDeclaration(node, ast));
|
|
62304
62720
|
}
|
|
62305
|
-
|
|
62721
|
+
typescript_default.forEachChild(node, visit);
|
|
62306
62722
|
};
|
|
62307
|
-
|
|
62723
|
+
typescript_default.forEachChild(ast, visit);
|
|
62308
62724
|
return classes;
|
|
62309
62725
|
}
|
|
62310
62726
|
/**
|
|
@@ -62313,12 +62729,12 @@ var init_typescript_parser = __esm({
|
|
|
62313
62729
|
extractImports(ast) {
|
|
62314
62730
|
const imports = [];
|
|
62315
62731
|
const visit = (node) => {
|
|
62316
|
-
if (
|
|
62732
|
+
if (typescript_default.isImportDeclaration(node)) {
|
|
62317
62733
|
imports.push(this.extractImportDeclaration(node));
|
|
62318
62734
|
}
|
|
62319
|
-
|
|
62735
|
+
typescript_default.forEachChild(node, visit);
|
|
62320
62736
|
};
|
|
62321
|
-
|
|
62737
|
+
typescript_default.forEachChild(ast, visit);
|
|
62322
62738
|
return imports;
|
|
62323
62739
|
}
|
|
62324
62740
|
/**
|
|
@@ -62327,9 +62743,9 @@ var init_typescript_parser = __esm({
|
|
|
62327
62743
|
extractExports(ast) {
|
|
62328
62744
|
const exports = [];
|
|
62329
62745
|
const visit = (node) => {
|
|
62330
|
-
if (
|
|
62746
|
+
if (typescript_default.isExportDeclaration(node)) {
|
|
62331
62747
|
this.extractExportDeclaration(node, exports);
|
|
62332
|
-
} else if (
|
|
62748
|
+
} else if (typescript_default.isExportAssignment(node)) {
|
|
62333
62749
|
exports.push({
|
|
62334
62750
|
name: this.getExportAssignmentName(node),
|
|
62335
62751
|
type: "unknown",
|
|
@@ -62337,7 +62753,7 @@ var init_typescript_parser = __esm({
|
|
|
62337
62753
|
isReexport: false,
|
|
62338
62754
|
sourceModule: void 0
|
|
62339
62755
|
});
|
|
62340
|
-
} else if (
|
|
62756
|
+
} else if (typescript_default.isFunctionDeclaration(node) && node.name && this.hasExportModifier(node)) {
|
|
62341
62757
|
exports.push({
|
|
62342
62758
|
name: node.name.text,
|
|
62343
62759
|
type: "function",
|
|
@@ -62345,7 +62761,7 @@ var init_typescript_parser = __esm({
|
|
|
62345
62761
|
isReexport: false,
|
|
62346
62762
|
sourceModule: void 0
|
|
62347
62763
|
});
|
|
62348
|
-
} else if (
|
|
62764
|
+
} else if (typescript_default.isClassDeclaration(node) && node.name && this.hasExportModifier(node)) {
|
|
62349
62765
|
exports.push({
|
|
62350
62766
|
name: node.name.text,
|
|
62351
62767
|
type: "class",
|
|
@@ -62353,9 +62769,9 @@ var init_typescript_parser = __esm({
|
|
|
62353
62769
|
isReexport: false,
|
|
62354
62770
|
sourceModule: void 0
|
|
62355
62771
|
});
|
|
62356
|
-
} else if (
|
|
62772
|
+
} else if (typescript_default.isVariableStatement(node) && this.hasExportModifier(node)) {
|
|
62357
62773
|
for (const declaration of node.declarationList.declarations) {
|
|
62358
|
-
if (
|
|
62774
|
+
if (typescript_default.isIdentifier(declaration.name)) {
|
|
62359
62775
|
exports.push({
|
|
62360
62776
|
name: declaration.name.text,
|
|
62361
62777
|
type: "variable",
|
|
@@ -62365,7 +62781,7 @@ var init_typescript_parser = __esm({
|
|
|
62365
62781
|
});
|
|
62366
62782
|
}
|
|
62367
62783
|
}
|
|
62368
|
-
} else if (
|
|
62784
|
+
} else if (typescript_default.isInterfaceDeclaration(node) && this.hasExportModifier(node)) {
|
|
62369
62785
|
exports.push({
|
|
62370
62786
|
name: node.name.text,
|
|
62371
62787
|
type: "interface",
|
|
@@ -62373,7 +62789,7 @@ var init_typescript_parser = __esm({
|
|
|
62373
62789
|
isReexport: false,
|
|
62374
62790
|
sourceModule: void 0
|
|
62375
62791
|
});
|
|
62376
|
-
} else if (
|
|
62792
|
+
} else if (typescript_default.isTypeAliasDeclaration(node) && this.hasExportModifier(node)) {
|
|
62377
62793
|
exports.push({
|
|
62378
62794
|
name: node.name.text,
|
|
62379
62795
|
type: "type",
|
|
@@ -62381,7 +62797,7 @@ var init_typescript_parser = __esm({
|
|
|
62381
62797
|
isReexport: false,
|
|
62382
62798
|
sourceModule: void 0
|
|
62383
62799
|
});
|
|
62384
|
-
} else if (
|
|
62800
|
+
} else if (typescript_default.isEnumDeclaration(node) && this.hasExportModifier(node)) {
|
|
62385
62801
|
exports.push({
|
|
62386
62802
|
name: node.name.text,
|
|
62387
62803
|
type: "enum",
|
|
@@ -62390,9 +62806,9 @@ var init_typescript_parser = __esm({
|
|
|
62390
62806
|
sourceModule: void 0
|
|
62391
62807
|
});
|
|
62392
62808
|
}
|
|
62393
|
-
|
|
62809
|
+
typescript_default.forEachChild(node, visit);
|
|
62394
62810
|
};
|
|
62395
|
-
|
|
62811
|
+
typescript_default.forEachChild(ast, visit);
|
|
62396
62812
|
return exports;
|
|
62397
62813
|
}
|
|
62398
62814
|
/**
|
|
@@ -62401,12 +62817,12 @@ var init_typescript_parser = __esm({
|
|
|
62401
62817
|
extractInterfaces(ast) {
|
|
62402
62818
|
const interfaces = [];
|
|
62403
62819
|
const visit = (node) => {
|
|
62404
|
-
if (
|
|
62820
|
+
if (typescript_default.isInterfaceDeclaration(node)) {
|
|
62405
62821
|
interfaces.push(this.extractInterfaceDeclaration(node, ast));
|
|
62406
62822
|
}
|
|
62407
|
-
|
|
62823
|
+
typescript_default.forEachChild(node, visit);
|
|
62408
62824
|
};
|
|
62409
|
-
|
|
62825
|
+
typescript_default.forEachChild(ast, visit);
|
|
62410
62826
|
return interfaces;
|
|
62411
62827
|
}
|
|
62412
62828
|
/**
|
|
@@ -62462,11 +62878,11 @@ var init_typescript_parser = __esm({
|
|
|
62462
62878
|
// Private Helper Methods
|
|
62463
62879
|
// ============================================================================
|
|
62464
62880
|
getScriptKind(filePath) {
|
|
62465
|
-
if (filePath.endsWith(".tsx")) return
|
|
62466
|
-
if (filePath.endsWith(".ts")) return
|
|
62467
|
-
if (filePath.endsWith(".jsx")) return
|
|
62468
|
-
if (filePath.endsWith(".js")) return
|
|
62469
|
-
return
|
|
62881
|
+
if (filePath.endsWith(".tsx")) return typescript_default.ScriptKind.TSX;
|
|
62882
|
+
if (filePath.endsWith(".ts")) return typescript_default.ScriptKind.TS;
|
|
62883
|
+
if (filePath.endsWith(".jsx")) return typescript_default.ScriptKind.JSX;
|
|
62884
|
+
if (filePath.endsWith(".js")) return typescript_default.ScriptKind.JS;
|
|
62885
|
+
return typescript_default.ScriptKind.TS;
|
|
62470
62886
|
}
|
|
62471
62887
|
extractFunctionDeclaration(node, sourceFile) {
|
|
62472
62888
|
const { line: startLine } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
@@ -62485,7 +62901,7 @@ var init_typescript_parser = __esm({
|
|
|
62485
62901
|
}
|
|
62486
62902
|
extractArrowFunctions(node, sourceFile, functions) {
|
|
62487
62903
|
for (const declaration of node.declarationList.declarations) {
|
|
62488
|
-
if (
|
|
62904
|
+
if (typescript_default.isIdentifier(declaration.name) && declaration.initializer && typescript_default.isArrowFunction(declaration.initializer)) {
|
|
62489
62905
|
const arrow = declaration.initializer;
|
|
62490
62906
|
const { line: startLine } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
62491
62907
|
const { line: endLine } = sourceFile.getLineAndCharacterOfPosition(node.getEnd());
|
|
@@ -62509,11 +62925,11 @@ var init_typescript_parser = __esm({
|
|
|
62509
62925
|
const methods = [];
|
|
62510
62926
|
const properties = [];
|
|
62511
62927
|
for (const member of node.members) {
|
|
62512
|
-
if (
|
|
62928
|
+
if (typescript_default.isMethodDeclaration(member) && member.name) {
|
|
62513
62929
|
methods.push(this.extractMethodDeclaration(member, sourceFile));
|
|
62514
|
-
} else if (
|
|
62930
|
+
} else if (typescript_default.isPropertyDeclaration(member) && member.name) {
|
|
62515
62931
|
properties.push(this.extractPropertyDeclaration(member, sourceFile));
|
|
62516
|
-
} else if (
|
|
62932
|
+
} else if (typescript_default.isConstructorDeclaration(member)) {
|
|
62517
62933
|
methods.push(this.extractConstructor(member, sourceFile));
|
|
62518
62934
|
this.extractParameterProperties(member, properties, sourceFile);
|
|
62519
62935
|
}
|
|
@@ -62522,9 +62938,9 @@ var init_typescript_parser = __esm({
|
|
|
62522
62938
|
const implementsClause = [];
|
|
62523
62939
|
if (node.heritageClauses) {
|
|
62524
62940
|
for (const clause of node.heritageClauses) {
|
|
62525
|
-
if (clause.token ===
|
|
62941
|
+
if (clause.token === typescript_default.SyntaxKind.ExtendsKeyword) {
|
|
62526
62942
|
extendsClause = clause.types[0]?.expression.getText(sourceFile);
|
|
62527
|
-
} else if (clause.token ===
|
|
62943
|
+
} else if (clause.token === typescript_default.SyntaxKind.ImplementsKeyword) {
|
|
62528
62944
|
for (const type of clause.types) {
|
|
62529
62945
|
implementsClause.push(type.expression.getText(sourceFile));
|
|
62530
62946
|
}
|
|
@@ -62578,7 +62994,7 @@ var init_typescript_parser = __esm({
|
|
|
62578
62994
|
for (const param of node.parameters) {
|
|
62579
62995
|
if (this.isParameterProperty(param)) {
|
|
62580
62996
|
properties.push({
|
|
62581
|
-
name:
|
|
62997
|
+
name: typescript_default.isIdentifier(param.name) ? param.name.text : param.name.getText(sourceFile),
|
|
62582
62998
|
type: param.type ? param.type.getText(sourceFile) : void 0,
|
|
62583
62999
|
isStatic: false,
|
|
62584
63000
|
isReadonly: this.hasReadonlyModifier(param),
|
|
@@ -62590,7 +63006,7 @@ var init_typescript_parser = __esm({
|
|
|
62590
63006
|
}
|
|
62591
63007
|
isParameterProperty(param) {
|
|
62592
63008
|
return !!param.modifiers?.some(
|
|
62593
|
-
(m74) => m74.kind ===
|
|
63009
|
+
(m74) => m74.kind === typescript_default.SyntaxKind.PublicKeyword || m74.kind === typescript_default.SyntaxKind.PrivateKeyword || m74.kind === typescript_default.SyntaxKind.ProtectedKeyword || m74.kind === typescript_default.SyntaxKind.ReadonlyKeyword
|
|
62594
63010
|
);
|
|
62595
63011
|
}
|
|
62596
63012
|
extractPropertyDeclaration(node, sourceFile) {
|
|
@@ -62614,9 +63030,9 @@ var init_typescript_parser = __esm({
|
|
|
62614
63030
|
defaultImport = node.importClause.name.text;
|
|
62615
63031
|
}
|
|
62616
63032
|
if (node.importClause.namedBindings) {
|
|
62617
|
-
if (
|
|
63033
|
+
if (typescript_default.isNamespaceImport(node.importClause.namedBindings)) {
|
|
62618
63034
|
namespaceImport = node.importClause.namedBindings.name.text;
|
|
62619
|
-
} else if (
|
|
63035
|
+
} else if (typescript_default.isNamedImports(node.importClause.namedBindings)) {
|
|
62620
63036
|
for (const element of node.importClause.namedBindings.elements) {
|
|
62621
63037
|
namedImports.push({
|
|
62622
63038
|
name: element.propertyName?.text ?? element.name.text,
|
|
@@ -62636,7 +63052,7 @@ var init_typescript_parser = __esm({
|
|
|
62636
63052
|
}
|
|
62637
63053
|
extractExportDeclaration(node, exports) {
|
|
62638
63054
|
const sourceModule = node.moduleSpecifier ? node.moduleSpecifier.text : void 0;
|
|
62639
|
-
if (node.exportClause &&
|
|
63055
|
+
if (node.exportClause && typescript_default.isNamedExports(node.exportClause)) {
|
|
62640
63056
|
for (const element of node.exportClause.elements) {
|
|
62641
63057
|
exports.push({
|
|
62642
63058
|
name: element.name.text,
|
|
@@ -62662,14 +63078,14 @@ var init_typescript_parser = __esm({
|
|
|
62662
63078
|
const properties = [];
|
|
62663
63079
|
const methods = [];
|
|
62664
63080
|
for (const member of node.members) {
|
|
62665
|
-
if (
|
|
63081
|
+
if (typescript_default.isPropertySignature(member) && member.name) {
|
|
62666
63082
|
properties.push({
|
|
62667
63083
|
name: this.getPropertyName(member.name, sourceFile),
|
|
62668
63084
|
type: member.type ? member.type.getText(sourceFile) : void 0,
|
|
62669
63085
|
isOptional: !!member.questionToken,
|
|
62670
63086
|
isReadonly: this.hasReadonlyModifier(member)
|
|
62671
63087
|
});
|
|
62672
|
-
} else if (
|
|
63088
|
+
} else if (typescript_default.isMethodSignature(member) && member.name) {
|
|
62673
63089
|
methods.push({
|
|
62674
63090
|
name: this.getPropertyName(member.name, sourceFile),
|
|
62675
63091
|
parameters: this.extractParameters(member.parameters),
|
|
@@ -62681,7 +63097,7 @@ var init_typescript_parser = __esm({
|
|
|
62681
63097
|
const extendsClause = [];
|
|
62682
63098
|
if (node.heritageClauses) {
|
|
62683
63099
|
for (const clause of node.heritageClauses) {
|
|
62684
|
-
if (clause.token ===
|
|
63100
|
+
if (clause.token === typescript_default.SyntaxKind.ExtendsKeyword) {
|
|
62685
63101
|
for (const type of clause.types) {
|
|
62686
63102
|
extendsClause.push(type.expression.getText(sourceFile));
|
|
62687
63103
|
}
|
|
@@ -62703,7 +63119,7 @@ var init_typescript_parser = __esm({
|
|
|
62703
63119
|
return parameters.map((param) => {
|
|
62704
63120
|
const sourceFile = param.getSourceFile();
|
|
62705
63121
|
return {
|
|
62706
|
-
name:
|
|
63122
|
+
name: typescript_default.isIdentifier(param.name) ? param.name.text : param.name.getText(sourceFile),
|
|
62707
63123
|
type: param.type ? param.type.getText(sourceFile) : void 0,
|
|
62708
63124
|
isOptional: !!param.questionToken || !!param.initializer,
|
|
62709
63125
|
isRest: !!param.dotDotDotToken,
|
|
@@ -62716,49 +63132,49 @@ var init_typescript_parser = __esm({
|
|
|
62716
63132
|
return typeParams.map((tp) => tp.name.text);
|
|
62717
63133
|
}
|
|
62718
63134
|
getPropertyName(name, sourceFile) {
|
|
62719
|
-
if (
|
|
63135
|
+
if (typescript_default.isIdentifier(name)) {
|
|
62720
63136
|
return name.text;
|
|
62721
63137
|
}
|
|
62722
|
-
if (
|
|
63138
|
+
if (typescript_default.isStringLiteral(name)) {
|
|
62723
63139
|
return name.text;
|
|
62724
63140
|
}
|
|
62725
|
-
if (
|
|
63141
|
+
if (typescript_default.isNumericLiteral(name)) {
|
|
62726
63142
|
return name.text;
|
|
62727
63143
|
}
|
|
62728
63144
|
return name.getText(sourceFile);
|
|
62729
63145
|
}
|
|
62730
63146
|
getExportAssignmentName(node) {
|
|
62731
|
-
if (
|
|
63147
|
+
if (typescript_default.isIdentifier(node.expression)) {
|
|
62732
63148
|
return node.expression.text;
|
|
62733
63149
|
}
|
|
62734
63150
|
return "default";
|
|
62735
63151
|
}
|
|
62736
63152
|
hasExportModifier(node) {
|
|
62737
|
-
return
|
|
63153
|
+
return typescript_default.canHaveModifiers(node) && !!typescript_default.getModifiers(node)?.some((m74) => m74.kind === typescript_default.SyntaxKind.ExportKeyword);
|
|
62738
63154
|
}
|
|
62739
63155
|
hasDefaultModifier(node) {
|
|
62740
|
-
return
|
|
63156
|
+
return typescript_default.canHaveModifiers(node) && !!typescript_default.getModifiers(node)?.some((m74) => m74.kind === typescript_default.SyntaxKind.DefaultKeyword);
|
|
62741
63157
|
}
|
|
62742
63158
|
hasAsyncModifier(node) {
|
|
62743
|
-
return
|
|
63159
|
+
return typescript_default.canHaveModifiers(node) && !!typescript_default.getModifiers(node)?.some((m74) => m74.kind === typescript_default.SyntaxKind.AsyncKeyword);
|
|
62744
63160
|
}
|
|
62745
63161
|
hasStaticModifier(node) {
|
|
62746
|
-
return
|
|
63162
|
+
return typescript_default.canHaveModifiers(node) && !!typescript_default.getModifiers(node)?.some((m74) => m74.kind === typescript_default.SyntaxKind.StaticKeyword);
|
|
62747
63163
|
}
|
|
62748
63164
|
hasAbstractModifier(node) {
|
|
62749
|
-
return
|
|
63165
|
+
return typescript_default.canHaveModifiers(node) && !!typescript_default.getModifiers(node)?.some((m74) => m74.kind === typescript_default.SyntaxKind.AbstractKeyword);
|
|
62750
63166
|
}
|
|
62751
63167
|
hasReadonlyModifier(node) {
|
|
62752
|
-
return
|
|
63168
|
+
return typescript_default.canHaveModifiers(node) && !!typescript_default.getModifiers(node)?.some((m74) => m74.kind === typescript_default.SyntaxKind.ReadonlyKeyword);
|
|
62753
63169
|
}
|
|
62754
63170
|
getVisibility(node) {
|
|
62755
|
-
if (!
|
|
62756
|
-
const modifiers =
|
|
63171
|
+
if (!typescript_default.canHaveModifiers(node)) return "public";
|
|
63172
|
+
const modifiers = typescript_default.getModifiers(node);
|
|
62757
63173
|
if (!modifiers) return "public";
|
|
62758
|
-
if (modifiers.some((m74) => m74.kind ===
|
|
63174
|
+
if (modifiers.some((m74) => m74.kind === typescript_default.SyntaxKind.PrivateKeyword)) {
|
|
62759
63175
|
return "private";
|
|
62760
63176
|
}
|
|
62761
|
-
if (modifiers.some((m74) => m74.kind ===
|
|
63177
|
+
if (modifiers.some((m74) => m74.kind === typescript_default.SyntaxKind.ProtectedKeyword)) {
|
|
62762
63178
|
return "protected";
|
|
62763
63179
|
}
|
|
62764
63180
|
return "public";
|
|
@@ -66621,14 +67037,22 @@ var init_test_verifier = __esm({
|
|
|
66621
67037
|
});
|
|
66622
67038
|
|
|
66623
67039
|
// src/agents/claim-verifier/verifiers/output-verifier.ts
|
|
66624
|
-
import {
|
|
67040
|
+
import { execFile } from "node:child_process";
|
|
66625
67041
|
import { promisify as promisify3 } from "node:util";
|
|
66626
|
-
var
|
|
67042
|
+
var execFileAsync, ALLOWED_COMMANDS, OutputBasedVerifier;
|
|
66627
67043
|
var init_output_verifier = __esm({
|
|
66628
67044
|
"src/agents/claim-verifier/verifiers/output-verifier.ts"() {
|
|
66629
67045
|
"use strict";
|
|
66630
67046
|
init_claim_verifier();
|
|
66631
|
-
|
|
67047
|
+
execFileAsync = promisify3(execFile);
|
|
67048
|
+
ALLOWED_COMMANDS = /* @__PURE__ */ new Map([
|
|
67049
|
+
["npm run build", { bin: "npm", args: ["run", "build"] }],
|
|
67050
|
+
["npm run lint", { bin: "npm", args: ["run", "lint"] }],
|
|
67051
|
+
["npm test", { bin: "npm", args: ["test"] }],
|
|
67052
|
+
["npm run typecheck", { bin: "npm", args: ["run", "typecheck"] }],
|
|
67053
|
+
["npm run test:unit", { bin: "npm", args: ["run", "test:unit"] }],
|
|
67054
|
+
["npm run test:ci", { bin: "npm", args: ["run", "test:ci"] }]
|
|
67055
|
+
]);
|
|
66632
67056
|
OutputBasedVerifier = class {
|
|
66633
67057
|
config;
|
|
66634
67058
|
/**
|
|
@@ -66753,11 +67177,18 @@ var init_output_verifier = __esm({
|
|
|
66753
67177
|
}
|
|
66754
67178
|
/**
|
|
66755
67179
|
* Execute a command and capture output.
|
|
67180
|
+
* Uses execFile with an allowlist to prevent command injection (CWE-78).
|
|
66756
67181
|
*/
|
|
66757
67182
|
async executeCommand(command) {
|
|
66758
67183
|
const startTime = Date.now();
|
|
67184
|
+
const allowed = ALLOWED_COMMANDS.get(command);
|
|
67185
|
+
if (!allowed) {
|
|
67186
|
+
throw new Error(
|
|
67187
|
+
`Command not in allowlist: "${command}". Allowed: ${[...ALLOWED_COMMANDS.keys()].join(", ")}`
|
|
67188
|
+
);
|
|
67189
|
+
}
|
|
66759
67190
|
try {
|
|
66760
|
-
const { stdout, stderr } = await
|
|
67191
|
+
const { stdout, stderr } = await execFileAsync(allowed.bin, [...allowed.args], {
|
|
66761
67192
|
cwd: this.config.rootDir,
|
|
66762
67193
|
timeout: this.config.timeout,
|
|
66763
67194
|
maxBuffer: this.config.maxOutputSize,
|
|
@@ -100311,7 +100742,7 @@ var init_plugin10 = __esm({
|
|
|
100311
100742
|
|
|
100312
100743
|
// src/domains/chaos-resilience/services/chaos-engineer.ts
|
|
100313
100744
|
import * as net from "net";
|
|
100314
|
-
import { execFile } from "child_process";
|
|
100745
|
+
import { execFile as execFile2 } from "child_process";
|
|
100315
100746
|
var DEFAULT_CONFIG55, ChaosEngineerService;
|
|
100316
100747
|
var init_chaos_engineer = __esm({
|
|
100317
100748
|
"src/domains/chaos-resilience/services/chaos-engineer.ts"() {
|
|
@@ -100821,7 +101252,7 @@ Provide:
|
|
|
100821
101252
|
const parts = sanitizedCommand.trim().split(/\s+/);
|
|
100822
101253
|
const executable = parts[0];
|
|
100823
101254
|
const args = parts.slice(1);
|
|
100824
|
-
|
|
101255
|
+
execFile2(executable, args, { timeout }, (error, stdout, _stderr) => {
|
|
100825
101256
|
if (error) {
|
|
100826
101257
|
console.log(`Command probe failed: ${probe.name} -> ${error.message}`);
|
|
100827
101258
|
resolve10(false);
|
|
@@ -101165,7 +101596,7 @@ Provide:
|
|
|
101165
101596
|
const parts = sanitizedCommand.trim().split(/\s+/);
|
|
101166
101597
|
const executable = parts[0];
|
|
101167
101598
|
const args = parts.slice(1);
|
|
101168
|
-
|
|
101599
|
+
execFile2(executable, args, { timeout }, (error, _stdout, stderr) => {
|
|
101169
101600
|
if (error) {
|
|
101170
101601
|
reject(new Error(`Command rollback failed: ${error.message}. ${stderr}`));
|
|
101171
101602
|
} else {
|
|
@@ -113834,12 +114265,12 @@ var init_coverage_analysis = __esm({
|
|
|
113834
114265
|
});
|
|
113835
114266
|
|
|
113836
114267
|
// src/domains/security-compliance/services/semgrep-integration.ts
|
|
113837
|
-
import { execFile as
|
|
114268
|
+
import { execFile as execFile3 } from "child_process";
|
|
113838
114269
|
import { promisify as promisify4 } from "util";
|
|
113839
114270
|
import * as path16 from "path";
|
|
113840
114271
|
async function isSemgrepAvailable() {
|
|
113841
114272
|
try {
|
|
113842
|
-
await
|
|
114273
|
+
await execFileAsync2("semgrep", ["--version"], { timeout: 5e3 });
|
|
113843
114274
|
return true;
|
|
113844
114275
|
} catch {
|
|
113845
114276
|
return false;
|
|
@@ -113847,7 +114278,7 @@ async function isSemgrepAvailable() {
|
|
|
113847
114278
|
}
|
|
113848
114279
|
async function getSemgrepVersion() {
|
|
113849
114280
|
try {
|
|
113850
|
-
const { stdout } = await
|
|
114281
|
+
const { stdout } = await execFileAsync2("semgrep", ["--version"], { timeout: 5e3 });
|
|
113851
114282
|
return stdout.trim();
|
|
113852
114283
|
} catch {
|
|
113853
114284
|
return null;
|
|
@@ -113884,7 +114315,7 @@ async function runSemgrep(config) {
|
|
|
113884
114315
|
}
|
|
113885
114316
|
args.push(fullConfig.target);
|
|
113886
114317
|
const timeoutMs = (fullConfig.timeout ?? 300) * 1e3;
|
|
113887
|
-
const { stdout, stderr } = await
|
|
114318
|
+
const { stdout, stderr } = await execFileAsync2("semgrep", args, {
|
|
113888
114319
|
timeout: timeoutMs,
|
|
113889
114320
|
maxBuffer: 50 * 1024 * 1024,
|
|
113890
114321
|
// 50MB buffer for large results
|
|
@@ -113996,13 +114427,13 @@ function convertSemgrepFindings(findings) {
|
|
|
113996
114427
|
references: f74.extra.metadata?.references || []
|
|
113997
114428
|
}));
|
|
113998
114429
|
}
|
|
113999
|
-
var
|
|
114430
|
+
var execFileAsync2;
|
|
114000
114431
|
var init_semgrep_integration = __esm({
|
|
114001
114432
|
"src/domains/security-compliance/services/semgrep-integration.ts"() {
|
|
114002
114433
|
"use strict";
|
|
114003
114434
|
init_error_utils();
|
|
114004
114435
|
init_safe_json();
|
|
114005
|
-
|
|
114436
|
+
execFileAsync2 = promisify4(execFile3);
|
|
114006
114437
|
}
|
|
114007
114438
|
});
|
|
114008
114439
|
|
|
@@ -126419,12 +126850,12 @@ __export(agent_booster_wasm_exports, {
|
|
|
126419
126850
|
transform: () => transform,
|
|
126420
126851
|
warmup: () => warmup
|
|
126421
126852
|
});
|
|
126422
|
-
import { createRequire as
|
|
126853
|
+
import { createRequire as createRequire7 } from "module";
|
|
126423
126854
|
async function loadWasm() {
|
|
126424
126855
|
if (wasmModule) return true;
|
|
126425
126856
|
if (loadError) return false;
|
|
126426
126857
|
try {
|
|
126427
|
-
const require3 =
|
|
126858
|
+
const require3 = createRequire7(import.meta.url);
|
|
126428
126859
|
wasmModule = require3("./agent_booster_wasm.js");
|
|
126429
126860
|
if (!wasmModule) {
|
|
126430
126861
|
throw new Error("WASM module loaded but is null");
|
|
@@ -128776,11 +129207,11 @@ __export(hnswlib_node_exports, {
|
|
|
128776
129207
|
init: () => init6,
|
|
128777
129208
|
pipeline: () => pipeline7
|
|
128778
129209
|
});
|
|
128779
|
-
import { createRequire as
|
|
129210
|
+
import { createRequire as createRequire8 } from "module";
|
|
128780
129211
|
var __require7, __mod6, hnswlib_node_default, RuvectorLayer6, TensorCompress6, differentiableSearch6, hierarchicalForward6, getCompressionLevel6, init6, FlashAttention6, DotProductAttention6, MultiHeadAttention6, HyperbolicAttention6, LinearAttention6, MoEAttention6, SonaEngine6, pipeline7;
|
|
128781
129212
|
var init_hnswlib_node = __esm({
|
|
128782
129213
|
"native-require:hnswlib-node"() {
|
|
128783
|
-
__require7 =
|
|
129214
|
+
__require7 = createRequire8(import.meta.url);
|
|
128784
129215
|
__mod6 = __require7("hnswlib-node");
|
|
128785
129216
|
hnswlib_node_default = __mod6;
|
|
128786
129217
|
({
|
|
@@ -143929,8 +144360,8 @@ var init_trajectory_bridge = __esm({
|
|
|
143929
144360
|
try {
|
|
143930
144361
|
const { join: join32 } = await import("path");
|
|
143931
144362
|
const { existsSync: existsSync21, mkdirSync: mkdirSync6 } = await import("fs");
|
|
143932
|
-
const { createRequire:
|
|
143933
|
-
const require3 =
|
|
144363
|
+
const { createRequire: createRequire13 } = await import("module");
|
|
144364
|
+
const require3 = createRequire13(import.meta.url);
|
|
143934
144365
|
const { openDatabase: openDatabase2 } = require3("../../shared/safe-db.js");
|
|
143935
144366
|
const dbPath = join32(this.options.projectRoot, ".agentic-qe", "trajectories.db");
|
|
143936
144367
|
const dir = join32(this.options.projectRoot, ".agentic-qe");
|
|
@@ -147836,11 +148267,11 @@ __export(prime_radiant_advanced_wasm_exports, {
|
|
|
147836
148267
|
init: () => init7,
|
|
147837
148268
|
pipeline: () => pipeline8
|
|
147838
148269
|
});
|
|
147839
|
-
import { createRequire as
|
|
148270
|
+
import { createRequire as createRequire9 } from "module";
|
|
147840
148271
|
var __require8, __mod7, prime_radiant_advanced_wasm_default, RuvectorLayer7, TensorCompress7, differentiableSearch7, hierarchicalForward7, getCompressionLevel7, init7, FlashAttention7, DotProductAttention7, MultiHeadAttention7, HyperbolicAttention7, LinearAttention7, MoEAttention7, SonaEngine7, pipeline8;
|
|
147841
148272
|
var init_prime_radiant_advanced_wasm = __esm({
|
|
147842
148273
|
"native-require:prime-radiant-advanced-wasm"() {
|
|
147843
|
-
__require8 =
|
|
148274
|
+
__require8 = createRequire9(import.meta.url);
|
|
147844
148275
|
__mod7 = __require8("prime-radiant-advanced-wasm");
|
|
147845
148276
|
prime_radiant_advanced_wasm_default = __mod7;
|
|
147846
148277
|
({
|
|
@@ -147863,7 +148294,7 @@ var init_prime_radiant_advanced_wasm = __esm({
|
|
|
147863
148294
|
});
|
|
147864
148295
|
|
|
147865
148296
|
// src/integrations/coherence/wasm-loader.ts
|
|
147866
|
-
import { createRequire as
|
|
148297
|
+
import { createRequire as createRequire10 } from "node:module";
|
|
147867
148298
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
147868
148299
|
import { dirname as dirname4, join as join23 } from "node:path";
|
|
147869
148300
|
import { readFileSync as readFileSync13, existsSync as existsSync15 } from "node:fs";
|
|
@@ -148125,7 +148556,7 @@ var init_wasm_loader = __esm({
|
|
|
148125
148556
|
return false;
|
|
148126
148557
|
}
|
|
148127
148558
|
try {
|
|
148128
|
-
const require3 =
|
|
148559
|
+
const require3 = createRequire10(import.meta.url);
|
|
148129
148560
|
const wasmPaths = [
|
|
148130
148561
|
(() => {
|
|
148131
148562
|
try {
|
|
@@ -148333,7 +148764,7 @@ var init_wasm_loader = __esm({
|
|
|
148333
148764
|
async attemptLoad() {
|
|
148334
148765
|
let require3;
|
|
148335
148766
|
try {
|
|
148336
|
-
require3 =
|
|
148767
|
+
require3 = createRequire10(import.meta.url);
|
|
148337
148768
|
} catch {
|
|
148338
148769
|
require3 = globalThis.require || (await import("module")).createRequire(__filename);
|
|
148339
148770
|
}
|
|
@@ -148577,11 +149008,11 @@ __export(rvf_node_exports, {
|
|
|
148577
149008
|
init: () => init8,
|
|
148578
149009
|
pipeline: () => pipeline9
|
|
148579
149010
|
});
|
|
148580
|
-
import { createRequire as
|
|
149011
|
+
import { createRequire as createRequire11 } from "module";
|
|
148581
149012
|
var __require9, __mod8, rvf_node_default, RuvectorLayer8, TensorCompress8, differentiableSearch8, hierarchicalForward8, getCompressionLevel8, init8, FlashAttention8, DotProductAttention8, MultiHeadAttention8, HyperbolicAttention8, LinearAttention8, MoEAttention8, SonaEngine8, pipeline9;
|
|
148582
149013
|
var init_rvf_node = __esm({
|
|
148583
149014
|
"native-require:@ruvector/rvf-node"() {
|
|
148584
|
-
__require9 =
|
|
149015
|
+
__require9 = createRequire11(import.meta.url);
|
|
148585
149016
|
__mod8 = __require9("@ruvector/rvf-node");
|
|
148586
149017
|
rvf_node_default = __mod8;
|
|
148587
149018
|
({
|
|
@@ -172087,7 +172518,7 @@ async function handleAQEHealth() {
|
|
|
172087
172518
|
success: true,
|
|
172088
172519
|
data: {
|
|
172089
172520
|
status: healthStatus,
|
|
172090
|
-
version: true ? "3.7.
|
|
172521
|
+
version: true ? "3.7.12" : "3.7.2",
|
|
172091
172522
|
loadedDomains: domainCount,
|
|
172092
172523
|
memory: memoryStats,
|
|
172093
172524
|
hnsw: hnswStats,
|
|
@@ -174441,7 +174872,10 @@ var ToolRegistry = class {
|
|
|
174441
174872
|
"domain",
|
|
174442
174873
|
"coordination",
|
|
174443
174874
|
"memory",
|
|
174444
|
-
"learning"
|
|
174875
|
+
"learning",
|
|
174876
|
+
"routing",
|
|
174877
|
+
"cross-phase",
|
|
174878
|
+
"infra-healing"
|
|
174445
174879
|
];
|
|
174446
174880
|
for (const category of categories) {
|
|
174447
174881
|
this.categoryTools.set(category, /* @__PURE__ */ new Set());
|
|
@@ -178207,7 +178641,7 @@ var MCPProtocolServer = class {
|
|
|
178207
178641
|
return {
|
|
178208
178642
|
name: this.config.name,
|
|
178209
178643
|
version: this.config.version,
|
|
178210
|
-
protocolVersion: "
|
|
178644
|
+
protocolVersion: "2025-11-25"
|
|
178211
178645
|
// MCP protocol version
|
|
178212
178646
|
};
|
|
178213
178647
|
}
|
|
@@ -178283,7 +178717,7 @@ var MCPProtocolServer = class {
|
|
|
178283
178717
|
}
|
|
178284
178718
|
this.initialized = true;
|
|
178285
178719
|
return {
|
|
178286
|
-
protocolVersion: "
|
|
178720
|
+
protocolVersion: "2025-11-25",
|
|
178287
178721
|
capabilities: this.getCapabilities(),
|
|
178288
178722
|
serverInfo: this.getServerInfo()
|
|
178289
178723
|
};
|
|
@@ -180651,9 +181085,9 @@ function generateSignature(payload, secret, timestamp) {
|
|
|
180651
181085
|
return hmac.digest("hex");
|
|
180652
181086
|
}
|
|
180653
181087
|
function generateSignatureHeader(payload, secret, timestamp) {
|
|
180654
|
-
const
|
|
180655
|
-
const signature = generateSignature(payload, secret,
|
|
180656
|
-
return `t=${
|
|
181088
|
+
const ts = timestamp ?? Date.now();
|
|
181089
|
+
const signature = generateSignature(payload, secret, ts);
|
|
181090
|
+
return `t=${ts},${SIGNATURE_VERSION}=${signature}`;
|
|
180657
181091
|
}
|
|
180658
181092
|
|
|
180659
181093
|
// src/adapters/a2a/notifications/subscription-store.ts
|
|
@@ -184474,7 +184908,7 @@ function createHTTPServer(config) {
|
|
|
184474
184908
|
}
|
|
184475
184909
|
|
|
184476
184910
|
// src/mcp/entry.ts
|
|
184477
|
-
import { createRequire as
|
|
184911
|
+
import { createRequire as createRequire12 } from "module";
|
|
184478
184912
|
|
|
184479
184913
|
// src/init/token-bootstrap.ts
|
|
184480
184914
|
init_token_optimizer_service();
|
|
@@ -185302,10 +185736,10 @@ function createCoordinationLock(defaultTtlMs) {
|
|
|
185302
185736
|
// src/strange-loop/infra-healing/infra-action-executor.ts
|
|
185303
185737
|
var ShellCommandRunner = class {
|
|
185304
185738
|
async run(command, timeoutMs) {
|
|
185305
|
-
const { execFile:
|
|
185739
|
+
const { execFile: execFile4 } = await import("node:child_process");
|
|
185306
185740
|
const startTime = Date.now();
|
|
185307
185741
|
return new Promise((resolve10) => {
|
|
185308
|
-
const child =
|
|
185742
|
+
const child = execFile4(
|
|
185309
185743
|
"/bin/sh",
|
|
185310
185744
|
["-c", command],
|
|
185311
185745
|
{ timeout: timeoutMs, maxBuffer: 1024 * 1024 },
|
|
@@ -185695,7 +186129,7 @@ init_global_instance();
|
|
|
185695
186129
|
import { readFileSync as readFileSync17 } from "node:fs";
|
|
185696
186130
|
import { resolve as resolve9, dirname as dirname10 } from "node:path";
|
|
185697
186131
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
185698
|
-
var require2 =
|
|
186132
|
+
var require2 = createRequire12(import.meta.url);
|
|
185699
186133
|
var pkg = require2("../../package.json");
|
|
185700
186134
|
var server = null;
|
|
185701
186135
|
var httpServer = null;
|