Commit graph

286 commits

Author SHA1 Message Date
Naiyuan Qing
a8143735e9 feat(desktop): initialize electron app with routing and cleanup
Remove template boilerplate (sample SVGs, test IPC message, comments),
add react-router-dom v7 with createHashRouter, scaffold home and chat
pages using @multica/ui components, and add READMEs for desktop, ui,
and store packages documenting import conventions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 14:17:31 +08:00
Jiayuan Zhang
03347d99fd
Merge pull request #62 from multica-ai/forrestchang/agent-error-handling
Fix tool error handling
2026-02-03 02:59:51 +08:00
Jiayuan
0385b0e025 test(agent): convert tool policy test 2026-02-03 02:30:47 +08:00
Naiyuan Qing
7122b12ad5
Merge pull request #61 from multica-ai/feat/text-stream
feat: streaming AI message rendering
2026-02-02 17:45:30 +08:00
Bohan Jiang
a87aee9f3d
Merge pull request #58 from multica-ai/feat/provider-switch
feat(providers): OAuth provider support, /provider and /model commands
2026-02-02 17:38:52 +08:00
Jiang Bohan
c55bb5a864 feat(cli): add /model command for switching models within provider
Add /model command to interactively switch models:
- /model: Show current model and list available models for provider
- /model <name>: Switch to specified model (preserves session)

Example usage:
  /model                    # Shows claude-opus-4-5, claude-sonnet-4-5, etc.
  /model claude-sonnet-4-5  # Switch to sonnet model

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 17:35:40 +08:00
Jiang Bohan
932ecb5dbb refactor(providers): move oauth/ to providers/oauth/ and simplify model names
- Move src/agent/oauth/ to src/agent/providers/oauth/ (parent-child structure)
- Delete deprecated oauth/providers.ts re-export file
- Simplify Claude model names: claude-opus-4-5 (without date suffix)
- Update Codex models to current lineup (gpt-5.2, gpt-5.1-codex, etc.)
- Set claude-opus-4-5 as default model for claude-code provider

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 17:35:35 +08:00
Jiang Bohan
1592e0c211 fix(types): add undefined to optional properties for exactOptionalPropertyTypes
- MemoryStorageOptions.baseDir: add | undefined
- FilterToolsOptions: add | undefined to all optional properties
- CreateToolsOptions: add | undefined to optional properties
2026-02-02 17:20:10 +08:00
Jiang Bohan
6723aa8561 refactor(providers): extract provider management to dedicated module
- Create src/agent/providers/ with registry.ts and resolver.ts
- registry.ts: Provider metadata, status checking, login instructions
- resolver.ts: API key resolution, model resolution
- oauth/providers.ts now re-exports from providers/ (deprecated)
- tools.ts: Remove PROVIDER_ALIAS and DEFAULT_MODELS (moved to providers/)
- Update imports in runner.ts and chat.ts

This separates concerns:
- oauth/ only handles OAuth credential reading
- providers/ manages all provider metadata and resolution
2026-02-02 17:20:02 +08:00
Naiyuan Qing
86d00bb134 feat(ui): render AI messages with streaming markdown
Messages store gains streamingIds set and startStream/appendStream/
endStream actions. Gateway store routes stream action payloads to
these new actions. Chat component switches to StreamingMarkdown
for in-progress messages, providing incremental block-level rendering.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 17:18:35 +08:00
Naiyuan Qing
d04bed8175 feat(agent): add streaming support for AI message generation
AsyncAgent now subscribes to pi-agent-core events (message_start,
message_update, message_end) and forwards incremental text deltas
through a stream callback. Hub registers the callback and sends
stream payloads to the requesting client via Gateway.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 17:18:10 +08:00
Jiang Bohan
5952f22ca2 docs: add LLM providers documentation
- Document OAuth providers (claude-code, openai-codex)
- Document API Key providers
- Add /provider command usage example
- Add OAuth login instructions
2026-02-02 17:10:14 +08:00
Jiang Bohan
35b13f976d feat(runner): validate provider credentials on startup
- Add isOAuthProvider() and isProviderAvailable() helpers
- Show login instructions for OAuth providers without credentials
- Show configuration example for API Key providers without keys
- Fail early with helpful error message instead of cryptic API errors
2026-02-02 17:10:10 +08:00
Jiang Bohan
051e56dbf6 feat(cli): improve /provider command display with ID column
- Add ID column to show actual provider keys for --provider flag
- Add usage examples with actual command syntax
- Improve visual formatting with table headers
2026-02-02 17:10:05 +08:00
Naiyuan Qing
6b0340480b
Merge pull request #60 from multica-ai/fix/sdk-source-exports
fix(sdk): point exports to source, remove .js suffixes
2026-02-02 17:01:44 +08:00
Naiyuan Qing
441c2059a8 fix(sdk): point exports to source and remove .js import suffixes
- Change package exports from dist/ to src/ (consistent with @multica/store and @multica/ui)
- Add private: true since SDK is an internal monorepo package
- Switch tsconfig from NodeNext to bundler moduleResolution
- Remove .js suffixes from all internal imports for Turbopack compatibility

