Commit graph

171 commits

Author SHA1 Message Date
Naiyuan Qing
c0db46e200 fix(desktop): add required metadata for Linux deb build
Add description, author, and homepage fields to package.json
required by electron-builder when building .deb packages on Linux CI.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-11 09:55:12 +08:00
Naiyuan Qing
2c9d1939c0 fix(desktop): update branding and fix code signing for development
- Change productName from "YourAppName" to "Multica"
- Change appId from "YourAppID" to "com.multica.app"
- Add app icons (icns, ico, png) for all platforms
- Disable hardenedRuntime to fix ad-hoc signing on ARM Macs
- Add build:desktop script to root package.json
- Simplify desktop .gitignore with !build/ exception
- Remove unused asarUnpack and entitlements config

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-11 09:49:18 +08:00
Jiayuan Zhang
ff7395960d fix(desktop): remove unused availableProviders destructuring
Fixes eslint no-unused-vars warning that fails CI with --max-warnings 0.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 00:16:02 +08:00
Jiayuan Zhang
7af64a12e2 fix(desktop): clear forceOnboarding flag on onboarding completion
completeOnboarding() only set completed=true but never cleared the
forceOnboarding flag, causing OnboardingGuard to redirect back to
onboarding in an infinite loop when --force-onboarding was used.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 00:12:15 +08:00
Jiayuan Zhang
0135951ac6 feat(desktop): allow reconfiguration of already-configured providers
Previously, configured providers only showed a checkmark with no way to
reconfigure them. Now shows a "Reconfigure" button alongside the checkmark.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 23:40:36 +08:00
Jiayuan Zhang
5c5bf46a95 fix(desktop): fix Try It step UI overflow and missing chat input
Add min-w-0 to SamplePrompt text container so truncate works in
flex layout. Always show ChatView when agent is ready so the message
input is visible (ChatView has its own empty state).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 23:29:23 +08:00
Jiayuan Zhang
e9c91ccc66 fix(desktop): allow selecting configured providers in setup step
Remove strict model validation from provider:set IPC handler that
rejected custom models not in the static registry list (broke OpenRouter
with user-typed models). Add error display to setup page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 23:23:22 +08:00
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
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
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
Naiyuan Qing
8b660e536c fix(cli): use @multica/core imports instead of relative paths 2026-02-10 18:23:32 +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
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
Jiang Bohan
a61e29469e fix(desktop): add overflow-y scroll to provider dropdown
The provider & model dropdown now scrolls internally instead of
causing the whole page to scroll when content exceeds viewport.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 19:20:16 +08:00
Jiang Bohan
2349868e8e feat(desktop): add model switching to provider dropdown
Add model selector section below the provider grid in the dropdown.
Shows available models for the current provider with active model
indicator. Clicking a model calls setProvider with the modelId.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 16:56:25 +08:00
Jiang Bohan
ff0694175e Merge branch 'main' of https://github.com/multica-ai/super-multica 2026-02-09 16:25:30 +08:00
Jiang Bohan
a8e7a803c9 fix(agent): separate display content from agent user turns 2026-02-09 15:54:10 +08:00
Jiang Bohan
5c7d913128 fix(desktop): externalize grammy in Vite Electron build
grammy was not in rollupOptions.external, causing the channels IPC
handlers to fail at runtime with 'No handler registered'.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 15:08:11 +08:00
Jiang Bohan
d6993000ca Merge branch 'main' of https://github.com/multica-ai/super-multica
# Conflicts:
#	apps/desktop/electron/electron-env.d.ts
2026-02-09 14:34:48 +08:00
Naiyuan Qing
0895d42d3b Merge remote-tracking branch 'origin/main' into feat/telegram-channel
# Conflicts:
#	apps/desktop/src/hooks/use-local-chat.ts
#	packages/sdk/src/actions/stream.ts
#	packages/ui/src/components/chat-view.tsx
#	src/agent/async-agent.ts
#	src/agent/events.ts
2026-02-09 14:28:06 +08:00
Jiang Bohan
22e225c6a8 refactor(profile): remove Communication Style UI and programmatic API
Style is now solely managed by the agent editing soul.md directly,
removing the need for UI controls, IPC handlers, and typed constants.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 14:25:38 +08:00
Bohan Jiang
b7085b2bf5
Merge pull request #107 from multica-ai/fix/new-user-onboarding
fix(desktop): new user onboarding — show errors and configure dialog in Chat
2026-02-09 13:54:48 +08:00
Jiang Bohan
ed681a96bf feat(desktop): add Configure button in chat error banner
When the agent fails due to missing API key, the error banner now
shows a "Configure" button that opens the same ApiKeyDialog (or
OAuthDialog) used on the home page. After successful configuration
the error clears and the user can immediately start chatting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 13:51:55 +08:00
Naiyuan Qing
23905daaa1 Merge remote-tracking branch 'origin/main' into feat/telegram-channel
# Conflicts:
#	apps/desktop/electron/electron-env.d.ts
#	apps/desktop/electron/ipc/index.ts
#	apps/desktop/electron/preload.ts
#	apps/desktop/src/App.tsx
#	apps/desktop/src/pages/layout.tsx
#	src/agent/async-agent.ts
#	src/agent/runner.ts
#	src/hub/hub.ts
2026-02-09 13:44:08 +08:00
Naiyuan Qing
43d11a6e5d fix(channels): address code review issues
- Fix double useChannels() instantiation: call once in ChannelsPage,
  pass as props to TelegramCard
