Commit Graph

648 Commits

Author SHA1 Message Date
I Putu Eddy Irawan 0e810a2ec4 fix: tighten HTML-expansion test to stay under chunk size
Reduce markdown input from 700 to 600 repeats (3600 runes) so it stays
under the 4000-rune chunk threshold. This ensures the test actually
exercises the HTML-expansion re-splitting logic rather than being split
at the markdown level first.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 09:20:16 +07:00
I Putu Eddy Irawan df53f4411a fix: format long lines in telegram_test.go to satisfy golines linter
Break function signatures and assert calls that exceed the 120-char
golines limit onto multiple lines.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 09:11:24 +07:00
I Putu Eddy Irawan 33109a1676 Address Copilot review: handle HTML expansion exceeding Telegram limit
When markdownToTelegramHTML expands a chunk beyond 4096 chars (e.g.
**a** → <b>a</b>), re-split the markdown with a proportionally smaller
maxLen so each resulting HTML chunk fits within Telegram's limit.

Extract sendHTMLChunk helper to avoid duplicating the HTML-send +
plain-text-fallback logic.

Add test case for markdown-short-but-HTML-long scenario to verify
the re-splitting behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 22:35:41 +07:00
I Putu Eddy Irawan 3501962977 test: add unit tests for Telegram Send() method
Cover empty content early return, single-message send,
multi-chunk splitting for long messages, HTML-to-plain-text
fallback per chunk, and error propagation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 21:54:35 +07:00
I Putu Eddy Irawan 2dccee5044 Address Copilot review feedback for Telegram message chunking
- Add early return for empty content to avoid silent no-op
- Split raw markdown before HTML conversion so SplitMessage's
  code-fence-aware logic works correctly and HTML tags/entities
  are never broken by mid-tag splitting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 09:40:09 +07:00