Eliminates the need to build SDK before running dev server or Next.js build.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 16:58:23 +08:00
Jiang Bohan
9b8aebdf76 chore(skills): remove redundant provider skill
The /provider command is now a built-in CLI command in chat.ts,
which directly calls oauth/providers.ts for accurate status.
The skill was redundant and could produce inconsistent results
since it relied on LLM reading files instead of using the API.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 16:54:42 +08:00
Jiang Bohan
da11e65d35 refactor(oauth): rename credentials/ to oauth/ for clarity
Separate OAuth credential reading (external CLI tools) from the main
CredentialManager (API Key configuration in credentials.json5).

- credentials.ts: API Key configuration management
- oauth/: External OAuth credential reading (Claude Code, Codex)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 16:52:04 +08:00
Jiang Bohan
307b381e6c feat(skills): add provider skill for LLM provider management
Provides instructions for viewing and switching LLM providers,
including OAuth (Claude Code, Codex) and API Key based providers.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 16:43:10 +08:00
Jiang Bohan
9504eeab62 feat(cli): add /provider command to show and switch providers
The /provider command shows:
- Current provider and model
- List of available providers (OAuth and API Key)
- Status of each provider (configured/not configured)
- Instructions for switching providers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 16:43:05 +08:00
Jiang Bohan
b9ce4da28f feat(runner): support OAuth providers (claude-code, openai-codex)
- Add provider alias mapping (claude-code -> anthropic)
- Resolve API key from OAuth credentials for claude-code and codex
- Add default models for each provider

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 16:43:00 +08:00
Jiang Bohan
05138029de feat(credentials): add CLI credentials reader for OAuth providers
Add support for reading OAuth credentials from external CLI tools:
- Claude Code: ~/.claude/.credentials.json or macOS Keychain
- Codex: ~/.codex/auth.json or macOS Keychain

Includes provider management with status checking and login instructions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 16:42:55 +08:00
Naiyuan Qing
ebcab2477a
Merge pull request #57 from multica-ai/feature/ws-migration
feat: migrate frontend to pure WebSocket RPC
2026-02-02 16:35:19 +08:00
Naiyuan Qing
a62ac2e075 chore: remove @multica/fetch package
No consumers remain after migrating to pure WebSocket RPC.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 16:29:27 +08:00
Naiyuan Qing
e491949749 refactor(store): remove @multica/fetch dependency
- Move gatewayUrl into gateway store state with setGatewayUrl action
- layout.tsx uses useGatewayStore.getState().setGatewayUrl() directly
- Remove @multica/fetch from store and web package.json dependencies

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 16:23:06 +08:00
Naiyuan Qing
a1c28b3d04 feat(ui): add auto-scroll to bottom for chat messages
- Add useAutoScroll hook using ResizeObserver + MutationObserver
- Observes content children for size changes (streaming, images)
- Watches for new DOM nodes (new messages, history load)
- Respects user scroll position: no force-scroll when reading above
- Integrate in Chat component alongside existing useScrollFade

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 16:14:18 +08:00
Naiyuan Qing
4d6d57187c feat(store): load agent message history via RPC
- Add typed AgentMessageItem to SDK with proper content block types
- Add fetchAgentMessages action to hub store using getAgentMessages RPC
- Extract text from complex content blocks (user string, assistant array)
- Auto-load history when selecting an agent with no local messages

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 16:13:59 +08:00
Naiyuan Qing
3622f82a7b feat(gateway): add auto-connect, hub discovery via list-devices
- Add LIST_DEVICES event and "hub" device type to SDK
- Add listDevices() method to GatewayClient
- Add handleListDevices handler in Gateway
- Change Hub deviceType from "client" to "hub"
- Refactor gateway store: auto-connect WS, separate hubId selection
- Hub-init: auto-connect on mount, discover hubs on registered
- Hub-sidebar: show discovered hubs list with connect/disconnect UI

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 16:13:40 +08:00
Bohan Jiang
10f9aa342c
Merge pull request #56 from multica-ai/feature/skills-progressive-loading
feat(skills): implement progressive loading for reduced token usage (MUL-123)
2026-02-02 16:05:15 +08:00
Jiang Bohan
6f0be4a1cb feat(skills): implement progressive loading for reduced token usage
Changed buildModelSkillsPrompt() to only output skill metadata (name + description)
instead of full instructions. Full instructions are now loaded on-demand when a
skill is triggered via the new buildSkillPromptForInjection() method.

