@kidsinai/kids-client
v0.0.11
Published
Own-client TUI for Kids OpenCode — talks to local `opencode serve` via @opencode-ai/sdk v2 with kid-warm rendering, mission progress, permission dialog, and stderr-tail audit pipeline.
Maintainers
Readme
@kidsinai/kids-client
Status: Phase 2.5 MVP scaffold (2026-05-16). Not yet npm-published; consumed via workspace +
bun linkfor dogfood.
The own-client TUI for Kids OpenCode. Talks to a local opencode serve process over @opencode-ai/sdk/v2. Replaces the upstream Solid.js TUI with a kid-warm Ink (React+Node) experience: branded welcome screen, Mission progress + Stars balance, permission dialogs the kid actually understands, friendly error screens, Kids Helpline overlay for crisis terms.
Why this exists
Per kids-opencode-client-prd.md §2 C route, the terminal-end UX must not look like an engineer tool. Upstream opencode is a great agent runtime but a hostile first impression for a 12-year-old. This package owns the rendering layer.
Architecture (see PRD §2.3):
kids-opencode wrapper → kids-client (this package, Ink)
│
spawns + supervises
↓
opencode serve (upstream kernel + @kidsinai/kids-opencode-plugin)
│
routes LLM via
↓
DeepRouterHow it runs
$ kids-opencode --course portfolio-site --mission mission-1The wrapper:
- Loads
OPENCODE_SERVER_PASSWORDfrom~/.config/kids-opencode/server-password - Translates
--course/--missionto env vars - Exec's
kids-client
The client:
- Probes
http://127.0.0.1:4096/appwith Basic Auth - If down, spawns
opencode serveas its child and pipes stderr - Parses
[kids-audit] {...}lines into the audit pipeline (local jsonl buffer; remote ingest plumbed but disabled) - Subscribes to
client.global.event()SSE - Renders the kid-warm Ink TUI
Architecture inside this package
src/core/— pure TS, no Ink imports. State machine, SDK client, SSE dispatcher, serve subprocess manager, audit pipeline. V1 Tauri reuses this verbatim.src/render/ink/— Ink components and screens. Replaceable with a WebView render layer for V1.
Files
src/index.tsx Composition root; main()
src/core/env.ts Reads KIDS_*/OPENCODE_* env, validates
src/core/serve-manager.ts Spawns + tails opencode serve
src/core/connection.ts createOpencodeClient with Basic Auth
src/core/session.ts session.create / prompt / abort
src/core/events.ts SSE subscribe + dispatch
src/core/store.ts useSyncExternalStore-compatible pub/sub
src/core/audit-pipeline.ts stderr → jsonl buffer (+ future remote POST)
src/dangerous-topic-bridge.ts Crisis-term patterns (mirrors kids-tui-plugin)
src/render/ink/App.tsx Router
src/render/ink/theme.ts Kid-warm color tokens
src/render/ink/screens/StartupScreen.tsx
src/render/ink/screens/MissionScreen.tsx
src/render/ink/screens/PermissionModal.tsx
src/render/ink/screens/DangerousTopicModal.tsx
src/render/ink/screens/ErrorScreen.tsx
src/render/ink/components/Header.tsx
src/render/ink/components/ChatStream.tsx
src/render/ink/components/Input.tsx
src/render/ink/components/Thinking.tsx
src/render/ink/components/KeyHints.tsxDogfood (current path)
From a clone of kidsinai/kids-opencode:
bun install
bun link --cwd packages/kids-client
KIDS_LLM_BYPASS_GATEWAY=1 ANTHROPIC_API_KEY=sk-ant-... \
kids-opencode --course portfolio-site --mission mission-1The startup screen should render within ~3 seconds. The wrapper's --shutdown subcommand kills any lingering serve on :4096.
V0 MVP scope cuts
Items in the PRD that we deliberately deferred to keep Phase 2.5 shippable for Workshop #2:
- Session resume across client crashes (PRD §5.3) — client kills serve on exit; deferred to V1
- Sound pack — deferred to V1 Tauri
- Embedded browser preview — V1 Tauri
- Locale runtime switching — V0 reads
$LANGonce at startup - Multi-mission parallel — single active session only
- Project sharing — handled in
airbotix-appweb side
Tests
bun test31 tests across env validation, store mutation, audit pipeline jsonl write,
dangerous-topic pattern detection, and Ink snapshot of StartupScreen/ErrorScreen
variants. Wired into CI via .github/workflows/ci.yml.
Related
- Plan:
~/.claude/plans/resilient-sleeping-pancake.md - Q3 spike result:
../../docs/v2-api-verification.md§Q3 - Plugin (server-side kid-safety):
../kids-plugin/ - TUI plugin (A-route theme/keymap, sibling):
../kids-tui-plugin/
