惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
爱范儿
爱范儿
GbyAI
GbyAI
博客园 - 叶小钗
Last Week in AI
Last Week in AI
Jina AI
Jina AI
Microsoft Security Blog
Microsoft Security Blog
云风的 BLOG
云风的 BLOG
C
Check Point Blog
H
Help Net Security
P
Proofpoint News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
大猫的无限游戏
大猫的无限游戏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
B
Blog RSS Feed
Y
Y Combinator Blog
U
Unit 42
T
Tailwind CSS Blog
MyScale Blog
MyScale Blog
N
Netflix TechBlog - Medium
S
SegmentFault 最新的问题
J
Java Code Geeks
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
refactor: adopt presentation rendering in Mattermost · op...
steipete · 2026-05-17 · via Recent Commits to openclaw:main

@@ -38,6 +38,12 @@ type MattermostSendText = NonNullable<NonNullable<typeof mattermostPlugin.outbou

3838

type MattermostSendTextParams = Parameters<MattermostSendText>[0];

3939

type MattermostSendMedia = NonNullable<NonNullable<typeof mattermostPlugin.outbound>["sendMedia"]>;

4040

type MattermostSendMediaParams = Parameters<MattermostSendMedia>[0];

41+

type MattermostRenderPresentation = NonNullable<

42+

NonNullable<typeof mattermostPlugin.outbound>["renderPresentation"]

43+

>;

44+

type MattermostSendPayload = NonNullable<

45+

NonNullable<typeof mattermostPlugin.outbound>["sendPayload"]

46+

>;

41474248

function getDescribedActions(cfg: OpenClawConfig, accountId?: string): string[] {

4349

return [...(mattermostPlugin.actions?.describeMessageTool?.({ cfg, accountId })?.actions ?? [])];

@@ -91,6 +97,22 @@ function requireMattermostChunker() {

9197

return chunker;

9298

}

9399100+

function requireMattermostRenderPresentation(): MattermostRenderPresentation {

101+

const renderPresentation = mattermostPlugin.outbound?.renderPresentation;

102+

if (!renderPresentation) {

103+

throw new Error("mattermost outbound.renderPresentation missing");

104+

}

105+

return renderPresentation;

106+

}

107+108+

function requireMattermostSendPayload(): MattermostSendPayload {

109+

const sendPayload = mattermostPlugin.outbound?.sendPayload;

110+

if (!sendPayload) {

111+

throw new Error("mattermost outbound.sendPayload missing");

112+

}

113+

return sendPayload;

114+

}

115+94116

function createMattermostActionContext(

95117

overrides: Partial<MattermostActionContext>,

96118

): MattermostActionContext {

@@ -427,6 +449,41 @@ describe("mattermostPlugin", () => {

427449

expect(options.replyToId).toBe("post-root");

428450

});

429451452+

it("maps presentation buttons without using legacy interactive conversion", async () => {

453+

const cfg = createMattermostTestConfig();

454+455+

await mattermostPlugin.actions?.handleAction?.(

456+

createMattermostActionContext({

457+

action: "send",

458+

params: {

459+

to: "channel:CHAN1",

460+

message: "Deploy finished",

461+

presentation: {

462+

blocks: [

463+

{

464+

type: "buttons",

465+

buttons: [

466+

{ label: "Open", value: "open", style: "primary" },

467+

{ label: "Docs", url: "https://example.com/docs" },

468+

],

469+

},

470+

],

471+

},

472+

},

473+

cfg,

474+

accountId: "default",

475+

}),

476+

);

477+478+

const options = expectSingleMattermostSend(

479+

"channel:CHAN1",

480+

"Deploy finished\n\n- Open\n- Docs: https://example.com/docs",

481+

);

482+

expect(options.buttons).toStrictEqual([

483+

[{ text: "Open", callback_data: "open", style: "primary" }],

484+

]);

485+

});

486+430487

it("falls back to trimmed replyTo when replyToId is blank", async () => {

431488

const cfg = createMattermostTestConfig();

432489

@@ -451,6 +508,86 @@ describe("mattermostPlugin", () => {

451508

});

452509453510

describe("outbound", () => {

511+

it("renders presentation buttons for normal reply payload delivery", async () => {

512+

const renderPresentation = requireMattermostRenderPresentation();

513+

const sendPayload = requireMattermostSendPayload();

514+

const cfg = createMattermostTestConfig();

515+

const presentation = {

516+

blocks: [

517+

{ type: "text" as const, text: "Deploy finished" },

518+

{

519+

type: "buttons" as const,

520+

buttons: [

521+

{ label: "Open", value: "open", style: "primary" as const },

522+

{ label: "Docs", url: "https://example.com/docs" },

523+

],

524+

},

525+

],

526+

};

527+

const rendered = await renderPresentation({

528+

payload: { presentation },

529+

presentation,

530+

ctx: {

531+

cfg,

532+

to: "channel:CHAN1",

533+

text: "",

534+

payload: { presentation },

535+

},

536+

});

537+538+

expect(rendered).toMatchObject({

539+

text: "Deploy finished\n\n- Open\n- Docs: https://example.com/docs",

540+

channelData: {

541+

mattermost: {

542+

presentationButtons: [[{ text: "Open", callback_data: "open", style: "primary" }]],

543+

},

544+

},

545+

});

546+547+

await sendPayload({

548+

cfg,

549+

to: "channel:CHAN1",

550+

text: "",

551+

payload: rendered!,

552+

});

553+554+

const options = expectSingleMattermostSend(

555+

"channel:CHAN1",

556+

"Deploy finished\n\n- Open\n- Docs: https://example.com/docs",

557+

);

558+

expect(options.buttons).toStrictEqual([

559+

[{ text: "Open", callback_data: "open", style: "primary" }],

560+

]);

561+

});

562+563+

it("keeps multi-media presentation payloads on the text/media fallback path", async () => {

564+

const renderPresentation = requireMattermostRenderPresentation();

565+

const presentation = {

566+

blocks: [

567+

{

568+

type: "buttons" as const,

569+

buttons: [{ label: "Open", value: "open" }],

570+

},

571+

],

572+

};

573+574+

expect(

575+

await renderPresentation({

576+

payload: {

577+

presentation,

578+

mediaUrls: ["https://example.com/1.png", "https://example.com/2.png"],

579+

},

580+

presentation,

581+

ctx: {

582+

cfg: createMattermostTestConfig(),

583+

to: "channel:CHAN1",

584+

text: "",

585+

payload: { presentation },

586+

},

587+

}),

588+

).toBeNull();

589+

});

590+454591

it("chunks outbound text without requiring Mattermost runtime initialization", () => {

455592

const chunker = requireMattermostChunker();

456593