|
Some checks failed
Release / Build aarch64-apple-darwin (push) Has been cancelled
Release / Build x86_64-apple-darwin (push) Has been cancelled
Release / Build aarch64-unknown-linux-gnu (push) Has been cancelled
Release / Build x86_64-unknown-linux-gnu (push) Has been cancelled
Release / Build mcp-server darwin-arm64 (push) Has been cancelled
Release / Build mcp-server linux-arm64 (push) Has been cancelled
Release / Build mcp-server darwin-x64 (push) Has been cancelled
Release / Build mcp-server linux-x64 (push) Has been cancelled
Release / Build mcp-server windows-x64 (push) Has been cancelled
Release / Publish GitHub Release (push) Has been cancelled
Release / Publish npm packages (optional) (push) Has been cancelled
cortex-ui gains a Live2D anime-character renderer alongside existing
32px pixel sprites. User chooses via Setup; switch stored in localStorage
(pet.toml `meta.renderer` field will be wired to daemon in Wave 22).
## Ports from AIRI (MIT, attribution in each file header)
- `src/lib/live2d/emotions.ts` (72 LOC) — 9-value Emotion enum + motion
name + VRM expression maps. Copy-verbatim + CortexMood→Emotion adapter.
- `src/lib/live2d/motion-manager.ts` (194 LOC) — motion state machine
(Vue composable → Svelte 5 factory). Named-group preference, fallback
on throw, replay, reset.
- `src/lib/live2d/expression-controller.ts` (180 LOC) — expression blend
math + transition reset.
- `src/lib/live2d/beat-sync.ts` (63 LOC) — audio-reactive STUB; full
port deferred to Wave 22.
- `src/lib/live2d/types.ts` (62 LOC) — shared interfaces.
## New component
- `src/components/Live2DPet.svelte` (169 LOC) — wraps pixi-live2d-display.
Props `{ modelPath, mood, width, height }`. Fallback message in jsdom
(no WebGL) — tests mount without throwing.
## PetEditor + Setup integration
- `PetEditor.svelte` reads `pet.toml` `meta.renderer` → localStorage
fallback → defaults `sprite32`. Toggle button swaps renderer mid-session.
- `Setup.svelte` adds Renderer radio (sprite32 / live2d), persists to
localStorage.
## Model bundled
Haru (`haru_greeter_t03`), Live2D Cubism official sample, free sample
data license with attribution. 3.4 MB on disk (384 KB moc3 + 2.7 MB
textures + 8 expressions + 5 motions). Served at
`./live2d-models/haru/haru_greeter_t03.model3.json`.
## Deps
- Added `pixi.js ^7.4.0` + `pixi-live2d-display ^0.4.0` to
_ts_packages/packages/cortex-ui/package.json
- AIRI's `pixi-live2d-display.patch` copied to patches/ with README
(manual apply, not needed for default model path)
- **Known risk**: pixi 7 vs library peer-dep 6 mismatch — silent at
install time, untested at runtime. Fallback path: downgrade to pixi ^6
OR swap to `pixi-live2d-display-lipsyncpatch`. Will validate during
live browser test; fix in Wave 22 if breaks.
## Tests
30 pass / 0 fail (was 10):
- live2d-emotions.test.ts (6 new)
- live2d-motion-manager.test.ts (6 new)
- live2d-expression-controller.test.ts (5 new)
- live2d-pet-mount.test.ts (3 new)
- pre-existing api + config tests unchanged (10)
## Bundle size
- Main JS: 56 KB (22 KB gzip) — SPA shell unchanged
- pixi.js: 428 KB (129 KB gzip) — code-split, lazy-loaded on `live2d` pick
- pixi-live2d-display + Cubism4: 308 KB (82 KB gzip) — code-split too
- Haru model assets: 3.4 MB public/, served on-demand
- dist total: 7.5 MB with sourcemaps
## Constructor Pattern
All source files ≤194 LOC (motion-manager largest). All leaf fns ≤18
LOC. Factory-composer pattern avoids Vue's Composition API wrapping
(no mixins, no DI).
## Svelte 5 config touch
- `vite.config.ts` adds `resolve.conditions: ['browser']` +
`server.deps.inline` for vitest — Svelte 5 runes resolve to client
entry under jsdom correctly.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| packages | ||
| .gitignore | ||
| bun.lock | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.base.json | ||
KeiSeiKit TypeScript Packages
v0.14.0 part B: MCP server layer + external-API adapters.
RULE 0.2 exception
TypeScript is chosen here under RULE 0.2 exception #4 (Browser/DOM adjacent) because:
- The official Model Context Protocol SDK is TypeScript-native; Rust MCP libraries are immature (as of 2026-04).
- The API adapters rely on JS-native SDKs with no Rust equivalents:
grammy(type-safe Telegram bot)googleapis(official Google API SDK for Gmail + YouTube)youtube-transcript(Tier-1 free transcript extractor)
- Async, JSON-heavy glue code is TypeScript's sweet spot.
Core primitives (signing, ledger, graph, memory, refactor, etc.) remain
Rust in ../_primitives/_rust/. This TS layer is a THIN wrapper: it
spawns the Rust CLIs as subprocesses and exposes them as MCP tools, plus
the six adapters above that have no Rust equivalent.
Layout
_ts_packages/
├── package.json npm workspace root
├── tsconfig.base.json strict TS 5.x
└── packages/
├── mcp-server/ @keisei/mcp-server
├── telegram-adapter/ @keisei/telegram-adapter
├── recall-adapter/ @keisei/recall-adapter (Zoom via Recall.ai)
├── grok-adapter/ @keisei/grok-adapter (xAI)
├── gmail-adapter/ @keisei/gmail-adapter
└── youtube-adapter/ @keisei/youtube-adapter
Install (for end users)
1. Install workspace deps
cd _ts_packages
npm install
npm run build
2. Link each package as a global CLI (optional)
npm i -g ./packages/mcp-server
npm i -g ./packages/telegram-adapter
# ... etc
Or install into a Claude agent directory:
npm i --prefix ~/.claude/agents/_ts_packages/packages/mcp-server \
./_ts_packages/packages/mcp-server
Environment variables (RULE 0.8 — secrets in ~/.claude/secrets/.env)
| Var | Package | Purpose |
|---|---|---|
TELEGRAM_BOT_TOKEN |
telegram-adapter | Bot API token |
RECALL_API_KEY |
recall-adapter | Recall.ai API key (Zoom meetings) |
XAI_API_KEY |
grok-adapter | xAI Grok API key |
GMAIL_CLIENT_ID |
gmail-adapter | Google OAuth2 client id |
GMAIL_CLIENT_SECRET |
gmail-adapter | Google OAuth2 client secret |
GMAIL_REFRESH_TOKEN |
gmail-adapter | Long-lived OAuth2 refresh token |
YOUTUBE_API_KEY |
youtube-adapter | YouTube Data API v3 key |
KEI_MCP_AUTH_TOKEN |
mcp-server | HMAC token for tool callers |
KEI_RUST_BIN_DIR |
mcp-server | Override directory holding Rust primitive CLIs |
All are read via process.env. Hardcoding tokens is forbidden (RULE 0.8).
MCP server integration
The @keisei/mcp-server exposes the Rust primitive CLIs as MCP tools. The
pattern is one Rust binary = one MCP tool, with the kei meta-tool on
top that routes natural-language queries via kei-router.
Stdio mode (for Claude Code native integration):
npx @keisei/mcp-server --stdio
HTTP mode:
npx @keisei/mcp-server --port 3000 --auth-token-file ~/.claude/mcp-token
Verification
npm install
npm run build --workspaces
npm run test --workspaces
All six packages compile under strict: true. Total new LOC: see commit.
Migration notes
- Zero impact on existing KeiSeiKit users unless they opt into the MCP
server (planned v0.14.1 installer flag
--enable-mcp). - The Rust primitives are unchanged; this layer only wraps them.
- Gmail and YouTube adapters are new (gaps in LBM).