mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-28 09:23:08 +08:00
Add benchmark results and tests for LSP graph builder and staged search
- Introduced a new benchmark results file for performance comparison on 2026-02-09. - Added a test for LspGraphBuilder to ensure it does not expand nodes at maximum depth. - Created a test for the staged search pipeline to validate fallback behavior when stage 1 returns empty results.
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
type CliSessionResumeStrategy
|
||||
} from './cli-session-command-builder.js';
|
||||
import { getCliSessionPolicy } from './cli-session-policy.js';
|
||||
import { appendCliSessionAudit } from './cli-session-audit.js';
|
||||
|
||||
export interface CliSession {
|
||||
sessionKey: string;
|
||||
@@ -147,10 +148,29 @@ export class CliSessionManager {
|
||||
private projectRoot: string;
|
||||
private emitter = new EventEmitter();
|
||||
private maxBufferBytes: number;
|
||||
private idleTimeoutMs: number;
|
||||
private reaperTimer: NodeJS.Timeout | null = null;
|
||||
|
||||
constructor(projectRoot: string) {
|
||||
this.projectRoot = projectRoot;
|
||||
this.maxBufferBytes = getCliSessionPolicy().maxBufferBytes;
|
||||
const policy = getCliSessionPolicy();
|
||||
this.maxBufferBytes = policy.maxBufferBytes;
|
||||
this.idleTimeoutMs = policy.idleTimeoutMs;
|
||||
|
||||
if (this.idleTimeoutMs > 0) {
|
||||
this.reaperTimer = setInterval(() => {
|
||||
const reaped = this.closeIdleSessions(this.idleTimeoutMs);
|
||||
for (const sessionKey of reaped) {
|
||||
appendCliSessionAudit({
|
||||
type: 'session_idle_reaped',
|
||||
timestamp: nowIso(),
|
||||
projectRoot: this.projectRoot,
|
||||
sessionKey,
|
||||
});
|
||||
}
|
||||
}, 60_000);
|
||||
this.reaperTimer.unref?.();
|
||||
}
|
||||
}
|
||||
|
||||
listSessions(): CliSession[] {
|
||||
@@ -354,14 +374,14 @@ export class CliSessionManager {
|
||||
return () => this.emitter.off('output', handler);
|
||||
}
|
||||
|
||||
closeIdleSessions(idleTimeoutMs: number): number {
|
||||
if (idleTimeoutMs <= 0) return 0;
|
||||
closeIdleSessions(idleTimeoutMs: number): string[] {
|
||||
if (idleTimeoutMs <= 0) return [];
|
||||
const now = Date.now();
|
||||
let closed = 0;
|
||||
const closed: string[] = [];
|
||||
for (const s of this.sessions.values()) {
|
||||
if (now - s.lastActivityAt >= idleTimeoutMs) {
|
||||
this.close(s.sessionKey);
|
||||
closed += 1;
|
||||
closed.push(s.sessionKey);
|
||||
}
|
||||
}
|
||||
return closed;
|
||||
|
||||
Reference in New Issue
Block a user