fix(capabilities): report missing navigation targets

This commit is contained in:
morluto committed 2026-10-24 04:05:23 +08:00
1 parent 4e7fb1ee8a
commit f8248417d7
3 files changed
+28 -7

No files matched your search

@@ -415,6 +415,22 @@ describe("compact tool availability", () => {
});
describe("partial navigation availability", () => {
it("requires a target before diagnosing navigation provider modes", () => {
expect(entry("get_navigation_context", status())).toMatchObject({
available: false,
reason: "target_required",
default_mode_available: false,
modes: [
{ name: "current_selection", available: false },
{ name: "explicit_document", available: false },
],
});
expect(
TOOL_CONTRACTS.find((tool) => tool.name === "get_navigation_context"),
).toMatchObject({
requiresActiveTarget: true,
});
});
it("allows explicit documents when the provider has no current-document getter", () => {
const capabilities = [
"current_document",
+4 -2
View File
@@ -383,12 +383,14 @@ const availabilityFor = (context: AvailabilityContext): Availability => {
context.name === "inspect_web_event_listeners"
)
return { reason: "available", remediation: null };
if (context.name === "get_navigation_context")
return availabilityForModes(
if (context.name === "get_navigation_context") {
const modes = availabilityForModes(
NAVIGATION_CONTEXT_MODES,
"current_selection",
context.descriptors,
);
return { ...modes, ...targetAvailability(context) };
}
const javascriptApplication = javascriptApplicationAvailability(context);
if (javascriptApplication !== null) return javascriptApplication;
const failure = optionalProviderFailureFor(context);
+8 -5
View File
@@ -168,11 +168,14 @@ export const SESSION_TOOL_CONTRACTS = [
"Return every retained Evidence record and residual unknown as a complete canonical bundle by default. detail=summary discovers retained records without copying or transferring their payloads; optionally filter by exact Evidence ID, operation, target SHA-256, analysis-profile digest or canonical native procedure address. Metadata distinguishes complete record retention from native value-flow truncation or unavailable/unknown coverage. Use a discovered evidence_id with inspect_analysis_view without restarting a provider. Filters apply only to summary delivery.",
getEvidenceBundleInputSchema,
),
session(
"get_navigation_context",
"Return the selected document, current address, and containing/current procedure in one provider-neutral result. The result reflects sequential provider observations, not an atomic cursor snapshot; a cursor outside any procedure returns procedure: null.",
navigationContextInputSchema,
),
{
...session(
"get_navigation_context",
"Return the selected document, current address, and containing/current procedure in one provider-neutral result. The result reflects sequential provider observations, not an atomic cursor snapshot; a cursor outside any procedure returns procedure: null.",
navigationContextInputSchema,
),
requiresActiveTarget: true,
},
session(
"inspect_address_context",
"Inspect one explicit reproducible address for its analyzed name, containing procedure, regular and inline comments, and matching bookmarks. Each unsupported facet returns a typed unavailable outcome; use xrefs, assembly, or pseudocode for those deeper views.",