G0~G8 성과·동맹 측정 OS 작업 일괄 고정

8월 7일까지 워킹트리에만 남아 있던 미커밋 작업을 커밋한다. 여러 사본
폴더(worktree·clone)에 흩어져 있던 중간 스냅샷을 정리하기 전에 원본을
git 이력으로 고정하는 것이 목적이다.

- contracts/routes/services: measurement, outcome_trajectory, rupture_repair,
  deliberate_practice, calibration_transfer, supervision_research,
  multimodal_alliance, continuous_improvement 계열 신규 모듈과 테스트
- infra/db/init: 07~16 마이그레이션(측정 기반~calibration transfer 실행)
- apps/web: 세션 리뷰 카드·관리 화면·E2E 스펙 추가
- docs/ops: G0~G8 라이브 통합·배포·롤백 증거 문서와 evidence JSON/PNG
- scripts: smoke·ledger·릴리스 에이전트·NAS 프리뷰 운영 스크립트

engine.public 로그 .bak과 apps/web/test-results 산출물은 커밋에서 제외했다.
This commit is contained in:
Yun Chan 2026-08-08 01:30:53 +09:00
parent 93dd8f82d7
commit 16e791e044
390 changed files with 243188 additions and 499 deletions

View file

@ -48,6 +48,8 @@ interface AdminUsageBreakdown {
provider: string;
model: string;
turns: number;
token_metered_turns: number;
token_unmetered_turns: number;
tokens_in: number;
tokens_out: number;
cost_usd: number;
@ -86,6 +88,8 @@ interface AdminUsageResponse {
window_days: number;
total_turns: number;
metered_turns: number;
token_metered_turns: number;
token_unmetered_turns: number;
tokens_in: number;
tokens_out: number;
cost_usd: number;
@ -250,6 +254,8 @@ async function mockAdminSession(
window_days: Number(url.searchParams.get("window_days") ?? 7),
total_turns: 0,
metered_turns: 0,
token_metered_turns: 0,
token_unmetered_turns: 0,
tokens_in: 0,
tokens_out: 0,
cost_usd: 0,
@ -886,15 +892,19 @@ test.describe("admin route guards", () => {
durable: true,
generated_at: 1_783_990_800,
window_days: 30,
total_turns: 32,
metered_turns: 30,
tokens_in: 125_000,
tokens_out: 18_500,
cost_usd: 6.6212,
total_turns: 37,
metered_turns: 37,
token_metered_turns: 35,
token_unmetered_turns: 2,
tokens_in: 160_703,
tokens_out: 19_629,
cost_usd: 7.023222,
recorded_cost_usd: 6.9612,
estimated_cost_usd: 0.062022,
budget: {
limit_usd: 20,
used_ratio: 0.33106,
remaining_usd: 13.3788,
used_ratio: 0.3512,
remaining_usd: 12.976778,
status: "ok",
},
evaluator_cache: {
@ -912,15 +922,48 @@ test.describe("admin route guards", () => {
provider: "openai",
model: "gpt-5-mini",
turns: 30,
token_metered_turns: 30,
token_unmetered_turns: 0,
tokens_in: 125_000,
tokens_out: 18_500,
cost_usd: 6.6212,
recorded_cost_usd: 6.6212,
estimated_cost_usd: 0,
cost_basis: "provider_reported",
},
{
provider: "claude_cli",
model: "claude-opus-4-8",
turns: 2,
token_metered_turns: 0,
token_unmetered_turns: 2,
tokens_in: 0,
tokens_out: 0,
cost_usd: 0.34,
recorded_cost_usd: 0.34,
estimated_cost_usd: 0,
cost_basis: "provider_estimate",
},
{
provider: "agy_cli",
model: "gemini-3.6-flash-high",
turns: 5,
token_metered_turns: 5,
token_unmetered_turns: 0,
tokens_in: 35_703,
tokens_out: 1_129,
cost_usd: 0.062022,
recorded_cost_usd: 0,
estimated_cost_usd: 0.062022,
cost_basis: "reference_rate",
rate_label:
"Google Gemini 3.6 Flash 표준 단가 · 입력 $1.50/M · 캐시 $0.15/M · 출력 $7.50/M",
},
],
daily_cost: [
{ day: "2026-07-13", turns: 8, tokens_in: 32_000, tokens_out: 4_800, cost_usd: 1.42 },
{ day: "2026-07-14", turns: 10, tokens_in: 41_000, tokens_out: 6_100, cost_usd: 2.08 },
{ day: "2026-07-15", turns: 12, tokens_in: 52_000, tokens_out: 7_600, cost_usd: 3.1212 },
{ day: "2026-07-15", turns: 17, tokens_in: 87_703, tokens_out: 8_729, cost_usd: 3.183222 },
],
},
},
@ -936,10 +979,17 @@ test.describe("admin route guards", () => {
);
await expect(page.getByText("운영 DB 원장").first()).toBeVisible();
// 2026-07-27 D7: 합계 금액은 화면에 소수 2자리로 표시하고 원본 정밀도는 title 로 옮겼다.
await expect(page.locator(".aic-ledger")).toContainText("$6.62");
await expect(page.locator(".aic-ledger b").first()).toHaveAttribute("title", /6\.6212/);
await expect(page.locator(".aic-budget")).toContainText("93.8%");
await expect(page.locator(".aic-ledger")).toContainText("$7.02");
await expect(page.locator(".aic-ledger b").first()).toHaveAttribute("title", /7\.023222/);
await expect(page.locator(".aic-budget")).toContainText("94.6%");
await expect(page.locator(".aic-table")).toContainText("gpt-5-mini");
await expect(page.locator(".aic-table")).toContainText("gemini-3.6-flash-high");
await expect(page.locator(".aic-table")).toContainText("참조단가");
await expect(page.locator(".aic-table")).toContainText("SDK 추정");
await expect(page.locator(".aic-table")).toContainText("미계량");
await expect(page.locator(".aic-table")).toContainText("$0.06");
await expect(page.locator(".aic-table")).toContainText("0.9%");
await expect(page.locator(".aic-ledger")).toContainText("기록 $6.96 · 참조 $0.06");
await expect(page.locator(".aic-cache-score")).toContainText("80%");
await expect(page.getByLabel("AI 기본 모델")).toHaveValue("gateway-default");
await expect(page.getByLabel("AI 엔진 공급자").locator("option")).toHaveCount(6);