Commit graph

242 commits

Author SHA1 Message Date
Naiyuan Qing
3d7b13555f refactor(sdk): unify gateway-sdk into @multica/sdk package
Sync latest code from src/shared/gateway-sdk/ into packages/sdk/,
update all backend imports to use @multica/sdk, and remove the
duplicate src/shared/gateway-sdk/ directory.

- Translate Chinese comments to English in SDK source
- Fix package.json exports with default condition
- Add @multica/sdk as workspace dependency for backend
- Update imports in gateway, test-client, and hub

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 13:43:52 +08:00
Naiyuan Qing
f4500ad148
Merge pull request #52 from multica-ai/naiyuan/refactor-frontend-logic
refactor(frontend): extract shared logic into packages
2026-02-02 12:03:18 +08:00
Naiyuan Qing
3548c91488 docs(web): add development guidelines README
Document thin-shell architecture, package responsibilities, Zustand
best practices, import conventions, and new feature checklist.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 11:52:47 +08:00
Naiyuan Qing
4a7a9800f2 fix(frontend): apply code review fixes across store and UI
- Move setConfig() after imports in layout.tsx
- Add gateway disconnect cleanup in hub-init useEffect
- Replace silent catches with toast error notifications in hub store
- Optimize chat selectors with useMemo and useCallback/getState()
- Remove unused getMessagesByAgent from messages store
- Add clipboard try/catch with error toast
- Add skeleton loading states for hub sidebar and chat header

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 11:52:42 +08:00
Naiyuan Qing
eef26d8675 refactor(frontend): complete migration of all hooks and components to packages
- Create gateway store in @multica/store (WS connection independent of components)
- Gateway auto-connects when hub is ready, messages handled internally
- Move scroll-fade hook to @multica/ui/hooks
- Move Chat component to @multica/ui/components
- Add setConfig() call in web layout for URL injection
- Delete all web-local hooks, components, and lib/config
- Web app is now a pure shell: layout.tsx + page.tsx

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 11:07:57 +08:00
Naiyuan Qing
97fce5b113 refactor(store): migrate messages hook to Zustand store
- Move useMessages from apps/web to packages/store/src/messages.ts
- Convert useState to Zustand store for global message persistence
- Add reserved interfaces: updateMessage, loadMessages, getMessagesByAgent
- Update chat.tsx imports to use @multica/store

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 10:49:52 +08:00
Naiyuan Qing
5275bc55fc refactor(store): migrate device-id hook to @multica/store
- Move useDeviceId from apps/web to packages/store/src/device-id.ts
- Update imports in chat.tsx and use-gateway.ts to use @multica/store
- Add uuid dependency to @multica/store

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 10:45:20 +08:00
Naiyuan Qing
63861d03c6 refactor(frontend): extract shared stores and components into packages
- Create @multica/fetch package for HTTP client and URL config
- Migrate hub store and hub-init hook to @multica/store
- Move HubSidebar component to @multica/ui for web/desktop reuse
- Update web app imports to use shared packages
- Remove counter store example and its component-example usage

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 10:37:17 +08:00
Jiayuan Zhang
46b7906272
Merge pull request #51 from multica-ai/jiayuan/fix-web-search
fix(web-search): use correct model name based on Perplexity API key type
2026-02-02 00:55:31 +08:00
Jiayuan
52a8b5a612 fix(web-search): use correct model name based on Perplexity API key type
- Direct Perplexity API (pplx-*) uses "sonar-pro" model name
- OpenRouter (sk-or-*) uses "perplexity/sonar-pro" model name
- Refactor inferPerplexityBaseUrl to inferPerplexityConfig returning both baseUrl and model
- Export internal functions for potential reuse

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 00:49:41 +08:00
Jiayuan Zhang
806279a72c
Merge pull request #50 from multica-ai/jiayuan/agent-setup
feat(profile): add interactive setup wizard and simplify profile structure
2026-02-02 00:18:48 +08:00
Jiayuan
8228643924 feat(skills): auto-sync bundled skills based on version comparison
When loading skills, automatically check if bundled skills have a higher
version than managed skills. If so, update the managed skill to the
newer bundled version.

