SdkAgentFilesystem (src/fs.ts)

gemini-cli · packages/sdk/src/fs.ts · typescript · Apache-2.0
security

Filesystem implementation enforcing path policies for SDK agents.

// Source: https://github.com/google-gemini/gemini-cli | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * @license
 * Copyright 2026 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */

import type { Config as CoreConfig } from '@google/gemini-cli-core';
import type { AgentFilesystem } from './types.js';
import fs from 'node:fs/promises';

/**
 * SDK implementation of {@link AgentFilesystem} that enforces path-based
 * access policies from the core Config.
 *
 * Read operations return `null` when access is denied; write operations
 * throw an error.
 */
export class SdkAgentFilesystem implements AgentFilesystem {
  constructor(private readonly config: CoreConfig) {}

  async

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key