picoclaw/pkg/agent
admin-mf 93fb7b8794 Merge upstream/main into sync/upstream-2026-05-07
Sync with sipeed/picoclaw upstream/main (~1095 commits since last merge),
including major restructures:

- Launcher migrated to web/backend (#1275): cmd/picoclaw-launcher/* removed.
  Our launcher is dropped (MagicForm doesn't use it; web/backend is the
  upstream replacement when needed).
- Agent loop split (#2585, 12d5421c): pkg/agent/loop.go deleted, replaced by
  pkg/agent/agent_*.go files. Multi-tenancy customizations to be forward-ported
  in follow-up commits on this branch.
- Tool packages reorganized (4c133dc2): pkg/tools/{filesystem,web}.go moved
  to pkg/tools/{fs,integration}/. Customizations to be forward-ported.
- Channels switched to map+Settings model: MagicFormConfig → MagicFormSettings
  registered in config_channel.go alongside other channels; channel constructor
  updated to (channelName, channelType, *Config, *MessageBus) factory pattern.
- Config schema updates: removed deprecated AgentDefaults.Model field;
  removed Config.Bindings (legacy migration in upstream); SessionConfig now
  uses Dimensions instead of DMScope; ExecConfig adds AllowRemote.

Conflicts resolved:
- pkg/agent/loop.go + loop_test.go: accepted upstream deletion (split)
- pkg/tools/{filesystem,web}.go: accepted upstream deletion (moved)
- cmd/picoclaw-launcher/*: dropped (deps deleted upstream, unused by MagicForm)
- cmd/picoclaw/internal/gateway/helpers.go: accepted upstream deletion
- pkg/channels/manager.go: switched to upstream's map-driven channel init
- pkg/config/config.go: merged AgentDefaults fields, kept WorkspaceRoot,
  removed deprecated Model
- pkg/bus/types.go: merged OutboundMessage with upstream's new fields
  (Context, AgentID, SessionKey, Scope, ContextUsage) plus our magicform
  callback fields (Type, Metrics, Progress, Escalation)
- pkg/tools/{cron,shell}.go: combined our customizations with upstream changes
- pkg/skills/installer.go: dropped our LimitReader path (upstream now uses
  chunked DownloadToFile which is size-bounded)

The magicform channel was rebuilt to match upstream's new API:
- *config.MagicFormSettings (SecureString token) instead of MagicFormConfig
- Send returns ([]string, error) per upstream Channel interface
- InboundMessage built with Context (with Raw map for tenancy hints) instead
  of bus.Peer + Metadata field which were removed.

Multi-tenancy hints (workspace_override, config_dir, allowed_tools,
allowed_skills) are still flowing via Context.Raw — the agent loop side of
the integration is forward-ported in a follow-up commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 12:12:44 -05:00
..
adapters fix(channels): dismiss tool feedback animation when turn ends via ResponseHandled (#2713) 2026-04-30 11:17:55 +08:00
interfaces fix(channels): dismiss tool feedback animation when turn ends via ResponseHandled (#2713) 2026-04-30 11:17:55 +08:00
agent.go fix(agent): drain scoped follow-up queue when pending stop skips turn startup 2026-05-05 19:24:15 +02:00
agent_command.go feat(agent): stop command 2026-05-04 08:41:17 +02:00
agent_event.go feat(events): add configurable runtime event logging 2026-04-26 17:41:00 +08:00
agent_init.go Merge pull request #2531 from is-Xiaoen/feat/delegate-tool 2026-05-07 11:25:41 +08:00
agent_inject.go refactor(agent): Agent Looper refactor phase2, restructure pipeline and rename loop files to agent (#2585) 2026-04-21 10:55:50 +08:00
agent_mcp.go feat(events): publish runtime service events 2026-04-26 16:05:10 +08:00
agent_mcp_test.go fix(mcp): surface MCP init failures to command handlers 2026-04-21 11:01:04 +02:00
agent_media.go fix(feishu): fix image download with API fallback and post image support (#2708) 2026-04-30 11:08:00 +08:00
agent_message.go refactor(agent): Agent Looper refactor phase2, restructure pipeline and rename loop files to agent (#2585) 2026-04-21 10:55:50 +08:00
agent_options.go feat(events): add runtime event bus 2026-04-26 15:36:03 +08:00
agent_outbound.go fix(tool-feedback): dedupe duplicate content and keep full explanations 2026-04-26 00:40:55 +08:00
agent_steering.go fix(agent): drain scoped follow-up queue when pending stop skips turn startup 2026-05-05 19:24:15 +02:00
agent_stop.go fix(agent): don't arm pending stop when /stop targets idle session 2026-05-04 13:10:02 +02:00
agent_test.go Merge pull request #2677 from alexhoshina/feat/runtime-events-plan 2026-05-03 23:15:25 +02:00
agent_transcribe.go refactor(agent): Agent Looper refactor phase2, restructure pipeline and rename loop files to agent (#2585) 2026-04-21 10:55:50 +08:00
agent_utils.go fix(agent): send SVG attachments as files 2026-05-05 19:36:09 +08:00
agent_utils_test.go fix(agent): send SVG attachments as files 2026-05-05 19:36:09 +08:00
bootstrap.go CLI overrides, workspace config, MagicForm channel, and security hardening (#1) 2026-03-06 10:16:36 -06:00
context.go Merge upstream/main into sync/upstream-2026-05-07 2026-05-07 12:12:44 -05:00
context_budget.go feat(seahorse): implement short-term memory engine (LCM) (#2285) 2026-04-05 09:05:16 +08:00
context_budget_test.go feat(seahorse): implement short-term memory engine (LCM) (#2285) 2026-04-05 09:05:16 +08:00
context_cache_test.go feat(web): support image messages in pico chat (#2299) 2026-04-03 14:15:20 +08:00
context_legacy.go refactor(events): emit agent runtime events directly 2026-04-26 16:55:02 +08:00
context_manager.go feat(agent): /clear now clears seahorse DB in addition to JSONL 2026-04-13 11:04:45 +08:00
context_manager_test.go test(events): migrate agent tests to runtime events 2026-04-26 16:23:58 +08:00
context_seahorse.go feat(agent): /clear now clears seahorse DB in addition to JSONL 2026-04-13 11:04:45 +08:00
context_seahorse_test.go feat(seahorse): implement short-term memory engine (LCM) (#2285) 2026-04-05 09:05:16 +08:00
context_seahorse_unsupported.go fix(agent): disable seahorse context manager on freebsd/arm (#2417) 2026-04-08 10:57:22 +08:00
context_test.go fix(agent): preserve reused tool call IDs across turns (#2528) 2026-04-15 20:18:09 +08:00
context_usage.go feat(agent): add context usage ring indicator and /context command (#2537) 2026-04-21 16:30:02 +08:00
definition.go merge: resolve conflicts between refactor/agent and main 2026-03-22 19:21:58 +08:00
definition_test.go merge: resolve conflicts between refactor/agent and main 2026-03-22 19:21:58 +08:00
dispatch_request.go fix(session): address review regressions 2026-04-13 22:51:44 +08:00
dispatch_request_test.go fix(session): address review regressions 2026-04-13 22:51:44 +08:00
event_payloads.go refactor(events): split agent event payload types 2026-04-26 16:31:52 +08:00
eventbus_test.go refactor(events): emit agent runtime events directly 2026-04-26 16:55:02 +08:00
events.go refactor(events): emit agent runtime events directly 2026-04-26 16:55:02 +08:00
events_runtime.go fix(events): keep runtime observers non-blocking 2026-04-27 13:09:03 +08:00
hook_mount.go fix(events): keep runtime observers non-blocking 2026-04-27 13:09:03 +08:00
hook_mount_test.go fix(events): keep runtime observers non-blocking 2026-04-27 13:09:03 +08:00
hook_process.go refactor(events): remove legacy agent event bus 2026-04-26 16:39:35 +08:00
hook_process_test.go test(events): prefer runtime hook observation 2026-04-26 16:28:41 +08:00
hooks.go refactor(events): emit agent runtime events directly 2026-04-26 16:55:02 +08:00
hooks_test.go refactor(events): remove legacy agent event bus 2026-04-26 16:39:35 +08:00
instance.go Merge upstream/main into sync/upstream-2026-05-07 2026-05-07 12:12:44 -05:00
instance_test.go refactor: support explicit provider field in model list entries (#2609) 2026-04-22 11:28:47 +08:00
llm_media.go feat: add DeepSeek vision unsupported error detection 2026-04-30 02:24:29 +08:00
memory.go refactor(modernize): apply safe modernize fixes 2026-02-27 16:35:07 +08:00
mock_provider_test.go feat(fmt): Fix formatting 2026-02-19 22:05:15 +02:00
model_resolution.go refactor: support explicit provider field in model list entries (#2609) 2026-04-22 11:28:47 +08:00
pipeline.go refactor(agent): Agent Looper refactor phase2, restructure pipeline and rename loop files to agent (#2585) 2026-04-21 10:55:50 +08:00
pipeline_execute.go Merge pull request #2677 from alexhoshina/feat/runtime-events-plan 2026-05-03 23:15:25 +02:00
pipeline_finalize.go refactor(events): emit agent runtime events directly 2026-04-26 16:55:02 +08:00
pipeline_llm.go fix(agent): use runtime event kind for LLM retry 2026-05-04 15:06:34 +08:00
pipeline_setup.go feat(agent): add structured prompt layering 2026-04-24 18:14:28 +08:00
prompt.go feat(agent): migrate tool prompts to capability slots 2026-04-24 19:36:46 +08:00
prompt_contributors.go feat(agent): migrate tool prompts to capability slots 2026-04-24 19:36:46 +08:00
prompt_test.go fix(agent): preserve prompt hook and cache semantics 2026-04-25 01:25:17 +08:00
prompt_turn.go fix(agent): preserve prompt hook and cache semantics 2026-04-25 01:25:17 +08:00
registry.go refactor(runtime): drop non-session legacy context compatibility 2026-04-01 20:56:48 +08:00
registry_test.go refactor Config to add Version and migratable 2026-03-12 13:52:55 +08:00
runtime_event_logger.go fix runtime event logger reload and shutdown 2026-04-26 19:28:26 +08:00
runtime_event_logger_test.go fix(events): keep runtime observers non-blocking 2026-04-27 13:09:03 +08:00
runtime_event_test.go test(events): migrate agent tests to runtime events 2026-04-26 16:23:58 +08:00
steering.go feat(agent): stop command 2026-05-04 08:41:17 +02:00
steering_test.go fix(agent): drain scoped follow-up queue when pending stop skips turn startup 2026-05-05 19:24:15 +02:00
subturn.go Merge pull request #2531 from is-Xiaoen/feat/delegate-tool 2026-05-07 11:25:41 +08:00
subturn_test.go Merge pull request #2531 from is-Xiaoen/feat/delegate-tool 2026-05-07 11:25:41 +08:00
thinking.go feat: add extended thinking support for Anthropic models (#1076) 2026-03-05 09:51:18 +08:00
thinking_test.go feat: add extended thinking support for Anthropic models (#1076) 2026-03-05 09:51:18 +08:00
turn_context.go refactor(events): emit agent runtime events directly 2026-04-26 16:55:02 +08:00
turn_coord.go feat(agent): stop command 2026-05-04 08:41:17 +02:00
turn_coord_test.go Merge pull request #2669 from david1gp/fix/network-error-retry 2026-05-03 20:18:18 +02:00
turn_state.go feat(agent): stop command 2026-05-04 08:41:17 +02:00