Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions GUI-VALIDATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Offline GUI validation

Final status: PASS for the requested offline GUI flows on source revision 7a7e521. The parent independently completed the last restart/restore observation after the second unlock. Subsequent commits update documentation only.

See V2-IMPLEMENTATION.md for the verified flow table, isolation controls, exact limitations and Claude design-advice disposition.

Executed built binary with CODEBASIC_V2_OFFLINE=1 and CODEBASIC_V2_TEST_ROOT=/tmp/codebasic-v2-gui-review. CUA verified startup, image attachment, message send, mock response, explicit playback/stop, slow-generation cancellation, conversation selection, settings round trip, normal quit and restart restoration. V1 was simultaneously running throughout; its UI and data were not operated on. Both V2 process sessions exited 0 after normal GUI quit.

Test data remains in /tmp/codebasic-v2-gui-review for inspection. It contains synthetic text/images only. Playback was a state mock with fake bytes, not sound-device output. No paid provider or ElevenLabs requests were made.

## Final post-performance-patch rerun

The final app built and signed successfully, and all 38 chat mock checks, offline/permit checks, production Gemini transport mock and original regressions passed. It was launched with CODEBASIC_V2_OFFLINE=1 and CODEBASIC_V2_TEST_ROOT=/tmp/codebasic-v2-bench-300, containing only generated synthetic history (300 seed conversations, 6,000 seed messages and approximately 83 MB of synthetic PNGs, plus a few benchmark turns).

CUA could not inspect or operate the app because the Mac was locked and automatic unlock was unavailable. A manual-unlock request was issued; no lock bypass was attempted. At that point the final flow and actual large-list GUI responsiveness were blocked. Both were subsequently observed after unlock, as recorded below. The prior complete GUI sequence above was on 0bfb8f4; it must not be presented as the final post-cache-patch rerun. The offline app remained running for the unlock/resume step. Startup logged one nonfatal NSTableView reentrant-operation warning; its user-visible effect could not be checked while locked.

The authorized real Google/ElevenLabs check was completed separately through production V2 components while GUI access was blocked; see LIVE-VALIDATION.md. That check does not establish the live GUI flow.

## Resumed final-code observations after unlock

The Mac was unlocked and CUA inspected the exact app built from 7a7e521 (binary SHA-256 3c89774e52bdc60a7cb4fe006be96e8156ebb2e192b263b5e5721a49cf06145e). The offline banner was visible. New test records were written only in /tmp/codebasic-v2-bench-300/chat, confirming the isolated data route. No source changes or additional real API requests were made.

Observed on this final source:

- Selected Synthetic conversation 0000, scrolled the sidebar to the final 0299 item, selected it and opened a new conversation. All remained responsive; no visible hang or incorrect conversation content was observed. This is qualitative GUI observation, not a measured FPS/frame-time result.
- Normally quit the old offline process (exit 0), relaunched the same final binary with the same offline variables, and observed the persisted new conversation plus the large synthetic list restored.
- Attached the known synthetic PNG through NSOpenPanel. Explicitly selecting the file row enabled Open; selecting only its suggested path had left Open disabled. This required no app change. The completed conversation visibly rendered the blue synthetic image.
- Sent Final offline attachment test 7a7e521; observed streaming state, complete mock response and playback control. Playback showed preparing/stop; stop reset the state.
- Created a second conversation with 취소 검증 final 7a7e521, started the deliberately slow mock and cancelled it; state became cancelled and input controls re-enabled.
- Switched back to the completed image conversation, opened voice and AI-service settings, and returned. Image, response and thread selection were preserved.
- The new restart logged the same nonfatal NSTableView reentrant-operation warning. During the tested list, compose, playback, cancellation and settings operations it caused no observed user-visible failure. Its underlying cause and behavior on future macOS versions remain unverified.

The Mac locked again before the last visual restoration check. Direct inspection at that point confirmed 310 threads / 6,020 messages, the completed test thread with an existing image attachment and timestamps, and the cancelled partial response with timestamps. This was initially recorded as pending; the independent GUI observation below resolves it.

V1 settings and installed-binary digests, and original credential-file metadata, were checked again after this GUI session and remained unchanged.

## Independent final restart/restore confirmation — completed

The parent reported a direct CUA confirmation after the Mac was unlocked again:

