feat: P1 — connect, API-key auth, session list, live transcript - #1
Merged
Conversation
Implements design doc §10 P1 on the published @codeoid/protocol + @codeoid/core packages: - Connect screen: /health + /config discovery, zid_sk_ API-key exchange via the daemon's /oauth2/token proxy (scoped request — a scope-less JWT would have every verb denied), credentials in the device Keychain/Keystore, JWT re-minted on every reconnect via getToken. - Connection singleton: CodeoidClient (parts, replay.chunked, replay.resume, send.idempotency declared) + MessageStore + ResumeCursors; AppState foreground + NetInfo regained-connectivity call reconnectNow(). - Session list: session.list with waitForResult correlation, kept live from session.status_change / session.info_update broadcasts, pull-to-refresh, protocol-version mismatch banner. - Transcript: attach on entry with incremental-resume cursor, re-attach on every reconnect, detach on leave, plain-text rows (identity label per message, tool phase line), composer minting one clientMsgId per send. - metro.config.js: resolver fallback retrying failed ".js" specifiers without the extension — the packages ship raw TS source with TS-ESM relative imports, which Metro does not redirect inside node_modules. Verified headless against a live daemon: discovery → exchange (all 9 scopes granted) → auth.ok (protocol v1) → session.list (17 sessions) → attach replayed 1015 messages through store.ingest(). Typecheck, lint, and expo export (android) all clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
All of P1 from
docs/mobile-app-design.md§10, built on the published@codeoid/protocol@0.1.0+@codeoid/core@0.1.0:/health+/configdiscovery →zid_sk_…API-key exchange at the daemon's same-origin/oauth2/tokenproxy → credentials in Keychain/Keystore (expo-secure-store), JWT held in memory only and re-minted on every reconnect (getToken). Auto-reconnects with stored credentials on launch. Google OAuth stays P3 (codeoid#42).CodeoidClient+MessageStore+ResumeCursorsper daemon; every broadcast routed throughstore.ingest(msg, cursors); capabilities declared:parts,replay.chunked,replay.resume,send.idempotency.AppState(foreground) + NetInfo (connectivity regained) →reconnectNow().session.listviawaitForResultcorrelation, kept live fromsession.status_change/session.info_update, pull-to-refresh, protocol-mismatch banner, sign-out.connectedtransition, detach on leave, plain-text rows with per-message identity labels and tool phase lines, composer minting oneclientMsgIdper send. FlashList + streaming markdown arrive in P2.Metro + TS-source packages (the flagged P1 risk)
The handoff's assumption was right to worry: Metro resolves the packages'
exports → ./src/index.tsfine, but does not apply the TS-ESM.js → .tsredirect to their internal relative imports (from "./types.js").metro.config.jsadds a minimalresolveRequestfallback that retries a failed.jsresolution without the extension — it cannot affect specifiers that already resolve.Verification
tsc --noEmit,eslint ., andnpx expo export --platform android(full Metro → Hermes bundle) all clean.auth.ok(protocol v1 both sides) →session.list(17 sessions) → read-only attach replaying 1015 messages throughstore.ingest(). The test daemon build predatesreplay.resume, so the cursor path correctly fell back to full replay; incremental re-attach still needs a current daemon to observe live.addEventListener, SecureStore, AppState resume behavior.🤖 Generated with Claude Code