mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
The Feishu and Telegram IM adapters used to be standalone Bun processes that the user had to launch manually with bun + .ts source on disk — which meant they were effectively unreachable from the bundled desktop app, since the user wouldn't have bun or the source tree. This adds them as a third mode of the merged claude-sidecar binary: claude-sidecar adapters --app-root <path> [--feishu] [--telegram] The launcher pre-checks credentials via the same `loadConfig()` the adapters use internally, then conditionally `await import()`s each enabled adapter whose creds are present. Adapters with missing creds are warned and skipped, so a partially-configured user (e.g. only Feishu set up, no Telegram bot token) still gets the working adapter started cleanly instead of having Telegram's top-level `process.exit(1)` kill the whole process. Adapter source code is unchanged — the adapters still self-start at top-level via Lark.WSClient.start() / grammy bot.start(). Their SIGINT handlers also still register independently. The only thing gating runtime is whether bun's static-import follows the dynamic specifier into adapters/feishu/index.ts and adapters/telegram/index.ts, which it does. Bundle impact ============= metric P0+P2 only +adapters mode delta claude-sidecar 66 MB 68 MB +2 MB .app total 87 MB 88 MB +1 MB .dmg 37 MB 37 MB 0 MB Both adapter SDKs (@larksuiteoapi/node-sdk and grammy) statically inline into the binary at a +2 MB cost, fully absorbed by DMG compression. Compared to the alternative (a separate ~60 MB sidecar binary per adapter, or even one combined ~60 MB adapter binary) this is essentially free. Verification ============ * `claude-sidecar server` regression test still passes (boots, /api/sessions → 200, CronScheduler runs) * `claude-sidecar cli --version` returns 999.0.0-local * `claude-sidecar adapters` (no flags) → exit 2 with usage error * `claude-sidecar adapters --feishu --telegram` (no creds) → both warned and skipped, exit 1 * `claude-sidecar adapters --feishu` (FEISHU_APP_ID=cli_fake creds) → Feishu adapter boots, Lark client `client ready`, attempts API connect, fails with 400 from feishu API and gracefully retries (correct behavior — fake creds) * `claude-sidecar adapters --telegram` (TELEGRAM_BOT_TOKEN=fake:token) → grammy bot.start() called, getMe API hits with 404, throws GrammyError (correct — fake creds) * `bun test adapters/` → 299 pass / 0 fail * `bun test src/` → 358 pass / 45 fail / 2 errors, identical to baseline Scanner change ============== desktop/scripts/scan-missing-imports.ts now also walks adapters/ in addition to src/, so any future feature() gated stubs in the adapter tree get auto-stubbed. As of this commit, adapters/ has 0 missing imports — all clean. Next step (UI integration, not done here) ========================================== To actually wire this into the desktop UX, the Tauri main process needs: - A "Configure IM adapters" settings page (App ID/Secret, bot token, allowed users) that writes ~/.claude/adapters.json - A "Start/stop Feishu" / "Start/stop Telegram" toggle that spawns `claude-sidecar adapters --feishu` (or both) as a managed sidecar, monitors lifecycle, restarts on crash The runtime infrastructure is now in place — that work is purely UI + Rust spawn glue and can be done independently. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
53 lines
926 B
Plaintext
53 lines
926 B
Plaintext
.env
|
|
.env.*
|
|
!.env.example
|
|
node_modules
|
|
.DS_Store
|
|
|
|
# Computer Use runtime (auto-generated)
|
|
.runtime/
|
|
extracted-natives/
|
|
|
|
# Adapter attachment cache (created at runtime by AttachmentStore when
|
|
# running adapter tests or the feishu/telegram adapters locally)
|
|
.lark-attachments/
|
|
.tg-attachments/
|
|
|
|
# Playwright MCP snapshots & logs
|
|
.playwright-mcp/
|
|
|
|
# OMX state/logs
|
|
.omx/
|
|
|
|
# E2E screenshots
|
|
e2e-*.png
|
|
|
|
# Desktop build output
|
|
desktop/dist/
|
|
desktop/src-tauri/binaries/
|
|
desktop/src-tauri/target/
|
|
desktop/src-tauri/gen/
|
|
desktop/package-lock.json
|
|
|
|
# Desktop brand asset candidates (keep only selected ones in public/)
|
|
desktop/brand-assets/
|
|
|
|
# Claude local config & auto-generated
|
|
.claude/
|
|
|
|
# Superpowers plans & specs (local only)
|
|
docs/superpowers/
|
|
|
|
# Debug / temp screenshots (root dir only)
|
|
/*.png
|
|
|
|
# TS build cache
|
|
*.tsbuildinfo
|
|
|
|
# Temp markdown snapshots
|
|
sidebar-snapshot.md
|
|
|
|
# VitePress
|
|
docs/.vitepress/dist
|
|
docs/.vitepress/cache
|