1. Normally quit V2 with Command-Q, then started the same built binary explicitly with CODEBASIC_V2_OFFLINE=1 and CODEBASIC_V2_TEST_ROOT=/tmp/codebasic-v2-bench-300.
2. Confirmed the visible offline MOCK / external-connection-blocked banner.
3. Opened 취소 검증 final 7a7e521 and observed the partial response with cancelled status.
4. Selected Final offline attachment test 7a7e521 and observed the original user message, image element, completed mock response acknowledging one image, and restored playback button.

This completes the visual restoration check for the newly created records; no GUI lock blocker remains. The observation was performed independently by the parent, not repeated by this implementation turn. No source change or further API test was required.

Automation caveat: immediately after the first normal quit, a CUA getAXState call automatically launched V2 in its default mode. The parent immediately closed that process without input, settings, generation or key-import actions, then explicitly relaunched offline and performed the checks above. The default-mode startup was not used as validation evidence. No additional generation/synthesis was requested; automatic model-discovery traffic during that incidental startup was not instrumented, so this report does not claim that process had a network blocker installed. Avoid selecting/observing a stopped native app until it has been relaunched with the intended explicit test environment.

A final read-only preservation check after this confirmation again found V1 settings and installed-executable digests unchanged, original settings/credential file metadata unchanged, and the V1 checkout clean at aba918365ea9a7dc19fa27b9652a0f6bbe84df24. No credentials were copied or printed. Physical speaker audibility, exact billing and full live GUI coverage of every provider remain outside this offline GUI result.
35 changes: 35 additions & 0 deletions LIVE-VALIDATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Authorized minimal Google / ElevenLabs verification — 2026-11-17

The user explicitly authorized read-only use of the existing app's authentication information for one short, harmless synthetic Google response and playback of that response with the existing ElevenLabs voice/model. No existing conversation, document or image was submitted. No credential value was printed, copied to a new file or added to a report.

The Mac was locked, so this was a production-component integration probe rather than an observed live GUI flow. The probe uses the same EndpointGenerator, provider-neutral conversation, ChatSession, ElevenLabsBackend, TextSplitter/ChatSpeechPlan and QueuePlayer as V2. It ran with CODEBASIC_V2_LIVE_VALIDATION=1, CODEBASIC_V2_OFFLINE unset and CODEBASIC_V2_TEST_ROOT=a dedicated temporary folder. Offline URLProtocol blocking was not bypassed; it is only installed by offline mode, in a different process. There was no account login, subscription, billing setting or installation change.

## Controls

Live-validation mode suppresses automatic provider/model discovery, refuses plan transports and non-Google generation endpoints in the UI, uses a dedicated /tmp data root, caps Gemini output at 64 tokens, and persists a one-use permit per authorized provider. Failed attempts also consume the permit. The audio check accepts a single response below 300 characters. The manual probe requires an explicit --authorized-single-probe argument, checks the selected original model/endpoint, and is never run by build.sh test. Keys are read through the explicit V1 fallback marker; only that empty marker is created, not key files.

Before the actual request, URLProtocol mock tests verified the production Gemini streaming payload had the 64-token cap and provider-neutral conversation. Permit/isolation checks and all normal regression tests passed without real requests.

## Actual result

| Item | Observed result |
|---|---|
| Google logical requests | 1, no application retry |
| Selected Google model | gemini-flash-lite-latest, original selected model |
| Submitted user text | 39 synthetic characters requesting only the sentence “음성 연결 테스트입니다.” |
| Other submitted content | A short synthetic system instruction; no previous messages or images |
| Generated response | 13 characters |
| Returned Google usage | 34 prompt tokens, 6 candidate tokens, 40 total; serviceTier standard |
| ElevenLabs logical requests | 1, no application retry |
| Voice/model | Original selected voice and eleven_v4; original tuning read-only |
| ElevenLabs input | The 13-character generated response only |
| ElevenLabs response | HTTP 200, 30,137 MP3 bytes |
| Playback | AVQueuePlayer reached end-of-item: completed_chunks=1, expected_chunks=1; no failure event or timeout |
| Physical audibility | Not independently recorded/heard through a measurement device; the completion event verifies the software playback path |
| Billing | No balance, invoice or exact charge was queried. Token/character counts above are known; monetary cost/credit debit remains unverified |

