perf(server): stop retaining unused OpenCode tool history (#9684)
This commit is contained in:
1 parent
2263e13fda
commit
f2e3764c25
1 file changed
-28
@@ -338,7 +338,6 @@ interface OpenCodeSessionContext {
|
||||
readonly partById: Map<string, Part>;
|
||||
readonly emittedTextByPartId: Map<string, string>;
|
||||
readonly completedAssistantPartIds: Set<string>;
|
||||
readonly turns: Array<OpenCodeTurnSnapshot>;
|
||||
activeTurnId: TurnId | undefined;
|
||||
activeAgent: string | undefined;
|
||||
activeVariant: string | undefined;
|
||||
@@ -476,31 +475,6 @@ function mapPermissionDecision(reply: "once" | "always" | "reject"): string {
|
||||
}
|
||||
}
|
||||
|
||||
function resolveTurnSnapshot(
|
||||
context: OpenCodeSessionContext,
|
||||
turnId: TurnId,
|
||||
): OpenCodeTurnSnapshot {
|
||||
const existing = context.turns.find((turn) => turn.id === turnId);
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
|
||||
const created: OpenCodeTurnSnapshot = { id: turnId, items: [] };
|
||||
context.turns.push(created);
|
||||
return created;
|
||||
}
|
||||
|
||||
function appendTurnItem(
|
||||
context: OpenCodeSessionContext,
|
||||
turnId: TurnId | undefined,
|
||||
item: unknown,
|
||||
): void {
|
||||
if (!turnId) {
|
||||
return;
|
||||
}
|
||||
resolveTurnSnapshot(context, turnId).items.push(item);
|
||||
}
|
||||
|
||||
const ensureSessionContext = Effect.fn("ensureSessionContext")(function* (
|
||||
sessions: ReadonlyMap<ThreadId, OpenCodeSessionContext>,
|
||||
threadId: ThreadId,
|
||||
@@ -2365,7 +2339,6 @@ export function makeOpenCodeAdapter(
|
||||
: "item.updated",
|
||||
payload,
|
||||
};
|
||||
appendTurnItem(context, turnId, part);
|
||||
yield* emit(runtimeEvent);
|
||||
}
|
||||
break;
|
||||
@@ -2853,7 +2826,6 @@ export function makeOpenCodeAdapter(
|
||||
emittedTextByPartId: new Map(),
|
||||
messageRoleById: new Map(),
|
||||
completedAssistantPartIds: new Set(),
|
||||
turns: [],
|
||||
activeTurnId: undefined,
|
||||
activeAgent: undefined,
|
||||
activeVariant: undefined,
|
||||
|
||||
Reference in new issue
Block a user