docs: AG Native bundle reverse engineering analysis — plannerResponse/Whi renderer structure, V8 cache fix, known-issues update

This commit is contained in:
Variet Worker
2026-04-12 07:05:57 +09:00
parent eef59e6bb2
commit 353265bed8
25 changed files with 1236 additions and 33 deletions

40
scratch_ki_update.py Normal file
View File

@@ -0,0 +1,40 @@
"""Prepend new known-issue entry to known-issues.md"""
import sys
ki_path = r"c:\Users\Variet-Worker\Desktop\gravity_control\.agents\references\known-issues.md"
new_entry = """### [2026-04-12] [SDK/DOM] AG Native 세션은 Cascade SDK API에 등록되지 않음 — DOM이 유일한 데이터 소스
- **증상**: AG Native 세션에서 Discord 릴레이로 AI 응답이 전혀 전달되지 않고, 대신 UI 노이즈(`content_copy`, `Always run`, `keyboard_arrow_up`, `Cancel`)가 전송됨
- **원인 1 (SDK)**: `GetCascadeTrajectorySteps(cascadeId=세션ID)` → `500 trajectory not found`. `GetDiagnostics` → `404`. AG Native 세션은 Cascade trajectory API에 전혀 등록되지 않는 별도 시스템
- **원인 2 (DOM)**: `observer-script.ts` v6의 `scanChatBodies()`가 `.text-ide-message-block-bot-color` 컨테이너의 `textContent`를 통째로 가져오면서 내부 버튼/아이콘 텍스트까지 포함
- **해결**: `observer-script.ts` v7로 전면 재설계:
1. `[data-testid="conversation-view"]` + `[data-step-index]` 기반 step-aware 파싱
2. `extractCleanStepText()`: 클론 후 button/svg/icon 엘리먼트 제거 → 마크다운 텍스트만 추출
3. `extractStepContext()`: `getStepContainer()` → step 헤더 + code 블록만 추출
4. `NOISE_RE`: Material icon 이름, 버튼 레이블, UI 텍스트 전면 차단
5. 최초 `conversation-view` 감지 시 DOM 구조 자동 덤프 (`/dump-html`)
- **주의**: SDK 경로(step-probe RT-CAPTURE)는 AG Native에서 사용 불가. DOM이 유일한 콘텐츠 소스이므로 AG UI 업데이트 시 `data-testid`/`data-step-index` 속성 존재 여부 반드시 확인 필요
"""
with open(ki_path, 'rb') as f:
raw = f.read()
try:
content = raw.decode('utf-8')
except:
content = raw.decode('cp949', errors='replace')
# Find the "---" separator and insert after it
marker = "---\n"
idx = content.find(marker, content.find("archive"))
if idx >= 0:
insert_pos = idx + len(marker) + 1 # after ---\n\n
# Find actual end of marker section
after_marker = content[idx + len(marker):]
# Insert new entry
new_content = content[:idx + len(marker)] + "\n" + new_entry + after_marker
with open(ki_path, 'w', encoding='utf-8') as f:
f.write(new_content)
print("OK: known-issue entry added")
else:
print("ERROR: could not find insertion point")