Commit graph

391 commits

Author SHA1 Message Date
stevef
9b9796e52f fix: enforce synchronous typing-stop signaling for Monitor UI stability 2026-04-13 21:52:26 +02:00
stevef
841bd0098a chore: address linter issues from PR review 2026-04-04 06:28:09 +02:00
stevef
f53e50c96a Final resolution of all merge conflicts and config cleanup 2026-04-03 22:49:25 +02:00
stevef
db2349cf4d feat(isolation): further hardening for agent loop and tools 2026-04-03 21:40:07 +02:00
stevef
afebbd3650 fixes 2026-04-03 21:40:07 +02:00
stevef
253412a526 fix(agent): inject media store in isolation and fix config unmarshal panic 2026-04-03 21:40:07 +02:00
stevef
3d621b6401 chore: minor configuration updates 2026-04-03 21:40:07 +02:00
stevef
5ca9b1c349 Remove deprecated /cgat and loop detection endpoints from server and docs 2026-04-03 21:35:55 +02:00
stevef
7dee43b0dc test: merge filesystem isolation validation into isolation_tools_test.go 2026-04-03 21:32:00 +02:00
stevef
5913149664 fix(agent): ensure isolated agents inherit manually registered tools to prevent test hangs 2026-04-03 21:32:00 +02:00
stevef
1bb3ca49ab made paths relative to workspace for sub-agents 2026-04-03 21:32:00 +02:00
stevef
3c6639517d azure skills whitelisting: fix skills loader, security config, and tests 2026-04-03 21:32:00 +02:00
stevef
8d95449084 added two new providers: NVIDIA and Azure plus Security enhancments to lock down skills if desired and added a configurable chat API 2026-04-03 21:32:00 +02:00
stevef
d8f440b7c5 Stabilize PicoClaw Security Integration and Agent Shield Features
Resolved rebase conflicts, fixed build errors across pkg/tools and pkg/providers, and fully integrated the Agent Shield security suite (Canary, PII, IPIA, Policy, Behavior).

