fix(sessions): stop duplicating user message for slash commands

A slash command sent as the first (or any idle) message showed the raw
command text twice until reload: once from the client's optimistic insert
and once from the server's message.append echo, neither of which converges
with the agent's canonical expanded message (e.g. a /skill:* block).

Make commands obey the same source-of-truth contract as prompts:
- client no longer inserts the raw command text optimistically; it shows
  the existing per-session sending indicator instead
- forwarded runtime/skill commands return a bare done result rather than a
  synthetic "Accepted ..." line
- server suppresses the raw message.append echo for command-forwarded
  prompts (threaded through the compaction queue too)

Result: pre-reload state matches reload, with no transient duplicate.
This commit is contained in:
Federico Jaramillo Martinez
2026-06-17 00:02:04 +02:00
parent dd23b3e054
commit e77ab98361
6 changed files with 90 additions and 13 deletions
+5 -1
View File
@@ -80,8 +80,12 @@ export class SessionCommandService<TSession extends CommandSession = CommandSess
if (!isBuiltinCommand(name)) {
if (this.isRuntimeCommand(session, name)) {
// The command is forwarded to the agent, which expands it (e.g. /skill:*
// into a skill block) and streams the canonical message back. That is the
// authoritative feedback, so we don't synthesize an extra "Accepted" line
// that would only vanish on reload.
await this.prompt(sessionId, text);
return { type: "done", message: `Accepted ${text}` };
return { type: "done" };
}
return { type: "unsupported", message: `Unknown command: /${name}` };
}