refactor(observation): return complete inventories
This commit is contained in:
@@ -58,7 +58,7 @@ export const electronActiveObservationInputSchema = z.strictObject({
|
||||
executable_path: absolutePathSchema,
|
||||
application_path: absolutePathSchema,
|
||||
application_root: absolutePathSchema,
|
||||
args: z.array(z.string().max(4_096)).max(32).default([]),
|
||||
args: z.array(z.string().max(4_096)).default([]),
|
||||
actions: z.array(actionSchema).default([]),
|
||||
});
|
||||
export type ElectronActiveObservationInput = z.infer<
|
||||
|
||||
@@ -24,16 +24,8 @@ const approvedElectronInput = {
|
||||
allowed_file_roots: electronFileRootsSchema,
|
||||
};
|
||||
|
||||
/** Collection bounds for passive Electron capture, applied internally. */
|
||||
export const DEFAULT_ELECTRON_INSPECTION_LIMITS = {
|
||||
max_frames: 200,
|
||||
max_dom_nodes: 2_000,
|
||||
max_scripts: 500,
|
||||
max_resources: 2_000,
|
||||
max_workers: 500,
|
||||
max_script_source_bytes: 1_024 * 1_024,
|
||||
max_total_script_source_bytes: 4 * 1_024 * 1_024,
|
||||
};
|
||||
/** Per-script source validation bound for passive Electron capture. */
|
||||
export const MAX_ELECTRON_SCRIPT_SOURCE_BYTES = 1_024 * 1_024;
|
||||
|
||||
/** Input for listing root-confined file:// page targets from Electron CDP. */
|
||||
export const listElectronTargetsInputSchema = z.strictObject({
|
||||
@@ -49,21 +41,16 @@ const inspectElectronPageFacts = {
|
||||
target_id: z.string().trim().min(1).max(256),
|
||||
observation_ms: z.number().int().min(0).max(10_000).default(100),
|
||||
} as const;
|
||||
export const inspectElectronPageInputSchema = z
|
||||
.union([
|
||||
z.strictObject({
|
||||
...inspectElectronPageFacts,
|
||||
include_script_sources: z.literal(false).default(false),
|
||||
}),
|
||||
z.strictObject({
|
||||
...inspectElectronPageFacts,
|
||||
include_script_sources: z.literal(true),
|
||||
}),
|
||||
])
|
||||
.transform((input) => ({
|
||||
...input,
|
||||
limits: DEFAULT_ELECTRON_INSPECTION_LIMITS,
|
||||
}));
|
||||
export const inspectElectronPageInputSchema = z.union([
|
||||
z.strictObject({
|
||||
...inspectElectronPageFacts,
|
||||
include_script_sources: z.literal(false).default(false),
|
||||
}),
|
||||
z.strictObject({
|
||||
...inspectElectronPageFacts,
|
||||
include_script_sources: z.literal(true),
|
||||
}),
|
||||
]);
|
||||
export const inspectElectronPageToolInputSchema = z.union([
|
||||
z.strictObject({
|
||||
discovery_evidence_id: z.string().min(1),
|
||||
|
||||
@@ -72,14 +72,8 @@ const observedJavaScriptRuntimeKindSchema = javascriptRuntimeKindSchema.or(
|
||||
z.literal("unknown"),
|
||||
);
|
||||
|
||||
/** Collection bounds for passive V8 Inspector capture, applied internally. */
|
||||
export const DEFAULT_JAVASCRIPT_RUNTIME_OBSERVATION_LIMITS = {
|
||||
max_events: 10_000,
|
||||
max_scripts: 2_000,
|
||||
max_execution_contexts: 1_000,
|
||||
max_location_bytes: 16_384,
|
||||
max_total_metadata_bytes: 4 * 1_024 * 1_024,
|
||||
};
|
||||
/** Maximum accepted source location byte length in one inspector event. */
|
||||
export const MAX_JAVASCRIPT_RUNTIME_LOCATION_BYTES = 16_384;
|
||||
|
||||
/** Input for one bounded, attach-only V8 Inspector observation. */
|
||||
export const observeJavaScriptRuntimeToolInputSchema = z.strictObject({
|
||||
@@ -97,11 +91,7 @@ export const observeJavaScriptRuntimeInputSchema = z
|
||||
runtime_kind: javascriptRuntimeKindSchema.optional(),
|
||||
observation_ms: z.number().int().min(0).max(10_000).default(100),
|
||||
})
|
||||
.superRefine(requireRuntimeScope)
|
||||
.transform((input) => ({
|
||||
...input,
|
||||
limits: DEFAULT_JAVASCRIPT_RUNTIME_OBSERVATION_LIMITS,
|
||||
}));
|
||||
.superRefine(requireRuntimeScope);
|
||||
export type ObserveJavaScriptRuntimeInput = z.infer<
|
||||
typeof observeJavaScriptRuntimeInputSchema
|
||||
>;
|
||||
|
||||
Reference in New Issue
Block a user