- Mask bot tokens in channels:getConfig before sending to renderer
- Add input validation (isValidId, token length) on all IPC handlers
- Fix stopAccount() to clean up typingTimer, lastRoute, aggregator,
  and debouncer when stopping the account they belong to
- Add try/catch to stopChannel/startChannel in useChannels hook
- Consistent return type { ok, error? } on channels:stop handler
- Add tooltip hint on disabled Remove button

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 13:05:34 +08:00
Naiyuan Qing
c99675b6e4 feat(desktop): add Channels configuration page with Telegram support
Add IPC handlers, preload API, useChannels hook, and Channels page UI.
Users can save/remove Telegram bot tokens and start/stop bots directly
from the desktop app with immediate effect and persistence across restarts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 12:50:24 +08:00
Naiyuan Qing
54e2ac4a17 fix(desktop): open external links in system browser
Use setWindowOpenHandler to intercept window.open calls and route
them through shell.openExternal instead of navigating inside Electron.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 08:04:25 +08:00
Jiang Bohan
0e383f51ab feat(desktop): display agent errors in Chat UI instead of hanging
When the agent encounters an error (e.g. no API key configured),
the Chat UI now shows an error banner instead of silently hanging.
The user can still type and retry after fixing their configuration.

- Add AgentErrorEvent to SDK stream types
- Forward agent_error events through IPC to renderer
- Handle error events in useLocalChat hook
- Keep chat input enabled for AGENT_ERROR (retriable)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 22:23:53 +08:00
yushen
a7db286530 Merge remote-tracking branch 'origin/main' into sessions-spawn-parent-trigger 2026-02-06 19:44:17 +08:00
Naiyuan Qing
e99600c356 fix(desktop): register ChatPage element in router
The /chat route was missing its element prop, causing React Router
to render an empty Outlet.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 19:35:46 +08:00
Naiyuan Qing
72598322d1 feat(desktop): handle agent_error events and clearLastRoute in IPC
Forward agent_error as passthrough event to renderer. Add
clearLastRoute() calls in hub:sendMessage and localChat:send
handlers so channel replies stop when desktop sends a message.
Handle agent_error in use-local-chat to show error UI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 19:35:39 +08:00
yushen
d392238be3 feat(subagent): tag internal orchestration messages and filter from user-facing history
Announcement messages from subagent completion flows were persisted as
regular user messages, polluting conversation history and leaking
orchestration instructions to frontend/CLI.

- Add `internal?: boolean` to SessionEntry message variant
- SessionManager.saveMessage accepts { internal: true } option
- SessionManager.loadMessages filters internal by default
- Agent.runInternal() tags messages as internal, rolls back from memory
- Agent.withRunMutex() prevents concurrent run/runInternal mis-tagging
- AsyncAgent.writeInternal() suppresses event forwarding during internal runs
- Announce flows use writeInternal() instead of write()
- Desktop IPC getHistory reads from session storage (filtered)
- CLI session show parses SessionEntry, supports --show-internal flag

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 18:34:11 +08:00
Jiang Bohan
02838bba78 fix(desktop): remove heartbeat section from home page 2026-02-06 17:36:46 +08:00
Jiang Bohan
9663079f48 feat(desktop): expose heartbeat controls and status card 2026-02-06 16:42:21 +08:00
Jiang Bohan
4983debf0c fix(desktop): add cron API type to ElectronAPI interface
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 15:43:55 +08:00
Jiang Bohan
a8dd9f2bbb feat(desktop): add Cron Jobs management page
- Add "Cron" tab to navigation bar with Time04Icon
- Add /crons route with CronsPage component
- Add cron IPC handlers (list, toggle, remove) in electron/ipc/cron.ts
- Expose cron API in preload.ts for renderer process
- Add useCronJobs hook for fetching and managing jobs
- Add CronJobList component with status badges, toggle switches,
  delete buttons, relative time display, and empty state

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 15:16:33 +08:00
Jiang Bohan
ea7a2c837b feat(desktop): add cron tool to Tools page UI
- Add 'group:cron' to TOOL_GROUPS in IPC handler and agent tools
- Add cron tool description and group name to use-tools hook
- Add Time04Icon for cron group in tool-list component
- Add subagent group icon (UserMultipleIcon) for completeness

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 14:47:54 +08:00
yushen
ec6dbff61c Merge remote-tracking branch 'origin/main' into copilothub-web-search 2026-02-06 11:43:40 +08:00