Files
reverse-engineering-anything/src/domain/analysisView/javascriptModuleReferences.ts
T
YsopwnableandKaoru0822 d9d085a15e feat(javascript): query retained application facts by exact path (#4265)
Expose exact-path, selected-property, paged reads of retained JavaScript application facts through the shared CLI/MCP analysis view. Preserve original identities, complete row Evidence and partial coverage; retain reproducible real-Joplin and actual-agent measurements, including negative cost results.

Fixes #4190. Part of #4027. Code mode remains deferred by #4091.

Integrate main after #4274. Validation: 114 distinct focused cases across documented invocations, 106 Python cases, full static/docs checks and 18 version-labelled real-application workflows with 9 complete CLI/MCP view parity controls. Preserve two local fixture deadline failures and the unchanged test passing on an available single CPU. Final-head CI passed all 36 jobs after one Windows timeout retry without source changes; both exact-head automated reviews are clear and all review threads resolved. Downloadable apps and raw large Evidence/transcripts are excluded.

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-16 12:46:53 +08:00

49 lines
1.6 KiB
TypeScript

import { z } from "zod";
import { prefixedDigestSchema } from "../digests.js";
import {
applicationGraphEvidenceSchema,
applicationNodeIdentitySchema,
} from "../javascript/javascriptApplicationEvidenceSchemas.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 type JavaScriptModuleReference = z.infer<
typeof javascriptModuleReferenceSchema
>;