This ensures users get skill updates when upgrading multica, without
needing manual intervention.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 00:15:40 +08:00
Jiayuan
34bfc81ce7 refactor(profile-setup): simplify setup to focus on agent identity and user info
Remove work context and workflow preferences collection since this is a
general-purpose agent not tied to specific work types.

Setup now only collects:
- Agent identity (name, style) -> soul.md
- User info (name, timezone, preferences) -> user.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 23:59:59 +08:00
Jiayuan
eeabe0d55c fix(profile-setup): add agent identity questions to setup wizard
- Add soul.md to the list of configurable files
- Include agent identity questions (name, role, style)
- Update file examples to show soul.md updates
- Start conversation by asking about agent's name first

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 23:55:40 +08:00
Jiayuan
a990a1c3ca feat(profile): add interactive setup command for agent profiles
- Add `multica profile setup <id>` command for interactive profile setup
- Create profile-setup skill with conversational setup wizard
- Agent collects user info through natural dialogue and updates profile files
- Supports updating user.md, workspace.md, and config.json

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 23:49:48 +08:00
Jiayuan
e7f84755b3 refactor(profile): simplify profile structure by removing identity and bootstrap
- Remove identity.md and bootstrap.md from profile files
- Merge identity content into soul.md (now contains identity, personality, and behavior)
- Update templates, storage, and types to reflect new structure
- Update tests to match new profile structure

Profile now has 4 files: soul.md, user.md, workspace.md, memory.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 23:49:37 +08:00
Jiayuan Zhang
9f48dca6af
Merge pull request #49 from multica-ai/jiayuan/better-cli-commands
refactor(cli): unify CLI with multica command and subcommands
2026-02-01 23:17:43 +08:00
Jiayuan
bbc488beda docs: update documentation for new CLI structure
- Update README.md with new multica command examples
- Update CLAUDE.md common commands section
- Document all subcommands and their usage

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 23:10:02 +08:00
Jiayuan
c35ffb1f80 chore(cli): update package.json and build script for unified CLI
- Simplify bin entries to multica and mu
- Update npm scripts to use new CLI entry point
- Modify build-cli.js to build single multica.mjs binary

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 23:09:54 +08:00
Jiayuan
52850920ac refactor(cli): unify CLI with multica command and subcommands
- Create unified entry point at src/agent/cli/index.ts
- Add subcommand modules: run, chat, session, profile, skills, tools, credentials, dev
- Support both 'multica' and 'mu' aliases
- Add session management commands (list, show, delete)
- Integrate dev server commands into CLI

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 23:09:44 +08:00
Jiayuan Zhang
144dc94f09
Merge pull request #48 from multica-ai/chore/update-pnpm-version
chore: update pnpm version to 10.28.2
2026-02-01 22:40:53 +08:00
Jiayuan
99b461fc1c chore: update pnpm version to 10.28.2
Co-Authored-By: Warp <agent@warp.dev>
2026-02-01 22:40:08 +08:00
Jiayuan Zhang
2d86d8ac7e
Merge pull request #47 from multica-ai/forrestchang/optimize-agent-templates
refactor(profile): optimize agent templates
2026-02-01 22:17:36 +08:00
Jiayuan
52e9bf9f9b docs(claude): add code style rule for English comments 2026-02-01 22:14:02 +08:00
Jiayuan
f0aa1e1b4d feat(profile): add profile directory path to system prompt
- Update workspace.md template with Profile Files table explaining
  when to update each file
- Inject actual profile directory path in buildSystemPrompt()
- Add getProfileDir() method to ProfileManager
- Agent can now use edit/write tools to update profile files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 22:11:30 +08:00
Jiayuan
9661226979 feat(profile): enhance templates with user.md and workspace.md
- Enrich soul.md with core truths, boundaries, and continuity guidance
  inspired by moltbot's template design
