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-12 21:12:18 +00:00
|
|
|
import { NativeMacOSProvider } from "../native/NativeMacOSProvider.js";
|
|
|
|
|
import { ArtifactProvider } from "../artifacts/ArtifactProvider.js";
|
|
|
|
|
import { CompositeProvider } from "./CompositeProvider.js";
|
2026-07-12 10:57:34 +08:00
|
|
|
import { silentLogger, type Logger } from "../logger.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-12 21:12:18 +00:00
|
|
|
return new BinarySession(
|
|
|
|
|
new CompositeProvider([
|
2026-07-14 01:12:27 +00:00
|
|
|
new ArtifactProvider(
|
|
|
|
|
config.artifactNativeMountEnabled,
|
|
|
|
|
config.artifactIntegrityContinueEnabled,
|
|
|
|
|
),
|
2026-07-12 21:12:18 +00:00
|
|
|
new NativeMacOSProvider(),
|
|
|
|
|
new HopperProvider(config, logger),
|
|
|
|
|
]),
|
|
|
|
|
);
|
2026-07-12 07:44:21 +08:00
|
|
|
};
|