mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-16 04:50:29 -07:00
speculative partial fix for typed configs
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2026 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { ProcessorRegistry } from './registry.js';
|
||||
import { ToolMaskingProcessor } from '../processors/toolMaskingProcessor.js';
|
||||
import { BlobDegradationProcessor } from '../processors/blobDegradationProcessor.js';
|
||||
import { SemanticCompressionProcessor } from '../processors/semanticCompressionProcessor.js';
|
||||
import { HistorySquashingProcessor } from '../processors/historySquashingProcessor.js';
|
||||
import { StateSnapshotProcessor } from '../processors/stateSnapshotProcessor.js';
|
||||
import { EmergencyTruncationProcessor } from '../processors/emergencyTruncationProcessor.js';
|
||||
|
||||
export function registerBuiltInProcessors() {
|
||||
ProcessorRegistry.register({
|
||||
id: 'ToolMaskingProcessor',
|
||||
schema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
processorId: { const: 'ToolMaskingProcessor' },
|
||||
options: {
|
||||
type: 'object',
|
||||
properties: { stringLengthThresholdTokens: { type: 'number' } },
|
||||
required: ['stringLengthThresholdTokens']
|
||||
}
|
||||
},
|
||||
required: ['processorId', 'options']
|
||||
},
|
||||
create: (env, opts) => new ToolMaskingProcessor(env, opts as any)
|
||||
});
|
||||
|
||||
ProcessorRegistry.register({
|
||||
id: 'BlobDegradationProcessor',
|
||||
schema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
processorId: { const: 'BlobDegradationProcessor' },
|
||||
options: { type: 'object' }
|
||||
},
|
||||
required: ['processorId']
|
||||
},
|
||||
create: (env) => new BlobDegradationProcessor(env)
|
||||
});
|
||||
|
||||
ProcessorRegistry.register({
|
||||
id: 'SemanticCompressionProcessor',
|
||||
schema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
processorId: { const: 'SemanticCompressionProcessor' },
|
||||
options: {
|
||||
type: 'object',
|
||||
properties: { nodeThresholdTokens: { type: 'number' } },
|
||||
required: ['nodeThresholdTokens']
|
||||
}
|
||||
},
|
||||
required: ['processorId', 'options']
|
||||
},
|
||||
create: (env, opts) => new SemanticCompressionProcessor(env, opts as any)
|
||||
});
|
||||
|
||||
ProcessorRegistry.register({
|
||||
id: 'HistorySquashingProcessor',
|
||||
schema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
processorId: { const: 'HistorySquashingProcessor' },
|
||||
options: {
|
||||
type: 'object',
|
||||
properties: { maxTokensPerNode: { type: 'number' } },
|
||||
required: ['maxTokensPerNode']
|
||||
}
|
||||
},
|
||||
required: ['processorId', 'options']
|
||||
},
|
||||
create: (env, opts) => new HistorySquashingProcessor(env, opts as any)
|
||||
});
|
||||
|
||||
ProcessorRegistry.register({
|
||||
id: 'StateSnapshotProcessor',
|
||||
schema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
processorId: { const: 'StateSnapshotProcessor' },
|
||||
options: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
model: { type: 'string' },
|
||||
systemInstruction: { type: 'string' },
|
||||
triggerDeficitTokens: { type: 'number' }
|
||||
}
|
||||
}
|
||||
},
|
||||
required: ['processorId']
|
||||
},
|
||||
create: (env, opts) => StateSnapshotProcessor.create(env, opts as any)
|
||||
});
|
||||
|
||||
ProcessorRegistry.register({
|
||||
id: 'EmergencyTruncationProcessor',
|
||||
schema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
processorId: { const: 'EmergencyTruncationProcessor' },
|
||||
options: { type: 'object' }
|
||||
},
|
||||
required: ['processorId']
|
||||
},
|
||||
create: (env, opts) => EmergencyTruncationProcessor.create(env, opts as any)
|
||||
});
|
||||
}
|
||||
|
||||
// Automatically register them upon import
|
||||
registerBuiltInProcessors();
|
||||
Reference in New Issue
Block a user