Key stabilization:
- Fixed filesystem tool constructor signatures and tests.
- Re-implemented timing-safe authentication in health/server.go.
- Synchronized gateway and channel manager initialization.
- Cleaned up architecture leakage and deprecated endpoints (/cgat).
- Removed local/sensitive paths from logs and .dockerignore.
2026-04-03 21:23:57 +02:00
stevef
066a6bc727 chore: stabilize build pipeline, fix lints and test panics 2026-04-03 20:55:13 +02:00
Mauro
d8c5183d9a
feat(mcp): store oversized text results as artifacts (#2308)
* feat(mcp): store oversized text results as artifacts

* feat(mcp): fix doc

* fix(mcp): preserve raw MCP payload in text artifacts

* fix(mcp): avoid leaking large text when artifact persistence fails

* chore(mcp): clarify inline text limit and cover artifact edge cases
2026-04-04 01:30:36 +08:00
stevef
6c0f36a44d fix(test): update NewContextBuilder call to match new signature 2026-04-03 15:14:13 +02:00
stevef
6c277610df feat(isolation): further hardening for agent loop and tools 2026-04-03 15:01:12 +02:00
stevef
f2ffc6cc31 fixes 2026-04-03 15:01:12 +02:00
stevef
8dc92fdedc fix(agent): inject media store in isolation and fix config unmarshal panic 2026-04-03 15:01:12 +02:00
stevef
570be19935 chore: minor configuration updates 2026-04-03 15:01:12 +02:00
stevef
9479c65ebb test: merge filesystem isolation validation into isolation_tools_test.go 2026-04-03 15:01:12 +02:00
stevef
386a93a13c fix(agent): ensure isolated agents inherit manually registered tools to prevent test hangs 2026-04-03 15:01:12 +02:00
stevef
eaf61a1e8a made paths relative to workspace for sub-agents 2026-04-03 15:01:12 +02:00
stevef
c72f9fe47e azure skills whitelisting: fix skills loader, security config, and tests 2026-04-03 15:01:12 +02:00
stevef
d3c64bcc1e added two new providers: NVIDIA and Azure plus Security enhancments to lock down skills if desired and added a configurable chat API 2026-04-03 15:01:12 +02:00
wenjie
f2a19ab947
feat(web): support image messages in pico chat (#2299) 2026-04-03 14:15:20 +08:00
Mauro
b114dcaeb1
feat(model): llm rate limiting (#2198)
* feat(model): rate limiting

* fix(agent): preserve per-model identity in rate limiting and fallback

* fix test
2026-04-02 19:26:26 +08:00
Mauro
bae4342af1
Feat/tool read_file by lines (#1981)
* feat(tool): read_file tool by lines

* fix test

* restore old bytes read_file tool

* unified read_file tool

* revert

* fix doc

* fix test

* fix doc

* fix offset

* fix default start_line

* fix line format

* fix bug

* removed legacy test

* enhanced infos

* improvements

* feat(tool): read_file tool by lines
2026-04-02 18:49:08 +08:00
Liu Yuan
7eba27c3c4
feat: add ContextManager abstraction for pluggable context management (#2203)
- Define ContextManager interface with Assemble/Compact/Ingest methods
- Implement legacyContextManager wrapping existing summarization logic
- Wire Assemble (before BuildMessages), Compact (post-turn + overflow),
  and Ingest (after message persistence) into agent loop
- Add ContextManager config field and factory registry with config passthrough
- Remove old maybeSummarize/summarizeSession/summarizeBatch/etc from loop.go
- All existing tests pass with default (legacy) config

Co-authored-by: Liu Yuan <namei.unix@gmail.com>
2026-04-02 00:08:15 +08:00
Cytown
9ac21c5908
add missing recover panic in subturn.go (#2253) 2026-04-01 23:44:41 +08:00
Cytown
e2a9bb97c7
unify all panic event to panic log file (#2250) 2026-04-01 23:26:49 +08:00
reusu
31afad6e87
feat: add load_image tool for local file vision (#2116)
* feat: add load_image tool for local file vision

* fix: address load_image PR review feedback

- Exclude load_image from sub-agent tools via Unregister after Clone,
  since RunToolLoop does not call resolveMediaRefs
- Add ToolRegistry.Unregister() method
- Fix scope collision: use channel:chatID instead of filename
- Add channel/chatID context resolution matching send_file pattern
- Add comment explaining iteration > 1 guard on resolveMediaRefs
- Remove emoji from ForUser for consistency with send_file
- Add load_image_test.go

* feat: enable load_image for subagents via MediaResolver in RunToolLoop

Instead of removing load_image from sub-agent tools (28f69e71), inject a
MediaResolver into the legacy RunToolLoop fallback path so media:// refs
are resolved to base64 before each LLM call — matching the main agent
loop behavior.

- Add MediaResolver field to ToolLoopConfig and call it on iteration > 1
- Add SubagentManager.SetMediaResolver() and wire it through runTask
- Remove ToolRegistry.Unregister() (no longer needed)
- Restore load_image in sub-agent tool set (revert Clone+Unregister)
- Add TestSubagentManager_SetMediaResolver_StoresResolver

* refactor(load_image): remove prompt parameter from tool schema

* test(tools): add success-path test for LoadImageTool

Add TestLoadImage_SuccessPath that creates a real PNG file with valid
magic bytes, calls Execute with WithToolContext, and verifies:
- result.IsError == false
- ToolResult.Media contains a media:// ref
- ToolResult.ForLLM contains the [image: marker
- media ref is resolvable in the store

Add explanatory comment in loop.go for why Media and ArtifactTags
coexist on non-ResponseHandled tool results (e.g. load_image).

* fix: preallocate slice in tests and add ResponseHandled guard in toolloop

Fix prealloc linter failure in load_image_test.go.

Prevent double-resolving media by checking ResponseHandled in toolloop.go.

* Register TTS tool if provider is available

---------

Co-authored-by: Reusu <admin@yumao.name>
Co-authored-by: 美電球 <hoshina@evaz.org>
2026-04-01 21:32:10 +08:00
Hua Audio
0f395ce110
Refactor/asr tts (#1939)
* refactor: update ASR and TTS implementations

* fix lint

* Integrating asr/tts models w/ new security config

* update documents

* add arbitrary whisper transcriptor support

* update documents

* fix lint

* add mimo tts
2026-04-01 12:21:21 +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
stevef
fc2943cb1a fix: gracefully handle LLM content safety filter refusals to prevent 500 errors 2026-03-31 11:55:56 +02:00
Badgerbees
93f391a6bf fix(agent): include SystemParts in token estimation and add reasoning guards 2026-03-31 16:33:24 +07:00
stevef
dc52457826 feat: security hardening for pii redaction and isolation tests 2026-03-31 08:50:37 +02: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
stevef
bf6a2c3b4d fix: final test updates for inline guardrails 2026-03-30 17:18:21 +02:00
stevef
91e533fe60 fix: update hook tests for inline guardrails 2026-03-30 16:35:31 +02:00
stevef
7bd508a894 fix: update security tests for inline guardrails 2026-03-30 16:20:09 +02:00
stevef
415151bd48 feat: implement inline guardrails and refine security system prompt for better utility and protection against indirect injection 2026-03-30 16:12:25 +02:00
Cytown
50b8d9bf83 Merge branch 'main' into t3 2026-03-30 18:01: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
stevef
a2e3789c46 feat: add system_prompt to agent defaults and k3s configuration for safety hardening 2026-03-29 22:59:02 +02:00
Cytown
9c28870e80 Merge branch 'main' into t3 2026-03-29 16:48:56 +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
stevef
dddf983a95 feat(isolation): further hardening for agent loop and tools 2026-03-28 20:42:48 +01:00
stevef
109b08e23b fixes 2026-03-28 20:42:48 +01:00