Skip to content

Commit b3b51b0

Browse files
fix(anthropic): surface Discord pre-tool commentary
Route Anthropic pre-tool narration through the commentary progress lane, preserve shared channel progress defaults, and keep Discord/Telegram reasoning gates explicit. Thanks @Marvinthebored!
1 parent 3eaaa2c commit b3b51b0

44 files changed

Lines changed: 1941 additions & 623 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
d88b36f186301f29b2ec01b1580609b6709b7b537ed461be84a14a66c80c5544 config-baseline.json
2-
16ea2dff07075ea8392bbf0cee461cd2f42fb54ade2f1a09a950fd1086e82a2f config-baseline.core.json
3-
671979e86e4c4f59415d0a20879e838f9bbd883b3d29eeb02cb5131db8d187fe config-baseline.channel.json
1+
5ce9c4b232d6472204e91187847bdb3204afc9e53833f6d92cf8dada2dc2ba67 config-baseline.json
2+
00242f93938579d3ff3130f8d42e08a423e43dc7a73e3b5e5afb45b80c78d25a config-baseline.core.json
3+
4982a9d7d070b37e64048697b0611e7ce34a1059ba0735106c07f17666ed9fc2 config-baseline.channel.json
44
21ce3d97ac3a83323fa29ddc35045c04f6eae3040c2c5515077f543b4608fd12 config-baseline.plugin.json

docs/concepts/streaming.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,22 @@ Supported surfaces:
214214
- To keep preview streaming but hide tool-progress lines, set `streaming.preview.toolProgress` to `false` for that channel. To keep tool-progress lines visible while hiding command/exec text, set `streaming.preview.commandText` to `"status"` or `streaming.progress.commandText` to `"status"`; the default is `"raw"` to preserve released behavior. This policy is shared by draft/progress channels that use OpenClaw's compact progress renderer, including Discord, Matrix, Microsoft Teams, Mattermost, Slack draft previews, and Telegram. To disable preview edits entirely, set `streaming.mode` to `off`.
215215
- Telegram selected quote replies are an exception: when `replyToMode` is not `"off"` and selected quote text is present, OpenClaw skips the answer preview stream for that turn so tool-progress preview lines cannot render. Current-message replies without selected quote text still keep preview streaming. See [Telegram channel docs](/channels/telegram) for details.
216216

217+
### Commentary progress lane
218+
219+
Beyond tool-progress, the compact progress renderer can surface one more lane in the draft:
220+
221+
- **`streaming.progress.commentary`** — render the model's pre-tool **commentary** (💬) — short "I'll check… then…" narration — interleaved with tool lines in the progress draft.
222+
223+
```json
224+
{
225+
"channels": {
226+
"discord": {
227+
"streaming": { "mode": "progress", "progress": { "commentary": true } }
228+
}
229+
}
230+
}
231+
```
232+
217233
Keep progress lines visible but hide raw command/exec text:
218234

219235
```json

docs/docs_map.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2829,6 +2829,7 @@ Do not edit it by hand; run `pnpm docs:map:gen`.
28292829
- H3: Channel mapping
28302830
- H3: Runtime behavior
28312831
- H3: Tool-progress preview updates
2832+
- H3: Commentary progress lane
28322833
- H2: Related
28332834

28342835
## concepts/system-prompt.md

extensions/discord/src/monitor/message-handler.draft-preview.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ export function createDiscordDraftPreviewController(params: {
4444
const accountBlockStreamingEnabled =
4545
resolveChannelStreamingBlockEnabled(params.discordConfig) ??
4646
params.cfg.agents?.defaults?.blockStreamingDefault === "on";
47+
const canStreamProgressDraftForToolOnlySource =
48+
params.sourceRepliesAreToolOnly && discordStreamMode === "progress";
4749
const canStreamDraft =
48-
!params.sourceRepliesAreToolOnly &&
50+
(!params.sourceRepliesAreToolOnly || canStreamProgressDraftForToolOnlySource) &&
4951
discordStreamMode !== "off" &&
5052
!accountBlockStreamingEnabled;
5153
const draftStream = canStreamDraft
@@ -89,6 +91,10 @@ export function createDiscordDraftPreviewController(params: {
8991
mode: discordStreamMode,
9092
active: Boolean(draftStream),
9193
seed: progressSeed,
94+
reasoningLinePrefix: "🧠 ",
95+
commentaryLinePrefix: "💬 ",
96+
reasoningGate: true,
97+
commentaryItalics: false,
9298
update: async (previewText, options) => {
9399
lastPartialText = previewText;
94100
draftText = previewText;
@@ -254,6 +260,8 @@ export function createDiscordDraftPreviewController(params: {
254260
});
255261
},
256262
handleAssistantMessageBoundary() {
263+
// Queued/followup turns need a fresh progress draft after the primary final.
264+
progressDraft.beginNewTurn();
257265
if (discordStreamMode === "progress") {
258266
return;
259267
}

0 commit comments

Comments
 (0)