Commit Graph

72 Commits

Author SHA1 Message Date
daming大铭 d20cb364a2 Merge pull request #677 from yinwm/refactor/model-to-model-name
refactor(config): rename model field to model_name
2026-02-24 19:05:40 +08:00
Kai Xia 6fb61539d7 translate Chinese comments
Signed-off-by: Kai Xia <kaix+github@fastmail.com>
2026-02-24 10:27:49 +11:00
yinwm 712f5a8300 refactor(config): rename model field to model_name
The configuration field for specifying the model has been renamed from
"model" to "model_name" for better clarity and consistency with the
model_list configuration.

A GetModelName() accessor method has been added to maintain backward
compatibility. Existing configurations using the old "model" field will
continue to work correctly.

This change affects:
- Configuration structure (AgentDefaults struct)
- All references across the codebase
- Documentation in all language variants
- Example configuration files
2026-02-23 16:55:06 +08:00
Artem Yadelskyi 02b4d9fbe2 feat(linter): Fix govet linter 2026-02-20 22:35:16 +02:00
Artem Yadelskyi 0675ce7c38 feat(fmt): Fix formatting 2026-02-20 20:03:11 +02:00
Artem Yadelskyi ad8c2d48c8 Merge branch 'main' into fix-formatting
# Conflicts:
#	cmd/picoclaw/main.go
#	pkg/agent/context.go
#	pkg/agent/loop.go
#	pkg/channels/dingtalk.go
#	pkg/channels/feishu_64.go
#	pkg/channels/line.go
#	pkg/channels/manager.go
#	pkg/config/config.go
#	pkg/migrate/migrate_test.go
#	pkg/providers/anthropic/provider_test.go
#	pkg/providers/claude_provider_test.go
#	pkg/providers/http_provider.go
#	pkg/providers/openai_compat/provider.go
#	pkg/providers/protocoltypes/types.go
#	pkg/providers/types.go
2026-02-20 20:02:53 +02:00
daming大铭 1ef33c90ed Merge pull request #474 from swordkee/main
add wecom and wecomApp
2026-02-20 21:17:59 +08:00
swordkee 0f70f783bd feat: add wecom and wecomApp test 2026-02-20 20:01:22 +08:00
swordkee ca481035a4 feat: add wecom and wecomApp test 2026-02-20 19:39:12 +08:00
Vernon Stinebaker 2fb2a733d4 feat(discord): add mention_only option for @-mention responses (#518)
* feat(discord): add mention_only option for @-mention responses

Add MentionOnly config option to Discord channel. When enabled, the bot
only responds when explicitly @-mentioned, useful for shared servers.

- Add MentionOnly bool field to DiscordConfig
- Store botUserID on startup for mention checking
- Check m.Mentions before processing messages when MentionOnly is true
- Update config example and README documentation

* fix(discord): resolve race condition and strip mention from content

- Get botUserID before opening session to avoid race condition
- Add stripBotMention to remove @mention from message content
- Handles both <@USER_ID> and <@!USER_ID> mention formats

* fix(discord): skip mention_only check for DMs

DMs should always be responded to regardless of mention_only setting.
Added check to skip the mention_only logic when GuildID is empty.

* Update README.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Hua Audio <161028864+Huaaudio@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-20 12:18:37 +01:00
swordkee 14ccfb39d9 feat: add wecom and wecomApp test 2026-02-20 18:28:10 +08:00
swordkee 59772cdbf2 feat: add wecom and wecomApp channel support 2026-02-20 17:40:59 +08:00
yinwm 723f4e84ef Merge upstream main into feat/refactor-provider-by-protocol
Resolved conflicts:
- pkg/config/config.go: Removed duplicate DefaultConfig() (already in defaults.go)

Upstream changes:
- Added Session.DMScope default value ("main")
- Various channel improvements

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:29:30 +08:00
hsohinna 4adafa8890 fix(channels): channels session key routing (#489)
* fix(onebot): add metadata for direct and group message handling
* fix(qq): add metadata for direct and group message handling
* fix(dingtalk): add metadata for direct and group message handling
* fix(feishu): add metadata for direct and group message handling
* fix(whatsapp): add metadata for direct and group message handlinga
* fix(line): add metadata for direct and group message handling
* fix(maixcam): add metadata for person detection handling
* fix(config): add default session configuration with DMScope
2026-02-20 13:27:08 +08:00
Artem Yadelskyi a896831903 feat(fmt): Fix formatting 2026-02-19 22:05:15 +02:00
Artem Yadelskyi 2038f04d0d Merge branch 'main' into fix-formatting
# Conflicts:
#	pkg/agent/loop.go
#	pkg/agent/loop_test.go
#	pkg/channels/discord.go
#	pkg/channels/onebot.go
#	pkg/config/config.go
#	pkg/tools/subagent_tool_test.go
2026-02-19 22:04:48 +02:00
yinwm f8f1d539d4 Merge remote-tracking branch 'origin/main' into feat/refactor-provider-by-protocol 2026-02-20 00:11:46 +08:00
Jex 213274002a fix: keep Discord typing indicator alive during agent processing (#391)
* fix: keep Discord typing indicator alive during agent processing

Discord's ChannelTyping() expires after ~10s, but agent processing
(LLM + tool execution) typically takes 30-60s+. Replace single-fire
ChannelTyping() with a self-managed typing loop inside DiscordChannel.

- startTyping(chatID): goroutine refreshes ChannelTyping every 8s
- stopTyping(chatID): called in Send() when response is dispatched
- Stop() cleans up all typing goroutines on shutdown
- startTyping placed after all early returns to prevent goroutine leaks

Typing lifecycle fully contained in channel layer, no interface changes.

Fixes #390

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

* fix: add goroutine safety to Discord typing indicator

- Add 5-minute timeout as safety net to prevent indefinite goroutine leaks
  when agent produces no outbound message (empty response, panic, etc.)
- Listen on c.ctx.Done() so goroutine exits when channel context is cancelled
- Log ChannelTyping() errors at debug level for diagnostics (rate limits, session closed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:28:58 +01:00
hsohinna 56a060ff61 feat(onebot): enhance OneBot channel (#192)
* fix: change BotStatus type to json.RawMessage and add isAPIResponse function

* feat(onebot): add rich media, API callback, keepalive and voice transcription

   Comprehensive improvements to the OneBot channel for better NapCatQQ
   compatibility:

   - Add echo-based API callback mechanism (sendAPIRequest) for
     request/response correlation via pending map
   - Add WebSocket ping/pong keepalive (30s ping, 60s read deadline)
   - Fetch bot self ID via get_login_info on connect/reconnect
   - Refactor parseMessageContentEx into parseMessageSegments supporting
     image, record, video, file, reply, face, forward segments
   - Add voice transcription via Groq transcriber (SetTranscriber)
   - Switch to message segment array format for sending with auto reply
     quote via lastMessageID tracking
   - Add message_sent event handling and detailed notice event processing
     (recall, poke, group increase/decrease, friend add, etc.)
   - Use sync/atomic for echoCounter, optimize listen() lock pattern
   - Clean up pending callbacks on Stop(), defer temp file cleanup
   - Mount Groq transcriber on OneBot channel in main.go gateway

* feat(onebot): add user ID allowlist check for incoming messages

- Currently, the agent does not respond to messages sent by users outside the allowlist.

* refactor(onebot): simplify channel implementation and add emoji reaction

- onebot.go from 1179 to 980 lines (~17%)
2026-02-19 14:39:35 +08:00
Huaaudio e35a827624 update documents 2026-02-18 21:44:25 +01:00
Hua e03124dc8a refactor: improve SplitMessage API clarity
- Accept hard upper limit (maxLen) instead of pre-subtracted value
- Caller now passes actual platform limit (e.g., 2000 for Discord)
- Internal buffer of 500 chars is handled within message.go
- Preferred split at maxLen - 500, may extend to maxLen for code blocks
- Never exceeds maxLen, no more mental math for callers
2026-02-18 20:21:51 +00:00
Hua 94a1b8664b refactor: extract message splitting logic to shared utils
- Move FindLast, findLast, and SplitMessage from discord.go to pkg/utils/message.go
- Update discord.go to use utils.SplitMessage()
- Makes splitting logic reusable across other channels
2026-02-18 20:01:53 +00:00
Artem Yadelskyi 9e120f90ea feat(fmt): Run formatters 2026-02-18 21:48:23 +02:00
Leandro Barbosa 447c17aeb1 merge: sync upstream/main (PR #213) into feat/multi-agent-routing
Resolve conflicts in pkg/providers/types.go and pkg/agent/loop.go:
- types.go: use protocoltypes aliases from PR #213, keep fallback types
- loop.go: drop old single-agent createToolRegistry (replaced by multi-agent pattern)

Refactor to align with PR #213 patterns:
- instance.go: use NewExecToolWithConfig (accept full config for deny patterns)
- registry.go: pass full config to NewAgentInstance
- loop.go: add Perplexity web search options to registerSharedTools
2026-02-18 11:39:14 -03:00
Leandro Barbosa 4fde0175cf Merge pull request #227 from mattn/fix-shadowing-running
Fix shadowing field runnnig
2026-02-17 12:58:48 -03:00
HansonJames f0e90e6379 feat: Add the Qwen provider 2026-02-17 22:07:58 +08:00
Leandro Barbosa 12007b5670 merge: sync upstream/main into feat/multi-agent-routing
Resolve conflicts:
- pkg/agent/loop.go: integrate context compression, command handling,
  utf8 token estimation, and summarization notification into
  multi-agent routing architecture
- pkg/config/config_test.go: merge imports from both branches
- pkg/agent/loop_test.go: update test to use registry-based sessions
2026-02-16 10:34:55 -03:00
is-Xiaoen 5c321a90de fix: tighten file perms and enforce Slack ACL checks (#186)
- write config and cron store with 0600 instead of 0644
- check allow list in Slack slash commands and app mentions
- pass workspace restrict flag to cron exec tool

Closes #179
2026-02-16 16:06:39 +08:00
Avisek Ray 9d5728ec5b feat: implement structured Telegram command handling with a dedicated command service and telegohandler integration. (#164) 2026-02-16 14:20:16 +08:00
Huaaudio 32cb8fdc12 Feat: Discord message length check and auto split (#143)
* feat: discord message auto split

* make fmt

* chore: remove failing discord_test.go

---------

Co-authored-by: Hua <zhangmikoto@gmail.com>
2026-02-16 13:39:26 +08:00
Luke Milby 811e4f8728 add when picoclaw responsed to discord message will show its typing (#236) 2026-02-16 01:37:32 +08:00
Yasuhiro Matsumoto 7ce5b75178 Fix shadowing field runnnig 2026-02-16 00:47:17 +09:00
Meng Zhuo 0f506d4202 Merge pull request #165 from alexhoshina/feat/onebot
feat: add OneBot channel support
2026-02-15 09:12:00 +08:00
lxowalle dbf2739783 fix: Remove the waiting animation for Telegram replies to reduce the risk of being rate-limited. 2026-02-15 02:26:42 +08:00
Leandro Barbosa 5e89264536 merge: sync upstream/main into feat/multi-agent-routing
Update registerSharedTools to use new WebSearchToolOptions API and
add hardware tools (I2C, SPI) from upstream. Accept upstream's
new web tools config test.
2026-02-14 10:38:04 -03:00
Hoshina 8cff6cf312 fix: improve connection handling in OneBotChannel 2026-02-14 20:25:55 +08:00
Hoshina 60c3d96b5e style: fix alignment of fields in BotStatus struct 2026-02-14 20:02:30 +08:00
Hoshina 773ce9bcb6 fix: update BotStatus type in oneBotRawEvent and adjust status checks 2026-02-14 19:58:19 +08:00
Hoshina f7421128a0 style: remove unnecessary log messages in WebSocket listener 2026-02-14 17:46:47 +08:00
Hoshina 1fcf3fde0f style: fix format 2026-02-14 17:23:18 +08:00
Hoshina 7fa641a2ed feat: add OneBot channel support 2026-02-14 16:50:21 +08:00
PixelTux ba0ef4b62c Merge branch 'main' into architecture-32-bit 2026-02-14 09:32:24 +01:00
ex-takashima ac79a23e0a style: fix gofmt formatting (CRLF -> LF)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 11:21:47 +09:00
ex-takashima aa7a8b89c3 merge: resolve conflict with upstream main
Merge upstream changes (HeartbeatConfig addition) alongside LINEConfig.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 10:47:06 +09:00
ex-takashima f294a71bc5 feat(channels): add LINE Official Account channel support
Add LINE Messaging API as the 9th messaging channel using HTTP Webhook.
Supports text/image/audio messages, group chat @mention detection,
reply with quote, and loading animation.

- No external SDK required (standard library only)
- HMAC-SHA256 webhook signature verification
- Reply Token (free) with Push API fallback
- Group chat: respond only when @mentioned
- Quote original message in replies using quoteToken

Closes #146

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 10:01:20 +09:00
PixelTux 2cb90f2fe6 Merge branch 'main' into architecture-32-bit 2026-02-13 21:18:34 +01:00
lxowalle 1aea912fcd Merge pull request #83 from carzygod/main
update telegram username support
2026-02-14 00:49:14 +08:00
Leandro Barbosa 8a6fb7d9e3 merge: sync upstream/main into feat/multi-agent-routing
Resolve conflicts in loop.go, config.go, config_test.go,
spawn.go, and subagent.go. Integrate upstream ToolResult/AsyncTool
pattern with multi-agent routing features. Rename mockProvider
to mockRegistryProvider in registry_test.go to avoid redeclaration
with upstream's loop_test.go.
2026-02-13 12:24:26 -03:00
Leandro Barbosa 272536a11a feat: add multi-agent routing with declarative bindings
Implement per-agent workspace/model/session isolation with 7-level
priority routing cascade (peer > parent_peer > guild > team > account >
channel > default). Backward compatible - empty agents.list creates
implicit "main" agent from defaults.

Core components:
- routing/agent_id.go: ID normalization with pre-compiled regex
- routing/session_key.go: 4 DM scope modes with identity links
- routing/route.go: RouteResolver with priority-based binding matcher
- agent/instance.go: Per-agent state (workspace, sessions, tools, model)
- agent/registry.go: Agent lifecycle, route resolution, subagent ACL

Integration:
- config.go: AgentModelConfig (flexible JSON), bindings, session config
- loop.go: Complete rewrite for multi-agent dispatch
- Channel adapters: peer_kind/peer_id metadata (telegram, discord, slack)
- spawn.go: Subagent allowlist enforcement per agent

Validated end-to-end with Discord channel-based bindings, default
fallback routing, and per-agent session persistence.
2026-02-13 12:12:33 -03:00
zeo 1e17bac9f0 fix: correct index bug in extractCodeBlocks and extractInlineCodes
The previous implementation used len(codes)-1 in ReplaceAllStringFunc,
which caused all placeholders to point to the same (last) index.
This resulted in only the last code block being displayed correctly
when multiple code blocks were present in a message.

Now using a proper counter variable that increments for each match,
ensuring each code block gets a unique placeholder index.
2026-02-13 21:38:14 +08:00