Add structured runtime logging

This commit is contained in:
morluto
2026-07-12 10:57:34 +08:00
parent 5ed56d63e0
commit 03072e0ea7
16 changed files with 795 additions and 48 deletions
+6 -1
View File
@@ -4,13 +4,17 @@ import type { AppConfig } from "../config.js";
import { BinarySession } from "./BinarySession.js";
import { HopperApplicationLauncher } from "../hopper/BridgeLauncher.js";
import { HopperClient } from "../hopper/HopperClient.js";
import { silentLogger, type Logger } from "../logger.js";
/**
* Compose the target-switching runtime shared directly by CLI and MCP adapters.
* This is the sole production wiring point for Hopper so neither adapter shells
* out to the other and both retain identical loader and bridge semantics.
*/
export const createBinarySession = (config: AppConfig): BinarySession => {
export const createBinarySession = (
config: AppConfig,
logger: Logger = silentLogger,
): BinarySession => {
const bridgeScriptPath = fileURLToPath(
new URL("../../bridge/hopper_bridge.py", import.meta.url),
);
@@ -27,6 +31,7 @@ export const createBinarySession = (config: AppConfig): BinarySession => {
: target.loaderArgs,
bridgeScriptPath,
}),
logger: logger.child({ layer: "bridge" }),
}),
);
};