refactoring continued

This commit is contained in:
Your Name
2026-04-06 22:27:32 +00:00
parent cf6866c38d
commit fc4439ce03
13 changed files with 130 additions and 97 deletions
@@ -11,9 +11,15 @@ 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 {
public readonly tokenCalculator: ContextTokenCalculator;
public readonly fileSystem: IFileSystem;
public readonly idGenerator: IIdGenerator;
constructor(
public readonly llmClient: BaseLlmClient,
@@ -24,7 +30,11 @@ export class ContextEnvironmentImpl implements ContextEnvironment {
public readonly tracer: ContextTracer,
public readonly charsPerToken: number,
public readonly eventBus: ContextEventBus,
fileSystem?: IFileSystem,
idGenerator?: IIdGenerator,
) {
this.tokenCalculator = new ContextTokenCalculator(this.charsPerToken);
this.fileSystem = fileSystem || new NodeFileSystem();
this.idGenerator = idGenerator || new NodeIdGenerator();
}
}