mirror of
https://github.com/morluto/rea.git
synced 2026-10-26 17:35:11 +00:00
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)
32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
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),
|
|
);
|
|
};
|