fix(agent): use --message flag for OpenClaw CLI invocation

OpenClaw CLI changed its prompt flag from `-p` to `--message`. The old
flag caused tasks to fail immediately with "required option '-m,
--message <text>' not specified".

Fixes #713, relates to #703.
This commit is contained in:
Jiang Bohan
2026-04-11 21:23:31 +08:00
parent ff241af8d7
commit 5ce18907a6

View File

@@ -11,7 +11,7 @@ import (
"time"
)
// openclawBackend implements Backend by spawning `openclaw agent -p <prompt>
// openclawBackend implements Backend by spawning `openclaw agent --message <prompt>
// --output-format stream-json --yes` and reading streaming NDJSON events from
// stdout — similar to the opencode backend.
type openclawBackend struct {
@@ -46,7 +46,7 @@ func (b *openclawBackend) Execute(ctx context.Context, prompt string, opts ExecO
if opts.ResumeSessionID != "" {
args = append(args, "--session", opts.ResumeSessionID)
}
args = append(args, "-p", prompt)
args = append(args, "--message", prompt)
cmd := exec.CommandContext(runCtx, execPath, args...)
if opts.Cwd != "" {