feat(javascript): add filtered retained module reference views

Expose filtered canonical module identities, retained source-range counts and mixed support through the existing shared CLI/MCP analysis view. Preserve full-item access, source selection, provenance and partial coverage while allocating only the selected page.

Verify exact facts and CLI/MCP identity on shipped Obsidian, record complete-task BPE/resource measurements and reuse owned-process supervision for optional tokenizer cleanup.

Fixes #4092
Part of #4027; decision #4091.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
This commit is contained in:
YsopwnableandKaoru0822 authored and GitHub committed 2026-10-15 21:05:00 +08:00
1 parent 7054bbb9ab
commit ec394a2bdf
14 files changed
+1950 -29

No files matched your search

@@ -0,0 +1,61 @@
import { z } from "zod";
import { prefixedDigestSchema } from "../digests.js";
import {
applicationCoverageSchema,
applicationGraphEvidenceSchema,
applicationNodeIdentitySchema,
} from "../javascript/javascriptApplicationEvidenceSchemas.js";
import { javaScriptSemanticGraphInputSchema } from "../javascript/javascriptSemanticGraphSchemas.js";
import { javaScriptSourceSelectionSchema } from "../javascript/javascriptSourceSelection.js";
const moduleKindSchema = z.enum([
"javascript-asset",
"javascript-module",
"source-module",
]);
/** Exact filters over retained owner facts; paths are not filesystem lookups. */
export const javascriptModuleReferencesRequestSchema = z.strictObject({
kind: z.literal("javascript"),
collection: z.literal("modules"),
projection: z.literal("references"),
where: z
.strictObject({
path: z.string().nullable().optional(),
kind: moduleKindSchema.optional(),
})
.default({}),
offset: z.number().int().nonnegative().default(0),
limit: z.number().int().positive().default(64),
});
/** Unique support states, without promoting mixed observations to one fact. */
const basisSchema = z.strictObject({
authority: applicationGraphEvidenceSchema.shape.authority,
state: applicationGraphEvidenceSchema.shape.state,
confidence: applicationGraphEvidenceSchema.shape.confidence,
});
/** Reusable facts rather than task-specific dependency interpretations. */
export const javascriptModuleReferenceSchema = z.strictObject({
node_id: prefixedDigestSchema("jag_node"),
kind: moduleKindSchema,
path: z.string().nullable(),
identity: applicationNodeIdentitySchema,
retained_source_range_count: z.number().int().nonnegative(),
basis: z.array(basisSchema).min(1),
});
export const javascriptModuleSourceCoverageSchema = z.strictObject({
source_selection: javaScriptSourceSelectionSchema.exactOptional(),
application: applicationCoverageSchema,
semantic: javaScriptSemanticGraphInputSchema.shape.coverage.omit({
families: true,
}),
application_unknown_count: z.number().int().nonnegative(),
semantic_unknown_count: z.number().int().nonnegative(),
});
export type JavaScriptModuleReference = z.infer<
typeof javascriptModuleReferenceSchema
>;