Commit Graph

1117 Commits

Author SHA1 Message Date
Hoshina 59dee895fc refactor(runtime): drop non-session legacy context compatibility 2026-04-01 20:56:48 +08:00
Hoshina ca9652e120 refactor(session): replace dm scope with dimensions policy 2026-04-01 17:19:50 +08:00
Hoshina 3957e2cc72 feat(session): persist scope metadata and aliases 2026-04-01 16:25:05 +08:00
Hoshina bb2167e3f3 feat(event): log turn context fields 2026-04-01 15:46:35 +08:00
Hoshina e0ceea91f6 refactor(context): carry route and scope through runtime 2026-04-01 15:23:36 +08:00
Hoshina 79de00f7f3 refactor(agent): carry inbound context through events and hooks 2026-04-01 14:37:43 +08:00
Hoshina fcab3a1b7c refactor(routing): move session allocation out of router 2026-04-01 14:26:12 +08:00
Hoshina 2095ec8700 refactor(agent): route using inbound context 2026-04-01 14:08:44 +08:00
Hoshina 963ed07d69 refactor(channels): emit inbound context in secondary adapters 2026-04-01 13:58:31 +08:00
Hoshina cf11ff70c3 refactor(channels): emit inbound context in primary adapters 2026-04-01 13:50:24 +08:00
Hoshina 9cfa3c3ba6 refactor(inbound): add inbound context compatibility bridge 2026-04-01 13:35:18 +08:00
wenjie 2bf842e460 feat(web): add service log level controls (#2227)
- centralize gateway log level resolution and normalization
- propagate debug flags to spawned launcher and gateway processes
- add a log level selector to the logs page
- cover the new behavior with backend and config tests
2026-03-31 20:32:42 +08:00
Badgerbees 1a44752dc5 fix(agent): prevent double-counting system message tokens in estimator
Treat SystemParts as an alternative representation of message Content
rather than an additive one. This prevents systematic overestimation
of system message tokens which could trigger premature context
pruning or summarization.
- Picks the maximum of Content vs. SystemParts to stay conservative.
- Adds a per-part overhead (20 chars) to account for JSON metadata.
- Streamlines the ReasoningContent counting logic.
Fixes a deficiency where structured blocks for cache-aware adapters
caused overestimated budgets or hidden overflows.
2026-03-31 17:09:01 +07:00
Badgerbees 93f391a6bf fix(agent): include SystemParts in token estimation and add reasoning guards 2026-03-31 16:33:24 +07:00
Cytown e4893d27d7 fix test and lint in web (#2219) 2026-03-31 15:50:55 +08:00
Cytown 31fcf55297 fix linter (#2206) 2026-03-31 15:06:47 +08:00
LC ee02e30992 feat(provider): add lmstudio and align local provider default auth/base handling (#2193)
* feat(provider): add lmstudio vendor and local no-key behavior

* refactor(provider): consolidate protocol metadata and local tests

* fix(provider): sync lmstudio probing and model normalization

* test(web): format lmstudio model status cases for golines
2026-03-31 14:48:18 +08:00
DimonB c36b06a901 Fix Telegram HTML links broken by italic regex matching inside href URLs (#2164)
reItalic (_text_) ran after reLink converted [text](url) to <a href>,
injecting <i> tags into URLs containing underscores (e.g. Google Flights
URL-safe base64 in the tfs param). Telegram silently dropped such malformed
<a> tags, causing only 1 of 3 links to appear in messages.

Fix: extract markdown links into placeholders before any formatting runs,
restore them as <a href> last — same pattern used for code blocks.
2026-03-31 11:46:06 +08:00
DimonB 6c0798ca3f feat(channels): make Channel.Send return delivered message IDs (#2190)
* feat(channels): Channel.Send and MediaSender.SendMedia return delivered message IDs

Change Channel.Send signature from (ctx, msg) error to (ctx, msg) ([]string, error)
and MediaSender.SendMedia similarly, so callers can capture platform message IDs
for threading, reactions, and history annotation.

Adapters that return real IDs: Telegram (per-chunk MessageID), Discord (Message.ID),
Slack Send (ts), QQ (sentMsg.ID), Matrix (EventID). Slack SendMedia returns nil
because UploadFileV2 does not expose the posted message timestamp in its response.
All other adapters return nil IDs.

preSend and sendWithRetry in manager.go updated to propagate ([]string, bool).
README examples updated for both English and Chinese docs.

* style: apply golangci-lint fixes (golines)

* docs: fix Send migration guide — restore old error-only signature in before/after example
2026-03-31 11:07:32 +08:00
Mauro 2d8556205f feat(telegram): include quoted reply context and media in inbound turns (#2200) 2026-03-31 10:46:41 +08:00
Mauro 4d34824737 Merge pull request #2088 from badgerbees/fix/telegram-dm-policy-security
fix(channels): add security audit for open-by-default bots
2026-03-30 23:58:25 +02:00
Mauro 4125f8ac14 Merge pull request #1849 from gaaralbakuu/main
Fix: Provider github copilot cannot create session
2026-03-30 23:37:26 +02:00
Mauro 7b3f47128f Merge pull request #2176 from Alix-007/fix/issue-2135-retry-after
fix(utils): honor Retry-After for 429 retries
2026-03-30 16:27:46 +02:00
Alix-007 711685192c utils: gofumpt http retry formatting 2026-03-30 22:08:21 +08:00
Alix-007 345d4fddc9 utils: make retry-after numeric clamp overflow-safe 2026-03-30 22:02:16 +08:00
Alix-007 9440bebca6 utils: anchor date retry-after to response date and cap delay 2026-03-30 21:58:12 +08:00
Mauro ffa65b53ed Merge pull request #1982 from Kathent/fix-deny-pattern
fix: more accurate deny pattern for disk wiping
2026-03-30 14:24:17 +02:00
Mauro 0fb45505bf Merge pull request #1988 from loafoe/main
feat(bedrock): detect SSO token expiration and provide actionable error
2026-03-30 14:17:19 +02:00
Mauro 45582b0b52 Merge pull request #1510 from dim/matrix/improved-formatting
Improve white-space and general rendering of CommonMark in Matrix
2026-03-30 14:02:19 +02:00
daming大铭 a5f8b0f98d Merge pull request #2134 from cytown/t3
add pid file for gateway running and auth token for /reload and pico channel
2026-03-30 18:55:01 +08:00
Mauro 1154017563 Merge pull request #2129 from kunalk16/chore-azure-openai-responses-tests
chore(tests): update tests and error cases handling for azure openai provider
2026-03-30 12:29:41 +02:00
Cytown f9bfa6b9a8 Merge branch 'main' into t3 2026-03-30 18:07:20 +08:00
Cytown 50b8d9bf83 Merge branch 'main' into t3 2026-03-30 18:01:07 +08:00
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
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
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
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