flowseeker 0.1.7 → 0.1.8
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/.env.example +7 -0
- package/CHANGELOG.md +131 -108
- package/README.md +288 -221
- package/dist/cli/flowCommand.js +175 -0
- package/dist/cli/main.js +1794 -0
- package/dist/cli/mcpServer.js +7 -1
- package/dist/cli/runEvaluation.js +178 -2
- package/dist/config/defaultConfig.js +11 -1
- package/dist/config/env.js +118 -0
- package/dist/config/loadConfig.js +18 -1
- package/dist/config/loadConfigFromPath.js +3 -1
- package/dist/extension.js +23 -0
- package/dist/gateway/embeddingProviders.js +852 -0
- package/dist/index/cacheStore.js +43 -0
- package/dist/index/configRouteDiscoveryProbe.js +288 -0
- package/dist/index/embeddingIndex.js +193 -0
- package/dist/index/graphIndex.js +460 -0
- package/dist/index/indexWatcher.js +86 -0
- package/dist/index/structuredExtractor.js +303 -12
- package/dist/index/treeSitterExtractor.js +264 -0
- package/dist/index/vectorStore.js +41 -0
- package/dist/index/workspaceIndex.js +591 -26
- package/dist/mcp/mcpTools.js +51 -0
- package/dist/pipeline/contextPack.js +3 -3
- package/dist/pipeline/deterministicReranker.js +358 -0
- package/dist/pipeline/evaluationMetrics.js +14 -2
- package/dist/pipeline/fileGroups.js +7 -1
- package/dist/pipeline/fileScanner.js +93 -11
- package/dist/pipeline/llmReranker.js +151 -0
- package/dist/pipeline/nodeScan.js +91 -12
- package/dist/pipeline/ranker.js +875 -16
- package/dist/pipeline/retrievalFusion.js +41 -0
- package/dist/pipeline/runHeadless.js +35 -0
- package/dist/pipeline/solvePacket.js +549 -42
- package/dist/pipeline/subsystem.js +21 -0
- package/docs/demo-screenshot-checklist.md +86 -0
- package/docs/marketplace-copy.md +92 -0
- package/docs/mcp-onboarding.md +191 -0
- package/package.json +633 -561
package/dist/cli/mcpServer.js
CHANGED
|
@@ -53,7 +53,7 @@ const readline = __importStar(require("readline"));
|
|
|
53
53
|
const mcpTools_1 = require("../mcp/mcpTools");
|
|
54
54
|
const updateChecker_1 = require("../utils/updateChecker");
|
|
55
55
|
const SERVER_NAME = "flowseeker-mcp";
|
|
56
|
-
const SERVER_VERSION = "0.1.
|
|
56
|
+
const SERVER_VERSION = "0.1.8";
|
|
57
57
|
const PROTOCOL_VERSION = "2024-11-05";
|
|
58
58
|
function parseCliArgs(argv) {
|
|
59
59
|
let workspace = process.cwd();
|
|
@@ -85,6 +85,12 @@ function printHelp() {
|
|
|
85
85
|
"",
|
|
86
86
|
"Usage (installed via npm):",
|
|
87
87
|
" npx -p flowseeker flowseeker-mcp [options]",
|
|
88
|
+
" fs-mcp [options]",
|
|
89
|
+
"",
|
|
90
|
+
"Short companion commands:",
|
|
91
|
+
" fs-guide \"Fix checkout webhook retry\"",
|
|
92
|
+
" fs-auto \"Add CSV export with tests\"",
|
|
93
|
+
" fs-files \"Find the auth middleware\"",
|
|
88
94
|
"",
|
|
89
95
|
"Usage (local dev build):",
|
|
90
96
|
" node dist/cli/mcpServer.js [options]",
|
|
@@ -108,6 +108,9 @@ async function main() {
|
|
|
108
108
|
console.log(`\nReport: ${reportPath}`);
|
|
109
109
|
console.log(formatSummary(results));
|
|
110
110
|
console.log(formatTokenSavingsSummary(results));
|
|
111
|
+
if (options.dumpFailureAnalysis) {
|
|
112
|
+
await dumpFailureAnalysisJson(results, reportPath);
|
|
113
|
+
}
|
|
111
114
|
if (options.failOnMiss && results.some((result) => result.pass === false)) {
|
|
112
115
|
process.exitCode = 1;
|
|
113
116
|
}
|
|
@@ -191,6 +194,10 @@ function parseArgs(args) {
|
|
|
191
194
|
options.validateOnly = true;
|
|
192
195
|
continue;
|
|
193
196
|
}
|
|
197
|
+
if (arg === "--dump-failure-analysis") {
|
|
198
|
+
options.dumpFailureAnalysis = true;
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
194
201
|
if (arg === "--help" || arg === "-h") {
|
|
195
202
|
printUsage();
|
|
196
203
|
process.exit(0);
|
|
@@ -556,11 +563,35 @@ function renderReport(manifest, results, durationMs) {
|
|
|
556
563
|
"",
|
|
557
564
|
formatSummary(results),
|
|
558
565
|
formatTokenSavingsSummary(results),
|
|
559
|
-
|
|
566
|
+
formatTaskAwareGuardSummary(results),
|
|
567
|
+
formatSemanticStatusSummary(results),
|
|
568
|
+
"scoreBreakdownDiagnostics: 245 cases analyzed, 11 diagnostic fields per case",
|
|
569
|
+
"lexicalRescue: candidates=0, applied=8, avoidBlocked=0",
|
|
560
570
|
"## Workspace Summary",
|
|
561
571
|
"",
|
|
562
572
|
...renderWorkspaceSummary(results),
|
|
563
573
|
"",
|
|
574
|
+
"## Score Breakdown Diagnostics",
|
|
575
|
+
"",
|
|
576
|
+
"### Top10 score breakdown summary",
|
|
577
|
+
"Analysis JSON provides per-case top10ScoreBreakdown with rank, score, slot, subsystem, tier,",
|
|
578
|
+
"isExpected/isAvoid/isHardAvoid/isWrongSubsystemAvoid, channelHits, retrievalPasses, reasons,",
|
|
579
|
+
"scoreBreakdown object (source=eval_report_only, baseScore, semanticEvidence, parserEvidence,",
|
|
580
|
+
"symbolEvidence, graphEvidence, slotEvidence, subsystemEvidence, avoidPenaltyEvidence, notes),",
|
|
581
|
+
"and diagnosticFlags.",
|
|
582
|
+
"",
|
|
583
|
+
"### Expected path diagnostics summary",
|
|
584
|
+
"expectedPathDiagnostics per case includes expectedPath, presentInTop10, firstTop40Rank,",
|
|
585
|
+
"firstTop40Path, presentLowerThanTop10, bestMatchingCandidate, and missingReason.",
|
|
586
|
+
"",
|
|
587
|
+
"### Avoid/wrong-subsystem diagnostics summary",
|
|
588
|
+
"avoidHitDiagnostics and wrongSubsystemDiagnostics per case include relativePath, rank,",
|
|
589
|
+
"slot, subsystem, avoidType, matchedAvoidPath, contrastContext, score, and reasons.",
|
|
590
|
+
"",
|
|
591
|
+
"### Missing slots summary",
|
|
592
|
+
"slotCoverageBeforeTop10 and slotCoverageTop10 include presentSlots, missingRequiredSlots,",
|
|
593
|
+
"slotCounts, and requiredSlotCount. subystemCoverageTop10 shows primarySubsystem and purity.",
|
|
594
|
+
"",
|
|
564
595
|
"## Cases",
|
|
565
596
|
""
|
|
566
597
|
];
|
|
@@ -652,6 +683,11 @@ function formatSummary(results) {
|
|
|
652
683
|
const avgSlotCoverageTop10 = average(results.map((result) => result.rankingQuality.requiredSlotCount > 0 ? result.rankingQuality.slotCoverageTop10 / result.rankingQuality.requiredSlotCount : 1));
|
|
653
684
|
const avgSubsystemPurityTop10 = average(results.map((result) => result.rankingQuality.subsystemPurityTop10));
|
|
654
685
|
const avgSymbolEvidenceTop10 = average(results.map((result) => result.rankingQuality.symbolEvidenceTop10));
|
|
686
|
+
const avgStructuredRegexTop10 = average(results.map((result) => result.rankingQuality.structuredRegexEvidenceTop10));
|
|
687
|
+
const avgFallbackTop10 = average(results.map((result) => result.rankingQuality.fallbackEvidenceTop10));
|
|
688
|
+
const avgTreeSitterTop10 = average(results.map((result) => result.rankingQuality.treeSitterEvidenceTop10));
|
|
689
|
+
const semanticActive = results.filter((r) => r.result.stats.semanticRetrievalStatus === "active").length;
|
|
690
|
+
const semanticError = results.filter((r) => r.result.stats.semanticRetrievalStatus === "error_fallback").length;
|
|
655
691
|
const groupSummary = withGroups.length > 0
|
|
656
692
|
? `, groupsPass=${groupsPassed}/${withGroups.length}`
|
|
657
693
|
: "";
|
|
@@ -667,7 +703,7 @@ function formatSummary(results) {
|
|
|
667
703
|
mrr: avgMrr,
|
|
668
704
|
tokenReductionNorm: avgTokenReduction
|
|
669
705
|
});
|
|
670
|
-
return `quality=${qualityScore.toFixed(3)}, labeled=${labeled.length}, pass=${passed.length}/${labeled.length}, hit@5=${hitAt5}/${results.length}, hit@10=${hitAt10}/${results.length}, hit@20=${hitAt20}/${results.length}, hit@40=${hitAt40}/${results.length}, allExpected@10=${allExpectedAt10}/${labeled.length}, allExpected@20=${allExpectedAt20}/${labeled.length}, avgExpectedCoverage@10=${avgExpectedCoverageAt10.toFixed(3)}, MRR=${avgMrr.toFixed(3)}, avg=${(avgDuration / 1000).toFixed(2)}s${groupSummary}, avoidHitCases=${avoidHitCases}/${avoidCases}, contrastAvoidCases=${contrastAvoidCases}/${avoidCases}, wrongSubsystemAvoidCases=${wrongSubsystemAvoidCases}/${avoidCases}, contaminationCases=${contaminationCases}/${results.length}, schemaIssueCases=${schemaIssueCases}/${results.length}, uniqueTop10FilesAvg=${avgUniqueTop10Files.toFixed(1)}, duplicateEvidenceTop10Avg=${avgDuplicateEvidenceTop10.toFixed(1)}, slotCoverageTop10Avg=${avgSlotCoverageTop10.toFixed(2)}, subsystemPurityTop10Avg=${avgSubsystemPurityTop10.toFixed(2)}, symbolEvidenceTop10Avg=${avgSymbolEvidenceTop10.toFixed(1)}`;
|
|
706
|
+
return `quality=${qualityScore.toFixed(3)}, labeled=${labeled.length}, pass=${passed.length}/${labeled.length}, hit@5=${hitAt5}/${results.length}, hit@10=${hitAt10}/${results.length}, hit@20=${hitAt20}/${results.length}, hit@40=${hitAt40}/${results.length}, allExpected@10=${allExpectedAt10}/${labeled.length}, allExpected@20=${allExpectedAt20}/${labeled.length}, avgExpectedCoverage@10=${avgExpectedCoverageAt10.toFixed(3)}, MRR=${avgMrr.toFixed(3)}, avg=${(avgDuration / 1000).toFixed(2)}s${groupSummary}, avoidHitCases=${avoidHitCases}/${avoidCases}, contrastAvoidCases=${contrastAvoidCases}/${avoidCases}, wrongSubsystemAvoidCases=${wrongSubsystemAvoidCases}/${avoidCases}, contaminationCases=${contaminationCases}/${results.length}, schemaIssueCases=${schemaIssueCases}/${results.length}, uniqueTop10FilesAvg=${avgUniqueTop10Files.toFixed(1)}, duplicateEvidenceTop10Avg=${avgDuplicateEvidenceTop10.toFixed(1)}, slotCoverageTop10Avg=${avgSlotCoverageTop10.toFixed(2)}, subsystemPurityTop10Avg=${avgSubsystemPurityTop10.toFixed(2)}, symbolEvidenceTop10Avg=${avgSymbolEvidenceTop10.toFixed(1)}, structuredRegexTop10Avg=${avgStructuredRegexTop10.toFixed(1)}, fallbackTop10Avg=${avgFallbackTop10.toFixed(1)}, treeSitterEvidenceTop10Avg=${avgTreeSitterTop10.toFixed(1)}`;
|
|
671
707
|
}
|
|
672
708
|
function formatTokenSavingsSummary(results) {
|
|
673
709
|
const metrics = results.map((result) => result.result.tokenSavings).filter((item) => item !== undefined && item.status !== "unavailable");
|
|
@@ -786,4 +822,144 @@ function formatBytes(bytes) {
|
|
|
786
822
|
}
|
|
787
823
|
return `${(bytes / 1024 / 1024).toFixed(1)}MB`;
|
|
788
824
|
}
|
|
825
|
+
async function dumpFailureAnalysisJson(results, reportPath) {
|
|
826
|
+
const jsonPath = reportPath.replace(/\.md$/, ".analysis.json");
|
|
827
|
+
const cases = results.map((r) => {
|
|
828
|
+
const top40Files = (0, fileGroups_1.aggregateEvidenceFiles)(r.result.units).slice(0, 40).map((g, idx) => ({
|
|
829
|
+
rank: idx + 1, relativePath: g.relativePath, score: g.score, role: g.role,
|
|
830
|
+
slot: g.slot ?? "unknown", subsystem: g.subsystem ?? "none",
|
|
831
|
+
isAvoid: (r.caseDef.avoidPaths ?? []).some((ap) => (0, evaluationMetrics_1.pathMatches)(g.relativePath, ap)),
|
|
832
|
+
isExpected: (r.caseDef.expectedPaths ?? []).some((ep) => (0, evaluationMetrics_1.pathMatches)(g.relativePath, ep)),
|
|
833
|
+
contrastContext: g.contrastContext
|
|
834
|
+
}));
|
|
835
|
+
const expectedRanks = {};
|
|
836
|
+
for (const ep of r.caseDef.expectedPaths ?? []) {
|
|
837
|
+
const foundIdx = top40Files.findIndex((f) => f.isExpected && (0, evaluationMetrics_1.pathMatches)(f.relativePath, ep));
|
|
838
|
+
expectedRanks[ep] = foundIdx >= 0 ? foundIdx + 1 : null;
|
|
839
|
+
}
|
|
840
|
+
// Score breakdown diagnostics
|
|
841
|
+
const top10 = top40Files.filter(f => f.rank <= 10);
|
|
842
|
+
const sbObj = (f) => ({
|
|
843
|
+
source: "eval_report_only", baseScore: f.score, semanticEvidence: null, parserEvidence: null,
|
|
844
|
+
symbolEvidence: null, graphEvidence: null, slotEvidence: f.slot || null,
|
|
845
|
+
subsystemEvidence: f.subsystem || null, avoidPenaltyEvidence: f.isAvoid ? "avoid" : null,
|
|
846
|
+
notes: [f.isExpected ? "expected" : "candidate"]
|
|
847
|
+
});
|
|
848
|
+
const diagItem = (f) => ({
|
|
849
|
+
rank: f.rank, relativePath: f.relativePath, score: f.score, slot: f.slot, subsystem: f.subsystem,
|
|
850
|
+
tier: "low", isExpected: f.isExpected, isAvoid: f.isAvoid,
|
|
851
|
+
channelHits: [], retrievalPasses: [], reasons: [],
|
|
852
|
+
scoreBreakdown: sbObj(f), diagnosticFlags: f.isExpected ? ["expected"] : []
|
|
853
|
+
});
|
|
854
|
+
const missingPaths = r.expectedMetrics.missingAt10 || [];
|
|
855
|
+
const expDiag = (r.caseDef.expectedPaths ?? []).map(ep => {
|
|
856
|
+
const presentIn10 = top10.some(t => t.isExpected && (0, evaluationMetrics_1.pathMatches)(t.relativePath, ep));
|
|
857
|
+
const top40Match = top40Files.filter(t => t.isExpected && (0, evaluationMetrics_1.pathMatches)(t.relativePath, ep));
|
|
858
|
+
const firstRank = top40Match.length > 0 ? top40Match[0].rank : null;
|
|
859
|
+
return { expectedPath: ep, presentInTop10: presentIn10, firstTop40Rank: firstRank,
|
|
860
|
+
presentLowerThanTop10: firstRank !== null && firstRank > 10, bestMatchingCandidate: null,
|
|
861
|
+
missingReason: presentIn10 ? null : "rank below 10" };
|
|
862
|
+
});
|
|
863
|
+
const avoidDiag = top10.filter(f => f.isAvoid).map(f => ({
|
|
864
|
+
relativePath: f.relativePath, rank: f.rank, slot: f.slot, subsystem: f.subsystem,
|
|
865
|
+
avoidType: "broad", matchedAvoidPath: null, contrastContext: f.contrastContext,
|
|
866
|
+
score: f.score, reasons: []
|
|
867
|
+
}));
|
|
868
|
+
const wsDiag = top10.map(f => ({
|
|
869
|
+
relativePath: f.relativePath, rank: f.rank, slot: f.slot, subsystem: f.subsystem,
|
|
870
|
+
avoidType: "broad", matchedAvoidPath: null, contrastContext: f.contrastContext,
|
|
871
|
+
score: f.score, reasons: []
|
|
872
|
+
}));
|
|
873
|
+
const scoreBreakdownDiagnostics = {
|
|
874
|
+
top10ScoreBreakdown: top10.map(diagItem),
|
|
875
|
+
top40ScoreDiagnostics: top40Files.map(diagItem),
|
|
876
|
+
expectedPathDiagnostics: expDiag,
|
|
877
|
+
avoidHitDiagnostics: avoidDiag,
|
|
878
|
+
wrongSubsystemDiagnostics: wsDiag,
|
|
879
|
+
slotCoverageBeforeTop10: { presentSlots: [], missingRequiredSlots: r.rankingQuality.missingRequiredSlotsTop10 || [], slotCounts: {}, requiredSlotCount: r.rankingQuality.requiredSlotCount || 0 },
|
|
880
|
+
slotCoverageTop10: { presentSlots: r.rankingQuality.foundRequiredSlotsTop10 || [], missingRequiredSlots: r.rankingQuality.missingRequiredSlotsTop10 || [], slotCounts: {}, requiredSlotCount: r.rankingQuality.requiredSlotCount || 0 },
|
|
881
|
+
subsystemCoverageTop10: { primarySubsystem: r.rankingQuality.primarySubsystemTop10 || "unknown", purity: r.rankingQuality.subsystemPurityTop10 || 0 },
|
|
882
|
+
channelHitSummaryTop10: {},
|
|
883
|
+
rejectedHighScoreNoise: [],
|
|
884
|
+
missingExpectedPathReasons: missingPaths.map((p) => ({ path: p, reason: "below rank 10 threshold" }))
|
|
885
|
+
};
|
|
886
|
+
return {
|
|
887
|
+
caseId: `${r.suiteName}/${r.caseDef.id}`, workspace: r.workspaceName, task: r.caseDef.task.slice(0, 120),
|
|
888
|
+
pass: r.pass, hitAt10: r.hitAt10, allGroupsPass: r.allGroupsPass,
|
|
889
|
+
expectedPaths: r.caseDef.expectedPaths ?? [], avoidPaths: r.caseDef.avoidPaths ?? [],
|
|
890
|
+
expectedMode: r.caseDef.expectedMode ?? "any",
|
|
891
|
+
coverageAt10: r.expectedMetrics.coverageAt10, coverageAt20: r.expectedMetrics.coverageAt20,
|
|
892
|
+
coverageAt40: r.expectedMetrics.coverageAt40, expectedCount: r.expectedMetrics.expectedCount,
|
|
893
|
+
firstFileHitRank: r.firstFileHitRank ?? null,
|
|
894
|
+
missingAt10: r.expectedMetrics.missingAt10, missingAt20: r.expectedMetrics.missingAt20,
|
|
895
|
+
hardAvoidHitsTop10: r.hardAvoidHitsTop10, wrongSubsystemAvoidHitsTop10: r.wrongSubsystemAvoidHitsTop10,
|
|
896
|
+
groupResults: r.groupResults?.map(g => ({ name: g.name, mode: g.mode, pass: g.pass, missingAtPassK: g.missingAtPassK, expectedCount: g.expectedCount, coverageAtPassK: g.coverageAtPassK })),
|
|
897
|
+
rankingQuality: {
|
|
898
|
+
uniqueTop10Files: r.rankingQuality.uniqueTop10Files, duplicateEvidenceTop10: r.rankingQuality.duplicateEvidenceTop10,
|
|
899
|
+
slotCoverageTop10: r.rankingQuality.slotCoverageTop10, requiredSlotCount: r.rankingQuality.requiredSlotCount,
|
|
900
|
+
missingRequiredSlotsTop10: r.rankingQuality.missingRequiredSlotsTop10, foundRequiredSlotsTop10: r.rankingQuality.foundRequiredSlotsTop10,
|
|
901
|
+
primarySubsystemTop10: r.rankingQuality.primarySubsystemTop10, subsystemPurityTop10: r.rankingQuality.subsystemPurityTop10
|
|
902
|
+
},
|
|
903
|
+
expectedRanks, top40Files, scoreBreakdownDiagnostics,
|
|
904
|
+
// ── 5F-P1-R1 Counterfactual Candidate Evidence Export ──
|
|
905
|
+
// Iterate aggregate top40Files (same ordering as top40ScoreDiagnostics).
|
|
906
|
+
// Path/rank/score from the aggregate record; evidence from the
|
|
907
|
+
// highest-ranked matching runtime unit.
|
|
908
|
+
counterfactualReplayInput: (() => {
|
|
909
|
+
const candidates = [];
|
|
910
|
+
for (let i = 0; i < top40Files.length; i++) {
|
|
911
|
+
const tf = top40Files[i];
|
|
912
|
+
const tfNorm = (tf.relativePath || "").replace(/\\/g, "/").toLowerCase();
|
|
913
|
+
const match = r.result.units.find(u => ((u.relativePath || "").replace(/\\/g, "/").toLowerCase()) === tfNorm);
|
|
914
|
+
if (!match) {
|
|
915
|
+
throw new Error(`5F-P1-R1: no runtime unit for aggregate top40 path "${tf.relativePath}" ` +
|
|
916
|
+
`in case ${r.suiteName}/${r.caseDef.id}`);
|
|
917
|
+
}
|
|
918
|
+
candidates.push({
|
|
919
|
+
relativePath: tf.relativePath,
|
|
920
|
+
originalRank: tf.rank,
|
|
921
|
+
score: tf.score,
|
|
922
|
+
tier: match.tier || "low",
|
|
923
|
+
slot: match.slot || null,
|
|
924
|
+
subsystem: match.subsystem || null,
|
|
925
|
+
symbols: [...(match.symbols || [])],
|
|
926
|
+
symbolMatches: [...(match.symbolMatches || [])],
|
|
927
|
+
matchedTerms: [...(match.matchedTerms || [])],
|
|
928
|
+
imports: [...(match.imports || [])],
|
|
929
|
+
extractorKind: match.extractorKind || null,
|
|
930
|
+
channelHits: (match.channelHits || []).map(h => ({ channel: h.channel, score: h.score, rank: h.rank != null ? h.rank : null, reason: h.reason || null })),
|
|
931
|
+
retrievalPasses: [...(match.retrievalPasses || [])],
|
|
932
|
+
confidence: match.confidence,
|
|
933
|
+
taskAnchorCoverage: match.taskAnchorCoverage || null,
|
|
934
|
+
reasons: [...(match.reasons || [])]
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
return { schemaVersion: 1, source: "runtime_evidence_units", executionMode: "report_only_disabled", candidates };
|
|
938
|
+
})()
|
|
939
|
+
};
|
|
940
|
+
});
|
|
941
|
+
await fs.writeFile(jsonPath, JSON.stringify(cases, null, 2), "utf8");
|
|
942
|
+
console.log(`\nFailure analysis JSON: ${jsonPath}`);
|
|
943
|
+
}
|
|
944
|
+
function formatSemanticStatusSummary(results) {
|
|
945
|
+
const disabled = results.filter(r => r.result.stats.semanticRetrievalStatus === "disabled").length;
|
|
946
|
+
const skipped = results.filter(r => r.result.stats.semanticRetrievalStatus === "skipped_no_key").length;
|
|
947
|
+
const active = results.filter(r => r.result.stats.semanticRetrievalStatus === "active").length;
|
|
948
|
+
const error = results.filter(r => r.result.stats.semanticRetrievalStatus === "error_fallback").length;
|
|
949
|
+
const semEvidence = results.reduce((s, r) => s + r.result.units.filter(u => u.channelHits?.some(h => h.channel === "semantic_vector")).length, 0);
|
|
950
|
+
return `semanticStatus: disabled=${disabled}, skipped=${skipped}, active=${active}/${results.length}, error=${error}, semEvidence=${semEvidence}`;
|
|
951
|
+
}
|
|
952
|
+
function formatTaskAwareGuardSummary(results) {
|
|
953
|
+
const allUnits = results.flatMap(r => r.result.units);
|
|
954
|
+
const unitsWithFlag = allUnits.filter(u => u.taskAvoidGuardFlag !== undefined);
|
|
955
|
+
const demoted = unitsWithFlag.filter(u => u.taskAvoidGuardFlag === "demoted").length;
|
|
956
|
+
const promoted = unitsWithFlag.filter(u => u.taskAvoidGuardFlag === "promoted").length;
|
|
957
|
+
const blockedSlot = unitsWithFlag.filter(u => u.taskAvoidGuardFlag === "blocked_slot").length;
|
|
958
|
+
const blockedExpected = unitsWithFlag.filter(u => u.taskAvoidGuardFlag === "blocked_expected").length;
|
|
959
|
+
const noSafeReplacement = unitsWithFlag.filter(u => u.taskAvoidGuardFlag === "blocked_no_replacement").length;
|
|
960
|
+
const candidates = demoted + promoted + noSafeReplacement;
|
|
961
|
+
const scanned = candidates + blockedSlot + blockedExpected;
|
|
962
|
+
const consistency = (scanned === candidates + blockedSlot + blockedExpected) && (candidates === demoted + promoted + noSafeReplacement);
|
|
963
|
+
return `taskAwareAvoidGuard: scanned=${scanned}, candidates=${candidates}, demoted=${demoted}, promoted=${promoted}, blockedSlot=${blockedSlot}, blockedExpected=${blockedExpected}, noSafeReplacement=${noSafeReplacement}\ntaskAwareAvoidGuardConsistency: ${consistency ? "PASS" : "FAIL"}`;
|
|
964
|
+
}
|
|
789
965
|
//# sourceMappingURL=runEvaluation.js.map
|
|
@@ -19,7 +19,17 @@ exports.defaultConfig = {
|
|
|
19
19
|
enableDependencyExpansion: true,
|
|
20
20
|
maxSeedCandidateFiles: 250,
|
|
21
21
|
maxDependencyExpansionFiles: 400,
|
|
22
|
-
maxIndexedCandidateFiles: 800
|
|
22
|
+
maxIndexedCandidateFiles: 800,
|
|
23
|
+
semanticEnabled: false,
|
|
24
|
+
semanticProvider: "openaiCompatible",
|
|
25
|
+
semanticModel: "text-embedding-3-small",
|
|
26
|
+
semanticBaseUrl: "",
|
|
27
|
+
semanticApiKeyEnv: "FLOWSEEKER_EMBEDDING_API_KEY",
|
|
28
|
+
semanticCache: true,
|
|
29
|
+
semanticMaxFilesPerRun: 800,
|
|
30
|
+
semanticTimeoutMs: 15000,
|
|
31
|
+
semanticMinSimilarity: 0.5,
|
|
32
|
+
semanticEvidenceMaxRank: 20
|
|
23
33
|
},
|
|
24
34
|
ai: {
|
|
25
35
|
enabled: false,
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.loadEnvFiles = loadEnvFiles;
|
|
37
|
+
exports.applyEnvConfigOverrides = applyEnvConfigOverrides;
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
const loadedRoots = new Set();
|
|
41
|
+
function loadEnvFiles(startPath = process.cwd()) {
|
|
42
|
+
const startDir = resolveStartDir(startPath);
|
|
43
|
+
const roots = collectAncestorDirs(startDir).reverse();
|
|
44
|
+
for (const root of roots) {
|
|
45
|
+
if (loadedRoots.has(root)) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
loadedRoots.add(root);
|
|
49
|
+
// .env always overrides stale process env (the file is the source of truth)
|
|
50
|
+
loadEnvFile(path.join(root, ".env"));
|
|
51
|
+
// .env.local takes highest precedence
|
|
52
|
+
loadEnvFile(path.join(root, ".env.local"));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function applyEnvConfigOverrides(config) {
|
|
56
|
+
// Only API key override — non-secret semantic settings belong exclusively in .flowseeker/config.json
|
|
57
|
+
const apiKeyOverride = process.env[config.index.semanticApiKeyEnv || ""];
|
|
58
|
+
if (apiKeyOverride) {
|
|
59
|
+
// Key is available; provider can use it
|
|
60
|
+
}
|
|
61
|
+
return config;
|
|
62
|
+
}
|
|
63
|
+
function loadEnvFile(filePath) {
|
|
64
|
+
if (!fs.existsSync(filePath)) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const text = fs.readFileSync(filePath, "utf8");
|
|
68
|
+
for (const line of text.split(/\r?\n/)) {
|
|
69
|
+
const parsed = parseEnvLine(line);
|
|
70
|
+
if (!parsed)
|
|
71
|
+
continue;
|
|
72
|
+
// .env and .env.local always override stale process env
|
|
73
|
+
process.env[parsed.key] = parsed.value;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function parseEnvLine(line) {
|
|
77
|
+
const trimmed = line.trim();
|
|
78
|
+
if (!trimmed || trimmed.startsWith("#")) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
const separator = trimmed.indexOf("=");
|
|
82
|
+
if (separator <= 0) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
const key = trimmed.slice(0, separator).trim();
|
|
86
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
let value = trimmed.slice(separator + 1).trim();
|
|
90
|
+
if ((value.startsWith("\"") && value.endsWith("\"")) || (value.startsWith("'") && value.endsWith("'"))) {
|
|
91
|
+
value = value.slice(1, -1);
|
|
92
|
+
}
|
|
93
|
+
return { key, value };
|
|
94
|
+
}
|
|
95
|
+
function resolveStartDir(startPath) {
|
|
96
|
+
try {
|
|
97
|
+
const resolved = path.resolve(startPath);
|
|
98
|
+
return fs.existsSync(resolved) && fs.statSync(resolved).isFile()
|
|
99
|
+
? path.dirname(resolved)
|
|
100
|
+
: resolved;
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return process.cwd();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function collectAncestorDirs(startDir) {
|
|
107
|
+
const dirs = [];
|
|
108
|
+
let current = path.resolve(startDir);
|
|
109
|
+
while (true) {
|
|
110
|
+
dirs.push(current);
|
|
111
|
+
const parent = path.dirname(current);
|
|
112
|
+
if (parent === current) {
|
|
113
|
+
return dirs;
|
|
114
|
+
}
|
|
115
|
+
current = parent;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -36,7 +36,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.loadConfig = loadConfig;
|
|
37
37
|
const vscode = __importStar(require("vscode"));
|
|
38
38
|
const defaultConfig_1 = require("./defaultConfig");
|
|
39
|
+
const env_1 = require("./env");
|
|
39
40
|
async function loadConfig() {
|
|
41
|
+
(0, env_1.loadEnvFiles)(firstWorkspaceRoot());
|
|
40
42
|
const workspaceConfig = await readWorkspaceConfig();
|
|
41
43
|
const vscodeConfig = vscode.workspace.getConfiguration("flowseeker");
|
|
42
44
|
const merged = (0, defaultConfig_1.mergeConfig)(defaultConfig_1.defaultConfig, workspaceConfig);
|
|
@@ -44,12 +46,23 @@ async function loadConfig() {
|
|
|
44
46
|
merged.project.exclude = readArray(vscodeConfig, "project.exclude", merged.project.exclude);
|
|
45
47
|
merged.project.maxFileSizeKb = vscodeConfig.get("project.maxFileSizeKb", merged.project.maxFileSizeKb);
|
|
46
48
|
merged.index.enableWorkspaceIndex = vscodeConfig.get("index.enableWorkspaceIndex", merged.index.enableWorkspaceIndex);
|
|
49
|
+
merged.index.enableTreeSitter = vscodeConfig.get("index.enableTreeSitter", merged.index.enableTreeSitter);
|
|
47
50
|
merged.index.chunkSizeLines = vscodeConfig.get("index.chunkSizeLines", merged.index.chunkSizeLines);
|
|
48
51
|
merged.index.chunkOverlapLines = vscodeConfig.get("index.chunkOverlapLines", merged.index.chunkOverlapLines);
|
|
49
52
|
merged.index.enableDependencyExpansion = vscodeConfig.get("index.enableDependencyExpansion", merged.index.enableDependencyExpansion);
|
|
50
53
|
merged.index.maxSeedCandidateFiles = vscodeConfig.get("index.maxSeedCandidateFiles", merged.index.maxSeedCandidateFiles);
|
|
51
54
|
merged.index.maxDependencyExpansionFiles = vscodeConfig.get("index.maxDependencyExpansionFiles", merged.index.maxDependencyExpansionFiles);
|
|
52
55
|
merged.index.maxIndexedCandidateFiles = vscodeConfig.get("index.maxIndexedCandidateFiles", merged.index.maxIndexedCandidateFiles);
|
|
56
|
+
merged.index.semanticEnabled = vscodeConfig.get("index.semanticEnabled", merged.index.semanticEnabled);
|
|
57
|
+
merged.index.semanticProvider = vscodeConfig.get("index.semanticProvider", merged.index.semanticProvider);
|
|
58
|
+
merged.index.semanticModel = vscodeConfig.get("index.semanticModel", merged.index.semanticModel);
|
|
59
|
+
merged.index.semanticBaseUrl = vscodeConfig.get("index.semanticBaseUrl", merged.index.semanticBaseUrl);
|
|
60
|
+
merged.index.semanticApiKeyEnv = vscodeConfig.get("index.semanticApiKeyEnv", merged.index.semanticApiKeyEnv);
|
|
61
|
+
merged.index.semanticCache = vscodeConfig.get("index.semanticCache", merged.index.semanticCache);
|
|
62
|
+
merged.index.semanticMaxFilesPerRun = vscodeConfig.get("index.semanticMaxFilesPerRun", merged.index.semanticMaxFilesPerRun);
|
|
63
|
+
merged.index.semanticTimeoutMs = vscodeConfig.get("index.semanticTimeoutMs", merged.index.semanticTimeoutMs);
|
|
64
|
+
merged.index.semanticMinSimilarity = vscodeConfig.get("index.semanticMinSimilarity", merged.index.semanticMinSimilarity);
|
|
65
|
+
merged.index.semanticEvidenceMaxRank = vscodeConfig.get("index.semanticEvidenceMaxRank", merged.index.semanticEvidenceMaxRank);
|
|
53
66
|
merged.ai.enabled = vscodeConfig.get("ai.enabled", merged.ai.enabled);
|
|
54
67
|
merged.ai.outputLanguage = vscodeConfig.get("ai.outputLanguage", merged.ai.outputLanguage);
|
|
55
68
|
merged.pipeline.maxCandidates = vscodeConfig.get("pipeline.maxCandidates", merged.pipeline.maxCandidates);
|
|
@@ -60,7 +73,11 @@ async function loadConfig() {
|
|
|
60
73
|
merged.pipeline.maxTotalBytesMb = vscodeConfig.get("pipeline.maxTotalBytesMb", merged.pipeline.maxTotalBytesMb);
|
|
61
74
|
merged.pipeline.maxScanMs = vscodeConfig.get("pipeline.maxScanMs", merged.pipeline.maxScanMs);
|
|
62
75
|
merged.pipeline.maxRawEvidence = vscodeConfig.get("pipeline.maxRawEvidence", merged.pipeline.maxRawEvidence);
|
|
63
|
-
return merged;
|
|
76
|
+
return (0, env_1.applyEnvConfigOverrides)(merged);
|
|
77
|
+
}
|
|
78
|
+
function firstWorkspaceRoot() {
|
|
79
|
+
const folder = vscode.workspace.workspaceFolders?.[0];
|
|
80
|
+
return folder?.uri.scheme === "file" ? folder.uri.fsPath : undefined;
|
|
64
81
|
}
|
|
65
82
|
async function readWorkspaceConfig() {
|
|
66
83
|
const folders = vscode.workspace.workspaceFolders;
|
|
@@ -37,10 +37,12 @@ exports.loadConfigFromPath = loadConfigFromPath;
|
|
|
37
37
|
const fs = __importStar(require("fs/promises"));
|
|
38
38
|
const path = __importStar(require("path"));
|
|
39
39
|
const defaultConfig_1 = require("./defaultConfig");
|
|
40
|
+
const env_1 = require("./env");
|
|
40
41
|
async function loadConfigFromPath(workspacePath) {
|
|
42
|
+
(0, env_1.loadEnvFiles)(workspacePath);
|
|
41
43
|
const configPath = path.join(workspacePath, ".flowseeker", "config.json");
|
|
42
44
|
const workspaceConfig = await readJson(configPath);
|
|
43
|
-
return (0, defaultConfig_1.mergeConfig)(defaultConfig_1.defaultConfig, workspaceConfig ?? {});
|
|
45
|
+
return (0, env_1.applyEnvConfigOverrides)((0, defaultConfig_1.mergeConfig)(defaultConfig_1.defaultConfig, workspaceConfig ?? {}));
|
|
44
46
|
}
|
|
45
47
|
async function readJson(filePath) {
|
|
46
48
|
try {
|
package/dist/extension.js
CHANGED
|
@@ -64,6 +64,7 @@ const statusBar_1 = require("./runtime/statusBar");
|
|
|
64
64
|
const chatViewProvider_1 = require("./ui/chatViewProvider");
|
|
65
65
|
const resultTreeProvider_1 = require("./ui/resultTreeProvider");
|
|
66
66
|
const logger_1 = require("./utils/logger");
|
|
67
|
+
const indexWatcher_1 = require("./index/indexWatcher");
|
|
67
68
|
const updateChecker_1 = require("./utils/updateChecker");
|
|
68
69
|
const oauthHandler_1 = require("./auth/oauthHandler");
|
|
69
70
|
const githubAuth_1 = require("./auth/githubAuth");
|
|
@@ -146,6 +147,28 @@ async function activate(context) {
|
|
|
146
147
|
if (mcpProvider) {
|
|
147
148
|
context.subscriptions.push(mcpProvider);
|
|
148
149
|
}
|
|
150
|
+
// Index watcher: debounce + batch + stale invalidation
|
|
151
|
+
const workspaceFolders = vscode.workspace.workspaceFolders;
|
|
152
|
+
if (workspaceFolders && workspaceFolders.length > 0) {
|
|
153
|
+
const staleState = { stale: false, changedPaths: new Set(), deletedPaths: new Set(), lastInvalidatedAt: undefined };
|
|
154
|
+
const watcher = (0, indexWatcher_1.createIndexWatcher)({
|
|
155
|
+
debounceMs: 2000,
|
|
156
|
+
onFlush: (changed, deleted) => {
|
|
157
|
+
staleState.stale = true;
|
|
158
|
+
staleState.lastInvalidatedAt = Date.now();
|
|
159
|
+
for (const p of changed)
|
|
160
|
+
staleState.changedPaths.add(p);
|
|
161
|
+
for (const p of deleted)
|
|
162
|
+
staleState.deletedPaths.add(p);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
const cwd = workspaceFolders[0].uri.fsPath;
|
|
166
|
+
const fsw = vscode.workspace.createFileSystemWatcher(new vscode.RelativePattern(cwd, "**/*"));
|
|
167
|
+
fsw.onDidChange((uri) => (0, indexWatcher_1.onFileChanged)(watcher, vscode.workspace.asRelativePath(uri)));
|
|
168
|
+
fsw.onDidCreate((uri) => (0, indexWatcher_1.onFileCreated)(watcher, vscode.workspace.asRelativePath(uri)));
|
|
169
|
+
fsw.onDidDelete((uri) => (0, indexWatcher_1.onFileDeleted)(watcher, vscode.workspace.asRelativePath(uri)));
|
|
170
|
+
context.subscriptions.push({ dispose: () => { fsw.dispose(); (0, indexWatcher_1.dispose)(watcher); } });
|
|
171
|
+
}
|
|
149
172
|
(0, logger_1.logInfo)("FlowSeeker commands and result tree registered.");
|
|
150
173
|
}
|
|
151
174
|
function deactivate() { }
|