mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-16 06:43:07 -07:00
continue tidying
This commit is contained in:
@@ -5,8 +5,7 @@
|
||||
*/
|
||||
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
|
||||
import { testTruncateProfile } from './sidecar/testProfile.js';
|
||||
import { testTruncateProfile } from './testing/testProfile.js';
|
||||
import {
|
||||
createSyntheticHistory,
|
||||
createMockContextConfig,
|
||||
|
||||
@@ -49,9 +49,11 @@ export function isUserPrompt(node: IrNode): node is UserPrompt {
|
||||
export function isSystemEvent(node: IrNode): node is SystemEvent {
|
||||
return node.type === 'SYSTEM_EVENT';
|
||||
}
|
||||
|
||||
export function isSnapshot(node: IrNode): node is Snapshot {
|
||||
return node.type === 'SNAPSHOT';
|
||||
}
|
||||
|
||||
export function isRollingSummary(node: IrNode): node is RollingSummary {
|
||||
return node.type === 'ROLLING_SUMMARY';
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import { ContextTracer } from '../tracer.js';
|
||||
import { ContextEventBus } from '../eventBus.js';
|
||||
import { InMemoryFileSystem } from '../system/InMemoryFileSystem.js';
|
||||
import { DeterministicIdGenerator } from '../system/DeterministicIdGenerator.js';
|
||||
|
||||
import { createMockLlmClient } from '../testing/contextTestUtils.js';
|
||||
|
||||
describe('ContextEnvironmentImpl', () => {
|
||||
|
||||
@@ -13,9 +13,7 @@ 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';
|
||||
|
||||
import { LiveInbox } from './inbox.js';
|
||||
|
||||
import { IrNodeBehaviorRegistry } from '../ir/behaviorRegistry.js';
|
||||
import { registerBuiltInBehaviors } from '../ir/builtinBehaviors.js';
|
||||
import { IrMapper } from '../ir/mapper.js';
|
||||
|
||||
@@ -136,7 +136,6 @@ describe('PipelineOrchestrator (Component)', () => {
|
||||
[
|
||||
{
|
||||
name: 'SyncPipe',
|
||||
execution: 'blocking',
|
||||
triggers: ['new_message'],
|
||||
processors: [
|
||||
{ processorId: 'ModifyingProcessor' } as unknown as ProcessorConfig,
|
||||
@@ -154,8 +153,8 @@ describe('PipelineOrchestrator (Component)', () => {
|
||||
registry,
|
||||
);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
expect(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(orchestrator as any).instantiatedProcessors.has('ModifyingProcessor'),
|
||||
).toBe(true);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
@@ -168,7 +167,6 @@ describe('PipelineOrchestrator (Component)', () => {
|
||||
const config = createConfig([
|
||||
{
|
||||
name: 'ThrowPipe',
|
||||
execution: 'blocking',
|
||||
triggers: ['new_message'],
|
||||
processors: [
|
||||
{ processorId: 'DoesNotExist' } as unknown as ProcessorConfig,
|
||||
@@ -186,7 +184,6 @@ describe('PipelineOrchestrator (Component)', () => {
|
||||
const config = createConfig([
|
||||
{
|
||||
name: 'SyncPipe',
|
||||
execution: 'blocking',
|
||||
triggers: ['new_message'],
|
||||
processors: [
|
||||
{ processorId: 'ModifyingProcessor' } as unknown as ProcessorConfig,
|
||||
@@ -235,7 +232,6 @@ describe('PipelineOrchestrator (Component)', () => {
|
||||
const config = createConfig([
|
||||
{
|
||||
name: 'ThrowPipe',
|
||||
execution: 'blocking',
|
||||
triggers: ['new_message'],
|
||||
processors: [
|
||||
{ processorId: 'ThrowingProcessor' } as unknown as ProcessorConfig,
|
||||
@@ -272,39 +268,6 @@ describe('PipelineOrchestrator (Component)', () => {
|
||||
expect(result).toStrictEqual(nodes);
|
||||
});
|
||||
|
||||
it('automatically triggers background pipelines via EventBus', () => {
|
||||
const config = createConfig([
|
||||
{
|
||||
name: 'PressureRelief',
|
||||
execution: 'background',
|
||||
triggers: ['retained_exceeded'],
|
||||
processors: [
|
||||
{ processorId: 'ModifyingProcessor' } as unknown as ProcessorConfig,
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
// Spy on the private method to see if the trigger fires it
|
||||
const executeSpy = vi.spyOn(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
PipelineOrchestrator.prototype as any,
|
||||
'executePipelineAsync',
|
||||
);
|
||||
|
||||
new PipelineOrchestrator(config, env, eventBus, env.tracer, registry);
|
||||
|
||||
const nodes = [createDummyNode('1', 'USER_PROMPT')];
|
||||
|
||||
// Emit the trigger
|
||||
eventBus.emitConsolidationNeeded({
|
||||
nodes,
|
||||
targetDeficit: 100,
|
||||
targetNodeIds: new Set(),
|
||||
});
|
||||
|
||||
expect(executeSpy).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('automatically dispatches workers when matching EventBus events occur', async () => {
|
||||
const config = createConfig([], [{ workerId: 'MockWorker' }]);
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ export const defaultSidecarProfile: SidecarConfig = {
|
||||
{
|
||||
name: 'Immediate Sanitization',
|
||||
triggers: ['new_message'],
|
||||
execution: 'blocking',
|
||||
processors: [
|
||||
{
|
||||
processorId: 'ToolMaskingProcessor',
|
||||
@@ -37,9 +36,8 @@ export const defaultSidecarProfile: SidecarConfig = {
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Deep Background Compression',
|
||||
triggers: [{ type: 'timer', intervalMs: 5000 }, 'retained_exceeded'],
|
||||
execution: 'background',
|
||||
name: 'Normalization',
|
||||
triggers: ['retained_exceeded'],
|
||||
processors: [
|
||||
{
|
||||
processorId: 'NodeTruncationProcessor',
|
||||
@@ -54,7 +52,6 @@ export const defaultSidecarProfile: SidecarConfig = {
|
||||
{
|
||||
name: 'Emergency Backstop',
|
||||
triggers: ['gc_backstop'],
|
||||
execution: 'blocking',
|
||||
processors: [
|
||||
{
|
||||
processorId: 'StateSnapshotProcessor',
|
||||
|
||||
@@ -78,10 +78,6 @@ export function getSidecarConfigSchema(registry: SidecarRegistry) {
|
||||
],
|
||||
},
|
||||
},
|
||||
execution: {
|
||||
type: 'string',
|
||||
enum: ['blocking', 'background'],
|
||||
},
|
||||
processors: {
|
||||
type: 'array',
|
||||
items: {
|
||||
|
||||
@@ -44,7 +44,6 @@ export type PipelineTrigger =
|
||||
export interface PipelineDef {
|
||||
name: string;
|
||||
triggers: PipelineTrigger[];
|
||||
execution: 'blocking' | 'background';
|
||||
processors: ProcessorConfig[];
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ describe('System Lifecycle Golden Tests', () => {
|
||||
pipelines: [
|
||||
{
|
||||
name: 'Pressure Relief', // Emits from eventBus 'retained_exceeded'
|
||||
execution: 'background',
|
||||
triggers: ['retained_exceeded'],
|
||||
processors: [
|
||||
{ processorId: 'BlobDegradationProcessor' },
|
||||
@@ -49,7 +48,6 @@ describe('System Lifecycle Golden Tests', () => {
|
||||
},
|
||||
{
|
||||
name: 'Immediate Sanitization', // The magic string the projector is hardcoded to use
|
||||
execution: 'blocking',
|
||||
triggers: ['retained_exceeded'],
|
||||
processors: [
|
||||
{ processorId: 'HistoryTruncationProcessor', options: {} },
|
||||
|
||||
+1
-2
@@ -3,7 +3,7 @@
|
||||
* Copyright 2026 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import type { SidecarConfig } from './types.js';
|
||||
import type { SidecarConfig } from '../sidecar/types.js';
|
||||
|
||||
export const testTruncateProfile: SidecarConfig = {
|
||||
budget: {
|
||||
@@ -14,7 +14,6 @@ export const testTruncateProfile: SidecarConfig = {
|
||||
{
|
||||
name: 'Emergency Backstop (Truncate Only)',
|
||||
triggers: ['gc_backstop', 'retained_exceeded'],
|
||||
execution: 'blocking',
|
||||
processors: [{ processorId: 'HistoryTruncationProcessor', options: {} }],
|
||||
},
|
||||
],
|
||||
Reference in New Issue
Block a user