feat(javascript): discover semantic call literals in feature traces (#7840)

* feat(javascript): discover semantic call literals in feature traces

* fix(javascript): bound retained call literals by transfer capacity

* test(javascript): align feature no-match diagnostic
This commit is contained in:
morluto authored and GitHub committed 2026-10-29 01:25:23 +08:00
1 parent 685f6db960
commit f9e7571a3d
20 files changed
+681 -15

No files matched your search

@@ -106,6 +106,15 @@ export const traceApplicationFeatureInputSchema = z
application: evidenceSchema,
native_observations: z.array(evidenceSchema).default([]),
seed: applicationFeatureSeedSchema,
semantic_page: z
.strictObject({
offset: z.int().nonnegative().default(0),
limit: z.int().positive().default(64),
})
.optional()
.describe(
"Page retained semantic label matches when a string seed has no application match. Defaults to offset 0 and limit 64.",
),
direction: z.enum(["outgoing", "incoming", "both"]).default("both"),
})
.superRefine(validateApplicationTraceIdentities);
@@ -156,6 +165,34 @@ export const applicationFeatureTraceResultSchema = z.strictObject({
seed: applicationFeatureSeedSchema,
direction: z.enum(["outgoing", "incoming", "both"]),
seed_matches: z.array(seedMatchSchema),
semantic_discovery: z
.strictObject({
source_graph_id: prefixedDigestSchema("jsrg"),
source_coverage: z.enum([
"complete",
"partial",
"unknown",
"unavailable",
]),
total: z.int().nonnegative(),
offset: z.int().nonnegative(),
limit: z.int().positive(),
next_offset: z.int().nonnegative().nullable(),
matches: z.array(
z.strictObject({
node_id: prefixedDigestSchema("jsrg_node"),
kind: z.string().min(1),
trace_seed: z.strictObject({
kind: z.literal("semantic-node"),
node_id: prefixedDigestSchema("jsrg_node"),
}),
}),
),
})
.optional()
.describe(
"On an unmatched string seed, retained semantic labels and direct string call arguments use the requested match mode and case sensitivity. Use a trace_seed with trace_javascript_semantics; source coverage limits absence claims.",
),
graph: javascriptApplicationGraphSchema.nullable(),
paths: z.array(tracePathSchema),
native_handoffs: z.array(nativeHandoffSchema),