Non-secret evidence is under build/validation/live. The synthetic conversation/audio and one-use markers remain in the dedicated /tmp live root. Do not re-run a paid probe merely to reproduce this report; another live run requires its own authorization. The reproduction benchmark and build.sh test use synthetic/local mocks only.

## V1 preservation

Before/after checks found the original settings JSON and installed app executable SHA-256 digests unchanged. Metadata for five settings/credential files (size, modification time and inode) was unchanged; credential contents were not read for this comparison. V1 checkout remained clean at aba918365ea9a7dc19fa27b9652a0f6bbe84df24. No V1 history or attachments were read. The only credential reads were those required by the expressly authorized Google/ElevenLabs probe.
23 changes: 23 additions & 0 deletions PERFORMANCE-VALIDATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Synthetic history performance

Measured on macOS 27.0.1 arm64, optimized swiftc build, local filesystem, 2026-11-17. This is an informal warm-filesystem measurement, not a cold-cache or controlled-system benchmark. Other Mac apps remained running. App build/unit compilation had finished before the final sequential comparison.

All data is synthetic. Seed sizes: 50/300/1000 threads, 20 messages per thread, approximately 500 text characters per message; 10/80/80 valid PNG attachments of 1,033,018 bytes each (10,330,180 / 82,641,440 / 82,641,440 bytes). Initial metadata sizes: 771,215 / 4,633,045 / 15,440,345 bytes. Each timed run appends one small benchmark thread/two messages. Exact loaded counts are in the JSON logs; this drift is small relative to seed message count.

Baseline: ChatSession extracted read-only from 0bfb8f4. Final: cached unchanged-thread metadata, one new-thread flush. Baseline is one run per scale; final entries are medians of three fresh-process runs. No filesystem cache flush was attempted.

| Seed threads/messages | Load ms before → final | New-thread flush ms before → final | Send flush ms before → final | Shutdown flush ms before → final | Main actor max tick gap ms before → final | Final loaded / end RSS MiB | Peak RSS MiB range |
|---|---|---|---|---|---|---|---|
| 50 / 1000 | 18.91 → 14.21 | 21.22 → 10.09 | 8.69 → 0.90 | 14.90 → 4.47 | 21.00 → 11.87 | 18.72 / 22.27 | 24.08–24.17 |
| 300 / 6000 | 69.53 → 63.28 | 86.83 → 42.57 | 41.19 → 2.90 | 45.41 → 9.42 | 69.94 → 14.39 | 104.09 / 119.92 | 121.44–130.59 |
| 1000 / 20000 | 158.02 → 150.06 | 288.68 → 135.83 | 137.62 → 7.91 | 146.38 → 29.15 | 149.16 → 22.26 | 142.58 / 237.64 | 237.34–240.34 |

Load includes synchronous archive decode and image file loading, measured from a fresh process with potentially warm OS cache. New-thread time includes its first full cache fill. Send and shutdown measure synchronous durability flush. The stream emits 120 synthetic chunks at 10 ms intervals, with a 1 ms MainActor ticker; the maximum observed tick gap measures scheduling stalls, not display frame rate or human-perceived latency. Resident memory uses Mach task_info; peak uses /usr/bin/time -l and includes the entire benchmark process. These are not GUI-app memory measurements.

The former repeated full JSON encoding was a measurable bottleneck. Caching unchanged thread JSON and removing the duplicate new-thread save reduced steady-state flush and main-actor scheduling gaps. The cache increases resident memory, especially for 20,000 messages. First save/initial load still scale with total history; this prototype is not a lazy-loading database.

Reproduce from the repository with `bash Tests/run-chat-benchmark.sh /tmp/codebasic-v2-benchmark-repro-UNIQUE`. It generates its own deterministic synthetic PNG and archives, compiles baseline/final harnesses, performs one baseline and three final runs per scale, and leaves JSON/time/fixture records in that dedicated /tmp root. Use a new root for each reproduction. No credentials or provider transports are compiled into this harness.

Actual GUI responsiveness on the final 300-thread dataset is recorded separately in GUI-VALIDATION.md; the ticker above is not a substitute for that observation.

After unlock, CUA qualitatively verified the 300-seed-thread GUI list through item 0299, new-thread creation, compose/attach/response, playback/stop, cancellation and settings navigation without a visible hang. This observation is separate from the quantitative MainActor ticker. The final visual restoration check was briefly interrupted by another Mac lock and was then completed independently by the parent using the explicit offline environment; see GUI-VALIDATION.md.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Independent V2 prototype

