feat(agent): add OpenClaw runtime support
Add OpenClaw as a fourth supported agent runtime alongside Claude Code, Codex, and OpenCode. OpenClaw CLI (`openclaw agent -p ... --output-format stream-json`) is integrated via the same Backend interface pattern. Changes: - Add openclawBackend in server/pkg/agent/openclaw.go with NDJSON event stream parsing (text, thinking, tool_call, error, step, result) - Register "openclaw" in the agent factory (agent.go) - Add MULTICA_OPENCLAW_PATH / MULTICA_OPENCLAW_MODEL env var detection in daemon config - Include "openclaw" in AGENTS.md config injection alongside codex/opencode - Add comprehensive unit tests for all event handlers and processEvents
This commit is contained in:
parent
2f63714dba
commit
5cf4ba803d
5 changed files with 934 additions and 9 deletions
|
|
@ -13,13 +13,14 @@ import (
|
|||
// For Claude: writes {workDir}/CLAUDE.md (skills discovered natively from .claude/skills/)
|
||||
// For Codex: writes {workDir}/AGENTS.md (skills discovered natively via CODEX_HOME)
|
||||
// For OpenCode: writes {workDir}/AGENTS.md (skills discovered natively from .config/opencode/skills/)
|
||||
// For OpenClaw: writes {workDir}/AGENTS.md (skills discovered natively from .openclaw/skills/)
|
||||
func InjectRuntimeConfig(workDir, provider string, ctx TaskContextForEnv) error {
|
||||
content := buildMetaSkillContent(provider, ctx)
|
||||
|
||||
switch provider {
|
||||
case "claude":
|
||||
return os.WriteFile(filepath.Join(workDir, "CLAUDE.md"), []byte(content), 0o644)
|
||||
case "codex", "opencode":
|
||||
case "codex", "opencode", "openclaw":
|
||||
return os.WriteFile(filepath.Join(workDir, "AGENTS.md"), []byte(content), 0o644)
|
||||
default:
|
||||
// Unknown provider — skip config injection, prompt-only mode.
|
||||
|
|
@ -117,8 +118,8 @@ func buildMetaSkillContent(provider string, ctx TaskContextForEnv) string {
|
|||
case "claude":
|
||||
// Claude discovers skills natively from .claude/skills/ — just list names.
|
||||
b.WriteString("You have the following skills installed (discovered automatically):\n\n")
|
||||
case "codex", "opencode":
|
||||
// Codex and OpenCode discover skills natively from their respective paths — just list names.
|
||||
case "codex", "opencode", "openclaw":
|
||||
// Codex, OpenCode, and OpenClaw discover skills natively from their respective paths — just list names.
|
||||
b.WriteString("You have the following skills installed (discovered automatically):\n\n")
|
||||
default:
|
||||
b.WriteString("Detailed skill instructions are in `.agent_context/skills/`. Each subdirectory contains a `SKILL.md`.\n\n")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue