rewrite: TS monorepo — pi SDK stateless agents, Postgres+pg-boss, SvelteKit themed UI; legacy moved to legacy/

This commit is contained in:
ai-chess
2026-10-18 15:32:39 +03:00
parent e23a07f07b
commit 5be4bd1da4
321 changed files with 37840 additions and 158 deletions
@@ -0,0 +1,96 @@
<script lang="ts">
// Fighting-game style health bar. `pct` is the player's win-probability (0..1).
// The pale "ghost" segment lags behind on damage like in SF/KOF.
let {
pct,
side = 'left',
label = ''
}: { pct: number; side?: 'left' | 'right'; label?: string } = $props();
const v = $derived(Math.max(0.02, Math.min(1, pct)));
const tone = $derived(v > 0.55 ? 'hi' : v > 0.3 ? 'mid' : 'low');
</script>
<div class="hp {side} {tone}" aria-label="{label}: {(v * 100).toFixed(0)}%">
<div class="track">
<div class="ghost" style:width="{v * 100}%"></div>
<div class="fill" style:width="{v * 100}%"></div>
<div class="ticks"></div>
</div>
<div class="pct mono">{(v * 100).toFixed(0)}%</div>
</div>
<style>
.hp {
display: grid;
grid-template-columns: 1fr auto;
align-items: center;
gap: 8px;
width: 100%;
}
.hp.right {
grid-template-columns: auto 1fr;
}
.hp.right .track {
order: 2;
}
.hp.right .pct {
order: 1;
text-align: right;
}
.track {
position: relative;
height: 18px;
background: #1c1c26;
border: 2px solid #f3efe4;
clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
overflow: hidden;
}
.right .track {
clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%);
}
.fill,
.ghost {
position: absolute;
top: 0;
bottom: 0;
left: 0;
}
.right .fill,
.right .ghost {
left: auto;
right: 0;
}
.fill {
background: linear-gradient(180deg, #8fff9c 0 45%, var(--hp) 45% 100%);
transition: width 0.45s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.mid .fill {
background: linear-gradient(180deg, #ffe88a 0 45%, var(--hp-mid) 45% 100%);
}
.low .fill {
background: linear-gradient(180deg, #ff8a8a 0 45%, var(--hp-low) 45% 100%);
animation: pulse 0.7s steps(2) infinite;
}
.ghost {
background: #ffb4b4;
transition: width 0.9s ease-out 0.5s;
}
.ticks {
position: absolute;
inset: 0;
background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(0, 0, 0, 0.55) calc(10% - 2px) 10%);
pointer-events: none;
}
.pct {
font-size: 13px;
font-weight: 700;
min-width: 38px;
color: var(--text);
}
@keyframes pulse {
50% {
filter: brightness(1.6);
}
}
</style>