Skip to content

Commit 1d87c61

Browse files
committed
feat: show (from → to)[ws/api] transport in CLI message logs
chatExchange now takes transport parameter and displays (user:recuu → manager)[ws]: message content format. Full message content shown without truncation.
1 parent 849f256 commit 1d87c61

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

src/manager.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,10 @@ export class Manager {
138138
* Fetches context, calls LLM, executes actions, returns reply.
139139
*/
140140
async handleWsMessage(content: string): Promise<string> {
141-
ui.chatMessage("user", "manager", `[ws] ${content}`);
142141
const context = await this.fetchContext();
143142
const { reply, actions } = await this.think(content, context);
144143
await this.executeActions(actions, context);
145-
ui.chatExchange("user", content, reply, actions.length);
144+
ui.chatExchange("user", content, reply, actions.length, "ws");
146145
// Advance lastSeenId so poll doesn't reprocess this message
147146
await this.advanceLastSeen();
148147
return reply;

src/ui.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,32 +60,30 @@ export function chatMessage(from: string, to: string, content: string): void {
6060
}
6161

6262
/**
63-
* Log a message exchange pair (inbound → reply) on two compact lines.
64-
* Reduces log noise for poll-path message processing.
63+
* Log a message exchange pair (inbound → reply) on two lines.
64+
* Format: (from → to)[transport]: content
6565
*/
6666
export function chatExchange(
6767
from: string,
6868
inbound: string,
6969
reply: string,
70-
actionCount: number
70+
actionCount: number,
71+
transport: "ws" | "api" = "api"
7172
): void {
7273
if (_debug) {
7374
chatMessage(from, "manager", inbound);
7475
chatMessage("manager", from, reply);
7576
return;
7677
}
7778
const ts = timestamp();
78-
const cols = process.stdout.columns ?? 80;
79-
const maxLen = Math.max(30, cols - 35);
80-
const inTrunc = truncateLine(inbound, maxLen);
81-
const reTrunc = truncateLine(reply, maxLen);
82-
const shortFrom = from.startsWith("user:") ? "user" : from;
79+
const shortFrom = from.startsWith("user:") ? from : from;
80+
const tColor = transport === "ws" ? color.green(`[${transport}]`) : color.dim(`[${transport}]`);
8381
const actionSuffix = actionCount > 0
8482
? color.cyan(` [${actionCount} action${actionCount > 1 ? "s" : ""}]`)
8583
: "";
8684
console.log(
87-
`${color.dim(ts)} ${color.bold(shortFrom)}: ${inTrunc}\n` +
88-
`${color.dim(ts)} ${color.bold("manager")}: ${reTrunc}${actionSuffix}`
85+
`${color.dim(ts)} (${shortFrom} → manager)${tColor}: ${inbound}\n` +
86+
`${color.dim(ts)} (manager → ${shortFrom})${tColor}: ${reply}${actionSuffix}`
8987
);
9088
}
9189

0 commit comments

Comments
 (0)