Commit graph

9 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
yushen
e5feb96b0b Merge remote-tracking branch 'origin/main' into agent-api-key-baseurl
# Conflicts:
#	src/shared/index.ts
2026-01-30 14:06:36 +08:00
Jiayuan
f74ac430a9
feat(shared): add error handling infrastructure (#27)
- Add JakartaError base class with error codes and retry semantics
- Add typed error classes for network, session, compaction, process, channel, and gateway errors
- Add withRetry utility with exponential backoff, jitter, and abort support
- Add CancellationToken with hierarchical parent-child cancellation support

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 13:50:49 +08:00
yushen
36e9acb35f refactor(shared): extract DATA_DIR constant to shared/paths.ts
Replace hardcoded ~/.super-multica paths across agent and hub modules
with a single DATA_DIR constant exported from shared.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 13:49:35 +08:00
Jiayuan
3a435aac8a
docs: translate comments from Chinese to English (#15)
Translate all comments, JSDoc strings, and documentation text from Chinese to English across 19 files for improved accessibility and consistency with the broader developer community.

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-30 04:01:14 +08:00
yushen
dcca9333ab Add Hub Console with agent management and message routing
Implement Hub that auto-connects to Gateway, manages agents via REST API,
and routes WebSocket messages to agents by payload.agentId with echo responses
sent back to the original sender.

- Add Hub with GatewayClient auto-connect, agent CRUD, and message routing
- Add Console (NestJS) with REST API and static pages (management + demo client)
- Switch Gateway registration from explicit event to query-based on connect
- Remove deprecated types (RegisterPayload, metadata, SendMessagePayload)
- Add @nestjs/serve-static for serving console UI

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 16:14:29 +08:00
yushen
2ea7938444 Add Docker support for Gateway and SDK documentation
- Add Dockerfile and build script for Gateway containerization
- Add USAGE.md documenting SDK usage for Client/Agent implementations
- Move socket.io-client to production dependencies (required by SDK)
- Remove redundant timestamp field from RoutedMessage (UUID v7 contains timestamp)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 17:56:22 +08:00
yushen
7d94b40a11 Implement WebSocket Gateway with NestJS and client SDK
- Add NestJS WebSocket Gateway with Socket.IO for real-time communication
- Create client SDK (GatewayClient) supporting both browser and Node.js
- Implement device registration and point-to-point message routing
- Add action types: request/response (RPC), stream (for chat messages)
- Integrate Pino logger for structured logging
- Configure heartbeat detection (pingInterval/pingTimeout)
- Use UUID v7 for time-ordered message IDs

Gateway features:
- Device registration with deviceId and deviceType (client/agent)
- Message routing between devices via Gateway
- HTTP API endpoints (/ping, /broadcast)
- Auto-reconnect support in client SDK

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 16:46:51 +08:00
yushen
6b34ddc3dc Initial project setup with multi-component architecture
- Initialize TypeScript project with pnpm
- Create agent, gateway, client, and shared modules
- Configure ESM with strict TypeScript settings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 14:08:34 +08:00