Commit Graph

12 Commits

Author SHA1 Message Date
huanghuoguoguo
8db23bf950 feat(agent-runner): add event-first context facts and pull APIs
Add EventLog and Transcript persistence entities for storing auditable
event facts and conversation history projection. Implement event-first
AgentRunContext builder that produces Protocol v1 compliant context
payloads with required fields: event, delivery, context (ContextAccess).

Key changes:
- EventLog ORM: auditable event records with indexes
- Transcript ORM: conversation history projection with composite indexes
- AgentRunContextBuilder: Protocol v1 payload with delivery, context, bootstrap
- EventLogStore/TranscriptStore: async stores for fact sources
- Host action handlers: HISTORY_PAGE, HISTORY_SEARCH, EVENT_GET, EVENT_PAGE
- Context validation: build_context output validates via SDK AgentRunContext
- Alembic migration for event_log and transcript tables
- Alembic env.py imports all ORM models for autogenerate discovery

Legacy compatibility: max-round messages go into bootstrap.messages and
compatibility.legacy_messages, not top-level messages field.
2026-05-23 16:07:46 +08:00
huanghuoguoguo
094b87e578 fix(agent-runner): package context for plugin execution 2026-05-21 13:56:17 +08:00
huanghuoguoguo
26923c66c0 feat: make agent runner config schema driven 2026-05-19 12:20:28 +08:00
huanghuoguoguo
7d6f635664 chore(agent): remove v1 wording from runner internals 2026-05-19 10:27:40 +08:00
huanghuoguoguo
927388c1f7 feat(agent): reserve stable runner event names 2026-05-19 10:15:00 +08:00
huanghuoguoguo
036affe01f feat(agent-runner): enrich plugin runner host context 2026-05-17 23:26:52 +08:00
huanghuoguoguo
19557c3227 fix: log agent runner best-effort failures 2026-05-17 11:07:52 +08:00
huanghuoguoguo
b9ecb27560 test: address agent runner review comments 2026-05-17 11:07:52 +08:00
huanghuoguoguo
ac3989d3ba feat: support dynamic agent runner defaults 2026-05-17 11:07:52 +08:00
huanghuoguoguo
6e982ff49d feat(plugin): implement INVOKE_RERANK handler with run-scoped authorization
- Add invoke_rerank action handler in plugin handler
- Validate rerank model access via run session
- Cap documents at 64 for API limit
- Return sorted results by relevance score
2026-05-17 11:07:52 +08:00
huanghuoguoguo
66eaa99887 perf(agent-runner): improve session registry and orchestrator efficiency
- Add pre-computed _authorized_ids (frozenset) at session registration for O(1) lookup
- Refactor is_resource_allowed() from linear search to set membership check
- Add thread-safe locking to get_session_registry() singleton
- Cache _session_registry and _state_store references in orchestrator __init__
- Add asyncio.gather() for parallel resource building in AgentResourceBuilder
- Create shared test fixtures in tests/unit_tests/agent/conftest.py
- Update test files to import from shared conftest.py

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 11:07:52 +08:00
huanghuoguoguo
5aaa422250 feat(agent-runner): integrate AgentRunner Protocol v1 with plugin system
Phase 0 integration complete - verified minimal loop with local-agent stub runner.

Changes:
- Add AgentRunOrchestrator for plugin-based agent execution
- Add AgentResultNormalizer for Protocol v1 result conversion
- Add AgentRunnerDescriptor for runner ID parsing (plugin:author/name/runner)
- Update chat handler to use new orchestrator instead of direct runner lookup
- Add plugin handler methods for list_agent_runners and run_agent
- Add connector methods for AgentRunner protocol forwarding
- Update pipeline API to include runner options in metadata
- Add integration docs and implementation plan

Integration verified:
- Runner: plugin:langbot/local-agent/default
- Input: "你好"
- Output: [stub] Echo: 你好
- Date: 2026-05-10 10:09

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 11:05:27 +08:00