nexus-agents 2.168.0 → 2.170.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/README.md +1 -1
- package/dist/{child-mcp-config-FAWSJFMQ.js → child-mcp-config-3RYBPZNE.js} +2 -2
- package/dist/{chunk-HZNOSJOO.js → chunk-57RYP435.js} +3 -3
- package/dist/{chunk-IAGLVGHN.js → chunk-5N5XURKV.js} +2 -2
- package/dist/{chunk-3KID7AIF.js → chunk-6TN2Z2AQ.js} +3 -3
- package/dist/{chunk-GNCUZDQI.js → chunk-75AUSQL4.js} +7 -7
- package/dist/{chunk-P7RBQUAG.js → chunk-BGV3IF3G.js} +8 -8
- package/dist/{chunk-F5JDQXHJ.js → chunk-C6IAXFNC.js} +2 -2
- package/dist/{chunk-2Z4QECP7.js → chunk-DCXCVEZP.js} +2 -2
- package/dist/{chunk-G7NDNFIE.js → chunk-DDQXPARJ.js} +3 -3
- package/dist/{chunk-UN7PYUJB.js → chunk-DEE2UTYV.js} +2 -2
- package/dist/{chunk-OKAHIWG4.js → chunk-GVTXP6F6.js} +25 -4
- package/dist/chunk-GVTXP6F6.js.map +1 -0
- package/dist/{chunk-6ERIC5NJ.js → chunk-HTM32H2E.js} +2 -2
- package/dist/{chunk-VQE3OSUW.js → chunk-JLG5AUZB.js} +2 -2
- package/dist/{chunk-MSBYVBPX.js → chunk-JOYOOEPJ.js} +2 -2
- package/dist/{chunk-N56C2MWI.js → chunk-JYDXHV4L.js} +2 -2
- package/dist/{chunk-CPS2HN4T.js → chunk-LDZEYJP3.js} +2 -2
- package/dist/{chunk-ELWMGKVP.js → chunk-LOKT6EW7.js} +8 -8
- package/dist/{chunk-LNPKBBPG.js → chunk-LYWNKEGM.js} +4 -4
- package/dist/{chunk-2ANAH2UU.js → chunk-MG4JBADQ.js} +4 -4
- package/dist/{chunk-TORS5V2C.js → chunk-NXSY4G4Y.js} +2 -2
- package/dist/{chunk-EQLJYWLP.js → chunk-OFVUBY6Z.js} +3 -3
- package/dist/{chunk-OLCDGMEO.js → chunk-OIT75IRK.js} +4 -4
- package/dist/{chunk-RJHLNI37.js → chunk-OYBAKU7N.js} +2 -2
- package/dist/{chunk-I3LGUSZ3.js → chunk-P4PLZZCR.js} +5 -5
- package/dist/{chunk-MX3XD2ML.js → chunk-PIODB4SW.js} +2 -2
- package/dist/{chunk-52T2MJDS.js → chunk-QMOJJ6A2.js} +732 -598
- package/dist/chunk-QMOJJ6A2.js.map +1 -0
- package/dist/{chunk-ETFCT2CH.js → chunk-RJDJMOX6.js} +4 -4
- package/dist/{chunk-5LPPJIZ4.js → chunk-RZJQZ5P3.js} +2 -2
- package/dist/{chunk-7IUVW67T.js → chunk-SCHD7NZD.js} +7 -7
- package/dist/{chunk-HJA3Z56H.js → chunk-URRNWRI4.js} +234 -20
- package/dist/chunk-URRNWRI4.js.map +1 -0
- package/dist/{chunk-UGJRDFMN.js → chunk-UXXNNT5D.js} +2 -2
- package/dist/{chunk-TZK7VQAW.js → chunk-WKW5SEP7.js} +5 -5
- package/dist/{chunk-AO4X3BMP.js → chunk-YF35FKKD.js} +2 -1
- package/dist/chunk-YF35FKKD.js.map +1 -0
- package/dist/{chunk-RQNBJ7AS.js → chunk-Z4AWOPXA.js} +2 -2
- package/dist/{chunk-CJLMB7MO.js → chunk-ZW7544DX.js} +3 -3
- package/dist/{cli-circuit-breaker-JDGZ25MD.js → cli-circuit-breaker-4GJA2IXC.js} +4 -4
- package/dist/cli.js +43 -41
- package/dist/cli.js.map +1 -1
- package/dist/codebase-search-LUF5YJLQ.js +14 -0
- package/dist/{composite-router-EZPPVCMD.js → composite-router-UBZO4YR7.js} +2 -2
- package/dist/{consensus-vote-YKKJHLOD.js → consensus-vote-USZFJO2K.js} +15 -15
- package/dist/{context-retriever-EGMARBAC.js → context-retriever-C5C7RFQE.js} +8 -8
- package/dist/{doctor-deep-QTBDR3VV.js → doctor-deep-2N3F7EV6.js} +3 -3
- package/dist/{expert-bridge-FZYJ3XAL.js → expert-bridge-B3EFTAID.js} +4 -4
- package/dist/{factory-SABHBAHC.js → factory-LKQKU3SD.js} +8 -8
- package/dist/{factory-NDMPXPYE.js → factory-SURRFPSV.js} +5 -5
- package/dist/{improvement-review-WYFGNEVP.js → improvement-review-75OCZ5K7.js} +5 -5
- package/dist/index.d.ts +40 -1
- package/dist/index.js +35 -31
- package/dist/index.js.map +1 -1
- package/dist/{init-opencode-CMGJ3TXZ.js → init-opencode-LDI5E5LW.js} +5 -5
- package/dist/{issue-triage-NHRZGMKC.js → issue-triage-WWQEY7PL.js} +6 -6
- package/dist/{pr-reviewer-helpers-HJRFRUZX.js → pr-reviewer-helpers-HDP24LGZ.js} +4 -4
- package/dist/{registry-command-JCOZA7TM.js → registry-command-PZY7HWKO.js} +2 -2
- package/dist/{repo-security-plan-OMY33VHA.js → repo-security-plan-IYKDY5PW.js} +3 -3
- package/dist/{research-helpers-synthesize-DFINP3KN.js → research-helpers-synthesize-XSOFXRFK.js} +4 -4
- package/dist/{routing-memory-KK4GPB64.js → routing-memory-JTNH2BXS.js} +2 -2
- package/dist/{session-memory-QTHGU2XM.js → session-memory-RJZ447UX.js} +3 -3
- package/dist/{setup-command-CURZCHSQ.js → setup-command-35MCRS33.js} +13 -13
- package/dist/{setup-config-FX6SJXGQ.js → setup-config-JV23ZYPO.js} +3 -3
- package/dist/{setup-custom-api-MYN4EVT2.js → setup-custom-api-LMA445OB.js} +3 -3
- package/dist/{tool-memory-3W5NXR4P.js → tool-memory-K6EYH3FQ.js} +5 -5
- package/dist/{unified-registry-PKPNJ3G7.js → unified-registry-MJA6IBDD.js} +9 -9
- package/dist/{weather-report-46ZY3X2Z.js → weather-report-ID4ZNUAF.js} +2 -2
- package/package.json +2 -1
- package/dist/chunk-52T2MJDS.js.map +0 -1
- package/dist/chunk-AO4X3BMP.js.map +0 -1
- package/dist/chunk-HJA3Z56H.js.map +0 -1
- package/dist/chunk-OKAHIWG4.js.map +0 -1
- package/dist/codebase-search-DKLEA4PR.js +0 -12
- /package/dist/{child-mcp-config-FAWSJFMQ.js.map → child-mcp-config-3RYBPZNE.js.map} +0 -0
- /package/dist/{chunk-HZNOSJOO.js.map → chunk-57RYP435.js.map} +0 -0
- /package/dist/{chunk-IAGLVGHN.js.map → chunk-5N5XURKV.js.map} +0 -0
- /package/dist/{chunk-3KID7AIF.js.map → chunk-6TN2Z2AQ.js.map} +0 -0
- /package/dist/{chunk-GNCUZDQI.js.map → chunk-75AUSQL4.js.map} +0 -0
- /package/dist/{chunk-P7RBQUAG.js.map → chunk-BGV3IF3G.js.map} +0 -0
- /package/dist/{chunk-F5JDQXHJ.js.map → chunk-C6IAXFNC.js.map} +0 -0
- /package/dist/{chunk-2Z4QECP7.js.map → chunk-DCXCVEZP.js.map} +0 -0
- /package/dist/{chunk-G7NDNFIE.js.map → chunk-DDQXPARJ.js.map} +0 -0
- /package/dist/{chunk-UN7PYUJB.js.map → chunk-DEE2UTYV.js.map} +0 -0
- /package/dist/{chunk-6ERIC5NJ.js.map → chunk-HTM32H2E.js.map} +0 -0
- /package/dist/{chunk-VQE3OSUW.js.map → chunk-JLG5AUZB.js.map} +0 -0
- /package/dist/{chunk-MSBYVBPX.js.map → chunk-JOYOOEPJ.js.map} +0 -0
- /package/dist/{chunk-N56C2MWI.js.map → chunk-JYDXHV4L.js.map} +0 -0
- /package/dist/{chunk-CPS2HN4T.js.map → chunk-LDZEYJP3.js.map} +0 -0
- /package/dist/{chunk-ELWMGKVP.js.map → chunk-LOKT6EW7.js.map} +0 -0
- /package/dist/{chunk-LNPKBBPG.js.map → chunk-LYWNKEGM.js.map} +0 -0
- /package/dist/{chunk-2ANAH2UU.js.map → chunk-MG4JBADQ.js.map} +0 -0
- /package/dist/{chunk-TORS5V2C.js.map → chunk-NXSY4G4Y.js.map} +0 -0
- /package/dist/{chunk-EQLJYWLP.js.map → chunk-OFVUBY6Z.js.map} +0 -0
- /package/dist/{chunk-OLCDGMEO.js.map → chunk-OIT75IRK.js.map} +0 -0
- /package/dist/{chunk-RJHLNI37.js.map → chunk-OYBAKU7N.js.map} +0 -0
- /package/dist/{chunk-I3LGUSZ3.js.map → chunk-P4PLZZCR.js.map} +0 -0
- /package/dist/{chunk-MX3XD2ML.js.map → chunk-PIODB4SW.js.map} +0 -0
- /package/dist/{chunk-ETFCT2CH.js.map → chunk-RJDJMOX6.js.map} +0 -0
- /package/dist/{chunk-5LPPJIZ4.js.map → chunk-RZJQZ5P3.js.map} +0 -0
- /package/dist/{chunk-7IUVW67T.js.map → chunk-SCHD7NZD.js.map} +0 -0
- /package/dist/{chunk-UGJRDFMN.js.map → chunk-UXXNNT5D.js.map} +0 -0
- /package/dist/{chunk-TZK7VQAW.js.map → chunk-WKW5SEP7.js.map} +0 -0
- /package/dist/{chunk-RQNBJ7AS.js.map → chunk-Z4AWOPXA.js.map} +0 -0
- /package/dist/{chunk-CJLMB7MO.js.map → chunk-ZW7544DX.js.map} +0 -0
- /package/dist/{cli-circuit-breaker-JDGZ25MD.js.map → cli-circuit-breaker-4GJA2IXC.js.map} +0 -0
- /package/dist/{codebase-search-DKLEA4PR.js.map → codebase-search-LUF5YJLQ.js.map} +0 -0
- /package/dist/{composite-router-EZPPVCMD.js.map → composite-router-UBZO4YR7.js.map} +0 -0
- /package/dist/{consensus-vote-YKKJHLOD.js.map → consensus-vote-USZFJO2K.js.map} +0 -0
- /package/dist/{context-retriever-EGMARBAC.js.map → context-retriever-C5C7RFQE.js.map} +0 -0
- /package/dist/{doctor-deep-QTBDR3VV.js.map → doctor-deep-2N3F7EV6.js.map} +0 -0
- /package/dist/{expert-bridge-FZYJ3XAL.js.map → expert-bridge-B3EFTAID.js.map} +0 -0
- /package/dist/{factory-NDMPXPYE.js.map → factory-LKQKU3SD.js.map} +0 -0
- /package/dist/{factory-SABHBAHC.js.map → factory-SURRFPSV.js.map} +0 -0
- /package/dist/{improvement-review-WYFGNEVP.js.map → improvement-review-75OCZ5K7.js.map} +0 -0
- /package/dist/{init-opencode-CMGJ3TXZ.js.map → init-opencode-LDI5E5LW.js.map} +0 -0
- /package/dist/{issue-triage-NHRZGMKC.js.map → issue-triage-WWQEY7PL.js.map} +0 -0
- /package/dist/{pr-reviewer-helpers-HJRFRUZX.js.map → pr-reviewer-helpers-HDP24LGZ.js.map} +0 -0
- /package/dist/{registry-command-JCOZA7TM.js.map → registry-command-PZY7HWKO.js.map} +0 -0
- /package/dist/{repo-security-plan-OMY33VHA.js.map → repo-security-plan-IYKDY5PW.js.map} +0 -0
- /package/dist/{research-helpers-synthesize-DFINP3KN.js.map → research-helpers-synthesize-XSOFXRFK.js.map} +0 -0
- /package/dist/{routing-memory-KK4GPB64.js.map → routing-memory-JTNH2BXS.js.map} +0 -0
- /package/dist/{session-memory-QTHGU2XM.js.map → session-memory-RJZ447UX.js.map} +0 -0
- /package/dist/{setup-command-CURZCHSQ.js.map → setup-command-35MCRS33.js.map} +0 -0
- /package/dist/{setup-config-FX6SJXGQ.js.map → setup-config-JV23ZYPO.js.map} +0 -0
- /package/dist/{setup-custom-api-MYN4EVT2.js.map → setup-custom-api-LMA445OB.js.map} +0 -0
- /package/dist/{tool-memory-3W5NXR4P.js.map → tool-memory-K6EYH3FQ.js.map} +0 -0
- /package/dist/{unified-registry-PKPNJ3G7.js.map → unified-registry-MJA6IBDD.js.map} +0 -0
- /package/dist/{weather-report-46ZY3X2Z.js.map → weather-report-ID4ZNUAF.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAutoAdapter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SCHD7NZD.js";
|
|
4
4
|
import {
|
|
5
5
|
mapModelErrorToCategory
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-Z4AWOPXA.js";
|
|
7
7
|
import {
|
|
8
8
|
CLI_NAMES,
|
|
9
9
|
CircularBuffer,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
ok,
|
|
25
25
|
recordRateLimitEvent,
|
|
26
26
|
toRateLimitError
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-GVTXP6F6.js";
|
|
28
28
|
|
|
29
29
|
// src/agents/collaboration/event-bus-helpers.ts
|
|
30
30
|
import { randomUUID } from "crypto";
|
|
@@ -1041,4 +1041,4 @@ export {
|
|
|
1041
1041
|
getGlobalRegistry,
|
|
1042
1042
|
resetGlobalRegistry
|
|
1043
1043
|
};
|
|
1044
|
-
//# sourceMappingURL=chunk-
|
|
1044
|
+
//# sourceMappingURL=chunk-RJDJMOX6.js.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
getErrorMessage,
|
|
9
9
|
ok,
|
|
10
10
|
parseBoolEnv
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-GVTXP6F6.js";
|
|
12
12
|
|
|
13
13
|
// src/cli/research-helpers-io.ts
|
|
14
14
|
import * as fs2 from "fs/promises";
|
|
@@ -146,4 +146,4 @@ export {
|
|
|
146
146
|
loadPapersRegistry,
|
|
147
147
|
savePapersRegistry
|
|
148
148
|
};
|
|
149
|
-
//# sourceMappingURL=chunk-
|
|
149
|
+
//# sourceMappingURL=chunk-RZJQZ5P3.js.map
|
|
@@ -5,27 +5,27 @@ import {
|
|
|
5
5
|
planOptionalParams,
|
|
6
6
|
requireApiKey,
|
|
7
7
|
validateApiKeyPresence
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-JOYOOEPJ.js";
|
|
9
9
|
import {
|
|
10
10
|
CUSTOM_API_BASE_URL_ENV,
|
|
11
11
|
CUSTOM_API_DEFAULT_MODEL,
|
|
12
12
|
PROVIDER_ENV_KEYS,
|
|
13
13
|
assertCustomApiHostResolvesPublic,
|
|
14
14
|
validateCustomApiBaseUrl
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-JLG5AUZB.js";
|
|
16
16
|
import {
|
|
17
17
|
CliCircuitBreaker,
|
|
18
18
|
DEFAULT_CIRCUIT_BREAKER_CONFIG
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-Z4AWOPXA.js";
|
|
20
20
|
import {
|
|
21
21
|
getAvailabilityCache
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-UXXNNT5D.js";
|
|
23
23
|
import {
|
|
24
24
|
extractSystemPrompt
|
|
25
25
|
} from "./chunk-QZUG667L.js";
|
|
26
26
|
import {
|
|
27
27
|
generateHyphenId
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-DCXCVEZP.js";
|
|
29
29
|
import {
|
|
30
30
|
CLI_SUBPROCESS_TIMEOUTS,
|
|
31
31
|
CLI_TIMEOUTS,
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
loadModelsDevSnapshot,
|
|
62
62
|
ok,
|
|
63
63
|
resolveCliAlias
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-GVTXP6F6.js";
|
|
65
65
|
|
|
66
66
|
// src/cli-adapters/cli-to-model-adapter.ts
|
|
67
67
|
var CliToModelAdapter = class {
|
|
@@ -4817,4 +4817,4 @@ export {
|
|
|
4817
4817
|
SdkAdapter,
|
|
4818
4818
|
createAutoAdapter
|
|
4819
4819
|
};
|
|
4820
|
-
//# sourceMappingURL=chunk-
|
|
4820
|
+
//# sourceMappingURL=chunk-SCHD7NZD.js.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveToken
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5N5XURKV.js";
|
|
4
4
|
import {
|
|
5
5
|
REGISTRY_PATH,
|
|
6
6
|
getProjectRoot,
|
|
7
7
|
loadPapersRegistry,
|
|
8
8
|
loadTechniquesRegistry,
|
|
9
9
|
savePapersRegistry
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-RZJQZ5P3.js";
|
|
11
11
|
import {
|
|
12
12
|
resolveInsideRoot
|
|
13
13
|
} from "./chunk-NUBSJGQZ.js";
|
|
14
14
|
import {
|
|
15
15
|
getToolMemory
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-MG4JBADQ.js";
|
|
17
17
|
import {
|
|
18
18
|
capitalizeWords,
|
|
19
19
|
truncateSentence
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
getTimeProvider,
|
|
39
39
|
ok,
|
|
40
40
|
registerPersistentDistillerFactory
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-GVTXP6F6.js";
|
|
42
42
|
import {
|
|
43
43
|
ensureLearningDir,
|
|
44
44
|
getRulesFile
|
|
@@ -3337,11 +3337,195 @@ function buildIndex(files) {
|
|
|
3337
3337
|
};
|
|
3338
3338
|
}
|
|
3339
3339
|
|
|
3340
|
+
// src/context/repo-map-callsites.ts
|
|
3341
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
3342
|
+
import { resolve as resolve4 } from "path";
|
|
3343
|
+
|
|
3344
|
+
// src/indexer/usage-ast.ts
|
|
3345
|
+
import { extname } from "path";
|
|
3346
|
+
import { Lang, parse as parse2 } from "@ast-grep/napi";
|
|
3347
|
+
var LANG_VALUES = ["typescript", "tsx", "javascript"];
|
|
3348
|
+
var MAX_SNIPPET_CHARS = 200;
|
|
3349
|
+
var IDENTIFIER_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
3350
|
+
var CALL_USAGE_KINDS = /* @__PURE__ */ new Set(["call", "method-call", "new"]);
|
|
3351
|
+
var DECLARATION_PARENT_KINDS = /* @__PURE__ */ new Set([
|
|
3352
|
+
"function_declaration",
|
|
3353
|
+
"generator_function_declaration",
|
|
3354
|
+
"class_declaration",
|
|
3355
|
+
"interface_declaration",
|
|
3356
|
+
"type_alias_declaration",
|
|
3357
|
+
"enum_declaration",
|
|
3358
|
+
"function_signature",
|
|
3359
|
+
"method_definition",
|
|
3360
|
+
"abstract_method_signature"
|
|
3361
|
+
]);
|
|
3362
|
+
var IMPORT_PARENT_KINDS = /* @__PURE__ */ new Set([
|
|
3363
|
+
"import_specifier",
|
|
3364
|
+
"namespace_import",
|
|
3365
|
+
"import_clause"
|
|
3366
|
+
]);
|
|
3367
|
+
function langToNapi(lang) {
|
|
3368
|
+
if (lang === "tsx") return Lang.Tsx;
|
|
3369
|
+
if (lang === "javascript") return Lang.JavaScript;
|
|
3370
|
+
return Lang.TypeScript;
|
|
3371
|
+
}
|
|
3372
|
+
function inferLang(file) {
|
|
3373
|
+
const ext = extname(file).toLowerCase();
|
|
3374
|
+
if (ext === ".tsx" || ext === ".jsx") return "tsx";
|
|
3375
|
+
if (ext === ".js" || ext === ".mjs" || ext === ".cjs") return "javascript";
|
|
3376
|
+
return "typescript";
|
|
3377
|
+
}
|
|
3378
|
+
function escapeRegex(value) {
|
|
3379
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3380
|
+
}
|
|
3381
|
+
function isDeclaredName(declarator, node) {
|
|
3382
|
+
const name = declarator.field("name");
|
|
3383
|
+
return name !== null && name.id() === node.id();
|
|
3384
|
+
}
|
|
3385
|
+
function classifyIdentifier(node) {
|
|
3386
|
+
const parent = node.parent();
|
|
3387
|
+
if (parent === null) return "reference";
|
|
3388
|
+
const pk = String(parent.kind());
|
|
3389
|
+
if (DECLARATION_PARENT_KINDS.has(pk)) return null;
|
|
3390
|
+
if (pk === "variable_declarator") return isDeclaredName(parent, node) ? null : "reference";
|
|
3391
|
+
if (IMPORT_PARENT_KINDS.has(pk)) return "import";
|
|
3392
|
+
if (pk === "call_expression") return "call";
|
|
3393
|
+
if (pk === "new_expression") return "new";
|
|
3394
|
+
return "reference";
|
|
3395
|
+
}
|
|
3396
|
+
function classifyProperty(node) {
|
|
3397
|
+
const member = node.parent();
|
|
3398
|
+
const grandparent = member === null ? null : member.parent();
|
|
3399
|
+
if (grandparent !== null && String(grandparent.kind()) === "call_expression")
|
|
3400
|
+
return "method-call";
|
|
3401
|
+
return "reference";
|
|
3402
|
+
}
|
|
3403
|
+
function toMatch(node, kind, lines) {
|
|
3404
|
+
const { start } = node.range();
|
|
3405
|
+
const rawLine = lines[start.line] ?? node.text();
|
|
3406
|
+
return {
|
|
3407
|
+
line: start.line + 1,
|
|
3408
|
+
column: start.column + 1,
|
|
3409
|
+
kind,
|
|
3410
|
+
snippet: rawLine.trim().slice(0, MAX_SNIPPET_CHARS)
|
|
3411
|
+
};
|
|
3412
|
+
}
|
|
3413
|
+
function findUsagesInSource(symbol, src, lang) {
|
|
3414
|
+
if (!IDENTIFIER_RE.test(symbol)) return [];
|
|
3415
|
+
const root = parse2(langToNapi(lang), src).root();
|
|
3416
|
+
const lines = src.split("\n");
|
|
3417
|
+
const out = [];
|
|
3418
|
+
for (const node of root.findAll(symbol)) {
|
|
3419
|
+
const kind = classifyIdentifier(node);
|
|
3420
|
+
if (kind !== null) out.push(toMatch(node, kind, lines));
|
|
3421
|
+
}
|
|
3422
|
+
const propRule = {
|
|
3423
|
+
rule: { kind: "property_identifier", regex: `^${escapeRegex(symbol)}$` }
|
|
3424
|
+
};
|
|
3425
|
+
for (const node of root.findAll(propRule)) {
|
|
3426
|
+
out.push(toMatch(node, classifyProperty(node), lines));
|
|
3427
|
+
}
|
|
3428
|
+
return out.sort((a, b) => a.line - b.line || a.column - b.column);
|
|
3429
|
+
}
|
|
3430
|
+
function bump(counts, symbols, name) {
|
|
3431
|
+
if (symbols.has(name)) counts.set(name, (counts.get(name) ?? 0) + 1);
|
|
3432
|
+
}
|
|
3433
|
+
function tallyIdentifierCalls(root, symbols, counts) {
|
|
3434
|
+
for (const node of root.findAll({ rule: { kind: "identifier" } })) {
|
|
3435
|
+
const kind = classifyIdentifier(node);
|
|
3436
|
+
if (kind !== null && CALL_USAGE_KINDS.has(kind)) bump(counts, symbols, node.text());
|
|
3437
|
+
}
|
|
3438
|
+
}
|
|
3439
|
+
function tallyPropertyCalls(root, symbols, counts) {
|
|
3440
|
+
for (const node of root.findAll({ rule: { kind: "property_identifier" } })) {
|
|
3441
|
+
if (CALL_USAGE_KINDS.has(classifyProperty(node))) bump(counts, symbols, node.text());
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
function countCallSitesInSource(symbols, src, lang) {
|
|
3445
|
+
const counts = /* @__PURE__ */ new Map();
|
|
3446
|
+
if (symbols.size === 0) return counts;
|
|
3447
|
+
const root = parse2(langToNapi(lang), src).root();
|
|
3448
|
+
tallyIdentifierCalls(root, symbols, counts);
|
|
3449
|
+
tallyPropertyCalls(root, symbols, counts);
|
|
3450
|
+
return counts;
|
|
3451
|
+
}
|
|
3452
|
+
|
|
3453
|
+
// src/context/repo-map-callsites.ts
|
|
3454
|
+
var CALLSITE_TOP_N_MODULES = 25;
|
|
3455
|
+
var MAX_PROBE_SYMBOLS = 60;
|
|
3456
|
+
var MAX_CALLSITE_FILES = 4e3;
|
|
3457
|
+
function defaultSourceRoot() {
|
|
3458
|
+
return resolve4(process.cwd(), "src");
|
|
3459
|
+
}
|
|
3460
|
+
function addModuleExports(mod, name, owner) {
|
|
3461
|
+
for (const file of mod.files) {
|
|
3462
|
+
for (const exp of file.exports) {
|
|
3463
|
+
if (exp.isReExport) continue;
|
|
3464
|
+
if (!owner.has(exp.name)) owner.set(exp.name, name);
|
|
3465
|
+
if (owner.size >= MAX_PROBE_SYMBOLS) return;
|
|
3466
|
+
}
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3469
|
+
function buildProbeSet(index, topModuleNames) {
|
|
3470
|
+
const owner = /* @__PURE__ */ new Map();
|
|
3471
|
+
for (const name of topModuleNames) {
|
|
3472
|
+
const mod = index.modules[name];
|
|
3473
|
+
if (mod === void 0) continue;
|
|
3474
|
+
addModuleExports(mod, name, owner);
|
|
3475
|
+
if (owner.size >= MAX_PROBE_SYMBOLS) break;
|
|
3476
|
+
}
|
|
3477
|
+
return { symbols: new Set(owner.keys()), owner };
|
|
3478
|
+
}
|
|
3479
|
+
function collectFiles(index, sourceRoot, maxFiles) {
|
|
3480
|
+
const refs = [];
|
|
3481
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3482
|
+
for (const mod of Object.values(index.modules)) {
|
|
3483
|
+
for (const file of mod.files) {
|
|
3484
|
+
if (seen.has(file.path)) continue;
|
|
3485
|
+
seen.add(file.path);
|
|
3486
|
+
refs.push({ abs: resolve4(sourceRoot, file.path), rel: file.path });
|
|
3487
|
+
if (refs.length >= maxFiles) return refs;
|
|
3488
|
+
}
|
|
3489
|
+
}
|
|
3490
|
+
return refs;
|
|
3491
|
+
}
|
|
3492
|
+
function tallyFile(probe, ref, counts, log) {
|
|
3493
|
+
let src;
|
|
3494
|
+
try {
|
|
3495
|
+
src = readFileSync3(ref.abs, "utf8");
|
|
3496
|
+
} catch {
|
|
3497
|
+
log.debug("repo-map call-site: unreadable file", { file: ref.rel });
|
|
3498
|
+
return;
|
|
3499
|
+
}
|
|
3500
|
+
for (const [sym, n] of countCallSitesInSource(probe.symbols, src, inferLang(ref.rel))) {
|
|
3501
|
+
const owner = probe.owner.get(sym);
|
|
3502
|
+
if (owner !== void 0) counts.set(owner, (counts.get(owner) ?? 0) + n);
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
3505
|
+
function computeCallSiteCounts(index, topModuleNames, options = {}) {
|
|
3506
|
+
const log = options.logger ?? createLogger({ component: "RepoMapCallSites" });
|
|
3507
|
+
const counts = /* @__PURE__ */ new Map();
|
|
3508
|
+
try {
|
|
3509
|
+
const probe = buildProbeSet(index, topModuleNames);
|
|
3510
|
+
if (probe.symbols.size === 0) return counts;
|
|
3511
|
+
const sourceRoot = options.sourceRoot ?? defaultSourceRoot();
|
|
3512
|
+
const maxFiles = options.maxFiles ?? MAX_CALLSITE_FILES;
|
|
3513
|
+
for (const ref of collectFiles(index, sourceRoot, maxFiles)) {
|
|
3514
|
+
tallyFile(probe, ref, counts, log);
|
|
3515
|
+
}
|
|
3516
|
+
} catch (error) {
|
|
3517
|
+
log.debug("repo-map call-site counting failed", {
|
|
3518
|
+
error: error instanceof Error ? error.message : String(error)
|
|
3519
|
+
});
|
|
3520
|
+
}
|
|
3521
|
+
return counts;
|
|
3522
|
+
}
|
|
3523
|
+
|
|
3340
3524
|
// src/context/repo-map.ts
|
|
3341
3525
|
var REPO_MAP_FLAG = "NEXUS_REPO_MAP";
|
|
3342
3526
|
var DEFAULT_REPO_MAP_TOKEN_BUDGET = 400;
|
|
3343
|
-
var REPO_MAP_CAVEAT = "
|
|
3344
|
-
var REPO_MAP_HEADER = "## Repo Map (module import graph \u2014
|
|
3527
|
+
var REPO_MAP_CAVEAT = "Ranking blends import-graph PageRank with structural call-site frequency (ast-grep, sampled over the top import-ranked modules). Call-site matching is syntactic, not type-aware: dynamic dispatch, computed/string-keyed calls, and same-named members on unrelated objects are not resolved \u2014 treat centrality as an approximate structural+usage signal, not an exact call graph.";
|
|
3528
|
+
var REPO_MAP_HEADER = "## Repo Map (module import graph + call-site usage \u2014 ranked)";
|
|
3345
3529
|
var PAGERANK_DAMPING = 0.85;
|
|
3346
3530
|
var PAGERANK_MAX_ITERATIONS = 100;
|
|
3347
3531
|
var PAGERANK_EPSILON = 1e-6;
|
|
@@ -3396,24 +3580,43 @@ function l1Delta(a, b) {
|
|
|
3396
3580
|
for (const [k, v] of a) d += Math.abs(v - (b.get(k) ?? 0));
|
|
3397
3581
|
return d;
|
|
3398
3582
|
}
|
|
3399
|
-
|
|
3583
|
+
var CALL_SITE_WEIGHT = 2;
|
|
3584
|
+
function blendRankScore(centrality, callSites, maxCallSites) {
|
|
3585
|
+
if (maxCallSites <= 0) return centrality;
|
|
3586
|
+
return centrality * (1 + CALL_SITE_WEIGHT * (callSites / maxCallSites));
|
|
3587
|
+
}
|
|
3588
|
+
function maxCount(counts) {
|
|
3589
|
+
let max = 0;
|
|
3590
|
+
for (const v of counts.values()) if (v > max) max = v;
|
|
3591
|
+
return max;
|
|
3592
|
+
}
|
|
3593
|
+
function rankRepoMapEntries(index, callSiteCounts) {
|
|
3400
3594
|
const ranks = computeModulePageRank(index.modules);
|
|
3401
|
-
const
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3595
|
+
const counts = callSiteCounts ?? /* @__PURE__ */ new Map();
|
|
3596
|
+
const max = maxCount(counts);
|
|
3597
|
+
const scored = Object.entries(index.modules).map(([name, mod]) => {
|
|
3598
|
+
const centrality = ranks.get(name) ?? 0;
|
|
3599
|
+
const callSites = counts.get(name) ?? 0;
|
|
3600
|
+
const entry = {
|
|
3601
|
+
module: name,
|
|
3602
|
+
centrality,
|
|
3603
|
+
callSites,
|
|
3604
|
+
purpose: mod.purpose,
|
|
3605
|
+
dependsOn: mod.dependsOn,
|
|
3606
|
+
fileCount: mod.stats.fileCount
|
|
3607
|
+
};
|
|
3608
|
+
return { entry, score: blendRankScore(centrality, callSites, max) };
|
|
3609
|
+
});
|
|
3610
|
+
scored.sort(
|
|
3611
|
+
(a, b) => b.score !== a.score ? b.score - a.score : a.entry.module.localeCompare(b.entry.module)
|
|
3410
3612
|
);
|
|
3613
|
+
return scored.map((s) => s.entry);
|
|
3411
3614
|
}
|
|
3412
3615
|
var CHARS_PER_TOKEN3 = 4;
|
|
3413
3616
|
var MAX_DEPS_PER_LINE = 6;
|
|
3414
3617
|
var MAX_LINE_CHARS = 200;
|
|
3415
3618
|
function buildRepoMap(index, options = {}) {
|
|
3416
|
-
const entries = rankRepoMapEntries(index);
|
|
3619
|
+
const entries = rankRepoMapEntries(index, options.callSiteCounts);
|
|
3417
3620
|
if (entries.length === 0) return "";
|
|
3418
3621
|
const budget = options.budgetTokens ?? DEFAULT_REPO_MAP_TOKEN_BUDGET;
|
|
3419
3622
|
return renderRepoMap(entries, budget);
|
|
@@ -3434,7 +3637,8 @@ function formatEntryLine(e) {
|
|
|
3434
3637
|
const shownDeps = e.dependsOn.slice(0, MAX_DEPS_PER_LINE);
|
|
3435
3638
|
const more = e.dependsOn.length > MAX_DEPS_PER_LINE ? ", \u2026" : "";
|
|
3436
3639
|
const deps = shownDeps.length > 0 ? ` \u2192 ${shownDeps.join(", ")}${more}` : "";
|
|
3437
|
-
const
|
|
3640
|
+
const calls = e.callSites > 0 ? `, ${String(e.callSites)} call-sites` : "";
|
|
3641
|
+
const line = `- ${e.module} (centrality ${e.centrality.toFixed(3)}${calls}, ${String(e.fileCount)} files): ${oneLine2(e.purpose)}${deps}`;
|
|
3438
3642
|
return line.slice(0, MAX_LINE_CHARS);
|
|
3439
3643
|
}
|
|
3440
3644
|
function fitLinesWithinBudget(lines, budgetTokens) {
|
|
@@ -3472,8 +3676,10 @@ function getRepoMapForTask(options) {
|
|
|
3472
3676
|
const log = options.logger ?? createLogger({ component: "RepoMap" });
|
|
3473
3677
|
try {
|
|
3474
3678
|
const index = (options.indexProvider ?? buildLiveIndex)();
|
|
3679
|
+
const callSiteCounts = options.callSiteCounts ?? liveCallSiteCounts(index, log);
|
|
3475
3680
|
const map = buildRepoMap(index, {
|
|
3476
|
-
budgetTokens: options.budgetTokens ?? DEFAULT_REPO_MAP_TOKEN_BUDGET
|
|
3681
|
+
budgetTokens: options.budgetTokens ?? DEFAULT_REPO_MAP_TOKEN_BUDGET,
|
|
3682
|
+
callSiteCounts
|
|
3477
3683
|
});
|
|
3478
3684
|
return map === "" ? void 0 : map;
|
|
3479
3685
|
} catch (error) {
|
|
@@ -3483,6 +3689,10 @@ function getRepoMapForTask(options) {
|
|
|
3483
3689
|
return void 0;
|
|
3484
3690
|
}
|
|
3485
3691
|
}
|
|
3692
|
+
function liveCallSiteCounts(index, log) {
|
|
3693
|
+
const topModules = rankRepoMapEntries(index).slice(0, CALLSITE_TOP_N_MODULES).map((e) => e.module);
|
|
3694
|
+
return computeCallSiteCounts(index, topModules, { logger: log });
|
|
3695
|
+
}
|
|
3486
3696
|
function buildLiveIndex() {
|
|
3487
3697
|
const extraction = extractProject({ extractDescriptions: false });
|
|
3488
3698
|
return buildIndex(extraction.files);
|
|
@@ -3811,6 +4021,10 @@ export {
|
|
|
3811
4021
|
CodebaseIndexSchema,
|
|
3812
4022
|
extractProject,
|
|
3813
4023
|
buildIndex,
|
|
4024
|
+
LANG_VALUES,
|
|
4025
|
+
IDENTIFIER_RE,
|
|
4026
|
+
inferLang,
|
|
4027
|
+
findUsagesInSource,
|
|
3814
4028
|
getContextForTask,
|
|
3815
4029
|
selectRelevantResearch,
|
|
3816
4030
|
getResearchInsightsForTask,
|
|
@@ -3819,4 +4033,4 @@ export {
|
|
|
3819
4033
|
DEFAULT_CONTEXT_BUDGET_TOKENS,
|
|
3820
4034
|
getContextPromptPrefix
|
|
3821
4035
|
};
|
|
3822
|
-
//# sourceMappingURL=chunk-
|
|
4036
|
+
//# sourceMappingURL=chunk-URRNWRI4.js.map
|