picoclaw/pkg/agent
admin-mf 9a0b281734 forward-port: multi-tenancy hint plumbing on agent processOptions (phase 1)
Re-applies the tenant-isolation extension from the deleted pkg/agent/loop.go
to upstream's split agent_*.go layout. Phase 1 plumbs the protocol; Phase 2
(future PR) wires effective sessions / provider / context per turn.

What's added:
- New file pkg/agent/agent_tenant.go (kept isolated for sync friendliness):
  - extractTenantOverrides reads workspace_override, config_dir,
    allowed_tools, allowed_skills from msg.Context.Raw
  - Validates workspace_override and config_dir resolve within the
    workspace_root boundary set in agents.defaults; rejects path escape
  - Fails closed when any override is present but workspace_root is unset,
    so tenants cannot bypass the security boundary
  - applyTo copies the overrides onto processOptions
  - logIfPresent logs a single line summarising tenant routing per turn
- processOptions in agent.go gains four override fields (WorkspaceOverride,
  ConfigDir, AllowedTools, AllowedSkills)
- agent_message.go processMessage extracts and applies the overrides right
  after building processOptions
- agent_tenant_test.go covers the happy path, escape rejection, missing
  boundary rejection, and CSV parsing

Phase 2 will introduce effSessions, effContextBuilder, effProvider, effModel
on processOptions and thread them through pipeline_llm/turn_state/context_*
so each tenant turn runs against an isolated session store, context builder,
and provider credential set. Phase 2 is deferred because:
- MagicForm doesn't currently send webhook traffic (verified), so phase 1's
  protocol-level plumbing has no live consumer that requires the swap yet.
- Phase 2 needs design discussion (per-tenant credential storage, session
  backend selection) that warrants its own focused PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 12:20:23 -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 forward-port: multi-tenancy hint plumbing on agent processOptions (phase 1) 2026-05-07 12:20:23 -05: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 forward-port: multi-tenancy hint plumbing on agent processOptions (phase 1) 2026-05-07 12:20:23 -05: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_tenant.go forward-port: multi-tenancy hint plumbing on agent processOptions (phase 1) 2026-05-07 12:20:23 -05:00
agent_tenant_test.go forward-port: multi-tenancy hint plumbing on agent processOptions (phase 1) 2026-05-07 12:20:23 -05: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