mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-25 02:37:53 -07:00
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2026 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import type { BaseLlmClient } from '../../core/baseLlmClient.js';
|
|
import type { ContextTracer } from '../tracer.js';
|
|
import type { ContextEnvironment } from './environment.js';
|
|
|
|
import type { ContextEventBus } from '../eventBus.js';
|
|
|
|
import { ContextTokenCalculator } from '../utils/contextTokenCalculator.js';
|
|
import type { IFileSystem } from '../system/IFileSystem.js';
|
|
import { NodeFileSystem } from '../system/NodeFileSystem.js';
|
|
import type { IIdGenerator } from '../system/IIdGenerator.js';
|
|
import { NodeIdGenerator } from '../system/NodeIdGenerator.js';
|
|
|
|
export class ContextEnvironmentImpl implements ContextEnvironment {
|
|
readonly tokenCalculator: ContextTokenCalculator;
|
|
readonly fileSystem: IFileSystem;
|
|
readonly idGenerator: IIdGenerator;
|
|
|
|
constructor(
|
|
readonly llmClient: BaseLlmClient,
|
|
readonly sessionId: string,
|
|
readonly promptId: string,
|
|
readonly traceDir: string,
|
|
readonly projectTempDir: string,
|
|
readonly tracer: ContextTracer,
|
|
readonly charsPerToken: number,
|
|
readonly eventBus: ContextEventBus,
|
|
fileSystem?: IFileSystem,
|
|
idGenerator?: IIdGenerator,
|
|
) {
|
|
this.tokenCalculator = new ContextTokenCalculator(this.charsPerToken);
|
|
this.fileSystem = fileSystem || new NodeFileSystem();
|
|
this.idGenerator = idGenerator || new NodeIdGenerator();
|
|
}
|
|
}
|