I Putu Eddy Irawan a6f4274870 feat: add message chunking in Telegram Send method
Split HTML content into 4000-char chunks before sending to handle cases
where markdown-to-HTML conversion causes messages to exceed Telegram's
4096-character limit. Uses the existing SplitMessage utility which
preserves code block integrity across chunk boundaries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 08:56:12 +07:00
daming大铭 9c9524f934 Merge pull request #914 from alexhoshina/fix/wecom-context-canceled
fix(wecom): use channel context instead of HTTP request context for async message processing
2026-02-28 21:56:17 +08:00
Hoshina 8e06e2adbd fix(wecom): initialize context in constructors to prevent nil panic in tests
The ctx field was only set in Start(), so tests calling handleMessageCallback
without Start() caused a nil pointer dereference in MessageBus.PublishInbound.
2026-02-28 21:45:08 +08:00
Hoshina 62f59f76e3 fix(wecom): use channel context instead of HTTP request context for async message processing
The HTTP request context is canceled as soon as the handler returns the
response, causing PublishInbound to fail with "context canceled" when
processMessage runs asynchronously in a goroutine. Use the channel's
long-lived context (c.ctx) instead.
2026-02-28 21:31:08 +08:00
lxowalle 8207c1c7e6 Feat/update migrate (#910)
* * update migrate

* * rename handlers to sources

* * delete dead code

* * fix go test error
v0.2.0
2026-02-28 19:59:17 +08:00
taorye 27e988c484 feat(tui): Add configurable Launcher and Gateway process management (#909)
- Implement POSIX-specific gateway process management in gateway_posix.go
- Implement Windows-specific gateway process management in gateway_windows.go
- Create a menu system in menu.go for user interaction
- Develop model management functionality in model.go, including adding, deleting, and testing models
- Introduce a style configuration in style.go for consistent UI appearance
- Set up the main application entry point in main.go
- Update go.mod and go.sum to include necessary dependencies for tcell and tview
2026-02-28 19:37:18 +08:00
Guoguo 08599f8736 build: add armv6 support to goreleaser (#905)
Add GOARM=6 targets for both picoclaw and picoclaw-launcher builds
to support older ARM devices like Raspberry Pi Zero/1.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 18:54:23 +08:00
Guoguo 5e028a847c feat: add picoclaw-launcher with web UI for configuration and gateway management (#904)
A standalone web-based tool for managing picoclaw configuration, OAuth
authentication providers, and gateway process lifecycle. Features include
a sidebar layout with i18n (en/zh) and theme support, real-time gateway
log streaming, startup prerequisites checks, and Windows icon embedding.

Co-authored-by: wj-xiao <meetwenjie@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 18:38:38 +08:00
Mauro 172e6ebe5f fix(exec) fail close on invalid deny pattern (#781)
* fix(exec) fail close on invalid deny pattern

* fix: error check

* resolve conflicts
2026-02-28 16:24:26 +08:00
wenjie 6c8866de6f fix: propagate error when no channels are enabled during startup (#897) 2026-02-28 16:04:44 +08:00
daming大铭 feee0da945 Merge pull request #884 from alexhoshina/fix/memory-leak-whatsapp-reasoning
Fix/memory leak whatsapp reasoning
2026-02-28 14:28:44 +08:00
Hoshina 871b2d7342 fix(whatsapp_native,agent): fixes for resource leak and log noise
- WhatsApp Start(): use deferred cleanup to nil out c.client/c.container
  and disconnect/close resources on any error after struct fields are
  assigned, preventing stale references and double-close in Stop()
- handleReasoning: treat bus.ErrBusClosed as an expected condition
  (DEBUG level) alongside context timeout/cancel, avoiding WARN noise
  during normal shutdown
2026-02-28 14:13:27 +08:00
daming大铭 8529abbc91 Merge pull request #681 from dimensi/bugfix/falsy-context-deadline
fix: distinguish network timeouts from context window errors
2026-02-28 14:12:09 +08:00
Hoshina 7f425f1d11 fix(agent): correct misspelling of 'canceled' 2026-02-28 13:00:40 +08:00
Hoshina d1b10a0004 fix(whatsapp_native,agent): address second round of review feedback
- WhatsApp Send(): detect unpaired state (Store.ID == nil) and return
  ErrTemporary instead of attempting to send while QR login is pending
- handleReasoning: check the returned error type (DeadlineExceeded /
  Canceled) instead of ctx.Err() to decide log level, so pubCtx
  timeouts on a full bus are correctly classified as expected
- Test: fill bus with a short-timeout loop instead of hardcoding the
  buffer size (64), making the test resilient to buffer size changes
2026-02-28 12:54:09 +08:00
Hoshina fc28c2660a fix(whatsapp_native): close TOCTOU race between eventHandler and Stop
Move the stopping check and wg.Add(1) inside reconnectMu in
eventHandler, and set the stopping flag under the same lock in Stop().
This makes the two operations atomic with respect to each other,
preventing the race where:
1. eventHandler checks stopping (false)
2. Stop() sets stopping=true and enters wg.Wait() (wg is 0)
3. eventHandler calls wg.Add(1) → panic or goroutine leak
2026-02-28 12:38:07 +08:00
Hoshina 9b80fdf885 fix(whatsapp_native,agent): address PR #884 review feedback
- Use c.runCtx for GetQRChannel so the QR producer is canceled on Stop()
- Add atomic stopping guard to prevent wg.Add/wg.Wait race in eventHandler
- Make Stop() context-aware: disconnect client before waiting, respect ctx deadline
- Reduce reasoning publish log noise: use debug level for expected ctx errors
- Add test for handleReasoning when outbound bus is full (timeout path)
2026-02-28 03:05:23 +08:00
Hoshina 1d0220f9fd fix(agent): prevent reasoning goroutine accumulation on full bus
Add a 5-second timeout to handleReasoning's PublishOutbound call so
fire-and-forget goroutines do not block indefinitely when the outbound
bus channel is full. Reasoning output is best-effort; on timeout the
publish is abandoned with a warning log instead of holding the
goroutine alive.

Fixes goroutine leak introduced in #802.
2026-02-28 01:39:17 +08:00
Hoshina c7d75a18f8 fix(whatsapp_native): fix goroutine and resource leak in Start/Stop lifecycle
- Move runCtx/runCancel creation before event handler registration and
  QR loop so Stop() can cancel at any point during startup
- Replace blocking QR event loop in Start() with a background goroutine
  that selects on runCtx.Done(), preventing Start() from hanging
  indefinitely when waiting for QR scan
- Track all background goroutines (QR handler, reconnect) with
  sync.WaitGroup; Stop() waits for them to finish before releasing
  client/container resources
- Cancel runCtx on error paths in Start() to avoid leaked contexts

Fixes resource leak introduced in #655.
2026-02-28 01:39:06 +08:00
美電球 cdbc9c4bd6 Merge branch 'sipeed:main' into main 2026-02-28 01:28:39 +08:00
daming大铭 2f4f45080b Merge pull request #882 from sipeed/fix/issue#565
Update config file reference from config.yaml to config.json
2026-02-28 00:41:23 +08:00
美電球 ebfa72a286 Update config file reference from config.yaml to config.json
Closes: #565
2026-02-28 00:36:39 +08:00
daming大铭 1211218b60 Merge pull request #881 from mosir/fix/onboard-include-empty-model
fix(config): keep empty agents.defaults.model in saved config
2026-02-28 00:28:02 +08:00
daming大铭 70fcbc5700 Merge pull request #824 from 0xYiliu/fix/issue-783-fallback-alias-resolution
fix: resolve fallback model alias parsing for issue #783
2026-02-28 00:25:18 +08:00
mosir 1161aee872 fix(config): keep empty agents.defaults.model in saved config 2026-02-28 00:18:10 +08:00
daming大铭 5b96923d66 Merge pull request #877 from sipeed/refactor/channel-system
Refactor/channel system
2026-02-28 00:08:36 +08:00
美電球 c119e0d5e8 Merge pull request #655 from adityakalro/main
Added a native WhatsApp channel implementation.
2026-02-27 20:25:59 +08:00
美電球 f6c275f70c Fix formatting of WhatsAppConfig struct fields 2026-02-27 20:25:02 +08:00
美電球 75a86ebe03 Resolve merge conflict in config.example.json
Removed conflicting lines and kept 'allow_from' as an empty array.
2026-02-27 20:23:20 +08:00
美電球 6b427afa44 Remove ignored files from .gitignore 2026-02-27 20:22:40 +08:00
美電球 67e1dab408 Update test case for unicode letters preservation 2026-02-27 20:20:58 +08:00
美電球 3ad937f05b Update function comment for SanitizeMessageContent 2026-02-27 20:20:25 +08:00
美電球 6fcc80bf44 Reformat WhatsAppConfig struct fields alignment 2026-02-27 20:20:00 +08:00
Hoshina 7276a2d651 Fix lint errors 2026-02-27 20:15:21 +08:00
美電球 fa68023ac2 Merge branch 'refactor/channel-system' into main 2026-02-27 20:04:08 +08:00
daming大铭 90e49bc671 Merge pull request #802 from biisal/reasoning-chnl
Fix Reasoning Content Being Silently Dropped by Adding Channel-Aware Reasoning Routing #645
2026-02-27 18:51:48 +08:00
Hoshina d429dcdd76 chore: fix go fmt formatting issues after rebase
Apply go fmt to files that had formatting inconsistencies
(alignment, indentation) after rebasing onto refactor/channel-system.
2026-02-27 17:35:50 +08:00
Avisek Ray b1a6b3898d Merge branch 'sipeed:main' into reasoning-chnl 2026-02-27 14:50:14 +05:30
lxowalle 29d4019e62 fix: set max tokens to 32k, default model to null (#858)
* * Set default value of max tokens to 32768

* * set max tokens to 32k, default model to null

* * Fix format error
2026-02-27 17:02:25 +08:00
Avisek f96cf3f8cc feat: Add reasoning_channel_id to communication platform configurations and improve message bus context cancellation handling. 2026-02-27 16:58:42 +08:00
Avisek 9f95aad5f3 feat: Introduce LLM reasoning fields to LLM responses and enable routing reasoning output to dedicated channels. 2026-02-27 16:58:42 +08:00
lxowalle b6927c9a7a Prompt to modify the max_tool_iterations parameter. (#855)
* Prompt to modify the max_tool_iterations parameter.

* fix typo and set max iterations to 50
2026-02-27 15:42:47 +08:00
lxowalle a91a4e5978 * update wechat qrcode & delete unused mp4 file (#852) 2026-02-27 14:36:26 +08:00
Aditya Kalro 42ee9ab1e3 Complete the whatsapp native channel implementation based on the new channel interface 2026-02-26 22:35:52 -08:00
Aditya Kalro a8644ca1c5 Refactor whatsapp native channel based on the new channel interface 2026-02-26 22:35:20 -08:00