대시보드 폴드아웃/드릴다운 정리 + 페르소나 역린·misconduct 반응 + 게이트웨이 격리·RAG 비차단 수정
SSOT 대시보드:
- 한신대 기술분석 PDF(19쪽) 정합성 분석 + 이번 세션 발견 섹션 추가
- 섹션 폴드아웃(접기)·상단 목차(드릴다운)·모두 펼치기/접기 — 내용 보존, 레이아웃만 정리
페르소나 반응 강화('저항·반응 조절' 핵심 차별):
- PersonaCard.triggers(역린) 필드 + CCD 핵심상처 파생 역린 블록
- L0에 무례·모욕·조롱 시 현실적 동맹 균열 반응 지침
버그·성능 수정(라이브/E2E로 포착):
- 게이트웨이 페르소나 격리: --append-system-prompt를 --system-prompt(교체)로 + --exclude-dynamic-system-prompt-sections (내담자 캐릭터 붕괴·개발맥락 누출 차단)
- RAG: 임베더 동기 로드(약 7-13초)를 _warm_rag_caches 백그라운드 warm으로(세션 생성 블로킹 회귀 수정)
- voice TTS RMS 데드힌트 제거, init_state OpennessParams 파라미터객체화
- 한국어 PII(날짜·금액·주소) 마스킹 보강
- 레이아웃 시각 게이트: 폼 컨트롤 값 스크롤 오탐 제외(7/7)
검증: 백엔드 84/84, E2E 42(데스크톱 27·모바일 11·아바타 4), 시각 게이트 7/7
This commit is contained in:
parent
cb2aebd76c
commit
085460b5e0
327 changed files with 31226 additions and 1829 deletions
|
|
@ -33,6 +33,10 @@ BASE_ARGS = [
|
|||
"--output-format", "stream-json",
|
||||
"--verbose",
|
||||
"--dangerously-skip-permissions",
|
||||
# 페르소나 격리: cwd/env/git status/메모리(CLAUDE.md) 등 per-machine 섹션을 시스템프롬프트에서
|
||||
# 제거 → 내담자 AI가 자신이 개발 환경(Claude Code/Vignette repo) 안에 있음을 알아채 캐릭터를
|
||||
# 깨는 것을 차단. (시스템프롬프트는 아래에서 --system-prompt 로 페르소나만 '교체' 주입.)
|
||||
"--exclude-dynamic-system-prompt-sections",
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -69,7 +73,9 @@ class EngineSession:
|
|||
if FALLBACK_MODEL:
|
||||
args += ["--fallback-model", FALLBACK_MODEL]
|
||||
if self.system_prompt:
|
||||
args += ["--append-system-prompt", self.system_prompt]
|
||||
# APPEND(기본 코딩 어시스턴트 프롬프트에 덧붙임) 대신 REPLACE → 페르소나가 유일한
|
||||
# 정체성. 기본 Claude Code 시스템프롬프트가 남으면 내담자가 어시스턴트로 작동/캐릭터 붕괴.
|
||||
args += ["--system-prompt", self.system_prompt]
|
||||
self.proc = await asyncio.create_subprocess_exec(
|
||||
*args,
|
||||
stdin=asyncio.subprocess.PIPE,
|
||||
|
|
@ -327,7 +333,6 @@ class GwMessage(BaseModel):
|
|||
class GwGenerateReq(BaseModel):
|
||||
ai_role: AIRole = "client"
|
||||
messages: list[GwMessage]
|
||||
tier: Literal["client", "feedback", "fast"] = "client"
|
||||
model: Optional[str] = None
|
||||
max_tokens: int = 1024
|
||||
temperature: float = 0.7
|
||||
|
|
@ -455,7 +460,14 @@ async def v1_stream(req: GwGenerateReq):
|
|||
yield f"event: error\ndata: {err}\n\n"
|
||||
else:
|
||||
meta = json.dumps(
|
||||
{"cost_usd": evt.get("cost_usd", 0.0), "turns": evt.get("turns", 0)},
|
||||
{
|
||||
"provider": "claude_cli",
|
||||
"model": s.model or DEFAULT_MODEL or "claude-opus-4-8",
|
||||
"tokens_in": 0,
|
||||
"tokens_out": 0,
|
||||
"cost_usd": evt.get("cost_usd", 0.0),
|
||||
"turns": evt.get("turns", 0),
|
||||
},
|
||||
ensure_ascii=False,
|
||||
)
|
||||
yield f"event: done\ndata: {meta}\n\n"
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class GatewayModelTest(unittest.TestCase):
|
|||
self.assertIs(ephemeral, True)
|
||||
self.assertEqual(session.model, "request-model")
|
||||
self.assertEqual(_model_arg(captured[0]), "request-model")
|
||||
self.assertIn("--append-system-prompt", captured[0])
|
||||
self.assertIn("--system-prompt", captured[0])
|
||||
finally:
|
||||
asyncio.run(session.close())
|
||||
|
||||
|
|
@ -120,6 +120,98 @@ class GatewayModelTest(unittest.TestCase):
|
|||
finally:
|
||||
asyncio.run(session.close())
|
||||
|
||||
def test_resolve_session_reuses_live_session_id_without_starting_claude(self):
|
||||
captured, process_patch = _capture_subprocess()
|
||||
existing = gateway.EngineSession(model=None)
|
||||
existing.proc = _FakeProcess()
|
||||
gateway.SESSIONS["sid"] = existing
|
||||
|
||||
with (
|
||||
patch.object(gateway, "DEFAULT_MODEL", "env-default"),
|
||||
patch.object(gateway, "FALLBACK_MODEL", ""),
|
||||
process_patch,
|
||||
):
|
||||
session, ephemeral = asyncio.run(
|
||||
gateway._resolve_session(_request(session_id="sid"), "new system prompt")
|
||||
)
|
||||
|
||||
self.assertIs(session, existing)
|
||||
self.assertIs(ephemeral, False)
|
||||
self.assertEqual(captured, [])
|
||||
|
||||
def test_resolve_session_creates_fresh_ephemeral_for_missing_session_id(self):
|
||||
captured, process_patch = _capture_subprocess()
|
||||
|
||||
with (
|
||||
patch.object(gateway, "DEFAULT_MODEL", "env-default"),
|
||||
patch.object(gateway, "FALLBACK_MODEL", ""),
|
||||
process_patch,
|
||||
):
|
||||
session, ephemeral = asyncio.run(
|
||||
gateway._resolve_session(_request(session_id="missing"), "system prompt")
|
||||
)
|
||||
|
||||
try:
|
||||
self.assertIs(ephemeral, True)
|
||||
self.assertNotIn(session.id, gateway.SESSIONS)
|
||||
self.assertEqual(len(captured), 1)
|
||||
self.assertIn("--system-prompt", captured[0])
|
||||
finally:
|
||||
asyncio.run(session.close())
|
||||
|
||||
def test_v1_generate_reuses_session_id_without_ephemeral_close(self):
|
||||
existing = gateway.EngineSession(model=None)
|
||||
existing.proc = _FakeProcess()
|
||||
gateway.SESSIONS["sid"] = existing
|
||||
calls = []
|
||||
closes = []
|
||||
|
||||
async def fake_turn(content, timeout=120.0):
|
||||
calls.append((content, timeout))
|
||||
return {"text": "reused response", "cost_usd": 0.01, "is_error": False}
|
||||
|
||||
async def fake_close():
|
||||
closes.append(True)
|
||||
|
||||
existing.turn = fake_turn
|
||||
existing.close = fake_close
|
||||
|
||||
response = asyncio.run(gateway.v1_generate(_request(session_id="sid")))
|
||||
|
||||
self.assertEqual(response["text"], "reused response")
|
||||
self.assertEqual(response["provider"], "claude_cli")
|
||||
self.assertEqual(calls, [("hello", 120.0)])
|
||||
self.assertEqual(closes, [])
|
||||
|
||||
def test_v1_generate_closes_fresh_ephemeral_session(self):
|
||||
started = []
|
||||
turned = []
|
||||
closed = []
|
||||
|
||||
async def fake_start(self):
|
||||
started.append(self)
|
||||
self.proc = _FakeProcess()
|
||||
|
||||
async def fake_turn(self, content, timeout=120.0):
|
||||
turned.append((self, content, timeout))
|
||||
return {"text": "fresh response", "cost_usd": 0.02, "is_error": False}
|
||||
|
||||
async def fake_close(self):
|
||||
closed.append(self)
|
||||
|
||||
with (
|
||||
patch.object(gateway.EngineSession, "start", fake_start),
|
||||
patch.object(gateway.EngineSession, "turn", fake_turn),
|
||||
patch.object(gateway.EngineSession, "close", fake_close),
|
||||
):
|
||||
response = asyncio.run(gateway.v1_generate(_request(session_id="missing")))
|
||||
|
||||
self.assertEqual(response["text"], "fresh response")
|
||||
self.assertEqual(len(started), 1)
|
||||
self.assertEqual(turned, [(started[0], "hello", 120.0)])
|
||||
self.assertEqual(closed, [started[0]])
|
||||
self.assertNotIn(started[0].id, gateway.SESSIONS)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue