Commit Graph

605 Commits

Author SHA1 Message Date
I Putu Eddy Irawan f07dbd1db2 fix: remove redundant SplitMessage in Send() per review feedback
WithMaxMessageLength(4000) already ensures msg.Content ≤ 4000 chars
before reaching Send(), making the SplitMessage call redundant.
The HTML expansion safety net (re-split when >4096 after conversion)
is still preserved.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 22:01:04 +07:00
I Putu Eddy Irawan 11017ac7ba merge: resolve conflicts with upstream/main
Accept upstream versions for all non-Telegram files to keep PR
scope focused on Telegram message chunking only.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 22:27:55 +07:00
I Putu Eddy Irawan bd0018a5d7 fix: use queue-based re-splitting for HTML expansion validation
After re-splitting an oversized chunk, sub-chunks were sent without
verifying their HTML also fits under 4096 chars. Non-uniform HTML
expansion (e.g. a sub-chunk dense with bold/links) could still exceed
the limit. Use a queue that pushes sub-chunks back for re-validation
instead of sending them blindly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 22:19:04 +07:00
I Putu Eddy Irawan 3de4cb863b fix: pass original markdown to sendHTMLChunk for plain-text fallback
When HTML parsing fails, the fallback was re-sending the same HTML
string with ParseMode cleared, showing raw HTML tags to users.
Now pass the original markdown chunk so the fallback displays
readable plain text instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 22:15:17 +07:00
I Putu Eddy Irawan 8bd1935efb telegram: lower MaxMessageLength to 4000 for HTML expansion margin
The Manager splits at MaxMessageLength before calling Send(), and
Telegram's Send() was re-splitting at 4000 internally. Aligning the
channel-level limit to 4000 avoids that redundant second split while
preserving the safety margin for markdown-to-HTML expansion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 20:46:43 +07:00
daming大铭 c8178f4ad4 Merge pull request #732 from is-Xiaoen/feat/jsonl-memory-store
feat(memory): JSONL-backed session persistence
2026-03-04 19:34:00 +08:00
xiaoen f9f726c0c1 fix(memory): fsync appended message for consistent durability
addMsg now calls f.Sync() before f.Close(), matching the durability
guarantee of writeMeta and rewriteJSONL (both use WriteFileAtomic
with fsync). Without this, a power loss could leave the appended
line in the kernel page cache only — lost on reboot.
2026-03-04 19:21:34 +08:00
Guoguo 028605cfd0 feat: execute LLM tool calls in parallel for faster response (#1070)
When the LLM returns multiple tool calls, they are now executed
concurrently using goroutines + sync.WaitGroup instead of sequentially.
Results are collected in an indexed slice and processed in original order
to preserve message ordering. MessageTool.sentInRound is changed to
atomic.Bool for thread safety.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 17:17:28 +08:00
shikihane b82bb9acc0 feat(tools): add GLM Search (智谱) web search provider (#1057)
* feat(config): add GLMSearchConfig for GLM Search provider

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

* test(tools): add failing tests for GLM Search provider

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

* feat(tools): add GLMSearchProvider for web search

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

* feat(agent): wire GLM Search config into web search tool registration

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 14:58:12 +08:00
Rahul Bansal df1b53fdf9 feat: make summarization message threshold and token percent configurable (#854) (#1029)
Co-authored-by: Rahul Bansal <rahul@hudle.in>
2026-03-04 11:23:01 +08:00
美電球 bea238c337 Merge pull request #853 from nayihz/feat_discord_proxy
feat(discord): add proxy support and tests
2026-03-04 01:03:57 +08:00
I Putu Eddy Irawan fe97387f0f Merge remote-tracking branch 'origin/feat/exa-search' into deploy/pi-integration 2026-03-03 22:29:10 +07:00
I Putu Eddy Irawan b7aaa5b887 Merge remote-tracking branch 'origin/feat/dotenv-loading' into deploy/pi-integration 2026-03-03 22:29:05 +07:00
I Putu Eddy Irawan 8ed351cf28 Merge remote-tracking branch 'origin/feat/telegram-chunking' into deploy/pi-integration 2026-03-03 22:28:59 +07:00
I Putu Eddy Irawan c5d2298490 Merge remote-tracking branch 'origin/feat/kimi-opencode-providers' into deploy/pi-integration 2026-03-03 22:28:54 +07:00
I Putu Eddy Irawan d257f1aaef merge: resolve conflict with upstream/main in provider_test.go
Keep both KimiCodeUserAgent test (from this branch) and
serializeMessages tests (from upstream) — no overlap.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 22:18:20 +07:00
I Putu Eddy Irawan e503c87c18 fix: add LiteLLM to env overrides and fix malformed .env test
- Add missing LITELLM entry to loadProviderEnvOverrides so
  PICOCLAW_PROVIDERS_LITELLM_API_KEY/API_BASE env vars work
- Replace valid .env content in TestLoadConfig_MalformedDotenv_NonFatal
  with genuinely malformed content (bare key without '=') to actually
  exercise the non-fatal error path

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 22:14:25 +07:00
I Putu Eddy Irawan 5b608ae678 test: use guardCommand directly and improve assertions in DiskWiping test
Address Copilot review feedback:
- Use guardCommand() instead of Execute() to avoid running dangerous
  commands (format, mkfs, diskpart) on the host if regex regresses
- Assert error message contains "blocked" for blocked commands
- Replace "go fmt ./..." with "echo go fmt ./..." to avoid accidental
  file modification

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 22:05:32 +07:00
I Putu Eddy Irawan 56ad77b735 Merge upstream/main into feat/dotenv-loading
Resolve go.mod conflict: keep h2non/filetype from upstream,
tcell/v2 stays in direct deps only (not duplicated in indirect).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 22:01:04 +07:00
I Putu Eddy Irawan 5dcd42e5d3 Merge upstream/main into fix/bugfixes
Resolve conflicts:
- provider.go: keep upstream's serializeMessages (supersedes stripSystemParts)
- provider_test.go: keep upstream's serializeMessages tests
- loop_test.go: add slices import needed by upstream tests
- shell.go: merge PR's --format deny fix with upstream's block device
  pattern, safePaths, and absolutePathPattern
- shell_test.go: include tests from both branches

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 21:55:26 +07:00
I Putu Eddy Irawan e54b1d39a5 refactor: parse Kimi API hostname once in constructor instead of per-call
Avoid re-parsing apiBase URL on every Chat() invocation by computing
isKimiAPI once in NewProvider(). Also document why the KimiCLI/0.77
User-Agent string is required.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 21:34:31 +07:00
Mauro 4a7605ee14 Merge pull request #1024 from wangyanfu2/fix-TavilySearch-response
fix: add HTTP status code check in BraveSearchProvider
2026-03-03 11:42:05 +01:00
nayihz 69b1ae48d5 Merge remote-tracking branch 'origin/main' into feat_discord_proxy 2026-03-03 18:38:57 +08:00
daming大铭 a65ccc0d1d Merge pull request #1020 from shikihane/feat/agent-vision-pipeline-v2
feat(agent): add vision/image support with streaming base64 and filetype detection
2026-03-03 18:35:23 +08:00
daming大铭 cf68166cf2 Merge pull request #1000 from alexhoshina/main
feat(feishu): enhance channel with markdown cards, media, mentions, and editing
2026-03-03 18:30:14 +08:00
pikaxinge 3902061db1 fix(agent): invalidate system prompt cache for global/builtin skills (#845)
* fix(agent): invalidate system prompt cache for global/builtin skills

* test(agent): avoid os.Chdir in builtin skill cache test

* fix(agent): harden skill cache invalidation checks
2026-03-03 18:25:00 +08:00
wangyanfu2 7de4cc5ebd fix: add HTTP status code check in BraveSearchProvider
- Add status code validation after reading response body, consistent
  with TavilySearchProvider and PerplexitySearchProvider
2026-03-03 17:54:43 +08:00
Guoguo 1265655ef0 feat(telegram): add base_url support for custom Telegram Bot API server (#1021)
* feat(telegram): add base_url support for custom Telegram Bot API server

Allow users to specify a custom Telegram Bot API server URL via
config field `base_url` or env var `PICOCLAW_CHANNELS_TELEGRAM_BASE_URL`.
Defaults to the official https://api.telegram.org when left empty.

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

* fix(telegram): trim whitespace and trailing slash from base_url

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 17:27:57 +08:00
shikihane 6ccb68c63e fix: resolve linter issues (gci import grouping, gofumpt, govet shadow)
- Separate third-party imports from local module imports (gci)
- Fix byte slice literal formatting (gofumpt)
- Rename shadowed err variable to ftErr (govet)
- Remove trailing blank lines in test files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 17:04:54 +08:00
Hoshina fa1cb9cc74 fix(feishu): address PR #1000 review comments from @xiaket
- Consolidate extractImageKey/extractFileKey/extractFileName into shared
  extractJSONStringField helper to reduce code duplication
- Move mentionPlaceholderRegex to package-level position after imports
- Rename feishuCfg field to config for clarity within FeishuChannel
- Replace @_user_1 heuristic with GET /open-apis/bot/v3/info API call
  at startup for reliable bot @mention detection
- Fix double close on file handle in downloadResource by removing defer
  and using explicit close in both success and error paths
- Add unit tests for common.go and feishu_64.go helpers (53 test cases)
2026-03-03 16:44:24 +08:00
shikihane 43227411ee feat(agent): wire media refs through agent pipeline to LLM provider
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 16:28:20 +08:00
shikihane 03f7ae494f feat(openai_compat): implement serializeMessages with multipart media support
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 16:28:20 +08:00
shikihane 6fd65825e7 feat(agent): implement resolveMediaRefs with streaming base64 and filetype detection
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 16:28:20 +08:00
shikihane 4c6c05a251 feat(config): add configurable max_media_size with 20MB default
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 16:27:29 +08:00
shikihane 6689c0b1c0 feat(providers): add Media field to Message struct for vision support
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 16:27:29 +08:00
daming大铭 de2ccb5da4 Merge pull request #999 from yinwm/fix/mcp-race-condition-and-resource-leak
fix(mcp): resolve TOCTOU race condition and resource leak
2026-03-03 15:06:57 +08:00
Guoguo 407707a7cc Revert "feat(agent): add vision/image support to agent pipeline" 2026-03-03 11:38:32 +08:00
Orgmar 12d4570a36 Merge pull request #990 from shikihane/feat/agent-vision-pipeline
feat(agent): add vision/image support to agent pipeline
2026-03-03 11:32:07 +08:00
shikihane 8ebeefc59f fix(agent,openai_compat): address review feedback on vision pipeline
- serializeMessages: preserve ToolCallID/ToolCalls when Media is present
- resolveMediaRefs: add 20MB file size limit to prevent OOM
- mimeFromExtension: return empty string for unknown extensions
- Add 11 unit tests for serializeMessages, resolveMediaRefs, mimeFromExtension

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 11:13:22 +08:00
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 2fc87985d2 fix: add kimi-code migration alias and User-Agent test
- Add "kimi-code" to the moonshot provider's providerNames in
  ConvertProvidersToModelList so configs using
  agents.defaults.provider: "kimi-code" migrate correctly.
- Add TestProviderChat_KimiCodeUserAgent verifying that
  User-Agent: KimiCLI/0.77 is set when apiBase hostname is
  api.kimi.com and not set for other hosts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 09:18:26 +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
Alfonso 946af6b53d feat: add LiteLLM provider alias support (#930) 2026-03-03 08:23:55 +11:00
Hoshina 595de7814d fix(feishu): remove dead fetchBotOpenID stub and fix misleading comment 2026-03-03 01:39:33 +08:00
Hoshina 42eb6ea410 fix(feishu): address review findings
- Remove stale "falls back to plain text" comment on Send
- Add empty ChatID validation in SendMedia to match Send
- Use messageID+fileKey as local filename to avoid write collisions
- Check allowlist before downloading inbound media to avoid wasted I/O
- Return errUnsupported consistently from all 32-bit stub methods
2026-03-03 01:27:46 +08:00
Hoshina 0bee9d7bcf fix(feishu): resolve lint issues 2026-03-03 01:04:11 +08:00
Hoshina c9fb681f3b feat(feishu): enhance channel with markdown cards, media, mentions, and editing
Upgrade the Feishu channel from basic text-only to full feature parity with
Telegram/Discord: interactive card messages with markdown rendering, message
editing (MessageEditor), placeholder messages (PlaceholderCapable), emoji
reactions (ReactionCapable), and inbound/outbound media support (MediaSender).

Also add @mention detection with lazy bot open_id discovery, group trigger
filtering with mention awareness, and multi-type inbound message parsing
(text, post, image, file, audio, video).
2026-03-03 00:49:32 +08:00
yinwm 78aba700d5 fix(mcp): resolve TOCTOU race condition and resource leak
- Use atomic.Bool for closed flag to prevent TOCTOU race between
  CallTool and Close operations
- Add double-check pattern in CallTool for thread-safe closed state
- Use atomic Swap in Close to ensure no new calls can start after
  closed flag is set
- Move MCP manager cleanup defer before initialization to handle
  partial initialization failures
- Update tests to use atomic.Bool operations

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 00:47:25 +08:00
daming大铭 4e348e39ac Merge branch 'main' into mcp-tools-support 2026-03-03 00:17:39 +08:00
esubaalew 2e0be92776 fix(wecom): resolve upstream rebase conflicts after channel refactor
Rebase onto latest upstream/main, keep ring-buffer dedupe behavior, move dedupe tests to pkg/channels/wecom, and ensure wecom/channels race tests pass.
2026-03-02 18:54:11 +03:00