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:
parent
93dd8f82d7
commit
16e791e044
390 changed files with 243188 additions and 499 deletions
104
apps/web/src/lib/voicePracticeContext.ts
Normal file
104
apps/web/src/lib/voicePracticeContext.ts
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
export type VoicePracticeSceneType =
|
||||
| "silence"
|
||||
| "overlap"
|
||||
| "interruption"
|
||||
| "prosody"
|
||||
| "pace"
|
||||
| "audio_quality";
|
||||
|
||||
export interface VoicePracticeContext {
|
||||
mode: "voice";
|
||||
sourceSessionId: string;
|
||||
sourceSceneId: string | null;
|
||||
sceneType: VoicePracticeSceneType | null;
|
||||
sceneStartMs: number | null;
|
||||
sceneEndMs: number | null;
|
||||
}
|
||||
|
||||
const SOURCE_SESSION_ID_RE = /^[a-z0-9][a-z0-9_-]{0,127}$/i;
|
||||
const SCENE_ID_RE = /^oas-g7-event-[a-z0-9-]+$/;
|
||||
const SCENE_TYPES = new Set<VoicePracticeSceneType>([
|
||||
"silence",
|
||||
"overlap",
|
||||
"interruption",
|
||||
"prosody",
|
||||
"pace",
|
||||
"audio_quality",
|
||||
]);
|
||||
|
||||
function parseMilliseconds(value: string | null): number | null {
|
||||
if (value == null || value === "") return null;
|
||||
const parsed = Number(value);
|
||||
return Number.isSafeInteger(parsed) && parsed >= 0 ? parsed : null;
|
||||
}
|
||||
|
||||
export function parseVoicePracticeContext(
|
||||
searchParams: URLSearchParams,
|
||||
): VoicePracticeContext | null {
|
||||
if (searchParams.get("mode") !== "voice") return null;
|
||||
const sourceSessionId = searchParams.get("source_session")?.trim() ?? "";
|
||||
if (!SOURCE_SESSION_ID_RE.test(sourceSessionId)) return null;
|
||||
|
||||
const rawSceneId = searchParams.get("source_scene");
|
||||
const rawSceneType = searchParams.get("scene_type");
|
||||
const rawSceneStartMs = searchParams.get("scene_start_ms");
|
||||
const rawSceneEndMs = searchParams.get("scene_end_ms");
|
||||
const sceneFields = [
|
||||
rawSceneId,
|
||||
rawSceneType,
|
||||
rawSceneStartMs,
|
||||
rawSceneEndMs,
|
||||
];
|
||||
const hasSceneContext = sceneFields.some((value) => value != null);
|
||||
|
||||
// 특정 장면 재연습은 네 필드가 하나의 provenance 묶음이다. 일부만 있거나
|
||||
// 하나라도 손상되면 전체 회기 재연습으로 조용히 축약하지 않는다.
|
||||
if (hasSceneContext && sceneFields.some((value) => value == null)) return null;
|
||||
|
||||
const normalizedSceneId = rawSceneId?.trim() ?? "";
|
||||
const normalizedSceneType = rawSceneType?.trim() ?? "";
|
||||
const sceneStartMs = parseMilliseconds(rawSceneStartMs);
|
||||
const sceneEndMs = parseMilliseconds(rawSceneEndMs);
|
||||
if (
|
||||
hasSceneContext &&
|
||||
(!SCENE_ID_RE.test(normalizedSceneId) ||
|
||||
!SCENE_TYPES.has(normalizedSceneType as VoicePracticeSceneType) ||
|
||||
sceneStartMs == null ||
|
||||
sceneEndMs == null ||
|
||||
sceneEndMs <= sceneStartMs)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
mode: "voice",
|
||||
sourceSessionId,
|
||||
sourceSceneId: hasSceneContext ? normalizedSceneId : null,
|
||||
sceneType: hasSceneContext
|
||||
? (normalizedSceneType as VoicePracticeSceneType)
|
||||
: null,
|
||||
sceneStartMs: hasSceneContext ? sceneStartMs : null,
|
||||
sceneEndMs: hasSceneContext ? sceneEndMs : null,
|
||||
};
|
||||
}
|
||||
|
||||
export function voicePracticeSearch(context: VoicePracticeContext): string {
|
||||
const params = new URLSearchParams({
|
||||
mode: context.mode,
|
||||
source_session: context.sourceSessionId,
|
||||
});
|
||||
if (context.sourceSceneId) params.set("source_scene", context.sourceSceneId);
|
||||
if (context.sceneType) params.set("scene_type", context.sceneType);
|
||||
if (context.sceneStartMs != null) params.set("scene_start_ms", String(context.sceneStartMs));
|
||||
if (context.sceneEndMs != null) params.set("scene_end_ms", String(context.sceneEndMs));
|
||||
return params.toString();
|
||||
}
|
||||
|
||||
export const VOICE_SCENE_LABEL: Record<VoicePracticeSceneType, string> = {
|
||||
silence: "침묵 뒤 응답",
|
||||
overlap: "발화 겹침",
|
||||
interruption: "끼어듦",
|
||||
prosody: "운율 변화",
|
||||
pace: "말 속도",
|
||||
audio_quality: "음질 구간",
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue