Commit graph

1445 commits

Author SHA1 Message Date
Cytown
275c1012f1
make gateway reload use new loglevel (#2155) 2026-03-30 18:00:18 +08:00
daming大铭
803b8bc02f
Merge pull request #2131 from imalasong/pr/3
fix(feishu): skip empty random_reaction_emoji entries
2026-03-30 17:51:26 +08:00
Cytown
7a1f2aba03
add check for gateway port and fix logger.Fatal not record issue (#2185) 2026-03-30 17:43:10 +08:00
daming大铭
cbe92286e9
Merge pull request #2184 from cytown/config
refactor config and add ModelConfig.Enabled
2026-03-30 17:23:07 +08:00
Alix-007
e88df4ff9c
feat(tools): add reaction tool and reply-aware message sends (#2156)
- Add `reaction` tool that reacts to a message (defaults to current inbound message via context)
- Extend `message` tool with optional `reply_to_message_id` parameter
- Introduce `WithToolInboundContext` to inject inbound message IDs into tool execution context
- Surface `MessageID` and `ReplyToMessageID` in `processOptions` for tool-surface consumption

Refs #2137
2026-03-30 16:31:34 +08:00
mattn
5e7545a22a
perf: precompute BM25 index for repeated searches (#2177) 2026-03-30 16:30:25 +08:00
smallwhite
89af3b2511 fix(tools): message tool no longer suppresses reply to originating chat
When the message tool sent to a different chat (e.g., a group), the
agent's final response to the originating chat was incorrectly skipped
because HasSentInRound() was a simple bool that didn't distinguish
targets. Replace with HasSentTo(channel, chatID) that tracks all
send targets per round and only suppresses when the target matches.

Fixes cross-conversation message causing "Processing..." to hang.
2026-03-30 15:06:22 +08:00
Cytown
93757812fc refactor config and add ModelConfig.Enabled 2026-03-30 14:01:20 +08:00
Alix-007
cd3f6600ca fix(utils): honor Retry-After for 429 retries 2026-03-30 13:04:51 +08:00
afjcjsbx
765a165475 fix(agent): warn on unknown frontmatter capabilities 2026-03-29 23:48:06 +02:00
afjcjsbx
abeb2d8e0a fix(agent): fall back to first AGENT line for discovery 2026-03-29 23:44:41 +02:00
afjcjsbx
f5f1dc9808 fix(agent): load only allowed MCP servers 2026-03-29 23:43:35 +02:00
afjcjsbx
409251e69d fix(agent): fail closed on invalid AGENT frontmatter 2026-03-29 23:41:32 +02:00
afjcjsbx
847218ef29 refactor(agent): added mcp allowlist 2026-03-29 23:22:47 +02:00
afjcjsbx
0ef25f779e refactor(agent): move delegation details out of discovery prompt 2026-03-29 22:57:57 +02:00
afjcjsbx
6429f6af9a refactor(agent): source discovery identity from AGENT.md frontmatter 2026-03-29 22:43:20 +02:00
daming大铭
1fc5345857
refactor(cron): remove deliver and type params, unify agent execution path (#2147)
The agent path now publishes to outbound bus directly (since #2100),
making the deliver=true direct-to-bus shortcut and the directive type
prompt wrapping redundant. All cron jobs now uniformly route through
the agent. This is an intentional behavior change: old jobs with
deliver=true will execute through the agent instead of bypassing it.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-29 22:52:34 +08:00
Cytown
1ef0553929
add logger test case for console log format for component (#2162) 2026-03-29 22:32:39 +08:00
afjcjsbx
bca131909d fix lint 2026-03-29 14:27:22 +02:00
afjcjsbx
07748bf076 chore: revert unrelated golines formatting 2026-03-29 14:06:19 +02:00
afjcjsbx
3b173c0bee feat(agent): add multi-agent discovery prompt and per-agent 2026-03-29 13:58:19 +02:00
Cytown
42e3aaff35 make logger more clear with highlight component and use package name for default component 2026-03-29 18:35:24 +08:00
Cytown
f0c0219c4c fix for review 2026-03-29 16:58:48 +08:00
Cytown
9c28870e80 Merge branch 'main' into t3 2026-03-29 16:48:56 +08:00
李光春
e70928cc6f
feat(mcp): support DisableStandaloneSSE for HTTP transport (#2108) 2026-03-29 14:37:22 +08:00
沈青川
e414b82ac3
fix(cron): publish agent response to outbound bus for cron-triggered jobs (#2100)
* fix(cron): publish agent response to outbound bus for cron-triggered jobs

When a cron job triggers agent execution via ProcessDirectWithChannel,
the agent response was silently discarded — the code assumed AgentLoop
would auto-publish it, but SendResponse is false on this path.

Delegate to PublishResponseIfNeeded (exported from AgentLoop) so the
response reaches the originating channel (e.g. Telegram) only when the
message tool did not already deliver content in the same round.

Also adds a "directive" message type to CronPayload, allowing cron jobs
to instruct the agent to execute a task rather than echo static text.

* fix(cron): add type validation and directive test coverage

Address reviewer blocking feedback:

1. Server-side whitelist for `type` parameter — the `enum` in
   Parameters() is only an LLM schema hint; any string was persisted.
   Now `addJob` rejects values other than "message" and "directive".

2. Comprehensive test coverage for the directive code path:
   - directive adds prompt prefix to ProcessDirectWithChannel
   - deliver=true + directive routes through agent (not direct publish)
   - directive prompt content, sessionKey, channel, chatID are correct
   - invalid type is rejected; valid types ("", "message", "directive") pass
   - deliver=true message type goes directly to bus (regression)
   - agent error path does not trigger publish (regression)

Also merge the two UpdateJob calls in addJob into one to avoid
redundant disk I/O (non-blocking suggestion from review).

* fix(cron): remove omitempty from CronPayload.Type for consistent JSON

Empty string and "message" are semantically equivalent defaults;
always serializing the field avoids asymmetric JSON output.

* test(cron): remove redundant test, strengthen error path coverage

- Remove ExecuteJobDirectivePassesCorrectContent: its assertions on
  sessionKey/channel/chatID duplicate ExecuteJobPublishesAgentResponse;
  its prompt check duplicates DirectiveAddsPromptPrefix.
- Strengthen DirectiveAddsPromptPrefix with exact prompt match and
  publish response assertion.
- Fix ReturnsErrorWithoutPublish: set non-empty stub response so the
  test verifies the error branch early-return, not the response==""
  guard.

* fix(ci): satisfy golines and gosmopolitan in cron code
2026-03-29 13:47:28 +08:00
zeed zhao
6ea364e67d
feat(web): protect launcher dashboard with token and SPA login (#1953)
Add token-based authentication for the Launcher's embedded Web Dashboard.

- Ephemeral token generated in-memory each run (or via PICOCLAW_LAUNCHER_TOKEN env var)
- HMAC-SHA256 session cookie (HttpOnly, SameSite=Lax, Secure when HTTPS)
- Bearer token support for API/script access
- Rate limiting on login (10 attempts/IP/min)
- Referrer-Policy: no-referrer on all responses
- POST-only logout with JSON content-type (CSRF-safe)
- System tray "Copy dashboard token" action
- Login page shows contextual help (console/tray/log file path)
- Path traversal protection via path.Clean
- X-Forwarded-Host/Port/Proto support for reverse proxy deployments
- Full i18n support (English, Chinese)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-29 13:11:43 +08:00
Andy Lo-A-Foe
4f90909af3
feat(bedrock): detect SSO token expiration and provide actionable error
When AWS SSO credentials expire, provide a clear error message instructing
the user to run 'aws sso login' to refresh their session.
2026-03-28 22:18:45 +01:00
Cytown
475d377af1 Merge branch 'main' into t3 2026-03-29 01:25:20 +08:00
Cytown
0bb561548f add pid file for gateway running and auth token for /reload and pico channel 2026-03-29 01:14:39 +08:00
imalasong
43095543ab fix(feishu): skip empty random_reaction_emoji entries
Feishu returns 231001 when emoji_type is empty. Config slices like
["", "Pin"] could randomly select an empty string; filter and
trim entries and fall back to Pin when none remain.

Made-with: Cursor
2026-03-28 23:36:49 +08:00
Kunal Karmakar
e23eda5365 Update tests and error cases handling 2026-03-28 13:33:48 +00:00
Kunal Karmakar
1809d04905
chore(provider): use openai responses api for azure openai endpoints (#2110)
Migrate Azure OpenAI provider from legacy Chat Completions API to the OpenAI Responses API.

- Switch API endpoint from `/openai/deployments/{deployment}/chat/completions` to `/openai/v1/responses`
- Change auth header from `Api-Key` to `Authorization: Bearer`
- Use `responses.ResponseNewParams` SDK types for request construction
- Extract shared Responses API utilities into `openai_responses_common` package
- Deduplicate 178 lines from codex_provider.go by reusing shared package
- Add 593 lines of comprehensive test coverage for the shared package

Closes #2111

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 20:50:24 +08:00
Mauro
026a1339c7
simplified duplicated code (#1935) 2026-03-28 20:28:24 +08:00
champly
11dec0c80a
fix(weixin): persist context tokens to disk to survive restarts (#2124) 2026-03-28 20:23:14 +08:00
Guoguo
62d40a02d4
fix: resolve typecheck errors in loop_test.go and dingtalk_test.go (#2122)
- loop_test.go: replace undefined WithSecurity/SecurityConfig/ModelSecurityEntry
  with direct APIKeys field using SimpleSecureStrings()
- dingtalk_test.go: use ClientSecret.String() and ClientSecret.Set()
  instead of non-existent ClientSecret() and SetClientSecret() methods

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 18:58:09 +08:00
Alix-007
b6951b6925
fix(dingtalk): honor mention-only groups and strip leading mentions (#2054)
* fix(dingtalk): honor @mention flag in mention-only groups

* fix(dingtalk): strip leading mentions in group payloads

---------

Co-authored-by: Alix-007 <267018309+Alix-007@users.noreply.github.com>
2026-03-28 18:26:10 +08:00
Hua Audio
0e13f6bdec
fix/wechat-new-protocol (#2106)
* fix/wechat-new-protocol

* fix cdn download logic
2026-03-28 18:18:01 +08:00
Mauro
230942d234
fix(loop): polling (#2103) 2026-03-28 16:36:06 +08:00
xiwuqi
e011284d8f
fix(agent): use light provider for routed model calls (#2038) 2026-03-28 15:25:23 +08:00
Cytown
f1cb7cc8f5
fix gateway reload will cause pico stop working issue (#2082)
* fix gateway reload will cause pico stop working issue

* fix for review
2026-03-28 11:30:31 +08:00
Mauro
60d7ec20a5
feat(log): prompt tokens (#2047) 2026-03-28 02:00:12 +08:00
Cytown
b646d3b8fe
refactor config and security to simplified the structure (#2068) 2026-03-28 00:03:34 +08:00
Cytown
98c78363b3
change default debug level to warn (#2084) 2026-03-27 21:04:28 +08:00
Badgerbees
8d5fc736d6 security: add open-by-default warning and '*' allow_from support 2026-03-27 20:04:21 +07:00
Cytown
0c9e4f0658
fix for FlexibleStringSlice cause picoclaw start crash issue (#2078) 2026-03-27 20:49:51 +08:00
daming大铭
25ce52715d
Merge pull request #2070 from afjcjsbx/feat/improve-web-tools
feat(tools) time range in web_search
2026-03-27 19:36:24 +08:00
afjcjsbx
d385491592 fix(config): array placeholder 2026-03-26 21:40:38 +01:00
afjcjsbx
e2018c4aa7 fix lint 2026-03-26 21:33:43 +01:00
afjcjsbx
b7f6ab7176 fix conf 2026-03-26 21:27:35 +01:00