perf(javascript): query selected source-to-bundle facts (#6128)

Select completed source-to-bundle mappings and candidates through the shared view owner, preserve reference-file provenance, and retain full Evidence. Reuse bounded JSON reading, heap admission, and cancellation before session writes.

Verified public Redux Toolkit source/map facts with an independent oracle, equivalent CLI/MCP workflows, focused negative controls, and complete CI/review. Historical paired SDK context estimates fall about 64%; timing/resource tradeoffs and final verification receipts are recorded without a general speedup or actual model-token claim.

Fixes #6112.
This commit is contained in:
gensokyo-dev authored and GitHub committed 2026-10-21 18:45:50 +00:00
1 parent a0214e0e0e
commit 0583fc69be
29 files changed
+3527 -129

No files matched your search

@@ -1,3 +1,9 @@
import {
absoluteLocalPathStringSchema,
localPathStringSchema,
} from "../../domain/localPath.js";
import { sourceToBundleViewRequestSchema } from "../../domain/analysisView/sourceToBundleView.js";
import { evidenceSchema } from "../../domain/evidence.js";
import { z } from "zod";
import { evidenceInputSchema } from "../evidenceInputContracts.js";
@@ -40,14 +46,34 @@ export const compareApplicationVersionsRequestSchema = z.strictObject({
right: evidenceInputSchema,
});
const compareSourceToBundleFacts = {
reference: compareSourceToBundleInputSchema.shape.reference,
} as const;
/** Historical-source comparison accepting inline or same-session application Evidence. */
const referenceFile = z.strictObject({
kind: z.literal("file"),
path: localPathStringSchema,
});
const sourceToBundleSelection = {
view: z
.union([
z.strictObject({ kind: z.literal("summary") }),
sourceToBundleViewRequestSchema,
])
.optional(),
};
/** Historical graph JSON is a transport alternative to the inline graph, authenticated by the same graph parser. */
export const compareSourceToBundleCliInputSchema = z.strictObject({
reference: z.union([
compareSourceToBundleInputSchema.shape.reference,
referenceFile,
]),
application: evidenceSchema,
});
/** The MCP host accepts absolute local paths; omitted view preserves the full report. */
export const compareSourceToBundleRequestSchema = z.strictObject({
...compareSourceToBundleFacts,
reference: z.union([
compareSourceToBundleInputSchema.shape.reference,
referenceFile.extend({ path: absoluteLocalPathStringSchema }),
]),
application: evidenceInputSchema,
...sourceToBundleSelection,
});
const compareJavaScriptExportShapesFacts = {