mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-25 20:05:46 -06:00
83d53044a4
* fix(slack): keep commentary progress on draft lane * fix(channels): route commentary through one progress owner Keep non-verbose commentary in Slack and Discord draft lanes while preserving one durable commentary payload when verbose progress makes those drafts yield. Freeze that owner decision for the turn so session changes apply on the next turn. Co-authored-by: Dallin Romney <dallinromney@gmail.com> Punchcard-Session: amber-workshop-workshop-36 * fix(channels): refresh queued commentary owner Recompute the frozen draft-versus-durable commentary owner for every queued follow-up turn and carry that decision into final payload projection. Punchcard-Session: amber-workshop-workshop-36 * fix(channels): clarify commentary owner opt-in * fix(channels): preserve queued draft preambles * fix(channels): require explicit queued progress ownership * refactor(channels): record commentary progress owner * fix(telegram): tolerate unscoped queued updates * test(discord): use canonical draft fixture after rebase --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
50 lines
1.6 KiB
TypeScript
50 lines
1.6 KiB
TypeScript
// Telegram renders progress lines from their structured fields, so a line that
|
|
// arrives without detail falls back to text that already carries its icon.
|
|
import { buildChannelProgressDraftLine } from "openclaw/plugin-sdk/channel-outbound";
|
|
import { describe, expect, it } from "vitest";
|
|
import { renderTelegramProgressDraftPreview } from "./progress-draft-preview.js";
|
|
|
|
function renderToolLine(name: string) {
|
|
const line = buildChannelProgressDraftLine(
|
|
{
|
|
event: "tool",
|
|
toolCallId: "call-1",
|
|
name,
|
|
phase: "start",
|
|
args: { command: "echo alpha", description: "print text" },
|
|
},
|
|
{ commandText: "raw" },
|
|
);
|
|
if (!line) {
|
|
throw new Error(`expected a progress line for ${name}`);
|
|
}
|
|
return renderTelegramProgressDraftPreview("Working", [line], false, true).text;
|
|
}
|
|
|
|
describe("renderTelegramProgressDraftPreview", () => {
|
|
it("prints one tool icon per line for every backend spelling", () => {
|
|
for (const name of ["Bash", "bash", "exec"]) {
|
|
const rendered = renderToolLine(name);
|
|
expect(rendered.match(/🛠️/gu) ?? []).toHaveLength(1);
|
|
}
|
|
});
|
|
|
|
it("keeps the label and detail separate for a non-shell tool", () => {
|
|
const line = buildChannelProgressDraftLine({
|
|
event: "tool",
|
|
toolCallId: "call-1",
|
|
name: "Read",
|
|
phase: "start",
|
|
args: { file_path: "/tmp/x.ts" },
|
|
});
|
|
if (!line) {
|
|
throw new Error("expected a progress line for Read");
|
|
}
|
|
|
|
const rendered = renderTelegramProgressDraftPreview("Working", [line], false, true).text;
|
|
|
|
expect(rendered).toContain("<b>📖 Read</b>");
|
|
expect(rendered.match(/📖/gu) ?? []).toHaveLength(1);
|
|
});
|
|
});
|