Commit graph

683 commits

Author SHA1 Message Date
Jiayuan Zhang
04d227c9fe feat(desktop): persist onboarding state with --force-onboarding flag
Use Zustand persist middleware with localStorage to remember onboarding
completion across app restarts. Only the completed flag is persisted;
transient UI state resets each launch. Add --force-onboarding CLI flag
to re-show onboarding even when already completed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 23:15:10 +08:00
Jiayuan Zhang
ab65f4cadf refactor(desktop): replace OpenRouter model dropdown with text input
Remove Combobox component and use a plain text input for model name,
allowing users to enter any model identifier manually.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 23:15:03 +08:00
Jiayuan Zhang
a143187da1 feat(desktop): add provider connection test to API key dialog
Save & Test flow: saves API key, then sends a minimal prompt to verify
the provider is reachable. Shows phase-based status (saving/testing/
success/error) with auto-close on success.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 23:02:45 +08:00
Jiayuan Zhang
d7ccbf066e feat(core): add testProvider method to AsyncAgent
Queued through the serialization queue to safely switch provider,
send a minimal test prompt, and restore the previous provider.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 23:02:39 +08:00
Jiayuan Zhang
9290fd1212 feat(desktop): add searchable model dropdown for OpenRouter
Replace plain text input with Combobox for model selection. Users can
search and select from the provider's model list via dropdown.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 22:52:00 +08:00
Jiayuan Zhang
9240e31fcb fix(desktop): improve Try It right panel visual separation
Replace bg-muted/30 with border-l for a clean separator between the
prompt list and ChatView panels.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 22:47:16 +08:00
Jiayuan Zhang
0c4f8796d7 fix(desktop): require active provider before Continue in setup step
Changed check from availableProviders.length > 0 to current?.available,
so Continue is only enabled when a provider is both configured and
selected as the active default.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 22:44:36 +08:00
Jiayuan Zhang
3e04422df6 feat(desktop): use interactive sample prompts in Try It step
Replace simple prompts with ones that demonstrate real agent
capabilities: web search, project analysis, and shell execution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 22:41:07 +08:00
Jiayuan Zhang
60e71ce4c8 fix(desktop): require successful Telegram connection before Continue
Continue button is now disabled until the bot status is 'running'.
Skip remains available when no token has been entered.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 22:41:02 +08:00
Jiayuan Zhang
bc24b58026 feat(desktop): wire Try It step to real agent chat
Replace fake sample prompts with real agent interaction. Clicking a
prompt sends it via localChat and shows the live ChatView on the right
panel with streaming responses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 22:34:59 +08:00
Jiayuan Zhang
7691f81376 feat(desktop): add model name input for OpenRouter configuration
OpenRouter requires both API key and model name. Adds optional model
input field to ApiKeyDialog, enabled via showModelInput prop.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 22:25:46 +08:00
Jiayuan Zhang
e0812017f1 fix(desktop): only show active provider when actually available
Prevents pre-selecting an unconfigured provider and enabling Continue
when no provider is configured. Also passes modelId through on success.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 22:25:41 +08:00
Jiayuan Zhang
4de9947a02 feat(desktop): add 4-step onboarding flow
Add complete onboarding wizard: Permissions > Provider > Connect > Try it

Step 1 (Permissions): Privacy & Trust acknowledgements with toggles for
file system, shell execution, LLM requests, and local storage access.

Step 2 (Provider): LLM provider setup with 4 supported providers
(Kimi Code, Claude Code OAuth, Codex OAuth, OpenRouter), default
provider selection via radio indicator, and contextual setup tutorials
in the right panel that change on hover.

Step 3 (Connect): Optional Telegram bot connection with token input and
BotFather tutorial. Reuses existing useChannels() hook.

Step 4 (Try it): Sample prompts and completion.

Includes OnboardingGuard, Zustand store (no persist - resets on launch),
breadcrumb stepper with progress bar, and left-right split layout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 22:17:20 +08:00
Jiayuan Zhang
16fe40bfc2 feat(desktop): hide native title bar with macOS hiddenInset style
Add titleBarStyle hiddenInset and trafficLightPosition to BrowserWindow.
Add drag region to main layout header with no-drag on interactive elements.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 22:17:07 +08:00
Jiayuan Zhang
1b252c1cf9 chore(ui): switch primary color to shadcn default
Change primary from custom purple oklch(0.51 0.23 277) to shadcn
default neutral near-black/near-white. Also reset chart and sidebar
primary colors to shadcn defaults.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 22:16:57 +08:00
Naiyuan Qing
22d0aca210
Merge pull request #122 from multica-ai/fix/ui-hmr-watch
fix(desktop): restructure to standard electron-vite layout for HMR
2026-02-10 22:08:09 +08:00
Naiyuan Qing
2269677ded fix(desktop): restructure to standard electron-vite layout for HMR
- Move renderer files to src/renderer/src/ (electron-vite standard)
- Move index.html to src/renderer/
- Remove root: '.' config that broke HMR
- Use ELECTRON_RENDERER_URL instead of VITE_DEV_SERVER_URL
- Update tsconfig paths for new structure

