KeiSeiKit-1.0/_ts_packages
Denis Parfionovich fc0758d2bb
Some checks are pending
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / preflight (push) Waiting to run
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / vps-smoke (push) Waiting to run
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:frustration-matrix,kei-frustration-loop,kei-skill-importer,kei-projects-index,kei-projects-watcher,kei-gdrive-import,kei-leak-matrix,kei-skills,kei-gateway,kei-cron-scheduler,kei-export-trajectories,kei-backend-daytona,kei-d… (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-compute-baremetal,kei-compute-vultr,kei-compute-linode,kei-compute-digitalocean,kei-svc-systemd,kei-llm-bridge-mlx name:hosted-sleep-compute]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-diff,kei-scheduler,kei-watch,kei-prune,kei-discover,kei-brain-view,kei-hibernate,kei-ledger-sign,kei-fork name:wave13-15]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-git-gitea,kei-git-forgejo,kei-git-gitlab,kei-git-bitbucket,kei-memory-sled,kei-memory-redis,kei-memory-postgres,kei-memory-sqlite,kei-auth-google,kei-auth-apple,kei-auth-magiclink,kei-auth-webauthn,kei-notify-slack,kei-n… (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-ledger,kei-migrate,kei-changelog,kei-memory,kei-store,kei-conflict-scan,kei-refactor-engine,kei-graph-check,kei-shared,kei-dna-index,kei-pet name:core]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-machine-probe,kei-llm-ollama,kei-llm-llamacpp,kei-llm-mlx,kei-llm-router,kei-model name:llm-stack]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-router,kei-sage,kei-task,kei-chat-store,kei-crossdomain,kei-search-core,kei-content-store,kei-social-store,kei-curator,kei-auth,kei-artifact name:mcp-lbm]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:keisei,kei-forge,kei-runtime,kei-runtime-core,kei-atom-discovery,kei-agent-runtime,kei-capability,kei-provision,kei-entity-store,kei-pipe,kei-cache,kei-spawn,kei-replay name:atom-substrate]) (push) Blocked by required conditions
chore: версия 0.38.0 единая + warning-fixes + mold для release-job
1. Версии npm-пакетов приведены к 0.38.0 (был зоопарк 0.14.0/0.14.6):
   _ts_packages/{,packages/{gmail,grok,mcp-server,recall,telegram,youtube}-adapter}

2. Rust warnings (cargo check workspace):
   - kei-cortex: deprecated validate_path → validate_path_lexical,
     удалён orphan-wrapper в read.rs, struct Input → pub(crate)
   - frustration-matrix: #[allow(dead_code)] на confusion_* поля
     EvalReport + train_from_dir (будущий CLI)

3. CI release.yml job 'release' падал на Build kei-changelog:
   clang invalid linker '-fuse-ld=mold' — в .cargo/config.toml
   жёстко прописан mold для linux. Добавлен Install mold шаг
   (как уже сделано в build-release matrix).
2026-05-18 13:41:37 +08:00
..
packages chore: версия 0.38.0 единая + warning-fixes + mold для release-job 2026-05-18 13:41:37 +08:00
.gitignore KeiSeiKit-public — clean state 2026-05-01 12:09:03 +08:00
bun.lock fix(ci): regenerate bun.lock — sync с package.json для CI release 2026-05-18 13:01:36 +08:00
package-lock.json diag(release): v0.14.5 — keigit auth diagnostic step before publish 2026-05-04 01:03:39 +08:00
package.json chore: версия 0.38.0 единая + warning-fixes + mold для release-job 2026-05-18 13:41:37 +08:00
README.md Revert "feat(mcp-server): production-ready publish path via GitHub Packages" 2026-05-03 18:04:00 +08:00
tsconfig.base.json feat(npm-publish): keigit as primary registry, npmjs reserved for future 2026-05-17 00:18:44 +08:00

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:

  1. The official Model Context Protocol SDK is TypeScript-native; Rust MCP libraries are immature (as of 2026-04).
  2. 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)
  3. 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
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).