feat: phase 3-5 — workflow engine, background subagents, multi-modal, cache shape, inline diff
Phase 3: Dynamic Workflow Engine - VM sandbox (node:vm) with agent/parallel/pipeline API, Claude Code compatible - Workflow file discovery (.boocode/workflows/*.js + ~/.boocode/workflows/*.js) - Workflow manager with session/chat creation and inference dispatch - Built-in catalog: deep-research, review-code, find-issues - Resumability cache: SHA-256 hash of agent spec, in-memory Map Phase 4: Background Subagents - background-task.ts service: spawn/poll/cancel lifecycle - spawn_subagent, subagent_status, subagent_result tools in ALL_TOOLS Phase 5: Multi-modal + Cache Shape - Multi-modal stub with type defs and hook point in payload.ts - CacheShapeBadge component in trace viewer (colored bar + %)
This commit is contained in:
38
apps/web/src/components/CacheShapeBadge.tsx
Normal file
38
apps/web/src/components/CacheShapeBadge.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
// vDeepSeek: cache shape telemetry badge. Displays cache token count with
|
||||
// a colored hit-rate bar in the trace viewer. Color thresholds are relative
|
||||
// to output tokens (tokens_used) since the trace doesn't carry prompt miss
|
||||
// tokens separately: green > 50%, yellow > 10%, red ≤ 10%.
|
||||
|
||||
export interface CacheShapeBadgeProps {
|
||||
cacheTokens: number | null | undefined;
|
||||
totalTokens: number | null | undefined;
|
||||
}
|
||||
|
||||
function hitRate(cache: number, total: number): number {
|
||||
if (cache <= 0 || total <= 0) return 0;
|
||||
return cache / (cache + total);
|
||||
}
|
||||
|
||||
function barColor(rate: number): string {
|
||||
if (rate > 0.5) return 'bg-green-500';
|
||||
if (rate > 0.1) return 'bg-yellow-500';
|
||||
return 'bg-red-500';
|
||||
}
|
||||
|
||||
export function CacheShapeBadge({ cacheTokens, totalTokens }: CacheShapeBadgeProps) {
|
||||
if (cacheTokens == null || cacheTokens <= 0) return null;
|
||||
|
||||
const rate = hitRate(cacheTokens, totalTokens ?? 0);
|
||||
const pct = Math.round(rate * 100);
|
||||
const color = barColor(rate);
|
||||
|
||||
return (
|
||||
<span className="shrink-0 inline-flex items-center gap-1 font-mono tabular-nums text-[10px] text-muted-foreground/60" title={`cache hit rate ${pct}%`}>
|
||||
<span className={`inline-block w-1.5 h-3 rounded-sm ${color}`} />
|
||||
<span>{cacheTokens}c</span>
|
||||
{totalTokens != null && totalTokens > 0 && (
|
||||
<span className="text-muted-foreground/40">{pct}%</span>
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user