See [V2-IMPLEMENTATION.md](V2-IMPLEMENTATION.md). Use `./build.sh build` and `./build.sh test`; V2 has no installation target. The inherited V1 documentation below describes the original app.

# Codebasic TTS

<p align="center">
Expand Down
88 changes: 20 additions & 68 deletions Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,25 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Codebasic TTS</string>
<key>CFBundleDisplayName</key>
<string>Codebasic TTS</string>
<key>CFBundleIdentifier</key>
<string>com.seongjoo.SelectedTextTTS</string>
<key>CFBundleExecutable</key>
<string>Codebasic TTS</string>
<key>CFBundleVersion</key>
<string>3</string>
<key>CFBundleShortVersionString</key>
<string>0.2.1</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleIconFile</key>
<string>AppIcon</string>
<key>LSMinimumSystemVersion</key>
<string>13.0</string>

<!-- Start as a focus-safe agent; MainWindow flips to a Dock app (.regular)
while its window is open. Keeps background Services playback from
stealing focus. -->
<key>LSUIElement</key>
<true/>

<!-- macOS Services registration. NSMessage maps to the selector
readSelectedText:userData:error: in ServiceProvider.swift. -->
<key>NSServices</key>
<array>
<dict>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>Codebasic TTS</string>
</dict>
<key>NSMessage</key>
<string>readSelectedText</string>
<key>NSPortName</key>
<string>SelectedTextTTS</string>
<key>NSSendTypes</key>
<array>
<string>public.utf8-plain-text</string>
</array>
<!-- Empty context dict = always available, regardless of app. -->
<key>NSRequiredContext</key>
<dict/>
</dict>
<!-- Second entry: explain selected code, then read the commentary aloud.
NSMessage maps to explainSelectedText:userData:error: in
ServiceProvider.swift. -->
<dict>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>Codebasic TTS: 코드 해설</string>
</dict>
<key>NSMessage</key>
<string>explainSelectedText</string>
<key>NSPortName</key>
<string>SelectedTextTTS</string>
<key>NSSendTypes</key>
<array>
<string>public.utf8-plain-text</string>
</array>
<key>NSRequiredContext</key>
<dict/>
</dict>
</array>
<key>CFBundleDisplayName</key>
<string>Codebasic TTS V2</string>
<key>CFBundleExecutable</key>
<string>Codebasic TTS V2</string>
<key>CFBundleIconFile</key>
<string>AppIcon</string>
<key>CFBundleIdentifier</key>
<string>com.seongjoo.CodebasicTTSV2</string>
<key>CFBundleName</key>
<string>Codebasic TTS V2</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.2.1</string>
<key>CFBundleVersion</key>
<string>3</string>
<key>LSMinimumSystemVersion</key>
<string>14.0</string>
<key>LSUIElement</key>
<true/>
</dict>
</plist>
3 changes: 1 addition & 2 deletions Sources/App/AntigravityPlan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ enum AntigravityPlan {
.first { FileManager.default.isExecutableFile(atPath: $0) }.map(URL.init(fileURLWithPath:))
}
static var home: URL {
FileManager.default.homeDirectoryForCurrentUser
.appendingPathComponent("Library/Application Support/Codebasic TTS/antigravity-plan")
URL(fileURLWithPath: Secrets.appSupportDir).appendingPathComponent("antigravity-plan")
}
static func environment(home: URL) -> [String: String] {
["HOME": home.path,
Expand Down
5 changes: 2 additions & 3 deletions Sources/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@ final class AppDelegate: NSObject, NSApplicationDelegate {

setUpMainMenu()
setUpStatusItem()
registerServices()
registerHotKeys()
// V2 is a conversation app; no V1 Services or global hotkey registrations.
observeState()

// Review-only 해설 (auto-play off): surface the window so it can be checked.
appState.onRequestReview = { [weak self] in
self?.mainWindow.show()
NSApp.activate(ignoringOtherApps: true)
}
if appState.keyPresent { appState.refreshVoices() }
// ElevenLabs is contacted only by explicit playback or settings actions.
mainWindow.show() // open the management window on launch

Log.app.info("Codebasic TTS launched. Backend: \(self.appState.backendIdentity, privacy: .public)")
Expand Down
Loading