feat(pcap): add bounded capture summaries through CLI and MCP
Summarize saved Wireshark4.x captures with enforced native resource limits, serialized admission, stable snapshot verification and retained fact/text pages. Preserve complete inventories within resource budgets and source uncertainty; report cleanup failure with partial Evidence and retained ownership. Verified six recorded corpora /13026 packets with independent Scapy/Python oracles, real CLI/MCP/schema parity,60 SNI names,132 DNS addresses and1000 URIs. Real TShark CI now exercises summary/paging. Actual Windows/Bun Wireshark remains unverified; macOS capture requires a separate enforceable-bound decision. Co-authored-by: 3QL <85309073+3QL@users.noreply.github.com> Co-authored-by: N0zoM1z0 <161784452+N0zoM1z0@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import {
|
||||
pcapInputSchemas,
|
||||
pcapResultSchemas,
|
||||
} from "../../domain/pcap/pcapAnalysis.js";
|
||||
import type { ToolContract } from "../toolContractTypes.js";
|
||||
import { evidenceResultOf } from "../toolOutputSchemaPrimitives.js";
|
||||
import { toolContractMetadata } from "../toolEffects.js";
|
||||
import {
|
||||
analysisDetailSchema,
|
||||
analysisDetailOutputSchemaOf,
|
||||
} from "../analysisDetail.js";
|
||||
import { pcapCaptureSummaryViewResultSchema } from "../../domain/analysisView/analysisView.js";
|
||||
|
||||
/** Packet-capture analysis served by caller-supplied tshark and capinfos. */
|
||||
export const PCAP_TOOL_CONTRACTS = [
|
||||
{
|
||||
name: "inspect_pcap_client",
|
||||
...toolContractMetadata("inspect_pcap_client"),
|
||||
description:
|
||||
"Inspect the caller-selected tshark and capinfos binaries: selected commands, selection sources, and versions. Both tools must be usable. Reads no capture file. REA never installs the Wireshark suite; select binaries with REA_TSHARK_COMMAND and REA_CAPINFOS_COMMAND (absolute) or from PATH.",
|
||||
kind: "pcap-provider",
|
||||
inputSchema: pcapInputSchemas.inspect_pcap_client,
|
||||
outputSchema: evidenceResultOf(pcapResultSchemas.inspect_pcap_client),
|
||||
examples: [{ title: "Check the analysis tools", input: {} }],
|
||||
},
|
||||
{
|
||||
name: "inspect_pcap_capture",
|
||||
...toolContractMetadata("inspect_pcap_capture"),
|
||||
description:
|
||||
"Request detail summary for capture identity/counts, then page retained facts with inspect_analysis_view kind pcap. Default detail complete preserves inline delivery. Inspect one saved pcap or pcapng capture through an owned snapshot: metadata, exact packet count, SHA-256, IPv4/IPv6 address counts, DNS questions and address values from the same single-question response, TLS SNI, protocol distribution and HTTP URIs. All derived inventories are retained within declared resource budgets; unknown DNS attribution and excluded credentials remain explicit. Linux requires util-linux prlimit; Windows uses owned Job Objects. Requires caller-supplied capinfos and tshark; REA never captures traffic.",
|
||||
kind: "pcap-provider",
|
||||
inputSchema: pcapInputSchemas.inspect_pcap_capture.extend({
|
||||
detail: analysisDetailSchema,
|
||||
}),
|
||||
outputSchema: analysisDetailOutputSchemaOf(
|
||||
pcapResultSchemas.inspect_pcap_capture,
|
||||
pcapCaptureSummaryViewResultSchema,
|
||||
),
|
||||
examples: [
|
||||
{
|
||||
title: "Inspect a capture file",
|
||||
input: { path: "/captures/session.pcap" },
|
||||
},
|
||||
],
|
||||
},
|
||||
] as const satisfies readonly ToolContract[];
|
||||
Reference in New Issue
Block a user