fix: send plain string message in tau-rpc instead of structured object

Pi-agent-core's Agent.prompt() expects a plain string, not a structured
message object. The RPC handler passes input.message directly to agent.prompt(),
so sending { role: "user", content: [...] } causes "(command produced no output)"
errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Ubuntu 2025-12-08 16:21:25 +00:00
parent 7a7c59e91a
commit c4ab46a087

View File

@ -121,10 +121,12 @@ class TauRpcClient {
const child = this.child;
if (!child) throw new Error("tau rpc child not initialized");
await new Promise<void>((resolve, reject) => {
// Pi-agent-core's Agent.prompt() expects a plain string, not a structured message.
// The RPC handler in pi-coding-agent passes input.message directly to agent.prompt().
const ok = child.stdin.write(
`${JSON.stringify({
type: "prompt",
message: { role: "user", content: [{ type: "text", text: prompt }] },
message: prompt,
})}\n`,
(err) => (err ? reject(err) : resolve()),
);