This reduces initial system prompt size significantly for projects with many skills.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-02 16:00:38 +08:00
Naiyuan Qing
150c87a496 refactor(frontend): replace HTTP API with pure WebSocket RPC
- gateway store: add hubId state and request() RPC method
- hub store: replace consoleApi calls with gateway.request() RPC
- hub-init: simplify to react on gwState === "registered"
- hub-sidebar: add hub-id input + connect/disconnect flow
- chat: use gateway hubId for message routing
- layout: remove consoleUrl config (no longer needed)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 15:27:07 +08:00
Naiyuan Qing
1f22c3e578 feat(hub): register RPC handlers for hub, agent, and gateway operations
Add 5 new RPC methods (getHubInfo, listAgents, createAgent, deleteAgent,
updateGateway) mirroring the existing Console HTTP API, enabling pure
WebSocket communication from the frontend.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 15:27:07 +08:00
Jiayuan
32dd62747d fix(agent): soften tool errors 2026-02-02 15:17:17 +08:00
Bohan Jiang
64878d9fe1
Merge pull request #55 from multica-ai/feature/skills-profile-and-autocomplete-fix
feat(skills): add --profile option and fix autocomplete terminal issues
2026-02-02 14:13:06 +08:00
Jiang Bohan
452ba8b5bb fix(autocomplete): improve terminal compatibility and CJK support
- Add terminal support detection to gracefully fallback to simple readline
- Add getStringWidth() for proper CJK character width calculation
- Remove unreliable SAVE_CURSOR/RESTORE_CURSOR ANSI sequences
- Use relative cursor movement for better compatibility
- Handle edge case when cursor is at line boundary

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 14:11:36 +08:00
Jiang Bohan
58eb249e11 docs(skills): add profile-specific installation documentation
Update both English and Chinese README files with:
- CLI examples for --profile option
- Reorganized manual creation as alternative method

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 14:11:36 +08:00
Jiang Bohan
351afb13a7 feat(skills): add --profile option for installing to specific profile
- Add profileId parameter to SkillAddRequest interface
- Add getSkillsDir() helper to determine target directory
- Update CLI to parse --profile/-p option
- Update help text and error messages with new option

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 14:11:36 +08:00
Jiang Bohan
991937897d docs(skills): update CLI commands and add profile skills documentation
- Update skills/README.zh-CN.md: pnpm skills:cli → multica skills
- Add "Adding Profile-Specific Skills" section to both READMEs
- Document manual creation of profile-specific skills

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 14:11:36 +08:00
Jiang Bohan
3797e9e58b docs: update CLI commands to use unified multica format
- Update skills/README.md: pnpm skills:cli → multica skills
- Update tools/README.md: pnpm agent:cli, pnpm tools:cli → multica run, multica tools
- Update tools/README.zh-CN.md: same changes for Chinese docs
- Update test commands: npx tsx → pnpm test

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 14:11:36 +08:00
LinYushen
4d4da4ed43
Merge pull request #54 from multica-ai/fetch-agent-history
feat(hub): add RPC protocol for fetching agent history
2026-02-02 14:10:52 +08:00
yushen
812710c06a docs(hub): add RPC protocol documentation
Document the full RPC flow, message format, error codes, SDK usage,
available methods (getAgentMessages), and guide for adding new methods.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 14:10:17 +08:00
yushen
1e7d5f66ec feat(hub): add RPC dispatcher with structured error handling
Add RpcDispatcher and RpcError for method dispatch with typed error
codes (METHOD_NOT_FOUND, INVALID_PARAMS, AGENT_NOT_FOUND). Implement
getAgentMessages handler that checks session files on disk, supporting
both active and closed agents. Wire up RPC request/response flow in Hub.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 14:10:09 +08:00
yushen
2541745152 feat(sdk): add RPC request method and types to GatewayClient
Add request<T>() method that handles full request/response lifecycle
with auto-generated requestId, timeout handling, and pending request
cleanup on disconnect. Also add GetAgentMessagesParams and
GetAgentMessagesResult type definitions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 14:10:00 +08:00
Naiyuan Qing
d5c4295eb2
Merge pull request #53 from multica-ai/naiyuan/unify-gateway-sdk
refactor(sdk): unify gateway-sdk into @multica/sdk package
2026-02-02 13:45:53 +08:00
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