2026-07-12 07:44:21 +08:00
|
|
|
import type { AppConfig } from "../config.js";
|
|
|
|
|
import { BinarySession } from "./BinarySession.js";
|
2026-07-12 19:32:13 +08:00
|
|
|
import { HopperProvider } from "../hopper/HopperProvider.js";
|
2026-07-16 00:02:49 +08:00
|
|
|
import { GhidraProvider } from "../ghidra/GhidraProvider.js";
|
2026-07-12 21:12:18 +00:00
|
|
|
import { NativeMacOSProvider } from "../native/NativeMacOSProvider.js";
|
|
|
|
|
import { ArtifactProvider } from "../artifacts/ArtifactProvider.js";
|
2026-07-16 15:56:40 +08:00
|
|
|
import { ManagedStaticProvider } from "../dotnet/ManagedStaticProvider.js";
|
2026-07-12 10:57:34 +08:00
|
|
|
import { silentLogger, type Logger } from "../logger.js";
|
2026-07-15 21:06:06 +08:00
|
|
|
import { AnalysisProviderRegistry } from "./AnalysisProviderRegistry.js";
|
|
|
|
|
import { SessionProviderRouter } from "./SessionProviderRouter.js";
|
2026-07-12 07:44:21 +08:00
|
|
|
|
2026-07-12 08:45:35 +08:00
|
|
|
/**
|
|
|
|
|
* Compose the target-switching runtime shared directly by CLI and MCP adapters.
|
2026-07-15 19:22:30 +08:00
|
|
|
* This is the sole production wiring point, so both adapters share identical
|
|
|
|
|
* provider selection, profile, lifecycle, and Evidence semantics.
|
2026-07-12 08:45:35 +08:00
|
|
|
*/
|
2026-07-12 10:57:34 +08:00
|
|
|
export const createBinarySession = (
|
|
|
|
|
config: AppConfig,
|
|
|
|
|
logger: Logger = silentLogger,
|
|
|
|
|
): BinarySession => {
|
2026-07-15 21:06:06 +08:00
|
|
|
const hopper = new HopperProvider(config, logger);
|
2026-07-16 00:02:49 +08:00
|
|
|
const ghidra = new GhidraProvider(config, logger);
|
2026-07-12 21:12:18 +00:00
|
|
|
return new BinarySession(
|
2026-07-15 21:06:06 +08:00
|
|
|
SessionProviderRouter.selectable(
|
2026-07-16 00:02:49 +08:00
|
|
|
new AnalysisProviderRegistry([hopper, ghidra], config.analysisProvider),
|
2026-07-15 21:06:06 +08:00
|
|
|
[
|
|
|
|
|
new ArtifactProvider(
|
|
|
|
|
config.artifactNativeMountEnabled,
|
|
|
|
|
config.artifactIntegrityContinueEnabled,
|
|
|
|
|
),
|
|
|
|
|
new NativeMacOSProvider(),
|
2026-07-16 15:56:40 +08:00
|
|
|
new ManagedStaticProvider(),
|
2026-07-15 21:06:06 +08:00
|
|
|
],
|
|
|
|
|
),
|
2026-07-12 21:12:18 +00:00
|
|
|
);
|
2026-07-12 07:44:21 +08:00
|
|
|
};
|