Commit Graph

506 Commits

Author SHA1 Message Date
afjcjsbx 9bb44b0a80 fix lint 2026-05-23 09:42:56 +02:00
afjcjsbx 6a97b1b087 Merge remote-tracking branch 'upstream/main' into fix/seahorse-fresh-tail-budget
# Conflicts:
#	pkg/agent/pipeline_llm.go
#	pkg/agent/pipeline_setup.go
#	pkg/agent/turn_state.go
2026-05-23 09:33:33 +02:00
lc6464 3a454593ca feat(openai_compat): map DeepSeek thinking fields 2026-05-23 10:51:24 +08:00
LiusCraft 33e5503e26 fix(session): normalize CreatedAt in SessionManager AddFullMessage/SetHistory 2026-05-22 13:42:35 +08:00
LiusCraft fd08ebd3db fix(test): read back history after SetHistory in steering test for CreatedAt normalization 2026-05-22 13:15:56 +08:00
LiusCraft 34e73f6b1a fix(test): read back history after SetHistory to account for CreatedAt normalization 2026-05-22 13:15:56 +08:00
LiusCraft 81bbef62b1 feat(session): add per-message created_at timestamps
- Persistence layer (jsonl.go addMsg/SetHistory) normalizes CreatedAt
  when missing so the invariant is guaranteed at the storage boundary
- API layer (session.go) exposes created_at on all transcript message
  types with session.updated fallback for legacy messages
- Frontend uses per-message timestamps when available
- messagesContentEqual ignores CreatedAt for tail-matching after
  JSONL roundtrip

