nexus-agents 2.56.0 → 2.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adaptive-memory-SUNFPY2W.js → adaptive-memory-TSZEJUJC.js} +3 -3
- package/dist/{chunk-4FVISCDB.js → chunk-6QU4DJYW.js} +2 -2
- package/dist/{chunk-NYNBDP7M.js → chunk-7Y36JLES.js} +2 -2
- package/dist/{chunk-FWSTXEG2.js → chunk-AFSIP6JH.js} +99 -23
- package/dist/chunk-AFSIP6JH.js.map +1 -0
- package/dist/{chunk-BPMQRYGU.js → chunk-BOZ26RIB.js} +283 -79
- package/dist/chunk-BOZ26RIB.js.map +1 -0
- package/dist/{chunk-VKZKC4SM.js → chunk-EDGG3RQE.js} +2 -2
- package/dist/{chunk-2SPRLBOS.js → chunk-EZXOJZYE.js} +2 -2
- package/dist/{chunk-W5AJRK4U.js → chunk-GMOGKX4E.js} +2 -2
- package/dist/chunk-H43PABG4.js +402 -0
- package/dist/chunk-H43PABG4.js.map +1 -0
- package/dist/{chunk-IOU7F5PH.js → chunk-K7EA5OV4.js} +2 -2
- package/dist/{chunk-KRIFBGWZ.js → chunk-PTGBJFSD.js} +3 -3
- package/dist/{chunk-EKYT4NMD.js → chunk-QGZBCD2A.js} +24 -9
- package/dist/chunk-QGZBCD2A.js.map +1 -0
- package/dist/{chunk-KGMC6F5D.js → chunk-QNYNQ257.js} +67 -61
- package/dist/chunk-QNYNQ257.js.map +1 -0
- package/dist/{chunk-UOUJZIKH.js → chunk-R2Y57PM3.js} +38 -15
- package/dist/chunk-R2Y57PM3.js.map +1 -0
- package/dist/{chunk-RSUCXOQM.js → chunk-SXWZS2V4.js} +26 -53
- package/dist/chunk-SXWZS2V4.js.map +1 -0
- package/dist/{chunk-PCMWLXT4.js → chunk-TC46TRLR.js} +2 -2
- package/dist/{chunk-3IDJSFWT.js → chunk-TFEFN37P.js} +2 -2
- package/dist/{chunk-Q5TKQWOI.js → chunk-V5CGWMYL.js} +2 -2
- package/dist/{chunk-TCQNNY4J.js → chunk-XEMRMZUN.js} +4 -4
- package/dist/{chunk-C3FGEDD7.js → chunk-Y7CD6AZW.js} +22 -406
- package/dist/chunk-Y7CD6AZW.js.map +1 -0
- package/dist/{chunk-R66AWJJ7.js → chunk-YU4NABXM.js} +2 -2
- package/dist/{chunk-EJLWDYK7.js → chunk-ZL3IBCH6.js} +658 -321
- package/dist/chunk-ZL3IBCH6.js.map +1 -0
- package/dist/{chunk-VLVHPC72.js → chunk-ZUWOFHNC.js} +6 -6
- package/dist/{cli-circuit-breaker-7MCMHSDY.js → cli-circuit-breaker-SL73NWX2.js} +4 -4
- package/dist/cli.d.ts +3 -1
- package/dist/cli.js +425 -341
- package/dist/cli.js.map +1 -1
- package/dist/{composite-router-LXFOSMSE.js → composite-router-A7URDW4X.js} +2 -2
- package/dist/{consensus-vote-G6H532ME.js → consensus-vote-CQ2JP6DC.js} +9 -8
- package/dist/{doctor-deep-RKMOZSIS.js → doctor-deep-VN6KMUCG.js} +3 -3
- package/dist/{expert-bridge-KHHE42JP.js → expert-bridge-LT7PKUPS.js} +3 -3
- package/dist/{factory-KRNR7XHD.js → factory-FA7WDPZW.js} +5 -5
- package/dist/{factory-JVN47MFN.js → factory-FZ2KSVYC.js} +4 -4
- package/dist/index.d.ts +324 -16
- package/dist/index.js +58 -43
- package/dist/index.js.map +1 -1
- package/dist/{issue-triage-O3C7P66H.js → issue-triage-YYTE6KTC.js} +4 -4
- package/dist/{mcp-config-QRERKGR4.js → mcp-config-34XMRM64.js} +3 -3
- package/dist/{mobimem-FAOAXV3B.js → mobimem-QDBP37H7.js} +2 -2
- package/dist/model-registry.generated.json +17033 -0
- package/dist/registry-command-S46JJ2SX.js +580 -0
- package/dist/registry-command-S46JJ2SX.js.map +1 -0
- package/dist/{repo-security-plan-AZ5HMGFC.js → repo-security-plan-C3LLE3Z7.js} +3 -3
- package/dist/{research-helpers-synthesize-E6WQLQKP.js → research-helpers-synthesize-NVQIWLQL.js} +3 -3
- package/dist/{routing-memory-MXF45FXT.js → routing-memory-W3YWMLJM.js} +2 -2
- package/dist/{session-memory-HL5XDBIL.js → session-memory-DWF5Z2LC.js} +3 -3
- package/dist/{setup-command-AV4MODEL.js → setup-command-6EJONTOU.js} +8 -7
- package/dist/{setup-config-PWK6WHMG.js → setup-config-JA5IX53Q.js} +3 -3
- package/dist/{setup-custom-api-XAWKRDWV.js → setup-custom-api-CSB26HWD.js} +7 -5
- package/dist/setup-custom-api-CSB26HWD.js.map +1 -0
- package/dist/{weather-report-XZ5CENHE.js → weather-report-YQSLX4MS.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-BPMQRYGU.js.map +0 -1
- package/dist/chunk-C3FGEDD7.js.map +0 -1
- package/dist/chunk-EJLWDYK7.js.map +0 -1
- package/dist/chunk-EKYT4NMD.js.map +0 -1
- package/dist/chunk-FWSTXEG2.js.map +0 -1
- package/dist/chunk-KGMC6F5D.js.map +0 -1
- package/dist/chunk-RSUCXOQM.js.map +0 -1
- package/dist/chunk-UOUJZIKH.js.map +0 -1
- package/dist/setup-custom-api-XAWKRDWV.js.map +0 -1
- /package/dist/{adaptive-memory-SUNFPY2W.js.map → adaptive-memory-TSZEJUJC.js.map} +0 -0
- /package/dist/{chunk-4FVISCDB.js.map → chunk-6QU4DJYW.js.map} +0 -0
- /package/dist/{chunk-NYNBDP7M.js.map → chunk-7Y36JLES.js.map} +0 -0
- /package/dist/{chunk-VKZKC4SM.js.map → chunk-EDGG3RQE.js.map} +0 -0
- /package/dist/{chunk-2SPRLBOS.js.map → chunk-EZXOJZYE.js.map} +0 -0
- /package/dist/{chunk-W5AJRK4U.js.map → chunk-GMOGKX4E.js.map} +0 -0
- /package/dist/{chunk-IOU7F5PH.js.map → chunk-K7EA5OV4.js.map} +0 -0
- /package/dist/{chunk-KRIFBGWZ.js.map → chunk-PTGBJFSD.js.map} +0 -0
- /package/dist/{chunk-PCMWLXT4.js.map → chunk-TC46TRLR.js.map} +0 -0
- /package/dist/{chunk-3IDJSFWT.js.map → chunk-TFEFN37P.js.map} +0 -0
- /package/dist/{chunk-Q5TKQWOI.js.map → chunk-V5CGWMYL.js.map} +0 -0
- /package/dist/{chunk-TCQNNY4J.js.map → chunk-XEMRMZUN.js.map} +0 -0
- /package/dist/{chunk-R66AWJJ7.js.map → chunk-YU4NABXM.js.map} +0 -0
- /package/dist/{chunk-VLVHPC72.js.map → chunk-ZUWOFHNC.js.map} +0 -0
- /package/dist/{cli-circuit-breaker-7MCMHSDY.js.map → cli-circuit-breaker-SL73NWX2.js.map} +0 -0
- /package/dist/{composite-router-LXFOSMSE.js.map → composite-router-A7URDW4X.js.map} +0 -0
- /package/dist/{consensus-vote-G6H532ME.js.map → consensus-vote-CQ2JP6DC.js.map} +0 -0
- /package/dist/{doctor-deep-RKMOZSIS.js.map → doctor-deep-VN6KMUCG.js.map} +0 -0
- /package/dist/{expert-bridge-KHHE42JP.js.map → expert-bridge-LT7PKUPS.js.map} +0 -0
- /package/dist/{factory-JVN47MFN.js.map → factory-FA7WDPZW.js.map} +0 -0
- /package/dist/{factory-KRNR7XHD.js.map → factory-FZ2KSVYC.js.map} +0 -0
- /package/dist/{issue-triage-O3C7P66H.js.map → issue-triage-YYTE6KTC.js.map} +0 -0
- /package/dist/{mcp-config-QRERKGR4.js.map → mcp-config-34XMRM64.js.map} +0 -0
- /package/dist/{mobimem-FAOAXV3B.js.map → mobimem-QDBP37H7.js.map} +0 -0
- /package/dist/{repo-security-plan-AZ5HMGFC.js.map → repo-security-plan-C3LLE3Z7.js.map} +0 -0
- /package/dist/{research-helpers-synthesize-E6WQLQKP.js.map → research-helpers-synthesize-NVQIWLQL.js.map} +0 -0
- /package/dist/{routing-memory-MXF45FXT.js.map → routing-memory-W3YWMLJM.js.map} +0 -0
- /package/dist/{session-memory-HL5XDBIL.js.map → session-memory-DWF5Z2LC.js.map} +0 -0
- /package/dist/{setup-command-AV4MODEL.js.map → setup-command-6EJONTOU.js.map} +0 -0
- /package/dist/{setup-config-PWK6WHMG.js.map → setup-config-JA5IX53Q.js.map} +0 -0
- /package/dist/{weather-report-XZ5CENHE.js.map → weather-report-YQSLX4MS.js.map} +0 -0
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getTokenEnvVars,
|
|
3
3
|
resolveToken
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EZXOJZYE.js";
|
|
5
5
|
import {
|
|
6
6
|
ClaudeAdapter,
|
|
7
7
|
DEFAULT_RELEVANCE_CONFIG,
|
|
8
8
|
EventTopics,
|
|
9
9
|
NOOP_NOTIFIER,
|
|
10
10
|
RateLimiter,
|
|
11
|
+
abortSignalStorage,
|
|
12
|
+
collectRealVotes,
|
|
11
13
|
createDefaultRateLimiter,
|
|
12
14
|
createEvent,
|
|
13
15
|
createMcpNotifier,
|
|
@@ -27,7 +29,7 @@ import {
|
|
|
27
29
|
withAccessPolicy,
|
|
28
30
|
withProgressHeartbeat,
|
|
29
31
|
wrapToolWithTimeout
|
|
30
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-BOZ26RIB.js";
|
|
31
33
|
import {
|
|
32
34
|
REGISTRY_PATH,
|
|
33
35
|
getProjectRoot,
|
|
@@ -36,14 +38,14 @@ import {
|
|
|
36
38
|
normalizeTopicToCanonical,
|
|
37
39
|
savePapersRegistry,
|
|
38
40
|
synthesizeResearch
|
|
39
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-TC46TRLR.js";
|
|
40
42
|
import {
|
|
41
43
|
IssueTriage,
|
|
42
44
|
sanitizeInput
|
|
43
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-AFSIP6JH.js";
|
|
44
46
|
import {
|
|
45
47
|
generateSecurityPlan
|
|
46
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-V5CGWMYL.js";
|
|
47
49
|
import {
|
|
48
50
|
analyzeGitHubRepo
|
|
49
51
|
} from "./chunk-BC3M4VLP.js";
|
|
@@ -58,13 +60,15 @@ import {
|
|
|
58
60
|
SharedMemoryStore
|
|
59
61
|
} from "./chunk-ED6VQWNG.js";
|
|
60
62
|
import {
|
|
61
|
-
DEFAULTS,
|
|
62
63
|
DEFAULT_TASK_TTL_MS,
|
|
63
64
|
DEFAULT_TOOL_RATE_LIMITS,
|
|
64
65
|
clampTaskTtl,
|
|
65
66
|
getAvailabilityCache,
|
|
66
67
|
resolveFallback
|
|
67
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-Y7CD6AZW.js";
|
|
69
|
+
import {
|
|
70
|
+
DEFAULTS
|
|
71
|
+
} from "./chunk-H43PABG4.js";
|
|
68
72
|
import {
|
|
69
73
|
resolveInsideRoot
|
|
70
74
|
} from "./chunk-NUBSJGQZ.js";
|
|
@@ -76,11 +80,11 @@ import {
|
|
|
76
80
|
} from "./chunk-GJVHRJO2.js";
|
|
77
81
|
import {
|
|
78
82
|
createSessionMemory
|
|
79
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-7Y36JLES.js";
|
|
80
84
|
import {
|
|
81
85
|
MemoryImportance,
|
|
82
86
|
calculateTextJaccardSimilarity
|
|
83
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-TFEFN37P.js";
|
|
84
88
|
import {
|
|
85
89
|
STOPWORDS,
|
|
86
90
|
capitalize,
|
|
@@ -89,13 +93,13 @@ import {
|
|
|
89
93
|
} from "./chunk-633WH2ML.js";
|
|
90
94
|
import {
|
|
91
95
|
generateMcpConfig
|
|
92
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-EDGG3RQE.js";
|
|
93
97
|
import {
|
|
94
98
|
getFallbackChainForCategory
|
|
95
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-PTGBJFSD.js";
|
|
96
100
|
import {
|
|
97
101
|
executeExpert
|
|
98
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-ZUWOFHNC.js";
|
|
99
103
|
import {
|
|
100
104
|
ClaudeCliAdapter,
|
|
101
105
|
CliDetectionCache,
|
|
@@ -104,7 +108,7 @@ import {
|
|
|
104
108
|
getAvailableClis,
|
|
105
109
|
sleep,
|
|
106
110
|
withTimeout
|
|
107
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-SXWZS2V4.js";
|
|
108
112
|
import {
|
|
109
113
|
AGENT_ROUTER_TIMEOUTS,
|
|
110
114
|
API_TIMEOUTS,
|
|
@@ -169,7 +173,7 @@ import {
|
|
|
169
173
|
ok,
|
|
170
174
|
toExpertTaskAnalysisResult,
|
|
171
175
|
withStep
|
|
172
|
-
} from "./chunk-
|
|
176
|
+
} from "./chunk-R2Y57PM3.js";
|
|
173
177
|
|
|
174
178
|
// src/agents/state-machine-types.ts
|
|
175
179
|
var VALID_TRANSITIONS = /* @__PURE__ */ new Map([
|
|
@@ -23433,10 +23437,10 @@ function calculateZStatistic(params) {
|
|
|
23433
23437
|
function calculateDifferenceCI(p1, p2, total1, total2, confidence) {
|
|
23434
23438
|
const difference = p1 - p2;
|
|
23435
23439
|
const seDiff = Math.sqrt(p1 * (1 - p1) / (total1 || 1) + p2 * (1 - p2) / (total2 || 1));
|
|
23436
|
-
const
|
|
23440
|
+
const z102 = getZScore(confidence);
|
|
23437
23441
|
return {
|
|
23438
|
-
lower: difference -
|
|
23439
|
-
upper: difference +
|
|
23442
|
+
lower: difference - z102 * seDiff,
|
|
23443
|
+
upper: difference + z102 * seDiff,
|
|
23440
23444
|
estimate: difference,
|
|
23441
23445
|
confidence,
|
|
23442
23446
|
n: total1 + total2,
|
|
@@ -23459,11 +23463,11 @@ function proportionConfidenceInterval(successes, total, options = {}) {
|
|
|
23459
23463
|
standardError: 0
|
|
23460
23464
|
};
|
|
23461
23465
|
}
|
|
23462
|
-
const
|
|
23463
|
-
const z210 =
|
|
23466
|
+
const z102 = getZScore(opts.confidence);
|
|
23467
|
+
const z210 = z102 * z102;
|
|
23464
23468
|
const denominator = 1 + z210 / n;
|
|
23465
23469
|
const center = (p + z210 / (2 * n)) / denominator;
|
|
23466
|
-
const margin =
|
|
23470
|
+
const margin = z102 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
|
|
23467
23471
|
const lower = Math.max(0, center - margin);
|
|
23468
23472
|
const upper = Math.min(1, center + margin);
|
|
23469
23473
|
const standardError = Math.sqrt(p * (1 - p) / n);
|
|
@@ -23493,8 +23497,8 @@ function meanConfidenceInterval(values, options = {}) {
|
|
|
23493
23497
|
const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / (n - 1 || 1);
|
|
23494
23498
|
const stdDev = Math.sqrt(variance);
|
|
23495
23499
|
const standardError = stdDev / Math.sqrt(n);
|
|
23496
|
-
const
|
|
23497
|
-
const margin =
|
|
23500
|
+
const z102 = getZScore(opts.confidence);
|
|
23501
|
+
const margin = z102 * standardError;
|
|
23498
23502
|
return {
|
|
23499
23503
|
lower: mean - margin,
|
|
23500
23504
|
upper: mean + margin,
|
|
@@ -26648,7 +26652,14 @@ async function executeSuperStep(graph, ctx, options) {
|
|
|
26648
26652
|
const completedIds = results.filter((r) => r.status === "success").map((r) => r.nodeId);
|
|
26649
26653
|
ctx.runnableIds = resolveNextNodes(graph, completedIds, ctx.state, ctx);
|
|
26650
26654
|
for (const result of results) {
|
|
26651
|
-
|
|
26655
|
+
try {
|
|
26656
|
+
options?.onNodeComplete?.(result);
|
|
26657
|
+
} catch (error) {
|
|
26658
|
+
logger15.warn("onNodeComplete callback threw \u2014 continuing execution", {
|
|
26659
|
+
nodeId: result.nodeId,
|
|
26660
|
+
error: getErrorMessage(error)
|
|
26661
|
+
});
|
|
26662
|
+
}
|
|
26652
26663
|
}
|
|
26653
26664
|
emitNodeResults(ctx, results, options);
|
|
26654
26665
|
emitStateUpdated(ctx, results, options);
|
|
@@ -26682,7 +26693,16 @@ function saveCheckpointIfConfigured(ctx, options) {
|
|
|
26682
26693
|
pendingNodeIds: ctx.runnableIds,
|
|
26683
26694
|
completedResults: ctx.allResults
|
|
26684
26695
|
});
|
|
26685
|
-
|
|
26696
|
+
try {
|
|
26697
|
+
store.save(checkpoint);
|
|
26698
|
+
} catch (err2) {
|
|
26699
|
+
const error = err2 instanceof Error ? err2 : new Error(String(err2));
|
|
26700
|
+
logger15.warn("Checkpoint save failed; execution continues without resumable state", {
|
|
26701
|
+
executionId: execId,
|
|
26702
|
+
stepNumber: ctx.stepsExecuted,
|
|
26703
|
+
errorMessage: error.message
|
|
26704
|
+
});
|
|
26705
|
+
}
|
|
26686
26706
|
}
|
|
26687
26707
|
function initializeState(graph, inputs) {
|
|
26688
26708
|
const state = {};
|
|
@@ -26702,11 +26722,20 @@ function mergeNodeResults(graph, currentState, results) {
|
|
|
26702
26722
|
}
|
|
26703
26723
|
return state;
|
|
26704
26724
|
}
|
|
26725
|
+
var undeclaredFieldWarned = /* @__PURE__ */ new Set();
|
|
26705
26726
|
function applyStateUpdates(graph, state, updates) {
|
|
26706
26727
|
const newState = { ...state };
|
|
26707
26728
|
for (const [field, value] of Object.entries(updates)) {
|
|
26708
26729
|
const schema = graph.stateSchema[field];
|
|
26709
26730
|
if (schema === void 0) {
|
|
26731
|
+
const key = `${String(Object.keys(graph.stateSchema).length)}:${field}`;
|
|
26732
|
+
if (!undeclaredFieldWarned.has(key)) {
|
|
26733
|
+
undeclaredFieldWarned.add(key);
|
|
26734
|
+
logger15.warn("Node wrote to undeclared state field; defaulting to overwrite reducer", {
|
|
26735
|
+
field,
|
|
26736
|
+
knownFields: Object.keys(graph.stateSchema)
|
|
26737
|
+
});
|
|
26738
|
+
}
|
|
26710
26739
|
newState[field] = value;
|
|
26711
26740
|
continue;
|
|
26712
26741
|
}
|
|
@@ -28091,7 +28120,22 @@ function evaluatePolicy2(options, context) {
|
|
|
28091
28120
|
const violations = [];
|
|
28092
28121
|
const rules = options.engine.listRules();
|
|
28093
28122
|
for (const rule of rules) {
|
|
28094
|
-
|
|
28123
|
+
let decision;
|
|
28124
|
+
try {
|
|
28125
|
+
decision = rule.evaluate(context);
|
|
28126
|
+
} catch (err2) {
|
|
28127
|
+
const error = err2 instanceof Error ? err2 : new Error(String(err2));
|
|
28128
|
+
logger20.error("Policy rule threw during evaluation", error, {
|
|
28129
|
+
ruleId: rule.id,
|
|
28130
|
+
stageId: context.stageId
|
|
28131
|
+
});
|
|
28132
|
+
const message = error.message;
|
|
28133
|
+
violations.push({
|
|
28134
|
+
ruleId: rule.id,
|
|
28135
|
+
reason: `Rule threw during evaluation: ${message}`
|
|
28136
|
+
});
|
|
28137
|
+
continue;
|
|
28138
|
+
}
|
|
28095
28139
|
if (!decision.allow) {
|
|
28096
28140
|
violations.push({
|
|
28097
28141
|
ruleId: rule.id,
|
|
@@ -30215,11 +30259,15 @@ var RoleFailureTracker = class {
|
|
|
30215
30259
|
});
|
|
30216
30260
|
}
|
|
30217
30261
|
};
|
|
30218
|
-
|
|
30262
|
+
function isCancelled2(signal) {
|
|
30263
|
+
return signal?.aborted === true;
|
|
30264
|
+
}
|
|
30265
|
+
async function executeWithConcurrencyLimit(tasks, limit, signal) {
|
|
30219
30266
|
const results = [];
|
|
30220
30267
|
let nextIndex = 0;
|
|
30221
30268
|
async function runNext() {
|
|
30222
30269
|
while (nextIndex < tasks.length) {
|
|
30270
|
+
if (isCancelled2(signal)) return;
|
|
30223
30271
|
const currentIndex = nextIndex;
|
|
30224
30272
|
nextIndex++;
|
|
30225
30273
|
const task = tasks[currentIndex];
|
|
@@ -30245,6 +30293,7 @@ async function dispatchWorkers(entries, options) {
|
|
|
30245
30293
|
const execId = options.executionId ?? `dispatch-${Date.now().toString(36)}`;
|
|
30246
30294
|
const staggerDelayMs = options.staggerDelayMs ?? DEFAULT_STAGGER_DELAY_MS;
|
|
30247
30295
|
for (const [waveIdx, wave] of waves.entries()) {
|
|
30296
|
+
if (isCancelled2(options.signal)) break;
|
|
30248
30297
|
const waveResults = await processWave(wave, waveIdx, waves.length, {
|
|
30249
30298
|
bus,
|
|
30250
30299
|
executionId: execId,
|
|
@@ -30321,7 +30370,11 @@ async function processWave(wave, waveIdx, totalWaves, opts) {
|
|
|
30321
30370
|
const tasks = wave.map(
|
|
30322
30371
|
(entry, taskIndex) => createWorkerTask(entry, taskIndex, waveNumber, opts)
|
|
30323
30372
|
);
|
|
30324
|
-
const waveResults = await executeWithConcurrencyLimit(
|
|
30373
|
+
const waveResults = await executeWithConcurrencyLimit(
|
|
30374
|
+
tasks,
|
|
30375
|
+
opts.maxConcurrency,
|
|
30376
|
+
opts.options.signal
|
|
30377
|
+
);
|
|
30325
30378
|
for (const result of waveResults) {
|
|
30326
30379
|
opts.failureTracker.record(result);
|
|
30327
30380
|
}
|
|
@@ -33098,6 +33151,11 @@ async function tryWorkerDispatch(agentPlan, task, deps, logger56, notifier) {
|
|
|
33098
33151
|
if (agentPlan === void 0 || !isWorkerDispatchEnabled() || adapter === void 0) {
|
|
33099
33152
|
return void 0;
|
|
33100
33153
|
}
|
|
33154
|
+
const abortSignal = abortSignalStorage.getStore();
|
|
33155
|
+
if (abortSignal?.aborted === true) {
|
|
33156
|
+
logger56.info("Worker dispatch aborted before start (client cancelled)");
|
|
33157
|
+
return void 0;
|
|
33158
|
+
}
|
|
33101
33159
|
try {
|
|
33102
33160
|
return await withProgressHeartbeat(
|
|
33103
33161
|
"worker-dispatch",
|
|
@@ -35073,7 +35131,8 @@ function resolveContextWarnThreshold(env = process.env) {
|
|
|
35073
35131
|
return DEFAULT_CONTEXT_WARN_THRESHOLD;
|
|
35074
35132
|
}
|
|
35075
35133
|
function computeExpertContextUtilization(observation, threshold = DEFAULT_CONTEXT_WARN_THRESHOLD) {
|
|
35076
|
-
const
|
|
35134
|
+
const UNKNOWN_MODEL_CTX_DEFAULT = 8192;
|
|
35135
|
+
const contextWindow = observation.modelId !== void 0 ? getModelContextWindow(observation.modelId) : UNKNOWN_MODEL_CTX_DEFAULT;
|
|
35077
35136
|
const utilization = contextWindow > 0 ? observation.tokensUsed / contextWindow : 0;
|
|
35078
35137
|
return {
|
|
35079
35138
|
tokensUsed: observation.tokensUsed,
|
|
@@ -35278,15 +35337,17 @@ async function tryExpertFallback(expert, task, logger56) {
|
|
|
35278
35337
|
logger56?.info("Retrying expert with fallback CLI", { role: expert.role, fallbackCli });
|
|
35279
35338
|
const fallbackResult = createExpert(expert.expertConfig, { adapter: fallbackAdapter });
|
|
35280
35339
|
if (!fallbackResult.ok) return void 0;
|
|
35340
|
+
const fallbackStart = getTimeProvider().now();
|
|
35281
35341
|
const result = await fallbackResult.value.execute(task);
|
|
35282
35342
|
if (!result.ok) return void 0;
|
|
35343
|
+
const fallbackDurationMs = getTimeProvider().now() - fallbackStart;
|
|
35283
35344
|
return {
|
|
35284
35345
|
ok: true,
|
|
35285
35346
|
value: buildSuccessResponse({
|
|
35286
35347
|
expertId: expert.id,
|
|
35287
35348
|
role: expert.role,
|
|
35288
35349
|
output: result.value.output,
|
|
35289
|
-
durationMs:
|
|
35350
|
+
durationMs: fallbackDurationMs,
|
|
35290
35351
|
tokensUsed: result.value.metadata.tokensUsed,
|
|
35291
35352
|
modelUsed: fallbackCli
|
|
35292
35353
|
})
|
|
@@ -36114,6 +36175,12 @@ function createError(code, source, message, cause) {
|
|
|
36114
36175
|
function getToday() {
|
|
36115
36176
|
return (/* @__PURE__ */ new Date()).toISOString().split("T")[0] ?? "";
|
|
36116
36177
|
}
|
|
36178
|
+
function buildHttpErrorResult(status, source) {
|
|
36179
|
+
const isRateLimit = status === 429;
|
|
36180
|
+
const envHint = source === "github" ? "GITHUB_TOKEN" : `${source.toUpperCase()}_API_KEY`;
|
|
36181
|
+
const message = isRateLimit ? `${source} rate-limited (HTTP 429) \u2014 set ${envHint} or retry later` : `API returned ${String(status)}`;
|
|
36182
|
+
return createError(isRateLimit ? "RATE_LIMIT" : "HTTP_ERROR", source, message);
|
|
36183
|
+
}
|
|
36117
36184
|
async function fetchSource(options) {
|
|
36118
36185
|
const { url, source, headers, timeoutMs = SOURCE_API_TIMEOUT_MS } = options;
|
|
36119
36186
|
try {
|
|
@@ -36121,10 +36188,7 @@ async function fetchSource(options) {
|
|
|
36121
36188
|
if (headers !== void 0) fetchInit.headers = headers;
|
|
36122
36189
|
const response = await fetch(url, fetchInit);
|
|
36123
36190
|
if (!response.ok) {
|
|
36124
|
-
return {
|
|
36125
|
-
ok: false,
|
|
36126
|
-
error: createError("HTTP_ERROR", source, `API returned ${String(response.status)}`)
|
|
36127
|
-
};
|
|
36191
|
+
return { ok: false, error: buildHttpErrorResult(response.status, source) };
|
|
36128
36192
|
}
|
|
36129
36193
|
return { ok: true, value: response };
|
|
36130
36194
|
} catch (error) {
|
|
@@ -36151,7 +36215,7 @@ function parseGitHubRepos(data) {
|
|
|
36151
36215
|
}));
|
|
36152
36216
|
}
|
|
36153
36217
|
async function discoverGitHubRepos(topic, maxResults = 10) {
|
|
36154
|
-
const query = encodeURIComponent(
|
|
36218
|
+
const query = encodeURIComponent(topic);
|
|
36155
36219
|
const url = `https://api.github.com/search/repositories?q=${query}&sort=stars&order=desc&per_page=${String(maxResults)}`;
|
|
36156
36220
|
const headers = {
|
|
36157
36221
|
Accept: "application/vnd.github.v3+json",
|
|
@@ -36395,10 +36459,18 @@ async function discoverSemanticScholar(topic, maxResults = 10) {
|
|
|
36395
36459
|
const query = encodeURIComponent(topic);
|
|
36396
36460
|
const fields = "title,url,abstract,citationCount,year,isOpenAccess,externalIds";
|
|
36397
36461
|
const url = `https://api.semanticscholar.org/graph/v1/paper/search?query=${query}&limit=${String(maxResults)}&fields=${fields}`;
|
|
36462
|
+
const headers = {
|
|
36463
|
+
"User-Agent": "nexus-agents",
|
|
36464
|
+
Accept: "application/json"
|
|
36465
|
+
};
|
|
36466
|
+
const apiKey = process.env["SEMANTIC_SCHOLAR_API_KEY"];
|
|
36467
|
+
if (apiKey !== void 0 && apiKey !== "") {
|
|
36468
|
+
headers["x-api-key"] = apiKey;
|
|
36469
|
+
}
|
|
36398
36470
|
const fetchResult = await fetchSource({
|
|
36399
36471
|
url,
|
|
36400
36472
|
source: "semantic_scholar",
|
|
36401
|
-
headers
|
|
36473
|
+
headers
|
|
36402
36474
|
});
|
|
36403
36475
|
if (!fetchResult.ok) return fetchResult;
|
|
36404
36476
|
let raw;
|
|
@@ -38082,6 +38154,7 @@ function recordTriageOutcome(success, durationMs, errorMsg) {
|
|
|
38082
38154
|
|
|
38083
38155
|
// src/security/audit-trail.ts
|
|
38084
38156
|
var MAX_EVENTS = 1e4;
|
|
38157
|
+
var MAX_STRIPPED_ELEMENTS_PER_EVENT = 20;
|
|
38085
38158
|
var AuditTrail = class {
|
|
38086
38159
|
events = [];
|
|
38087
38160
|
nextId = 1;
|
|
@@ -40366,7 +40439,7 @@ async function tryIssueTriage(task) {
|
|
|
40366
40439
|
try {
|
|
40367
40440
|
const issueMatch = task.match(/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/);
|
|
40368
40441
|
if (issueMatch === null) return null;
|
|
40369
|
-
const { createIssueTriage } = await import("./issue-triage-
|
|
40442
|
+
const { createIssueTriage } = await import("./issue-triage-YYTE6KTC.js");
|
|
40370
40443
|
const triage = createIssueTriage();
|
|
40371
40444
|
const owner = issueMatch[1] ?? "";
|
|
40372
40445
|
const num = issueMatch[2] ?? "";
|
|
@@ -40394,7 +40467,7 @@ var VALID_TEMPLATES = /* @__PURE__ */ new Set([
|
|
|
40394
40467
|
]);
|
|
40395
40468
|
async function classifyWithLLM(task) {
|
|
40396
40469
|
try {
|
|
40397
|
-
const { executeExpert: executeExpert2 } = await import("./expert-bridge-
|
|
40470
|
+
const { executeExpert: executeExpert2 } = await import("./expert-bridge-LT7PKUPS.js");
|
|
40398
40471
|
const prompt = [
|
|
40399
40472
|
"Classify this task into exactly one pipeline template.",
|
|
40400
40473
|
"Templates: dev (implementation/bug fix/refactor), research (investigate/evaluate/compare),",
|
|
@@ -41188,7 +41261,7 @@ var memoryInitPromise = null;
|
|
|
41188
41261
|
async function initPipelineMemory() {
|
|
41189
41262
|
if (cachedMemory !== null) return cachedMemory;
|
|
41190
41263
|
try {
|
|
41191
|
-
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-
|
|
41264
|
+
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-DWF5Z2LC.js");
|
|
41192
41265
|
const { LEARNING_DIR } = await import("./learning-persistence-WMWZJZ35.js");
|
|
41193
41266
|
const mem = createSessionMemory2(LEARNING_DIR);
|
|
41194
41267
|
mem.startSession(`pipeline-${String(Date.now())}`);
|
|
@@ -41241,7 +41314,7 @@ async function persistMobiMemState() {
|
|
|
41241
41314
|
if (!isPersistenceEnabled()) return;
|
|
41242
41315
|
const os6 = await import("os");
|
|
41243
41316
|
const path20 = await import("path");
|
|
41244
|
-
const { createMobiMem } = await import("./mobimem-
|
|
41317
|
+
const { createMobiMem } = await import("./mobimem-QDBP37H7.js");
|
|
41245
41318
|
const mobimem = createMobiMem();
|
|
41246
41319
|
const savePath = path20.join(os6.homedir(), ".nexus-agents", "memory", "mobimem-state.json");
|
|
41247
41320
|
await mobimem.save(savePath);
|
|
@@ -41258,7 +41331,7 @@ function recordRoutingExperience(category, success, durationMs) {
|
|
|
41258
41331
|
callRecord(routingMemoryCache);
|
|
41259
41332
|
return;
|
|
41260
41333
|
}
|
|
41261
|
-
void import("./routing-memory-
|
|
41334
|
+
void import("./routing-memory-W3YWMLJM.js").then(({ createRoutingMemory }) => {
|
|
41262
41335
|
routingMemoryCache = createRoutingMemory();
|
|
41263
41336
|
callRecord(routingMemoryCache);
|
|
41264
41337
|
}).catch((error) => {
|
|
@@ -41287,7 +41360,7 @@ ${text}` : "";
|
|
|
41287
41360
|
}
|
|
41288
41361
|
async function getWeatherContext() {
|
|
41289
41362
|
try {
|
|
41290
|
-
const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-
|
|
41363
|
+
const { generateWeatherReport: generateWeatherReport2 } = await import("./weather-report-YQSLX4MS.js");
|
|
41291
41364
|
const report = generateWeatherReport2({ includeAdaptive: true });
|
|
41292
41365
|
const mappings = "recommendedMappings" in report ? report.recommendedMappings : [];
|
|
41293
41366
|
if (!Array.isArray(mappings) || mappings.length === 0) return "";
|
|
@@ -41304,7 +41377,7 @@ ${lines}
|
|
|
41304
41377
|
}
|
|
41305
41378
|
async function getMemoryContext(task) {
|
|
41306
41379
|
try {
|
|
41307
|
-
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-
|
|
41380
|
+
const { createSessionMemory: createSessionMemory2 } = await import("./session-memory-DWF5Z2LC.js");
|
|
41308
41381
|
const { LEARNING_DIR } = await import("./learning-persistence-WMWZJZ35.js");
|
|
41309
41382
|
const memory = createSessionMemory2(LEARNING_DIR, { maxLearningsInContext: 10 });
|
|
41310
41383
|
const learnings = memory.searchLearnings(task.slice(0, 200));
|
|
@@ -41397,7 +41470,7 @@ ${contextBlock}`;
|
|
|
41397
41470
|
const strategy = config.votingStrategy ?? "higher_order";
|
|
41398
41471
|
await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
|
|
41399
41472
|
try {
|
|
41400
|
-
const { executeVoting } = await import("./consensus-vote-
|
|
41473
|
+
const { executeVoting } = await import("./consensus-vote-CQ2JP6DC.js");
|
|
41401
41474
|
const votingResult = await executeVoting(
|
|
41402
41475
|
{
|
|
41403
41476
|
proposal: plan.slice(0, 4e3),
|
|
@@ -42266,7 +42339,7 @@ async function extractSymbolsForTask(task) {
|
|
|
42266
42339
|
}
|
|
42267
42340
|
async function retrieveAdaptiveMemory(task) {
|
|
42268
42341
|
try {
|
|
42269
|
-
const { AdaptiveMemoryBackend } = await import("./adaptive-memory-
|
|
42342
|
+
const { AdaptiveMemoryBackend } = await import("./adaptive-memory-TSZEJUJC.js");
|
|
42270
42343
|
const os6 = await import("os");
|
|
42271
42344
|
const path20 = await import("path");
|
|
42272
42345
|
const baseDir = path20.join(os6.homedir(), ".nexus-agents", "memory");
|
|
@@ -42285,7 +42358,7 @@ async function retrieveAdaptiveMemory(task) {
|
|
|
42285
42358
|
}
|
|
42286
42359
|
async function queryResearchRegistry(task) {
|
|
42287
42360
|
try {
|
|
42288
|
-
const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-
|
|
42361
|
+
const { synthesizeResearch: synthesizeResearch2 } = await import("./research-helpers-synthesize-NVQIWLQL.js");
|
|
42289
42362
|
const topic = task.split(/[.!?\n]/).filter((s) => s.trim().length > 10)[0]?.trim();
|
|
42290
42363
|
if (topic === void 0) return null;
|
|
42291
42364
|
const result = await synthesizeResearch2(topic.slice(0, 50));
|
|
@@ -42370,7 +42443,7 @@ function createScanStageWrapper() {
|
|
|
42370
42443
|
try {
|
|
42371
42444
|
const slug = ctx.task.match(/([a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+)/)?.[1];
|
|
42372
42445
|
if (slug !== void 0) {
|
|
42373
|
-
const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-
|
|
42446
|
+
const { generateSecurityPlan: generateSecurityPlan2 } = await import("./repo-security-plan-C3LLE3Z7.js");
|
|
42374
42447
|
const plan = await generateSecurityPlan2({ repo: slug, maxScanners: 10 });
|
|
42375
42448
|
const recs = plan.recommendations.slice(0, 5).map((r) => `${r.priority}: ${r.displayName} (${r.category})`).join("; ");
|
|
42376
42449
|
ctx.sharedMemory.write("scan", "decision", { recommendations: recs });
|
|
@@ -42410,10 +42483,265 @@ function createAuditStageRegistry() {
|
|
|
42410
42483
|
]);
|
|
42411
42484
|
}
|
|
42412
42485
|
|
|
42413
|
-
// src/mcp/tools/
|
|
42486
|
+
// src/mcp/tools/pr-review-tool.ts
|
|
42414
42487
|
import { z as z89 } from "zod";
|
|
42415
|
-
|
|
42416
|
-
|
|
42488
|
+
|
|
42489
|
+
// src/mcp/tools/pr-review-findings.ts
|
|
42490
|
+
import { parse as parseYaml3 } from "yaml";
|
|
42491
|
+
function isFindingVerified(gate) {
|
|
42492
|
+
if (gate.reread_cited_line !== "passed") return false;
|
|
42493
|
+
if (gate.traced_call_path !== "passed") return false;
|
|
42494
|
+
if (gate.ruled_out_language_non_issue !== "passed") return false;
|
|
42495
|
+
if (gate.named_assertion.trim().length < 10) return false;
|
|
42496
|
+
if (/^(passed|ok|yes|done|verified)$/i.test(gate.named_assertion.trim())) return false;
|
|
42497
|
+
return true;
|
|
42498
|
+
}
|
|
42499
|
+
var FINDINGS_BLOCK_RE = /```yaml findings\n([\s\S]*?)\n```/;
|
|
42500
|
+
function parseFindings(reasoning) {
|
|
42501
|
+
const match = FINDINGS_BLOCK_RE.exec(reasoning);
|
|
42502
|
+
if (match === null) return [];
|
|
42503
|
+
const yamlBody = match[1];
|
|
42504
|
+
if (yamlBody === void 0 || yamlBody.trim() === "") return [];
|
|
42505
|
+
let parsed;
|
|
42506
|
+
try {
|
|
42507
|
+
parsed = parseYaml3(yamlBody);
|
|
42508
|
+
} catch {
|
|
42509
|
+
return [];
|
|
42510
|
+
}
|
|
42511
|
+
if (!Array.isArray(parsed)) return [];
|
|
42512
|
+
return parsed.map(coerceFinding).filter((f) => f !== null);
|
|
42513
|
+
}
|
|
42514
|
+
function coerceFinding(raw) {
|
|
42515
|
+
if (raw === null || typeof raw !== "object") return null;
|
|
42516
|
+
const r = raw;
|
|
42517
|
+
if (typeof r["summary"] !== "string" || r["summary"].trim() === "") return null;
|
|
42518
|
+
if (typeof r["location"] !== "string" || r["location"].trim() === "") return null;
|
|
42519
|
+
if (typeof r["claim"] !== "string" || r["claim"].trim() === "") return null;
|
|
42520
|
+
const gate = coerceGate(r["gate"]);
|
|
42521
|
+
if (gate === null) return null;
|
|
42522
|
+
const severity = coerceSeverity(r["severity"]);
|
|
42523
|
+
const finding = {
|
|
42524
|
+
summary: r["summary"].trim(),
|
|
42525
|
+
location: r["location"].trim(),
|
|
42526
|
+
severity,
|
|
42527
|
+
gate,
|
|
42528
|
+
claim: r["claim"].trim(),
|
|
42529
|
+
verified: isFindingVerified(gate)
|
|
42530
|
+
};
|
|
42531
|
+
return finding;
|
|
42532
|
+
}
|
|
42533
|
+
function coerceGate(raw) {
|
|
42534
|
+
if (raw === null || typeof raw !== "object") return null;
|
|
42535
|
+
const r = raw;
|
|
42536
|
+
return {
|
|
42537
|
+
reread_cited_line: coerceGateCheck(r["reread_cited_line"]),
|
|
42538
|
+
traced_call_path: coerceGateCheck(r["traced_call_path"]),
|
|
42539
|
+
named_assertion: typeof r["named_assertion"] === "string" ? r["named_assertion"] : "",
|
|
42540
|
+
ruled_out_language_non_issue: coerceGateCheck(r["ruled_out_language_non_issue"])
|
|
42541
|
+
};
|
|
42542
|
+
}
|
|
42543
|
+
function coerceGateCheck(raw) {
|
|
42544
|
+
if (raw === "passed" || raw === "failed" || raw === "skipped") return raw;
|
|
42545
|
+
if (raw === true) return "passed";
|
|
42546
|
+
if (raw === false) return "failed";
|
|
42547
|
+
return "skipped";
|
|
42548
|
+
}
|
|
42549
|
+
function coerceSeverity(raw) {
|
|
42550
|
+
if (raw === "critical" || raw === "high" || raw === "medium" || raw === "low") return raw;
|
|
42551
|
+
return "medium";
|
|
42552
|
+
}
|
|
42553
|
+
var FINDINGS_FORMAT_INSTRUCTIONS = `If you have one or more findings (claims that justify request_changes), emit them in a fenced YAML block at the END of your reasoning, exactly as below. If you're approving, OMIT the block entirely.
|
|
42554
|
+
|
|
42555
|
+
\`\`\`yaml findings
|
|
42556
|
+
- summary: 'One-line summary of the issue'
|
|
42557
|
+
location: path/file.ext:LINE
|
|
42558
|
+
severity: critical | high | medium | low
|
|
42559
|
+
gate:
|
|
42560
|
+
reread_cited_line: passed
|
|
42561
|
+
traced_call_path: passed
|
|
42562
|
+
named_assertion: 'Concrete failing assertion \u2014 what test would fail and how. Must be substantive, not "passed".'
|
|
42563
|
+
ruled_out_language_non_issue: passed
|
|
42564
|
+
claim: 'What is wrong and why it justifies blocking the merge.'
|
|
42565
|
+
\`\`\`
|
|
42566
|
+
|
|
42567
|
+
A finding only triggers request_changes if ALL FOUR gate checks are 'passed' AND named_assertion is substantive (>10 chars, naming a concrete failure). Findings missing any of those surface as informational only \u2014 they do not block the merge. This is the #2225 verification gate; the 2026-04-25 audit found a 100% false-positive rate when this gate was not enforced.`;
|
|
42568
|
+
|
|
42569
|
+
// src/mcp/tools/pr-review-tool.ts
|
|
42570
|
+
var PR_REVIEW_ROLES = [
|
|
42571
|
+
"architect",
|
|
42572
|
+
"security",
|
|
42573
|
+
"devex",
|
|
42574
|
+
"catfish",
|
|
42575
|
+
"scope_steward"
|
|
42576
|
+
];
|
|
42577
|
+
var MAX_DIFF_LENGTH = 5e4;
|
|
42578
|
+
var MAX_DESCRIPTION_LENGTH = 1e4;
|
|
42579
|
+
var PrReviewInputSchema = z89.object({
|
|
42580
|
+
prTitle: z89.string().min(1).max(500).describe("PR title"),
|
|
42581
|
+
prDescription: z89.string().max(MAX_DESCRIPTION_LENGTH).optional().describe("PR body / description"),
|
|
42582
|
+
prDiff: z89.string().min(1).max(MAX_DIFF_LENGTH).describe(`Unified diff text (max ${String(MAX_DIFF_LENGTH)} chars; truncate before calling)`),
|
|
42583
|
+
repoContext: z89.string().max(2e3).optional().describe("Optional one-paragraph repo context (architecture, conventions)"),
|
|
42584
|
+
baseRef: z89.string().max(200).optional().describe("Base branch ref (e.g. main)"),
|
|
42585
|
+
headRef: z89.string().max(200).optional().describe("Head branch ref"),
|
|
42586
|
+
simulate: z89.boolean().default(false).describe("Use simulated voters (testing only; never ship live with this true)")
|
|
42587
|
+
});
|
|
42588
|
+
function mapVoteDecisionToPrDecision(voteDecision) {
|
|
42589
|
+
if (voteDecision === "reject") return "request_changes";
|
|
42590
|
+
return voteDecision;
|
|
42591
|
+
}
|
|
42592
|
+
var SOFT_BLOCK_REQUEST_CHANGES_THRESHOLD = 3;
|
|
42593
|
+
function aggregatePrDecisions(reviews) {
|
|
42594
|
+
const valid = reviews.filter((r) => r.source !== "error");
|
|
42595
|
+
if (valid.length === 0) return { decision: "abstain", verified: true };
|
|
42596
|
+
const hasVerifiedBlocker = valid.some(
|
|
42597
|
+
(r) => r.decision === "request_changes" && r.findings.some((f) => f.verified)
|
|
42598
|
+
);
|
|
42599
|
+
if (hasVerifiedBlocker) return { decision: "request_changes", verified: true };
|
|
42600
|
+
const requestChangesVoters = valid.filter((r) => r.decision === "request_changes").length;
|
|
42601
|
+
if (requestChangesVoters >= SOFT_BLOCK_REQUEST_CHANGES_THRESHOLD) {
|
|
42602
|
+
return { decision: "request_changes", verified: false };
|
|
42603
|
+
}
|
|
42604
|
+
if (valid.every((r) => r.decision === "approve")) {
|
|
42605
|
+
return { decision: "approve", verified: true };
|
|
42606
|
+
}
|
|
42607
|
+
return { decision: "abstain", verified: true };
|
|
42608
|
+
}
|
|
42609
|
+
function buildPrReviewProposal(input) {
|
|
42610
|
+
const parts = [];
|
|
42611
|
+
parts.push(`# Pull Request Review
|
|
42612
|
+
`);
|
|
42613
|
+
parts.push(`**Title:** ${input.prTitle}
|
|
42614
|
+
`);
|
|
42615
|
+
if (input.baseRef !== void 0 && input.headRef !== void 0) {
|
|
42616
|
+
parts.push(`**Branches:** ${input.headRef} \u2192 ${input.baseRef}
|
|
42617
|
+
`);
|
|
42618
|
+
}
|
|
42619
|
+
if (input.repoContext !== void 0 && input.repoContext !== "") {
|
|
42620
|
+
parts.push(`
|
|
42621
|
+
**Repo context:**
|
|
42622
|
+
${input.repoContext}
|
|
42623
|
+
`);
|
|
42624
|
+
}
|
|
42625
|
+
if (input.prDescription !== void 0 && input.prDescription !== "") {
|
|
42626
|
+
parts.push(`
|
|
42627
|
+
**Description:**
|
|
42628
|
+
${input.prDescription}
|
|
42629
|
+
`);
|
|
42630
|
+
}
|
|
42631
|
+
parts.push(`
|
|
42632
|
+
## Diff
|
|
42633
|
+
|
|
42634
|
+
\`\`\`diff
|
|
42635
|
+
${input.prDiff}
|
|
42636
|
+
\`\`\`
|
|
42637
|
+
`);
|
|
42638
|
+
parts.push(`
|
|
42639
|
+
## Your task
|
|
42640
|
+
`);
|
|
42641
|
+
parts.push(`Review this PR from your role's perspective. Decide: should it be merged as-is?
|
|
42642
|
+
`);
|
|
42643
|
+
parts.push(`- **APPROVE** if the diff is correct, complete, and aligned with your role.
|
|
42644
|
+
`);
|
|
42645
|
+
parts.push(
|
|
42646
|
+
`- **REJECT** (= "request changes") if there is at least one concrete defect, missing requirement, or violation that justifies blocking the merge.
|
|
42647
|
+
`
|
|
42648
|
+
);
|
|
42649
|
+
parts.push(`- **ABSTAIN** if the diff is outside your role's concerns.
|
|
42650
|
+
`);
|
|
42651
|
+
parts.push(`
|
|
42652
|
+
${FINDINGS_FORMAT_INSTRUCTIONS}
|
|
42653
|
+
`);
|
|
42654
|
+
return parts.join("");
|
|
42655
|
+
}
|
|
42656
|
+
function resolveFindings(result) {
|
|
42657
|
+
const raw = result.vote.findings;
|
|
42658
|
+
if (raw !== void 0 && raw.length > 0) {
|
|
42659
|
+
return raw.map((f) => ({
|
|
42660
|
+
summary: f.summary,
|
|
42661
|
+
location: f.location,
|
|
42662
|
+
severity: f.severity,
|
|
42663
|
+
gate: f.gate,
|
|
42664
|
+
claim: f.claim,
|
|
42665
|
+
verified: isFindingVerified(f.gate)
|
|
42666
|
+
}));
|
|
42667
|
+
}
|
|
42668
|
+
return parseFindings(result.vote.reasoning);
|
|
42669
|
+
}
|
|
42670
|
+
function toPrReviewVote(result) {
|
|
42671
|
+
return {
|
|
42672
|
+
role: result.role,
|
|
42673
|
+
decision: mapVoteDecisionToPrDecision(result.vote.decision),
|
|
42674
|
+
confidence: result.vote.confidence,
|
|
42675
|
+
reasoning: result.vote.reasoning,
|
|
42676
|
+
findings: resolveFindings(result),
|
|
42677
|
+
source: result.source,
|
|
42678
|
+
cli: result.cli,
|
|
42679
|
+
processingTimeMs: result.processingTimeMs,
|
|
42680
|
+
...result.error !== void 0 && { errorMessage: result.error }
|
|
42681
|
+
};
|
|
42682
|
+
}
|
|
42683
|
+
function summarizeReviews(reviews) {
|
|
42684
|
+
return {
|
|
42685
|
+
approveCount: reviews.filter((r) => r.source !== "error" && r.decision === "approve").length,
|
|
42686
|
+
requestChangesCount: reviews.filter(
|
|
42687
|
+
(r) => r.source !== "error" && r.decision === "request_changes"
|
|
42688
|
+
).length,
|
|
42689
|
+
abstainCount: reviews.filter((r) => r.source !== "error" && r.decision === "abstain").length,
|
|
42690
|
+
errorCount: reviews.filter((r) => r.source === "error").length
|
|
42691
|
+
};
|
|
42692
|
+
}
|
|
42693
|
+
async function prReviewHandler(args, ctx) {
|
|
42694
|
+
const parsed = PrReviewInputSchema.safeParse(args);
|
|
42695
|
+
if (!parsed.success) {
|
|
42696
|
+
return toolError(`Validation error: ${formatZodError(parsed.error)}`);
|
|
42697
|
+
}
|
|
42698
|
+
const input = parsed.data;
|
|
42699
|
+
const start = Date.now();
|
|
42700
|
+
try {
|
|
42701
|
+
const proposal = buildPrReviewProposal(input);
|
|
42702
|
+
const voteResults = await collectRealVotes({
|
|
42703
|
+
roles: PR_REVIEW_ROLES,
|
|
42704
|
+
proposal,
|
|
42705
|
+
simulate: input.simulate,
|
|
42706
|
+
logger: ctx.logger
|
|
42707
|
+
});
|
|
42708
|
+
const reviews = voteResults.map(toPrReviewVote);
|
|
42709
|
+
const counts = summarizeReviews(reviews);
|
|
42710
|
+
const aggregate = aggregatePrDecisions(reviews);
|
|
42711
|
+
const response = {
|
|
42712
|
+
summary: aggregate.decision,
|
|
42713
|
+
verified: aggregate.verified,
|
|
42714
|
+
...counts,
|
|
42715
|
+
reviews,
|
|
42716
|
+
totalDurationMs: Date.now() - start
|
|
42717
|
+
};
|
|
42718
|
+
return toolSuccess(JSON.stringify(response, null, 2));
|
|
42719
|
+
} catch (error) {
|
|
42720
|
+
return toolError(`PR review failed: ${getErrorMessage(error)}`);
|
|
42721
|
+
}
|
|
42722
|
+
}
|
|
42723
|
+
function registerPrReviewTool(server, deps) {
|
|
42724
|
+
const logger56 = deps.logger ?? createLogger({ tool: "pr_review" });
|
|
42725
|
+
const description = "Run multi-voter consensus review on a PR diff (#2233). 5 voters (architect, security, devex, catfish, scope_steward) each emit approve/request_changes/abstain with reasoning and citations. Reuses consensus_vote infra; experimental.";
|
|
42726
|
+
const secureHandler = createSecureHandler(prReviewHandler, {
|
|
42727
|
+
toolName: "pr_review",
|
|
42728
|
+
rateLimiter: deps.rateLimiter,
|
|
42729
|
+
logger: logger56
|
|
42730
|
+
});
|
|
42731
|
+
const timeoutMs = getToolTimeout("pr_review", deps.security);
|
|
42732
|
+
const wrappedHandler = wrapToolWithTimeout("pr_review", secureHandler, { timeoutMs, logger: logger56 });
|
|
42733
|
+
server.registerTool(
|
|
42734
|
+
"pr_review",
|
|
42735
|
+
{ description, inputSchema: PrReviewInputSchema.shape },
|
|
42736
|
+
toSdkCallback(wrappedHandler)
|
|
42737
|
+
);
|
|
42738
|
+
logger56.info("Registered pr_review tool");
|
|
42739
|
+
}
|
|
42740
|
+
|
|
42741
|
+
// src/mcp/tools/query-task-state-tool.ts
|
|
42742
|
+
import { z as z90 } from "zod";
|
|
42743
|
+
var QueryTaskStateInputSchema = z90.object({
|
|
42744
|
+
taskId: z90.string().min(1).max(128).describe("Task ID whose structured state log should be read")
|
|
42417
42745
|
});
|
|
42418
42746
|
function queryTaskStateHandler(args, ctx) {
|
|
42419
42747
|
const parsed = QueryTaskStateInputSchema.safeParse(args);
|
|
@@ -42443,7 +42771,7 @@ function queryTaskStateHandler(args, ctx) {
|
|
|
42443
42771
|
function registerQueryTaskStateTool(server, deps) {
|
|
42444
42772
|
const logger56 = deps.logger ?? createLogger({ tool: "query_task_state" });
|
|
42445
42773
|
const toolSchema = {
|
|
42446
|
-
taskId:
|
|
42774
|
+
taskId: z90.string().min(1).max(128).describe("Task ID whose structured state log should be read")
|
|
42447
42775
|
};
|
|
42448
42776
|
const description = "Read the structured state log for a task ID and return the current snapshot. Structured state is only written when NEXUS_TASK_STATE_ENABLED=1 was set during the orchestrate invocation.";
|
|
42449
42777
|
const secureHandler = createSecureHandler(queryTaskStateHandler, {
|
|
@@ -42465,18 +42793,18 @@ function registerQueryTaskStateTool(server, deps) {
|
|
|
42465
42793
|
}
|
|
42466
42794
|
|
|
42467
42795
|
// src/mcp/tools/pipeline-tool.ts
|
|
42468
|
-
import { z as
|
|
42796
|
+
import { z as z91 } from "zod";
|
|
42469
42797
|
import * as fs9 from "fs";
|
|
42470
42798
|
import * as path11 from "path";
|
|
42471
|
-
var PipelineInputSchema =
|
|
42799
|
+
var PipelineInputSchema = z91.object({
|
|
42472
42800
|
/** The task to execute. */
|
|
42473
|
-
task:
|
|
42801
|
+
task: z91.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
|
|
42474
42802
|
/** Path to a spec file (.md, .yaml) to use as task input. */
|
|
42475
|
-
specFile:
|
|
42803
|
+
specFile: z91.string().max(500).optional().describe("Path to a spec file \u2014 content prepended to task for greenfield projects"),
|
|
42476
42804
|
/** Override template (dev, research, audit, greenfield). Auto-detected if omitted. */
|
|
42477
|
-
template:
|
|
42805
|
+
template: z91.string().max(50).optional().describe(`Pipeline template override. Available: ${listTemplateIds().join(", ")}`),
|
|
42478
42806
|
/** Voting strategy for consensus stages. */
|
|
42479
|
-
votingStrategy:
|
|
42807
|
+
votingStrategy: z91.enum([
|
|
42480
42808
|
"simple_majority",
|
|
42481
42809
|
"supermajority",
|
|
42482
42810
|
"unanimous",
|
|
@@ -42487,13 +42815,13 @@ var PipelineInputSchema = z90.object({
|
|
|
42487
42815
|
"Voting strategy for plan approval. simple_majority (default), supermajority (67%), unanimous, higher_order (Bayesian), proof_of_learning, opinion_wise"
|
|
42488
42816
|
),
|
|
42489
42817
|
/** Use 3 agents instead of 6 for faster voting. */
|
|
42490
|
-
quickMode:
|
|
42818
|
+
quickMode: z91.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
|
|
42491
42819
|
/** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
|
|
42492
|
-
timeoutMs:
|
|
42820
|
+
timeoutMs: z91.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
|
|
42493
42821
|
/** Stop after planning/voting (no implementation). */
|
|
42494
|
-
dryRun:
|
|
42822
|
+
dryRun: z91.boolean().default(false).describe("Stop after vote stage (no implementation)"),
|
|
42495
42823
|
/** Use simulated votes (for testing). */
|
|
42496
|
-
simulateVotes:
|
|
42824
|
+
simulateVotes: z91.boolean().default(false).describe("Use simulated votes (for testing without real CLIs)")
|
|
42497
42825
|
});
|
|
42498
42826
|
function buildOutput2(result) {
|
|
42499
42827
|
return {
|
|
@@ -42981,7 +43309,8 @@ function registerTools(server, options) {
|
|
|
42981
43309
|
"extract_symbols",
|
|
42982
43310
|
"search_codebase",
|
|
42983
43311
|
"run_dev_pipeline",
|
|
42984
|
-
"run_pipeline"
|
|
43312
|
+
"run_pipeline",
|
|
43313
|
+
"pr_review"
|
|
42985
43314
|
],
|
|
42986
43315
|
logger: logger56,
|
|
42987
43316
|
rateLimiter
|
|
@@ -43109,40 +43438,40 @@ var RiskLevel = /* @__PURE__ */ ((RiskLevel2) => {
|
|
|
43109
43438
|
})(RiskLevel || {});
|
|
43110
43439
|
|
|
43111
43440
|
// src/mcp/safety/stpa-schemas.ts
|
|
43112
|
-
import { z as
|
|
43113
|
-
var HazardCategorySchema =
|
|
43114
|
-
var HazardSeveritySchema =
|
|
43115
|
-
var ConstraintPrioritySchema =
|
|
43116
|
-
var RiskLevelSchema =
|
|
43117
|
-
var TriggerPatternSchema =
|
|
43118
|
-
parameter:
|
|
43119
|
-
matchType:
|
|
43120
|
-
pattern:
|
|
43121
|
-
reason:
|
|
43441
|
+
import { z as z92 } from "zod";
|
|
43442
|
+
var HazardCategorySchema = z92.enum(HazardCategory);
|
|
43443
|
+
var HazardSeveritySchema = z92.enum(HazardSeverity);
|
|
43444
|
+
var ConstraintPrioritySchema = z92.enum(ConstraintPriority);
|
|
43445
|
+
var RiskLevelSchema = z92.enum(RiskLevel);
|
|
43446
|
+
var TriggerPatternSchema = z92.object({
|
|
43447
|
+
parameter: z92.string().min(1),
|
|
43448
|
+
matchType: z92.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
|
|
43449
|
+
pattern: z92.string(),
|
|
43450
|
+
reason: z92.string()
|
|
43122
43451
|
});
|
|
43123
|
-
var HazardSchema =
|
|
43124
|
-
id:
|
|
43125
|
-
description:
|
|
43452
|
+
var HazardSchema = z92.object({
|
|
43453
|
+
id: z92.string().min(1),
|
|
43454
|
+
description: z92.string(),
|
|
43126
43455
|
category: HazardCategorySchema,
|
|
43127
43456
|
severity: HazardSeveritySchema,
|
|
43128
|
-
likelihood:
|
|
43129
|
-
triggerConditions:
|
|
43130
|
-
consequences:
|
|
43457
|
+
likelihood: z92.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
|
|
43458
|
+
triggerConditions: z92.array(z92.string()),
|
|
43459
|
+
consequences: z92.array(z92.string())
|
|
43131
43460
|
});
|
|
43132
|
-
var UnsafeControlActionSchema =
|
|
43133
|
-
id:
|
|
43134
|
-
toolName:
|
|
43135
|
-
type:
|
|
43136
|
-
description:
|
|
43137
|
-
unsafeContext:
|
|
43138
|
-
relatedHazards:
|
|
43139
|
-
triggerPatterns:
|
|
43461
|
+
var UnsafeControlActionSchema = z92.object({
|
|
43462
|
+
id: z92.string().min(1),
|
|
43463
|
+
toolName: z92.string().min(1),
|
|
43464
|
+
type: z92.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
|
|
43465
|
+
description: z92.string(),
|
|
43466
|
+
unsafeContext: z92.string(),
|
|
43467
|
+
relatedHazards: z92.array(z92.string()),
|
|
43468
|
+
triggerPatterns: z92.array(TriggerPatternSchema).optional()
|
|
43140
43469
|
});
|
|
43141
|
-
var SafetyConstraintSchema =
|
|
43142
|
-
id:
|
|
43143
|
-
description:
|
|
43144
|
-
mitigates:
|
|
43145
|
-
enforcement:
|
|
43470
|
+
var SafetyConstraintSchema = z92.object({
|
|
43471
|
+
id: z92.string().min(1),
|
|
43472
|
+
description: z92.string(),
|
|
43473
|
+
mitigates: z92.array(z92.string()),
|
|
43474
|
+
enforcement: z92.enum([
|
|
43146
43475
|
"prevent",
|
|
43147
43476
|
"require_confirmation",
|
|
43148
43477
|
"alert",
|
|
@@ -43150,54 +43479,54 @@ var SafetyConstraintSchema = z91.object({
|
|
|
43150
43479
|
"rate_limit",
|
|
43151
43480
|
"require_privilege"
|
|
43152
43481
|
]),
|
|
43153
|
-
validationFunction:
|
|
43482
|
+
validationFunction: z92.string().optional(),
|
|
43154
43483
|
priority: ConstraintPrioritySchema
|
|
43155
43484
|
});
|
|
43156
|
-
var PropertySchemaSchema =
|
|
43157
|
-
type:
|
|
43158
|
-
description:
|
|
43159
|
-
enum:
|
|
43160
|
-
pattern:
|
|
43161
|
-
minimum:
|
|
43162
|
-
maximum:
|
|
43485
|
+
var PropertySchemaSchema = z92.object({
|
|
43486
|
+
type: z92.string(),
|
|
43487
|
+
description: z92.string().optional(),
|
|
43488
|
+
enum: z92.array(z92.unknown()).optional(),
|
|
43489
|
+
pattern: z92.string().optional(),
|
|
43490
|
+
minimum: z92.number().optional(),
|
|
43491
|
+
maximum: z92.number().optional()
|
|
43163
43492
|
});
|
|
43164
|
-
var ToolInputSchemaSchema =
|
|
43165
|
-
type:
|
|
43166
|
-
properties:
|
|
43167
|
-
required:
|
|
43168
|
-
additionalProperties:
|
|
43493
|
+
var ToolInputSchemaSchema = z92.object({
|
|
43494
|
+
type: z92.string(),
|
|
43495
|
+
properties: z92.record(z92.string(), PropertySchemaSchema).optional(),
|
|
43496
|
+
required: z92.array(z92.string()).optional(),
|
|
43497
|
+
additionalProperties: z92.boolean().optional()
|
|
43169
43498
|
});
|
|
43170
|
-
var ToolDefinitionSchema =
|
|
43171
|
-
name:
|
|
43172
|
-
description:
|
|
43499
|
+
var ToolDefinitionSchema = z92.object({
|
|
43500
|
+
name: z92.string().min(1),
|
|
43501
|
+
description: z92.string(),
|
|
43173
43502
|
inputSchema: ToolInputSchemaSchema
|
|
43174
43503
|
});
|
|
43175
|
-
var AnalysisConfigurationSchema =
|
|
43176
|
-
includeLowSeverity:
|
|
43177
|
-
generateAllConstraints:
|
|
43178
|
-
checkInteractions:
|
|
43179
|
-
maxHazardsPerTool:
|
|
43180
|
-
categories:
|
|
43504
|
+
var AnalysisConfigurationSchema = z92.object({
|
|
43505
|
+
includeLowSeverity: z92.boolean().default(true),
|
|
43506
|
+
generateAllConstraints: z92.boolean().default(true),
|
|
43507
|
+
checkInteractions: z92.boolean().default(true),
|
|
43508
|
+
maxHazardsPerTool: z92.number().int().min(1).max(100).default(50),
|
|
43509
|
+
categories: z92.array(HazardCategorySchema).default([])
|
|
43181
43510
|
});
|
|
43182
|
-
var ConstraintViolationSchema =
|
|
43183
|
-
constraintId:
|
|
43184
|
-
constraintDescription:
|
|
43511
|
+
var ConstraintViolationSchema = z92.object({
|
|
43512
|
+
constraintId: z92.string().min(1),
|
|
43513
|
+
constraintDescription: z92.string(),
|
|
43185
43514
|
severity: HazardSeveritySchema,
|
|
43186
|
-
details:
|
|
43187
|
-
remediation:
|
|
43515
|
+
details: z92.string(),
|
|
43516
|
+
remediation: z92.string()
|
|
43188
43517
|
});
|
|
43189
|
-
var ValidationWarningSchema =
|
|
43190
|
-
code:
|
|
43191
|
-
message:
|
|
43192
|
-
affected:
|
|
43518
|
+
var ValidationWarningSchema = z92.object({
|
|
43519
|
+
code: z92.string().min(1),
|
|
43520
|
+
message: z92.string(),
|
|
43521
|
+
affected: z92.string()
|
|
43193
43522
|
});
|
|
43194
|
-
var ValidationResultSchema =
|
|
43195
|
-
valid:
|
|
43196
|
-
toolName:
|
|
43197
|
-
violations:
|
|
43198
|
-
passed:
|
|
43199
|
-
warnings:
|
|
43200
|
-
validatedAt:
|
|
43523
|
+
var ValidationResultSchema = z92.object({
|
|
43524
|
+
valid: z92.boolean(),
|
|
43525
|
+
toolName: z92.string().min(1),
|
|
43526
|
+
violations: z92.array(ConstraintViolationSchema),
|
|
43527
|
+
passed: z92.array(z92.string()),
|
|
43528
|
+
warnings: z92.array(ValidationWarningSchema),
|
|
43529
|
+
validatedAt: z92.date()
|
|
43201
43530
|
});
|
|
43202
43531
|
|
|
43203
43532
|
// src/mcp/safety/stpa-types.ts
|
|
@@ -44282,22 +44611,22 @@ var GeminiResponseParser = class {
|
|
|
44282
44611
|
};
|
|
44283
44612
|
|
|
44284
44613
|
// src/cli-adapters/task-analyzer.ts
|
|
44285
|
-
import { z as
|
|
44286
|
-
var TaskProfileSchema =
|
|
44614
|
+
import { z as z93 } from "zod";
|
|
44615
|
+
var TaskProfileSchema = z93.object({
|
|
44287
44616
|
/** Estimated input tokens required */
|
|
44288
|
-
contextRequired:
|
|
44617
|
+
contextRequired: z93.number().min(0),
|
|
44289
44618
|
/** Reasoning complexity on 0-10 scale */
|
|
44290
|
-
reasoningComplexity:
|
|
44619
|
+
reasoningComplexity: z93.number().min(0).max(10),
|
|
44291
44620
|
/** Whether task involves code generation */
|
|
44292
|
-
codeGeneration:
|
|
44621
|
+
codeGeneration: z93.boolean(),
|
|
44293
44622
|
/** Whether task involves multimodal content (images, etc.) */
|
|
44294
|
-
multimodal:
|
|
44623
|
+
multimodal: z93.boolean(),
|
|
44295
44624
|
/** Whether task can be split into parallel subtasks */
|
|
44296
|
-
parallelizable:
|
|
44625
|
+
parallelizable: z93.boolean(),
|
|
44297
44626
|
/** Whether cost should be minimized */
|
|
44298
|
-
budgetSensitive:
|
|
44627
|
+
budgetSensitive: z93.boolean(),
|
|
44299
44628
|
/** Primary task type classification */
|
|
44300
|
-
taskType:
|
|
44629
|
+
taskType: z93.enum([
|
|
44301
44630
|
"architecture",
|
|
44302
44631
|
"code_implementation",
|
|
44303
44632
|
"code_review",
|
|
@@ -44311,53 +44640,53 @@ var TaskProfileSchema = z92.object({
|
|
|
44311
44640
|
});
|
|
44312
44641
|
|
|
44313
44642
|
// src/cli-adapters/router-types.ts
|
|
44314
|
-
import { z as
|
|
44315
|
-
var RouterConfigSchema =
|
|
44316
|
-
minCapacityThreshold:
|
|
44317
|
-
preferCostEfficient:
|
|
44318
|
-
maxDecisionTimeMs:
|
|
44643
|
+
import { z as z94 } from "zod";
|
|
44644
|
+
var RouterConfigSchema = z94.object({
|
|
44645
|
+
minCapacityThreshold: z94.number().min(0).max(1).default(0.1),
|
|
44646
|
+
preferCostEfficient: z94.boolean().default(false),
|
|
44647
|
+
maxDecisionTimeMs: z94.number().min(1).max(1e3).default(100)
|
|
44319
44648
|
});
|
|
44320
44649
|
|
|
44321
44650
|
// src/cli-adapters/agreement-cascade-types.ts
|
|
44322
|
-
import { z as
|
|
44323
|
-
var AgreementCascadeConfigSchema =
|
|
44324
|
-
agreementThreshold:
|
|
44325
|
-
maxStages:
|
|
44326
|
-
modelTimeoutMs:
|
|
44651
|
+
import { z as z95 } from "zod";
|
|
44652
|
+
var AgreementCascadeConfigSchema = z95.object({
|
|
44653
|
+
agreementThreshold: z95.number().min(0.5).max(1).default(0.7),
|
|
44654
|
+
maxStages: z95.number().int().min(1).max(5).default(3),
|
|
44655
|
+
modelTimeoutMs: z95.number().int().min(1e3).max(3e5).default(6e4)
|
|
44327
44656
|
});
|
|
44328
44657
|
|
|
44329
44658
|
// src/cli-adapters/agreement-cascade-router.ts
|
|
44330
44659
|
var logger42 = createLogger({ component: "agreement-cascade-router" });
|
|
44331
44660
|
|
|
44332
44661
|
// src/cli-adapters/daao-types.ts
|
|
44333
|
-
import { z as
|
|
44334
|
-
var EncodedFeaturesSchema =
|
|
44662
|
+
import { z as z96 } from "zod";
|
|
44663
|
+
var EncodedFeaturesSchema = z96.object({
|
|
44335
44664
|
/** Lexical complexity score (vocabulary diversity, rare words) */
|
|
44336
|
-
lexicalComplexity:
|
|
44665
|
+
lexicalComplexity: z96.number().min(0).max(1),
|
|
44337
44666
|
/** Syntactic complexity score (sentence structure, nesting) */
|
|
44338
|
-
syntacticComplexity:
|
|
44667
|
+
syntacticComplexity: z96.number().min(0).max(1),
|
|
44339
44668
|
/** Semantic density score (concept density, abstraction level) */
|
|
44340
|
-
semanticDensity:
|
|
44669
|
+
semanticDensity: z96.number().min(0).max(1),
|
|
44341
44670
|
/** Technical specificity (domain-specific terminology) */
|
|
44342
|
-
technicalSpecificity:
|
|
44671
|
+
technicalSpecificity: z96.number().min(0).max(1),
|
|
44343
44672
|
/** Task scope (breadth of requirements) */
|
|
44344
|
-
taskScope:
|
|
44673
|
+
taskScope: z96.number().min(0).max(1),
|
|
44345
44674
|
/** Constraint complexity (constraints, edge cases, requirements) */
|
|
44346
|
-
constraintComplexity:
|
|
44675
|
+
constraintComplexity: z96.number().min(0).max(1),
|
|
44347
44676
|
/** Ambiguity level (inverse - higher means more clear/specific) */
|
|
44348
|
-
clarity:
|
|
44677
|
+
clarity: z96.number().min(0).max(1),
|
|
44349
44678
|
/** Output complexity expectation */
|
|
44350
|
-
outputComplexity:
|
|
44679
|
+
outputComplexity: z96.number().min(0).max(1)
|
|
44351
44680
|
});
|
|
44352
|
-
var FeatureWeightsSchema =
|
|
44353
|
-
lexicalComplexity:
|
|
44354
|
-
syntacticComplexity:
|
|
44355
|
-
semanticDensity:
|
|
44356
|
-
technicalSpecificity:
|
|
44357
|
-
taskScope:
|
|
44358
|
-
constraintComplexity:
|
|
44359
|
-
clarity:
|
|
44360
|
-
outputComplexity:
|
|
44681
|
+
var FeatureWeightsSchema = z96.object({
|
|
44682
|
+
lexicalComplexity: z96.number().min(0).max(1),
|
|
44683
|
+
syntacticComplexity: z96.number().min(0).max(1),
|
|
44684
|
+
semanticDensity: z96.number().min(0).max(1),
|
|
44685
|
+
technicalSpecificity: z96.number().min(0).max(1),
|
|
44686
|
+
taskScope: z96.number().min(0).max(1),
|
|
44687
|
+
constraintComplexity: z96.number().min(0).max(1),
|
|
44688
|
+
clarity: z96.number().min(0).max(1),
|
|
44689
|
+
outputComplexity: z96.number().min(0).max(1)
|
|
44361
44690
|
});
|
|
44362
44691
|
var DEFAULT_FEATURE_WEIGHTS = {
|
|
44363
44692
|
lexicalComplexity: 0.1,
|
|
@@ -44379,50 +44708,50 @@ var DEFAULT_DAAO_TIER_TO_CLIS = {
|
|
|
44379
44708
|
balanced: ["codex", "opencode", "gemini", "claude"],
|
|
44380
44709
|
powerful: ["claude", "codex", "opencode", "gemini"]
|
|
44381
44710
|
};
|
|
44382
|
-
var DAAOConfigSchema =
|
|
44711
|
+
var DAAOConfigSchema = z96.object({
|
|
44383
44712
|
/** Difficulty thresholds for level classification */
|
|
44384
|
-
thresholds:
|
|
44385
|
-
easyUpperBound:
|
|
44386
|
-
hardLowerBound:
|
|
44713
|
+
thresholds: z96.object({
|
|
44714
|
+
easyUpperBound: z96.number().min(0).max(1),
|
|
44715
|
+
hardLowerBound: z96.number().min(0).max(1)
|
|
44387
44716
|
}).default(DEFAULT_DAAO_THRESHOLDS),
|
|
44388
44717
|
/** Feature weights for difficulty aggregation */
|
|
44389
44718
|
weights: FeatureWeightsSchema.default(DEFAULT_FEATURE_WEIGHTS),
|
|
44390
44719
|
/** Mapping from model tier to CLI preference order */
|
|
44391
|
-
tierToClis:
|
|
44392
|
-
|
|
44393
|
-
|
|
44720
|
+
tierToClis: z96.record(
|
|
44721
|
+
z96.enum(["fast", "balanced", "powerful"]),
|
|
44722
|
+
z96.array(z96.enum(["claude", "gemini", "codex", "opencode"]))
|
|
44394
44723
|
).default(DEFAULT_DAAO_TIER_TO_CLIS),
|
|
44395
44724
|
/** Enable adaptive calibration from outcomes */
|
|
44396
|
-
enableCalibration:
|
|
44725
|
+
enableCalibration: z96.boolean().default(true),
|
|
44397
44726
|
/** Maximum outcomes to store for calibration */
|
|
44398
|
-
maxCalibrationOutcomes:
|
|
44727
|
+
maxCalibrationOutcomes: z96.number().int().positive().default(1e3),
|
|
44399
44728
|
/** Minimum outcomes before applying calibration adjustments */
|
|
44400
|
-
minCalibrationOutcomes:
|
|
44729
|
+
minCalibrationOutcomes: z96.number().int().positive().default(50),
|
|
44401
44730
|
/** Reconstruction error threshold for typical patterns */
|
|
44402
|
-
typicalPatternThreshold:
|
|
44731
|
+
typicalPatternThreshold: z96.number().min(0).max(1).default(0.3),
|
|
44403
44732
|
/** Verbose logging */
|
|
44404
|
-
verbose:
|
|
44733
|
+
verbose: z96.boolean().default(false)
|
|
44405
44734
|
});
|
|
44406
44735
|
|
|
44407
44736
|
// src/cli-adapters/task-classifier.ts
|
|
44408
|
-
import { z as
|
|
44409
|
-
var ClassificationPatternsSchema =
|
|
44410
|
-
code:
|
|
44411
|
-
research:
|
|
44412
|
-
documentation:
|
|
44413
|
-
analysis:
|
|
44737
|
+
import { z as z97 } from "zod";
|
|
44738
|
+
var ClassificationPatternsSchema = z97.object({
|
|
44739
|
+
code: z97.array(z97.string()).readonly(),
|
|
44740
|
+
research: z97.array(z97.string()).readonly(),
|
|
44741
|
+
documentation: z97.array(z97.string()).readonly(),
|
|
44742
|
+
analysis: z97.array(z97.string()).readonly()
|
|
44414
44743
|
});
|
|
44415
44744
|
|
|
44416
44745
|
// src/cli-adapters/response-cache-types.ts
|
|
44417
|
-
import { z as
|
|
44418
|
-
var ResponseCacheConfigSchema =
|
|
44419
|
-
defaultTTL:
|
|
44746
|
+
import { z as z98 } from "zod";
|
|
44747
|
+
var ResponseCacheConfigSchema = z98.object({
|
|
44748
|
+
defaultTTL: z98.number().min(1e3).max(36e5).default(3e5),
|
|
44420
44749
|
// 5 minutes
|
|
44421
|
-
maxEntries:
|
|
44422
|
-
maxMemoryMB:
|
|
44423
|
-
cleanupInterval:
|
|
44750
|
+
maxEntries: z98.number().min(10).max(1e5).default(1e3),
|
|
44751
|
+
maxMemoryMB: z98.number().min(1).max(1e3).default(50),
|
|
44752
|
+
cleanupInterval: z98.number().min(1e3).max(6e5).default(6e4),
|
|
44424
44753
|
// 1 minute
|
|
44425
|
-
enableLogging:
|
|
44754
|
+
enableLogging: z98.boolean().default(false)
|
|
44426
44755
|
});
|
|
44427
44756
|
|
|
44428
44757
|
// src/cli-adapters/response-cache-utils.ts
|
|
@@ -44430,12 +44759,12 @@ import { createHash as createHash3 } from "crypto";
|
|
|
44430
44759
|
var logger43 = createLogger({ component: "ResponseCacheUtils" });
|
|
44431
44760
|
|
|
44432
44761
|
// src/cli-adapters/unified-routing-types.ts
|
|
44433
|
-
import { z as
|
|
44434
|
-
var UnifiedRoutingDecisionSchema =
|
|
44435
|
-
selectedCli:
|
|
44436
|
-
confidence:
|
|
44437
|
-
reason:
|
|
44438
|
-
strategy:
|
|
44762
|
+
import { z as z99 } from "zod";
|
|
44763
|
+
var UnifiedRoutingDecisionSchema = z99.object({
|
|
44764
|
+
selectedCli: z99.string(),
|
|
44765
|
+
confidence: z99.number().min(0).max(1),
|
|
44766
|
+
reason: z99.string(),
|
|
44767
|
+
strategy: z99.enum([
|
|
44439
44768
|
"composite",
|
|
44440
44769
|
"quality",
|
|
44441
44770
|
"budget",
|
|
@@ -44447,57 +44776,57 @@ var UnifiedRoutingDecisionSchema = z98.object({
|
|
|
44447
44776
|
"linucb",
|
|
44448
44777
|
"direct"
|
|
44449
44778
|
]),
|
|
44450
|
-
decisionTimeMs:
|
|
44451
|
-
alternatives:
|
|
44452
|
-
stagesExecuted:
|
|
44453
|
-
withinBudget:
|
|
44454
|
-
estimatedComplexity:
|
|
44455
|
-
estimatedTokens:
|
|
44456
|
-
topsisScore:
|
|
44457
|
-
ucbScore:
|
|
44458
|
-
resolvedAtStage:
|
|
44459
|
-
consensusReached:
|
|
44460
|
-
agreementScore:
|
|
44461
|
-
metadata:
|
|
44779
|
+
decisionTimeMs: z99.number().nonnegative(),
|
|
44780
|
+
alternatives: z99.array(z99.string()).readonly(),
|
|
44781
|
+
stagesExecuted: z99.array(z99.string()).readonly(),
|
|
44782
|
+
withinBudget: z99.boolean().optional(),
|
|
44783
|
+
estimatedComplexity: z99.enum(["simple", "moderate", "complex", "expert"]).optional(),
|
|
44784
|
+
estimatedTokens: z99.number().int().positive().optional(),
|
|
44785
|
+
topsisScore: z99.number().optional(),
|
|
44786
|
+
ucbScore: z99.number().optional(),
|
|
44787
|
+
resolvedAtStage: z99.number().int().nonnegative().optional(),
|
|
44788
|
+
consensusReached: z99.boolean().optional(),
|
|
44789
|
+
agreementScore: z99.number().min(0).max(1).optional(),
|
|
44790
|
+
metadata: z99.record(z99.string(), z99.unknown()).optional()
|
|
44462
44791
|
});
|
|
44463
44792
|
|
|
44464
44793
|
// src/learning/outcome-feedback-types.ts
|
|
44465
|
-
import { z as
|
|
44466
|
-
var QualitySignalsSchema =
|
|
44467
|
-
testsPass:
|
|
44468
|
-
lintErrors:
|
|
44469
|
-
userApproved:
|
|
44470
|
-
retryCount:
|
|
44471
|
-
completionRatio:
|
|
44472
|
-
validStructure:
|
|
44473
|
-
coherenceScore:
|
|
44794
|
+
import { z as z100 } from "zod";
|
|
44795
|
+
var QualitySignalsSchema = z100.object({
|
|
44796
|
+
testsPass: z100.boolean().optional(),
|
|
44797
|
+
lintErrors: z100.number().int().min(0).optional(),
|
|
44798
|
+
userApproved: z100.boolean().optional(),
|
|
44799
|
+
retryCount: z100.number().int().min(0).default(0),
|
|
44800
|
+
completionRatio: z100.number().min(0).max(1).default(1),
|
|
44801
|
+
validStructure: z100.boolean().optional(),
|
|
44802
|
+
coherenceScore: z100.number().min(0).max(1).optional()
|
|
44474
44803
|
});
|
|
44475
|
-
var RoutingDecisionSchema =
|
|
44476
|
-
id:
|
|
44477
|
-
timestamp:
|
|
44478
|
-
query:
|
|
44479
|
-
routerType:
|
|
44480
|
-
selectedModel:
|
|
44481
|
-
selectedTier:
|
|
44482
|
-
armIndex:
|
|
44483
|
-
banditContext:
|
|
44484
|
-
queryFeatures:
|
|
44485
|
-
ucbScore:
|
|
44486
|
-
confidence:
|
|
44487
|
-
traceId:
|
|
44488
|
-
domain:
|
|
44804
|
+
var RoutingDecisionSchema = z100.object({
|
|
44805
|
+
id: z100.uuid(),
|
|
44806
|
+
timestamp: z100.iso.datetime(),
|
|
44807
|
+
query: z100.string(),
|
|
44808
|
+
routerType: z100.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
|
|
44809
|
+
selectedModel: z100.string(),
|
|
44810
|
+
selectedTier: z100.enum(["strong", "weak"]).optional(),
|
|
44811
|
+
armIndex: z100.number().int().min(0).optional(),
|
|
44812
|
+
banditContext: z100.record(z100.string(), z100.unknown()).optional(),
|
|
44813
|
+
queryFeatures: z100.record(z100.string(), z100.unknown()).optional(),
|
|
44814
|
+
ucbScore: z100.number().optional(),
|
|
44815
|
+
confidence: z100.number().min(0).max(1).optional(),
|
|
44816
|
+
traceId: z100.string(),
|
|
44817
|
+
domain: z100.string().optional()
|
|
44489
44818
|
});
|
|
44490
|
-
var TaskOutcomeSchema =
|
|
44491
|
-
routingDecisionId:
|
|
44492
|
-
timestamp:
|
|
44493
|
-
outcomeClass:
|
|
44494
|
-
success:
|
|
44495
|
-
qualityScore:
|
|
44496
|
-
durationMs:
|
|
44497
|
-
tokenUsage:
|
|
44498
|
-
errorMessage:
|
|
44819
|
+
var TaskOutcomeSchema = z100.object({
|
|
44820
|
+
routingDecisionId: z100.uuid(),
|
|
44821
|
+
timestamp: z100.iso.datetime(),
|
|
44822
|
+
outcomeClass: z100.enum(["success", "partial", "failure", "timeout", "error"]),
|
|
44823
|
+
success: z100.boolean(),
|
|
44824
|
+
qualityScore: z100.number().min(0).max(1),
|
|
44825
|
+
durationMs: z100.number().min(0),
|
|
44826
|
+
tokenUsage: z100.number().int().min(0),
|
|
44827
|
+
errorMessage: z100.string().optional(),
|
|
44499
44828
|
qualitySignals: QualitySignalsSchema,
|
|
44500
|
-
traceId:
|
|
44829
|
+
traceId: z100.string()
|
|
44501
44830
|
});
|
|
44502
44831
|
var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
44503
44832
|
maxPendingDecisions: 1e3,
|
|
@@ -44512,17 +44841,17 @@ var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
|
44512
44841
|
targetTokenUsage: 2e3,
|
|
44513
44842
|
maxHistorySize: 1e4
|
|
44514
44843
|
};
|
|
44515
|
-
var FeedbackCollectorConfigSchema =
|
|
44516
|
-
maxPendingDecisions:
|
|
44517
|
-
pendingTimeoutMs:
|
|
44518
|
-
enableAutoReward:
|
|
44519
|
-
qualityWeight:
|
|
44520
|
-
speedWeight:
|
|
44521
|
-
efficiencyWeight:
|
|
44522
|
-
retryPenalty:
|
|
44523
|
-
targetDurationMs:
|
|
44524
|
-
targetTokenUsage:
|
|
44525
|
-
maxHistorySize:
|
|
44844
|
+
var FeedbackCollectorConfigSchema = z100.object({
|
|
44845
|
+
maxPendingDecisions: z100.number().int().positive().default(1e3),
|
|
44846
|
+
pendingTimeoutMs: z100.number().positive().default(3e5),
|
|
44847
|
+
enableAutoReward: z100.boolean().default(true),
|
|
44848
|
+
qualityWeight: z100.number().min(0).max(1).default(0.5),
|
|
44849
|
+
speedWeight: z100.number().min(0).max(1).default(0.2),
|
|
44850
|
+
efficiencyWeight: z100.number().min(0).max(1).default(0.2),
|
|
44851
|
+
retryPenalty: z100.number().min(0).max(1).default(0.1),
|
|
44852
|
+
targetDurationMs: z100.number().positive().default(5e3),
|
|
44853
|
+
targetTokenUsage: z100.number().positive().default(2e3),
|
|
44854
|
+
maxHistorySize: z100.number().int().positive().default(1e4)
|
|
44526
44855
|
});
|
|
44527
44856
|
|
|
44528
44857
|
// src/learning/outcome-feedback-helpers.ts
|
|
@@ -45172,7 +45501,7 @@ function computeOutcomeReward(collector, outcome) {
|
|
|
45172
45501
|
}
|
|
45173
45502
|
|
|
45174
45503
|
// src/audit/audit-types.ts
|
|
45175
|
-
import { z as
|
|
45504
|
+
import { z as z101 } from "zod";
|
|
45176
45505
|
var AuditError = class extends Error {
|
|
45177
45506
|
code = "AUDIT_ERROR";
|
|
45178
45507
|
context;
|
|
@@ -45184,7 +45513,7 @@ var AuditError = class extends Error {
|
|
|
45184
45513
|
this.context = options?.context;
|
|
45185
45514
|
}
|
|
45186
45515
|
};
|
|
45187
|
-
var AuditCategorySchema =
|
|
45516
|
+
var AuditCategorySchema = z101.enum([
|
|
45188
45517
|
"authentication",
|
|
45189
45518
|
// Login, logout, token refresh
|
|
45190
45519
|
"authorization",
|
|
@@ -45202,7 +45531,7 @@ var AuditCategorySchema = z100.enum([
|
|
|
45202
45531
|
"system"
|
|
45203
45532
|
// System events, startup, shutdown
|
|
45204
45533
|
]);
|
|
45205
|
-
var AuditSeveritySchema =
|
|
45534
|
+
var AuditSeveritySchema = z101.enum([
|
|
45206
45535
|
"info",
|
|
45207
45536
|
// Normal operations
|
|
45208
45537
|
"warning",
|
|
@@ -45210,7 +45539,7 @@ var AuditSeveritySchema = z100.enum([
|
|
|
45210
45539
|
"critical"
|
|
45211
45540
|
// Security violations, failures
|
|
45212
45541
|
]);
|
|
45213
|
-
var AuditOutcomeSchema =
|
|
45542
|
+
var AuditOutcomeSchema = z101.enum([
|
|
45214
45543
|
"success",
|
|
45215
45544
|
// Operation completed successfully
|
|
45216
45545
|
"failure",
|
|
@@ -45220,108 +45549,108 @@ var AuditOutcomeSchema = z100.enum([
|
|
|
45220
45549
|
"error"
|
|
45221
45550
|
// Unexpected error occurred
|
|
45222
45551
|
]);
|
|
45223
|
-
var AuditActorSchema =
|
|
45224
|
-
type:
|
|
45225
|
-
id:
|
|
45226
|
-
name:
|
|
45227
|
-
ip:
|
|
45228
|
-
userAgent:
|
|
45552
|
+
var AuditActorSchema = z101.object({
|
|
45553
|
+
type: z101.enum(["user", "agent", "system", "external"]),
|
|
45554
|
+
id: z101.string().min(1),
|
|
45555
|
+
name: z101.string().optional(),
|
|
45556
|
+
ip: z101.string().optional(),
|
|
45557
|
+
userAgent: z101.string().optional()
|
|
45229
45558
|
});
|
|
45230
|
-
var AuditResourceSchema =
|
|
45231
|
-
type:
|
|
45559
|
+
var AuditResourceSchema = z101.object({
|
|
45560
|
+
type: z101.string().min(1),
|
|
45232
45561
|
// e.g., 'file', 'tool', 'config', 'agent'
|
|
45233
|
-
id:
|
|
45234
|
-
name:
|
|
45235
|
-
path:
|
|
45562
|
+
id: z101.string().min(1),
|
|
45563
|
+
name: z101.string().optional(),
|
|
45564
|
+
path: z101.string().optional()
|
|
45236
45565
|
});
|
|
45237
|
-
var AuditEventSchema =
|
|
45566
|
+
var AuditEventSchema = z101.object({
|
|
45238
45567
|
// Identity
|
|
45239
|
-
id:
|
|
45568
|
+
id: z101.string().min(1),
|
|
45240
45569
|
// Unique event ID
|
|
45241
|
-
version:
|
|
45570
|
+
version: z101.literal("1.0"),
|
|
45242
45571
|
// Schema version for migrations
|
|
45243
45572
|
// Timing
|
|
45244
|
-
timestamp:
|
|
45573
|
+
timestamp: z101.string(),
|
|
45245
45574
|
// ISO 8601 format
|
|
45246
|
-
timestampMs:
|
|
45575
|
+
timestampMs: z101.number(),
|
|
45247
45576
|
// Unix epoch milliseconds
|
|
45248
45577
|
// Classification
|
|
45249
45578
|
category: AuditCategorySchema,
|
|
45250
45579
|
severity: AuditSeveritySchema,
|
|
45251
45580
|
outcome: AuditOutcomeSchema,
|
|
45252
45581
|
// Event details
|
|
45253
|
-
action:
|
|
45582
|
+
action: z101.string().min(1),
|
|
45254
45583
|
// e.g., 'tool.invoke', 'policy.evaluate'
|
|
45255
|
-
description:
|
|
45584
|
+
description: z101.string().optional(),
|
|
45256
45585
|
// Actors and resources
|
|
45257
45586
|
actor: AuditActorSchema,
|
|
45258
45587
|
resource: AuditResourceSchema.optional(),
|
|
45259
45588
|
// Correlation
|
|
45260
|
-
requestId:
|
|
45589
|
+
requestId: z101.string().optional(),
|
|
45261
45590
|
// Request correlation ID
|
|
45262
|
-
traceId:
|
|
45591
|
+
traceId: z101.string().optional(),
|
|
45263
45592
|
// Distributed trace ID
|
|
45264
|
-
sessionId:
|
|
45593
|
+
sessionId: z101.string().optional(),
|
|
45265
45594
|
// Session correlation ID
|
|
45266
45595
|
// Context
|
|
45267
|
-
toolName:
|
|
45268
|
-
durationMs:
|
|
45269
|
-
metadata:
|
|
45596
|
+
toolName: z101.string().optional(),
|
|
45597
|
+
durationMs: z101.number().optional(),
|
|
45598
|
+
metadata: z101.record(z101.string(), z101.unknown()).optional(),
|
|
45270
45599
|
// Policy and security
|
|
45271
|
-
policyName:
|
|
45272
|
-
policyDecision:
|
|
45273
|
-
violationType:
|
|
45600
|
+
policyName: z101.string().optional(),
|
|
45601
|
+
policyDecision: z101.string().optional(),
|
|
45602
|
+
violationType: z101.string().optional(),
|
|
45274
45603
|
// Integrity (for tamper-evidence)
|
|
45275
|
-
previousHash:
|
|
45604
|
+
previousHash: z101.string().optional(),
|
|
45276
45605
|
// Hash of previous event (chain)
|
|
45277
|
-
hash:
|
|
45606
|
+
hash: z101.string().optional()
|
|
45278
45607
|
// Hash of this event
|
|
45279
45608
|
});
|
|
45280
|
-
var AuditEventInputSchema =
|
|
45609
|
+
var AuditEventInputSchema = z101.object({
|
|
45281
45610
|
category: AuditCategorySchema,
|
|
45282
45611
|
severity: AuditSeveritySchema.optional().default("info"),
|
|
45283
45612
|
outcome: AuditOutcomeSchema,
|
|
45284
|
-
action:
|
|
45285
|
-
description:
|
|
45613
|
+
action: z101.string().min(1),
|
|
45614
|
+
description: z101.string().optional(),
|
|
45286
45615
|
actor: AuditActorSchema,
|
|
45287
45616
|
resource: AuditResourceSchema.optional(),
|
|
45288
|
-
requestId:
|
|
45289
|
-
traceId:
|
|
45290
|
-
sessionId:
|
|
45291
|
-
toolName:
|
|
45292
|
-
durationMs:
|
|
45293
|
-
metadata:
|
|
45294
|
-
policyName:
|
|
45295
|
-
policyDecision:
|
|
45296
|
-
violationType:
|
|
45617
|
+
requestId: z101.string().optional(),
|
|
45618
|
+
traceId: z101.string().optional(),
|
|
45619
|
+
sessionId: z101.string().optional(),
|
|
45620
|
+
toolName: z101.string().optional(),
|
|
45621
|
+
durationMs: z101.number().optional(),
|
|
45622
|
+
metadata: z101.record(z101.string(), z101.unknown()).optional(),
|
|
45623
|
+
policyName: z101.string().optional(),
|
|
45624
|
+
policyDecision: z101.string().optional(),
|
|
45625
|
+
violationType: z101.string().optional()
|
|
45297
45626
|
});
|
|
45298
|
-
var AuditLogConfigSchema =
|
|
45627
|
+
var AuditLogConfigSchema = z101.object({
|
|
45299
45628
|
// Storage
|
|
45300
|
-
logDir:
|
|
45301
|
-
filePrefix:
|
|
45302
|
-
maxFileSizeBytes:
|
|
45629
|
+
logDir: z101.string().min(1),
|
|
45630
|
+
filePrefix: z101.string().optional().default("audit"),
|
|
45631
|
+
maxFileSizeBytes: z101.number().positive().optional().default(10 * 1024 * 1024),
|
|
45303
45632
|
// 10MB
|
|
45304
|
-
maxFiles:
|
|
45633
|
+
maxFiles: z101.number().positive().optional().default(10),
|
|
45305
45634
|
// Features
|
|
45306
|
-
enableHashChain:
|
|
45307
|
-
enableCompression:
|
|
45308
|
-
flushIntervalMs:
|
|
45635
|
+
enableHashChain: z101.boolean().optional().default(true),
|
|
45636
|
+
enableCompression: z101.boolean().optional().default(false),
|
|
45637
|
+
flushIntervalMs: z101.number().positive().optional().default(1e3),
|
|
45309
45638
|
// Filtering
|
|
45310
45639
|
minSeverity: AuditSeveritySchema.optional().default("info"),
|
|
45311
|
-
categories:
|
|
45640
|
+
categories: z101.array(AuditCategorySchema).optional()
|
|
45312
45641
|
});
|
|
45313
|
-
var AuditQueryCriteriaSchema =
|
|
45314
|
-
startTime:
|
|
45315
|
-
endTime:
|
|
45316
|
-
categories:
|
|
45317
|
-
severities:
|
|
45318
|
-
outcomes:
|
|
45319
|
-
actorId:
|
|
45320
|
-
resourceId:
|
|
45321
|
-
requestId:
|
|
45322
|
-
traceId:
|
|
45323
|
-
limit:
|
|
45324
|
-
offset:
|
|
45642
|
+
var AuditQueryCriteriaSchema = z101.object({
|
|
45643
|
+
startTime: z101.date().optional(),
|
|
45644
|
+
endTime: z101.date().optional(),
|
|
45645
|
+
categories: z101.array(AuditCategorySchema).optional(),
|
|
45646
|
+
severities: z101.array(AuditSeveritySchema).optional(),
|
|
45647
|
+
outcomes: z101.array(AuditOutcomeSchema).optional(),
|
|
45648
|
+
actorId: z101.string().optional(),
|
|
45649
|
+
resourceId: z101.string().optional(),
|
|
45650
|
+
requestId: z101.string().optional(),
|
|
45651
|
+
traceId: z101.string().optional(),
|
|
45652
|
+
limit: z101.number().positive().optional().default(100),
|
|
45653
|
+
offset: z101.number().nonnegative().optional().default(0)
|
|
45325
45654
|
});
|
|
45326
45655
|
|
|
45327
45656
|
// src/audit/audit-storage-queries.ts
|
|
@@ -52289,7 +52618,7 @@ var GitHubTaskTracker = class {
|
|
|
52289
52618
|
cachedProvider = null;
|
|
52290
52619
|
async getProvider() {
|
|
52291
52620
|
if (this.cachedProvider !== null) return this.cachedProvider;
|
|
52292
|
-
const { createScmProvider } = await import("./factory-
|
|
52621
|
+
const { createScmProvider } = await import("./factory-FA7WDPZW.js");
|
|
52293
52622
|
const result = await createScmProvider({ repo: this.config.repo ?? "" });
|
|
52294
52623
|
if (!result.ok) throw new Error(`SCM provider error: ${result.error.message}`);
|
|
52295
52624
|
this.cachedProvider = result.value;
|
|
@@ -52868,6 +53197,7 @@ export {
|
|
|
52868
53197
|
registerResearchSynthesizeTool,
|
|
52869
53198
|
IssueTriageInputSchema,
|
|
52870
53199
|
registerIssueTriageTool,
|
|
53200
|
+
MAX_STRIPPED_ELEMENTS_PER_EVENT,
|
|
52871
53201
|
AuditTrail,
|
|
52872
53202
|
emitTrustEvent,
|
|
52873
53203
|
emitPolicyEvent,
|
|
@@ -52930,6 +53260,13 @@ export {
|
|
|
52930
53260
|
runDevPipeline,
|
|
52931
53261
|
createDevStageRegistry,
|
|
52932
53262
|
registerPipelineTool,
|
|
53263
|
+
PR_REVIEW_ROLES,
|
|
53264
|
+
MAX_DIFF_LENGTH,
|
|
53265
|
+
PrReviewInputSchema,
|
|
53266
|
+
mapVoteDecisionToPrDecision,
|
|
53267
|
+
aggregatePrDecisions,
|
|
53268
|
+
buildPrReviewProposal,
|
|
53269
|
+
registerPrReviewTool,
|
|
52933
53270
|
createAnnotationsProxy,
|
|
52934
53271
|
createToolObservabilityProxy,
|
|
52935
53272
|
registerTools,
|
|
@@ -53103,4 +53440,4 @@ export {
|
|
|
53103
53440
|
detectBackend,
|
|
53104
53441
|
createTaskTracker
|
|
53105
53442
|
};
|
|
53106
|
-
//# sourceMappingURL=chunk-
|
|
53443
|
+
//# sourceMappingURL=chunk-ZL3IBCH6.js.map
|