mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-12 11:00:51 -07:00
broken refactor
This commit is contained in:
@@ -28,8 +28,9 @@ class DummySyncProcessor implements ContextProcessor {
|
||||
readonly id = 'DummySync';
|
||||
readonly options = {};
|
||||
async process(editor: EpisodeEditor, _state: ContextAccountingState) {
|
||||
if (editor.targets.length === 0) return;
|
||||
editor.editEpisode(
|
||||
editor.episodes[0].id,
|
||||
editor.targets[0].episode.id,
|
||||
'DUMMY_EDIT',
|
||||
(draft: unknown) => {
|
||||
(draft as Record<string, unknown>)['dummyModified'] = true;
|
||||
@@ -47,8 +48,9 @@ class DummyAsyncProcessor implements ContextProcessor {
|
||||
readonly id = 'DummyAsync';
|
||||
readonly options = {};
|
||||
async process(editor: EpisodeEditor, _state: ContextAccountingState) {
|
||||
if (editor.targets.length === 0) return;
|
||||
editor.editEpisode(
|
||||
editor.episodes[0].id,
|
||||
editor.targets[0].episode.id,
|
||||
'DUMMY_EDIT',
|
||||
(draft: unknown) => {
|
||||
(draft as Record<string, unknown>)['dummyAsyncModified'] = true;
|
||||
@@ -285,7 +287,7 @@ describe('PipelineOrchestrator (Component)', () => {
|
||||
const episodes = [createDummyEpisode('1', 'USER_PROMPT', [])];
|
||||
|
||||
// Emit the trigger
|
||||
eventBus.emitConsolidationNeeded({ episodes, targetDeficit: 100 });
|
||||
eventBus.emitConsolidationNeeded({ episodes, targetDeficit: 100, targetNodeIds: new Set() });
|
||||
|
||||
expect(executeSpy).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -15,6 +15,7 @@ import type {
|
||||
import type { ProcessorRegistry } from './registry.js';
|
||||
import { debugLogger } from '../../utils/debugLogger.js';
|
||||
import { EpisodeEditor } from '../ir/episodeEditor.js';
|
||||
import { isUserPrompt } from '../ir/graphUtils.js';
|
||||
|
||||
export class PipelineOrchestrator {
|
||||
private activeTimers: NodeJS.Timeout[] = [];
|
||||
@@ -78,6 +79,20 @@ export class PipelineOrchestrator {
|
||||
isBudgetSatisfied: false,
|
||||
deficitTokens: event.targetDeficit,
|
||||
protectedEpisodeIds: new Set(),
|
||||
targetNodeIds: event.targetNodeIds,
|
||||
};
|
||||
void this.executePipelineAsync(pipeline, event.episodes, state);
|
||||
});
|
||||
} else if (trigger === 'on_turn') {
|
||||
this.eventBus.onChunkReceived((event) => {
|
||||
const state: ContextAccountingState = {
|
||||
currentTokens: 0,
|
||||
retainedTokens: this.config.budget.retainedTokens,
|
||||
maxTokens: this.config.budget.maxTokens,
|
||||
isBudgetSatisfied: false,
|
||||
deficitTokens: 0,
|
||||
protectedEpisodeIds: new Set(),
|
||||
targetNodeIds: event.targetNodeIds,
|
||||
};
|
||||
void this.executePipelineAsync(pipeline, event.episodes, state);
|
||||
});
|
||||
@@ -130,7 +145,7 @@ export class PipelineOrchestrator {
|
||||
'Orchestrator',
|
||||
`Executing processor: ${procDef.processorId}`,
|
||||
);
|
||||
const editor = new EpisodeEditor(currentEpisodes);
|
||||
const editor = new EpisodeEditor(currentEpisodes, state.targetNodeIds);
|
||||
await processor.process(editor, state);
|
||||
currentEpisodes = editor.getFinalEpisodes();
|
||||
} catch (error) {
|
||||
@@ -171,7 +186,7 @@ export class PipelineOrchestrator {
|
||||
`Executing processor: ${procDef.processorId} (async)`,
|
||||
);
|
||||
|
||||
const editor = new EpisodeEditor(currentEpisodes);
|
||||
const editor = new EpisodeEditor(currentEpisodes, state.targetNodeIds);
|
||||
await processor.process(editor, state);
|
||||
currentEpisodes = editor.getFinalEpisodes();
|
||||
|
||||
@@ -190,7 +205,7 @@ export class PipelineOrchestrator {
|
||||
const ep = mutation.episode!;
|
||||
let fallbackText = '';
|
||||
if (ep.yield?.text) fallbackText = ep.yield.text;
|
||||
else if (ep.trigger?.type === 'USER_PROMPT') {
|
||||
else if (isUserPrompt(ep.trigger)) {
|
||||
const firstPart = ep.trigger.semanticParts?.[0];
|
||||
if (firstPart) {
|
||||
fallbackText =
|
||||
|
||||
Reference in New Issue
Block a user