Repository navigation
Conversation
- LLM layer: LLM.openaiChatStream (OpenAI-compatible SSE streaming, image
input via data URLs) + OpenAICompat {models, base URL presets, fallback
model lists}; OpenAICompatNormalizer/Explainer/Reviewer + Gemini/Ollama
Reviewer so every channel can serve every role.
- AppState: NormalizeProvider gains .opencode/.openrouter (per-channel
endpoint URL + model + key status + refresh/saveKey); role-based model
pickers (script/explain/vision/review) replace the provider-binding
pickers; new 검수 (script review) stage streams a report comparing the
자막용 해설 with the TTS 대본 (auto after 대본 생성, toggleable, never
overwrites the script); settings persist all new fields.
- UI: model pickers take a role; Settings 텍스트 생성 channel adds
OpenCode/OpenRouter sections; save triggers split into two ViewModifiers
(SettingsSaveTriggers A/B) after the onChange chain exceeded the Swift
type-checker's expression budget.
- Secrets: opencode_key/openrouter_key accessors (App Support plaintext
files, same scheme as gemini_key).
Verified: ./build.sh build (signed) + ./build.sh test all pass; endpoints
probed live — OpenRouter gemini-3.1-flash-lite 1.0s, OpenCode(go)
glm-5.3-flash 1.8s. Keys installed to App Support by the operator.
- 기본 엔드포인트를 generativelanguage.googleapis.com/v1beta/openai 로: TTS 앱의 gemini_key(AIza…)를 Bearer 키로 그대로 쓰는 Google 공식 OpenAI 호환 경로. 별도 키 발급 없이 통합 채널 사용 가능. - .openrouter 채널을 .openai 로 대체: openai_key 파일이 있으면 우선, 없으면 gemini_key 공용(Secrets.openAIKey). 엔드포인트 URL을 OpenCode·자체 프록시로 바꾸면 그 키를 openai_key에 저장하는 구조. - Gemini 호환 경로의 models/*/id 표기 정규화, 스트림 폴백 URL 정리. - 실측: gemini-3.1-flash-lite 0.68s(비스트리밍) / 첫 청크 0.67s(스트리밍) — 기존 후보 중 최속. OpenCode는 보조 채널로 유지.
- PlaybackInbox (신규): ~/.hermes/../Codebasic TTS/tts-inbox 의 재생 패키지(narration=자막용 해설, script=음성용 대본)를 1초 폴링으로 감시 → 최신 1건 로드 → .done 개명. 기동 시 유실분 자동 로드. - AppState.prepareInboxPackage: LLM 호출 없이 두 텍스트를 패널에 반영하고 재생 준비. 자동 재생 없음 — 사용자가 재생 버튼/단축키로 트리거(재생 제어는 앱 소유 유지). - AppDelegate: 수신함 기동 + 패키지 도착 시 관리 창 표시. - Hermes 플러그인 측: send_to_inbox + send_playback_package 도구 — 세션이 3단 산출(해설·대본)을 앱으로 전송하는 공식 경로.
- 패키지 JSON에 autoplay 필드(기본 false): true면 앱이 수신 즉시 synthesize(script, 자막=narration). 아니면 재생 준비 후 사용자 트리거. - 재생 제어(정지·스킵·일시정지)는 어느 쪽이든 앱 소유 유지.
- PlaybackInbox: kqueue DispatchSource(O_EVTONLY, write/extend/rename)로 디렉터리 감시. 이벤트 1건 → 0.25s 버스트 병합 후 1회 스캔. 디렉터리 치환(rename/delete) 시 재감시. 기동 시 유실분 1회 로드 유지. - 작성자(플러그인)는 tmp→rename 원자적 쓰기로 이벤트 시점 온전성 보장.
- PlaybackInbox.watch(): 공유 dirFD 프로퍼티 제거. 각 DispatchSource가
자기 fd를 값으로 캡처해 cancel 핸들러에서만 닫는다(Apple 계약).
이전 소스의 비동기 cancel 핸들러가 새 소스의 fd를 닫아 디렉터리
치환 후 감시가 조용히 죽던 버그 수정. 동기 close와의 이중 close 경합도 제거.
- 재감시 전 수신함 디렉터리를 다시 만들어 삭제/치환 후 open이 성공하게 함.
- AppDelegate: "\\(" 로 이스케이프돼 문자 그대로 찍히던 기동 로그의
backendIdentity 보간 복구.
Verified: ./build.sh build (signed) + ./build.sh test pass.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
watch()가 기동·재감시 양쪽에서 디렉터리를 보장하므로 start()의 호출은 바로 뒤에서 한 번 더 실행되는 중복 syscall이었다. 디렉터리 생성 지점을 watch() 한 곳으로 모은다. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
재감시 중 mkdir/open이 실패하면 source가 nil인 채 영구히 감시가 끊겼다 (폴링 폴백은 d95bb0d에서 제거됨). 이제 mkdir 오류를 로그로 남기고, open 실패 시 errno를 로그·status에 표시한 뒤 5초 후 재시도를 예약한다. 재시도 성공 시 status를 지우고 끊긴 동안 도착한 패키지를 1회 스캔한다. stop()은 예약된 재시도도 취소한다. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
다른 저장소(CacheStore·NormalizationCache·BacklogStore)와 같은 기준 경로를 쓰도록 하드코딩 리터럴을 제거. appSupportDir이 바뀌어도 수신함이 따라간다. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
소스는 cancel 시 자기 핸들러를 해제하므로 강한 캡처가 순환을 남기지 않는다. 옵셔널 언래핑과 조기 반환 경로 하나를 덜어낸다. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
삭제/치환 이벤트마다 메인 큐에서 mkdir+open+소스 생성을 즉시 반복하던 것을 scheduleRewatch로 모아 버스트당 1회만 재감시하고, 재감시 뒤 스캔을 이어 건다. open 실패 재시도도 같은 경로를 쓴다(5초). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
재감시 시점에 폴더가 없으면 조용히 빈 폴더를 다시 만들기만 했다. 옮겨진 폴더 안의 대기 패키지는 집어오지 못하므로 로그와 status로 알린다. 부모 디렉터리 감시로의 전환은 하지 않음 — 플러그인은 폴더 자체를 개명하지 않고 파일만 교체하므로 외부 조작(Finder 이동 등)에 한정된 경우다. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
PlaybackInbox(파일 수신함 감시)와 AppDelegate 배선, AppState.prepareInboxPackage를 제거한다. 해설·대본·검수는 앱 안의 LLM 채널로만 수행하며, 외부 에이전트가 텍스트를 밀어 넣는 경로는 없다. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
3단(해설 → 대본 → 음성)의 해설과 대본 각각에 검수 단계를 붙인다. 검수는 리포트만 남기던 것에서, 마지막 줄의 '판정: 통과 / 판정: 수정 — <지시>'를 읽어 실제 결과에 반영하는 단계로 바뀐다. - ReviewVerdict (Core, 순수 로직 + 테스트): 판정 줄 파싱. 굵게·글머리· 전각 콜론 허용, 지시가 비면 리포트 본문을 지시로, 판정 줄이 없으면 '문제 없음'일 때만 통과. - Reviewing 프로토콜을 prompt 기반으로 단순화. ScriptReview(원문 vs 대본) 지시문에 판정 규칙 추가, ExplanationReview(코드 vs 해설) 신설: 창작· 실행 결과 예측·누락·마크다운·인사말·타임코드·발음 표기 검출. - AppState: 해설 생성(runExplain)·대본 생성(prepareScript)·내부 대본 (ttsScript)·다듬기(runRefineScript) 끝에 검수를 await로 붙인다. 판정이 '수정'이고 자동 반영이 켜져 있으면 현재 결과 + 리포트 + 지시를 넣어 1회 재생성한 뒤 재검수(라운드 1회 고정). 검수·수정을 거친 결과를 캐시에 넣고, 캐시 적중 시 검수를 생략한다고 표시. 단축키 원샷 경로도 검수 뒤에 재생한다. - UI: ReviewPanel 공용 블록(자동 검수·수정 자동 반영 토글, 검수 실행, 검수 모델, 판정 배지, 리포트, 지시문 편집)을 해설 탭과 TTS 탭에 배치. - 설정: reviewAutoFix·explainReviewEnabled 저장, 두 검수 지시문은 사용자 변경 시에만 저장. Verified: ./build.sh build (signed) + ./build.sh test pass. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- 5cf36e5에서 .openrouter 채널을 .openai(Gemini 공식 호환 경로)로 바꾼 뒤 남은 OpenRouter 문구(설정 안내문, 픽커 주석, MARK, SSE 주석)와 미사용 defaultOpenRouterBaseURL 제거. - reviewEnabled 저장은 ReviewPanel의 onChange가 담당하므로 SettingsSaveTriggersB의 중복 트리거 제거(저장 2회 → 1회). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
앱의 실제 소스(TextNormalizer 프롬프트·스트림, ReviewVerdict 파서, Secrets)를 그대로 컴파일해 gemini_key로 실제 호출한다. 오염된 해설(제목·타임코드·인사말· 발음 표기)에 '수정' 판정이 나오고, 앱과 같은 힌트 구성으로 재생성하면 '통과'로 바뀌는지까지 확인. 유료 호출이라 단위 테스트와 분리된 옵트인 타깃. 실측(2026-09-03, gemini-flash-latest / flash-lite-latest): 해설 25.6s, 검수 0.7~2.0s, 대본 1.8s. 정상 해설은 통과, 대본 검수는 'e.sum(axis=0)' 발음을 '수정'으로 잡음, 오염 해설은 수정→재생성 9.2s→재검수 통과, 오염 표식 잔여 없음. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- 캐시: 검수 판정을 얻은 결과에만 캐시에 검수 표시(ReviewMark)를 남긴다. 표시 없는 캐시 적중은 "생성 당시 검수를 마치지 못한 결과"로 보고 그때 검수한다 — 검수 실패가 캐시로 굳지 않고, "생성 시 검수됨" 거짓 문구도 없앴다. 캐시 적중 시 표시(통과/수정 반영 후 통과/재검수 미통과/미반영)를 배지에 되살린다. - 상태줄: 검수 단계가 ReviewOutcome.notice로 최종 메시지를 돌려주고 호출자가 그대로 표시한다. 수정 반영 실패 원인이 더는 지워지지 않는다. - 재검수 정책: 수정본 재검수도 '수정'이면 수정본을 버리고 원본 유지. 플래그 (reviewFlagged/explainReviewFlagged → 빨간 배지)를 세우고 통합 로그 (category "review", warning)와 백로그(태그 '검수'·'재검수 미통과', input=원본, output=버린 수정본, note=1차 검수·지시·재검수 리포트)에 기록한다. 재생성 실패·빈 응답도 원본 유지. 재검수 자체가 실패하면 수정본을 채택하되 표시를 남기지 않아 다음 캐시 적중 때 다시 검수한다. - 검수 공급자: 설정에 없으면 해설 공급자를 따르고, 기본 Gemini 검수 모델을 flash-lite로. (사용자 settings.json도 Ollama → Gemini flash-lite로 변경, 백업 settings.json.pre-review-fix.bak) - Core: ReviewMark·ReviewOutcome(순수, 테스트), Log.review 카테고리. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요약
LLM 엔드포인트를 다중 채널로 확장하고, 해설·대본 생성을 Hermes 세션으로 위임하는 수신함 계약을 도입합니다. 앱은 재생·자막·제어에만 집중합니다.
변경 내용
1. 다중 엔드포인트 LLM 채널 (c17968b, 5cf36e5)
NormalizeProvider에openai(Google OpenAI 호환 포함)·opencode·openrouter추가 — 기존 gemini/ollama와 병행gemini_key)를v1beta/openaiBearer 경로로 재사용 — 별도 키 불필요, 실측 gemini-3.1-flash-lite 0.68sSettingsSaveTriggersA/B로 분할 — Swift 타입체크 타임아웃 해결2. 대본 검수 단계 (c17968b)
3. Hermes 세션 수신함 계약 (0134814, d20081c, d95bb0d)
PlaybackInbox:~/Library/Application Support/Codebasic TTS/tts-inbox/*.json감시{narration(자막), script(음성), topic, autoplay}— 앱은 재생 준비만, 자동 재생 없음(autoplay 플래그 시 즉시)테스트
./build.sh test전체 통과참고