2226 Commits

Author SHA1 Message Date
David Siewert 38baf1ccd0 fix(agent): normalize nil args and improve error handling in FormatArgsJSON
- Return fmt.Sprintf fallback instead of {} on encoding errors to preserve visibility
- Normalize nil to empty map in FormatArgsJSON for consistent output
- Remove redundant nil check in toolFeedbackArgsPreview wrapper
- Update test expectation: nil args now return {} not null
2026-04-27 16:31:20 +06: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
David Siewert 97b1c3efec fix duplicate toolFeedbackArgsPreview function declaration 2026-04-27 15:42:18 +06:00
Guoguo 0161298154 ci: add stale bot to auto-close inactive issues and PRs (#2685)
Two-phase strategy: 7 days inactive → stale warning, 7 more days → close.
Exempt labels: pinned, keep-open, wip, do-not-close, type: roadmap.
Draft PRs are also exempt. Runs daily at 03:00 JST.
Scan oldest items first (ascending: true) with 500 ops budget to avoid
backlog starvation.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-27 17:15:02 +08:00
ex-takashima 188ee24d2e Merge remote-tracking branch 'origin/main' into refactor/line-sdk
# Conflicts:
#	go.mod
#	go.sum
2026-04-27 17:47:41 +09:00
美電球 f90e756e21 Merge pull request #2663 from SiYue-ZO/feature/config-save-restart-prompts
feat: improve config save and restart feedback
2026-04-27 15:45:38 +08:00
Hoshina 78fd080189 fix(events): keep runtime observers non-blocking
Add a non-blocking runtime publish path and switch hot-path publishers to it.

Enforce subscription timeout boundaries, keep ordered subscriber snapshots up to date on subscribe changes, expose all runtime kinds to process hooks, add safe log attrs for non-agent events, and close the gateway message bus on full shutdown.
2026-04-27 13:09:03 +08:00
Mauro ed687d62ae fix(config): show precise malformed config diagnostics (#2415)
* fix(config): show precise malformed config diagnostics

* fix lint

* fix test
2026-04-27 09:45:52 +08:00
dtapps f62e8621fc docs: fix agents.defaults model configuration format
Change incorrect object format model.primary/fallbacks to correct
flat format model_name/model_fallbacks in Agent defaults example.

The AgentDefaults struct does not support the object format used
in AgentConfig, so the documentation example was misleading.
2026-04-27 09:30:11 +08:00
afjcjsbx 4eeb69688e fix lint 2026-04-26 22:33:35 +02:00
afjcjsbx 1ff8a418f6 fix(mcp): sanitize MCP tool schemas for Gemini function calling 2026-04-26 22:23:55 +02:00
SiYue-ZO ddf2d7c655 fix gateway boot signature after pico setup 2026-04-26 22:09:00 +08:00
SiYue-ZO cbe6a0907c feat: complete tool and model restart feedback 2026-04-26 22:09:00 +08:00
SiYue-ZO 02d9a0d190 feat: track channel and web search restart requirements 2026-04-26 22:09:00 +08:00
SiYue-ZO afc600baed feat: add config save and restart prompts 2026-04-26 22:09:00 +08:00
美電球 39dec35408 Merge pull request #2672 from lc6464/fix-tool-calls-thought-ui
feat(pico): add structured tool call support to web chat
2026-04-26 21:27:28 +08:00
lc6464 d6b38c4236 fix(chat): update tool_calls structure and ensure kind is always set 2026-04-26 20:13:13 +08:00
LC 1b9e7e32bd fix(chat): add \r? for regular expressions
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-26 19:59:55 +08:00
lc6464 1acab59fc7 fix(tests): format error message 2026-04-26 19:48:22 +08:00
lc6464 bfc37b784e fix(channels): bypass placeholder edits for thought and tool calls 2026-04-26 19:43:25 +08:00
Hoshina 4d6337fd26 fix runtime event logger reload and shutdown 2026-04-26 19:28:26 +08:00
Hoshina b3d9f86a01 feat(events): add configurable runtime event logging 2026-04-26 17:41:00 +08:00
Hoshina f4a24614b8 docs(events): remove stale subturn event names
Replace leftover SubTurnOrphanResultEvent and short subturn event references with runtime event kinds in comments, tests, and hook design notes.

Validation: GOCACHE=/tmp/picoclaw-go-cache go test ./pkg/agent -run TestSpawnSubTurn_OrphanResultRouting; make lint
2026-04-26 17:04:38 +08:00
Hoshina e613258fa5 feat(gateway): publish lifecycle runtime events
Emit gateway.start, gateway.ready, and gateway.shutdown on the shared runtime event bus, while keeping reload events on the same helper path.

Update subturn architecture docs to refer to runtime event kinds instead of the removed agent EventBus names.

Validation: GOCACHE=/tmp/picoclaw-go-cache go test ./pkg/gateway ./pkg/events; GOCACHE=/tmp/picoclaw-go-cache go test ./pkg/bus ./pkg/channels ./pkg/mcp ./pkg/tools/integration ./pkg/events ./pkg/gateway; make lint
2026-04-26 17:02:48 +08:00
Hoshina 795ee362ea refactor(events): emit agent runtime events directly
Remove the legacy EventKind/Event envelope mapping and let agent event emission build pkg/events.Event values directly.

Keep HookMeta as the shared hook metadata shape and preserve legacy observe string aliases by mapping them to runtime event kinds.

Validation: GOCACHE=/tmp/picoclaw-go-cache go test ./pkg/agent; make lint
2026-04-26 16:55:02 +08:00
Hoshina b954e6b8dc refactor(events): remove legacy agent event bus
Drop the old agent EventBus, SubscribeEvents/EventDrops public surface, legacy hook observer dispatch, and hook.event process notification path. Agent observations now flow through pkg/events runtime events.

Validation: go test ./pkg/agent; make lint
2026-04-26 16:39:35 +08:00
Hoshina fce800414d docs(events): align hook design with runtime observation
Mark the original hook design as an early record and update observer examples to pkg/events runtime events and hook.runtime_event.

Validation: make lint
2026-04-26 16:33:18 +08:00
Hoshina b2249df3ea refactor(events): split agent event payload types
Move agent domain event payload structs out of the legacy event envelope file so the remaining EventKind/Event/EventMeta compatibility layer can be removed independently later.

Validation: go test ./pkg/agent; make lint
2026-04-26 16:31:52 +08:00
Hoshina 6e8a81bfbf test(events): prefer runtime hook observation
Use RuntimeEventObserver for the normal in-process hook observer path and make the process-hook helper assert hook.runtime_event notifications.

Validation: go test ./pkg/agent; make lint
2026-04-26 16:28:41 +08:00
Hoshina dc80e8f5f2 test(events): migrate agent tests to runtime events
Move AgentLoop event assertions to the runtime event stream and keep the legacy SubscribeEvents test only for dual-publish compatibility.

Validation: go test ./pkg/agent; make lint
2026-04-26 16:23:58 +08:00
Hoshina d9717b5632 refactor(events): start runtime event consumer migration
Deprecate the legacy agent event APIs and add a runtime event test helper, then migrate the follow-up queued test to the runtime event stream.

Validation: go test ./pkg/agent; make lint
2026-04-26 16:11:09 +08:00
Hoshina 8caf9aeb2b feat(events): publish runtime service events
Migrate hook observation to runtime events and update the process hook notification protocol. Add runtime event publication for message bus failures, channel lifecycle/outbound flow, gateway reloads, MCP server state, and MCP tool calls.

Validation: go test ./pkg/events/... ./pkg/bus ./pkg/agent ./pkg/channels ./pkg/mcp ./pkg/tools/integration ./pkg/gateway; make lint
2026-04-26 16:05:10 +08:00
Hoshina eedebabbea feat(events): add runtime event bus
Introduce pkg/events with filtered channels, subscription policies, backpressure, and stats. Wire AgentLoop to dual-publish legacy agent events into runtime events while preserving old event APIs.

Validation: go test ./pkg/events/... ./pkg/agent; go test -race ./pkg/events/...; make lint
2026-04-26 15:36:03 +08:00
David Siewert f0dc709b17 fix(config): fix golines max-len for MaxLLMRetries field 2026-04-26 07:07:19 +06:00
David Siewert 4ddd650be4 align ToolFeedbackConfig field spacing 2026-04-26 07:06:36 +06:00
lc6464 9d42282672 fix(chat): tolerate animated legacy tool feedback parsing 2026-04-26 01:19:19 +08:00
David Siewert 9bc702ebaf fix test: enable pretty_print in tool feedback test 2026-04-25 23:09:40 +06:00
David Siewert 612097b411 fix(config): align gci formatting for LLM retry fields 2026-04-25 23:01:45 +06:00
lc6464 303ff8137d feat(chat): unify reasoning and tool call visibility 2026-04-26 00:50:18 +08:00
lc6464 6d04d15ce0 fix(tool-feedback): dedupe duplicate content and keep full explanations 2026-04-26 00:40:55 +08:00
David Siewert bdaff5cb69 Add pretty_print and disable_escape_html to tool_feedback defaults 2026-04-25 22:27:01 +06:00
David Siewert 1b2f8aac79 fix(config): align indentation for new LLM retry default fields 2026-04-25 22:12:41 +06:00
David Siewert 32c8b8ce6a chore(config): add default values for max_llm_retries and llm_retry_backoff_secs 2026-04-25 22:09:44 +06:00
David Siewert d2f6a08981 fix(config): align gci formatting for MaxLLMRetries field 2026-04-25 22:07:16 +06:00
lc6464 5cd10b594a feat(pico): add support for tool_calls in chat messages 2026-04-25 23:43:10 +08:00
David Siewert 3c4523e7aa test(agent): add unit tests for network error retry backoff strategy
- Test all network error types trigger retry (connection_reset, broken_pipe, read_tcp, eof, connection_refused)
- Test custom MaxLLMRetries and LLMRetryBackoffSecs config is respected
- Test retry count limit (1 initial + maxRetries retries)
- Add countingErrorProvider mock for deterministic call count verification
2026-04-25 21:19:13 +06:00
David Siewert fc89fea319 test(utils): add unit tests for FormatArgsJSON
Add tests for FormatArgsJSON covering:
- Default compact JSON output
- Pretty print formatting
- HTML escape disabling (preserves &&, <, >)
- Combined pretty print and escape disable
- Default HTML escaping behavior
- Nil args handling
2026-04-25 21:14:06 +06:00
David Siewert bcc3d447a1 feat(agent): add pretty_print and disable_escape_html options for tool feedback
- Add PrettyPrint and DisableEscapeHTML config options to ToolFeedbackConfig
- Add FormatArgsJSON helper function with configurable pretty printing and HTML escaping
- Add toolFeedbackArgsPreviewWithOptions to pass formatting options
- Update pipeline_execute.go to use new formatting options for tool feedback

This fixes the issue where '&&' would be displayed as '\u0026' in tool
feedback messages and provides optional pretty-printing for better
readability.
2026-04-25 20:46:16 +06:00
David Siewert 06fad95719 feat(agent): add network error retry with configurable max retries and backoff
- Add isNetworkError detection for connection reset, broken pipe, read/write tcp, EOF
- Add retry logic with configurable exponential backoff for network errors
- Add config options max_llm_retries and llm_retry_backoff_secs in agents.defaults
- Network errors now retry with backoff (was previously not retried)
- Timeout errors now use configurable backoff instead of hardcoded 5s
- Default: 2 retries with 2s backoff (3 total attempts)
2026-04-25 19:08:46 +06:00
美電球 77be169db4 Merge pull request #2654 from SiYue-ZO/fix/launcher-hide-windows-console-flash
fix(launcher): hide windows child-process console flashes
2026-04-25 18:00:50 +08:00