Fixes #2787
2026-05-22 13:15:56 +08:00
lxowalle 2992eccbf0 feat: add request-scoped context policies (#2914)
* feat: add request-scoped context policies

Add named turn profiles under agents.defaults so callers can opt into
per-request context and tool policies without changing default chat behavior.

Profiles can disable history, system context, skill prompts, or tools, and can
limit skills/tools with allow lists. Wire profile selection through Pico message
payloads, agent turn execution, Web chat selection, and Web visual config.

Reject invalid turn profiles before saving config through Web APIs and document
the new request context policy behavior.

* fix: address turn profile review blockers

* feat: simplify request context policy config

* fix: suppress tool prompt when turn tools are disabled

* fix: enforce turn profile tool restrictions
2026-05-22 10:06:40 +08:00
lxowalle e7e21df354 fix(agent): honor explicit thinking off (#2898)
* fix(agent): honor explicit thinking off

* fix(agent): address thinking off lint failures

* Clarify unset thinking level display

* fix ci
2026-05-21 11:07:39 +08:00
afjcjsbx f0dcba8c5a fix(seahorse): preserve active tool-call turn when trimming fresh tail 2026-05-20 09:16:09 +02:00
LC b7db059544 feat(chat,seahorse): persist and display model_name across history (#2897)
* feat(chat,seahorse): persist and display model_name across history

* test(seahorse): fix lint regressions in repair coverage

* fix(pico): preserve model_name in live updates

* fix(pico): preserve model_name through live stream wrappers
2026-05-20 13:42:21 +08:00
lxowalle 639b32703a feat: support streaming (#2892)
* Support streaming

* fix: stream pico reasoning updates

Route Pico reasoning through the active streamer and hide empty thought placeholders.

* fix: harden configured streaming delivery

* fix ci

* fix split issue
2026-05-19 16:38:47 +08:00
afjcjsbx fe7ded5c13 fix(agent): preserve active turn during context retry rebuild 2026-05-19 09:18:39 +02:00
afjcjsbx 1502636bf0 fix(seahorse): enforce budget on fresh tail and rebuild paths 2026-05-18 21:11:21 +02:00
lc6464 6ae7dc38b9 fix(openai_compat): align MiMo reasoning replay with DeepSeek 2026-05-14 20:59:01 +08:00
lxowalle b3a7b7ad64 feat: agent self evolution (#2847)
* feat: add agent self-evolution

* fix ci

* delete unused doc

* fix lint

* fix evolution review issues
2026-05-11 16:13:27 +08:00
Mauro 6e6293e596 Merge pull request #2158 from afjcjsbx/feat/agent-discovery-prompt
feat(agent): Multi-agent discovery prompt
2026-05-09 13:56:19 +02:00
Mauro f571a142bf Merge pull request #2823 from bogdanovich/fix/parent-session-tool-feedback-cleanup
fix(agent): dismiss tool feedback when outbound is skipped
2026-05-09 11:09:10 +02:00
afjcjsbx 2ae25b1038 fix(agent): treat empty AGENT.md tools as allow none 2026-05-09 10:35:13 +02:00
Anton Bogdanovich e1ed47b0ff fix(agent): remove unused scheduled helper 2026-05-09 00:53:23 -07:00
Anton Bogdanovich 8362203631 fix(agent): transcribe queued voice follow-ups 2026-05-08 13:50:14 -07:00
afjcjsbx 148583e7bb fix(agent): hide discovery when spawn is unavailable 2026-05-08 22:23:50 +02:00
Anton Bogdanovich a3edbcd05e test(agent): satisfy lint for tool feedback cleanup 2026-05-08 10:33:16 -07:00
afjcjsbx c6a09a35e2 fix(agent): suppress MCP discovery when no servers are selectable 2026-05-08 13:48:47 +02:00
afjcjsbx ffa184d183 fix(agent): resolve primary provider from frontmatter model 2026-05-08 13:43:21 +02:00
Anton Bogdanovich 610e9e3fe8 fix(agent): dismiss session tool feedback on skipped outbound 2026-05-07 23:10:56 -07:00
afjcjsbx b8f4257cee fix(agent): filter discovery by spawn permissions 2026-05-07 18:26:09 +02:00
afjcjsbx 96fd887cad fix(agent): match MCP server allowlists case-insensitively 2026-05-07 18:17:37 +02:00
afjcjsbx dd8e247550 fix(agent): align MCP prompt registration with tool allowlist 2026-05-07 14:01:43 +02:00
afjcjsbx 27bd816b1c fix(agent): validate AGENT tool declarations from registry 2026-05-07 13:49:23 +02:00
afjcjsbx f1f6e1131b removed unused code 2026-05-07 13:20:39 +02:00
afjcjsbx 6f6270b39d Merge upstream/main into feat/agent-discovery-prompt 2026-05-07 13:16:30 +02:00
美電球 658961b728 Merge pull request #2531 from is-Xiaoen/feat/delegate-tool
feat(tools): add delegate tool for cross-agent task handoff
2026-05-07 11:25:41 +08:00
Mauro 788cda5c7a Merge pull request #2762 from afjcjsbx/feat/stop-command
feat(agent): stop command
2026-05-06 18:19:14 +02:00
afjcjsbx a7e52e8a25 fix(agent): drain scoped follow-up queue when pending stop skips turn startup 2026-05-05 19:24:15 +02:00
xp d601b75268 fix(agent): send SVG attachments as files 2026-05-05 19:36:09 +08:00
Mauro ba4abff4a4 Merge pull request #2670 from david1gp/fix/tool-feedback-pretty-print
feat(agent): add pretty_print and disable_escape_html options for tool feedback
2026-05-04 21:47:32 +02:00
afjcjsbx d63430ab33 fix(agent): don't arm pending stop when /stop targets idle session 2026-05-04 13:10:02 +02:00
afjcjsbx 7a1f5fe8b9 fix test 2026-05-04 09:06:39 +02:00
Hoshina 057683d94c fix(agent): use runtime event kind for LLM retry 2026-05-04 15:06:34 +08:00
afjcjsbx a0245c7b02 feat(agent): stop command 2026-05-04 08:41:29 +02:00
afjcjsbx f3ef7090c5 feat(agent): stop command 2026-05-04 08:41:17 +02:00
Mauro be67aed4dc Merge pull request #2677 from alexhoshina/feat/runtime-events-plan
Feat/runtime events
2026-05-03 23:15:25 +02:00
Mauro 490d90749c Merge pull request #2717 from LiusCraft/feat/deepseek-vision-unsupported-error
feat: add DeepSeek vision unsupported error detection
2026-05-03 20:24:56 +02:00
Mauro 272dee3fca Merge pull request #2669 from david1gp/fix/network-error-retry
feat(agent): add network error retry with configurable max retries and backoff
2026-05-03 20:18:18 +02:00
Guoguo 5db008f384 fix(channels): dismiss tool feedback animation when turn ends via ResponseHandled (#2713)
* fix(channels): dismiss tool feedback animation when turn ends via ResponseHandled

When a tool sets ResponseHandled=true (e.g., send_file), the turn ends
without producing a final assistant response. This meant no outbound
message triggered FinalizeToolFeedbackMessage, leaving the animation
goroutine running indefinitely — editing the Feishu card every 3 seconds
with "." / ".." suffixes long after the tool had finished.

Fix: call DismissToolFeedback at "Tool output satisfied delivery" so the
tracker is cleared and the animation goroutine is stopped immediately.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(adapters): add DismissToolFeedback to channelManagerAdapter

The adapter must implement the new interface method added in the
previous commit, otherwise the package fails to compile.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(channels): pass InboundContext to DismissToolFeedback for topic-aware keys

Telegram forum topics use scoped tracker keys like "chatID/topicID",
resolved via ToolFeedbackMessageChatID with the InboundContext. The
previous nil context caused the lookup to fall back to the raw chatID,
missing the topic-scoped entry and leaving the animation goroutine
orphaned in forum-topic conversations.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* style: wrap long function signatures for golines

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 11:17:55 +08:00
Guoguo cb1e1a3595 fix(feishu): fix image download with API fallback and post image support (#2708)
* fix(feishu): fix image download with API fallback and post image support

- Add Image.Get API fallback when MessageResource.Get fails (different
  permission scope: im:resource vs im:message:readonly)
- Extract and download images from post (rich text) messages
- Extract images from interactive card messages
- Deduplicate post image keys across locales
- Add comprehensive tests for new helpers

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

* feat(media): add image path tags alongside base64 for LLM file access

Images are still base64-encoded into msg.Media for multimodal LLMs,
but now also get [image:path] tags injected into message content so
the LLM knows the local file path for save/forward operations.

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

* refactor(media): only auto-inject images for tool results, not user messages

Channel-received images (role=user) now get path tags only, letting
the LLM decide whether to view via load_image or just operate on
the file. Tool result images (role=tool, e.g. load_image) are
base64-encoded into a synthetic user message appended after the tool
message, since many LLM APIs don't support image_url in tool messages.

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

* fix(media): preserve tool-message ordering for multi-tool-call scenarios

Move synthetic user message (carrying base64 tool images) to after the
entire contiguous tool-message block instead of immediately after each
tool message. This preserves the assistant→tool→tool ordering required
by OpenAI-compatible APIs.

Also fix load_image to use generic [image: photo] placeholder so
injectPathTags can properly replace it with the actual path.

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

* fix(test): update load_image test for [image: photo] placeholder

The test was checking ForLLM for the media:// ref, but load_image now
emits the generic [image: photo] placeholder instead.

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

* fix(media): match all channel image placeholders in injectPathTags

Different channels emit different placeholder formats — Telegram/Feishu
use [image: photo], WeCom/WeChat/Line use bare [image], QQ/Discord use
[image: <filename>]. The previous string-match code only handled
[image: photo], so for the other channels the path tag was appended as
a duplicate, producing content like "[image] [image:/path]".

Switch to per-type regex that matches all generic placeholder shapes
while leaving path tags ([image:/path]) untouched. Also fixes the same
issue for [audio], [video], [file] tags. Added test coverage for the
various placeholder shapes.

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

* fix(media): skip path tag append for JSON content (Feishu cards/posts)

When content is structured JSON (interactive cards, post messages),
injectPathTags now skips the fallback append — only placeholder
replacement is attempted. This prevents corrupting JSON payloads
like {"schema":"2.0",...} with appended [image:/path] tags.

Adds looksLikeJSON() helper and three test cases covering JSON
objects, arrays, and an end-to-end resolveMediaRefs scenario with
Feishu card content.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(media): prepend path tags for JSON content, narrow looksLikeJSON

Two fixes from code review:

1. looksLikeJSON now only checks for '{' prefix (not '['), avoiding
   false positives on regular text like "[update] see attached".

2. For JSON content (Feishu cards/posts), path tags are prepended
   before the JSON instead of being silently dropped. This ensures
   the LLM can discover attached images via the path tag while the
   JSON payload stays valid for downstream parsing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-30 11:08:00 +08:00
LiusCraft 1722cfc282 feat: add DeepSeek vision unsupported error detection
Add detection for 'unknown variant' + 'image_url' error pattern used by
DeepSeek and other strict providers when vision is not supported.
These providers reject the image_url field at the JSON schema level
rather than returning a semantic 'not supported' message.
2026-04-30 02:24:29 +08:00
SiYue-ZO 2114e1a53f feat(config): wire serial tool into runtime and dashboard 2026-04-28 12:56:27 +08:00
David Siewert 8dca2a1319 fix: improve error handling and nil consistency in FormatArgsJSON
- Use fmt.Sprintf fallback instead of {} on encoding errors
- Normalize nil args to {} in FormatArgsJSON for consistent output
- Update tests to expect {} instead of null for nil args

Based on PR #2670 review feedback from afjcjsbx
2026-04-27 16:05:10 +06:00