Merge origin/main into feat/artifact-integrity-policy

Keep main's skill metadata version (27) and regenerate the package, tool
catalog and product metadata for the merged tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-07 14:18:28 +00:00
co-authored by Claude Opus 5.5
124 changed files with 6709 additions and 167 deletions
+3 -1
View File
@@ -11,13 +11,15 @@ export class BrowserObservationError extends AnalysisError {
override readonly cleanupIncomplete: boolean;
override readonly cleanupResources: readonly string[];
override readonly userCategory: "cancelled" | undefined;
override readonly userMessage: string | undefined;
constructor(
readonly operation: BrowserObservationOperation,
readonly reason: BrowserObservationFailureReason,
options?: ErrorOptions,
options?: ErrorOptions & { readonly detail?: string },
) {
super(`Browser observation ${operation} failed: ${reason}`, options);
this.userMessage = options?.detail;
this.cleanupIncomplete = reason === "cleanup_failed";
this.cleanupResources =
reason === "cleanup_failed" ? ["browser_transport"] : [];
+2
View File
@@ -5,6 +5,8 @@ export type BrowserObservationOperation =
| "analyze_web_bundle"
| "trace_web_module_imports"
| "observe_web_session"
| "observe_web_execution"
| "inspect_web_event_listeners"
| "discover_webmcp_tools"
| "compare_web_captures"
| "capture_web_screenshot"
+44
View File
@@ -0,0 +1,44 @@
import { z } from "zod";
import {
webRuntimeBrowserSchema,
webRuntimeLocationSchema,
webRuntimeScopeSchema,
webRuntimeSourceSchema,
webRuntimeTargetSchema,
} from "./webRuntime.js";
/** Inspect listeners registered directly on the first main-document CSS match. */
export const inspectWebEventListenersInputSchema = webRuntimeScopeSchema.extend(
{
selector: z.string().min(1),
},
);
export type InspectWebEventListenersInput = z.infer<
typeof inspectWebEventListenersInputSchema
>;
/** A listener declaration and its source location do not establish that it ran. */
export const webEventListenersSchema = z.object({
browser: webRuntimeBrowserSchema,
target: webRuntimeTargetSchema,
inspected_at: z.iso.datetime(),
selected_node: z.object({
selector: z.string(),
match: z.enum(["found", "not_found"]),
backend_node_id: z.number().int().min(1).nullable(),
}),
listeners: z.array(
z.object({
type: z.string(),
use_capture: z.boolean(),
passive: z.boolean(),
once: z.boolean(),
location: webRuntimeLocationSchema,
execution: z.literal("unknown"),
}),
),
sources: z.array(webRuntimeSourceSchema),
cleanup: z.literal("confirmed"),
limitations: z.array(z.string()),
});
export type WebEventListeners = z.infer<typeof webEventListenersSchema>;
+93
View File
@@ -0,0 +1,93 @@
import { z } from "zod";
import { jsonObjectSchema } from "./jsonValue.js";
import {
webRuntimeBrowserSchema,
webRuntimeLocationSchema,
webRuntimeScopeSchema,
webRuntimeSourceSchema,
webRuntimeTargetSchema,
} from "./webRuntime.js";
/** Explicit instrumentation request for one finite, externally driven execution window. */
export const observeWebExecutionInputSchema = webRuntimeScopeSchema.extend({
observation_ms: z.number().int().min(1).max(2_147_483_647).default(10_000),
});
export type ObserveWebExecutionInput = z.infer<
typeof observeWebExecutionInputSchema
>;
const rangeSchema = z.object({
start_offset: z.number().int().min(0),
end_offset: z.number().int().min(0),
count: z.number().int().min(0),
source_bounds: z.enum(["verified", "unknown"]),
});
const functionSchema = z.object({
name: z.string(),
is_block_coverage: z.boolean(),
ranges: z.array(rangeSchema),
});
/** Precise V8 ranges retain their nested structure and counts without summing them. */
export const webExecutionSchema = z.object({
browser: webRuntimeBrowserSchema,
target: webRuntimeTargetSchema,
window: z.object({
armed_at: z.iso.datetime(),
ended_at: z.iso.datetime(),
requested_ms: z.number().int().min(1),
end_reason: z.enum([
"window_elapsed",
"document_changed",
"target_terminated",
]),
producer_started_seconds: z.number().min(0),
producer_sampled_seconds: z.number().min(0).nullable(),
}),
coverage: z.object({
state: z.enum(["captured", "unavailable"]),
reason: z.string().nullable(),
offset_units: z.literal("utf16-code-units"),
end_offset: z.literal("exclusive"),
scripts: z.array(
z.object({
script_id: z.string().min(1),
reported_url: z.string(),
functions: z.array(functionSchema),
}),
),
excluded_scripts: z.number().int().min(0),
}),
requests: z.array(
z.object({
request_id: z.string().min(1),
url: z.string(),
method: z.string(),
timestamp_seconds: z.number().min(0),
initiator_type: z.string(),
reported_initiator: jsonObjectSchema,
callsites: z.array(webRuntimeLocationSchema),
async_parent_ids: z.array(
z.object({ id: z.string(), debugger_id: z.string().nullable() }),
),
causal_attribution: z.literal("unknown"),
}),
),
excluded_requests: z.number().int().min(0),
script_inventory: z.object({
main_document_scripts: z.number().int().min(0),
not_reported_script_ids: z.array(z.string().min(1)),
coverage_absence: z.literal("unknown"),
}),
sources: z.array(webRuntimeSourceSchema),
instrumentation: z.object({
resets_execution_counters: z.literal(true),
disables_optimized_execution: z.literal(true),
takes_one_resetting_sample: z.boolean(),
executes_selected_code: z.literal(false),
cleanup: z.literal("confirmed"),
page_ownership: z.literal("external"),
}),
limitations: z.array(z.string()),
});
export type WebExecution = z.infer<typeof webExecutionSchema>;
+79
View File
@@ -0,0 +1,79 @@
import { z } from "zod";
import {
browserAllowedOriginsSchema,
browserEndpointSchema,
} from "./browserObservation.js";
import { browserVersionSchema } from "./browserObservationSchemas.js";
import { jsonObjectSchema } from "./jsonValue.js";
/** Scope for one externally owned page; omitted origins select its current origin. */
export const webRuntimeScopeSchema = z.strictObject({
cdp_endpoint: browserEndpointSchema,
allowed_origins: browserAllowedOriginsSchema,
target_id: z.string().min(1),
});
/** Source evidence is bound by the selected CDP session's script ID, never URL equality. */
export const webRuntimeSourceSchema = z.object({
script_id: z.string().min(1),
url: z.string(),
execution_context_id: z.number().int().nullable(),
reported_execution_context: jsonObjectSchema.nullable(),
reported_script_context_aux_data: jsonObjectSchema.nullable(),
frame_id: z.string().nullable(),
producer_hash: z.string().nullable(),
source_map_url: z.string().nullable(),
has_source_url: z.boolean().nullable(),
language: z.string().nullable(),
resource_start: z
.object({
line_number: z.number().int().min(0),
column_number: z.number().int().min(0),
})
.nullable(),
source: z.discriminatedUnion("state", [
z.object({
state: z.literal("captured"),
text: z.string(),
sha256: z.string().regex(/^[a-f0-9]{64}$/u),
utf8_bytes: z.number().int().min(0),
utf16_units: z.number().int().min(0),
}),
z.object({
state: z.enum(["unavailable", "excluded"]),
reason: z.string().min(1),
}),
]),
});
export type WebRuntimeSource = z.infer<typeof webRuntimeSourceSchema>;
/** Producer callsite coordinates are zero-based resource lines and UTF-16 columns. */
export const webRuntimeLocationSchema = z.object({
script_id: z.string(),
url: z.string().nullable(),
line_number: z.number().int().min(0),
column_number: z.number().int().min(0).nullable(),
function_name: z.string().nullable(),
source_association: z.enum(["script_id", "unknown"]),
});
/** Common identity for a selected live page document. */
export const webRuntimeTargetSchema = z.object({
target_id: z.string().min(1),
origin: z.string().min(1),
initial_url: z.string(),
frame_id: z.string().min(1),
loader_id: z.string().nullable(),
});
/** Producer product identity is observed separately from the unknown host platform. */
export const webRuntimeBrowserSchema = browserVersionSchema;
/** Complete runtime evidence has explicit byte budgets rather than silent item truncation. */
export const WEB_RUNTIME_LIMITS = {
protocolBytes: 64 * 1024 * 1024,
retainedEventBytes: 8 * 1024 * 1024,
sourceBytes: 32 * 1024 * 1024,
commandTimeoutMs: 20_000,
cleanupTimeoutMs: 5_000,
} as const;