From 8fd439678bf52e104a0d62b1f0a285e64fe4f0ad Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 9 Apr 2026 03:35:12 +0000 Subject: [PATCH] lints step 1 --- packages/core/src/context/contextManager.ts | 2 +- packages/core/src/context/historyObserver.ts | 4 ++-- packages/core/src/context/ir/behaviorRegistry.ts | 5 +++++ packages/core/src/context/ir/builtinBehaviors.ts | 5 +++++ packages/core/src/context/ir/fromIr.ts | 5 +++++ packages/core/src/context/ir/mapper.ts | 5 +++++ .../context/processors/blobDegradationProcessor.test.ts | 6 +++--- .../context/processors/nodeDistillationProcessor.test.ts | 4 ++-- .../context/processors/nodeTruncationProcessor.test.ts | 8 +++----- .../context/processors/rollingSummaryProcessor.test.ts | 5 +++++ .../src/context/processors/stateSnapshotProcessor.test.ts | 8 ++++---- .../src/context/processors/toolMaskingProcessor.test.ts | 4 ++-- packages/core/src/context/sidecar/environmentImpl.test.ts | 5 +++++ packages/core/src/context/sidecar/inbox.test.ts | 5 +++++ packages/core/src/context/sidecar/orchestrator.ts | 5 ++--- packages/core/src/context/sidecar/registry.test.ts | 5 +++++ packages/core/src/context/testing/contextTestUtils.ts | 3 +-- 17 files changed, 60 insertions(+), 24 deletions(-) diff --git a/packages/core/src/context/contextManager.ts b/packages/core/src/context/contextManager.ts index 5ae2616bb2..6fa3b400ee 100644 --- a/packages/core/src/context/contextManager.ts +++ b/packages/core/src/context/contextManager.ts @@ -12,7 +12,7 @@ import type { ContextEventBus } from './eventBus.js'; import type { ContextTracer } from './tracer.js'; import type { ContextEnvironment } from './sidecar/environment.js'; import type { SidecarConfig } from './sidecar/types.js'; -import { PipelineOrchestrator } from './sidecar/orchestrator.js'; +import type { PipelineOrchestrator } from './sidecar/orchestrator.js'; import { HistoryObserver } from './historyObserver.js'; import { IrProjector } from './ir/projector.js'; diff --git a/packages/core/src/context/historyObserver.ts b/packages/core/src/context/historyObserver.ts index 7fef1f26fc..89fa9caa45 100644 --- a/packages/core/src/context/historyObserver.ts +++ b/packages/core/src/context/historyObserver.ts @@ -8,7 +8,7 @@ import type { AgentChatHistory, HistoryEvent, } from '../core/agentChatHistory.js'; -import { IrMapper } from './ir/mapper.js'; +import type { IrMapper } from './ir/mapper.js'; import type { ContextTokenCalculator } from './utils/contextTokenCalculator.js'; import type { ContextEventBus } from './eventBus.js'; import type { ContextTracer } from './tracer.js'; @@ -48,7 +48,7 @@ export class HistoryObserver { this.tokenCalculator, ); - const nodes: Array = []; + const nodes: ConcreteNode[] = []; for (const ep of pristineEpisodes) { if (ep.concreteNodes) { for (const child of ep.concreteNodes) { diff --git a/packages/core/src/context/ir/behaviorRegistry.ts b/packages/core/src/context/ir/behaviorRegistry.ts index ea39644fcc..0148a662de 100644 --- a/packages/core/src/context/ir/behaviorRegistry.ts +++ b/packages/core/src/context/ir/behaviorRegistry.ts @@ -1,3 +1,8 @@ +/** + * @license + * Copyright 2026 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ import type { Content, Part } from '@google/genai'; import type { ConcreteNode } from './types.js'; diff --git a/packages/core/src/context/ir/builtinBehaviors.ts b/packages/core/src/context/ir/builtinBehaviors.ts index 8840b7d00a..e02042d826 100644 --- a/packages/core/src/context/ir/builtinBehaviors.ts +++ b/packages/core/src/context/ir/builtinBehaviors.ts @@ -1,3 +1,8 @@ +/** + * @license + * Copyright 2026 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ import type { Part } from '@google/genai'; import type { IrNodeBehavior, IrNodeBehaviorRegistry } from './behaviorRegistry.js'; import type { diff --git a/packages/core/src/context/ir/fromIr.ts b/packages/core/src/context/ir/fromIr.ts index 479794a44d..4f0ccfcd79 100644 --- a/packages/core/src/context/ir/fromIr.ts +++ b/packages/core/src/context/ir/fromIr.ts @@ -1,3 +1,8 @@ +/** + * @license + * Copyright 2026 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ import type { Content, Part } from '@google/genai'; import type { ConcreteNode } from './types.js'; import type { IrSerializationWriter, IrNodeBehaviorRegistry } from './behaviorRegistry.js'; diff --git a/packages/core/src/context/ir/mapper.ts b/packages/core/src/context/ir/mapper.ts index 641929acce..e301847a4b 100644 --- a/packages/core/src/context/ir/mapper.ts +++ b/packages/core/src/context/ir/mapper.ts @@ -1,3 +1,8 @@ +/** + * @license + * Copyright 2026 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ import type { Content } from '@google/genai'; import type { Episode, ConcreteNode } from './types.js'; import { toIr } from './toIr.js'; diff --git a/packages/core/src/context/processors/blobDegradationProcessor.test.ts b/packages/core/src/context/processors/blobDegradationProcessor.test.ts index 398d28dc6f..b6560b4bc3 100644 --- a/packages/core/src/context/processors/blobDegradationProcessor.test.ts +++ b/packages/core/src/context/processors/blobDegradationProcessor.test.ts @@ -37,7 +37,7 @@ describe('BlobDegradationProcessor', () => { const targets = [prompt]; const result = await processor.process({ - buffer: {} as any as any, + buffer: {} as any, targets, inbox: {} as any, }); @@ -82,7 +82,7 @@ describe('BlobDegradationProcessor', () => { const targets = [prompt]; const result = await processor.process({ - buffer: {} as any as any, + buffer: {} as any, targets, inbox: {} as any, }); @@ -102,7 +102,7 @@ describe('BlobDegradationProcessor', () => { const targets: any[] = []; const result = await processor.process({ - buffer: {} as any as any, + buffer: {} as any, targets, inbox: {} as any, }); diff --git a/packages/core/src/context/processors/nodeDistillationProcessor.test.ts b/packages/core/src/context/processors/nodeDistillationProcessor.test.ts index 510da809a3..3154faf73e 100644 --- a/packages/core/src/context/processors/nodeDistillationProcessor.test.ts +++ b/packages/core/src/context/processors/nodeDistillationProcessor.test.ts @@ -46,7 +46,7 @@ describe('NodeDistillationProcessor', () => { const targets = [prompt, thought, tool]; const result = await processor.process({ - buffer: {} as any as any, + buffer: {} as any, targets, inbox: {} as any, }); @@ -99,7 +99,7 @@ describe('NodeDistillationProcessor', () => { const targets = [prompt, thought]; const result = await processor.process({ - buffer: {} as any as any, + buffer: {} as any, targets, inbox: {} as any, }); diff --git a/packages/core/src/context/processors/nodeTruncationProcessor.test.ts b/packages/core/src/context/processors/nodeTruncationProcessor.test.ts index 0b523261fe..1ca6d9d7d7 100644 --- a/packages/core/src/context/processors/nodeTruncationProcessor.test.ts +++ b/packages/core/src/context/processors/nodeTruncationProcessor.test.ts @@ -48,7 +48,7 @@ describe('NodeTruncationProcessor', () => { const targets = [prompt, thought, yieldNode]; const result = await processor.process({ - buffer: {} as any as any, + buffer: {} as any, targets, inbox: {} as any, }); @@ -80,9 +80,7 @@ describe('NodeTruncationProcessor', () => { const mockTokenCalculator = new ContextTokenCalculator(1, env.behaviorRegistry) as any; mockTokenCalculator.tokensToChars = vi.fn().mockReturnValue(100); - mockTokenCalculator.estimateTokensForString = vi.fn((text: string) => { - return text.length; - }); + mockTokenCalculator.estimateTokensForString = vi.fn((text: string) => text.length); mockTokenCalculator.estimateTokensForParts = vi.fn(() => 5); mockTokenCalculator.getTokenCost = vi.fn(() => 5); @@ -106,7 +104,7 @@ describe('NodeTruncationProcessor', () => { const targets = [prompt, thought]; const result = await processor.process({ - buffer: {} as any as any, + buffer: {} as any, targets, inbox: {} as any, }); diff --git a/packages/core/src/context/processors/rollingSummaryProcessor.test.ts b/packages/core/src/context/processors/rollingSummaryProcessor.test.ts index 224a33368c..e56a4bfc12 100644 --- a/packages/core/src/context/processors/rollingSummaryProcessor.test.ts +++ b/packages/core/src/context/processors/rollingSummaryProcessor.test.ts @@ -1,3 +1,8 @@ +/** + * @license + * Copyright 2026 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ import { describe, it, expect } from 'vitest'; import { RollingSummaryProcessor } from './rollingSummaryProcessor.js'; import { createMockEnvironment, createDummyNode } from '../testing/contextTestUtils.js'; diff --git a/packages/core/src/context/processors/stateSnapshotProcessor.test.ts b/packages/core/src/context/processors/stateSnapshotProcessor.test.ts index c999fda5c3..360e3283cc 100644 --- a/packages/core/src/context/processors/stateSnapshotProcessor.test.ts +++ b/packages/core/src/context/processors/stateSnapshotProcessor.test.ts @@ -18,7 +18,7 @@ describe('StateSnapshotProcessor', () => { const targets = [createDummyNode('ep1', 'USER_PROMPT')]; const inbox = new InboxSnapshotImpl([]); - const result = await processor.process({ buffer: {} as any as any, targets, inbox }); + const result = await processor.process({ buffer: {} as any, targets, inbox }); expect(result).toBe(targets); // Strict equality }); @@ -46,7 +46,7 @@ describe('StateSnapshotProcessor', () => { } ]); - const result = await processor.process({ buffer: {} as any as any, targets, inbox }); + const result = await processor.process({ buffer: {} as any, targets, inbox }); // Should remove A and B, insert Snapshot, keep C expect(result.length).toBe(2); @@ -78,7 +78,7 @@ describe('StateSnapshotProcessor', () => { } ]); - const result = await processor.process({ buffer: {} as any as any, targets, inbox }); + const result = await processor.process({ buffer: {} as any, targets, inbox }); // Because deficit is 0, and Inbox was rejected, nothing should change expect(result.length).toBe(1); @@ -96,7 +96,7 @@ describe('StateSnapshotProcessor', () => { const targets = [nodeA, nodeB, nodeC]; const inbox = new InboxSnapshotImpl([]); - const result = await processor.process({ buffer: {} as any as any, targets, inbox }); + const result = await processor.process({ buffer: {} as any, targets, inbox }); // Should synthesize a new snapshot synchronously expect(env.llmClient.generateContent).toHaveBeenCalled(); diff --git a/packages/core/src/context/processors/toolMaskingProcessor.test.ts b/packages/core/src/context/processors/toolMaskingProcessor.test.ts index 8754bf1e36..d93df4d784 100644 --- a/packages/core/src/context/processors/toolMaskingProcessor.test.ts +++ b/packages/core/src/context/processors/toolMaskingProcessor.test.ts @@ -31,7 +31,7 @@ describe('ToolMaskingProcessor', () => { }); const result = await processor.process({ - buffer: {} as any as any, + buffer: {} as any, targets: [toolStep], inbox: {} as any, }); @@ -66,7 +66,7 @@ describe('ToolMaskingProcessor', () => { }); const result = await processor.process({ - buffer: {} as any as any, + buffer: {} as any, targets: [toolStep], inbox: {} as any, }); diff --git a/packages/core/src/context/sidecar/environmentImpl.test.ts b/packages/core/src/context/sidecar/environmentImpl.test.ts index 1998b91e61..d3b43b1674 100644 --- a/packages/core/src/context/sidecar/environmentImpl.test.ts +++ b/packages/core/src/context/sidecar/environmentImpl.test.ts @@ -1,3 +1,8 @@ +/** + * @license + * Copyright 2026 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ import { describe, it, expect } from 'vitest'; import { ContextEnvironmentImpl } from './environmentImpl.js'; import { ContextTracer } from '../tracer.js'; diff --git a/packages/core/src/context/sidecar/inbox.test.ts b/packages/core/src/context/sidecar/inbox.test.ts index e8690856b9..3c327d2198 100644 --- a/packages/core/src/context/sidecar/inbox.test.ts +++ b/packages/core/src/context/sidecar/inbox.test.ts @@ -1,3 +1,8 @@ +/** + * @license + * Copyright 2026 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ import { describe, it, expect } from 'vitest'; import { LiveInbox, InboxSnapshotImpl } from './inbox.js'; import { DeterministicIdGenerator } from '../system/DeterministicIdGenerator.js'; diff --git a/packages/core/src/context/sidecar/orchestrator.ts b/packages/core/src/context/sidecar/orchestrator.ts index 9ee1de48d7..8775b351d3 100644 --- a/packages/core/src/context/sidecar/orchestrator.ts +++ b/packages/core/src/context/sidecar/orchestrator.ts @@ -8,7 +8,7 @@ import type { ConcreteNode } from '../ir/types.js'; import type { ContextProcessor, ContextWorker, -} from '../pipeline.js'; + ContextWorkingBuffer } from '../pipeline.js'; import type { SidecarConfig, PipelineDef, PipelineTrigger } from './types.js'; import type { ContextEnvironment, @@ -18,13 +18,12 @@ import type { import type { SidecarRegistry } from './registry.js'; import { debugLogger } from '../../utils/debugLogger.js'; import { InboxSnapshotImpl } from './inbox.js'; -import type { ContextWorkingBuffer } from '../pipeline.js'; class ContextWorkingBufferImpl implements ContextWorkingBuffer { private readonly nodesMap: Map; constructor( - public readonly nodes: readonly ConcreteNode[], + readonly nodes: readonly ConcreteNode[], ) { this.nodesMap = new Map(nodes.map(n => [n.id, n])); } diff --git a/packages/core/src/context/sidecar/registry.test.ts b/packages/core/src/context/sidecar/registry.test.ts index 134ef1ee89..3969ed66ca 100644 --- a/packages/core/src/context/sidecar/registry.test.ts +++ b/packages/core/src/context/sidecar/registry.test.ts @@ -1,3 +1,8 @@ +/** + * @license + * Copyright 2026 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ import { describe, it, expect } from 'vitest'; import { SidecarRegistry } from './registry.js'; import type { ContextProcessorDef, ContextWorkerDef } from './registry.js'; diff --git a/packages/core/src/context/testing/contextTestUtils.ts b/packages/core/src/context/testing/contextTestUtils.ts index 265101c128..6191c1d685 100644 --- a/packages/core/src/context/testing/contextTestUtils.ts +++ b/packages/core/src/context/testing/contextTestUtils.ts @@ -21,9 +21,8 @@ import type { ConcreteNode, ToolExecution } from '../ir/types.js'; import type { ContextEnvironment } from '../sidecar/environment.js'; import type { Config } from '../../config/config.js'; import type { BaseLlmClient } from '../../core/baseLlmClient.js'; -import type { Content } from '@google/genai'; +import type { Content , GenerateContentResponse } from '@google/genai'; -import type { GenerateContentResponse } from '@google/genai'; /** * Creates a valid mock GenerateContentResponse with the provided text.