mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-12 02:37:45 +08:00
feat: add orchestrator execution engine, observability panel, and LSP document caching
Wire FlowExecutor into orchestrator routes for actual flow execution with
pause/resume/stop lifecycle management. Add CLI session audit system with
audit-routes backend and Observability tab in IssueHub frontend. Introduce
cli-session-mux for cross-workspace session routing and QueueSendToOrchestrator
UI component. Normalize frontend API response handling for { data: ... }
wrapper format and propagate projectPath through flow hooks.
In codex-lens, add per-server opened-document cache in StandaloneLspManager
to avoid redundant didOpen notifications (using didChange for updates), and
skip warmup delay for already-warmed LSP server instances in ChainSearchEngine.
This commit is contained in:
@@ -4,9 +4,9 @@
|
|||||||
// Dynamic header component for IssueHub
|
// Dynamic header component for IssueHub
|
||||||
|
|
||||||
import { useIntl } from 'react-intl';
|
import { useIntl } from 'react-intl';
|
||||||
import { AlertCircle, Radar, ListTodo, LayoutGrid } from 'lucide-react';
|
import { AlertCircle, Radar, ListTodo, LayoutGrid, Activity } from 'lucide-react';
|
||||||
|
|
||||||
type IssueTab = 'issues' | 'board' | 'queue' | 'discovery';
|
type IssueTab = 'issues' | 'board' | 'queue' | 'discovery' | 'observability';
|
||||||
|
|
||||||
interface IssueHubHeaderProps {
|
interface IssueHubHeaderProps {
|
||||||
currentTab: IssueTab;
|
currentTab: IssueTab;
|
||||||
@@ -37,6 +37,11 @@ export function IssueHubHeader({ currentTab }: IssueHubHeaderProps) {
|
|||||||
title: formatMessage({ id: 'issues.discovery.pageTitle' }),
|
title: formatMessage({ id: 'issues.discovery.pageTitle' }),
|
||||||
description: formatMessage({ id: 'issues.discovery.description' }),
|
description: formatMessage({ id: 'issues.discovery.description' }),
|
||||||
},
|
},
|
||||||
|
observability: {
|
||||||
|
icon: <Activity className="w-6 h-6 text-primary" />,
|
||||||
|
title: formatMessage({ id: 'issues.observability.pageTitle' }),
|
||||||
|
description: formatMessage({ id: 'issues.observability.description' }),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const config = tabConfig[currentTab];
|
const config = tabConfig[currentTab];
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import { useIntl } from 'react-intl';
|
|||||||
import { Button } from '@/components/ui/Button';
|
import { Button } from '@/components/ui/Button';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
|
|
||||||
export type IssueTab = 'issues' | 'board' | 'queue' | 'discovery';
|
// Keep in sync with IssueHubHeader/IssueHubPage
|
||||||
|
export type IssueTab = 'issues' | 'board' | 'queue' | 'discovery' | 'observability';
|
||||||
|
|
||||||
interface IssueHubTabsProps {
|
interface IssueHubTabsProps {
|
||||||
currentTab: IssueTab;
|
currentTab: IssueTab;
|
||||||
@@ -22,6 +23,7 @@ export function IssueHubTabs({ currentTab, onTabChange }: IssueHubTabsProps) {
|
|||||||
{ value: 'board', label: formatMessage({ id: 'issues.hub.tabs.board' }) },
|
{ value: 'board', label: formatMessage({ id: 'issues.hub.tabs.board' }) },
|
||||||
{ value: 'queue', label: formatMessage({ id: 'issues.hub.tabs.queue' }) },
|
{ value: 'queue', label: formatMessage({ id: 'issues.hub.tabs.queue' }) },
|
||||||
{ value: 'discovery', label: formatMessage({ id: 'issues.hub.tabs.discovery' }) },
|
{ value: 'discovery', label: formatMessage({ id: 'issues.hub.tabs.discovery' }) },
|
||||||
|
{ value: 'observability', label: formatMessage({ id: 'issues.hub.tabs.observability' }) },
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
294
ccw/frontend/src/components/issue/hub/ObservabilityPanel.tsx
Normal file
294
ccw/frontend/src/components/issue/hub/ObservabilityPanel.tsx
Normal file
@@ -0,0 +1,294 @@
|
|||||||
|
// ========================================
|
||||||
|
// Observability Panel
|
||||||
|
// ========================================
|
||||||
|
// Audit log UI for issue workbench (read-only)
|
||||||
|
|
||||||
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
|
import { useIntl } from 'react-intl';
|
||||||
|
import { ChevronDown, ChevronRight, RefreshCw } from 'lucide-react';
|
||||||
|
import { Card } from '@/components/ui/Card';
|
||||||
|
import { Badge } from '@/components/ui/Badge';
|
||||||
|
import { Button } from '@/components/ui/Button';
|
||||||
|
import { Input } from '@/components/ui/Input';
|
||||||
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/Select';
|
||||||
|
import { useCliSessionAudit } from '@/hooks';
|
||||||
|
import { cn } from '@/lib/utils';
|
||||||
|
import type { CliSessionAuditEvent, CliSessionAuditEventType } from '@/lib/api';
|
||||||
|
|
||||||
|
const EVENT_TYPES: CliSessionAuditEventType[] = [
|
||||||
|
'session_created',
|
||||||
|
'session_closed',
|
||||||
|
'session_send',
|
||||||
|
'session_execute',
|
||||||
|
'session_resize',
|
||||||
|
'session_share_created',
|
||||||
|
'session_share_revoked',
|
||||||
|
'session_idle_reaped',
|
||||||
|
];
|
||||||
|
|
||||||
|
function badgeVariantForType(type: CliSessionAuditEventType): 'default' | 'secondary' | 'destructive' | 'outline' | 'success' | 'warning' | 'info' {
|
||||||
|
switch (type) {
|
||||||
|
case 'session_created':
|
||||||
|
return 'success';
|
||||||
|
case 'session_closed':
|
||||||
|
case 'session_idle_reaped':
|
||||||
|
return 'secondary';
|
||||||
|
case 'session_execute':
|
||||||
|
return 'info';
|
||||||
|
case 'session_send':
|
||||||
|
case 'session_resize':
|
||||||
|
return 'outline';
|
||||||
|
case 'session_share_created':
|
||||||
|
return 'warning';
|
||||||
|
case 'session_share_revoked':
|
||||||
|
return 'secondary';
|
||||||
|
default:
|
||||||
|
return 'default';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function stableEventKey(ev: CliSessionAuditEvent, index: number): string {
|
||||||
|
return `${ev.timestamp}|${ev.type}|${ev.sessionKey ?? ''}|${index}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ObservabilityPanel() {
|
||||||
|
const { formatMessage } = useIntl();
|
||||||
|
|
||||||
|
const [q, setQ] = useState('');
|
||||||
|
const [sessionKey, setSessionKey] = useState('');
|
||||||
|
const [type, setType] = useState<string>('');
|
||||||
|
const [limit, setLimit] = useState<number>(200);
|
||||||
|
const [offset, setOffset] = useState<number>(0);
|
||||||
|
const [expandedKey, setExpandedKey] = useState<string | null>(null);
|
||||||
|
|
||||||
|
// Reset paging when filters change
|
||||||
|
useEffect(() => {
|
||||||
|
setOffset(0);
|
||||||
|
}, [q, sessionKey, type, limit]);
|
||||||
|
|
||||||
|
const query = useCliSessionAudit({
|
||||||
|
q: q.trim() || undefined,
|
||||||
|
sessionKey: sessionKey.trim() || undefined,
|
||||||
|
type: type ? (type as CliSessionAuditEventType) : undefined,
|
||||||
|
limit,
|
||||||
|
offset,
|
||||||
|
});
|
||||||
|
|
||||||
|
const events = query.data?.data.events ?? [];
|
||||||
|
const total = query.data?.data.total ?? 0;
|
||||||
|
const hasMore = query.data?.data.hasMore ?? false;
|
||||||
|
|
||||||
|
const headerRight = useMemo(() => {
|
||||||
|
const start = total === 0 ? 0 : offset + 1;
|
||||||
|
const end = Math.min(total, offset + limit);
|
||||||
|
return `${start}-${end} / ${total}`;
|
||||||
|
}, [limit, offset, total]);
|
||||||
|
|
||||||
|
const handleRefresh = async () => {
|
||||||
|
try {
|
||||||
|
await query.refetch();
|
||||||
|
} catch (e) {
|
||||||
|
// Errors are surfaced by query.error
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-4">
|
||||||
|
<Card className="p-4">
|
||||||
|
<div className="flex flex-col gap-3">
|
||||||
|
<div className="flex items-center justify-between gap-3">
|
||||||
|
<div className="text-sm font-semibold text-foreground">
|
||||||
|
{formatMessage({ id: 'issues.observability.audit.title' })}
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="text-xs text-muted-foreground font-mono">
|
||||||
|
{headerRight}
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={handleRefresh}
|
||||||
|
disabled={query.isFetching}
|
||||||
|
className="gap-2"
|
||||||
|
>
|
||||||
|
<RefreshCw className={cn('h-4 w-4', query.isFetching && 'animate-spin')} />
|
||||||
|
{formatMessage({ id: 'common.actions.refresh' })}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-4 gap-3">
|
||||||
|
<div className="md:col-span-2">
|
||||||
|
<label className="block text-xs font-medium text-muted-foreground mb-1">
|
||||||
|
{formatMessage({ id: 'issues.observability.filters.search' })}
|
||||||
|
</label>
|
||||||
|
<Input
|
||||||
|
value={q}
|
||||||
|
onChange={(e) => setQ(e.target.value)}
|
||||||
|
placeholder={formatMessage({ id: 'issues.observability.filters.searchPlaceholder' })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label className="block text-xs font-medium text-muted-foreground mb-1">
|
||||||
|
{formatMessage({ id: 'issues.observability.filters.sessionKey' })}
|
||||||
|
</label>
|
||||||
|
<Input
|
||||||
|
value={sessionKey}
|
||||||
|
onChange={(e) => setSessionKey(e.target.value)}
|
||||||
|
placeholder={formatMessage({ id: 'issues.observability.filters.sessionKeyPlaceholder' })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label className="block text-xs font-medium text-muted-foreground mb-1">
|
||||||
|
{formatMessage({ id: 'issues.observability.filters.type' })}
|
||||||
|
</label>
|
||||||
|
<Select value={type} onValueChange={(v) => setType(v)}>
|
||||||
|
<SelectTrigger>
|
||||||
|
<SelectValue placeholder={formatMessage({ id: 'issues.observability.filters.typeAll' })} />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="">{formatMessage({ id: 'issues.observability.filters.typeAll' })}</SelectItem>
|
||||||
|
{EVENT_TYPES.map((t) => (
|
||||||
|
<SelectItem key={t} value={t}>
|
||||||
|
{t}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<label className="block text-xs font-medium text-muted-foreground">
|
||||||
|
{formatMessage({ id: 'issues.observability.filters.limit' })}
|
||||||
|
</label>
|
||||||
|
<Select value={String(limit)} onValueChange={(v) => setLimit(parseInt(v, 10))}>
|
||||||
|
<SelectTrigger className="w-[140px]">
|
||||||
|
<SelectValue />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{[50, 100, 200, 500, 1000].map((n) => (
|
||||||
|
<SelectItem key={n} value={String(n)}>{n}</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => setOffset(Math.max(0, offset - limit))}
|
||||||
|
disabled={offset === 0 || query.isFetching}
|
||||||
|
>
|
||||||
|
{formatMessage({ id: 'common.actions.previous' })}
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => setOffset(offset + limit)}
|
||||||
|
disabled={!hasMore || query.isFetching}
|
||||||
|
>
|
||||||
|
{formatMessage({ id: 'common.actions.next' })}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
|
||||||
|
{query.error && (
|
||||||
|
<Card className="p-6 border-destructive/50 bg-destructive/5">
|
||||||
|
<div className="text-sm text-destructive">
|
||||||
|
{(query.error as Error).message || formatMessage({ id: 'issues.observability.error' })}
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{!query.isLoading && events.length === 0 && (
|
||||||
|
<Card className="p-10 text-center text-muted-foreground">
|
||||||
|
{formatMessage({ id: 'issues.observability.empty' })}
|
||||||
|
</Card>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{events.length > 0 && (
|
||||||
|
<Card className="p-0 overflow-hidden">
|
||||||
|
<div className="px-4 py-2 border-b border-border bg-card/50 text-xs font-medium text-muted-foreground grid grid-cols-12 gap-3">
|
||||||
|
<div className="col-span-3">{formatMessage({ id: 'issues.observability.table.timestamp' })}</div>
|
||||||
|
<div className="col-span-2">{formatMessage({ id: 'issues.observability.table.type' })}</div>
|
||||||
|
<div className="col-span-3">{formatMessage({ id: 'issues.observability.table.sessionKey' })}</div>
|
||||||
|
<div className="col-span-2">{formatMessage({ id: 'issues.observability.table.tool' })}</div>
|
||||||
|
<div className="col-span-2">{formatMessage({ id: 'issues.observability.table.resumeKey' })}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="divide-y divide-border">
|
||||||
|
{events.map((ev, index) => {
|
||||||
|
const key = stableEventKey(ev, index);
|
||||||
|
const expanded = expandedKey === key;
|
||||||
|
return (
|
||||||
|
<div key={key} className="px-4 py-2">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="w-full text-left grid grid-cols-12 gap-3 items-center hover:bg-muted/40 rounded-md px-2 py-2"
|
||||||
|
onClick={() => setExpandedKey(expanded ? null : key)}
|
||||||
|
>
|
||||||
|
<div className="col-span-3 flex items-center gap-2 min-w-0">
|
||||||
|
{expanded ? (
|
||||||
|
<ChevronDown className="h-4 w-4 text-muted-foreground shrink-0" />
|
||||||
|
) : (
|
||||||
|
<ChevronRight className="h-4 w-4 text-muted-foreground shrink-0" />
|
||||||
|
)}
|
||||||
|
<span className="font-mono text-xs text-foreground truncate">
|
||||||
|
{ev.timestamp}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div className="col-span-2">
|
||||||
|
<Badge variant={badgeVariantForType(ev.type)} className="font-mono text-xs">
|
||||||
|
{ev.type}
|
||||||
|
</Badge>
|
||||||
|
</div>
|
||||||
|
<div className="col-span-3 font-mono text-xs text-muted-foreground truncate">
|
||||||
|
{ev.sessionKey || '-'}
|
||||||
|
</div>
|
||||||
|
<div className="col-span-2 font-mono text-xs text-muted-foreground truncate">
|
||||||
|
{ev.tool || '-'}
|
||||||
|
</div>
|
||||||
|
<div className="col-span-2 font-mono text-xs text-muted-foreground truncate">
|
||||||
|
{ev.resumeKey || '-'}
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{expanded && (
|
||||||
|
<div className="mt-2 ml-6 space-y-2">
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-2 text-xs">
|
||||||
|
<div className="text-muted-foreground">
|
||||||
|
<span className="font-medium text-foreground">{formatMessage({ id: 'issues.observability.table.workingDir' })}: </span>
|
||||||
|
<span className="font-mono break-all">{ev.workingDir || '-'}</span>
|
||||||
|
</div>
|
||||||
|
<div className="text-muted-foreground">
|
||||||
|
<span className="font-medium text-foreground">{formatMessage({ id: 'issues.observability.table.ip' })}: </span>
|
||||||
|
<span className="font-mono break-all">{ev.ip || '-'}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{ev.userAgent && (
|
||||||
|
<div className="text-xs text-muted-foreground">
|
||||||
|
<span className="font-medium text-foreground">{formatMessage({ id: 'issues.observability.table.userAgent' })}: </span>
|
||||||
|
<span className="font-mono break-all">{ev.userAgent}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<pre className="text-xs bg-muted/50 rounded-md p-3 overflow-x-auto">
|
||||||
|
{JSON.stringify(ev.details ?? {}, null, 2)}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ObservabilityPanel;
|
||||||
@@ -0,0 +1,355 @@
|
|||||||
|
// ========================================
|
||||||
|
// QueueSendToOrchestrator
|
||||||
|
// ========================================
|
||||||
|
// Create a flow from a queue item and execute it via Orchestrator (tmux-like delivery to PTY session).
|
||||||
|
|
||||||
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
|
import { useIntl } from 'react-intl';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import { Plus, RefreshCw, Workflow } from 'lucide-react';
|
||||||
|
import { Button } from '@/components/ui/Button';
|
||||||
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/Select';
|
||||||
|
import { cn } from '@/lib/utils';
|
||||||
|
import { useWorkflowStore, selectProjectPath } from '@/stores/workflowStore';
|
||||||
|
import { toast, useExecutionStore, useFlowStore } from '@/stores';
|
||||||
|
import { useIssues } from '@/hooks';
|
||||||
|
import {
|
||||||
|
createCliSession,
|
||||||
|
createOrchestratorFlow,
|
||||||
|
executeOrchestratorFlow,
|
||||||
|
fetchCliSessions,
|
||||||
|
type CliSession,
|
||||||
|
type QueueItem,
|
||||||
|
} from '@/lib/api';
|
||||||
|
import { useCliSessionStore } from '@/stores/cliSessionStore';
|
||||||
|
|
||||||
|
type ToolName = 'claude' | 'codex' | 'gemini' | 'qwen';
|
||||||
|
type ResumeStrategy = 'nativeResume' | 'promptConcat';
|
||||||
|
|
||||||
|
function buildQueueItemInstruction(item: QueueItem, issue: any | undefined): string {
|
||||||
|
const lines: string[] = [];
|
||||||
|
lines.push(`Queue Item: ${item.item_id}`);
|
||||||
|
lines.push(`Issue: ${item.issue_id}`);
|
||||||
|
lines.push(`Solution: ${item.solution_id}`);
|
||||||
|
if (item.task_id) lines.push(`Task: ${item.task_id}`);
|
||||||
|
lines.push('');
|
||||||
|
|
||||||
|
if (issue) {
|
||||||
|
if (issue.title) lines.push(`Title: ${issue.title}`);
|
||||||
|
if (issue.context) {
|
||||||
|
lines.push('');
|
||||||
|
lines.push('Context:');
|
||||||
|
lines.push(String(issue.context));
|
||||||
|
}
|
||||||
|
|
||||||
|
const solution = Array.isArray(issue.solutions)
|
||||||
|
? issue.solutions.find((s: any) => s?.id === item.solution_id)
|
||||||
|
: undefined;
|
||||||
|
if (solution) {
|
||||||
|
lines.push('');
|
||||||
|
lines.push('Solution Description:');
|
||||||
|
if (solution.description) lines.push(String(solution.description));
|
||||||
|
if (solution.approach) {
|
||||||
|
lines.push('');
|
||||||
|
lines.push('Approach:');
|
||||||
|
lines.push(String(solution.approach));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lines.push('');
|
||||||
|
lines.push('Instruction:');
|
||||||
|
lines.push(
|
||||||
|
'Implement the above queue item in this repository. Prefer small, testable changes; run relevant tests; report blockers if any.'
|
||||||
|
);
|
||||||
|
|
||||||
|
return lines.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateId(prefix: string): string {
|
||||||
|
return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function QueueSendToOrchestrator({ item, className }: { item: QueueItem; className?: string }) {
|
||||||
|
const { formatMessage } = useIntl();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const projectPath = useWorkflowStore(selectProjectPath);
|
||||||
|
|
||||||
|
const { issues } = useIssues();
|
||||||
|
const issue = useMemo(() => issues.find((i) => i.id === item.issue_id) as any, [issues, item.issue_id]);
|
||||||
|
|
||||||
|
const sessionsByKey = useCliSessionStore((s) => s.sessions);
|
||||||
|
const setSessions = useCliSessionStore((s) => s.setSessions);
|
||||||
|
const upsertSession = useCliSessionStore((s) => s.upsertSession);
|
||||||
|
|
||||||
|
const sessions = useMemo(
|
||||||
|
() => Object.values(sessionsByKey).sort((a, b) => a.createdAt.localeCompare(b.createdAt)),
|
||||||
|
[sessionsByKey]
|
||||||
|
);
|
||||||
|
|
||||||
|
const [selectedSessionKey, setSelectedSessionKey] = useState<string>('');
|
||||||
|
const [tool, setTool] = useState<ToolName>('claude');
|
||||||
|
const [mode, setMode] = useState<'analysis' | 'write'>('write');
|
||||||
|
const [resumeStrategy, setResumeStrategy] = useState<ResumeStrategy>('nativeResume');
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const [isSending, setIsSending] = useState(false);
|
||||||
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
const [lastResult, setLastResult] = useState<{ flowId: string; execId: string } | null>(null);
|
||||||
|
|
||||||
|
const refreshSessions = async () => {
|
||||||
|
setIsLoading(true);
|
||||||
|
setError(null);
|
||||||
|
try {
|
||||||
|
const r = await fetchCliSessions(projectPath || undefined);
|
||||||
|
setSessions(r.sessions as unknown as CliSession[]);
|
||||||
|
} catch (e) {
|
||||||
|
setError(e instanceof Error ? e.message : String(e));
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
void refreshSessions();
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [projectPath]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (selectedSessionKey) return;
|
||||||
|
if (sessions.length === 0) return;
|
||||||
|
setSelectedSessionKey(sessions[sessions.length - 1]?.sessionKey ?? '');
|
||||||
|
}, [sessions, selectedSessionKey]);
|
||||||
|
|
||||||
|
const ensureSession = async (): Promise<string> => {
|
||||||
|
if (selectedSessionKey) return selectedSessionKey;
|
||||||
|
if (!projectPath) throw new Error('No project path selected');
|
||||||
|
const created = await createCliSession({
|
||||||
|
workingDir: projectPath,
|
||||||
|
preferredShell: 'bash',
|
||||||
|
resumeKey: item.issue_id,
|
||||||
|
}, projectPath);
|
||||||
|
upsertSession(created.session as unknown as CliSession);
|
||||||
|
setSelectedSessionKey(created.session.sessionKey);
|
||||||
|
return created.session.sessionKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCreateSession = async () => {
|
||||||
|
setError(null);
|
||||||
|
try {
|
||||||
|
if (!projectPath) throw new Error('No project path selected');
|
||||||
|
const created = await createCliSession({
|
||||||
|
workingDir: projectPath,
|
||||||
|
preferredShell: 'bash',
|
||||||
|
resumeKey: item.issue_id,
|
||||||
|
}, projectPath);
|
||||||
|
upsertSession(created.session as unknown as CliSession);
|
||||||
|
setSelectedSessionKey(created.session.sessionKey);
|
||||||
|
await refreshSessions();
|
||||||
|
} catch (e) {
|
||||||
|
setError(e instanceof Error ? e.message : String(e));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSend = async () => {
|
||||||
|
setIsSending(true);
|
||||||
|
setError(null);
|
||||||
|
setLastResult(null);
|
||||||
|
try {
|
||||||
|
const sessionKey = await ensureSession();
|
||||||
|
const instruction = buildQueueItemInstruction(item, issue);
|
||||||
|
|
||||||
|
const nodeId = generateId('node');
|
||||||
|
const flowName = `Queue ${item.issue_id} / ${item.solution_id}${item.task_id ? ` / ${item.task_id}` : ''}`;
|
||||||
|
const flowDescription = `Queue item ${item.item_id} -> Orchestrator`;
|
||||||
|
|
||||||
|
const created = await createOrchestratorFlow({
|
||||||
|
name: flowName,
|
||||||
|
description: flowDescription,
|
||||||
|
version: '1.0.0',
|
||||||
|
nodes: [
|
||||||
|
{
|
||||||
|
id: nodeId,
|
||||||
|
type: 'prompt-template',
|
||||||
|
position: { x: 100, y: 100 },
|
||||||
|
data: {
|
||||||
|
label: flowName,
|
||||||
|
instruction,
|
||||||
|
tool,
|
||||||
|
mode,
|
||||||
|
delivery: 'sendToSession',
|
||||||
|
targetSessionKey: sessionKey,
|
||||||
|
resumeKey: item.issue_id,
|
||||||
|
resumeStrategy,
|
||||||
|
tags: ['queue', item.item_id, item.issue_id, item.solution_id].filter(Boolean),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
edges: [],
|
||||||
|
variables: {},
|
||||||
|
metadata: {
|
||||||
|
source: 'local',
|
||||||
|
tags: ['queue', item.item_id, item.issue_id, item.solution_id].filter(Boolean),
|
||||||
|
},
|
||||||
|
}, projectPath || undefined);
|
||||||
|
|
||||||
|
if (!created.success) {
|
||||||
|
throw new Error('Failed to create flow');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Best-effort: hydrate Orchestrator stores so the user lands on the created flow.
|
||||||
|
const flowDto = created.data as any;
|
||||||
|
const parsedVersion = parseInt(String(flowDto.version ?? '1'), 10);
|
||||||
|
const flowForStore = {
|
||||||
|
...flowDto,
|
||||||
|
version: Number.isFinite(parsedVersion) ? parsedVersion : 1,
|
||||||
|
} as any;
|
||||||
|
useFlowStore.getState().setCurrentFlow(flowForStore);
|
||||||
|
|
||||||
|
// Trigger execution (backend returns execId; engine wiring may run async).
|
||||||
|
const executed = await executeOrchestratorFlow(created.data.id, {}, projectPath || undefined);
|
||||||
|
if (!executed.success) {
|
||||||
|
throw new Error('Failed to execute flow');
|
||||||
|
}
|
||||||
|
|
||||||
|
const execId = executed.data.execId;
|
||||||
|
useExecutionStore.getState().startExecution(execId, created.data.id);
|
||||||
|
useExecutionStore.getState().setMonitorPanelOpen(true);
|
||||||
|
|
||||||
|
setLastResult({ flowId: created.data.id, execId });
|
||||||
|
toast.success(
|
||||||
|
formatMessage({ id: 'issues.queue.orchestrator.sentTitle' }),
|
||||||
|
formatMessage({ id: 'issues.queue.orchestrator.sentDesc' }, { flowId: created.data.id })
|
||||||
|
);
|
||||||
|
|
||||||
|
navigate('/orchestrator');
|
||||||
|
} catch (e) {
|
||||||
|
const message = e instanceof Error ? e.message : String(e);
|
||||||
|
setError(message);
|
||||||
|
toast.error(formatMessage({ id: 'issues.queue.orchestrator.sendFailed' }), message);
|
||||||
|
} finally {
|
||||||
|
setIsSending(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={cn('space-y-3', className)}>
|
||||||
|
<div className="flex items-center justify-between gap-2">
|
||||||
|
<h3 className="text-sm font-semibold text-foreground flex items-center gap-2">
|
||||||
|
<Workflow className="h-4 w-4" />
|
||||||
|
{formatMessage({ id: 'issues.queue.orchestrator.title' })}
|
||||||
|
</h3>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={refreshSessions}
|
||||||
|
disabled={isLoading}
|
||||||
|
className="gap-2"
|
||||||
|
>
|
||||||
|
<RefreshCw className={cn('h-4 w-4', isLoading && 'animate-spin')} />
|
||||||
|
{formatMessage({ id: 'issues.terminal.session.refresh' })}
|
||||||
|
</Button>
|
||||||
|
<Button variant="outline" size="sm" onClick={handleCreateSession} className="gap-2">
|
||||||
|
<Plus className="h-4 w-4" />
|
||||||
|
{formatMessage({ id: 'issues.terminal.session.new' })}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||||
|
<div>
|
||||||
|
<label className="block text-xs font-medium text-muted-foreground mb-1">
|
||||||
|
{formatMessage({ id: 'issues.queue.orchestrator.targetSession' })}
|
||||||
|
</label>
|
||||||
|
<Select value={selectedSessionKey} onValueChange={(v) => setSelectedSessionKey(v)}>
|
||||||
|
<SelectTrigger>
|
||||||
|
<SelectValue placeholder={formatMessage({ id: 'issues.terminal.session.none' })} />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{sessions.length === 0 ? (
|
||||||
|
<SelectItem value="" disabled>
|
||||||
|
{formatMessage({ id: 'issues.terminal.session.none' })}
|
||||||
|
</SelectItem>
|
||||||
|
) : (
|
||||||
|
sessions.map((s) => (
|
||||||
|
<SelectItem key={s.sessionKey} value={s.sessionKey}>
|
||||||
|
{(s.tool || 'cli') + ' · ' + s.sessionKey}
|
||||||
|
</SelectItem>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label className="block text-xs font-medium text-muted-foreground mb-1">
|
||||||
|
{formatMessage({ id: 'issues.queue.orchestrator.tool' })}
|
||||||
|
</label>
|
||||||
|
<Select value={tool} onValueChange={(v) => setTool(v as ToolName)}>
|
||||||
|
<SelectTrigger>
|
||||||
|
<SelectValue />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="claude">claude</SelectItem>
|
||||||
|
<SelectItem value="codex">codex</SelectItem>
|
||||||
|
<SelectItem value="gemini">gemini</SelectItem>
|
||||||
|
<SelectItem value="qwen">qwen</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label className="block text-xs font-medium text-muted-foreground mb-1">
|
||||||
|
{formatMessage({ id: 'issues.queue.orchestrator.mode' })}
|
||||||
|
</label>
|
||||||
|
<Select value={mode} onValueChange={(v) => setMode(v as 'analysis' | 'write')}>
|
||||||
|
<SelectTrigger>
|
||||||
|
<SelectValue />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="analysis">analysis</SelectItem>
|
||||||
|
<SelectItem value="write">write</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label className="block text-xs font-medium text-muted-foreground mb-1">
|
||||||
|
{formatMessage({ id: 'issues.queue.orchestrator.resumeStrategy' })}
|
||||||
|
</label>
|
||||||
|
<Select value={resumeStrategy} onValueChange={(v) => setResumeStrategy(v as ResumeStrategy)}>
|
||||||
|
<SelectTrigger>
|
||||||
|
<SelectValue />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="nativeResume">nativeResume</SelectItem>
|
||||||
|
<SelectItem value="promptConcat">promptConcat</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{error && <div className="text-sm text-destructive">{error}</div>}
|
||||||
|
{lastResult && (
|
||||||
|
<div className="text-xs text-muted-foreground font-mono break-all">
|
||||||
|
{lastResult.flowId} · {lastResult.execId}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="flex items-center justify-end">
|
||||||
|
<Button onClick={handleSend} disabled={isSending || !projectPath} className="gap-2">
|
||||||
|
{isSending ? (
|
||||||
|
<>
|
||||||
|
<RefreshCw className="h-4 w-4 animate-spin" />
|
||||||
|
{formatMessage({ id: 'issues.queue.orchestrator.sending' })}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
formatMessage({ id: 'issues.queue.orchestrator.send' })
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default QueueSendToOrchestrator;
|
||||||
@@ -10,6 +10,7 @@ import { Badge } from '@/components/ui/Badge';
|
|||||||
import { Button } from '@/components/ui/Button';
|
import { Button } from '@/components/ui/Button';
|
||||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/Tabs';
|
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/Tabs';
|
||||||
import { QueueExecuteInSession } from '@/components/issue/queue/QueueExecuteInSession';
|
import { QueueExecuteInSession } from '@/components/issue/queue/QueueExecuteInSession';
|
||||||
|
import { QueueSendToOrchestrator } from '@/components/issue/queue/QueueSendToOrchestrator';
|
||||||
import { IssueTerminalTab } from '@/components/issue/hub/IssueTerminalTab';
|
import { IssueTerminalTab } from '@/components/issue/hub/IssueTerminalTab';
|
||||||
import { useIssueQueue } from '@/hooks';
|
import { useIssueQueue } from '@/hooks';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
@@ -179,6 +180,9 @@ export function SolutionDrawer({ item, isOpen, onClose }: SolutionDrawerProps) {
|
|||||||
{/* Execute in Session */}
|
{/* Execute in Session */}
|
||||||
<QueueExecuteInSession item={item} />
|
<QueueExecuteInSession item={item} />
|
||||||
|
|
||||||
|
{/* Send to Orchestrator */}
|
||||||
|
<QueueSendToOrchestrator item={item} />
|
||||||
|
|
||||||
{/* Dependencies */}
|
{/* Dependencies */}
|
||||||
{item.depends_on && item.depends_on.length > 0 && (
|
{item.depends_on && item.depends_on.length > 0 && (
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -91,6 +91,14 @@ export type {
|
|||||||
UseIssueDiscoveryReturn,
|
UseIssueDiscoveryReturn,
|
||||||
} from './useIssues';
|
} from './useIssues';
|
||||||
|
|
||||||
|
// ========== Audit ==========
|
||||||
|
export {
|
||||||
|
useCliSessionAudit,
|
||||||
|
} from './useAudit';
|
||||||
|
export type {
|
||||||
|
UseCliSessionAuditOptions,
|
||||||
|
} from './useAudit';
|
||||||
|
|
||||||
// ========== Skills ==========
|
// ========== Skills ==========
|
||||||
export {
|
export {
|
||||||
useSkills,
|
useSkills,
|
||||||
|
|||||||
57
ccw/frontend/src/hooks/useAudit.ts
Normal file
57
ccw/frontend/src/hooks/useAudit.ts
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
// ========================================
|
||||||
|
// useAudit Hooks
|
||||||
|
// ========================================
|
||||||
|
// TanStack Query hooks for audit/observability APIs
|
||||||
|
|
||||||
|
import { useQuery, type UseQueryResult } from '@tanstack/react-query';
|
||||||
|
import { useWorkflowStore, selectProjectPath } from '@/stores/workflowStore';
|
||||||
|
import { workspaceQueryKeys } from '@/lib/queryKeys';
|
||||||
|
import {
|
||||||
|
fetchCliSessionAudit,
|
||||||
|
type CliSessionAuditEventType,
|
||||||
|
type CliSessionAuditListResponse,
|
||||||
|
} from '@/lib/api';
|
||||||
|
|
||||||
|
export interface UseCliSessionAuditOptions {
|
||||||
|
sessionKey?: string;
|
||||||
|
type?: CliSessionAuditEventType | CliSessionAuditEventType[];
|
||||||
|
q?: string;
|
||||||
|
limit?: number;
|
||||||
|
offset?: number;
|
||||||
|
enabled?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useCliSessionAudit(
|
||||||
|
options: UseCliSessionAuditOptions = {}
|
||||||
|
): UseQueryResult<{ success: boolean; data: CliSessionAuditListResponse }> {
|
||||||
|
const projectPath = useWorkflowStore(selectProjectPath);
|
||||||
|
const enabled = (options.enabled ?? true) && !!projectPath;
|
||||||
|
|
||||||
|
const typeParam = Array.isArray(options.type)
|
||||||
|
? options.type.join(',')
|
||||||
|
: options.type;
|
||||||
|
|
||||||
|
return useQuery({
|
||||||
|
queryKey: projectPath
|
||||||
|
? workspaceQueryKeys.cliSessionAudit(projectPath, {
|
||||||
|
sessionKey: options.sessionKey,
|
||||||
|
type: typeParam,
|
||||||
|
q: options.q,
|
||||||
|
limit: options.limit,
|
||||||
|
offset: options.offset,
|
||||||
|
})
|
||||||
|
: ['audit', 'cliSessions', 'no-project'],
|
||||||
|
queryFn: () => fetchCliSessionAudit({
|
||||||
|
projectPath: projectPath ?? undefined,
|
||||||
|
sessionKey: options.sessionKey,
|
||||||
|
type: options.type,
|
||||||
|
q: options.q,
|
||||||
|
limit: options.limit,
|
||||||
|
offset: options.offset,
|
||||||
|
}),
|
||||||
|
enabled,
|
||||||
|
staleTime: 10_000,
|
||||||
|
retry: 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@@ -5,10 +5,18 @@
|
|||||||
|
|
||||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||||
import type { Flow } from '../types/flow';
|
import type { Flow } from '../types/flow';
|
||||||
|
import { useWorkflowStore, selectProjectPath } from '@/stores/workflowStore';
|
||||||
|
|
||||||
// API base URL
|
// API base URL
|
||||||
const API_BASE = '/api/orchestrator';
|
const API_BASE = '/api/orchestrator';
|
||||||
|
|
||||||
|
function withPath(url: string, projectPath?: string | null): string {
|
||||||
|
const p = typeof projectPath === 'string' ? projectPath.trim() : '';
|
||||||
|
if (!p) return url;
|
||||||
|
const sep = url.includes('?') ? '&' : '?';
|
||||||
|
return `${url}${sep}path=${encodeURIComponent(p)}`;
|
||||||
|
}
|
||||||
|
|
||||||
// Query keys
|
// Query keys
|
||||||
export const flowKeys = {
|
export const flowKeys = {
|
||||||
all: ['flows'] as const,
|
all: ['flows'] as const,
|
||||||
@@ -30,32 +38,36 @@ interface FlowsListResponse {
|
|||||||
interface ExecutionStartResponse {
|
interface ExecutionStartResponse {
|
||||||
execId: string;
|
execId: string;
|
||||||
flowId: string;
|
flowId: string;
|
||||||
status: 'running';
|
status: 'pending' | 'running' | 'paused' | 'completed' | 'failed';
|
||||||
startedAt: string;
|
startedAt: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ExecutionControlResponse {
|
interface ExecutionControlResponse {
|
||||||
execId: string;
|
execId: string;
|
||||||
status: 'paused' | 'running' | 'stopped';
|
status: 'pending' | 'running' | 'paused' | 'completed' | 'failed';
|
||||||
message: string;
|
message: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========== Fetch Functions ==========
|
// ========== Fetch Functions ==========
|
||||||
|
|
||||||
async function fetchFlows(): Promise<FlowsListResponse> {
|
async function fetchFlows(): Promise<FlowsListResponse> {
|
||||||
const response = await fetch(`${API_BASE}/flows`);
|
const response = await fetch(`${API_BASE}/flows`, { credentials: 'same-origin' });
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to fetch flows: ${response.statusText}`);
|
throw new Error(`Failed to fetch flows: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
return response.json();
|
const json = await response.json();
|
||||||
|
const flows = Array.isArray(json?.data) ? json.data : (json?.flows || []);
|
||||||
|
const total = typeof json?.total === 'number' ? json.total : flows.length;
|
||||||
|
return { flows, total };
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchFlow(id: string): Promise<Flow> {
|
async function fetchFlow(id: string): Promise<Flow> {
|
||||||
const response = await fetch(`${API_BASE}/flows/${id}`);
|
const response = await fetch(`${API_BASE}/flows/${id}`, { credentials: 'same-origin' });
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to fetch flow: ${response.statusText}`);
|
throw new Error(`Failed to fetch flow: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
return response.json();
|
const json = await response.json();
|
||||||
|
return (json && typeof json === 'object' && 'data' in json) ? json.data : json;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createFlow(flow: Omit<Flow, 'id' | 'created_at' | 'updated_at'>): Promise<Flow> {
|
async function createFlow(flow: Omit<Flow, 'id' | 'created_at' | 'updated_at'>): Promise<Flow> {
|
||||||
@@ -63,11 +75,13 @@ async function createFlow(flow: Omit<Flow, 'id' | 'created_at' | 'updated_at'>):
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(flow),
|
body: JSON.stringify(flow),
|
||||||
|
credentials: 'same-origin',
|
||||||
});
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to create flow: ${response.statusText}`);
|
throw new Error(`Failed to create flow: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
return response.json();
|
const json = await response.json();
|
||||||
|
return (json && typeof json === 'object' && 'data' in json) ? json.data : json;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateFlow(id: string, flow: Partial<Flow>): Promise<Flow> {
|
async function updateFlow(id: string, flow: Partial<Flow>): Promise<Flow> {
|
||||||
@@ -75,16 +89,19 @@ async function updateFlow(id: string, flow: Partial<Flow>): Promise<Flow> {
|
|||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(flow),
|
body: JSON.stringify(flow),
|
||||||
|
credentials: 'same-origin',
|
||||||
});
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to update flow: ${response.statusText}`);
|
throw new Error(`Failed to update flow: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
return response.json();
|
const json = await response.json();
|
||||||
|
return (json && typeof json === 'object' && 'data' in json) ? json.data : json;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteFlow(id: string): Promise<void> {
|
async function deleteFlow(id: string): Promise<void> {
|
||||||
const response = await fetch(`${API_BASE}/flows/${id}`, {
|
const response = await fetch(`${API_BASE}/flows/${id}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
|
credentials: 'same-origin',
|
||||||
});
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to delete flow: ${response.statusText}`);
|
throw new Error(`Failed to delete flow: ${response.statusText}`);
|
||||||
@@ -94,53 +111,72 @@ async function deleteFlow(id: string): Promise<void> {
|
|||||||
async function duplicateFlow(id: string): Promise<Flow> {
|
async function duplicateFlow(id: string): Promise<Flow> {
|
||||||
const response = await fetch(`${API_BASE}/flows/${id}/duplicate`, {
|
const response = await fetch(`${API_BASE}/flows/${id}/duplicate`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
credentials: 'same-origin',
|
||||||
});
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to duplicate flow: ${response.statusText}`);
|
throw new Error(`Failed to duplicate flow: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
return response.json();
|
const json = await response.json();
|
||||||
|
return (json && typeof json === 'object' && 'data' in json) ? json.data : json;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========== Execution Functions ==========
|
// ========== Execution Functions ==========
|
||||||
|
|
||||||
async function executeFlow(flowId: string): Promise<ExecutionStartResponse> {
|
async function executeFlow(flowId: string, projectPath?: string | null): Promise<ExecutionStartResponse> {
|
||||||
const response = await fetch(`${API_BASE}/flows/${flowId}/execute`, {
|
const response = await fetch(withPath(`${API_BASE}/flows/${flowId}/execute`, projectPath), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
credentials: 'same-origin',
|
||||||
});
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to execute flow: ${response.statusText}`);
|
throw new Error(`Failed to execute flow: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
return response.json();
|
const json = await response.json();
|
||||||
|
return (json && typeof json === 'object' && 'data' in json) ? json.data : json;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function pauseExecution(execId: string): Promise<ExecutionControlResponse> {
|
async function pauseExecution(execId: string, projectPath?: string | null): Promise<ExecutionControlResponse> {
|
||||||
const response = await fetch(`${API_BASE}/executions/${execId}/pause`, {
|
const response = await fetch(withPath(`${API_BASE}/executions/${execId}/pause`, projectPath), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
credentials: 'same-origin',
|
||||||
});
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to pause execution: ${response.statusText}`);
|
throw new Error(`Failed to pause execution: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
return response.json();
|
const json = await response.json();
|
||||||
|
if (json?.data?.id) {
|
||||||
|
return { execId: json.data.id, status: json.data.status, message: json.message || 'Execution paused' };
|
||||||
|
}
|
||||||
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function resumeExecution(execId: string): Promise<ExecutionControlResponse> {
|
async function resumeExecution(execId: string, projectPath?: string | null): Promise<ExecutionControlResponse> {
|
||||||
const response = await fetch(`${API_BASE}/executions/${execId}/resume`, {
|
const response = await fetch(withPath(`${API_BASE}/executions/${execId}/resume`, projectPath), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
credentials: 'same-origin',
|
||||||
});
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to resume execution: ${response.statusText}`);
|
throw new Error(`Failed to resume execution: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
return response.json();
|
const json = await response.json();
|
||||||
|
if (json?.data?.id) {
|
||||||
|
return { execId: json.data.id, status: json.data.status, message: json.message || 'Execution resumed' };
|
||||||
|
}
|
||||||
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function stopExecution(execId: string): Promise<ExecutionControlResponse> {
|
async function stopExecution(execId: string, projectPath?: string | null): Promise<ExecutionControlResponse> {
|
||||||
const response = await fetch(`${API_BASE}/executions/${execId}/stop`, {
|
const response = await fetch(withPath(`${API_BASE}/executions/${execId}/stop`, projectPath), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
credentials: 'same-origin',
|
||||||
});
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to stop execution: ${response.statusText}`);
|
throw new Error(`Failed to stop execution: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
return response.json();
|
const json = await response.json();
|
||||||
|
if (json?.data?.id) {
|
||||||
|
return { execId: json.data.id, status: json.data.status, message: json.message || 'Execution stopped' };
|
||||||
|
}
|
||||||
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========== Query Hooks ==========
|
// ========== Query Hooks ==========
|
||||||
@@ -265,8 +301,9 @@ export function useDuplicateFlow() {
|
|||||||
* Execute a flow
|
* Execute a flow
|
||||||
*/
|
*/
|
||||||
export function useExecuteFlow() {
|
export function useExecuteFlow() {
|
||||||
|
const projectPath = useWorkflowStore(selectProjectPath);
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: executeFlow,
|
mutationFn: (flowId: string) => executeFlow(flowId, projectPath),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,8 +311,9 @@ export function useExecuteFlow() {
|
|||||||
* Pause execution
|
* Pause execution
|
||||||
*/
|
*/
|
||||||
export function usePauseExecution() {
|
export function usePauseExecution() {
|
||||||
|
const projectPath = useWorkflowStore(selectProjectPath);
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: pauseExecution,
|
mutationFn: (execId: string) => pauseExecution(execId, projectPath),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,8 +321,9 @@ export function usePauseExecution() {
|
|||||||
* Resume execution
|
* Resume execution
|
||||||
*/
|
*/
|
||||||
export function useResumeExecution() {
|
export function useResumeExecution() {
|
||||||
|
const projectPath = useWorkflowStore(selectProjectPath);
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: resumeExecution,
|
mutationFn: (execId: string) => resumeExecution(execId, projectPath),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,15 +331,19 @@ export function useResumeExecution() {
|
|||||||
* Stop execution
|
* Stop execution
|
||||||
*/
|
*/
|
||||||
export function useStopExecution() {
|
export function useStopExecution() {
|
||||||
|
const projectPath = useWorkflowStore(selectProjectPath);
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: stopExecution,
|
mutationFn: (execId: string) => stopExecution(execId, projectPath),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========== Execution Monitoring Fetch Functions ==========
|
// ========== Execution Monitoring Fetch Functions ==========
|
||||||
|
|
||||||
async function fetchExecutionStateById(execId: string): Promise<{ success: boolean; data: { execId: string; flowId: string; status: string; currentNodeId?: string; startedAt: string; completedAt?: string; elapsedMs: number } }> {
|
async function fetchExecutionStateById(
|
||||||
const response = await fetch(`${API_BASE}/executions/${execId}`);
|
execId: string,
|
||||||
|
projectPath?: string | null
|
||||||
|
): Promise<{ success: boolean; data: { execId: string; flowId: string; status: string; currentNodeId?: string; startedAt: string; completedAt?: string; elapsedMs: number } }> {
|
||||||
|
const response = await fetch(withPath(`${API_BASE}/executions/${execId}`, projectPath), { credentials: 'same-origin' });
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to fetch execution state: ${response.statusText}`);
|
throw new Error(`Failed to fetch execution state: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
@@ -314,7 +357,8 @@ async function fetchExecutionLogsById(
|
|||||||
offset?: number;
|
offset?: number;
|
||||||
level?: string;
|
level?: string;
|
||||||
nodeId?: string;
|
nodeId?: string;
|
||||||
}
|
},
|
||||||
|
projectPath?: string | null
|
||||||
): Promise<{ success: boolean; data: { execId: string; logs: unknown[]; total: number; limit: number; offset: number; hasMore: boolean } }> {
|
): Promise<{ success: boolean; data: { execId: string; logs: unknown[]; total: number; limit: number; offset: number; hasMore: boolean } }> {
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
if (options?.limit) params.append('limit', String(options.limit));
|
if (options?.limit) params.append('limit', String(options.limit));
|
||||||
@@ -323,7 +367,11 @@ async function fetchExecutionLogsById(
|
|||||||
if (options?.nodeId) params.append('nodeId', options.nodeId);
|
if (options?.nodeId) params.append('nodeId', options.nodeId);
|
||||||
|
|
||||||
const queryString = params.toString();
|
const queryString = params.toString();
|
||||||
const response = await fetch(`${API_BASE}/executions/${execId}/logs${queryString ? `?${queryString}` : ''}`);
|
const url = withPath(
|
||||||
|
`${API_BASE}/executions/${execId}/logs${queryString ? `?${queryString}` : ''}`,
|
||||||
|
projectPath
|
||||||
|
);
|
||||||
|
const response = await fetch(url, { credentials: 'same-origin' });
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to fetch execution logs: ${response.statusText}`);
|
throw new Error(`Failed to fetch execution logs: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
@@ -337,9 +385,10 @@ async function fetchExecutionLogsById(
|
|||||||
* Uses useQuery to get execution state, enabled when execId exists
|
* Uses useQuery to get execution state, enabled when execId exists
|
||||||
*/
|
*/
|
||||||
export function useExecutionState(execId: string | null) {
|
export function useExecutionState(execId: string | null) {
|
||||||
|
const projectPath = useWorkflowStore(selectProjectPath);
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: flowKeys.executionState(execId ?? ''),
|
queryKey: [...flowKeys.executionState(execId ?? ''), projectPath],
|
||||||
queryFn: () => fetchExecutionStateById(execId!),
|
queryFn: () => fetchExecutionStateById(execId!, projectPath),
|
||||||
enabled: !!execId,
|
enabled: !!execId,
|
||||||
staleTime: 5000, // 5 seconds - needs more frequent updates for monitoring
|
staleTime: 5000, // 5 seconds - needs more frequent updates for monitoring
|
||||||
});
|
});
|
||||||
@@ -358,9 +407,10 @@ export function useExecutionLogs(
|
|||||||
nodeId?: string;
|
nodeId?: string;
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
|
const projectPath = useWorkflowStore(selectProjectPath);
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: flowKeys.executionLogs(execId ?? '', options),
|
queryKey: [...flowKeys.executionLogs(execId ?? '', options), projectPath],
|
||||||
queryFn: () => fetchExecutionLogsById(execId!, options),
|
queryFn: () => fetchExecutionLogsById(execId!, options, projectPath),
|
||||||
enabled: !!execId,
|
enabled: !!execId,
|
||||||
staleTime: 10000, // 10 seconds
|
staleTime: 10000, // 10 seconds
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -43,15 +43,66 @@ interface ExportTemplateResponse {
|
|||||||
|
|
||||||
// ========== Fetch Functions ==========
|
// ========== Fetch Functions ==========
|
||||||
|
|
||||||
|
function toFlowTemplate(raw: any): FlowTemplate {
|
||||||
|
const meta = raw?.template_metadata ?? {};
|
||||||
|
const nodes = Array.isArray(raw?.nodes) ? raw.nodes : [];
|
||||||
|
const edges = Array.isArray(raw?.edges) ? raw.edges : [];
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: String(raw?.id ?? ''),
|
||||||
|
name: String(raw?.name ?? ''),
|
||||||
|
description: (typeof meta.description === 'string' ? meta.description : raw?.description) || undefined,
|
||||||
|
category: typeof meta.category === 'string' ? meta.category : undefined,
|
||||||
|
tags: Array.isArray(meta.tags) ? meta.tags : undefined,
|
||||||
|
author: typeof meta.author === 'string' ? meta.author : undefined,
|
||||||
|
version: String(meta.version ?? raw?.version ?? '1.0.0'),
|
||||||
|
created_at: String(raw?.created_at ?? new Date().toISOString()),
|
||||||
|
updated_at: String(raw?.updated_at ?? new Date().toISOString()),
|
||||||
|
nodeCount: nodes.length,
|
||||||
|
edgeCount: edges.length,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function toFlowFromTemplate(raw: any): Flow {
|
||||||
|
const meta = raw?.template_metadata ?? {};
|
||||||
|
const now = new Date().toISOString();
|
||||||
|
return {
|
||||||
|
id: `flow-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`,
|
||||||
|
name: String(raw?.name ?? 'Template Flow'),
|
||||||
|
description: (typeof meta.description === 'string' ? meta.description : raw?.description) || undefined,
|
||||||
|
version: String(meta.version ?? raw?.version ?? '1.0.0'),
|
||||||
|
created_at: String(raw?.created_at ?? now),
|
||||||
|
updated_at: String(raw?.updated_at ?? now),
|
||||||
|
nodes: Array.isArray(raw?.nodes) ? raw.nodes : [],
|
||||||
|
edges: Array.isArray(raw?.edges) ? raw.edges : [],
|
||||||
|
variables: typeof raw?.variables === 'object' && raw.variables ? raw.variables : {},
|
||||||
|
metadata: {
|
||||||
|
source: 'template',
|
||||||
|
templateId: typeof raw?.id === 'string' ? raw.id : undefined,
|
||||||
|
tags: Array.isArray(meta.tags) ? meta.tags : undefined,
|
||||||
|
category: typeof meta.category === 'string' ? meta.category : undefined,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
async function fetchTemplates(category?: string): Promise<TemplatesListResponse> {
|
async function fetchTemplates(category?: string): Promise<TemplatesListResponse> {
|
||||||
const url = category
|
const url = category
|
||||||
? `${API_BASE}/templates?category=${encodeURIComponent(category)}`
|
? `${API_BASE}/templates?category=${encodeURIComponent(category)}`
|
||||||
: `${API_BASE}/templates`;
|
: `${API_BASE}/templates`;
|
||||||
const response = await fetch(url);
|
const response = await fetch(url, { credentials: 'same-origin' });
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to fetch templates: ${response.statusText}`);
|
throw new Error(`Failed to fetch templates: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
return response.json();
|
const json = await response.json();
|
||||||
|
const rawTemplates: any[] = Array.isArray(json?.data) ? json.data : (json?.templates || []);
|
||||||
|
const templates: FlowTemplate[] = rawTemplates.map(toFlowTemplate);
|
||||||
|
const total = typeof json?.total === 'number' ? json.total : templates.length;
|
||||||
|
const categories = Array.from(new Set(
|
||||||
|
templates
|
||||||
|
.map((t) => t.category)
|
||||||
|
.filter((c): c is string => typeof c === 'string' && c.trim().length > 0)
|
||||||
|
));
|
||||||
|
return { templates, total, categories };
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchTemplate(id: string): Promise<TemplateDetailResponse> {
|
async function fetchTemplate(id: string): Promise<TemplateDetailResponse> {
|
||||||
@@ -67,11 +118,14 @@ async function installTemplate(request: TemplateInstallRequest): Promise<Install
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(request),
|
body: JSON.stringify(request),
|
||||||
|
credentials: 'same-origin',
|
||||||
});
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to install template: ${response.statusText}`);
|
throw new Error(`Failed to install template: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
return response.json();
|
const json = await response.json();
|
||||||
|
const template = (json && typeof json === 'object' && 'data' in json) ? json.data : json;
|
||||||
|
return { flow: toFlowFromTemplate(template), message: json?.message || 'Template installed' };
|
||||||
}
|
}
|
||||||
|
|
||||||
async function exportTemplate(request: TemplateExportRequest): Promise<ExportTemplateResponse> {
|
async function exportTemplate(request: TemplateExportRequest): Promise<ExportTemplateResponse> {
|
||||||
@@ -79,16 +133,20 @@ async function exportTemplate(request: TemplateExportRequest): Promise<ExportTem
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(request),
|
body: JSON.stringify(request),
|
||||||
|
credentials: 'same-origin',
|
||||||
});
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to export template: ${response.statusText}`);
|
throw new Error(`Failed to export template: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
return response.json();
|
const json = await response.json();
|
||||||
|
const template = (json && typeof json === 'object' && 'data' in json) ? json.data : json;
|
||||||
|
return { template: toFlowTemplate(template), message: json?.message || 'Template exported' };
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteTemplate(id: string): Promise<void> {
|
async function deleteTemplate(id: string): Promise<void> {
|
||||||
const response = await fetch(`${API_BASE}/templates/${id}`, {
|
const response = await fetch(`${API_BASE}/templates/${id}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
|
credentials: 'same-origin',
|
||||||
});
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to delete template: ${response.statusText}`);
|
throw new Error(`Failed to delete template: ${response.statusText}`);
|
||||||
|
|||||||
@@ -5451,6 +5451,52 @@ export interface ExecutionLogsResponse {
|
|||||||
hasMore: boolean;
|
hasMore: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ========== Orchestrator Flow API (Create/Execute) ==========
|
||||||
|
|
||||||
|
export interface OrchestratorFlowDto {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
description?: string;
|
||||||
|
version: string;
|
||||||
|
created_at: string;
|
||||||
|
updated_at: string;
|
||||||
|
nodes: Array<Record<string, unknown>>;
|
||||||
|
edges: Array<Record<string, unknown>>;
|
||||||
|
variables: Record<string, unknown>;
|
||||||
|
metadata: Record<string, unknown>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateOrchestratorFlowRequest {
|
||||||
|
name: string;
|
||||||
|
description?: string;
|
||||||
|
version?: string;
|
||||||
|
nodes?: Array<Record<string, unknown>>;
|
||||||
|
edges?: Array<Record<string, unknown>>;
|
||||||
|
variables?: Record<string, unknown>;
|
||||||
|
metadata?: Record<string, unknown>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function createOrchestratorFlow(
|
||||||
|
request: CreateOrchestratorFlowRequest,
|
||||||
|
projectPath?: string
|
||||||
|
): Promise<{ success: boolean; data: OrchestratorFlowDto }> {
|
||||||
|
return fetchApi(withPath('/api/orchestrator/flows', projectPath), {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify(request),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function executeOrchestratorFlow(
|
||||||
|
flowId: string,
|
||||||
|
request?: { variables?: Record<string, unknown> },
|
||||||
|
projectPath?: string
|
||||||
|
): Promise<{ success: boolean; data: { execId: string; flowId: string; status: string; startedAt: string } }> {
|
||||||
|
return fetchApi(withPath(`/api/orchestrator/flows/${encodeURIComponent(flowId)}/execute`, projectPath), {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify(request ?? {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch execution state by execId
|
* Fetch execution state by execId
|
||||||
* @param execId - Execution ID
|
* @param execId - Execution ID
|
||||||
@@ -5824,3 +5870,62 @@ export async function revokeCliSessionShareToken(
|
|||||||
{ method: 'POST', body: JSON.stringify(input) }
|
{ method: 'POST', body: JSON.stringify(input) }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ========== Audit (Observability) API ==========
|
||||||
|
|
||||||
|
export type CliSessionAuditEventType =
|
||||||
|
| 'session_created'
|
||||||
|
| 'session_closed'
|
||||||
|
| 'session_send'
|
||||||
|
| 'session_execute'
|
||||||
|
| 'session_resize'
|
||||||
|
| 'session_share_created'
|
||||||
|
| 'session_share_revoked'
|
||||||
|
| 'session_idle_reaped';
|
||||||
|
|
||||||
|
export interface CliSessionAuditEvent {
|
||||||
|
type: CliSessionAuditEventType;
|
||||||
|
timestamp: string;
|
||||||
|
projectRoot: string;
|
||||||
|
sessionKey?: string;
|
||||||
|
tool?: string;
|
||||||
|
resumeKey?: string;
|
||||||
|
workingDir?: string;
|
||||||
|
ip?: string;
|
||||||
|
userAgent?: string;
|
||||||
|
details?: Record<string, unknown>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CliSessionAuditListResponse {
|
||||||
|
events: CliSessionAuditEvent[];
|
||||||
|
total: number;
|
||||||
|
limit: number;
|
||||||
|
offset: number;
|
||||||
|
hasMore: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchCliSessionAudit(
|
||||||
|
options?: {
|
||||||
|
projectPath?: string;
|
||||||
|
sessionKey?: string;
|
||||||
|
type?: CliSessionAuditEventType | CliSessionAuditEventType[];
|
||||||
|
q?: string;
|
||||||
|
limit?: number;
|
||||||
|
offset?: number;
|
||||||
|
}
|
||||||
|
): Promise<{ success: boolean; data: CliSessionAuditListResponse }> {
|
||||||
|
const params = new URLSearchParams();
|
||||||
|
if (options?.sessionKey) params.set('sessionKey', options.sessionKey);
|
||||||
|
if (options?.q) params.set('q', options.q);
|
||||||
|
if (typeof options?.limit === 'number') params.set('limit', String(options.limit));
|
||||||
|
if (typeof options?.offset === 'number') params.set('offset', String(options.offset));
|
||||||
|
if (options?.type) {
|
||||||
|
const types = Array.isArray(options.type) ? options.type : [options.type];
|
||||||
|
params.set('type', types.join(','));
|
||||||
|
}
|
||||||
|
|
||||||
|
const queryString = params.toString();
|
||||||
|
return fetchApi<{ success: boolean; data: CliSessionAuditListResponse }>(
|
||||||
|
withPath(`/api/audit/cli-sessions${queryString ? `?${queryString}` : ''}`, options?.projectPath)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -116,6 +116,19 @@ export const workspaceQueryKeys = {
|
|||||||
cliHistoryList: (projectPath: string) => [...workspaceQueryKeys.cliHistory(projectPath), 'list'] as const,
|
cliHistoryList: (projectPath: string) => [...workspaceQueryKeys.cliHistory(projectPath), 'list'] as const,
|
||||||
cliExecutionDetail: (projectPath: string, executionId: string) =>
|
cliExecutionDetail: (projectPath: string, executionId: string) =>
|
||||||
[...workspaceQueryKeys.cliHistory(projectPath), 'detail', executionId] as const,
|
[...workspaceQueryKeys.cliHistory(projectPath), 'detail', executionId] as const,
|
||||||
|
|
||||||
|
// ========== Audit ==========
|
||||||
|
audit: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'audit'] as const,
|
||||||
|
cliSessionAudit: (
|
||||||
|
projectPath: string,
|
||||||
|
options?: {
|
||||||
|
sessionKey?: string;
|
||||||
|
type?: string;
|
||||||
|
q?: string;
|
||||||
|
limit?: number;
|
||||||
|
offset?: number;
|
||||||
|
}
|
||||||
|
) => [...workspaceQueryKeys.audit(projectPath), 'cliSessions', options] as const,
|
||||||
};
|
};
|
||||||
|
|
||||||
// ========== API Settings Keys ==========
|
// ========== API Settings Keys ==========
|
||||||
|
|||||||
@@ -159,6 +159,18 @@
|
|||||||
"exec": {
|
"exec": {
|
||||||
"title": "Execute in Session"
|
"title": "Execute in Session"
|
||||||
},
|
},
|
||||||
|
"orchestrator": {
|
||||||
|
"title": "Send to Orchestrator",
|
||||||
|
"targetSession": "Target session",
|
||||||
|
"tool": "Tool",
|
||||||
|
"mode": "Mode",
|
||||||
|
"resumeStrategy": "resumeStrategy",
|
||||||
|
"send": "Send",
|
||||||
|
"sending": "Sending...",
|
||||||
|
"sentTitle": "Sent to Orchestrator",
|
||||||
|
"sentDesc": "Flow created: {flowId}",
|
||||||
|
"sendFailed": "Failed to send"
|
||||||
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"pending": "Pending",
|
"pending": "Pending",
|
||||||
"ready": "Ready",
|
"ready": "Ready",
|
||||||
@@ -359,9 +371,38 @@
|
|||||||
"issues": "Issues",
|
"issues": "Issues",
|
||||||
"board": "Board",
|
"board": "Board",
|
||||||
"queue": "Queue",
|
"queue": "Queue",
|
||||||
"discovery": "Discovery"
|
"discovery": "Discovery",
|
||||||
|
"observability": "Observability"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"observability": {
|
||||||
|
"pageTitle": "Observability",
|
||||||
|
"description": "Audit and inspect automated deliveries and CLI session activity",
|
||||||
|
"audit": {
|
||||||
|
"title": "CLI Session Audit"
|
||||||
|
},
|
||||||
|
"filters": {
|
||||||
|
"search": "Search",
|
||||||
|
"searchPlaceholder": "Search type/sessionKey/resumeKey/details...",
|
||||||
|
"sessionKey": "Session Key",
|
||||||
|
"sessionKeyPlaceholder": "e.g. cli-xxxx",
|
||||||
|
"type": "Type",
|
||||||
|
"typeAll": "All types",
|
||||||
|
"limit": "Limit"
|
||||||
|
},
|
||||||
|
"table": {
|
||||||
|
"timestamp": "Timestamp",
|
||||||
|
"type": "Type",
|
||||||
|
"sessionKey": "Session",
|
||||||
|
"tool": "Tool",
|
||||||
|
"resumeKey": "Resume Key",
|
||||||
|
"workingDir": "Working Dir",
|
||||||
|
"ip": "IP",
|
||||||
|
"userAgent": "User Agent"
|
||||||
|
},
|
||||||
|
"empty": "No audit events",
|
||||||
|
"error": "Failed to load audit events"
|
||||||
|
},
|
||||||
"board": {
|
"board": {
|
||||||
"pageTitle": "Issue Board",
|
"pageTitle": "Issue Board",
|
||||||
"description": "Visualize and manage issues in a kanban board",
|
"description": "Visualize and manage issues in a kanban board",
|
||||||
|
|||||||
@@ -159,6 +159,18 @@
|
|||||||
"exec": {
|
"exec": {
|
||||||
"title": "在会话中执行"
|
"title": "在会话中执行"
|
||||||
},
|
},
|
||||||
|
"orchestrator": {
|
||||||
|
"title": "发送到编排器",
|
||||||
|
"targetSession": "目标会话",
|
||||||
|
"tool": "工具",
|
||||||
|
"mode": "模式",
|
||||||
|
"resumeStrategy": "resumeStrategy",
|
||||||
|
"send": "发送",
|
||||||
|
"sending": "发送中...",
|
||||||
|
"sentTitle": "已发送到编排器",
|
||||||
|
"sentDesc": "已创建 flow: {flowId}",
|
||||||
|
"sendFailed": "发送失败"
|
||||||
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"pending": "待处理",
|
"pending": "待处理",
|
||||||
"ready": "就绪",
|
"ready": "就绪",
|
||||||
@@ -359,9 +371,38 @@
|
|||||||
"issues": "问题列表",
|
"issues": "问题列表",
|
||||||
"board": "看板",
|
"board": "看板",
|
||||||
"queue": "执行队列",
|
"queue": "执行队列",
|
||||||
"discovery": "问题发现"
|
"discovery": "问题发现",
|
||||||
|
"observability": "可观测"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"observability": {
|
||||||
|
"pageTitle": "可观测面板",
|
||||||
|
"description": "审计并查看自动投递与 CLI 会话活动",
|
||||||
|
"audit": {
|
||||||
|
"title": "CLI 会话审计"
|
||||||
|
},
|
||||||
|
"filters": {
|
||||||
|
"search": "搜索",
|
||||||
|
"searchPlaceholder": "搜索 type/sessionKey/resumeKey/details...",
|
||||||
|
"sessionKey": "会话 Key",
|
||||||
|
"sessionKeyPlaceholder": "例如 cli-xxxx",
|
||||||
|
"type": "类型",
|
||||||
|
"typeAll": "全部类型",
|
||||||
|
"limit": "条数"
|
||||||
|
},
|
||||||
|
"table": {
|
||||||
|
"timestamp": "时间戳",
|
||||||
|
"type": "类型",
|
||||||
|
"sessionKey": "会话",
|
||||||
|
"tool": "工具",
|
||||||
|
"resumeKey": "resumeKey",
|
||||||
|
"workingDir": "工作目录",
|
||||||
|
"ip": "IP",
|
||||||
|
"userAgent": "User-Agent"
|
||||||
|
},
|
||||||
|
"empty": "暂无审计事件",
|
||||||
|
"error": "加载审计事件失败"
|
||||||
|
},
|
||||||
"board": {
|
"board": {
|
||||||
"pageTitle": "问题看板",
|
"pageTitle": "问题看板",
|
||||||
"description": "以看板方式可视化管理问题",
|
"description": "以看板方式可视化管理问题",
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import { IssuesPanel } from '@/components/issue/hub/IssuesPanel';
|
|||||||
import { IssueBoardPanel } from '@/components/issue/hub/IssueBoardPanel';
|
import { IssueBoardPanel } from '@/components/issue/hub/IssueBoardPanel';
|
||||||
import { QueuePanel } from '@/components/issue/hub/QueuePanel';
|
import { QueuePanel } from '@/components/issue/hub/QueuePanel';
|
||||||
import { DiscoveryPanel } from '@/components/issue/hub/DiscoveryPanel';
|
import { DiscoveryPanel } from '@/components/issue/hub/DiscoveryPanel';
|
||||||
|
import { ObservabilityPanel } from '@/components/issue/hub/ObservabilityPanel';
|
||||||
import { Button } from '@/components/ui/Button';
|
import { Button } from '@/components/ui/Button';
|
||||||
import { Input } from '@/components/ui/Input';
|
import { Input } from '@/components/ui/Input';
|
||||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/Dialog';
|
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/Dialog';
|
||||||
@@ -193,6 +194,9 @@ export function IssueHubPage() {
|
|||||||
case 'discovery':
|
case 'discovery':
|
||||||
return null; // Discovery panel has its own controls
|
return null; // Discovery panel has its own controls
|
||||||
|
|
||||||
|
case 'observability':
|
||||||
|
return null; // Observability panel has its own controls
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -217,6 +221,7 @@ export function IssueHubPage() {
|
|||||||
{currentTab === 'board' && <IssueBoardPanel />}
|
{currentTab === 'board' && <IssueBoardPanel />}
|
||||||
{currentTab === 'queue' && <QueuePanel />}
|
{currentTab === 'queue' && <QueuePanel />}
|
||||||
{currentTab === 'discovery' && <DiscoveryPanel />}
|
{currentTab === 'discovery' && <DiscoveryPanel />}
|
||||||
|
{currentTab === 'observability' && <ObservabilityPanel />}
|
||||||
|
|
||||||
<NewIssueDialog open={isNewIssueOpen} onOpenChange={setIsNewIssueOpen} onSubmit={handleCreateIssue} isCreating={isCreating} />
|
<NewIssueDialog open={isNewIssueOpen} onOpenChange={setIsNewIssueOpen} onSubmit={handleCreateIssue} isCreating={isCreating} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -186,13 +186,18 @@ export const useFlowStore = create<FlowStore>()(
|
|||||||
method,
|
method,
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(flowToSave),
|
body: JSON.stringify(flowToSave),
|
||||||
|
credentials: 'same-origin',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to save flow: ${response.statusText}`);
|
throw new Error(`Failed to save flow: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const savedFlow = await response.json();
|
const payload = await response.json();
|
||||||
|
const savedFlow = (payload && typeof payload === 'object' && 'data' in payload)
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
? (payload as any).data
|
||||||
|
: payload;
|
||||||
|
|
||||||
set(
|
set(
|
||||||
(state) => ({
|
(state) => ({
|
||||||
@@ -215,12 +220,16 @@ export const useFlowStore = create<FlowStore>()(
|
|||||||
|
|
||||||
loadFlow: async (id: string): Promise<boolean> => {
|
loadFlow: async (id: string): Promise<boolean> => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE}/flows/${id}`);
|
const response = await fetch(`${API_BASE}/flows/${id}`, { credentials: 'same-origin' });
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to load flow: ${response.statusText}`);
|
throw new Error(`Failed to load flow: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const flow: Flow = await response.json();
|
const payload = await response.json();
|
||||||
|
const flow: Flow = (payload && typeof payload === 'object' && 'data' in payload)
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
? (payload as any).data
|
||||||
|
: payload;
|
||||||
|
|
||||||
set(
|
set(
|
||||||
{
|
{
|
||||||
@@ -246,6 +255,7 @@ export const useFlowStore = create<FlowStore>()(
|
|||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE}/flows/${id}`, {
|
const response = await fetch(`${API_BASE}/flows/${id}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
|
credentials: 'same-origin',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
@@ -274,13 +284,18 @@ export const useFlowStore = create<FlowStore>()(
|
|||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE}/flows/${id}/duplicate`, {
|
const response = await fetch(`${API_BASE}/flows/${id}/duplicate`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
credentials: 'same-origin',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to duplicate flow: ${response.statusText}`);
|
throw new Error(`Failed to duplicate flow: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const duplicatedFlow: Flow = await response.json();
|
const payload = await response.json();
|
||||||
|
const duplicatedFlow: Flow = (payload && typeof payload === 'object' && 'data' in payload)
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
? (payload as any).data
|
||||||
|
: payload;
|
||||||
|
|
||||||
set(
|
set(
|
||||||
(state) => ({
|
(state) => ({
|
||||||
@@ -478,13 +493,13 @@ export const useFlowStore = create<FlowStore>()(
|
|||||||
set({ isLoadingFlows: true }, false, 'fetchFlows/start');
|
set({ isLoadingFlows: true }, false, 'fetchFlows/start');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_BASE}/flows`);
|
const response = await fetch(`${API_BASE}/flows`, { credentials: 'same-origin' });
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to fetch flows: ${response.statusText}`);
|
throw new Error(`Failed to fetch flows: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
const flows: Flow[] = data.flows || [];
|
const flows: Flow[] = Array.isArray(data?.data) ? data.data : (data?.flows || []);
|
||||||
|
|
||||||
set({ flows, isLoadingFlows: false }, false, 'fetchFlows/success');
|
set({ flows, isLoadingFlows: false }, false, 'fetchFlows/success');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ export interface Flow {
|
|||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
version: number;
|
version: string | number;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
updated_at: string;
|
updated_at: string;
|
||||||
nodes: FlowNode[];
|
nodes: FlowNode[];
|
||||||
|
|||||||
154
ccw/src/core/routes/audit-routes.ts
Normal file
154
ccw/src/core/routes/audit-routes.ts
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
/**
|
||||||
|
* Audit Routes Module
|
||||||
|
* Read-only APIs for audit/observability panels.
|
||||||
|
*
|
||||||
|
* Currently supported:
|
||||||
|
* - GET /api/audit/cli-sessions - Read CLI session (PTY) audit events (JSONL)
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { existsSync } from 'fs';
|
||||||
|
import { readFile } from 'fs/promises';
|
||||||
|
import { join } from 'path';
|
||||||
|
import { validatePath as validateAllowedPath } from '../../utils/path-validator.js';
|
||||||
|
import type { CliSessionAuditEvent, CliSessionAuditEventType } from '../services/cli-session-audit.js';
|
||||||
|
import type { RouteContext } from './types.js';
|
||||||
|
|
||||||
|
function clampInt(value: number, min: number, max: number): number {
|
||||||
|
if (!Number.isFinite(value)) return min;
|
||||||
|
return Math.min(max, Math.max(min, Math.trunc(value)));
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseCsvParam(value: string | null): string[] {
|
||||||
|
if (!value) return [];
|
||||||
|
return value
|
||||||
|
.split(',')
|
||||||
|
.map((v) => v.trim())
|
||||||
|
.filter(Boolean);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isCliSessionAuditEventType(value: string): value is CliSessionAuditEventType {
|
||||||
|
return [
|
||||||
|
'session_created',
|
||||||
|
'session_closed',
|
||||||
|
'session_send',
|
||||||
|
'session_execute',
|
||||||
|
'session_resize',
|
||||||
|
'session_share_created',
|
||||||
|
'session_share_revoked',
|
||||||
|
'session_idle_reaped',
|
||||||
|
].includes(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function matchesSearch(event: CliSessionAuditEvent, qLower: string): boolean {
|
||||||
|
if (!qLower) return true;
|
||||||
|
|
||||||
|
const haystacks: string[] = [];
|
||||||
|
if (event.type) haystacks.push(event.type);
|
||||||
|
if (event.timestamp) haystacks.push(event.timestamp);
|
||||||
|
if (event.sessionKey) haystacks.push(event.sessionKey);
|
||||||
|
if (event.tool) haystacks.push(event.tool);
|
||||||
|
if (event.resumeKey) haystacks.push(event.resumeKey);
|
||||||
|
if (event.workingDir) haystacks.push(event.workingDir);
|
||||||
|
if (event.ip) haystacks.push(event.ip);
|
||||||
|
if (event.userAgent) haystacks.push(event.userAgent);
|
||||||
|
if (event.details) {
|
||||||
|
try {
|
||||||
|
haystacks.push(JSON.stringify(event.details));
|
||||||
|
} catch {
|
||||||
|
// Ignore non-serializable details
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return haystacks.some((h) => h.toLowerCase().includes(qLower));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle audit routes
|
||||||
|
* @returns true if route was handled, false otherwise
|
||||||
|
*/
|
||||||
|
export async function handleAuditRoutes(ctx: RouteContext): Promise<boolean> {
|
||||||
|
const { pathname, url, req, res, initialPath } = ctx;
|
||||||
|
|
||||||
|
// GET /api/audit/cli-sessions
|
||||||
|
if (pathname === '/api/audit/cli-sessions' && req.method === 'GET') {
|
||||||
|
const projectPathParam = url.searchParams.get('path') || initialPath;
|
||||||
|
|
||||||
|
const limit = clampInt(parseInt(url.searchParams.get('limit') || '200', 10), 1, 1000);
|
||||||
|
const offset = clampInt(parseInt(url.searchParams.get('offset') || '0', 10), 0, Number.MAX_SAFE_INTEGER);
|
||||||
|
|
||||||
|
const sessionKey = url.searchParams.get('sessionKey');
|
||||||
|
const qLower = (url.searchParams.get('q') || '').trim().toLowerCase();
|
||||||
|
|
||||||
|
const typeFilters = parseCsvParam(url.searchParams.get('type'))
|
||||||
|
.filter(isCliSessionAuditEventType);
|
||||||
|
const typeFilterSet = typeFilters.length > 0 ? new Set<CliSessionAuditEventType>(typeFilters) : null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const projectRoot = await validateAllowedPath(projectPathParam, {
|
||||||
|
mustExist: true,
|
||||||
|
allowedDirectories: [initialPath],
|
||||||
|
});
|
||||||
|
|
||||||
|
const filePath = join(projectRoot, '.workflow', 'audit', 'cli-sessions.jsonl');
|
||||||
|
if (!existsSync(filePath)) {
|
||||||
|
res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8' });
|
||||||
|
res.end(JSON.stringify({
|
||||||
|
success: true,
|
||||||
|
data: { events: [], total: 0, limit, offset, hasMore: false },
|
||||||
|
}));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const raw = await readFile(filePath, 'utf-8');
|
||||||
|
const parsed: CliSessionAuditEvent[] = [];
|
||||||
|
for (const line of raw.split('\n')) {
|
||||||
|
const trimmed = line.trim();
|
||||||
|
if (!trimmed) continue;
|
||||||
|
try {
|
||||||
|
parsed.push(JSON.parse(trimmed) as CliSessionAuditEvent);
|
||||||
|
} catch {
|
||||||
|
// Skip invalid JSONL line
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const filtered = parsed.filter((ev) => {
|
||||||
|
if (sessionKey && ev.sessionKey !== sessionKey) return false;
|
||||||
|
if (typeFilterSet && !typeFilterSet.has(ev.type)) return false;
|
||||||
|
if (qLower && !matchesSearch(ev, qLower)) return false;
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Best-effort: file is append-only, so reverse for newest-first.
|
||||||
|
filtered.reverse();
|
||||||
|
|
||||||
|
const total = filtered.length;
|
||||||
|
const page = filtered.slice(offset, offset + limit);
|
||||||
|
|
||||||
|
res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8' });
|
||||||
|
res.end(JSON.stringify({
|
||||||
|
success: true,
|
||||||
|
data: {
|
||||||
|
events: page,
|
||||||
|
total,
|
||||||
|
limit,
|
||||||
|
offset,
|
||||||
|
hasMore: offset + limit < total,
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
return true;
|
||||||
|
} catch (err: unknown) {
|
||||||
|
const message = err instanceof Error ? err.message : String(err);
|
||||||
|
const lowered = message.toLowerCase();
|
||||||
|
const status = lowered.includes('access denied') ? 403 : 400;
|
||||||
|
res.writeHead(status, { 'Content-Type': 'application/json; charset=utf-8' });
|
||||||
|
res.end(JSON.stringify({
|
||||||
|
success: false,
|
||||||
|
error: status === 403 ? 'Access denied' : 'Invalid request',
|
||||||
|
}));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -33,11 +33,16 @@ import { join, dirname } from 'path';
|
|||||||
import { randomBytes } from 'crypto';
|
import { randomBytes } from 'crypto';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import type { RouteContext } from './types.js';
|
import type { RouteContext } from './types.js';
|
||||||
|
import { FlowExecutor } from '../services/flow-executor.js';
|
||||||
|
import { validatePath as validateAllowedPath } from '../../utils/path-validator.js';
|
||||||
|
|
||||||
// ES Module __dirname equivalent
|
// ES Module __dirname equivalent
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = dirname(__filename);
|
const __dirname = dirname(__filename);
|
||||||
|
|
||||||
|
// In-memory execution engines for pause/resume/stop (best-effort; resets on server restart)
|
||||||
|
const activeExecutors = new Map<string, FlowExecutor>();
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// TypeScript Interfaces
|
// TypeScript Interfaces
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -847,8 +852,25 @@ function flowToTemplate(
|
|||||||
export async function handleOrchestratorRoutes(ctx: RouteContext): Promise<boolean> {
|
export async function handleOrchestratorRoutes(ctx: RouteContext): Promise<boolean> {
|
||||||
const { pathname, req, res, initialPath, handlePostRequest, broadcastToClients } = ctx;
|
const { pathname, req, res, initialPath, handlePostRequest, broadcastToClients } = ctx;
|
||||||
|
|
||||||
// Get workflow directory from initialPath
|
// Get workflow directory from initialPath, optionally overridden by ?path= (scoped to allowed dirs)
|
||||||
const workflowDir = initialPath || process.cwd();
|
const allowedRoot = initialPath || process.cwd();
|
||||||
|
let workflowDir = allowedRoot;
|
||||||
|
|
||||||
|
const projectPathParam = ctx.url.searchParams.get('path');
|
||||||
|
if (projectPathParam && projectPathParam.trim()) {
|
||||||
|
try {
|
||||||
|
workflowDir = await validateAllowedPath(projectPathParam, {
|
||||||
|
mustExist: true,
|
||||||
|
allowedDirectories: [allowedRoot],
|
||||||
|
});
|
||||||
|
} catch (err: unknown) {
|
||||||
|
const message = err instanceof Error ? err.message : String(err);
|
||||||
|
const status = message.toLowerCase().includes('access denied') ? 403 : 400;
|
||||||
|
res.writeHead(status, { 'Content-Type': 'application/json; charset=utf-8' });
|
||||||
|
res.end(JSON.stringify({ success: false, error: status === 403 ? 'Access denied' : 'Invalid path' }));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ==== LIST FLOWS ====
|
// ==== LIST FLOWS ====
|
||||||
// GET /api/orchestrator/flows
|
// GET /api/orchestrator/flows
|
||||||
@@ -1209,9 +1231,24 @@ export async function handleOrchestratorRoutes(ctx: RouteContext): Promise<boole
|
|||||||
// Broadcast execution created
|
// Broadcast execution created
|
||||||
broadcastExecutionStateUpdate(execution);
|
broadcastExecutionStateUpdate(execution);
|
||||||
|
|
||||||
// TODO: Trigger actual flow executor (future enhancement)
|
// Trigger actual flow executor (best-effort, async)
|
||||||
// For now, just create the execution in pending state
|
// Execution state is persisted by FlowExecutor and updates are broadcast via WebSocket.
|
||||||
// The executor will be implemented in a later task
|
try {
|
||||||
|
const executor = new FlowExecutor(flow, execId, workflowDir);
|
||||||
|
activeExecutors.set(execId, executor);
|
||||||
|
|
||||||
|
void executor.execute(inputVariables).then((finalState) => {
|
||||||
|
// Keep executor instance if paused, so it can be resumed.
|
||||||
|
if (finalState.status !== 'paused') {
|
||||||
|
activeExecutors.delete(execId);
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
// Best-effort cleanup on unexpected failures.
|
||||||
|
activeExecutors.delete(execId);
|
||||||
|
});
|
||||||
|
} catch {
|
||||||
|
// If executor bootstrap fails, keep the pending execution for inspection.
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
@@ -1241,6 +1278,19 @@ export async function handleOrchestratorRoutes(ctx: RouteContext): Promise<boole
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const executor = activeExecutors.get(execId);
|
||||||
|
if (executor) {
|
||||||
|
executor.pause();
|
||||||
|
const execution = await readExecutionStorage(workflowDir, execId);
|
||||||
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
||||||
|
res.end(JSON.stringify({
|
||||||
|
success: true,
|
||||||
|
data: execution ?? executor.getState(),
|
||||||
|
message: 'Pause requested'
|
||||||
|
}));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const execution = await readExecutionStorage(workflowDir, execId);
|
const execution = await readExecutionStorage(workflowDir, execId);
|
||||||
if (!execution) {
|
if (!execution) {
|
||||||
res.writeHead(404, { 'Content-Type': 'application/json' });
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|
||||||
@@ -1294,6 +1344,36 @@ export async function handleOrchestratorRoutes(ctx: RouteContext): Promise<boole
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const executor = activeExecutors.get(execId);
|
||||||
|
if (executor) {
|
||||||
|
const current = executor.getState();
|
||||||
|
if (current.status !== 'paused') {
|
||||||
|
res.writeHead(400, { 'Content-Type': 'application/json' });
|
||||||
|
res.end(JSON.stringify({
|
||||||
|
success: false,
|
||||||
|
error: `Cannot resume execution with status: ${current.status}`
|
||||||
|
}));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void executor.resume().then((finalState) => {
|
||||||
|
if (finalState.status !== 'paused') {
|
||||||
|
activeExecutors.delete(execId);
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
// Best-effort: keep executor for inspection/resume retries.
|
||||||
|
});
|
||||||
|
|
||||||
|
const execution = await readExecutionStorage(workflowDir, execId);
|
||||||
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
||||||
|
res.end(JSON.stringify({
|
||||||
|
success: true,
|
||||||
|
data: execution ?? executor.getState(),
|
||||||
|
message: 'Resume requested'
|
||||||
|
}));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const execution = await readExecutionStorage(workflowDir, execId);
|
const execution = await readExecutionStorage(workflowDir, execId);
|
||||||
if (!execution) {
|
if (!execution) {
|
||||||
res.writeHead(404, { 'Content-Type': 'application/json' });
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|
||||||
@@ -1347,6 +1427,36 @@ export async function handleOrchestratorRoutes(ctx: RouteContext): Promise<boole
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const executor = activeExecutors.get(execId);
|
||||||
|
if (executor) {
|
||||||
|
executor.stop();
|
||||||
|
|
||||||
|
// If currently paused, mark as failed immediately (no running loop to observe stop flag).
|
||||||
|
const current = executor.getState();
|
||||||
|
if (current.status === 'paused') {
|
||||||
|
const now = new Date().toISOString();
|
||||||
|
current.status = 'failed';
|
||||||
|
current.completedAt = now;
|
||||||
|
current.logs.push({
|
||||||
|
timestamp: now,
|
||||||
|
level: 'warn',
|
||||||
|
message: 'Execution manually stopped by user'
|
||||||
|
});
|
||||||
|
await writeExecutionStorage(workflowDir, current);
|
||||||
|
broadcastExecutionStateUpdate(current);
|
||||||
|
activeExecutors.delete(execId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const execution = await readExecutionStorage(workflowDir, execId);
|
||||||
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
||||||
|
res.end(JSON.stringify({
|
||||||
|
success: true,
|
||||||
|
data: execution ?? current,
|
||||||
|
message: 'Stop requested'
|
||||||
|
}));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const execution = await readExecutionStorage(workflowDir, execId);
|
const execution = await readExecutionStorage(workflowDir, execId);
|
||||||
if (!execution) {
|
if (!execution) {
|
||||||
res.writeHead(404, { 'Content-Type': 'application/json' });
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { handleStatusRoutes } from './routes/status-routes.js';
|
|||||||
import { handleCliRoutes, cleanupStaleExecutions } from './routes/cli-routes.js';
|
import { handleCliRoutes, cleanupStaleExecutions } from './routes/cli-routes.js';
|
||||||
import { handleCliSettingsRoutes } from './routes/cli-settings-routes.js';
|
import { handleCliSettingsRoutes } from './routes/cli-settings-routes.js';
|
||||||
import { handleCliSessionsRoutes } from './routes/cli-sessions-routes.js';
|
import { handleCliSessionsRoutes } from './routes/cli-sessions-routes.js';
|
||||||
|
import { handleAuditRoutes } from './routes/audit-routes.js';
|
||||||
import { handleProviderRoutes } from './routes/provider-routes.js';
|
import { handleProviderRoutes } from './routes/provider-routes.js';
|
||||||
import { handleMemoryRoutes } from './routes/memory-routes.js';
|
import { handleMemoryRoutes } from './routes/memory-routes.js';
|
||||||
import { handleCoreMemoryRoutes } from './routes/core-memory-routes.js';
|
import { handleCoreMemoryRoutes } from './routes/core-memory-routes.js';
|
||||||
@@ -615,6 +616,11 @@ export async function startServer(options: ServerOptions = {}): Promise<http.Ser
|
|||||||
if (await handleCliSessionsRoutes(routeContext)) return;
|
if (await handleCliSessionsRoutes(routeContext)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Audit routes (/api/audit/*)
|
||||||
|
if (pathname.startsWith('/api/audit')) {
|
||||||
|
if (await handleAuditRoutes(routeContext)) return;
|
||||||
|
}
|
||||||
|
|
||||||
// CLI routes (/api/cli/*)
|
// CLI routes (/api/cli/*)
|
||||||
if (pathname.startsWith('/api/cli/')) {
|
if (pathname.startsWith('/api/cli/')) {
|
||||||
// CLI Settings routes first (more specific path /api/cli/settings/*)
|
// CLI Settings routes first (more specific path /api/cli/settings/*)
|
||||||
|
|||||||
@@ -177,6 +177,14 @@ export class CliSessionManager {
|
|||||||
return Array.from(this.sessions.values()).map(({ pty: _pty, buffer: _buffer, bufferBytes: _bytes, ...rest }) => rest);
|
return Array.from(this.sessions.values()).map(({ pty: _pty, buffer: _buffer, bufferBytes: _bytes, ...rest }) => rest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getProjectRoot(): string {
|
||||||
|
return this.projectRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
hasSession(sessionKey: string): boolean {
|
||||||
|
return this.sessions.has(sessionKey);
|
||||||
|
}
|
||||||
|
|
||||||
getSession(sessionKey: string): CliSession | null {
|
getSession(sessionKey: string): CliSession | null {
|
||||||
const session = this.sessions.get(sessionKey);
|
const session = this.sessions.get(sessionKey);
|
||||||
if (!session) return null;
|
if (!session) return null;
|
||||||
@@ -398,3 +406,15 @@ export function getCliSessionManager(projectRoot: string = process.cwd()): CliSe
|
|||||||
managersByRoot.set(resolved, created);
|
managersByRoot.set(resolved, created);
|
||||||
return created;
|
return created;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the manager that owns a given sessionKey.
|
||||||
|
* Useful for cross-workspace routing (tmux-like send) where the executor
|
||||||
|
* may not share the same workflowDir/projectRoot as the target session.
|
||||||
|
*/
|
||||||
|
export function findCliSessionManager(sessionKey: string): CliSessionManager | null {
|
||||||
|
for (const manager of managersByRoot.values()) {
|
||||||
|
if (manager.hasSession(sessionKey)) return manager;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|||||||
24
ccw/src/core/services/cli-session-mux.ts
Normal file
24
ccw/src/core/services/cli-session-mux.ts
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* CliSessionMux
|
||||||
|
*
|
||||||
|
* A tiny indirection layer used by FlowExecutor (and potentially others) to
|
||||||
|
* route commands to existing PTY sessions in a testable way.
|
||||||
|
*
|
||||||
|
* Why this exists:
|
||||||
|
* - ESM module namespace exports are immutable, which makes it hard to mock
|
||||||
|
* named exports in node:test without special loaders.
|
||||||
|
* - Exporting a mutable object lets tests override behavior by swapping
|
||||||
|
* functions on the object.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import type { CliSessionManager } from './cli-session-manager.js';
|
||||||
|
import { findCliSessionManager, getCliSessionManager } from './cli-session-manager.js';
|
||||||
|
|
||||||
|
export const cliSessionMux: {
|
||||||
|
findCliSessionManager: (sessionKey: string) => CliSessionManager | null;
|
||||||
|
getCliSessionManager: (projectRoot?: string) => CliSessionManager;
|
||||||
|
} = {
|
||||||
|
findCliSessionManager,
|
||||||
|
getCliSessionManager,
|
||||||
|
};
|
||||||
|
|
||||||
@@ -19,7 +19,8 @@ import { existsSync } from 'fs';
|
|||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { broadcastToClients } from '../websocket.js';
|
import { broadcastToClients } from '../websocket.js';
|
||||||
import { executeCliTool } from '../../tools/cli-executor-core.js';
|
import { executeCliTool } from '../../tools/cli-executor-core.js';
|
||||||
import { getCliSessionManager } from './cli-session-manager.js';
|
import { cliSessionMux } from './cli-session-mux.js';
|
||||||
|
import { appendCliSessionAudit } from './cli-session-audit.js';
|
||||||
import type {
|
import type {
|
||||||
Flow,
|
Flow,
|
||||||
FlowNode,
|
FlowNode,
|
||||||
@@ -255,16 +256,46 @@ export class NodeRunner {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const manager = getCliSessionManager(this.context.workingDir || process.cwd());
|
const manager = cliSessionMux.findCliSessionManager(targetSessionKey)
|
||||||
|
?? cliSessionMux.getCliSessionManager(this.context.workingDir || process.cwd());
|
||||||
|
if (!manager.hasSession(targetSessionKey)) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error: `Target session not found: ${targetSessionKey}`
|
||||||
|
};
|
||||||
|
}
|
||||||
const routed = manager.execute(targetSessionKey, {
|
const routed = manager.execute(targetSessionKey, {
|
||||||
tool,
|
tool,
|
||||||
prompt: instruction,
|
prompt: instruction,
|
||||||
mode,
|
mode,
|
||||||
workingDir: this.context.workingDir,
|
|
||||||
resumeKey: data.resumeKey,
|
resumeKey: data.resumeKey,
|
||||||
resumeStrategy: data.resumeStrategy === 'promptConcat' ? 'promptConcat' : 'nativeResume'
|
resumeStrategy: data.resumeStrategy === 'promptConcat' ? 'promptConcat' : 'nativeResume'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Best-effort: record audit event so Observability panel includes orchestrator-routed executions.
|
||||||
|
try {
|
||||||
|
const session = manager.getSession(targetSessionKey);
|
||||||
|
appendCliSessionAudit({
|
||||||
|
type: 'session_execute',
|
||||||
|
timestamp: new Date().toISOString(),
|
||||||
|
projectRoot: manager.getProjectRoot(),
|
||||||
|
sessionKey: targetSessionKey,
|
||||||
|
tool,
|
||||||
|
resumeKey: data.resumeKey,
|
||||||
|
workingDir: session?.workingDir,
|
||||||
|
details: {
|
||||||
|
executionId: routed.executionId,
|
||||||
|
mode,
|
||||||
|
resumeStrategy: data.resumeStrategy ?? 'nativeResume',
|
||||||
|
delivery: 'sendToSession',
|
||||||
|
flowId: this.context.flowId,
|
||||||
|
nodeId: node.id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
|
||||||
const outputKey = data.outputName || `${node.id}_output`;
|
const outputKey = data.outputName || `${node.id}_output`;
|
||||||
this.context.variables[outputKey] = {
|
this.context.variables[outputKey] = {
|
||||||
delivery: 'sendToSession',
|
delivery: 'sendToSession',
|
||||||
|
|||||||
157
ccw/tests/audit-routes.test.js
Normal file
157
ccw/tests/audit-routes.test.js
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
/**
|
||||||
|
* Integration tests for audit routes.
|
||||||
|
*
|
||||||
|
* Targets runtime implementation shipped in `ccw/dist`.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { after, before, describe, it } from 'node:test';
|
||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import http from 'node:http';
|
||||||
|
import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';
|
||||||
|
import { tmpdir } from 'node:os';
|
||||||
|
import { join } from 'node:path';
|
||||||
|
|
||||||
|
const auditRoutesUrl = new URL('../dist/core/routes/audit-routes.js', import.meta.url);
|
||||||
|
auditRoutesUrl.searchParams.set('t', String(Date.now()));
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
let mod;
|
||||||
|
|
||||||
|
async function requestJson(baseUrl, method, path) {
|
||||||
|
const url = new URL(path, baseUrl);
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const req = http.request(
|
||||||
|
url,
|
||||||
|
{ method, headers: { Accept: 'application/json' } },
|
||||||
|
(res) => {
|
||||||
|
let responseBody = '';
|
||||||
|
res.on('data', (chunk) => {
|
||||||
|
responseBody += chunk.toString();
|
||||||
|
});
|
||||||
|
res.on('end', () => {
|
||||||
|
let json = null;
|
||||||
|
try {
|
||||||
|
json = responseBody ? JSON.parse(responseBody) : null;
|
||||||
|
} catch {
|
||||||
|
json = null;
|
||||||
|
}
|
||||||
|
resolve({ status: res.statusCode || 0, json, text: responseBody });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
req.on('error', reject);
|
||||||
|
req.end();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('audit routes integration', async () => {
|
||||||
|
let server = null;
|
||||||
|
let baseUrl = '';
|
||||||
|
let projectRoot = '';
|
||||||
|
|
||||||
|
before(async () => {
|
||||||
|
projectRoot = mkdtempSync(join(tmpdir(), 'ccw-audit-routes-project-'));
|
||||||
|
|
||||||
|
mod = await import(auditRoutesUrl.href);
|
||||||
|
|
||||||
|
server = http.createServer(async (req, res) => {
|
||||||
|
const url = new URL(req.url || '/', 'http://localhost');
|
||||||
|
const pathname = url.pathname;
|
||||||
|
|
||||||
|
const ctx = {
|
||||||
|
pathname,
|
||||||
|
url,
|
||||||
|
req,
|
||||||
|
res,
|
||||||
|
initialPath: projectRoot,
|
||||||
|
handlePostRequest() {},
|
||||||
|
broadcastToClients() {},
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const handled = await mod.handleAuditRoutes(ctx);
|
||||||
|
if (!handled) {
|
||||||
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|
||||||
|
res.end(JSON.stringify({ error: 'Not Found' }));
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
res.writeHead(500, { 'Content-Type': 'application/json' });
|
||||||
|
res.end(JSON.stringify({ error: err instanceof Error ? err.message : String(err) }));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await new Promise((resolve) => server.listen(0, () => resolve()));
|
||||||
|
const addr = server.address();
|
||||||
|
const port = typeof addr === 'object' && addr ? addr.port : 0;
|
||||||
|
baseUrl = `http://127.0.0.1:${port}`;
|
||||||
|
});
|
||||||
|
|
||||||
|
after(() => {
|
||||||
|
if (server) server.close();
|
||||||
|
if (projectRoot) rmSync(projectRoot, { recursive: true, force: true });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns empty list when audit file is missing', async () => {
|
||||||
|
const r = await requestJson(baseUrl, 'GET', `/api/audit/cli-sessions?path=${encodeURIComponent(projectRoot)}`);
|
||||||
|
assert.equal(r.status, 200);
|
||||||
|
assert.equal(r.json.success, true);
|
||||||
|
assert.deepEqual(r.json.data.events, []);
|
||||||
|
assert.equal(r.json.data.total, 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('lists events newest-first and supports filters', async () => {
|
||||||
|
const auditDir = join(projectRoot, '.workflow', 'audit');
|
||||||
|
mkdirSync(auditDir, { recursive: true });
|
||||||
|
const filePath = join(auditDir, 'cli-sessions.jsonl');
|
||||||
|
|
||||||
|
const ev1 = {
|
||||||
|
type: 'session_created',
|
||||||
|
timestamp: '2026-02-09T00:00:00.000Z',
|
||||||
|
projectRoot,
|
||||||
|
sessionKey: 's-1',
|
||||||
|
tool: 'claude',
|
||||||
|
resumeKey: 'ISSUE-1',
|
||||||
|
details: { a: 1 },
|
||||||
|
};
|
||||||
|
const ev2 = {
|
||||||
|
type: 'session_execute',
|
||||||
|
timestamp: '2026-02-09T00:00:01.000Z',
|
||||||
|
projectRoot,
|
||||||
|
sessionKey: 's-1',
|
||||||
|
tool: 'claude',
|
||||||
|
resumeKey: 'ISSUE-1',
|
||||||
|
details: { q: 'hello' },
|
||||||
|
};
|
||||||
|
const ev3 = {
|
||||||
|
type: 'session_send',
|
||||||
|
timestamp: '2026-02-09T00:00:02.000Z',
|
||||||
|
projectRoot,
|
||||||
|
sessionKey: 's-2',
|
||||||
|
tool: 'codex',
|
||||||
|
resumeKey: 'ISSUE-2',
|
||||||
|
details: { bytes: 10 },
|
||||||
|
};
|
||||||
|
|
||||||
|
writeFileSync(filePath, [ev1, ev2, ev3].map((e) => JSON.stringify(e)).join('\n') + '\n', 'utf8');
|
||||||
|
|
||||||
|
const all = await requestJson(baseUrl, 'GET', `/api/audit/cli-sessions?path=${encodeURIComponent(projectRoot)}&limit=10&offset=0`);
|
||||||
|
assert.equal(all.status, 200);
|
||||||
|
assert.equal(all.json.success, true);
|
||||||
|
assert.equal(all.json.data.total, 3);
|
||||||
|
// Newest-first
|
||||||
|
assert.equal(all.json.data.events[0].type, 'session_send');
|
||||||
|
assert.equal(all.json.data.events[0].sessionKey, 's-2');
|
||||||
|
|
||||||
|
const bySession = await requestJson(baseUrl, 'GET', `/api/audit/cli-sessions?path=${encodeURIComponent(projectRoot)}&sessionKey=s-1`);
|
||||||
|
assert.equal(bySession.json.data.total, 2);
|
||||||
|
assert.equal(bySession.json.data.events[0].type, 'session_execute');
|
||||||
|
|
||||||
|
const byType = await requestJson(baseUrl, 'GET', `/api/audit/cli-sessions?path=${encodeURIComponent(projectRoot)}&type=session_created`);
|
||||||
|
assert.equal(byType.json.data.total, 1);
|
||||||
|
assert.equal(byType.json.data.events[0].type, 'session_created');
|
||||||
|
|
||||||
|
const bySearch = await requestJson(baseUrl, 'GET', `/api/audit/cli-sessions?path=${encodeURIComponent(projectRoot)}&q=hello`);
|
||||||
|
assert.equal(bySearch.json.data.total, 1);
|
||||||
|
assert.equal(bySearch.json.data.events[0].type, 'session_execute');
|
||||||
|
});
|
||||||
|
});
|
||||||
112
ccw/tests/flow-executor-send-to-session.test.js
Normal file
112
ccw/tests/flow-executor-send-to-session.test.js
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
/**
|
||||||
|
* Integration test for FlowExecutor tmux-like routing to PTY sessions.
|
||||||
|
*
|
||||||
|
* Ensures that delivery=sendToSession:
|
||||||
|
* - locates the target PTY session even if the executor workflowDir differs
|
||||||
|
* - records a session_execute audit event for Observability panel
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { after, before, describe, it } from 'node:test';
|
||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import { mkdtempSync, rmSync, readFileSync } from 'node:fs';
|
||||||
|
import { tmpdir } from 'node:os';
|
||||||
|
import { join } from 'node:path';
|
||||||
|
|
||||||
|
const flowExecutorUrl = new URL('../dist/core/services/flow-executor.js', import.meta.url);
|
||||||
|
flowExecutorUrl.searchParams.set('t', String(Date.now()));
|
||||||
|
|
||||||
|
const cliSessionMuxFileUrl = new URL('../dist/core/services/cli-session-mux.js', import.meta.url).href;
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
let FlowExecutorMod;
|
||||||
|
|
||||||
|
describe('flow-executor sendToSession routing', async () => {
|
||||||
|
let workflowDir = '';
|
||||||
|
let sessionRoot = '';
|
||||||
|
let sessionKey = '';
|
||||||
|
|
||||||
|
before(async () => {
|
||||||
|
workflowDir = mkdtempSync(join(tmpdir(), 'ccw-flowexec-workflow-'));
|
||||||
|
sessionRoot = mkdtempSync(join(tmpdir(), 'ccw-flowexec-sessionroot-'));
|
||||||
|
|
||||||
|
sessionKey = 'cli-session-test-1';
|
||||||
|
|
||||||
|
const fakeManager = {
|
||||||
|
hasSession: (key) => key === sessionKey,
|
||||||
|
getProjectRoot: () => sessionRoot,
|
||||||
|
getSession: (key) => (key === sessionKey ? { sessionKey, workingDir: sessionRoot, tool: 'claude' } : null),
|
||||||
|
execute: (key, options) => {
|
||||||
|
if (key !== sessionKey) throw new Error('Session not found');
|
||||||
|
return { executionId: 'exec-routed-1', command: `echo routed ${options?.tool || ''}` };
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const muxMod = await import(cliSessionMuxFileUrl);
|
||||||
|
muxMod.cliSessionMux.findCliSessionManager = (key) => (key === sessionKey ? fakeManager : null);
|
||||||
|
muxMod.cliSessionMux.getCliSessionManager = () => fakeManager;
|
||||||
|
|
||||||
|
FlowExecutorMod = await import(flowExecutorUrl.href);
|
||||||
|
});
|
||||||
|
|
||||||
|
after(() => {
|
||||||
|
if (workflowDir) rmSync(workflowDir, { recursive: true, force: true });
|
||||||
|
if (sessionRoot) rmSync(sessionRoot, { recursive: true, force: true });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('routes execution to the target session and appends audit event', async () => {
|
||||||
|
const flowId = 'flow-test-send-to-session';
|
||||||
|
const execId = `exec-${Date.now()}`;
|
||||||
|
const now = new Date().toISOString();
|
||||||
|
|
||||||
|
const flow = {
|
||||||
|
id: flowId,
|
||||||
|
name: 'SendToSession Flow',
|
||||||
|
description: '',
|
||||||
|
version: '1.0.0',
|
||||||
|
created_at: now,
|
||||||
|
updated_at: now,
|
||||||
|
nodes: [
|
||||||
|
{
|
||||||
|
id: 'node-1',
|
||||||
|
type: 'prompt-template',
|
||||||
|
position: { x: 0, y: 0 },
|
||||||
|
data: {
|
||||||
|
label: 'SendToSession',
|
||||||
|
instruction: 'echo hello',
|
||||||
|
tool: 'claude',
|
||||||
|
mode: 'analysis',
|
||||||
|
delivery: 'sendToSession',
|
||||||
|
targetSessionKey: sessionKey,
|
||||||
|
resumeKey: 'ISSUE-TEST',
|
||||||
|
resumeStrategy: 'nativeResume',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
edges: [],
|
||||||
|
variables: {},
|
||||||
|
metadata: { source: 'local' },
|
||||||
|
};
|
||||||
|
|
||||||
|
const executor = new FlowExecutorMod.FlowExecutor(flow, execId, workflowDir);
|
||||||
|
const state = await executor.execute({});
|
||||||
|
|
||||||
|
assert.equal(state.status, 'completed');
|
||||||
|
|
||||||
|
const auditPath = join(sessionRoot, '.workflow', 'audit', 'cli-sessions.jsonl');
|
||||||
|
const raw = readFileSync(auditPath, 'utf8');
|
||||||
|
const events = raw
|
||||||
|
.split('\n')
|
||||||
|
.map((l) => l.trim())
|
||||||
|
.filter(Boolean)
|
||||||
|
.map((l) => JSON.parse(l));
|
||||||
|
|
||||||
|
const ev = events.find((e) => e.type === 'session_execute' && e.sessionKey === sessionKey);
|
||||||
|
assert.ok(ev, 'expected session_execute audit event');
|
||||||
|
assert.equal(ev.tool, 'claude');
|
||||||
|
assert.equal(ev.resumeKey, 'ISSUE-TEST');
|
||||||
|
assert.ok(ev.details);
|
||||||
|
assert.equal(ev.details.delivery, 'sendToSession');
|
||||||
|
assert.equal(ev.details.flowId, flowId);
|
||||||
|
assert.equal(ev.details.nodeId, 'node-1');
|
||||||
|
});
|
||||||
|
});
|
||||||
183
ccw/tests/orchestrator-execution.test.js
Normal file
183
ccw/tests/orchestrator-execution.test.js
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
/**
|
||||||
|
* Integration tests for orchestrator execution wiring.
|
||||||
|
*
|
||||||
|
* Verifies that POST /api/orchestrator/flows/:id/execute triggers the FlowExecutor
|
||||||
|
* and persists a completed execution for an empty flow (no nodes).
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { after, before, describe, it, mock } from 'node:test';
|
||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import http from 'node:http';
|
||||||
|
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
|
||||||
|
import { tmpdir } from 'node:os';
|
||||||
|
import { join } from 'node:path';
|
||||||
|
|
||||||
|
const orchestratorRoutesUrl = new URL('../dist/core/routes/orchestrator-routes.js', import.meta.url);
|
||||||
|
orchestratorRoutesUrl.searchParams.set('t', String(Date.now()));
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
let mod;
|
||||||
|
|
||||||
|
async function requestJson(baseUrl, method, path, body) {
|
||||||
|
const url = new URL(path, baseUrl);
|
||||||
|
const payload = body === undefined ? null : Buffer.from(JSON.stringify(body), 'utf8');
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const req = http.request(
|
||||||
|
url,
|
||||||
|
{
|
||||||
|
method,
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
...(payload
|
||||||
|
? { 'Content-Type': 'application/json', 'Content-Length': String(payload.length) }
|
||||||
|
: {}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
(res) => {
|
||||||
|
let responseBody = '';
|
||||||
|
res.on('data', (chunk) => {
|
||||||
|
responseBody += chunk.toString();
|
||||||
|
});
|
||||||
|
res.on('end', () => {
|
||||||
|
let json = null;
|
||||||
|
try {
|
||||||
|
json = responseBody ? JSON.parse(responseBody) : null;
|
||||||
|
} catch {
|
||||||
|
json = null;
|
||||||
|
}
|
||||||
|
resolve({ status: res.statusCode || 0, json, text: responseBody });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
req.on('error', reject);
|
||||||
|
if (payload) req.write(payload);
|
||||||
|
req.end();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePostRequest(req, res, handler) {
|
||||||
|
let body = '';
|
||||||
|
req.on('data', (chunk) => {
|
||||||
|
body += chunk.toString();
|
||||||
|
});
|
||||||
|
req.on('end', async () => {
|
||||||
|
try {
|
||||||
|
const parsed = body ? JSON.parse(body) : {};
|
||||||
|
const result = await handler(parsed);
|
||||||
|
|
||||||
|
if (result?.error) {
|
||||||
|
res.writeHead(result.status || 500, { 'Content-Type': 'application/json' });
|
||||||
|
res.end(JSON.stringify({ error: result.error }));
|
||||||
|
} else {
|
||||||
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
||||||
|
res.end(JSON.stringify(result));
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
res.writeHead(500, { 'Content-Type': 'application/json' });
|
||||||
|
res.end(JSON.stringify({ error: err instanceof Error ? err.message : String(err) }));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('orchestrator execution integration', async () => {
|
||||||
|
let server = null;
|
||||||
|
let baseUrl = '';
|
||||||
|
let projectRoot = '';
|
||||||
|
|
||||||
|
before(async () => {
|
||||||
|
projectRoot = mkdtempSync(join(tmpdir(), 'ccw-orchestrator-project-'));
|
||||||
|
|
||||||
|
// Reduce noise from executor internals during tests
|
||||||
|
mock.method(console, 'log', () => {});
|
||||||
|
mock.method(console, 'error', () => {});
|
||||||
|
|
||||||
|
mod = await import(orchestratorRoutesUrl.href);
|
||||||
|
|
||||||
|
// Seed a minimal empty flow (no nodes)
|
||||||
|
const flowsDir = join(projectRoot, '.workflow', '.orchestrator', 'flows');
|
||||||
|
mkdirSync(flowsDir, { recursive: true });
|
||||||
|
const flowId = 'flow-test-empty';
|
||||||
|
const now = new Date().toISOString();
|
||||||
|
writeFileSync(
|
||||||
|
join(flowsDir, `${flowId}.json`),
|
||||||
|
JSON.stringify({
|
||||||
|
id: flowId,
|
||||||
|
name: 'Empty Flow',
|
||||||
|
description: '',
|
||||||
|
version: '1.0.0',
|
||||||
|
created_at: now,
|
||||||
|
updated_at: now,
|
||||||
|
nodes: [],
|
||||||
|
edges: [],
|
||||||
|
variables: {},
|
||||||
|
metadata: { source: 'local' },
|
||||||
|
}, null, 2),
|
||||||
|
'utf8'
|
||||||
|
);
|
||||||
|
|
||||||
|
server = http.createServer(async (req, res) => {
|
||||||
|
const url = new URL(req.url || '/', 'http://localhost');
|
||||||
|
const pathname = url.pathname;
|
||||||
|
|
||||||
|
const ctx = {
|
||||||
|
pathname,
|
||||||
|
url,
|
||||||
|
req,
|
||||||
|
res,
|
||||||
|
initialPath: projectRoot,
|
||||||
|
handlePostRequest,
|
||||||
|
broadcastToClients() {},
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const handled = await mod.handleOrchestratorRoutes(ctx);
|
||||||
|
if (!handled) {
|
||||||
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|
||||||
|
res.end(JSON.stringify({ error: 'Not Found' }));
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
res.writeHead(500, { 'Content-Type': 'application/json' });
|
||||||
|
res.end(JSON.stringify({ error: err instanceof Error ? err.message : String(err) }));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await new Promise((resolve) => server.listen(0, () => resolve()));
|
||||||
|
const addr = server.address();
|
||||||
|
const port = typeof addr === 'object' && addr ? addr.port : 0;
|
||||||
|
baseUrl = `http://127.0.0.1:${port}`;
|
||||||
|
});
|
||||||
|
|
||||||
|
after(() => {
|
||||||
|
if (server) server.close();
|
||||||
|
if (projectRoot) rmSync(projectRoot, { recursive: true, force: true });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('executes an empty flow to completion', async () => {
|
||||||
|
const start = await requestJson(baseUrl, 'POST', '/api/orchestrator/flows/flow-test-empty/execute', {});
|
||||||
|
assert.equal(start.status, 200);
|
||||||
|
assert.equal(start.json.success, true);
|
||||||
|
assert.ok(start.json.data.execId);
|
||||||
|
|
||||||
|
const execId = start.json.data.execId;
|
||||||
|
|
||||||
|
// Poll until completed (should be very fast for empty flow)
|
||||||
|
let state = null;
|
||||||
|
for (let i = 0; i < 50; i++) {
|
||||||
|
// eslint-disable-next-line no-await-in-loop
|
||||||
|
await new Promise((r) => setTimeout(r, 20));
|
||||||
|
// eslint-disable-next-line no-await-in-loop
|
||||||
|
const r = await requestJson(baseUrl, 'GET', `/api/orchestrator/executions/${encodeURIComponent(execId)}`);
|
||||||
|
if (r.status === 200 && r.json?.success) {
|
||||||
|
state = r.json.data;
|
||||||
|
if (state.status === 'completed') break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.ok(state, 'expected execution state to be readable');
|
||||||
|
assert.equal(state.status, 'completed');
|
||||||
|
assert.ok(state.startedAt);
|
||||||
|
assert.ok(state.completedAt);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
@@ -0,0 +1,465 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"timestamp": "2026-02-10 12:23:36",
|
||||||
|
"source": "src",
|
||||||
|
"k": 10,
|
||||||
|
"coarse_k": 100,
|
||||||
|
"query_count": 7,
|
||||||
|
"avg_jaccard_topk": 0.12384302205730777,
|
||||||
|
"avg_rbo_topk": 0.09816673566816325,
|
||||||
|
"staged": {
|
||||||
|
"success": 7,
|
||||||
|
"avg_latency_ms": 3996.4113285754406
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"success": 7,
|
||||||
|
"avg_latency_ms": 2780.485200004918
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"comparisons": [
|
||||||
|
{
|
||||||
|
"query": "class Config",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "class Config",
|
||||||
|
"latency_ms": 2365.3048999905586,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\path_mapper.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\api\\semantic.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\api\\references.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\config.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\server.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 25.228023529052734,
|
||||||
|
"stage1_fallback_search_ms": 206.0999870300293,
|
||||||
|
"stage2_expand_ms": 16.644954681396484,
|
||||||
|
"stage3_cluster_ms": 0.025987625122070312,
|
||||||
|
"stage4_rerank_ms": 2064.2504692077637
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 37,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 86,
|
||||||
|
"stage2_unique_paths": 53,
|
||||||
|
"stage2_duplicate_paths": 33,
|
||||||
|
"stage3_clustered": 20,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "class Config",
|
||||||
|
"latency_ms": 2610.047899991274,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\query_parser.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\embedding_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migration_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.125,
|
||||||
|
"rbo_topk": 0.06741929885142856,
|
||||||
|
"staged_unique_files_topk": 8,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 5,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "def search",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "def search",
|
||||||
|
"latency_ms": 3723.305599987507,
|
||||||
|
"num_results": 3,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\entities.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 31.742334365844727,
|
||||||
|
"stage2_expand_ms": 2125.1025199890137,
|
||||||
|
"stage3_cluster_ms": 0.0007152557373046875,
|
||||||
|
"stage4_rerank_ms": 1511.4071369171143
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 3,
|
||||||
|
"stage2_expanded": 4,
|
||||||
|
"stage2_unique_paths": 3,
|
||||||
|
"stage2_duplicate_paths": 1,
|
||||||
|
"stage3_clustered": 4,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "def search",
|
||||||
|
"latency_ms": 2072.4792000055313,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\query_parser.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.09090909090909091,
|
||||||
|
"rbo_topk": 0.23541639942571424,
|
||||||
|
"staged_unique_files_topk": 2,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 2,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "LspBridge",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "LspBridge",
|
||||||
|
"latency_ms": 5251.151299983263,
|
||||||
|
"num_results": 6,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_graph_builder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\keepalive_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\__init__.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 32.721757888793945,
|
||||||
|
"stage1_fallback_search_ms": 195.51420211791992,
|
||||||
|
"stage2_expand_ms": 2060.0733757019043,
|
||||||
|
"stage3_cluster_ms": 0.0095367431640625,
|
||||||
|
"stage4_rerank_ms": 2900.8395671844482
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 5,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 31,
|
||||||
|
"stage2_unique_paths": 11,
|
||||||
|
"stage2_duplicate_paths": 20,
|
||||||
|
"stage3_clustered": 20,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "LspBridge",
|
||||||
|
"latency_ms": 1972.8982000350952,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\vector_meta_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\graph_expander.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.06666666666666667,
|
||||||
|
"rbo_topk": 0.045191399425714276,
|
||||||
|
"staged_unique_files_topk": 6,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 2,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "graph expansion",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "graph expansion",
|
||||||
|
"latency_ms": 4101.171400010586,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migrations\\migration_007_add_graph_neighbors.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_graph_builder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\ann_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\config.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\graph_expander.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\enrichment.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 29.141902923583984,
|
||||||
|
"stage1_fallback_search_ms": 234.2982292175293,
|
||||||
|
"stage2_expand_ms": 2082.4878215789795,
|
||||||
|
"stage3_cluster_ms": 0.0011920928955078125,
|
||||||
|
"stage4_rerank_ms": 1698.7183094024658
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 11,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 16,
|
||||||
|
"stage2_unique_paths": 13,
|
||||||
|
"stage2_duplicate_paths": 3,
|
||||||
|
"stage3_clustered": 16,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "graph expansion",
|
||||||
|
"latency_ms": 2331.9747000038624,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migration_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\global_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.1875,
|
||||||
|
"rbo_topk": 0.06134116970571428,
|
||||||
|
"staged_unique_files_topk": 9,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 7,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"latency_ms": 4032.0041000247,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\config.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\noop_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\dbscan_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\base.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\hdbscan_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\frequency_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\factory.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\__init__.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 42.098283767700195,
|
||||||
|
"stage1_fallback_search_ms": 209.6574306488037,
|
||||||
|
"stage2_expand_ms": 2053.9097785949707,
|
||||||
|
"stage3_cluster_ms": 0.00095367431640625,
|
||||||
|
"stage4_rerank_ms": 1665.3883457183838
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 10,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 10,
|
||||||
|
"stage2_unique_paths": 10,
|
||||||
|
"stage2_duplicate_paths": 0,
|
||||||
|
"stage3_clustered": 10,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 10
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"latency_ms": 2026.5661999881268,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\gpu_support.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\enrichment.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.1111111111111111,
|
||||||
|
"rbo_topk": 0.04670528456571428,
|
||||||
|
"staged_unique_files_topk": 10,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 3,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "error handling",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "error handling",
|
||||||
|
"latency_ms": 4237.893900036812,
|
||||||
|
"num_results": 6,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\gpu_support.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\rotational_embedder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\watcher\\manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 64.01538848876953,
|
||||||
|
"stage1_fallback_search_ms": 225.14033317565918,
|
||||||
|
"stage2_expand_ms": 2116.3012981414795,
|
||||||
|
"stage3_cluster_ms": 0.0007152557373046875,
|
||||||
|
"stage4_rerank_ms": 1776.0803699493408
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 5,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 13,
|
||||||
|
"stage2_unique_paths": 6,
|
||||||
|
"stage2_duplicate_paths": 7,
|
||||||
|
"stage3_clustered": 13,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "error handling",
|
||||||
|
"latency_ms": 2125.935900002718,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\embedding_manager.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.07142857142857142,
|
||||||
|
"rbo_topk": 0.045191399425714276,
|
||||||
|
"staged_unique_files_topk": 5,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 4,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "how to parse json",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "how to parse json",
|
||||||
|
"latency_ms": 4264.048099994659,
|
||||||
|
"num_results": 7,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\standalone_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\parsers\\factory.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\indexing\\symbol_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\parsers\\treesitter_parser.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 31.972646713256836,
|
||||||
|
"stage1_fallback_search_ms": 235.47840118408203,
|
||||||
|
"stage2_expand_ms": 2161.5889072418213,
|
||||||
|
"stage3_cluster_ms": 0.0007152557373046875,
|
||||||
|
"stage4_rerank_ms": 1768.0847644805908
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 4,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 9,
|
||||||
|
"stage2_unique_paths": 7,
|
||||||
|
"stage2_duplicate_paths": 2,
|
||||||
|
"stage3_clustered": 9,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "how to parse json",
|
||||||
|
"latency_ms": 6323.49430000782,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\ranking.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\ann_index.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.21428571428571427,
|
||||||
|
"rbo_topk": 0.18590219827714285,
|
||||||
|
"staged_unique_files_topk": 7,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 5,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,467 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"timestamp": "2026-02-10 12:46:47",
|
||||||
|
"source": "src",
|
||||||
|
"k": 10,
|
||||||
|
"coarse_k": 100,
|
||||||
|
"query_count": 7,
|
||||||
|
"avg_jaccard_topk": 0.11350467619264612,
|
||||||
|
"avg_rbo_topk": 0.09062624799510204,
|
||||||
|
"staged": {
|
||||||
|
"success": 7,
|
||||||
|
"avg_latency_ms": 5670.9065000244545
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"success": 7,
|
||||||
|
"avg_latency_ms": 3047.475757143327
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"comparisons": [
|
||||||
|
{
|
||||||
|
"query": "class Config",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "class Config",
|
||||||
|
"latency_ms": 2971.5892000496387,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\path_mapper.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\api\\references.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\api\\semantic.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\server.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\parsers\\factory.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\watcher\\file_watcher.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 108.11758041381836,
|
||||||
|
"stage1_fallback_search_ms": 230.96132278442383,
|
||||||
|
"stage2_expand_ms": 18.60976219177246,
|
||||||
|
"stage3_cluster_ms": 1.100301742553711,
|
||||||
|
"stage4_rerank_ms": 2528.761625289917
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 37,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 86,
|
||||||
|
"stage2_unique_paths": 53,
|
||||||
|
"stage2_duplicate_paths": 33,
|
||||||
|
"stage3_clustered": 20,
|
||||||
|
"stage3_strategy": "dir_rr",
|
||||||
|
"stage4_reranked": 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "class Config",
|
||||||
|
"latency_ms": 2937.113800019026,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\query_parser.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\embedding_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migration_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.05263157894736842,
|
||||||
|
"rbo_topk": 0.014635885139999999,
|
||||||
|
"staged_unique_files_topk": 10,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 8,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "def search",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "def search",
|
||||||
|
"latency_ms": 10065.153400033712,
|
||||||
|
"num_results": 3,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\entities.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 127.17461585998535,
|
||||||
|
"stage2_expand_ms": 7361.833810806274,
|
||||||
|
"stage3_cluster_ms": 0.001430511474609375,
|
||||||
|
"stage4_rerank_ms": 2472.7542400360107
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 3,
|
||||||
|
"stage2_expanded": 4,
|
||||||
|
"stage2_unique_paths": 3,
|
||||||
|
"stage2_duplicate_paths": 1,
|
||||||
|
"stage3_clustered": 4,
|
||||||
|
"stage3_strategy": "dir_rr",
|
||||||
|
"stage4_reranked": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "def search",
|
||||||
|
"latency_ms": 3059.5018000006676,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\query_parser.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.09090909090909091,
|
||||||
|
"rbo_topk": 0.23541639942571424,
|
||||||
|
"staged_unique_files_topk": 2,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 2,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "LspBridge",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "LspBridge",
|
||||||
|
"latency_ms": 5557.314100056887,
|
||||||
|
"num_results": 7,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\keepalive_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_graph_builder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\__init__.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 133.9263916015625,
|
||||||
|
"stage1_fallback_search_ms": 242.1243190765381,
|
||||||
|
"stage2_expand_ms": 2106.602430343628,
|
||||||
|
"stage3_cluster_ms": 0.47016143798828125,
|
||||||
|
"stage4_rerank_ms": 2967.3829078674316
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 5,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 31,
|
||||||
|
"stage2_unique_paths": 11,
|
||||||
|
"stage2_duplicate_paths": 20,
|
||||||
|
"stage3_clustered": 20,
|
||||||
|
"stage3_strategy": "dir_rr",
|
||||||
|
"stage4_reranked": 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "LspBridge",
|
||||||
|
"latency_ms": 3157.7918999791145,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\vector_meta_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\graph_expander.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.06666666666666667,
|
||||||
|
"rbo_topk": 0.045191399425714276,
|
||||||
|
"staged_unique_files_topk": 6,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 2,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "graph expansion",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "graph expansion",
|
||||||
|
"latency_ms": 5458.670999974012,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migrations\\migration_007_add_graph_neighbors.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_graph_builder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\ann_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\config.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\graph_expander.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\enrichment.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 113.62957954406738,
|
||||||
|
"stage1_fallback_search_ms": 204.56886291503906,
|
||||||
|
"stage2_expand_ms": 2166.4509773254395,
|
||||||
|
"stage3_cluster_ms": 0.0011920928955078125,
|
||||||
|
"stage4_rerank_ms": 2872.969627380371
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 11,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 16,
|
||||||
|
"stage2_unique_paths": 13,
|
||||||
|
"stage2_duplicate_paths": 3,
|
||||||
|
"stage3_clustered": 16,
|
||||||
|
"stage3_strategy": "dir_rr",
|
||||||
|
"stage4_reranked": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "graph expansion",
|
||||||
|
"latency_ms": 2896.5341999828815,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migration_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\global_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.1875,
|
||||||
|
"rbo_topk": 0.06134116970571428,
|
||||||
|
"staged_unique_files_topk": 9,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 7,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"latency_ms": 5028.861099988222,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\config.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\noop_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\dbscan_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\base.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\hdbscan_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\frequency_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\factory.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\__init__.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 111.71293258666992,
|
||||||
|
"stage1_fallback_search_ms": 192.02208518981934,
|
||||||
|
"stage2_expand_ms": 2054.065465927124,
|
||||||
|
"stage3_cluster_ms": 0.0007152557373046875,
|
||||||
|
"stage4_rerank_ms": 2579.0507793426514
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 10,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 10,
|
||||||
|
"stage2_unique_paths": 10,
|
||||||
|
"stage2_duplicate_paths": 0,
|
||||||
|
"stage3_clustered": 10,
|
||||||
|
"stage3_strategy": "dir_rr",
|
||||||
|
"stage4_reranked": 10
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"latency_ms": 3627.1755999922752,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\gpu_support.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\enrichment.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.1111111111111111,
|
||||||
|
"rbo_topk": 0.04670528456571428,
|
||||||
|
"staged_unique_files_topk": 10,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 3,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "error handling",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "error handling",
|
||||||
|
"latency_ms": 5114.356300055981,
|
||||||
|
"num_results": 6,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\gpu_support.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\rotational_embedder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\watcher\\manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 135.76626777648926,
|
||||||
|
"stage1_fallback_search_ms": 211.12942695617676,
|
||||||
|
"stage2_expand_ms": 2151.059150695801,
|
||||||
|
"stage3_cluster_ms": 0.00095367431640625,
|
||||||
|
"stage4_rerank_ms": 2519.892692565918
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 5,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 13,
|
||||||
|
"stage2_unique_paths": 6,
|
||||||
|
"stage2_duplicate_paths": 7,
|
||||||
|
"stage3_clustered": 13,
|
||||||
|
"stage3_strategy": "dir_rr",
|
||||||
|
"stage4_reranked": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "error handling",
|
||||||
|
"latency_ms": 2853.594000041485,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\embedding_manager.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.07142857142857142,
|
||||||
|
"rbo_topk": 0.045191399425714276,
|
||||||
|
"staged_unique_files_topk": 5,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 4,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "how to parse json",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "how to parse json",
|
||||||
|
"latency_ms": 5500.400400012732,
|
||||||
|
"num_results": 7,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\standalone_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\parsers\\factory.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\indexing\\symbol_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\parsers\\treesitter_parser.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 96.66872024536133,
|
||||||
|
"stage1_fallback_search_ms": 176.37205123901367,
|
||||||
|
"stage2_expand_ms": 2137.751340866089,
|
||||||
|
"stage3_cluster_ms": 0.00095367431640625,
|
||||||
|
"stage4_rerank_ms": 2991.840124130249
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 4,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 9,
|
||||||
|
"stage2_unique_paths": 7,
|
||||||
|
"stage2_duplicate_paths": 2,
|
||||||
|
"stage3_clustered": 9,
|
||||||
|
"stage3_strategy": "dir_rr",
|
||||||
|
"stage4_reranked": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "how to parse json",
|
||||||
|
"latency_ms": 2800.6189999878407,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\ranking.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\ann_index.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.21428571428571427,
|
||||||
|
"rbo_topk": 0.18590219827714285,
|
||||||
|
"staged_unique_files_topk": 7,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 5,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
465
codex-lens/benchmarks/results/compare_2026-02-10_path_fast7.json
Normal file
465
codex-lens/benchmarks/results/compare_2026-02-10_path_fast7.json
Normal file
@@ -0,0 +1,465 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"timestamp": "2026-02-10 12:52:44",
|
||||||
|
"source": "src",
|
||||||
|
"k": 10,
|
||||||
|
"coarse_k": 100,
|
||||||
|
"query_count": 7,
|
||||||
|
"avg_jaccard_topk": 0.13455730777159347,
|
||||||
|
"avg_rbo_topk": 0.10274807844326529,
|
||||||
|
"staged": {
|
||||||
|
"success": 7,
|
||||||
|
"avg_latency_ms": 4445.262371412346
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"success": 7,
|
||||||
|
"avg_latency_ms": 3327.1750857276575
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"comparisons": [
|
||||||
|
{
|
||||||
|
"query": "class Config",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "class Config",
|
||||||
|
"latency_ms": 2719.7998999655247,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\path_mapper.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\api\\semantic.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\api\\references.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\embedding_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\server.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 33.12373161315918,
|
||||||
|
"stage1_fallback_search_ms": 230.31878471374512,
|
||||||
|
"stage2_expand_ms": 22.444486618041992,
|
||||||
|
"stage3_cluster_ms": 0.06079673767089844,
|
||||||
|
"stage4_rerank_ms": 2338.5443687438965
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 37,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 86,
|
||||||
|
"stage2_unique_paths": 53,
|
||||||
|
"stage2_duplicate_paths": 33,
|
||||||
|
"stage3_clustered": 20,
|
||||||
|
"stage3_strategy": "path",
|
||||||
|
"stage4_reranked": 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "class Config",
|
||||||
|
"latency_ms": 2334.8668000102043,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\query_parser.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\embedding_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migration_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.2,
|
||||||
|
"rbo_topk": 0.09948869827714285,
|
||||||
|
"staged_unique_files_topk": 8,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 4,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "def search",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "def search",
|
||||||
|
"latency_ms": 4470.056899994612,
|
||||||
|
"num_results": 3,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\entities.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 28.5646915435791,
|
||||||
|
"stage2_expand_ms": 2216.57133102417,
|
||||||
|
"stage3_cluster_ms": 0.001430511474609375,
|
||||||
|
"stage4_rerank_ms": 2131.246566772461
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 3,
|
||||||
|
"stage2_expanded": 4,
|
||||||
|
"stage2_unique_paths": 3,
|
||||||
|
"stage2_duplicate_paths": 1,
|
||||||
|
"stage3_clustered": 4,
|
||||||
|
"stage3_strategy": "path",
|
||||||
|
"stage4_reranked": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "def search",
|
||||||
|
"latency_ms": 2447.341199964285,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\query_parser.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.09090909090909091,
|
||||||
|
"rbo_topk": 0.23541639942571424,
|
||||||
|
"staged_unique_files_topk": 2,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 2,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "LspBridge",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "LspBridge",
|
||||||
|
"latency_ms": 6126.65680000186,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_graph_builder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\keepalive_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 25.135278701782227,
|
||||||
|
"stage1_fallback_search_ms": 171.53453826904297,
|
||||||
|
"stage2_expand_ms": 2094.9013233184814,
|
||||||
|
"stage3_cluster_ms": 0.024318695068359375,
|
||||||
|
"stage4_rerank_ms": 3743.204355239868
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 5,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 31,
|
||||||
|
"stage2_unique_paths": 11,
|
||||||
|
"stage2_duplicate_paths": 20,
|
||||||
|
"stage3_clustered": 11,
|
||||||
|
"stage3_strategy": "path",
|
||||||
|
"stage4_reranked": 11
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "LspBridge",
|
||||||
|
"latency_ms": 9015.508300036192,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\vector_meta_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\graph_expander.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.06666666666666667,
|
||||||
|
"rbo_topk": 0.045191399425714276,
|
||||||
|
"staged_unique_files_topk": 6,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 2,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "graph expansion",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "graph expansion",
|
||||||
|
"latency_ms": 4319.597599953413,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migrations\\migration_007_add_graph_neighbors.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_graph_builder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\ann_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\config.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\graph_expander.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\enrichment.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 18.799781799316406,
|
||||||
|
"stage1_fallback_search_ms": 167.36602783203125,
|
||||||
|
"stage2_expand_ms": 2101.4957427978516,
|
||||||
|
"stage3_cluster_ms": 0.00095367431640625,
|
||||||
|
"stage4_rerank_ms": 1976.8805503845215
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 11,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 16,
|
||||||
|
"stage2_unique_paths": 13,
|
||||||
|
"stage2_duplicate_paths": 3,
|
||||||
|
"stage3_clustered": 16,
|
||||||
|
"stage3_strategy": "path",
|
||||||
|
"stage4_reranked": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "graph expansion",
|
||||||
|
"latency_ms": 2356.994699984789,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migration_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\global_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.1875,
|
||||||
|
"rbo_topk": 0.06134116970571428,
|
||||||
|
"staged_unique_files_topk": 9,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 7,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"latency_ms": 4574.691199988127,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\config.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\dbscan_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\noop_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\base.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\hdbscan_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\frequency_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\factory.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\__init__.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 45.72629928588867,
|
||||||
|
"stage1_fallback_search_ms": 233.0036163330078,
|
||||||
|
"stage2_expand_ms": 2068.8536167144775,
|
||||||
|
"stage3_cluster_ms": 0.0007152557373046875,
|
||||||
|
"stage4_rerank_ms": 2152.9064178466797
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 10,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 10,
|
||||||
|
"stage2_unique_paths": 10,
|
||||||
|
"stage2_duplicate_paths": 0,
|
||||||
|
"stage3_clustered": 10,
|
||||||
|
"stage3_strategy": "path",
|
||||||
|
"stage4_reranked": 10
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"latency_ms": 2311.4787000119686,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\gpu_support.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\enrichment.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.1111111111111111,
|
||||||
|
"rbo_topk": 0.04670528456571428,
|
||||||
|
"staged_unique_files_topk": 10,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 3,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "error handling",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "error handling",
|
||||||
|
"latency_ms": 4616.5374999940395,
|
||||||
|
"num_results": 6,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\gpu_support.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\rotational_embedder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\watcher\\manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 38.83004188537598,
|
||||||
|
"stage1_fallback_search_ms": 263.0441188812256,
|
||||||
|
"stage2_expand_ms": 2070.7976818084717,
|
||||||
|
"stage3_cluster_ms": 0.00095367431640625,
|
||||||
|
"stage4_rerank_ms": 2133.629083633423
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 5,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 13,
|
||||||
|
"stage2_unique_paths": 6,
|
||||||
|
"stage2_duplicate_paths": 7,
|
||||||
|
"stage3_clustered": 13,
|
||||||
|
"stage3_strategy": "path",
|
||||||
|
"stage4_reranked": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "error handling",
|
||||||
|
"latency_ms": 2337.4413000643253,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\embedding_manager.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.07142857142857142,
|
||||||
|
"rbo_topk": 0.045191399425714276,
|
||||||
|
"staged_unique_files_topk": 5,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 4,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "how to parse json",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "how to parse json",
|
||||||
|
"latency_ms": 4289.496699988842,
|
||||||
|
"num_results": 7,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\standalone_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\parsers\\factory.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\indexing\\symbol_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\parsers\\treesitter_parser.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 34.40546989440918,
|
||||||
|
"stage1_fallback_search_ms": 231.8587303161621,
|
||||||
|
"stage2_expand_ms": 2068.8445568084717,
|
||||||
|
"stage3_cluster_ms": 0.0007152557373046875,
|
||||||
|
"stage4_rerank_ms": 1850.6083488464355
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 4,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 9,
|
||||||
|
"stage2_unique_paths": 7,
|
||||||
|
"stage2_duplicate_paths": 2,
|
||||||
|
"stage3_clustered": 9,
|
||||||
|
"stage3_strategy": "path",
|
||||||
|
"stage4_reranked": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "how to parse json",
|
||||||
|
"latency_ms": 2486.594600021839,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\ranking.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\ann_index.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.21428571428571427,
|
||||||
|
"rbo_topk": 0.18590219827714285,
|
||||||
|
"staged_unique_files_topk": 7,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 5,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,465 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"timestamp": "2026-02-10 12:44:24",
|
||||||
|
"source": "src",
|
||||||
|
"k": 10,
|
||||||
|
"coarse_k": 100,
|
||||||
|
"query_count": 7,
|
||||||
|
"avg_jaccard_topk": 0.12384302205730777,
|
||||||
|
"avg_rbo_topk": 0.09816673566816325,
|
||||||
|
"staged": {
|
||||||
|
"success": 7,
|
||||||
|
"avg_latency_ms": 4603.035771421024
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"success": 7,
|
||||||
|
"avg_latency_ms": 2776.139728575945
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"comparisons": [
|
||||||
|
{
|
||||||
|
"query": "class Config",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "class Config",
|
||||||
|
"latency_ms": 3544.4309000074863,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\path_mapper.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\api\\semantic.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\api\\references.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\config.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\server.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 34.082651138305664,
|
||||||
|
"stage1_fallback_search_ms": 217.52095222473145,
|
||||||
|
"stage2_expand_ms": 18.847942352294922,
|
||||||
|
"stage3_cluster_ms": 0.031948089599609375,
|
||||||
|
"stage4_rerank_ms": 3176.4564514160156
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 37,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 86,
|
||||||
|
"stage2_unique_paths": 53,
|
||||||
|
"stage2_duplicate_paths": 33,
|
||||||
|
"stage3_clustered": 20,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "class Config",
|
||||||
|
"latency_ms": 3075.5329999923706,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\query_parser.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\embedding_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migration_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.125,
|
||||||
|
"rbo_topk": 0.06741929885142856,
|
||||||
|
"staged_unique_files_topk": 8,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 5,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "def search",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "def search",
|
||||||
|
"latency_ms": 4371.493600010872,
|
||||||
|
"num_results": 3,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\entities.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 29.517173767089844,
|
||||||
|
"stage2_expand_ms": 2236.224412918091,
|
||||||
|
"stage3_cluster_ms": 0.0007152557373046875,
|
||||||
|
"stage4_rerank_ms": 1998.866319656372
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 3,
|
||||||
|
"stage2_expanded": 4,
|
||||||
|
"stage2_unique_paths": 3,
|
||||||
|
"stage2_duplicate_paths": 1,
|
||||||
|
"stage3_clustered": 4,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "def search",
|
||||||
|
"latency_ms": 2334.758200019598,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\query_parser.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.09090909090909091,
|
||||||
|
"rbo_topk": 0.23541639942571424,
|
||||||
|
"staged_unique_files_topk": 2,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 2,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "LspBridge",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "LspBridge",
|
||||||
|
"latency_ms": 4143.470999985933,
|
||||||
|
"num_results": 6,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_graph_builder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\keepalive_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\__init__.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 20.66636085510254,
|
||||||
|
"stage1_fallback_search_ms": 150.6054401397705,
|
||||||
|
"stage2_expand_ms": 2064.2361640930176,
|
||||||
|
"stage3_cluster_ms": 0.012159347534179688,
|
||||||
|
"stage4_rerank_ms": 1838.1483554840088
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 5,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 31,
|
||||||
|
"stage2_unique_paths": 11,
|
||||||
|
"stage2_duplicate_paths": 20,
|
||||||
|
"stage3_clustered": 20,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "LspBridge",
|
||||||
|
"latency_ms": 2207.86700001359,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\vector_meta_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\graph_expander.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.06666666666666667,
|
||||||
|
"rbo_topk": 0.045191399425714276,
|
||||||
|
"staged_unique_files_topk": 6,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 2,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "graph expansion",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "graph expansion",
|
||||||
|
"latency_ms": 4234.638899981976,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migrations\\migration_007_add_graph_neighbors.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_graph_builder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\ann_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\config.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\graph_expander.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\enrichment.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 21.48127555847168,
|
||||||
|
"stage1_fallback_search_ms": 153.59735488891602,
|
||||||
|
"stage2_expand_ms": 2092.521905899048,
|
||||||
|
"stage3_cluster_ms": 0.00095367431640625,
|
||||||
|
"stage4_rerank_ms": 1876.7595291137695
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 11,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 16,
|
||||||
|
"stage2_unique_paths": 13,
|
||||||
|
"stage2_duplicate_paths": 3,
|
||||||
|
"stage3_clustered": 16,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "graph expansion",
|
||||||
|
"latency_ms": 2646.9266000390053,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migration_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\global_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.1875,
|
||||||
|
"rbo_topk": 0.06134116970571428,
|
||||||
|
"staged_unique_files_topk": 9,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 7,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"latency_ms": 4778.165899991989,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\config.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\dbscan_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\noop_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\base.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\hdbscan_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\frequency_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\factory.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\__init__.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 18.590688705444336,
|
||||||
|
"stage1_fallback_search_ms": 195.90282440185547,
|
||||||
|
"stage2_expand_ms": 2053.685426712036,
|
||||||
|
"stage3_cluster_ms": 0.00095367431640625,
|
||||||
|
"stage4_rerank_ms": 2431.095838546753
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 10,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 10,
|
||||||
|
"stage2_unique_paths": 10,
|
||||||
|
"stage2_duplicate_paths": 0,
|
||||||
|
"stage3_clustered": 10,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 10
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"latency_ms": 2887.1304000020027,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\gpu_support.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\enrichment.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.1111111111111111,
|
||||||
|
"rbo_topk": 0.04670528456571428,
|
||||||
|
"staged_unique_files_topk": 10,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 3,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "error handling",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "error handling",
|
||||||
|
"latency_ms": 5823.889799982309,
|
||||||
|
"num_results": 6,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\gpu_support.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\rotational_embedder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\watcher\\manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 109.02619361877441,
|
||||||
|
"stage1_fallback_search_ms": 196.54059410095215,
|
||||||
|
"stage2_expand_ms": 2088.4640216827393,
|
||||||
|
"stage3_cluster_ms": 0.00095367431640625,
|
||||||
|
"stage4_rerank_ms": 3328.0465602874756
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 5,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 13,
|
||||||
|
"stage2_unique_paths": 6,
|
||||||
|
"stage2_duplicate_paths": 7,
|
||||||
|
"stage3_clustered": 13,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "error handling",
|
||||||
|
"latency_ms": 3351.872999995947,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\embedding_manager.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.07142857142857142,
|
||||||
|
"rbo_topk": 0.045191399425714276,
|
||||||
|
"staged_unique_files_topk": 5,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 4,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "how to parse json",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "how to parse json",
|
||||||
|
"latency_ms": 5325.160299986601,
|
||||||
|
"num_results": 7,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\standalone_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\parsers\\factory.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\indexing\\symbol_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\parsers\\treesitter_parser.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 216.71128273010254,
|
||||||
|
"stage1_fallback_search_ms": 295.27878761291504,
|
||||||
|
"stage2_expand_ms": 2091.4883613586426,
|
||||||
|
"stage3_cluster_ms": 0.001430511474609375,
|
||||||
|
"stage4_rerank_ms": 2606.9161891937256
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 4,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 9,
|
||||||
|
"stage2_unique_paths": 7,
|
||||||
|
"stage2_duplicate_paths": 2,
|
||||||
|
"stage3_clustered": 9,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "how to parse json",
|
||||||
|
"latency_ms": 2928.889899969101,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\ranking.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\ann_index.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.21428571428571427,
|
||||||
|
"rbo_topk": 0.18590219827714285,
|
||||||
|
"staged_unique_files_topk": 7,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 5,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,467 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"timestamp": "2026-02-11 15:16:08",
|
||||||
|
"source": "codex-lens\\src",
|
||||||
|
"k": 10,
|
||||||
|
"coarse_k": 100,
|
||||||
|
"query_count": 7,
|
||||||
|
"avg_jaccard_topk": 0.11350467619264612,
|
||||||
|
"avg_rbo_topk": 0.09062624799510204,
|
||||||
|
"staged": {
|
||||||
|
"success": 7,
|
||||||
|
"avg_latency_ms": 4507.475014303412
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"success": 7,
|
||||||
|
"avg_latency_ms": 2537.8563000304357
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"comparisons": [
|
||||||
|
{
|
||||||
|
"query": "class Config",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "class Config",
|
||||||
|
"latency_ms": 2474.800100028515,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\path_mapper.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\api\\references.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\api\\semantic.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\server.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\parsers\\factory.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\watcher\\file_watcher.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 91.76826477050781,
|
||||||
|
"stage1_fallback_search_ms": 162.45269775390625,
|
||||||
|
"stage2_expand_ms": 14.957904815673828,
|
||||||
|
"stage3_cluster_ms": 0.8461475372314453,
|
||||||
|
"stage4_rerank_ms": 2129.7342777252197
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 37,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 86,
|
||||||
|
"stage2_unique_paths": 53,
|
||||||
|
"stage2_duplicate_paths": 33,
|
||||||
|
"stage3_clustered": 20,
|
||||||
|
"stage3_strategy": "dir_rr",
|
||||||
|
"stage4_reranked": 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "class Config",
|
||||||
|
"latency_ms": 2425.3046000003815,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\query_parser.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\embedding_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migration_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.05263157894736842,
|
||||||
|
"rbo_topk": 0.014635885139999999,
|
||||||
|
"staged_unique_files_topk": 10,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 8,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "def search",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "def search",
|
||||||
|
"latency_ms": 5389.070900022984,
|
||||||
|
"num_results": 3,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\entities.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 63.6446475982666,
|
||||||
|
"stage2_expand_ms": 3202.108144760132,
|
||||||
|
"stage3_cluster_ms": 0.0007152557373046875,
|
||||||
|
"stage4_rerank_ms": 2011.8708610534668
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 3,
|
||||||
|
"stage2_expanded": 4,
|
||||||
|
"stage2_unique_paths": 3,
|
||||||
|
"stage2_duplicate_paths": 1,
|
||||||
|
"stage3_clustered": 4,
|
||||||
|
"stage3_strategy": "dir_rr",
|
||||||
|
"stage4_reranked": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "def search",
|
||||||
|
"latency_ms": 2465.9148000478745,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\query_parser.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.09090909090909091,
|
||||||
|
"rbo_topk": 0.23541639942571424,
|
||||||
|
"staged_unique_files_topk": 2,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 2,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "LspBridge",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "LspBridge",
|
||||||
|
"latency_ms": 4989.407700002193,
|
||||||
|
"num_results": 7,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\keepalive_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_graph_builder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\__init__.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 88.54341506958008,
|
||||||
|
"stage1_fallback_search_ms": 125.9164810180664,
|
||||||
|
"stage2_expand_ms": 2063.6398792266846,
|
||||||
|
"stage3_cluster_ms": 0.3476142883300781,
|
||||||
|
"stage4_rerank_ms": 2633.7506771087646
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 5,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 31,
|
||||||
|
"stage2_unique_paths": 11,
|
||||||
|
"stage2_duplicate_paths": 20,
|
||||||
|
"stage3_clustered": 20,
|
||||||
|
"stage3_strategy": "dir_rr",
|
||||||
|
"stage4_reranked": 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "LspBridge",
|
||||||
|
"latency_ms": 2424.8579000234604,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\vector_meta_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\graph_expander.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.06666666666666667,
|
||||||
|
"rbo_topk": 0.045191399425714276,
|
||||||
|
"staged_unique_files_topk": 6,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 2,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "graph expansion",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "graph expansion",
|
||||||
|
"latency_ms": 4771.1614000201225,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migrations\\migration_007_add_graph_neighbors.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_graph_builder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\ann_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\config.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\graph_expander.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\enrichment.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 61.426401138305664,
|
||||||
|
"stage1_fallback_search_ms": 152.01711654663086,
|
||||||
|
"stage2_expand_ms": 2078.4833431243896,
|
||||||
|
"stage3_cluster_ms": 0.0007152557373046875,
|
||||||
|
"stage4_rerank_ms": 2376.2998580932617
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 11,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 16,
|
||||||
|
"stage2_unique_paths": 13,
|
||||||
|
"stage2_duplicate_paths": 3,
|
||||||
|
"stage3_clustered": 16,
|
||||||
|
"stage3_strategy": "dir_rr",
|
||||||
|
"stage4_reranked": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "graph expansion",
|
||||||
|
"latency_ms": 2418.981700003147,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migration_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\global_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.1875,
|
||||||
|
"rbo_topk": 0.06134116970571428,
|
||||||
|
"staged_unique_files_topk": 9,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 7,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"latency_ms": 4559.269900023937,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\config.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\noop_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\dbscan_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\base.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\hdbscan_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\frequency_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\factory.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\__init__.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 60.93573570251465,
|
||||||
|
"stage1_fallback_search_ms": 141.4163112640381,
|
||||||
|
"stage2_expand_ms": 2032.2721004486084,
|
||||||
|
"stage3_cluster_ms": 0.0007152557373046875,
|
||||||
|
"stage4_rerank_ms": 2217.2317504882812
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 10,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 10,
|
||||||
|
"stage2_unique_paths": 10,
|
||||||
|
"stage2_duplicate_paths": 0,
|
||||||
|
"stage3_clustered": 10,
|
||||||
|
"stage3_strategy": "dir_rr",
|
||||||
|
"stage4_reranked": 10
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"latency_ms": 2443.3700000047684,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\gpu_support.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\enrichment.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.1111111111111111,
|
||||||
|
"rbo_topk": 0.04670528456571428,
|
||||||
|
"staged_unique_files_topk": 10,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 3,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "error handling",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "error handling",
|
||||||
|
"latency_ms": 4757.269500017166,
|
||||||
|
"num_results": 6,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\gpu_support.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\rotational_embedder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\watcher\\manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 89.56503868103027,
|
||||||
|
"stage1_fallback_search_ms": 143.58854293823242,
|
||||||
|
"stage2_expand_ms": 2119.623899459839,
|
||||||
|
"stage3_cluster_ms": 0.0007152557373046875,
|
||||||
|
"stage4_rerank_ms": 2303.9650917053223
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 5,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 13,
|
||||||
|
"stage2_unique_paths": 6,
|
||||||
|
"stage2_duplicate_paths": 7,
|
||||||
|
"stage3_clustered": 13,
|
||||||
|
"stage3_strategy": "dir_rr",
|
||||||
|
"stage4_reranked": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "error handling",
|
||||||
|
"latency_ms": 2431.0521000623703,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\embedding_manager.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.07142857142857142,
|
||||||
|
"rbo_topk": 0.045191399425714276,
|
||||||
|
"staged_unique_files_topk": 5,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 4,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "how to parse json",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "how to parse json",
|
||||||
|
"latency_ms": 4611.3456000089645,
|
||||||
|
"num_results": 7,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\standalone_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\parsers\\factory.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\indexing\\symbol_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\parsers\\treesitter_parser.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 74.86128807067871,
|
||||||
|
"stage1_fallback_search_ms": 137.465238571167,
|
||||||
|
"stage2_expand_ms": 2086.426019668579,
|
||||||
|
"stage3_cluster_ms": 0.00095367431640625,
|
||||||
|
"stage4_rerank_ms": 2218.2157039642334
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 4,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 9,
|
||||||
|
"stage2_unique_paths": 7,
|
||||||
|
"stage2_duplicate_paths": 2,
|
||||||
|
"stage3_clustered": 9,
|
||||||
|
"stage3_strategy": "dir_rr",
|
||||||
|
"stage4_reranked": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "how to parse json",
|
||||||
|
"latency_ms": 3155.5130000710487,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\ranking.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\ann_index.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.21428571428571427,
|
||||||
|
"rbo_topk": 0.18590219827714285,
|
||||||
|
"staged_unique_files_topk": 7,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 5,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
465
codex-lens/benchmarks/results/compare_2026-02-11_path_fast7.json
Normal file
465
codex-lens/benchmarks/results/compare_2026-02-11_path_fast7.json
Normal file
@@ -0,0 +1,465 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"timestamp": "2026-02-11 15:12:41",
|
||||||
|
"source": "codex-lens\\src",
|
||||||
|
"k": 10,
|
||||||
|
"coarse_k": 100,
|
||||||
|
"query_count": 7,
|
||||||
|
"avg_jaccard_topk": 0.13455730777159347,
|
||||||
|
"avg_rbo_topk": 0.10274807844326529,
|
||||||
|
"staged": {
|
||||||
|
"success": 7,
|
||||||
|
"avg_latency_ms": 4532.43382857527
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"success": 7,
|
||||||
|
"avg_latency_ms": 2712.3431142909185
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"comparisons": [
|
||||||
|
{
|
||||||
|
"query": "class Config",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "class Config",
|
||||||
|
"latency_ms": 2704.6869000196457,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\path_mapper.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\api\\semantic.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\api\\references.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\embedding_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\server.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 56.32758140563965,
|
||||||
|
"stage1_fallback_search_ms": 156.8472385406494,
|
||||||
|
"stage2_expand_ms": 15.436887741088867,
|
||||||
|
"stage3_cluster_ms": 0.04291534423828125,
|
||||||
|
"stage4_rerank_ms": 2388.756513595581
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 37,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 86,
|
||||||
|
"stage2_unique_paths": 53,
|
||||||
|
"stage2_duplicate_paths": 33,
|
||||||
|
"stage3_clustered": 20,
|
||||||
|
"stage3_strategy": "path",
|
||||||
|
"stage4_reranked": 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "class Config",
|
||||||
|
"latency_ms": 3257.856599986553,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\query_parser.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\embedding_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migration_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.2,
|
||||||
|
"rbo_topk": 0.09948869827714285,
|
||||||
|
"staged_unique_files_topk": 8,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 4,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "def search",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "def search",
|
||||||
|
"latency_ms": 4347.2081000208855,
|
||||||
|
"num_results": 3,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\entities.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 65.37723541259766,
|
||||||
|
"stage2_expand_ms": 2145.587682723999,
|
||||||
|
"stage3_cluster_ms": 0.00095367431640625,
|
||||||
|
"stage4_rerank_ms": 2052.9236793518066
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 3,
|
||||||
|
"stage2_expanded": 4,
|
||||||
|
"stage2_unique_paths": 3,
|
||||||
|
"stage2_duplicate_paths": 1,
|
||||||
|
"stage3_clustered": 4,
|
||||||
|
"stage3_strategy": "path",
|
||||||
|
"stage4_reranked": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "def search",
|
||||||
|
"latency_ms": 2642.404200077057,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\query_parser.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.09090909090909091,
|
||||||
|
"rbo_topk": 0.23541639942571424,
|
||||||
|
"staged_unique_files_topk": 2,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 2,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "LspBridge",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "LspBridge",
|
||||||
|
"latency_ms": 4627.254400074482,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_graph_builder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\keepalive_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 96.67634963989258,
|
||||||
|
"stage1_fallback_search_ms": 162.25123405456543,
|
||||||
|
"stage2_expand_ms": 2071.5224742889404,
|
||||||
|
"stage3_cluster_ms": 0.018835067749023438,
|
||||||
|
"stage4_rerank_ms": 2211.8191719055176
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 5,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 31,
|
||||||
|
"stage2_unique_paths": 11,
|
||||||
|
"stage2_duplicate_paths": 20,
|
||||||
|
"stage3_clustered": 11,
|
||||||
|
"stage3_strategy": "path",
|
||||||
|
"stage4_reranked": 11
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "LspBridge",
|
||||||
|
"latency_ms": 2479.5284999608994,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\vector_meta_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\graph_expander.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.06666666666666667,
|
||||||
|
"rbo_topk": 0.045191399425714276,
|
||||||
|
"staged_unique_files_topk": 6,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 2,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "graph expansion",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "graph expansion",
|
||||||
|
"latency_ms": 4663.639899969101,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migrations\\migration_007_add_graph_neighbors.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_graph_builder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\ann_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\config.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\graph_expander.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\enrichment.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 82.36384391784668,
|
||||||
|
"stage1_fallback_search_ms": 158.2353115081787,
|
||||||
|
"stage2_expand_ms": 2087.8846645355225,
|
||||||
|
"stage3_cluster_ms": 0.00095367431640625,
|
||||||
|
"stage4_rerank_ms": 2249.4378089904785
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 11,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 16,
|
||||||
|
"stage2_unique_paths": 13,
|
||||||
|
"stage2_duplicate_paths": 3,
|
||||||
|
"stage3_clustered": 16,
|
||||||
|
"stage3_strategy": "path",
|
||||||
|
"stage4_reranked": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "graph expansion",
|
||||||
|
"latency_ms": 2455.024599969387,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migration_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\global_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.1875,
|
||||||
|
"rbo_topk": 0.06134116970571428,
|
||||||
|
"staged_unique_files_topk": 9,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 7,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"latency_ms": 6402.90189999342,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\config.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\dbscan_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\noop_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\base.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\hdbscan_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\frequency_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\factory.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\__init__.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 44.295310974121094,
|
||||||
|
"stage1_fallback_search_ms": 127.30145454406738,
|
||||||
|
"stage2_expand_ms": 2030.930995941162,
|
||||||
|
"stage3_cluster_ms": 0.00095367431640625,
|
||||||
|
"stage4_rerank_ms": 4132.822036743164
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 10,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 10,
|
||||||
|
"stage2_unique_paths": 10,
|
||||||
|
"stage2_duplicate_paths": 0,
|
||||||
|
"stage3_clustered": 10,
|
||||||
|
"stage3_strategy": "path",
|
||||||
|
"stage4_reranked": 10
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"latency_ms": 3286.4142000079155,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\gpu_support.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\enrichment.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.1111111111111111,
|
||||||
|
"rbo_topk": 0.04670528456571428,
|
||||||
|
"staged_unique_files_topk": 10,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 3,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "error handling",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "error handling",
|
||||||
|
"latency_ms": 4532.2757999897,
|
||||||
|
"num_results": 6,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\gpu_support.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\rotational_embedder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\watcher\\manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 85.02960205078125,
|
||||||
|
"stage1_fallback_search_ms": 146.46339416503906,
|
||||||
|
"stage2_expand_ms": 2071.5532302856445,
|
||||||
|
"stage3_cluster_ms": 0.00095367431640625,
|
||||||
|
"stage4_rerank_ms": 2140.7644748687744
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 5,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 13,
|
||||||
|
"stage2_unique_paths": 6,
|
||||||
|
"stage2_duplicate_paths": 7,
|
||||||
|
"stage3_clustered": 13,
|
||||||
|
"stage3_strategy": "path",
|
||||||
|
"stage4_reranked": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "error handling",
|
||||||
|
"latency_ms": 2349.7827999591827,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\embedding_manager.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.07142857142857142,
|
||||||
|
"rbo_topk": 0.045191399425714276,
|
||||||
|
"staged_unique_files_topk": 5,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 4,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "how to parse json",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "how to parse json",
|
||||||
|
"latency_ms": 4449.06979995966,
|
||||||
|
"num_results": 7,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\standalone_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\parsers\\factory.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\indexing\\symbol_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\parsers\\treesitter_parser.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 67.15631484985352,
|
||||||
|
"stage1_fallback_search_ms": 148.30541610717773,
|
||||||
|
"stage2_expand_ms": 2069.3678855895996,
|
||||||
|
"stage3_cluster_ms": 0.0007152557373046875,
|
||||||
|
"stage4_rerank_ms": 2097.882032394409
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 4,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 9,
|
||||||
|
"stage2_unique_paths": 7,
|
||||||
|
"stage2_duplicate_paths": 2,
|
||||||
|
"stage3_clustered": 9,
|
||||||
|
"stage3_strategy": "path",
|
||||||
|
"stage4_reranked": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "how to parse json",
|
||||||
|
"latency_ms": 2515.3909000754356,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\ranking.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\ann_index.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.21428571428571427,
|
||||||
|
"rbo_topk": 0.18590219827714285,
|
||||||
|
"staged_unique_files_topk": 7,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 5,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,465 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"timestamp": "2026-02-11 15:14:25",
|
||||||
|
"source": "codex-lens\\src",
|
||||||
|
"k": 10,
|
||||||
|
"coarse_k": 100,
|
||||||
|
"query_count": 7,
|
||||||
|
"avg_jaccard_topk": 0.12384302205730777,
|
||||||
|
"avg_rbo_topk": 0.09816673566816325,
|
||||||
|
"staged": {
|
||||||
|
"success": 7,
|
||||||
|
"avg_latency_ms": 4538.7477714674815
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"success": 7,
|
||||||
|
"avg_latency_ms": 2568.1517999768257
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"comparisons": [
|
||||||
|
{
|
||||||
|
"query": "class Config",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "class Config",
|
||||||
|
"latency_ms": 2546.395000040531,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\path_mapper.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\api\\semantic.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\api\\references.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\config.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\server.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 70.5413818359375,
|
||||||
|
"stage1_fallback_search_ms": 165.39907455444336,
|
||||||
|
"stage2_expand_ms": 15.58542251586914,
|
||||||
|
"stage3_cluster_ms": 0.020265579223632812,
|
||||||
|
"stage4_rerank_ms": 2209.89727973938
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 37,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 86,
|
||||||
|
"stage2_unique_paths": 53,
|
||||||
|
"stage2_duplicate_paths": 33,
|
||||||
|
"stage3_clustered": 20,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "class Config",
|
||||||
|
"latency_ms": 2610.328099966049,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\query_parser.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\embedding_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migration_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.125,
|
||||||
|
"rbo_topk": 0.06741929885142856,
|
||||||
|
"staged_unique_files_topk": 8,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 5,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "def search",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "def search",
|
||||||
|
"latency_ms": 4569.872200012207,
|
||||||
|
"num_results": 3,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\entities.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 96.31776809692383,
|
||||||
|
"stage2_expand_ms": 2299.86310005188,
|
||||||
|
"stage3_cluster_ms": 0.0007152557373046875,
|
||||||
|
"stage4_rerank_ms": 2094.2182540893555
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 3,
|
||||||
|
"stage2_expanded": 4,
|
||||||
|
"stage2_unique_paths": 3,
|
||||||
|
"stage2_duplicate_paths": 1,
|
||||||
|
"stage3_clustered": 4,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "def search",
|
||||||
|
"latency_ms": 2509.9732999801636,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\query_parser.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.09090909090909091,
|
||||||
|
"rbo_topk": 0.23541639942571424,
|
||||||
|
"staged_unique_files_topk": 2,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 2,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "LspBridge",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "LspBridge",
|
||||||
|
"latency_ms": 5064.990800082684,
|
||||||
|
"num_results": 6,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_graph_builder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\keepalive_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\__init__.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 86.1806869506836,
|
||||||
|
"stage1_fallback_search_ms": 150.21824836730957,
|
||||||
|
"stage2_expand_ms": 2080.6803703308105,
|
||||||
|
"stage3_cluster_ms": 0.011682510375976562,
|
||||||
|
"stage4_rerank_ms": 2663.7954711914062
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 5,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 31,
|
||||||
|
"stage2_unique_paths": 11,
|
||||||
|
"stage2_duplicate_paths": 20,
|
||||||
|
"stage3_clustered": 20,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "LspBridge",
|
||||||
|
"latency_ms": 2778.6906000375748,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\vector_meta_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\graph_expander.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.06666666666666667,
|
||||||
|
"rbo_topk": 0.045191399425714276,
|
||||||
|
"staged_unique_files_topk": 6,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 2,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "graph expansion",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "graph expansion",
|
||||||
|
"latency_ms": 4816.586899995804,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migrations\\migration_007_add_graph_neighbors.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_graph_builder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\ann_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\config.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\graph_expander.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\enrichment.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 79.48184013366699,
|
||||||
|
"stage1_fallback_search_ms": 158.03027153015137,
|
||||||
|
"stage2_expand_ms": 2087.271213531494,
|
||||||
|
"stage3_cluster_ms": 0.0007152557373046875,
|
||||||
|
"stage4_rerank_ms": 2410.567283630371
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 11,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 16,
|
||||||
|
"stage2_unique_paths": 13,
|
||||||
|
"stage2_duplicate_paths": 3,
|
||||||
|
"stage3_clustered": 16,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "graph expansion",
|
||||||
|
"latency_ms": 2692.1504999399185,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\migration_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\global_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.1875,
|
||||||
|
"rbo_topk": 0.06134116970571428,
|
||||||
|
"staged_unique_files_topk": 9,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 7,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"latency_ms": 4494.9805000424385,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\config.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\dbscan_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\noop_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\base.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\hdbscan_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\frequency_strategy.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\factory.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\clustering\\__init__.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 40.569305419921875,
|
||||||
|
"stage1_fallback_search_ms": 141.06035232543945,
|
||||||
|
"stage2_expand_ms": 2043.9364910125732,
|
||||||
|
"stage3_cluster_ms": 0.00095367431640625,
|
||||||
|
"stage4_rerank_ms": 2198.4200477600098
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 10,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 10,
|
||||||
|
"stage2_unique_paths": 10,
|
||||||
|
"stage2_duplicate_paths": 0,
|
||||||
|
"stage3_clustered": 10,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 10
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "clustering strategy",
|
||||||
|
"latency_ms": 2474.2726999521255,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\vector_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\gpu_support.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\enrichment.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.1111111111111111,
|
||||||
|
"rbo_topk": 0.04670528456571428,
|
||||||
|
"staged_unique_files_topk": 10,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 3,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "error handling",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "error handling",
|
||||||
|
"latency_ms": 5652.523400068283,
|
||||||
|
"num_results": 6,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\lsp_bridge.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\gpu_support.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\rotational_embedder.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\watcher\\manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 87.34393119812012,
|
||||||
|
"stage1_fallback_search_ms": 149.7325897216797,
|
||||||
|
"stage2_expand_ms": 2072.728157043457,
|
||||||
|
"stage3_cluster_ms": 0.00095367431640625,
|
||||||
|
"stage4_rerank_ms": 3190.687894821167
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 5,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 13,
|
||||||
|
"stage2_unique_paths": 6,
|
||||||
|
"stage2_duplicate_paths": 7,
|
||||||
|
"stage3_clustered": 13,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 13
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "error handling",
|
||||||
|
"latency_ms": 2481.709800004959,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\__init__.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\registry.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\embedding_manager.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.07142857142857142,
|
||||||
|
"rbo_topk": 0.045191399425714276,
|
||||||
|
"staged_unique_files_topk": 5,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 4,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"query": "how to parse json",
|
||||||
|
"staged": {
|
||||||
|
"strategy": "staged",
|
||||||
|
"query": "how to parse json",
|
||||||
|
"latency_ms": 4625.885600030422,
|
||||||
|
"num_results": 7,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\lsp\\standalone_manager.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\parsers\\factory.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\indexing\\symbol_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\parsers\\treesitter_parser.py"
|
||||||
|
],
|
||||||
|
"stage_stats": {
|
||||||
|
"stage_times": {
|
||||||
|
"stage1_binary_ms": 92.83590316772461,
|
||||||
|
"stage1_fallback_search_ms": 147.12858200073242,
|
||||||
|
"stage2_expand_ms": 2061.2568855285645,
|
||||||
|
"stage3_cluster_ms": 0.0011920928955078125,
|
||||||
|
"stage4_rerank_ms": 2246.800184249878
|
||||||
|
},
|
||||||
|
"stage_counts": {
|
||||||
|
"stage1_candidates": 4,
|
||||||
|
"stage1_fallback_used": 1,
|
||||||
|
"stage2_expanded": 9,
|
||||||
|
"stage2_unique_paths": 7,
|
||||||
|
"stage2_duplicate_paths": 2,
|
||||||
|
"stage3_clustered": 9,
|
||||||
|
"stage3_strategy": "score",
|
||||||
|
"stage4_reranked": 9
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"dense_rerank": {
|
||||||
|
"strategy": "dense_rerank",
|
||||||
|
"query": "how to parse json",
|
||||||
|
"latency_ms": 2429.9375999569893,
|
||||||
|
"num_results": 10,
|
||||||
|
"topk_paths": [
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\cli\\commands.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\chain_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\index_tree.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\code_extractor.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\dir_index.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\hybrid_search.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\search\\ranking.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\chunker.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\storage\\sqlite_store.py",
|
||||||
|
"d:\\claude_dms3\\codex-lens\\src\\codexlens\\semantic\\ann_index.py"
|
||||||
|
],
|
||||||
|
"stage_stats": null,
|
||||||
|
"error": null
|
||||||
|
},
|
||||||
|
"jaccard_topk": 0.21428571428571427,
|
||||||
|
"rbo_topk": 0.18590219827714285,
|
||||||
|
"staged_unique_files_topk": 7,
|
||||||
|
"dense_unique_files_topk": 10,
|
||||||
|
"staged_unique_dirs_topk": 5,
|
||||||
|
"dense_unique_dirs_topk": 4
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -58,6 +58,10 @@ class ServerState:
|
|||||||
restart_count: int = 0
|
restart_count: int = 0
|
||||||
# Queue for producer-consumer pattern - continuous reading puts messages here
|
# Queue for producer-consumer pattern - continuous reading puts messages here
|
||||||
message_queue: asyncio.Queue = field(default_factory=asyncio.Queue)
|
message_queue: asyncio.Queue = field(default_factory=asyncio.Queue)
|
||||||
|
# Track opened documents to avoid redundant didOpen spam (and unnecessary delays).
|
||||||
|
# Key: document URI -> (version, file_mtime)
|
||||||
|
opened_documents: Dict[str, Tuple[int, float]] = field(default_factory=dict)
|
||||||
|
opened_documents_lock: asyncio.Lock = field(default_factory=asyncio.Lock)
|
||||||
|
|
||||||
|
|
||||||
class StandaloneLspManager:
|
class StandaloneLspManager:
|
||||||
@@ -836,28 +840,66 @@ class StandaloneLspManager:
|
|||||||
file_path = self._normalize_file_path(file_path)
|
file_path = self._normalize_file_path(file_path)
|
||||||
resolved_path = Path(file_path).resolve()
|
resolved_path = Path(file_path).resolve()
|
||||||
|
|
||||||
|
# Fast path: already opened and unchanged (per-server cache).
|
||||||
try:
|
try:
|
||||||
content = resolved_path.read_text(encoding="utf-8")
|
uri = resolved_path.as_uri()
|
||||||
except Exception as e:
|
except Exception:
|
||||||
logger.error(f"Failed to read file {file_path}: {e}")
|
uri = ""
|
||||||
return
|
|
||||||
|
|
||||||
# Detect language ID from extension
|
try:
|
||||||
language_id = self.get_language_id(file_path) or "plaintext"
|
file_mtime = float(resolved_path.stat().st_mtime)
|
||||||
|
except Exception:
|
||||||
|
file_mtime = 0.0
|
||||||
|
|
||||||
logger.debug(f"Opening document: {resolved_path.name} ({len(content)} chars)")
|
# Serialize open/change notifications per server to avoid races when
|
||||||
await self._send_notification(state, "textDocument/didOpen", {
|
# multiple concurrent LSP requests target the same file.
|
||||||
"textDocument": {
|
async with state.opened_documents_lock:
|
||||||
"uri": resolved_path.as_uri(),
|
existing = state.opened_documents.get(uri) if uri else None
|
||||||
"languageId": language_id,
|
if existing is not None and existing[1] == file_mtime:
|
||||||
"version": 1,
|
return
|
||||||
"text": content,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
# Give the language server a brief moment to process the file
|
try:
|
||||||
# The message queue handles any server requests automatically
|
content = resolved_path.read_text(encoding="utf-8")
|
||||||
await asyncio.sleep(0.5)
|
except Exception as e:
|
||||||
|
logger.error(f"Failed to read file {file_path}: {e}")
|
||||||
|
return
|
||||||
|
|
||||||
|
# Detect language ID from extension
|
||||||
|
language_id = self.get_language_id(file_path) or "plaintext"
|
||||||
|
|
||||||
|
# Send didOpen only once per document; subsequent changes use didChange.
|
||||||
|
if existing is None:
|
||||||
|
version = 1
|
||||||
|
logger.debug(f"Opening document: {resolved_path.name} ({len(content)} chars)")
|
||||||
|
await self._send_notification(
|
||||||
|
state,
|
||||||
|
"textDocument/didOpen",
|
||||||
|
{
|
||||||
|
"textDocument": {
|
||||||
|
"uri": uri or resolved_path.as_uri(),
|
||||||
|
"languageId": language_id,
|
||||||
|
"version": version,
|
||||||
|
"text": content,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
version = int(existing[0]) + 1
|
||||||
|
logger.debug(f"Updating document: {resolved_path.name} ({len(content)} chars)")
|
||||||
|
await self._send_notification(
|
||||||
|
state,
|
||||||
|
"textDocument/didChange",
|
||||||
|
{
|
||||||
|
"textDocument": {
|
||||||
|
"uri": uri or resolved_path.as_uri(),
|
||||||
|
"version": version,
|
||||||
|
},
|
||||||
|
"contentChanges": [{"text": content}],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
if uri:
|
||||||
|
state.opened_documents[uri] = (version, file_mtime)
|
||||||
|
|
||||||
# ========== Public LSP Methods ==========
|
# ========== Public LSP Methods ==========
|
||||||
|
|
||||||
|
|||||||
@@ -169,6 +169,9 @@ class ChainSearchEngine:
|
|||||||
self._realtime_lsp_keepalive_lock = threading.RLock()
|
self._realtime_lsp_keepalive_lock = threading.RLock()
|
||||||
self._realtime_lsp_keepalive = None
|
self._realtime_lsp_keepalive = None
|
||||||
self._realtime_lsp_keepalive_key = None
|
self._realtime_lsp_keepalive_key = None
|
||||||
|
# Track which (workspace_root, config_file) pairs have already been warmed up.
|
||||||
|
# This avoids paying the warmup sleep on every query when using keep-alive LSP servers.
|
||||||
|
self._realtime_lsp_warmed_ids: set[tuple[str, str | None]] = set()
|
||||||
|
|
||||||
def _get_executor(self, max_workers: Optional[int] = None) -> ThreadPoolExecutor:
|
def _get_executor(self, max_workers: Optional[int] = None) -> ThreadPoolExecutor:
|
||||||
"""Get or create the shared thread pool executor.
|
"""Get or create the shared thread pool executor.
|
||||||
@@ -1609,16 +1612,18 @@ class ChainSearchEngine:
|
|||||||
if not seed_nodes:
|
if not seed_nodes:
|
||||||
return coarse_results
|
return coarse_results
|
||||||
|
|
||||||
|
effective_warmup_s = warmup_s
|
||||||
|
|
||||||
async def expand_graph(bridge: LspBridge):
|
async def expand_graph(bridge: LspBridge):
|
||||||
# Warm up analysis: open seed docs and wait a bit so references/call hierarchy are populated.
|
# Warm up analysis: open seed docs and wait a bit so references/call hierarchy are populated.
|
||||||
if warmup_s > 0:
|
if effective_warmup_s > 0:
|
||||||
for seed in seed_nodes[:3]:
|
for seed in seed_nodes[:3]:
|
||||||
try:
|
try:
|
||||||
await bridge.get_document_symbols(seed.file_path)
|
await bridge.get_document_symbols(seed.file_path)
|
||||||
except Exception:
|
except Exception:
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
warmup_budget = min(warmup_s, max(0.0, timeout_s * 0.1))
|
warmup_budget = min(effective_warmup_s, max(0.0, timeout_s * 0.1))
|
||||||
await asyncio.sleep(min(warmup_budget, max(0.0, timeout_s - 0.5)))
|
await asyncio.sleep(min(warmup_budget, max(0.0, timeout_s - 0.5)))
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
@@ -1659,7 +1664,10 @@ class ChainSearchEngine:
|
|||||||
config_file=str(lsp_config_file) if lsp_config_file else None,
|
config_file=str(lsp_config_file) if lsp_config_file else None,
|
||||||
timeout=float(timeout_s),
|
timeout=float(timeout_s),
|
||||||
)
|
)
|
||||||
|
warm_id = (key.workspace_root, key.config_file)
|
||||||
with self._realtime_lsp_keepalive_lock:
|
with self._realtime_lsp_keepalive_lock:
|
||||||
|
if warm_id in self._realtime_lsp_warmed_ids:
|
||||||
|
effective_warmup_s = 0.0
|
||||||
keepalive = self._realtime_lsp_keepalive
|
keepalive = self._realtime_lsp_keepalive
|
||||||
if keepalive is None or self._realtime_lsp_keepalive_key != key:
|
if keepalive is None or self._realtime_lsp_keepalive_key != key:
|
||||||
if keepalive is not None:
|
if keepalive is not None:
|
||||||
@@ -1676,6 +1684,8 @@ class ChainSearchEngine:
|
|||||||
self._realtime_lsp_keepalive_key = key
|
self._realtime_lsp_keepalive_key = key
|
||||||
|
|
||||||
graph = keepalive.run(expand_graph, timeout=timeout_s)
|
graph = keepalive.run(expand_graph, timeout=timeout_s)
|
||||||
|
with self._realtime_lsp_keepalive_lock:
|
||||||
|
self._realtime_lsp_warmed_ids.add(warm_id)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
self.logger.debug("Stage 2 (realtime) expansion failed: %r", exc)
|
self.logger.debug("Stage 2 (realtime) expansion failed: %r", exc)
|
||||||
return coarse_results
|
return coarse_results
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import asyncio
|
||||||
|
import time
|
||||||
|
from pathlib import Path
|
||||||
|
from types import SimpleNamespace
|
||||||
|
from unittest.mock import AsyncMock, MagicMock
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from codexlens.lsp.standalone_manager import ServerConfig, ServerState, StandaloneLspManager
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_open_document_skips_when_unchanged(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
|
target = tmp_path / "a.py"
|
||||||
|
target.write_text("print('hi')\n", encoding="utf-8")
|
||||||
|
|
||||||
|
manager = StandaloneLspManager(workspace_root=str(tmp_path))
|
||||||
|
# Make language detection deterministic.
|
||||||
|
manager._extension_map["py"] = "python" # type: ignore[attr-defined]
|
||||||
|
|
||||||
|
cfg = ServerConfig(
|
||||||
|
language_id="python",
|
||||||
|
display_name="Pyright",
|
||||||
|
extensions=["py"],
|
||||||
|
command=["pyright-langserver", "--stdio"],
|
||||||
|
)
|
||||||
|
|
||||||
|
# ServerState requires reader/writer/process, but _open_document only uses writer via _send_notification.
|
||||||
|
dummy_process = SimpleNamespace(returncode=None)
|
||||||
|
dummy_reader = asyncio.StreamReader()
|
||||||
|
dummy_writer = MagicMock()
|
||||||
|
state = ServerState(config=cfg, process=dummy_process, reader=dummy_reader, writer=dummy_writer)
|
||||||
|
|
||||||
|
sent: list[str] = []
|
||||||
|
|
||||||
|
async def _send_notification(_state, method: str, _params):
|
||||||
|
sent.append(method)
|
||||||
|
|
||||||
|
monkeypatch.setattr(manager, "_send_notification", _send_notification)
|
||||||
|
|
||||||
|
await manager._open_document(state, str(target)) # type: ignore[attr-defined]
|
||||||
|
await manager._open_document(state, str(target)) # unchanged: should be skipped
|
||||||
|
|
||||||
|
assert sent.count("textDocument/didOpen") == 1
|
||||||
|
assert "textDocument/didChange" not in sent
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_open_document_sends_did_change_on_mtime_change(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
|
target = tmp_path / "a.py"
|
||||||
|
target.write_text("print('hi')\n", encoding="utf-8")
|
||||||
|
|
||||||
|
manager = StandaloneLspManager(workspace_root=str(tmp_path))
|
||||||
|
manager._extension_map["py"] = "python" # type: ignore[attr-defined]
|
||||||
|
|
||||||
|
cfg = ServerConfig(
|
||||||
|
language_id="python",
|
||||||
|
display_name="Pyright",
|
||||||
|
extensions=["py"],
|
||||||
|
command=["pyright-langserver", "--stdio"],
|
||||||
|
)
|
||||||
|
|
||||||
|
dummy_process = SimpleNamespace(returncode=None)
|
||||||
|
dummy_reader = asyncio.StreamReader()
|
||||||
|
dummy_writer = MagicMock()
|
||||||
|
state = ServerState(config=cfg, process=dummy_process, reader=dummy_reader, writer=dummy_writer)
|
||||||
|
|
||||||
|
sent: list[str] = []
|
||||||
|
|
||||||
|
async def _send_notification(_state, method: str, _params):
|
||||||
|
sent.append(method)
|
||||||
|
|
||||||
|
monkeypatch.setattr(manager, "_send_notification", _send_notification)
|
||||||
|
|
||||||
|
await manager._open_document(state, str(target)) # type: ignore[attr-defined]
|
||||||
|
|
||||||
|
# Ensure filesystem mtime changes (Windows can have coarse resolution).
|
||||||
|
time.sleep(0.02)
|
||||||
|
target.write_text("print('changed')\n", encoding="utf-8")
|
||||||
|
|
||||||
|
await manager._open_document(state, str(target)) # changed -> didChange
|
||||||
|
|
||||||
|
assert sent.count("textDocument/didOpen") == 1
|
||||||
|
assert sent.count("textDocument/didChange") == 1
|
||||||
|
|
||||||
Reference in New Issue
Block a user