INNER CODE UNIT · TypeScript

grace

AmrDab/clawdcursor · src/surface/cli.ts:477

      const grace = Promise.resolve().then(() => serverShutdown.onStop()).catch(() => {});
      const cap = new Promise<void>(resolve => setTimeout(resolve, 2500));
      void Promise.race([grace, cap]).then(() => process.exit(0));
      setTimeout(() => process.exit(1), 6000); // hard-kill safety net
    },
  });

  // Build the ToolContext shared by every MCP handler. In agent mode it
  // reuses the agent's already-connected NativeDesktop and AccessibilityBridge;
  // in --no-llm mode it boots a fresh ToolContext like the legacy serve cmd.
  const { getPlatform } = await import('../platform');

  // One UIMapHolder per daemon session — shared by the agent loop (via runAgent
  // deps) and the MCP surface (via toolCtx → toolContextToAgent bridge). Mirror
  // how cdpDriver is wired: create once here, attach to the agent, pass via ctx.
  const uiMapHolder = new UIMapHolder();

  let toolCtx: any;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…