This fixes hot module replacement not working after the monorepo
restructure. The previous non-standard directory layout with root: '.'
caused electron-vite's HMR to fail silently.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 22:03:18 +08:00
Bohan Jiang
98b8126c89
Merge pull request #120 from multica-ai/feat/subagent-concurrency-queue
feat(subagent): add concurrency queue and default timeout
2026-02-10 20:04:16 +08:00
Bohan Jiang
2cb5d4f51b
Merge pull request #121 from multica-ai/Bohan-J/sync-main-updates
fix(agent): sanitize invalid tool call ids before LLM calls
2026-02-10 19:57:12 +08:00
Jiang Bohan
d78f8480bf chore(agent): remove debug invalid tool-call injection 2026-02-10 19:53:33 +08:00
Jiang Bohan
db25f8f44a chore(agent): add debug hook to inject invalid tool call id 2026-02-10 19:43:49 +08:00
Jiang Bohan
e2d4803f8b fix(agent): sanitize invalid tool call ids in context 2026-02-10 19:33:44 +08:00
Jiang Bohan
683dfa759b feat(subagent): integrate command queue and configurable timeout
Wire registry and sessions_spawn through the lane-based queue so
sub-agents respect max concurrency. Add resolveSubagentTimeoutMs()
with defaults (10 min), 0 = no timeout, and safe clamping.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 19:27:26 +08:00
Jiang Bohan
240fdd1286 feat(subagent): add lane-based command queue with concurrency control
Introduces a command queue system adapted from OpenClaw to prevent
unbounded sub-agent spawning. Default max concurrency: 10.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 19:27:19 +08:00
Naiyuan Qing
9d719c66af
Merge pull request #119 from multica-ai/refactor/monorepo-restructure
refactor: restructure to monorepo architecture
2026-02-10 18:35:57 +08:00
Naiyuan Qing
29590492c7 docs: add pre-push checks requirement 2026-02-10 18:24:49 +08:00
Naiyuan Qing
8b660e536c fix(cli): use @multica/core imports instead of relative paths 2026-02-10 18:23:32 +08:00
Naiyuan Qing
24c3af1185 fix(ui): handle possibly undefined values in strict mode 2026-02-10 18:19:41 +08:00
Naiyuan Qing
428c6b5e03 fix: typecheck depends on build for type declarations 2026-02-10 18:16:19 +08:00
Naiyuan Qing
4b14ccb38d chore: sync pnpm-lock.yaml with package.json 2026-02-10 18:13:01 +08:00
Naiyuan Qing
7eb36a48d3 fix(cli): filter pnpm standalone -- arg and simplify dev scripts
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 18:09:12 +08:00
Naiyuan Qing
6ef58a0cab refactor: restructure to monorepo architecture
- Move core agent engine to packages/core/
- Add packages/types/ for shared TypeScript types
- Add packages/utils/ for utility functions
- Add apps/cli/ for command-line interface
- Add apps/gateway/ for NestJS WebSocket gateway
- Add apps/server/ for REST API server
- Restructure desktop app (electron/ → src/main/, src/preload/)
- Update pnpm workspace configuration
- Remove legacy src/ directory

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-10 18:00:23 +08:00
yushen
5ba8c87744 fix(gateway): use esbuild to bundle workspace packages in Docker
Replace tsc with esbuild for building @multica/sdk and @multica/store
in the Docker builder stage. esbuild resolves extensionless imports
that Node.js ESM cannot handle at runtime, producing self-contained
bundles for each workspace package.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 17:34:40 +08:00
yushen
01f64ff1ec fix(gateway): include workspace packages in Docker build
Copy @multica/sdk and @multica/store workspace packages into both builder
and production stages. Build them with tsc in the builder stage, then
patch their package.json exports to point from ./src/*.ts to ./dist/*.js
for Node.js runtime compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 17:31:51 +08:00
yushen
31f38bb0ec fix(gateway): update Dockerfile pnpm version and add pnpm-workspace.yaml
Update pnpm from 10.16.1 to 10.28.2 to match project packageManager,
and copy pnpm-workspace.yaml into both build stages so pnpm can resolve
the catalog configuration recorded in the lockfile.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 17:23:26 +08:00
LinYushen
cdff06d488
Merge pull request #118 from multica-ai/fix/gateway-pino-deadlock
chore(telegram): add webhook setup script
2026-02-10 17:09:12 +08:00
yushen
e9d934a384 chore(telegram): add webhook setup script
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 17:07:45 +08:00
LinYushen
187199d389
Merge pull request #117 from multica-ai/fix/gateway-pino-deadlock
feat(gateway): Telegram channel integration with connection link verification
2026-02-10 17:00:18 +08:00
yushen
d367e77c0a feat(device): add clientName to DeviceMeta for multi-client display
Add clientName field to DeviceMeta so non-browser clients (Telegram,
Discord, etc.) can provide a human-readable label instead of relying on
userAgent parsing. Desktop UI now prioritizes clientName over parsed UA
string, fixing "Unknown on Unknown" display for Telegram connections.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 16:43:44 +08:00
yushen
a94b6e8b1c fix(telegram): use DeviceMeta interface for verify RPC meta parameter
Pack Telegram user info (userId, username, firstName) into the
userAgent field instead of passing custom fields that don't conform
to the SDK's DeviceMeta interface.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 16:19:08 +08:00
yushen
c9836d60d4 chore: move SQL schema to src/gateway/migrations/
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 16:11:47 +08:00
yushen
bc78dcdca9 chore: move SQL schema to migrations/ directory
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 16:10:29 +08:00
yushen
1547da3279 refactor(telegram): remove auto table creation, add SQL script for ops
Move table DDL to scripts/telegram-users.sql for manual execution by
ops. Remove OnModuleInit and ensureTable() from TelegramUserStore.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 16:08:52 +08:00
yushen
6284ffd74a fix(telegram): drop and recreate telegram_users table for schema change
The old table had hub_url column; new schema uses hub_id + agent_id.
CREATE TABLE IF NOT EXISTS won't alter existing tables, so drop first.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 16:06:58 +08:00
yushen
483f4a2f59 fix(gateway): graceful degradation when MySQL is unavailable
Instead of throwing and crashing the gateway when MySQL connection
fails, close the broken pool and continue with pool=null so the
isAvailable() guard handles it gracefully.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 16:04:47 +08:00
yushen
dc60cb754d feat(telegram): replace Hub URL binding with connection link verification
Replace the two-step Hub URL binding flow with a multica://connect
connection link flow that uses the same verify RPC handshake as the
SDK/web clients.

Changes:
- types.ts: replace hubUrl with hubId + agentId fields
- telegram-user.store.ts: update DB schema (hub_id, agent_id columns),
  accept explicit deviceId in upsert
- telegram.service.ts: rewrite with parseConnectionCode validation,
  verify RPC via routeFromVirtualDevice, pending request map for
  RPC promise tracking, smart sendCallback for stream/message/RPC
- package.json: add @multica/store workspace dependency

Flow: user pastes multica://connect link -> parse & validate ->
check Hub online -> register virtual device -> verify RPC to Hub ->
Desktop approval -> save to DB -> route messages

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 16:04:35 +08:00
yushen
604d74d984 fix(gateway): route messages to virtual devices in handleSend()
handleSend() only checked socket-based devices (deviceToSocket map),
causing DEVICE_NOT_FOUND errors when Hub sends responses to virtual
devices like Telegram. Now checks virtualDevices map as fallback.

Also adds routeFromVirtualDevice() to allow virtual devices to
initiate messages (e.g., verify RPC, chat messages) through the
Gateway routing infrastructure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 16:04:10 +08:00
Naiyuan Qing
bfa96d87af
Merge pull request #116 from multica-ai/fix/remove-accidental-config
fix: remove accidentally committed ~/.super-multica config
2026-02-10 09:50:50 +08:00
Naiyuan Qing
cedb8f9138 revert: undo unintended .gitignore change
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 09:39:01 +08:00
Naiyuan Qing
6becd791ae fix: remove accidentally committed ~/.super-multica config
The empty ~/.super-multica/channels.json5 file was accidentally added
during a merge conflict resolution. Remove it and add ~/.super-multica/
to .gitignore to prevent future accidents.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 09:35:50 +08:00