Commit graph

8 commits

Author SHA1 Message Date
dj-oyu
8336d3f6dc merge upstream/main: incorporate channel refactor, launcher, and modernizations
Resolve 65 file conflicts merging upstream/main into local branch.

Key decisions:
- Accept upstream's channel interface refactoring (clean Channel interface)
- Accept upstream's Cobra CLI restructuring, Launcher TUI, armv6 support
- Accept upstream's HTTP client caching, resp.Body leak fix, regex precompile
- Accept upstream's WeChat/WeCom resource leak fixes and context handling
- Accept upstream's migrate API restructure (NewMigrateInstance pattern)
- Accept upstream's Go 1.22+ syntax modernizations (for range, max/min)
- Preserve local orchestration, plan mode, heartbeat, sandbox, spawn system
- Preserve local SendWithID/MessageSenderWithID for status message dedup
- Preserve local Stream/RPM/functional options in providers
- Rename AGENT.md → AGENTS.md to match upstream template convention

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 03:07:54 +09:00
dj-oyu
d7a97043dd fix: deduplicate status/task messages by editing instead of creating new bubbles
IsStatus and IsTaskStatus flags on OutboundMessage were set by the agent
loop but completely ignored by the channel Manager. Every status update
created a new message bubble, flooding chats with redundant messages.

Add MessageSenderWithID interface and implement it for Telegram, Discord,
and Pico channels. Manager now routes IsStatus/IsTaskStatus messages to
dedicated handlers that track message IDs and edit in-place. Final
responses also reuse the tracked status message via preSend. TTL janitor
extended to clean up stale tracking entries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 05:38:09 +09:00
dj-oyu
36c3345816 Merge upstream/main: cobra CLI, channel refactoring, media store, reasoning support
Merge upstream changes including:
- Cobra-based CLI command structure migration
- Channel system refactoring (flat files -> subdirectories for telegram, slack)
- Media store abstraction for file handling
- Reasoning channel support for LLM thinking output
- Prompt caching infrastructure (BuildSystemPromptWithCache)
- Bug fixes: goroutine leaks, error propagation, PublishInbound/Outbound context

Resolved 27 merge conflicts, combining HEAD's orchestration system
(AgentReporter, Broadcaster, spawn/subagent, plan mode) with upstream's
architectural changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 21:18:40 +09:00
Petrichor
76e3051cbd chore: resolve conflicts with upstream/main 2026-02-28 12:21:54 +08:00
Hoshina
60f9582ff5 fix: resolve wastedassign lint warnings in channel subpackages
Remove wasted initial assignments before switch statements in
onebot (segType), telegram (filename), and wecom (mediaType).
2026-02-26 23:36:06 +08:00
Hoshina
2bcc179c4a fix(channels): fix memory hazards in channel abstraction layer
Address 7 memory/architecture issues affecting long-running gateway
processes on embedded devices (<10MB RAM):

- Fix dispatcher busy-wait: remove select+default pattern that caused
  CPU spin after context cancellation; SubscribeOutbound handles ctx
  internally
- Add TTL janitor for typingStops/placeholders sync.Map entries to
  prevent unbounded accumulation when outbound paths fail
- Reduce queue buffers from 100 to 16 slots (~84% memory reduction)
- Optimize SplitMessage with index-based rune operations to reduce
  intermediate string/rune allocations
- Replace uuid.New() with atomic counter + random prefix for media
  scope IDs (eliminates per-call crypto/rand syscall)
- Lazy channel worker creation: defer goroutine+buffer allocation
  until channel.Start() succeeds
2026-02-24 22:30:22 +08:00
Hoshina
a1db95b67f feat(channels): add typing/placeholder automation and Pico Protocol channel (Phase 10 + 7)
Phase 10: Define TypingCapable, MessageEditor, PlaceholderRecorder interfaces.
Manager orchestrates outbound typing stop and placeholder editing via preSend.
Migrate Telegram, Discord, Slack, OneBot to register state with Manager instead
of handling locally in Send. Phase 7: Add native WebSocket Pico Protocol channel
as reference implementation of all optional capability interfaces.
2026-02-23 04:55:15 +08:00
Hoshina
575c262159 refactor(channels): add per-channel rate limiting and send retry with error classification
Define sentinel error types (ErrNotRunning, ErrRateLimit, ErrTemporary,
ErrSendFailed) so the Manager can classify Send failures and choose the
right retry strategy: permanent errors bail immediately, rate-limit
errors use a fixed 1s delay, and temporary/unknown errors use exponential
backoff (500ms→1s→2s, capped at 8s, up to 3 retries). A per-channel
token-bucket rate limiter (golang.org/x/time/rate) throttles outbound
sends before they hit the platform API.
2026-02-22 23:51:55 +08:00