feat(signals): decode recordings with bounded sigrok output (#2339)

Decode caller-selected protocols from existing recordings through shared
CLI/MCP Evidence. Page literal output lines after complete decoding;
preserve explicit full output, source identity and failed cleanup ownership.

Verified real sigrok-cli 0.7.2 workflows, published UART/SPI/I2C recordings,
independent UART values, selector limits, SDK schemas and cleanup regressions.

Co-authored-by: Olorinm <59321404+Olorinm@users.noreply.github.com>
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
This commit is contained in:
Ysopwnable
2026-10-12 20:59:02 +00:00
committed by GitHub
co-authored by Olorinm
parent 5f79c852af
commit 91b8f587cd
50 changed files with 2715 additions and 252 deletions
+17
View File
@@ -1,6 +1,9 @@
import type { PacketCaptureService } from "../application/captures/PacketCaptureService.js";
import { createPacketCaptureService } from "../composition/captures.js";
import { registerCaptureTools } from "./registerCaptureTools.js";
import type { SignalRecordingService } from "../application/signals/SignalRecordingService.js";
import { createSignalRecordingService } from "../composition/signals.js";
import { registerSignalTools } from "./registerSignalTools.js";
import type { WasmArtifactService } from "../application/wasm/WasmArtifactService.js";
import { wasmArtifactModule } from "../composition/wasm.js";
import { registerWasmTools } from "./registerWasmTools.js";
@@ -123,6 +126,7 @@ export interface CreateServerOptions {
readonly environment?: Readonly<NodeJS.ProcessEnv>;
readonly delivery?: ToolResultDelivery;
readonly packetCapture?: PacketCaptureService;
readonly signalRecording?: SignalRecordingService;
readonly wasmArtifact?: WasmArtifactService;
readonly evmInterface?: EvmInterfaceService;
readonly sqliteDatabase?: SqliteDatabaseService;
@@ -168,6 +172,9 @@ const installSessionToolAvailability = (
packetCaptureEnabled:
options.packetCapture !== undefined ||
(linux && isAbsolute(environment.REA_TSHARK_COMMAND ?? "")),
signalRecordingEnabled:
options.signalRecording !== undefined ||
(linux && isAbsolute(environment.REA_SIGROK_COMMAND ?? "")),
wasmArtifactEnabled:
options.wasmArtifact !== undefined ||
isAbsolute(environment.REA_WABT_BIN_DIRECTORY ?? ""),
@@ -301,6 +308,8 @@ export const createServer = (
);
const packetCapture =
options.packetCapture ?? createPacketCaptureService(environment);
const signalRecording =
options.signalRecording ?? createSignalRecordingService(environment);
const apktool =
options.apktoolAnalysis ??
createApktoolResourceAnalysisProvider(environment);
@@ -314,6 +323,7 @@ export const createServer = (
fridaInstrumentation.closeAll(),
wasmArtifact.close(),
packetCapture.close(),
signalRecording.close(),
apktool.close(),
jeb.close(),
adbDevice.close(),
@@ -401,6 +411,13 @@ export const createServer = (
recordEvidence,
analysisAdmission,
);
registerSignalTools(
server,
signalRecording,
toolLogger,
recordEvidence,
analysisAdmission,
);
registerConfiguredAnalysisTools(
toolContext,
android,
+31
View File
@@ -0,0 +1,31 @@
import type { EvidenceMcpServer } from "./EvidenceMcpServer.js";
import type { SignalRecordingService } from "../application/signals/SignalRecordingService.js";
import type { EvidenceWriter } from "../application/investigation/InvestigationRecordPort.js";
import { toolContract } from "../contracts/toolContracts.js";
import type { Logger } from "pino";
import type { WithAdmittedAnalysis } from "./analysisAdmission.js";
import { createEvidenceToolHandler } from "./contractToolHandler.js";
import { toolRegistrationOptions } from "./toolRegistrationOptions.js";
/** Bind the named signal contract through shared admission and retained Evidence delivery. */
export const registerSignalTools = (
server: EvidenceMcpServer,
service: SignalRecordingService,
logger: Logger,
recordEvidence?: EvidenceWriter["recordEvidence"],
withAdmittedAnalysis?: WithAdmittedAnalysis,
): void => {
const contract = toolContract("decode_signal_recording");
const handler = createEvidenceToolHandler(
server,
(input, options) => service.decode(input, options),
logger,
recordEvidence,
withAdmittedAnalysis,
);
server.registerTool(
contract.name,
toolRegistrationOptions(contract),
handler(contract),
);
};
+3
View File
@@ -9,6 +9,7 @@ export interface SessionAvailabilityDefaults {
readonly optionalFeatures?: Pick<
AvailabilityPolicy,
| "packetCaptureEnabled"
| "signalRecordingEnabled"
| "wasmArtifactEnabled"
| "evmInterfaceEnabled"
| "browserObservationEnabled"
@@ -35,6 +36,8 @@ export const sessionAvailabilityPolicy = (
(() => ({
packetCaptureEnabled:
defaults.optionalFeatures?.packetCaptureEnabled ?? false,
signalRecordingEnabled:
defaults.optionalFeatures?.signalRecordingEnabled ?? false,
wasmArtifactEnabled:
defaults.optionalFeatures?.wasmArtifactEnabled ?? false,
evmInterfaceEnabled: