MCPcopy Index your code
hub / github.com/cursor/community-plugins / redirectSdkStateToTmp

Function redirectSdkStateToTmp

apps/cursor/src/lib/plugins/scan.ts:323–332  ·  view source on GitHub ↗

* Point every Cursor SDK state surface at writable tmpfs and return the * `stateRoot` to pass to `Agent.prompt`: * * - `platform.stateRoot` covers the SDK's in-process run/checkpoint stores * (the `sdk-agent-store` path that failed in production). * - `HOME` / `CURSOR_CONFIG_DIR` / `CURSOR_DA

()

Source from the content-addressed store, hash-verified

321 * invocations in a shared instance can't observe a mix.
322 */
323async function redirectSdkStateToTmp(): Promise<string> {
324 const cursorDir = path.join(SDK_STATE_HOME, ".cursor");
325 const stateRoot = path.join(SDK_STATE_HOME, "sdk-agent-store");
326 process.env.HOME = SDK_STATE_HOME;
327 process.env.CURSOR_CONFIG_DIR = cursorDir;
328 process.env.CURSOR_DATA_DIR = cursorDir;
329 await mkdir(cursorDir, { recursive: true });
330 await mkdir(stateRoot, { recursive: true });
331 return stateRoot;
332}
333
334function archiveSizeGuard(tag: string) {
335 let downloaded = 0;

Callers 1

runSecurityAgentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected