nexus-agents 2.59.0 → 2.60.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/{chunk-V2Z7EHSY.js → chunk-5JSMLCCK.js} +167 -173
- package/dist/chunk-5JSMLCCK.js.map +1 -0
- package/dist/chunk-FDNWRZNJ.js +22 -0
- package/dist/chunk-FDNWRZNJ.js.map +1 -0
- package/dist/{chunk-L3NHOUEX.js → chunk-FEWWXGFE.js} +30 -30
- package/dist/{chunk-L3NHOUEX.js.map → chunk-FEWWXGFE.js.map} +1 -1
- package/dist/{chunk-ZOQQGA3L.js → chunk-MJ3K4FYS.js} +2 -2
- package/dist/{chunk-7USAZET2.js → chunk-XRXUCE6K.js} +8 -7
- package/dist/{chunk-7USAZET2.js.map → chunk-XRXUCE6K.js.map} +1 -1
- package/dist/cli.js +48 -51
- package/dist/cli.js.map +1 -1
- package/dist/{consensus-vote-HDM6HA5Z.js → consensus-vote-PRLGGUNY.js} +3 -2
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/nexus-data-dir-M6DYKIHJ.js +12 -0
- package/dist/{registry-command-S46JJ2SX.js → registry-command-TTXAUCOK.js} +7 -5
- package/dist/registry-command-TTXAUCOK.js.map +1 -0
- package/dist/{setup-command-QAGEWX7G.js → setup-command-LIX2S7JD.js} +4 -3
- package/dist/setup-command-LIX2S7JD.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-V2Z7EHSY.js.map +0 -1
- package/dist/registry-command-S46JJ2SX.js.map +0 -1
- /package/dist/{chunk-ZOQQGA3L.js.map → chunk-MJ3K4FYS.js.map} +0 -0
- /package/dist/{consensus-vote-HDM6HA5Z.js.map → consensus-vote-PRLGGUNY.js.map} +0 -0
- /package/dist/{setup-command-QAGEWX7G.js.map → nexus-data-dir-M6DYKIHJ.js.map} +0 -0
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SharedMemoryStore
|
|
3
|
+
} from "./chunk-ED6VQWNG.js";
|
|
1
4
|
import {
|
|
2
5
|
getTokenEnvVars,
|
|
3
6
|
resolveToken
|
|
4
7
|
} from "./chunk-EZXOJZYE.js";
|
|
8
|
+
import {
|
|
9
|
+
executeExpert
|
|
10
|
+
} from "./chunk-JKDHWOQL.js";
|
|
5
11
|
import {
|
|
6
12
|
ClaudeAdapter,
|
|
7
13
|
DEFAULT_RELEVANCE_CONFIG,
|
|
@@ -29,7 +35,7 @@ import {
|
|
|
29
35
|
withAccessPolicy,
|
|
30
36
|
withProgressHeartbeat,
|
|
31
37
|
wrapToolWithTimeout
|
|
32
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-FEWWXGFE.js";
|
|
33
39
|
import {
|
|
34
40
|
REGISTRY_PATH,
|
|
35
41
|
getProjectRoot,
|
|
@@ -56,22 +62,22 @@ import {
|
|
|
56
62
|
extractSymbolIndex,
|
|
57
63
|
extractSymbols
|
|
58
64
|
} from "./chunk-BQ4YXGGQ.js";
|
|
59
|
-
import {
|
|
60
|
-
SharedMemoryStore
|
|
61
|
-
} from "./chunk-ED6VQWNG.js";
|
|
62
65
|
import {
|
|
63
66
|
DEFAULT_TASK_TTL_MS,
|
|
64
67
|
DEFAULT_TOOL_RATE_LIMITS,
|
|
65
68
|
clampTaskTtl,
|
|
66
69
|
getAvailabilityCache,
|
|
67
70
|
resolveFallback
|
|
68
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-XRXUCE6K.js";
|
|
69
72
|
import {
|
|
70
73
|
DEFAULTS
|
|
71
74
|
} from "./chunk-H43PABG4.js";
|
|
72
75
|
import {
|
|
73
76
|
resolveInsideRoot
|
|
74
77
|
} from "./chunk-NUBSJGQZ.js";
|
|
78
|
+
import {
|
|
79
|
+
nexusDataPath
|
|
80
|
+
} from "./chunk-FDNWRZNJ.js";
|
|
75
81
|
import {
|
|
76
82
|
BUILT_IN_EXPERTS,
|
|
77
83
|
BuiltInExpertTypeSchema,
|
|
@@ -97,9 +103,6 @@ import {
|
|
|
97
103
|
import {
|
|
98
104
|
getFallbackChainForCategory
|
|
99
105
|
} from "./chunk-PTGBJFSD.js";
|
|
100
|
-
import {
|
|
101
|
-
executeExpert
|
|
102
|
-
} from "./chunk-JKDHWOQL.js";
|
|
103
106
|
import {
|
|
104
107
|
ClaudeCliAdapter,
|
|
105
108
|
CliDetectionCache,
|
|
@@ -13860,7 +13863,7 @@ function wouldCreateCycle(from, to, getNode) {
|
|
|
13860
13863
|
return canReach(to, from, /* @__PURE__ */ new Set(), getNode);
|
|
13861
13864
|
}
|
|
13862
13865
|
function findCyclePath(from, to, getNode) {
|
|
13863
|
-
const
|
|
13866
|
+
const path20 = [from, to];
|
|
13864
13867
|
const visited = /* @__PURE__ */ new Set([from]);
|
|
13865
13868
|
const findPath = (current) => {
|
|
13866
13869
|
if (current === from) return true;
|
|
@@ -13869,9 +13872,9 @@ function findCyclePath(from, to, getNode) {
|
|
|
13869
13872
|
for (const depId of node.dependencies.keys()) {
|
|
13870
13873
|
if (!visited.has(depId)) {
|
|
13871
13874
|
visited.add(depId);
|
|
13872
|
-
|
|
13875
|
+
path20.push(depId);
|
|
13873
13876
|
if (findPath(depId)) return true;
|
|
13874
|
-
|
|
13877
|
+
path20.pop();
|
|
13875
13878
|
} else if (depId === from) {
|
|
13876
13879
|
return true;
|
|
13877
13880
|
}
|
|
@@ -13879,7 +13882,7 @@ function findCyclePath(from, to, getNode) {
|
|
|
13879
13882
|
return false;
|
|
13880
13883
|
};
|
|
13881
13884
|
findPath(to);
|
|
13882
|
-
return
|
|
13885
|
+
return path20;
|
|
13883
13886
|
}
|
|
13884
13887
|
function detectCycleDFS(nodeId, visited, stack, getNode) {
|
|
13885
13888
|
visited.add(nodeId);
|
|
@@ -13898,29 +13901,29 @@ function detectCycleDFS(nodeId, visited, stack, getNode) {
|
|
|
13898
13901
|
return false;
|
|
13899
13902
|
}
|
|
13900
13903
|
function findCycleFromNode(startId, getNode) {
|
|
13901
|
-
const
|
|
13904
|
+
const path20 = [];
|
|
13902
13905
|
const visited = /* @__PURE__ */ new Set();
|
|
13903
13906
|
const dfs = (nodeId) => {
|
|
13904
|
-
if (
|
|
13905
|
-
const cycleStart =
|
|
13906
|
-
|
|
13907
|
-
|
|
13907
|
+
if (path20.includes(nodeId)) {
|
|
13908
|
+
const cycleStart = path20.indexOf(nodeId);
|
|
13909
|
+
path20.splice(0, cycleStart);
|
|
13910
|
+
path20.push(nodeId);
|
|
13908
13911
|
return true;
|
|
13909
13912
|
}
|
|
13910
13913
|
if (visited.has(nodeId)) return false;
|
|
13911
13914
|
visited.add(nodeId);
|
|
13912
|
-
|
|
13915
|
+
path20.push(nodeId);
|
|
13913
13916
|
const node = getNode(nodeId);
|
|
13914
13917
|
if (node) {
|
|
13915
13918
|
for (const depId of node.dependencies.keys()) {
|
|
13916
13919
|
if (dfs(depId)) return true;
|
|
13917
13920
|
}
|
|
13918
13921
|
}
|
|
13919
|
-
|
|
13922
|
+
path20.pop();
|
|
13920
13923
|
return false;
|
|
13921
13924
|
};
|
|
13922
13925
|
dfs(startId);
|
|
13923
|
-
return
|
|
13926
|
+
return path20;
|
|
13924
13927
|
}
|
|
13925
13928
|
|
|
13926
13929
|
// src/agents/skills/skill-dependency-graph.ts
|
|
@@ -15078,7 +15081,6 @@ function createContextItem(id, content, source, relevance, timestamp) {
|
|
|
15078
15081
|
// src/agents/wave-checkpoint-persistence.ts
|
|
15079
15082
|
import * as fs from "fs";
|
|
15080
15083
|
import * as path from "path";
|
|
15081
|
-
import * as os from "os";
|
|
15082
15084
|
|
|
15083
15085
|
// src/agents/wave-checkpoint-types.ts
|
|
15084
15086
|
import { z as z27 } from "zod";
|
|
@@ -15103,13 +15105,13 @@ var WaveCheckpointEntrySchema = z27.object({
|
|
|
15103
15105
|
|
|
15104
15106
|
// src/agents/wave-checkpoint-persistence.ts
|
|
15105
15107
|
var logger5 = createLogger({ component: "wave-checkpoint" });
|
|
15106
|
-
var
|
|
15108
|
+
var CHECKPOINT_SUBDIR = "checkpoints";
|
|
15107
15109
|
var DIR_MODE = 448;
|
|
15108
15110
|
function getCheckpointDir(customDir) {
|
|
15109
15111
|
if (customDir !== void 0) {
|
|
15110
15112
|
return path.resolve(customDir);
|
|
15111
15113
|
}
|
|
15112
|
-
return
|
|
15114
|
+
return nexusDataPath(CHECKPOINT_SUBDIR);
|
|
15113
15115
|
}
|
|
15114
15116
|
function ensureCheckpointDir(customDir) {
|
|
15115
15117
|
const dirPath = getCheckpointDir(customDir);
|
|
@@ -18466,18 +18468,18 @@ var DependencyGraph = class {
|
|
|
18466
18468
|
}
|
|
18467
18469
|
const startNode = firstNode;
|
|
18468
18470
|
const visited = /* @__PURE__ */ new Set();
|
|
18469
|
-
const
|
|
18471
|
+
const path20 = [];
|
|
18470
18472
|
const dfs = (nodeId) => {
|
|
18471
|
-
if (
|
|
18472
|
-
const cycleStart =
|
|
18473
|
-
|
|
18473
|
+
if (path20.includes(nodeId)) {
|
|
18474
|
+
const cycleStart = path20.indexOf(nodeId);
|
|
18475
|
+
path20.splice(0, cycleStart);
|
|
18474
18476
|
return true;
|
|
18475
18477
|
}
|
|
18476
18478
|
if (visited.has(nodeId)) {
|
|
18477
18479
|
return false;
|
|
18478
18480
|
}
|
|
18479
18481
|
visited.add(nodeId);
|
|
18480
|
-
|
|
18482
|
+
path20.push(nodeId);
|
|
18481
18483
|
const node = this.nodes.get(nodeId);
|
|
18482
18484
|
if (node) {
|
|
18483
18485
|
for (const depId of node.dependencies) {
|
|
@@ -18488,11 +18490,11 @@ var DependencyGraph = class {
|
|
|
18488
18490
|
}
|
|
18489
18491
|
}
|
|
18490
18492
|
}
|
|
18491
|
-
|
|
18493
|
+
path20.pop();
|
|
18492
18494
|
return false;
|
|
18493
18495
|
};
|
|
18494
18496
|
dfs(startNode);
|
|
18495
|
-
return
|
|
18497
|
+
return path20.length > 0 ? path20 : cycleNodes.slice(0, 3);
|
|
18496
18498
|
}
|
|
18497
18499
|
/**
|
|
18498
18500
|
* Gets the execution order (topologically sorted step IDs).
|
|
@@ -19344,9 +19346,9 @@ function getBuiltInTemplatesPath() {
|
|
|
19344
19346
|
join3(dirname2(currentDir), "workflows", "templates"),
|
|
19345
19347
|
join3(dirname2(currentDir), "dist", "workflows", "templates")
|
|
19346
19348
|
];
|
|
19347
|
-
for (const
|
|
19348
|
-
if (existsSync3(
|
|
19349
|
-
return
|
|
19349
|
+
for (const path20 of possiblePaths) {
|
|
19350
|
+
if (existsSync3(path20)) {
|
|
19351
|
+
return path20;
|
|
19350
19352
|
}
|
|
19351
19353
|
}
|
|
19352
19354
|
return join3(currentDir, "templates");
|
|
@@ -19887,9 +19889,9 @@ function validateRequiredInputs(inputs, required) {
|
|
|
19887
19889
|
}
|
|
19888
19890
|
|
|
19889
19891
|
// src/workflows/expression-resolver-helpers.ts
|
|
19890
|
-
function getNestedValue(obj,
|
|
19892
|
+
function getNestedValue(obj, path20) {
|
|
19891
19893
|
let current = obj;
|
|
19892
|
-
for (const key of
|
|
19894
|
+
for (const key of path20) {
|
|
19893
19895
|
if (current === null || current === void 0) {
|
|
19894
19896
|
return void 0;
|
|
19895
19897
|
}
|
|
@@ -19900,24 +19902,24 @@ function getNestedValue(obj, path21) {
|
|
|
19900
19902
|
}
|
|
19901
19903
|
return current;
|
|
19902
19904
|
}
|
|
19903
|
-
function resolveInputs(
|
|
19904
|
-
const value = getNestedValue(context.inputs,
|
|
19905
|
+
function resolveInputs(path20, context) {
|
|
19906
|
+
const value = getNestedValue(context.inputs, path20);
|
|
19905
19907
|
if (value === void 0) {
|
|
19906
19908
|
return {
|
|
19907
19909
|
success: false,
|
|
19908
|
-
error: `Input '${
|
|
19910
|
+
error: `Input '${path20.join(".")}' not found`
|
|
19909
19911
|
};
|
|
19910
19912
|
}
|
|
19911
19913
|
return { success: true, value };
|
|
19912
19914
|
}
|
|
19913
|
-
function validateStepPath(
|
|
19914
|
-
if (
|
|
19915
|
+
function validateStepPath(path20) {
|
|
19916
|
+
if (path20.length < 2) {
|
|
19915
19917
|
return {
|
|
19916
19918
|
success: false,
|
|
19917
19919
|
error: "Steps expression requires at least stepId and output"
|
|
19918
19920
|
};
|
|
19919
19921
|
}
|
|
19920
|
-
if (
|
|
19922
|
+
if (path20[0] === void 0 || path20[1] === void 0) {
|
|
19921
19923
|
return {
|
|
19922
19924
|
success: false,
|
|
19923
19925
|
error: "Steps expression requires stepId and output"
|
|
@@ -19943,12 +19945,12 @@ function validateStepResult(stepId, outputKey, stepResult) {
|
|
|
19943
19945
|
}
|
|
19944
19946
|
return null;
|
|
19945
19947
|
}
|
|
19946
|
-
function resolveSteps(
|
|
19947
|
-
const pathError = validateStepPath(
|
|
19948
|
+
function resolveSteps(path20, context) {
|
|
19949
|
+
const pathError = validateStepPath(path20);
|
|
19948
19950
|
if (pathError !== null) return pathError;
|
|
19949
|
-
const stepId =
|
|
19950
|
-
const outputKey =
|
|
19951
|
-
const rest =
|
|
19951
|
+
const stepId = path20[0] ?? "";
|
|
19952
|
+
const outputKey = path20[1] ?? "";
|
|
19953
|
+
const rest = path20.slice(2);
|
|
19952
19954
|
const stepResult = context.stepResults.get(stepId);
|
|
19953
19955
|
const earlyReturn = validateStepResult(stepId, outputKey, stepResult);
|
|
19954
19956
|
if (earlyReturn !== null) return earlyReturn;
|
|
@@ -19964,15 +19966,15 @@ function resolveSteps(path21, context) {
|
|
|
19964
19966
|
}
|
|
19965
19967
|
return { success: true, value };
|
|
19966
19968
|
}
|
|
19967
|
-
function resolveVariables(
|
|
19968
|
-
if (
|
|
19969
|
+
function resolveVariables(path20, context) {
|
|
19970
|
+
if (path20.length === 0) {
|
|
19969
19971
|
return {
|
|
19970
19972
|
success: false,
|
|
19971
19973
|
error: "Variables expression requires a variable name"
|
|
19972
19974
|
};
|
|
19973
19975
|
}
|
|
19974
|
-
const varName =
|
|
19975
|
-
const rest =
|
|
19976
|
+
const varName = path20[0];
|
|
19977
|
+
const rest = path20.slice(1);
|
|
19976
19978
|
if (varName === void 0) {
|
|
19977
19979
|
return {
|
|
19978
19980
|
success: false,
|
|
@@ -20995,8 +20997,8 @@ var WorkflowEngine = class {
|
|
|
20995
20997
|
this.config = resolveConfig2(config);
|
|
20996
20998
|
}
|
|
20997
20999
|
/** Load workflow template from file. */
|
|
20998
|
-
async loadTemplate(
|
|
20999
|
-
return this.deps.loadWorkflowFile(
|
|
21000
|
+
async loadTemplate(path20) {
|
|
21001
|
+
return this.deps.loadWorkflowFile(path20);
|
|
21000
21002
|
}
|
|
21001
21003
|
/** Execute a workflow with inputs. */
|
|
21002
21004
|
async execute(workflow, inputs) {
|
|
@@ -21100,8 +21102,8 @@ var WorkflowEngine = class {
|
|
|
21100
21102
|
}
|
|
21101
21103
|
return Promise.resolve(templates);
|
|
21102
21104
|
}
|
|
21103
|
-
createTemplate(workflow,
|
|
21104
|
-
const t = { name: workflow.name, version: workflow.version, path:
|
|
21105
|
+
createTemplate(workflow, path20, category) {
|
|
21106
|
+
const t = { name: workflow.name, version: workflow.version, path: path20, category };
|
|
21105
21107
|
if (workflow.description !== void 0) t.description = workflow.description;
|
|
21106
21108
|
return t;
|
|
21107
21109
|
}
|
|
@@ -21387,8 +21389,8 @@ function createParseWorkflow() {
|
|
|
21387
21389
|
};
|
|
21388
21390
|
}
|
|
21389
21391
|
function createLoadWorkflowFile() {
|
|
21390
|
-
return async (
|
|
21391
|
-
const result = await loadWorkflowFile(
|
|
21392
|
+
return async (path20) => {
|
|
21393
|
+
const result = await loadWorkflowFile(path20);
|
|
21392
21394
|
if (!result.ok) {
|
|
21393
21395
|
if (result.error instanceof ParseError) {
|
|
21394
21396
|
return result;
|
|
@@ -21617,13 +21619,12 @@ function withLogging(toolName, handler3, logger56) {
|
|
|
21617
21619
|
// src/mcp/middleware/auth-handler.ts
|
|
21618
21620
|
import { randomBytes, timingSafeEqual } from "crypto";
|
|
21619
21621
|
import { readFileSync as readFileSync2, writeFileSync, existsSync as existsSync4, mkdirSync as mkdirSync2 } from "fs";
|
|
21620
|
-
import {
|
|
21621
|
-
|
|
21622
|
-
var DEFAULT_AUTH_DIR = ".nexus-agents/auth";
|
|
21622
|
+
import { dirname as dirname3 } from "path";
|
|
21623
|
+
var DEFAULT_AUTH_SUBDIR = "auth";
|
|
21623
21624
|
var DEFAULT_TOKEN_FILE = "server-token";
|
|
21624
21625
|
var TOKEN_LENGTH_BYTES = 32;
|
|
21625
21626
|
function getDefaultTokenPath() {
|
|
21626
|
-
return
|
|
21627
|
+
return nexusDataPath(DEFAULT_AUTH_SUBDIR, DEFAULT_TOKEN_FILE);
|
|
21627
21628
|
}
|
|
21628
21629
|
function generateSecureToken() {
|
|
21629
21630
|
return randomBytes(TOKEN_LENGTH_BYTES).toString("hex");
|
|
@@ -27030,31 +27031,31 @@ var GraphBuilder = class {
|
|
|
27030
27031
|
}
|
|
27031
27032
|
const visited = /* @__PURE__ */ new Set();
|
|
27032
27033
|
const stack = /* @__PURE__ */ new Set();
|
|
27033
|
-
const
|
|
27034
|
+
const path20 = [];
|
|
27034
27035
|
for (const nodeId of this.nodes.keys()) {
|
|
27035
|
-
const cycle = this.dfs(nodeId, adj, visited, stack,
|
|
27036
|
+
const cycle = this.dfs(nodeId, adj, visited, stack, path20);
|
|
27036
27037
|
if (cycle !== void 0) return cycle;
|
|
27037
27038
|
}
|
|
27038
27039
|
return void 0;
|
|
27039
27040
|
}
|
|
27040
|
-
dfs(nodeId, adj, visited, stack,
|
|
27041
|
+
dfs(nodeId, adj, visited, stack, path20) {
|
|
27041
27042
|
if (stack.has(nodeId)) {
|
|
27042
|
-
const cycleStart =
|
|
27043
|
-
const cyclePath =
|
|
27043
|
+
const cycleStart = path20.indexOf(nodeId);
|
|
27044
|
+
const cyclePath = path20.slice(cycleStart);
|
|
27044
27045
|
cyclePath.push(nodeId);
|
|
27045
27046
|
return { type: "cycle_detected", path: cyclePath };
|
|
27046
27047
|
}
|
|
27047
27048
|
if (visited.has(nodeId)) return void 0;
|
|
27048
27049
|
visited.add(nodeId);
|
|
27049
27050
|
stack.add(nodeId);
|
|
27050
|
-
|
|
27051
|
+
path20.push(nodeId);
|
|
27051
27052
|
const neighbors = adj.get(nodeId) ?? [];
|
|
27052
27053
|
for (const neighbor of neighbors) {
|
|
27053
|
-
const cycle = this.dfs(neighbor, adj, visited, stack,
|
|
27054
|
+
const cycle = this.dfs(neighbor, adj, visited, stack, path20);
|
|
27054
27055
|
if (cycle !== void 0) return cycle;
|
|
27055
27056
|
}
|
|
27056
27057
|
stack.delete(nodeId);
|
|
27057
|
-
|
|
27058
|
+
path20.pop();
|
|
27058
27059
|
return void 0;
|
|
27059
27060
|
}
|
|
27060
27061
|
checkReachability() {
|
|
@@ -27594,13 +27595,13 @@ function emitPipelineStageEvent(prefix, stage, status, details) {
|
|
|
27594
27595
|
|
|
27595
27596
|
// src/pipeline/trace-writer.ts
|
|
27596
27597
|
import { mkdir, writeFile, rename, unlink } from "fs/promises";
|
|
27597
|
-
import { join as
|
|
27598
|
+
import { join as join5 } from "path";
|
|
27598
27599
|
var logger18 = createLogger({ component: "TraceWriter" });
|
|
27599
27600
|
var MAX_BUFFER_SIZE = 5e4;
|
|
27600
27601
|
var TraceWriter = class {
|
|
27601
27602
|
constructor(bus, options) {
|
|
27602
27603
|
this.options = options;
|
|
27603
|
-
this.runDir =
|
|
27604
|
+
this.runDir = join5(options.runsDir, options.runId);
|
|
27604
27605
|
this.maxBuffer = options.maxBufferSize ?? MAX_BUFFER_SIZE;
|
|
27605
27606
|
this.unsubscribe = bus.subscribe({}, (event) => {
|
|
27606
27607
|
if (!this.stopped) {
|
|
@@ -27621,7 +27622,7 @@ var TraceWriter = class {
|
|
|
27621
27622
|
if (this.buffer.length === 0) return;
|
|
27622
27623
|
await mkdir(this.runDir, { recursive: true });
|
|
27623
27624
|
const lines = this.buffer.map((e) => JSON.stringify(e)).join("\n");
|
|
27624
|
-
const tracePath =
|
|
27625
|
+
const tracePath = join5(this.runDir, "trace.jsonl");
|
|
27625
27626
|
const traceTmp = `${tracePath}.tmp.${String(process.pid)}`;
|
|
27626
27627
|
try {
|
|
27627
27628
|
await writeFile(traceTmp, lines + "\n", "utf-8");
|
|
@@ -27634,7 +27635,7 @@ var TraceWriter = class {
|
|
|
27634
27635
|
throw err2;
|
|
27635
27636
|
}
|
|
27636
27637
|
const indexContent = this.buildIndex();
|
|
27637
|
-
const indexPath =
|
|
27638
|
+
const indexPath = join5(this.runDir, "index.md");
|
|
27638
27639
|
const indexTmp = `${indexPath}.tmp.${String(process.pid)}`;
|
|
27639
27640
|
try {
|
|
27640
27641
|
await writeFile(indexTmp, indexContent, "utf-8");
|
|
@@ -27722,8 +27723,8 @@ function extractModelAttribution(event) {
|
|
|
27722
27723
|
};
|
|
27723
27724
|
}
|
|
27724
27725
|
function extractRoutingAttribution(event) {
|
|
27725
|
-
const
|
|
27726
|
-
return { modelId: event.selectedModel, reasoning: event.reasoning, decisionPath:
|
|
27726
|
+
const path20 = event.decisionPath !== void 0 ? [...event.decisionPath] : void 0;
|
|
27727
|
+
return { modelId: event.selectedModel, reasoning: event.reasoning, decisionPath: path20 };
|
|
27727
27728
|
}
|
|
27728
27729
|
function extractPipelineAttribution(event) {
|
|
27729
27730
|
if (event.type === "pipeline.completed") {
|
|
@@ -29284,10 +29285,8 @@ function createSicaOrchestratorAdapter(sicaAgent, _logger) {
|
|
|
29284
29285
|
|
|
29285
29286
|
// src/mcp/tools/research-auto-catalog.ts
|
|
29286
29287
|
import * as fs4 from "fs";
|
|
29287
|
-
import * as path4 from "path";
|
|
29288
|
-
import * as os2 from "os";
|
|
29289
29288
|
import { z as z51 } from "zod";
|
|
29290
|
-
var
|
|
29289
|
+
var CATALOG_SUBDIR = "research";
|
|
29291
29290
|
var CATALOG_FILE = "pending-catalog.json";
|
|
29292
29291
|
var FILE_MODE = 384;
|
|
29293
29292
|
var DIR_MODE2 = 448;
|
|
@@ -29305,7 +29304,7 @@ var PersistedCatalogSchema = z51.object({
|
|
|
29305
29304
|
savedAt: z51.string()
|
|
29306
29305
|
});
|
|
29307
29306
|
function getCatalogPath() {
|
|
29308
|
-
return
|
|
29307
|
+
return nexusDataPath(CATALOG_SUBDIR, CATALOG_FILE);
|
|
29309
29308
|
}
|
|
29310
29309
|
function loadPersistedCatalog(logger56) {
|
|
29311
29310
|
const filePath = getCatalogPath();
|
|
@@ -29330,7 +29329,7 @@ function loadPersistedCatalog(logger56) {
|
|
|
29330
29329
|
}
|
|
29331
29330
|
}
|
|
29332
29331
|
function savePersistedCatalog(references, logger56) {
|
|
29333
|
-
const dirPath =
|
|
29332
|
+
const dirPath = nexusDataPath(CATALOG_SUBDIR);
|
|
29334
29333
|
const filePath = getCatalogPath();
|
|
29335
29334
|
const tempPath = `${filePath}.tmp.${String(process.pid)}`;
|
|
29336
29335
|
try {
|
|
@@ -31931,8 +31930,8 @@ function isReflectiveShadowMode() {
|
|
|
31931
31930
|
}
|
|
31932
31931
|
|
|
31933
31932
|
// src/mcp/tools/orchestrate-reflection.ts
|
|
31934
|
-
import * as
|
|
31935
|
-
import * as
|
|
31933
|
+
import * as os from "os";
|
|
31934
|
+
import * as path4 from "path";
|
|
31936
31935
|
var logger28 = createLogger({ component: "orchestrate-reflection" });
|
|
31937
31936
|
var REFLECTION_MAX_TOKENS2 = 1e3;
|
|
31938
31937
|
var REFLECTION_WRITE_CONFIDENCE_THRESHOLD = 0.6;
|
|
@@ -32023,7 +32022,7 @@ function writeLearningsToSession(learnings, taskDescription) {
|
|
|
32023
32022
|
}
|
|
32024
32023
|
if (eligible.length === 0) return 0;
|
|
32025
32024
|
try {
|
|
32026
|
-
const memoryDir =
|
|
32025
|
+
const memoryDir = path4.join(os.homedir(), ".nexus-agents", "memory", "sessions");
|
|
32027
32026
|
const memory = createSessionMemory(memoryDir);
|
|
32028
32027
|
const sessionId = `reflection-${String(Date.now())}`;
|
|
32029
32028
|
const startResult = memory.startSession(sessionId);
|
|
@@ -32471,8 +32470,8 @@ function hashObjective(userObjective) {
|
|
|
32471
32470
|
|
|
32472
32471
|
// src/context/structured-task-state.ts
|
|
32473
32472
|
import * as fs5 from "fs";
|
|
32474
|
-
import * as
|
|
32475
|
-
import * as
|
|
32473
|
+
import * as path5 from "path";
|
|
32474
|
+
import * as os2 from "os";
|
|
32476
32475
|
|
|
32477
32476
|
// src/context/structured-task-state-types.ts
|
|
32478
32477
|
import { z as z55 } from "zod";
|
|
@@ -32595,15 +32594,15 @@ var StructuredTaskLogEntrySchema = z55.discriminatedUnion("event", [
|
|
|
32595
32594
|
|
|
32596
32595
|
// src/context/structured-task-state.ts
|
|
32597
32596
|
var logger29 = createLogger({ component: "structured-task-state" });
|
|
32598
|
-
var TASKS_DIR =
|
|
32597
|
+
var TASKS_DIR = path5.join(".nexus-agents", "tasks");
|
|
32599
32598
|
var FILE_MODE2 = 384;
|
|
32600
32599
|
var DIR_MODE3 = 448;
|
|
32601
32600
|
function getTasksDir(customDir) {
|
|
32602
|
-
if (customDir !== void 0) return
|
|
32603
|
-
return
|
|
32601
|
+
if (customDir !== void 0) return path5.resolve(customDir);
|
|
32602
|
+
return path5.join(os2.homedir(), TASKS_DIR);
|
|
32604
32603
|
}
|
|
32605
32604
|
function getLogPath(taskId, customDir) {
|
|
32606
|
-
return
|
|
32605
|
+
return path5.join(getTasksDir(customDir), `state-${taskId}.jsonl`);
|
|
32607
32606
|
}
|
|
32608
32607
|
function validateTaskId(taskId) {
|
|
32609
32608
|
if (taskId.includes("..") || taskId.includes("/") || taskId.includes("\\")) {
|
|
@@ -36384,18 +36383,18 @@ function parseArxivEntries(xml, source, topic = "") {
|
|
|
36384
36383
|
|
|
36385
36384
|
// src/cli/research-helpers-sources-io.ts
|
|
36386
36385
|
import * as fs6 from "fs/promises";
|
|
36387
|
-
import * as
|
|
36386
|
+
import * as path6 from "path";
|
|
36388
36387
|
import { parse as parseYaml2, stringify as stringifyYaml } from "yaml";
|
|
36389
36388
|
var SOURCES_FILE = "sources.yaml";
|
|
36390
36389
|
function validatePath3(constructedPath, allowedRoot) {
|
|
36391
36390
|
const resolved = resolveInsideRoot(constructedPath, allowedRoot);
|
|
36392
36391
|
if (resolved === null) {
|
|
36393
|
-
const root =
|
|
36392
|
+
const root = path6.resolve(allowedRoot);
|
|
36394
36393
|
return {
|
|
36395
36394
|
ok: false,
|
|
36396
36395
|
error: {
|
|
36397
36396
|
code: "PATH_TRAVERSAL",
|
|
36398
|
-
message: `Path ${
|
|
36397
|
+
message: `Path ${path6.resolve(constructedPath)} is outside ${root}`
|
|
36399
36398
|
}
|
|
36400
36399
|
};
|
|
36401
36400
|
}
|
|
@@ -36403,7 +36402,7 @@ function validatePath3(constructedPath, allowedRoot) {
|
|
|
36403
36402
|
}
|
|
36404
36403
|
async function loadSourcesRegistry(rootDir) {
|
|
36405
36404
|
const root = rootDir ?? getProjectRoot();
|
|
36406
|
-
const filePath =
|
|
36405
|
+
const filePath = path6.join(root, REGISTRY_PATH, SOURCES_FILE);
|
|
36407
36406
|
const pathResult = validatePath3(filePath, root);
|
|
36408
36407
|
if (!pathResult.ok) return pathResult;
|
|
36409
36408
|
try {
|
|
@@ -36429,7 +36428,7 @@ async function loadSourcesRegistry(rootDir) {
|
|
|
36429
36428
|
}
|
|
36430
36429
|
async function saveSourcesRegistry(registry, rootDir) {
|
|
36431
36430
|
const root = rootDir ?? getProjectRoot();
|
|
36432
|
-
const filePath =
|
|
36431
|
+
const filePath = path6.join(root, REGISTRY_PATH, SOURCES_FILE);
|
|
36433
36432
|
const pathResult = validatePath3(filePath, root);
|
|
36434
36433
|
if (!pathResult.ok) return pathResult;
|
|
36435
36434
|
try {
|
|
@@ -36736,12 +36735,12 @@ function rankDiscoveredItems(items, topic) {
|
|
|
36736
36735
|
|
|
36737
36736
|
// src/cli/research-helpers-index-ops.ts
|
|
36738
36737
|
import * as fs7 from "fs/promises";
|
|
36739
|
-
import * as
|
|
36738
|
+
import * as path7 from "path";
|
|
36740
36739
|
function getRegistryPath() {
|
|
36741
|
-
return
|
|
36740
|
+
return path7.resolve(process.cwd(), "docs/research/registry");
|
|
36742
36741
|
}
|
|
36743
36742
|
function getIndexPath() {
|
|
36744
|
-
return
|
|
36743
|
+
return path7.resolve(process.cwd(), "docs/research/RESEARCH_INDEX.md");
|
|
36745
36744
|
}
|
|
36746
36745
|
async function handleStatsCommand(options) {
|
|
36747
36746
|
const registryPath = getRegistryPath();
|
|
@@ -36771,7 +36770,7 @@ async function handleRefreshCommand(options) {
|
|
|
36771
36770
|
if (!mdResult.ok) {
|
|
36772
36771
|
return `Error: Failed to generate markdown: ${mdResult.error.message}`;
|
|
36773
36772
|
}
|
|
36774
|
-
await fs7.mkdir(
|
|
36773
|
+
await fs7.mkdir(path7.dirname(outputPath), { recursive: true });
|
|
36775
36774
|
await fs7.writeFile(outputPath, mdResult.value, "utf-8");
|
|
36776
36775
|
const stats = index.stats;
|
|
36777
36776
|
return [
|
|
@@ -38711,12 +38710,12 @@ function extractFileReferences(markdown) {
|
|
|
38711
38710
|
let match;
|
|
38712
38711
|
FILE_REF_PATTERN.lastIndex = 0;
|
|
38713
38712
|
while ((match = FILE_REF_PATTERN.exec(markdown)) !== null) {
|
|
38714
|
-
const
|
|
38715
|
-
if (
|
|
38716
|
-
seen.add(
|
|
38713
|
+
const path20 = match[1];
|
|
38714
|
+
if (path20 === void 0 || seen.has(path20)) continue;
|
|
38715
|
+
seen.add(path20);
|
|
38717
38716
|
const lineStr = match[2];
|
|
38718
38717
|
const line = lineStr !== void 0 ? parseInt(lineStr, 10) : void 0;
|
|
38719
|
-
refs.push(line !== void 0 ? { path:
|
|
38718
|
+
refs.push(line !== void 0 ? { path: path20, line } : { path: path20 });
|
|
38720
38719
|
}
|
|
38721
38720
|
return refs;
|
|
38722
38721
|
}
|
|
@@ -40000,7 +39999,7 @@ function registerExtractSymbolsTool(server, deps) {
|
|
|
40000
39999
|
|
|
40001
40000
|
// src/mcp/tools/query-trace-tool.ts
|
|
40002
40001
|
import { readFile as readFile5, stat as stat3 } from "fs/promises";
|
|
40003
|
-
import { join as
|
|
40002
|
+
import { join as join9, resolve as resolve11, sep as sep3 } from "path";
|
|
40004
40003
|
import { z as z84 } from "zod";
|
|
40005
40004
|
var QueryTraceInputSchema = z84.object({
|
|
40006
40005
|
runId: z84.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/, "runId must be alphanumeric, hyphens, or underscores").describe("Run ID to query traces for"),
|
|
@@ -40041,7 +40040,7 @@ var EMPTY_RESPONSE = {
|
|
|
40041
40040
|
};
|
|
40042
40041
|
async function queryTraceFromDisk(input, runsDir) {
|
|
40043
40042
|
const dir = runsDir ?? DEFAULT_RUNS_DIR;
|
|
40044
|
-
const tracePath =
|
|
40043
|
+
const tracePath = join9(dir, input.runId, "trace.jsonl");
|
|
40045
40044
|
const resolvedDir = resolve11(dir);
|
|
40046
40045
|
const resolvedTrace = resolve11(tracePath);
|
|
40047
40046
|
if (!resolvedTrace.startsWith(resolvedDir + sep3) && resolvedTrace !== resolvedDir) {
|
|
@@ -40351,11 +40350,11 @@ var InMemoryAuditStorage = class {
|
|
|
40351
40350
|
|
|
40352
40351
|
// src/audit/audit-storage.ts
|
|
40353
40352
|
import * as fs9 from "fs";
|
|
40354
|
-
import * as
|
|
40353
|
+
import * as path8 from "path";
|
|
40355
40354
|
function validateLogDir(logDir, allowedRoot) {
|
|
40356
|
-
const resolvedRoot =
|
|
40357
|
-
const resolvedLogDir =
|
|
40358
|
-
if (!resolvedLogDir.startsWith(resolvedRoot +
|
|
40355
|
+
const resolvedRoot = path8.resolve(allowedRoot);
|
|
40356
|
+
const resolvedLogDir = path8.resolve(allowedRoot, logDir);
|
|
40357
|
+
if (!resolvedLogDir.startsWith(resolvedRoot + path8.sep) && resolvedLogDir !== resolvedRoot) {
|
|
40359
40358
|
return {
|
|
40360
40359
|
ok: false,
|
|
40361
40360
|
error: new SecurityError("Path traversal detected: logDir escapes allowed root directory", {
|
|
@@ -40378,10 +40377,10 @@ function validateLogDirBasic(logDir) {
|
|
|
40378
40377
|
};
|
|
40379
40378
|
}
|
|
40380
40379
|
}
|
|
40381
|
-
const resolved =
|
|
40380
|
+
const resolved = path8.resolve(logDir);
|
|
40382
40381
|
const systemDirs = ["/etc", "/var", "/usr", "/bin", "/sbin", "/root", "/proc", "/sys"];
|
|
40383
40382
|
for (const sysDir of systemDirs) {
|
|
40384
|
-
if (resolved === sysDir || resolved.startsWith(sysDir +
|
|
40383
|
+
if (resolved === sysDir || resolved.startsWith(sysDir + path8.sep)) {
|
|
40385
40384
|
return {
|
|
40386
40385
|
ok: false,
|
|
40387
40386
|
error: new SecurityError("logDir cannot be a system directory", {
|
|
@@ -40470,7 +40469,7 @@ var FileAuditStorage = class _FileAuditStorage {
|
|
|
40470
40469
|
const existingFiles = this.getExistingLogFiles();
|
|
40471
40470
|
const latestFileName = existingFiles[0];
|
|
40472
40471
|
if (existingFiles.length > 0 && latestFileName !== void 0) {
|
|
40473
|
-
const latestFile =
|
|
40472
|
+
const latestFile = path8.join(this.logDir, latestFileName);
|
|
40474
40473
|
const stats = fs9.statSync(latestFile);
|
|
40475
40474
|
if (stats.size < this.maxFileSizeBytes) {
|
|
40476
40475
|
this.currentFile = latestFile;
|
|
@@ -40493,7 +40492,7 @@ var FileAuditStorage = class _FileAuditStorage {
|
|
|
40493
40492
|
this.writeStream.end();
|
|
40494
40493
|
this.writeStream = null;
|
|
40495
40494
|
}
|
|
40496
|
-
this.currentFile =
|
|
40495
|
+
this.currentFile = path8.join(this.logDir, this.generateFileName());
|
|
40497
40496
|
this.currentFileSize = 0;
|
|
40498
40497
|
this.openWriteStream();
|
|
40499
40498
|
this.logger.debug("Rotated audit log file", { file: this.currentFile });
|
|
@@ -40504,7 +40503,7 @@ var FileAuditStorage = class _FileAuditStorage {
|
|
|
40504
40503
|
if (files.length > this.maxFiles) {
|
|
40505
40504
|
const filesToDelete = files.slice(this.maxFiles);
|
|
40506
40505
|
for (const file of filesToDelete) {
|
|
40507
|
-
const filePath =
|
|
40506
|
+
const filePath = path8.join(this.logDir, file);
|
|
40508
40507
|
fs9.unlinkSync(filePath);
|
|
40509
40508
|
this.logger.info("Pruned old audit log", { file });
|
|
40510
40509
|
}
|
|
@@ -40558,7 +40557,7 @@ var FileAuditStorage = class _FileAuditStorage {
|
|
|
40558
40557
|
let skipped = 0;
|
|
40559
40558
|
for (const file of files) {
|
|
40560
40559
|
if (results.length >= limit) break;
|
|
40561
|
-
const filePath =
|
|
40560
|
+
const filePath = path8.join(this.logDir, file);
|
|
40562
40561
|
const events = await readAuditFile({
|
|
40563
40562
|
filePath,
|
|
40564
40563
|
criteria,
|
|
@@ -41529,7 +41528,7 @@ function resolveConfidence(rule) {
|
|
|
41529
41528
|
}
|
|
41530
41529
|
|
|
41531
41530
|
// src/mcp/tools/security-scan.ts
|
|
41532
|
-
import * as
|
|
41531
|
+
import * as path9 from "path";
|
|
41533
41532
|
var logger33 = createLogger({ component: "security-scan" });
|
|
41534
41533
|
var SCAN_TIMEOUT_MS = 3e5;
|
|
41535
41534
|
async function isSemgrepAvailable() {
|
|
@@ -41556,9 +41555,9 @@ async function runSemgrep(targetDir, rulesets) {
|
|
|
41556
41555
|
return stdout;
|
|
41557
41556
|
}
|
|
41558
41557
|
function validateTargetPath(target) {
|
|
41559
|
-
const root =
|
|
41560
|
-
const resolved =
|
|
41561
|
-
if (resolved !== root && !resolved.startsWith(root +
|
|
41558
|
+
const root = path9.resolve(process.cwd());
|
|
41559
|
+
const resolved = path9.resolve(root, target);
|
|
41560
|
+
if (resolved !== root && !resolved.startsWith(root + path9.sep)) {
|
|
41562
41561
|
throw new Error(
|
|
41563
41562
|
`Invalid target path: must resolve inside ${root} (got ${resolved})`
|
|
41564
41563
|
);
|
|
@@ -41987,8 +41986,8 @@ async function runOsvCheck(targetDir, enabled) {
|
|
|
41987
41986
|
if (!enabled) return [];
|
|
41988
41987
|
try {
|
|
41989
41988
|
const fs20 = await import("fs");
|
|
41990
|
-
const
|
|
41991
|
-
const pkgPath =
|
|
41989
|
+
const path20 = await import("path");
|
|
41990
|
+
const pkgPath = path20.join(targetDir, "package.json");
|
|
41992
41991
|
if (!fs20.existsSync(pkgPath)) return [];
|
|
41993
41992
|
const pkg = JSON.parse(fs20.readFileSync(pkgPath, "utf-8"));
|
|
41994
41993
|
const deps = Object.entries(pkg.dependencies ?? {}).slice(0, 20).map(([name, version]) => ({
|
|
@@ -42099,11 +42098,10 @@ async function persistMobiMemState() {
|
|
|
42099
42098
|
try {
|
|
42100
42099
|
const { isPersistenceEnabled } = await import("./learning-persistence-WMWZJZ35.js");
|
|
42101
42100
|
if (!isPersistenceEnabled()) return;
|
|
42102
|
-
const
|
|
42103
|
-
const path21 = await import("path");
|
|
42101
|
+
const { nexusDataPath: nexusDataPath2 } = await import("./nexus-data-dir-M6DYKIHJ.js");
|
|
42104
42102
|
const { createMobiMem } = await import("./mobimem-QDBP37H7.js");
|
|
42105
42103
|
const mobimem = createMobiMem();
|
|
42106
|
-
const savePath =
|
|
42104
|
+
const savePath = nexusDataPath2("memory", "mobimem-state.json");
|
|
42107
42105
|
await mobimem.save(savePath);
|
|
42108
42106
|
} catch {
|
|
42109
42107
|
}
|
|
@@ -42257,7 +42255,7 @@ ${contextBlock}`;
|
|
|
42257
42255
|
const strategy = config.votingStrategy ?? "higher_order";
|
|
42258
42256
|
await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
|
|
42259
42257
|
try {
|
|
42260
|
-
const { executeVoting } = await import("./consensus-vote-
|
|
42258
|
+
const { executeVoting } = await import("./consensus-vote-PRLGGUNY.js");
|
|
42261
42259
|
const votingResult = await executeVoting(
|
|
42262
42260
|
{
|
|
42263
42261
|
proposal: plan.slice(0, 4e3),
|
|
@@ -42417,7 +42415,7 @@ function extractIssues(text) {
|
|
|
42417
42415
|
|
|
42418
42416
|
// src/pipeline/pipeline-checkpoint.ts
|
|
42419
42417
|
import * as fs10 from "fs";
|
|
42420
|
-
import * as
|
|
42418
|
+
import * as path10 from "path";
|
|
42421
42419
|
var logger38 = createLogger({ component: "pipeline-checkpoint" });
|
|
42422
42420
|
var SESSION_ID_REGEX = /^[a-zA-Z0-9_-]{1,128}$/;
|
|
42423
42421
|
function validateSessionId(sessionId) {
|
|
@@ -42429,7 +42427,7 @@ function getCheckpointPath(sessionId, customDir) {
|
|
|
42429
42427
|
logger38.warn("Checkpoint directory unavailable", { error: dirResult.error.message });
|
|
42430
42428
|
return null;
|
|
42431
42429
|
}
|
|
42432
|
-
return
|
|
42430
|
+
return path10.join(dirResult.value, `pipeline-${sessionId}.jsonl`);
|
|
42433
42431
|
}
|
|
42434
42432
|
function saveStageCheckpoint(sessionId, stage, data, customDir) {
|
|
42435
42433
|
if (!validateSessionId(sessionId)) {
|
|
@@ -42521,10 +42519,6 @@ function checkpointToResult(state) {
|
|
|
42521
42519
|
return result;
|
|
42522
42520
|
}
|
|
42523
42521
|
|
|
42524
|
-
// src/pipeline/dev-pipeline.ts
|
|
42525
|
-
import { homedir as homedir6 } from "os";
|
|
42526
|
-
import { join as join14 } from "path";
|
|
42527
|
-
|
|
42528
42522
|
// src/orchestration/qa-loop.ts
|
|
42529
42523
|
var logger39 = createLogger({ component: "qa-loop" });
|
|
42530
42524
|
var DEFAULT_MAX_QA_ITERATIONS = 3;
|
|
@@ -42611,7 +42605,7 @@ async function runDevPipelineInner(task, stages, options, sid, prior) {
|
|
|
42611
42605
|
function createTraceWriter(sessionId) {
|
|
42612
42606
|
if (sessionId === void 0) return null;
|
|
42613
42607
|
try {
|
|
42614
|
-
const tracesDir =
|
|
42608
|
+
const tracesDir = nexusDataPath("traces");
|
|
42615
42609
|
return new TraceWriter(getPipelineEventBus(), {
|
|
42616
42610
|
runsDir: tracesDir,
|
|
42617
42611
|
runId: `pipeline-${sessionId}`
|
|
@@ -43106,11 +43100,11 @@ async function extractSymbolsForTask(task) {
|
|
|
43106
43100
|
const fileRefs = task.match(/(?:src|lib|packages)\/[^\s,)]+\.ts/g);
|
|
43107
43101
|
if (fileRefs === null || fileRefs.length === 0) return null;
|
|
43108
43102
|
const { extractSymbols: extractSymbols2 } = await import("./symbol-extractor-UEBANFSN.js");
|
|
43109
|
-
const
|
|
43103
|
+
const path20 = await import("path");
|
|
43110
43104
|
const summaries = [];
|
|
43111
43105
|
for (const ref of fileRefs.slice(0, 3)) {
|
|
43112
43106
|
try {
|
|
43113
|
-
const resolved =
|
|
43107
|
+
const resolved = path20.resolve(ref);
|
|
43114
43108
|
const result = await extractSymbols2(resolved);
|
|
43115
43109
|
const exported = result.symbols.filter((s) => s.exported);
|
|
43116
43110
|
if (exported.length > 0) {
|
|
@@ -43127,12 +43121,12 @@ async function extractSymbolsForTask(task) {
|
|
|
43127
43121
|
async function retrieveAdaptiveMemory(task) {
|
|
43128
43122
|
try {
|
|
43129
43123
|
const { AdaptiveMemoryBackend } = await import("./adaptive-memory-TSZEJUJC.js");
|
|
43130
|
-
const
|
|
43131
|
-
const
|
|
43132
|
-
const baseDir =
|
|
43124
|
+
const path20 = await import("path");
|
|
43125
|
+
const { nexusDataPath: nexusDataPath2 } = await import("./nexus-data-dir-M6DYKIHJ.js");
|
|
43126
|
+
const baseDir = nexusDataPath2("memory");
|
|
43133
43127
|
const memory = new AdaptiveMemoryBackend({
|
|
43134
|
-
dbPath:
|
|
43135
|
-
markdownDir:
|
|
43128
|
+
dbPath: path20.join(baseDir, "adaptive.db"),
|
|
43129
|
+
markdownDir: path20.join(baseDir, "adaptive-md")
|
|
43136
43130
|
});
|
|
43137
43131
|
const key = task.slice(0, 50).replace(/\s+/g, "-").toLowerCase();
|
|
43138
43132
|
const result = await memory.retrieve(key);
|
|
@@ -43581,7 +43575,7 @@ function registerQueryTaskStateTool(server, deps) {
|
|
|
43581
43575
|
|
|
43582
43576
|
// src/mcp/tools/verify-audit-chain-tool.ts
|
|
43583
43577
|
import * as fs11 from "fs/promises";
|
|
43584
|
-
import * as
|
|
43578
|
+
import * as path11 from "path";
|
|
43585
43579
|
import { z as z92 } from "zod";
|
|
43586
43580
|
var VerifyAuditChainInputSchema = z92.object({
|
|
43587
43581
|
logDir: z92.string().min(1).max(512).describe(
|
|
@@ -43593,7 +43587,7 @@ async function loadAuditEvents(dir, logger56) {
|
|
|
43593
43587
|
const auditFiles = entries.filter((name) => name.startsWith("audit-") && name.endsWith(".jsonl")).sort();
|
|
43594
43588
|
const events = [];
|
|
43595
43589
|
for (const filename of auditFiles) {
|
|
43596
|
-
const fullPath =
|
|
43590
|
+
const fullPath = path11.join(dir, filename);
|
|
43597
43591
|
let content;
|
|
43598
43592
|
try {
|
|
43599
43593
|
content = await fs11.readFile(fullPath, "utf-8");
|
|
@@ -43628,7 +43622,7 @@ async function handler2(args, ctx) {
|
|
|
43628
43622
|
if (!parsed.success) {
|
|
43629
43623
|
return toolError(`Validation error: ${formatZodError(parsed.error)}`);
|
|
43630
43624
|
}
|
|
43631
|
-
const resolvedDir =
|
|
43625
|
+
const resolvedDir = path11.resolve(parsed.data.logDir);
|
|
43632
43626
|
let dirStats;
|
|
43633
43627
|
try {
|
|
43634
43628
|
dirStats = await fs11.stat(resolvedDir);
|
|
@@ -43678,7 +43672,7 @@ function registerVerifyAuditChainTool(server, deps) {
|
|
|
43678
43672
|
// src/mcp/tools/pipeline-tool.ts
|
|
43679
43673
|
import { z as z93 } from "zod";
|
|
43680
43674
|
import * as fs12 from "fs";
|
|
43681
|
-
import * as
|
|
43675
|
+
import * as path12 from "path";
|
|
43682
43676
|
var PipelineInputSchema = z93.object({
|
|
43683
43677
|
/** The task to execute. */
|
|
43684
43678
|
task: z93.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
|
|
@@ -43721,8 +43715,8 @@ function buildOutput2(result) {
|
|
|
43721
43715
|
}
|
|
43722
43716
|
function resolveTask(task, specFile) {
|
|
43723
43717
|
if (specFile === void 0) return task;
|
|
43724
|
-
const resolved =
|
|
43725
|
-
const cwdRoot =
|
|
43718
|
+
const resolved = path12.resolve(specFile);
|
|
43719
|
+
const cwdRoot = path12.resolve(".");
|
|
43726
43720
|
if (!resolved.startsWith(cwdRoot)) {
|
|
43727
43721
|
throw new Error(`Path traversal denied: specFile must be within ${cwdRoot}`);
|
|
43728
43722
|
}
|
|
@@ -48153,13 +48147,13 @@ function createEmptyContext() {
|
|
|
48153
48147
|
approachHistory: []
|
|
48154
48148
|
};
|
|
48155
48149
|
}
|
|
48156
|
-
function assignRelevance(
|
|
48150
|
+
function assignRelevance(path20, response) {
|
|
48157
48151
|
const lowerResponse = response.toLowerCase();
|
|
48158
|
-
const lowerPath =
|
|
48152
|
+
const lowerPath = path20.toLowerCase();
|
|
48159
48153
|
const idx = lowerResponse.indexOf(lowerPath);
|
|
48160
48154
|
if (idx === -1) return "low";
|
|
48161
48155
|
const surroundStart = Math.max(0, idx - 100);
|
|
48162
|
-
const surroundEnd = Math.min(lowerResponse.length, idx +
|
|
48156
|
+
const surroundEnd = Math.min(lowerResponse.length, idx + path20.length + 100);
|
|
48163
48157
|
const surrounding = lowerResponse.slice(surroundStart, surroundEnd);
|
|
48164
48158
|
if (/(?:root cause|bug|fix|patch|change|modify|edit)/i.test(surrounding)) {
|
|
48165
48159
|
return "high";
|
|
@@ -48303,9 +48297,9 @@ var SAFE_COMMIT_RE = /^[0-9a-f]{7,40}$/i;
|
|
|
48303
48297
|
var SAFE_REPO_RE = /^[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+$/;
|
|
48304
48298
|
async function tryExistingClone(repoDir, commit, exec5) {
|
|
48305
48299
|
const fs20 = await import("fs/promises");
|
|
48306
|
-
const
|
|
48300
|
+
const path20 = await import("path");
|
|
48307
48301
|
try {
|
|
48308
|
-
await fs20.access(
|
|
48302
|
+
await fs20.access(path20.join(repoDir, ".git"));
|
|
48309
48303
|
await exec5(`git checkout -- .`, { cwd: repoDir, timeout: GIT_TIMEOUT_MS });
|
|
48310
48304
|
await exec5(`git clean -fd`, { cwd: repoDir, timeout: GIT_TIMEOUT_MS });
|
|
48311
48305
|
try {
|
|
@@ -48324,7 +48318,7 @@ async function tryExistingClone(repoDir, commit, exec5) {
|
|
|
48324
48318
|
}
|
|
48325
48319
|
}
|
|
48326
48320
|
async function cloneRepository(repo, commit, workDir) {
|
|
48327
|
-
const
|
|
48321
|
+
const path20 = await import("path");
|
|
48328
48322
|
const fs20 = await import("fs/promises");
|
|
48329
48323
|
const childProcess = await import("child_process");
|
|
48330
48324
|
const { promisify: promisify9 } = await import("util");
|
|
@@ -48335,7 +48329,7 @@ async function cloneRepository(repo, commit, workDir) {
|
|
|
48335
48329
|
if (!SAFE_COMMIT_RE.test(commit)) {
|
|
48336
48330
|
return { ok: false, error: new AgentRunnerError(`Invalid commit hash: ${commit}`) };
|
|
48337
48331
|
}
|
|
48338
|
-
const repoDir =
|
|
48332
|
+
const repoDir = path20.join(workDir, repo.replaceAll("/", "__"));
|
|
48339
48333
|
try {
|
|
48340
48334
|
await fs20.mkdir(workDir, { recursive: true });
|
|
48341
48335
|
const cloned = await tryExistingClone(repoDir, commit, exec5);
|
|
@@ -48354,8 +48348,8 @@ async function applyPatch(repoDir, patch) {
|
|
|
48354
48348
|
const { promisify: promisify9 } = await import("util");
|
|
48355
48349
|
const exec5 = promisify9(childProcess.exec);
|
|
48356
48350
|
const fs20 = await import("fs/promises");
|
|
48357
|
-
const
|
|
48358
|
-
const patchFile =
|
|
48351
|
+
const path20 = await import("path");
|
|
48352
|
+
const patchFile = path20.join(repoDir, ".agent_patch.diff");
|
|
48359
48353
|
try {
|
|
48360
48354
|
await fs20.writeFile(patchFile, patch);
|
|
48361
48355
|
await exec5(`git apply --whitespace=fix ${patchFile}`, {
|
|
@@ -49493,7 +49487,7 @@ function transformHarnessOutput(raw) {
|
|
|
49493
49487
|
// src/swe-bench/harness-file-operations.ts
|
|
49494
49488
|
import { spawn } from "child_process";
|
|
49495
49489
|
import * as fs14 from "fs/promises";
|
|
49496
|
-
import * as
|
|
49490
|
+
import * as path13 from "path";
|
|
49497
49491
|
var capitalizeFirst = capitalize;
|
|
49498
49492
|
function buildHarnessArgs(config) {
|
|
49499
49493
|
const args = [
|
|
@@ -49590,7 +49584,7 @@ function createInitialProgress(totalCount) {
|
|
|
49590
49584
|
};
|
|
49591
49585
|
}
|
|
49592
49586
|
function getResultsFilePath(config) {
|
|
49593
|
-
return
|
|
49587
|
+
return path13.join(config.outputDir, config.runId, "results.json");
|
|
49594
49588
|
}
|
|
49595
49589
|
|
|
49596
49590
|
// src/swe-bench/harness-process-runner.ts
|
|
@@ -50147,7 +50141,7 @@ function formatValidationResult(result) {
|
|
|
50147
50141
|
}
|
|
50148
50142
|
|
|
50149
50143
|
// src/swe-bench/evaluation-harness-helpers.ts
|
|
50150
|
-
import * as
|
|
50144
|
+
import * as os3 from "os";
|
|
50151
50145
|
function calculateMetrics(results) {
|
|
50152
50146
|
const totalInstances = results.length;
|
|
50153
50147
|
const predictedInstances = totalInstances;
|
|
@@ -50239,12 +50233,12 @@ function createProgressAdapter(totalPredictions, onProgress) {
|
|
|
50239
50233
|
}
|
|
50240
50234
|
function getMemoryInfo() {
|
|
50241
50235
|
return {
|
|
50242
|
-
total:
|
|
50243
|
-
free:
|
|
50236
|
+
total: os3.totalmem(),
|
|
50237
|
+
free: os3.freemem()
|
|
50244
50238
|
};
|
|
50245
50239
|
}
|
|
50246
50240
|
function getCpuCores() {
|
|
50247
|
-
return
|
|
50241
|
+
return os3.cpus().length;
|
|
50248
50242
|
}
|
|
50249
50243
|
|
|
50250
50244
|
// src/swe-bench/evaluation-harness.ts
|
|
@@ -51328,11 +51322,11 @@ function parsePatch(patch) {
|
|
|
51328
51322
|
import { execFile as execFile5 } from "child_process";
|
|
51329
51323
|
import { promisify as promisify7 } from "util";
|
|
51330
51324
|
import * as fs15 from "fs/promises";
|
|
51331
|
-
import * as
|
|
51325
|
+
import * as path14 from "path";
|
|
51332
51326
|
var execFileAsync5 = promisify7(execFile5);
|
|
51333
51327
|
var MAX_OUTPUT_BUFFER = 5 * 1024 * 1024;
|
|
51334
51328
|
async function writeTempPatch(patch, workDir) {
|
|
51335
|
-
const tempPath =
|
|
51329
|
+
const tempPath = path14.join(workDir, `.patch-${String(getTimeProvider().now())}.patch`);
|
|
51336
51330
|
await fs15.writeFile(tempPath, patch, "utf-8");
|
|
51337
51331
|
return tempPath;
|
|
51338
51332
|
}
|
|
@@ -51583,9 +51577,9 @@ var TestRunnerError = class extends Error {
|
|
|
51583
51577
|
|
|
51584
51578
|
// src/swe-bench/test-runner-parser.ts
|
|
51585
51579
|
import * as fs16 from "fs/promises";
|
|
51586
|
-
import * as
|
|
51580
|
+
import * as path15 from "path";
|
|
51587
51581
|
async function readJsonResults(workDir) {
|
|
51588
|
-
const jsonPath =
|
|
51582
|
+
const jsonPath = path15.join(workDir, "test-results.json");
|
|
51589
51583
|
try {
|
|
51590
51584
|
const content = await fs16.readFile(jsonPath, "utf-8");
|
|
51591
51585
|
return JSON.parse(content);
|
|
@@ -51780,7 +51774,7 @@ ${getStderr()}`.trim();
|
|
|
51780
51774
|
import { exec as exec3 } from "child_process";
|
|
51781
51775
|
import { promisify as promisify8 } from "util";
|
|
51782
51776
|
import * as fs17 from "fs/promises";
|
|
51783
|
-
import * as
|
|
51777
|
+
import * as path16 from "path";
|
|
51784
51778
|
var execAsync3 = promisify8(exec3);
|
|
51785
51779
|
var FRAMEWORK_CONFIG_FILES = {
|
|
51786
51780
|
pytest: ["pytest.ini", "pyproject.toml", "setup.cfg", "conftest.py", "tox.ini"],
|
|
@@ -51886,7 +51880,7 @@ var TestRunner = class {
|
|
|
51886
51880
|
async findConfigFiles(workDir, configFiles) {
|
|
51887
51881
|
const found = [];
|
|
51888
51882
|
for (const file of configFiles) {
|
|
51889
|
-
const filePath =
|
|
51883
|
+
const filePath = path16.join(workDir, file);
|
|
51890
51884
|
try {
|
|
51891
51885
|
await fs17.access(filePath);
|
|
51892
51886
|
found.push(file);
|
|
@@ -52039,7 +52033,7 @@ async function detectTestFramework(workDir) {
|
|
|
52039
52033
|
|
|
52040
52034
|
// src/swe-bench/report-generator.ts
|
|
52041
52035
|
import * as fs18 from "fs/promises";
|
|
52042
|
-
import * as
|
|
52036
|
+
import * as path17 from "path";
|
|
52043
52037
|
|
|
52044
52038
|
// src/swe-bench/report-renderer.ts
|
|
52045
52039
|
function renderReport(report, format) {
|
|
@@ -52395,7 +52389,7 @@ var ReportGenerator = class {
|
|
|
52395
52389
|
async save(report, config) {
|
|
52396
52390
|
this.logger.info("Saving report", { outputPath: config.outputPath });
|
|
52397
52391
|
const content = await this.render(report, config.format);
|
|
52398
|
-
await fs18.mkdir(
|
|
52392
|
+
await fs18.mkdir(path17.dirname(config.outputPath), { recursive: true });
|
|
52399
52393
|
await fs18.writeFile(config.outputPath, content, "utf-8");
|
|
52400
52394
|
this.logger.info("Report saved", { path: config.outputPath, format: config.format });
|
|
52401
52395
|
}
|
|
@@ -52615,14 +52609,14 @@ async function exportReport(result, outputPath, config) {
|
|
|
52615
52609
|
|
|
52616
52610
|
// src/swe-bench/trace-logger.ts
|
|
52617
52611
|
import { appendFile, writeFile as writeFile6 } from "fs/promises";
|
|
52618
|
-
import * as
|
|
52612
|
+
import * as path18 from "path";
|
|
52619
52613
|
function deriveTracePath(outputPath) {
|
|
52620
|
-
const ext =
|
|
52614
|
+
const ext = path18.extname(outputPath);
|
|
52621
52615
|
const base = outputPath.slice(0, outputPath.length - ext.length);
|
|
52622
52616
|
return `${base}-trace.jsonl`;
|
|
52623
52617
|
}
|
|
52624
52618
|
function deriveStatusPath(outputPath) {
|
|
52625
|
-
const ext =
|
|
52619
|
+
const ext = path18.extname(outputPath);
|
|
52626
52620
|
const base = outputPath.slice(0, outputPath.length - ext.length);
|
|
52627
52621
|
return `${base}-status.json`;
|
|
52628
52622
|
}
|
|
@@ -52828,7 +52822,7 @@ function getStdinLifecycleMonitor() {
|
|
|
52828
52822
|
|
|
52829
52823
|
// src/pipeline/task-tracker.ts
|
|
52830
52824
|
import * as fs19 from "fs";
|
|
52831
|
-
import * as
|
|
52825
|
+
import * as path19 from "path";
|
|
52832
52826
|
var logger55 = createLogger({ component: "task-tracker" });
|
|
52833
52827
|
async function exec4(cmd, args, timeout = 15e3) {
|
|
52834
52828
|
const { execFile: execFile6 } = await import("child_process");
|
|
@@ -52906,8 +52900,8 @@ var JsonTaskTracker = class {
|
|
|
52906
52900
|
outputPath;
|
|
52907
52901
|
constructor(config) {
|
|
52908
52902
|
const dir = config.outputDir ?? ".nexus-pipeline";
|
|
52909
|
-
this.outputPath =
|
|
52910
|
-
fs19.mkdirSync(
|
|
52903
|
+
this.outputPath = path19.resolve(dir, "tasks.json");
|
|
52904
|
+
fs19.mkdirSync(path19.dirname(this.outputPath), { recursive: true });
|
|
52911
52905
|
}
|
|
52912
52906
|
async createTask(title, body) {
|
|
52913
52907
|
const id = String(this.nextId++);
|
|
@@ -53667,4 +53661,4 @@ export {
|
|
|
53667
53661
|
detectBackend,
|
|
53668
53662
|
createTaskTracker
|
|
53669
53663
|
};
|
|
53670
|
-
//# sourceMappingURL=chunk-
|
|
53664
|
+
//# sourceMappingURL=chunk-5JSMLCCK.js.map
|