- Add user.md template for building user profile and preferences
- Add workspace.md template for workspace behavior guidelines
- Update memory.md and bootstrap.md with more structured content
- Update all related storage, types, and test files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 22:04:35 +08:00
Jiayuan
e571bd5918 refactor(profile): remove tools.md template
The tools.md template content duplicated information already present in
each tool's schema description, causing maintenance burden and potential
inconsistencies. Tool usage guidelines can be added to soul.md if needed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 21:55:22 +08:00
Jiayuan Zhang
7695a3ec45
Merge pull request #46 from multica-ai/docs/add-agents-md
docs: add AGENTS.md for OpenAI Codex compatibility
2026-02-01 18:56:10 +08:00
Jiayuan
49f78aadc3 docs: add AGENTS.md for OpenAI Codex compatibility
Add AGENTS.md file to provide guidance for AI agents using OpenAI's
convention. The file mirrors CLAUDE.md content to ensure consistent
AI-assisted development experience across different agent platforms.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 18:55:26 +08:00
Jiayuan Zhang
a2fc30080c
Merge pull request #45 from multica-ai/forrestchang/cli-tool-details
test(cli): add output formatting tests and refactoring
2026-02-01 02:55:45 +08:00
Jiayuan
98a447b7a2 test(cli): add comprehensive tests for output formatting functions
Added 36 tests covering toolDisplayName, formatToolArgs, extractResultDetails, and formatResultSummary functions. Also refactored code to eliminate duplicate truncate function and remove unused variable.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-01 02:53:23 +08:00
Jiayuan
5520fec251 feat(cli): add detailed tool info display for glob, web_search, web_fetch
- Add display name mappings for glob, web_search, web_fetch tools
- Show relevant args: glob pattern, search query, URL hostname/path
- Display result summaries: file count, search results count, page title/size
- Add grep result summary showing match count

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 02:40:59 +08:00
Jiayuan Zhang
6dd796102d
Merge pull request #44 from multica-ai/forrestchang/skill-api-auth
Add JSON5 credentials files and init CLI
2026-02-01 02:31:00 +08:00
Jiayuan
c54e768016 docs: update credential setup 2026-02-01 02:28:43 +08:00
Jiayuan
3ee8946e29 feat(credentials): add JSON5 credential system 2026-02-01 02:28:27 +08:00
Jiayuan Zhang
b1d80f29ae
feat(agent): enhance interactive CLI with colors, spinner, and status bar (#43)
* feat(agent): improve interactive CLI with colors, spinner, and status bar

- Add colors.ts module with ANSI terminal color utilities
- Add spinner animation for tool execution feedback
- Add persistent status bar showing session/provider/model
- Apply colors to welcome banner, prompts, commands, and suggestions
- Support NO_COLOR env for accessibility

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(agent): correct cursor position with ANSI-colored prompts

Strip ANSI escape codes when calculating visual length of prompt
to ensure cursor is positioned correctly after colored text.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(agent): prevent duplicate input echo in interactive CLI

Lazy-initialize readline.Interface only when multiline mode is active.
This prevents readline from interfering with autocomplete's raw mode,
which was causing user input to be echoed twice.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(agent): move CLI files to dedicated cli/ directory

Reorganize CLI-related files into src/agent/cli/ for better separation:
- interactive.ts (was interactive-cli.ts)
- non-interactive.ts (was cli.ts)
- profile.ts, skills.ts, tools.ts (was *-cli.ts)
- autocomplete.ts, colors.ts, output.ts (CLI utilities)

Update all imports, package.json scripts, and build configuration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 21:07:07 +08:00
Jiayuan Zhang
b7e1063b3a
Merge pull request #42 from multica-ai/forrestchang/find-skills-location
Simplify skills loading to managed + profile sources
2026-01-31 18:58:32 +08:00
Jiayuan Zhang
ace1a2fe6b
Merge pull request #41 from multica-ai/forrestchang/exec-blocking
fix(agent): improve exec tool with three-layer buffers and real-time updates
2026-01-31 18:54:36 +08:00
Jiayuan
69cad35b4b docs(skill-creator): support profile-specific skill creation
Update skill-creator instructions to:
- Default to profile directory when running under a profile
- Fall back to global directory when no profile is active
- Show both directory structures
- Add profile skill removal instructions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 18:53:27 +08:00
Jiayuan
53bd52b137 feat(agent): add process list action for activity monitoring
Add 'list' action to process tool that displays all registered processes
with their ID, command, status, duration, and source (exec/process).

Example output:
ID                                    COMMAND        STATUS       DURATION  SOURCE
019c139c-dbb7-70ec-ab91-0a7fd2711043  curl -X POST   running         15.2s  [exec]

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 18:49:16 +08:00
Jiayuan
6bb8f2d9e0 docs(skill-creator): update precedence to reflect simplified sources
Update Skill Precedence section to show only two sources:
1. Profile-specific skills (highest priority)
2. Global skills (~/.super-multica/skills/)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 18:44:39 +08:00
Jiayuan
aaf0522303 feat(cli): display real-time tool execution updates
Handle tool_execution_update events in CLI output to show live progress
while commands are running. Shows the last 60 characters of output on
a single line that updates in place.

This completes the real-time streaming feature added to exec tool.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 18:40:40 +08:00
Jiayuan
14bcebee2a feat(agent): add real-time streaming updates to exec tool
Utilize the onUpdate callback from pi-agent-core's AgentTool interface
to stream output updates in real-time while commands are executing.

- Accept onUpdate as 4th parameter in execute function
- Emit tailBuffer updates on each stdout/stderr data event
- Stop emitting updates once command is backgrounded (yielded)

This enables UI to show live command output progress via the
tool_execution_update agent event.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 18:31:50 +08:00
Jiayuan
cbb13b26d1 fix(agent): return collected output when exec auto-backgrounds
Previously, when a command exceeded yieldMs (default 5s) and was
auto-backgrounded, exec returned an empty output string. This caused
agents to misinterpret slow commands (like curl) as failed, leading
to infinite retry loops.

Changes:
- Implement three-layer buffer system (pending 30KB + aggregated 200KB + tail 1KB)
- Return collected output snapshot when backgrounding instead of empty string
- Increase default yieldMs from 5s to 10s for better coverage
- Add auto sweeper for terminated process cleanup (30min TTL)
- Register process immediately on spawn to capture all output

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 18:31:50 +08:00
Jiayuan Zhang
a5f979fceb
Merge pull request #40 from multica-ai/forrestchang/fix-cli-multiline-flash
fix(cli): handle terminal line wrapping in autocomplete input
2026-01-31 18:29:07 +08:00
Jiayuan
34358645de fix(cli): handle terminal line wrapping in autocomplete input
When input exceeds terminal width, the text wraps to new lines but the
old code only cleared one line, causing screen flashing and duplicate
lines. Now tracks input line count and cursor position across wrapped
lines for proper rendering.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 18:25:37 +08:00
Jiayuan
d90edea8d0 fix(skills): call initializeManagedSkills in loadAllSkills
Automatically initialize managed skills directory with bundled skills
on first load. This ensures bundled skills are available without
requiring explicit initialization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 18:20:59 +08:00
Jiayuan
dafe1085b4 refactor(skills): simplify loading to managed + profile sources
- Remove bundled, extraDirs, and plugin skill sources
- Skills now load from only two sources:
  1. managed (~/.super-multica/skills/) - global skills
  2. profile (~/.super-multica/agent-profiles/<id>/skills/) - profile-specific
- Add initializeManagedSkills() to copy bundled skills on first run
- Delete plugin.ts (multica.plugin.json discovery)
- Update documentation and tests

This simplifies the architecture by treating bundled skills as
managed skills that are initialized once, rather than maintaining
multiple loading sources with complex precedence.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 18:16:16 +08:00
Bohan Jiang
96c93cf958
Merge pull request #39 from multica-ai/feat/tools-system
feat(tools): comprehensive tools system with policy filtering and memory tools
2026-01-31 02:26:20 +08:00
Jiang Bohan
22d60f889c docs(tools): simplify roadmap and add Chinese translation
- Replace phased roadmap with simple future tools list
- Add Chinese README (README.zh-CN.md)
- Add language switching links between EN/CN docs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 02:25:42 +08:00