3.0 KiB
3.0 KiB
Wiring for the agent core (integrator checklist)
I did not touch main.cpp, Makefile, src/cli, src/store, src/config, PARITY.md.
Build
- Add to the link line:
-lcurl -lpthread(already-lcurl;-lpthreadfor threads). Static target needs nothing extra (zlib not used). src/llm/py.cppetc. include"unicode_data.h","json.h"relatively; no new include dirs needed beyond the existing-Iper src dir. Noteconsts.h,text.hexist in several src dirs: my files include their own directory first.- Removed legacy files:
src/agent/{exec,loop}.{h,cpp},src/agent/tools.cpp,src/llm/llm.{h,cpp}.main.cpp(ToolRegistry,RegisterAll,RunTurn) andtests/test_main.cpp(llm::ChatClient("openai", ...),ModelHealth,Opencode,feed_sse,provider_info) use that removed placeholder API: replace theruncommand withagent::Agentand drop those test sections.src/agent/agent.mkandsrc/llm/llm.mkare stale (unused by the Makefile). - Test targets (my files):
tests/agent_diff.cpp,agent_e2e.cpp,agent_sched.cpp(+agent_memstore.h) built with all ofsrc/llm/*.cpp src/agent/*.cpp, driven bytests/agent_diff.py,agent_e2e.py,agent_sched.py(binaries expected atbuild/agent_diff,build/agent_e2e,build/agent_sched).
Hooks to apply at startup
agent::ports().storeis per-Agent (passStorePort*toAgent); set the rest once:ports().runtime, shell, ui, mcp, skills, plexer, tui (optional), ops, scheduler_db.llm::set_log_sink(&debuglog)(DebugLog adapter:enabled(),event(level, area, kind, message, profile, bot, meta)).llm::set_box_port(&sandbox)for the opencode-in-box fallback.llm::ChatClient::set_tool_catalog(natives, core)with the 61 tool names anddata::CoreTools()solog_completioncounts match.- Build
AgentConfigfrom Config (fields inagent_config.h,llm/ports.h::LlmConfig);ChatClientandAgentkeep a reference, so mutate that same object when settings change. --update-models->agent::update_models_command(cfg);--resume->agent::resume_turn(agent); one-shot ->Agent::run_verified; scheduler mode ->agent::Scheduler(cfg, db).start().- REPL/TUI set
agent.prompter,agent.stream_factory,agent.on_phaseas in Python;Agent::total_step_cap()is the live-patchableConsts.TOTAL_STEP_CAP.
Port contracts the other owners must satisfy (see src/agent/ports.h)
- StorePort: same semantics as the Python Store methods of the same name; rows are
json::Valueobjects with the Python key names;get_chunks_by_idsreturns an object keyed by the id as a string;sql_rowsis a read-only SELECT for RagStats. - ShellPort:
run_live_shell=run_live(command, shell=True, cwd, env=environ+extra_env, stream, ask);shell_target_paths= tai.pyshell_target_paths. - McpPort, SkillsPort, OpsPort, PlexerPort: mirror the named tai.py functions (comments in ports.h).
- UiPort is optional; without it replies print raw and the non-Glow
┌─/└─call frames are used.