INNER CODE UNIT · TypeScript
createToolContext
AmrDab/clawdcursor · src/surface/cli.ts:1278
async function createToolContext() {
const { NativeDesktop } = await import('../platform/native-desktop');
const { AccessibilityBridge } = await import('../platform/accessibility');
const { CDPDriver } = await import('../platform/cdp-driver');
const { DEFAULT_CONFIG } = await import('../types');
const { DEFAULT_CDP_PORT } = await import('../llm/browser-config');
const { getPlatform } = await import('../platform');
const desktop = new NativeDesktop({ ...DEFAULT_CONFIG });
const a11y = new AccessibilityBridge();
const cdp = new CDPDriver(DEFAULT_CDP_PORT);
// Session-scoped el_NN UIMap cache. Without this, compile_ui / find_* and
// the {element_id, snapshot_id} ref path fail with "no UIMap holder on this
// context" over stdio MCP — the v1.5.0 substrate was unreachable for editor-
// hosted agents (only the `agent` daemon constructed one). Gauntlet F1.
const { UIMapHolder } = await import('../core/sense/ui-map-holder');
const uiMaps = new UIMapHolder();
// Lazy adapter handle — Tranche 1A primitives run through this. Populated