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

推荐订阅源

J
Java Code Geeks
Martin Fowler
Martin Fowler
B
Blog RSS Feed
D
DataBreaches.Net
L
LangChain Blog
月光博客
月光博客
S
SegmentFault 最新的问题
阮一峰的网络日志
阮一峰的网络日志
V
Visual Studio Blog
美团技术团队
Jina AI
Jina AI
博客园 - 司徒正美
雷峰网
雷峰网
Last Week in AI
Last Week in AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
IT之家
IT之家
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
小众软件
小众软件
罗磊的独立博客
博客园_首页
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
A
About on SuperTechFans
Engineering at Meta
Engineering at Meta

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
fix: clarify generated media reply prompts (#88458) · ope...
steipete · 2026-05-31 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -991,7 +991,9 @@ describe("buildAgentSystemPrompt", () => {

991991

});

992992
993993

expect(prompt).toContain("use `message(action=send)` for visible source-channel output");

994-

expect(prompt).toContain("Attach media with message-tool attachment fields");

994+

expect(prompt).toContain(

995+

"Tool/generated media paths are attachments, not prose; send one with `media`, multiple with `attachments: [{media: ...}]`.",

996+

);

995997

expect(prompt).not.toContain("Attach media: `MEDIA:<path-or-url>`");

996998

expect(prompt).toContain("The target defaults to the current source channel");

997999

expect(prompt).toContain("do not repeat that visible content in your final answer");

@@ -1003,6 +1005,23 @@ describe("buildAgentSystemPrompt", () => {

10031005

expect(prompt).not.toContain("For `action=send`, include `target` and `message`.");

10041006

});

10051007
1008+

it("tells automatic source delivery to expose generated media as MEDIA directives", () => {

1009+

const prompt = buildAgentSystemPrompt({

1010+

workspaceDir: "/tmp/openclaw",

1011+

toolNames: ["message"],

1012+

runtimeInfo: {

1013+

channel: "telegram",

1014+

},

1015+

});

1016+
1017+

expect(prompt).toContain(

1018+

"Attach media in the final visible reply with `MEDIA:<path-or-url>` on its own line.",

1019+

);

1020+

expect(prompt).toContain(

1021+

"Tool/generated media paths are attachments, not prose; emit each as its own `MEDIA:<path-or-url>` line.",

1022+

);

1023+

});

1024+
10061025

it("suppresses plain chat approval commands when inline approval UI is available", () => {

10071026

const prompt = buildAgentSystemPrompt({

10081027

workspaceDir: "/tmp/openclaw",

Original file line numberDiff line numberDiff line change

@@ -396,7 +396,8 @@ function buildAssistantOutputDirectivesSection(params: {

396396

return [

397397

"## Assistant Output Directives",

398398

"- Visible source-channel output is delivered through `message(action=send)`.",

399-

"- Attach media with message-tool attachment fields such as `media`, `mediaUrl`, `path`, or `filePath`; do not write attachment commands in text.",

399+

"- Tool/generated media paths are attachments, not prose; send one with `media`, multiple with `attachments: [{media: ...}]`.",

400+

"- Do not use legacy `MEDIA:` directives for source-channel delivery.",

400401

"- Voice-note audio hint: use message-tool `asVoice` when sending audio as a voice note.",

401402

"- Native quote/reply: use message-tool `replyTo` when an explicit reply target is needed.",

402403

"",

@@ -405,6 +406,7 @@ function buildAssistantOutputDirectivesSection(params: {

405406

return [

406407

"## Assistant Output Directives",

407408

"- Attach media in the final visible reply with `MEDIA:<path-or-url>` on its own line.",

409+

"- Tool/generated media paths are attachments, not prose; emit each as its own `MEDIA:<path-or-url>` line.",

408410

" The MEDIA directive must start the line as plain text, outside code fences and without Markdown wrappers. Do not write `**MEDIA:...**`, `` `MEDIA:...` ``, or inline prose like `Here is the file: MEDIA:...`.",

409411

"- Voice-note audio hint: `[[audio_as_voice]]` when audio is attached.",

410412

"- Native quote/reply: first token `[[reply_to_current]]`; use `[[reply_to:<id>]]` only with an explicit id.",

Original file line numberDiff line numberDiff line change

@@ -1075,6 +1075,25 @@ describe("message tool explicit target guard", () => {

10751075

});

10761076
10771077

describe("message tool path passthrough", () => {

1078+

it("advertises canonical media params without compat aliases", () => {

1079+

const properties = getToolProperties(createMessageTool());

1080+

const attachments = properties.attachments as

1081+

| { items?: { properties?: Record<string, unknown> } }

1082+

| undefined;

1083+

const attachmentProperties = attachments?.items?.properties ?? {};

1084+
1085+

expect(properties).toHaveProperty("media");

1086+

expect(properties).not.toHaveProperty("mediaUrl");

1087+

expect(properties).not.toHaveProperty("mediaUrls");

1088+

expect(properties).not.toHaveProperty("path");

1089+

expect(properties).not.toHaveProperty("filePath");

1090+

expect(properties).not.toHaveProperty("fileUrl");

1091+

expect(attachmentProperties).toHaveProperty("media");

1092+

for (const name of ["mediaUrl", "path", "filePath", "fileUrl", "url"]) {

1093+

expect(attachmentProperties).not.toHaveProperty(name);

1094+

}

1095+

});

1096+
10781097

it.each([

10791098

{ field: "path", value: "~/Downloads/voice.ogg" },

10801099

{ field: "filePath", value: "./tmp/note.m4a" },

Original file line numberDiff line numberDiff line change

@@ -190,16 +190,6 @@ function buildSendSchema(options: {

190190

description: "Media URL/path. data: use buffer.",

191191

}),

192192

),

193-

mediaUrl: Type.Optional(

194-

Type.String({

195-

description: "Alias for media.",

196-

}),

197-

),

198-

mediaUrls: Type.Optional(

199-

Type.Array(Type.String(), {

200-

description: "Multiple media URLs/paths.",

201-

}),

202-

),

203193

filename: Type.Optional(Type.String()),

204194

buffer: Type.Optional(

205195

Type.String({

@@ -209,24 +199,16 @@ function buildSendSchema(options: {

209199

contentType: Type.Optional(Type.String()),

210200

mimeType: Type.Optional(Type.String()),

211201

caption: Type.Optional(Type.String()),

212-

path: Type.Optional(Type.String()),

213-

filePath: Type.Optional(Type.String()),

214202

attachments: Type.Optional(

215203

Type.Array(

216204

Type.Object({

217205

type: Type.Optional(stringEnum(["image", "audio", "video", "file"])),

218206

media: Type.Optional(Type.String()),

219-

mediaUrl: Type.Optional(Type.String()),

220-

path: Type.Optional(Type.String()),

221-

filePath: Type.Optional(Type.String()),

222-

fileUrl: Type.Optional(Type.String()),

223-

url: Type.Optional(Type.String()),

224207

name: Type.Optional(Type.String()),

225208

mimeType: Type.Optional(Type.String()),

226209

}),

227210

{

228-

description:

229-

"Structured attachments; each needs media/mediaUrl/path/filePath/fileUrl/url.",

211+

description: "Structured attachments; each entry uses media.",

230212

},

231213

),

232214

),

Original file line numberDiff line numberDiff line change

@@ -658,36 +658,21 @@

658658

"type": "boolean"

659659

},

660660

"attachments": {

661-

"description": "Structured attachments; each needs media/mediaUrl/path/filePath/fileUrl/url.",

661+

"description": "Structured attachments; each entry uses media.",

662662

"items": {

663663

"properties": {

664-

"filePath": {

665-

"type": "string"

666-

},

667-

"fileUrl": {

668-

"type": "string"

669-

},

670664

"media": {

671665

"type": "string"

672666

},

673-

"mediaUrl": {

674-

"type": "string"

675-

},

676667

"mimeType": {

677668

"type": "string"

678669

},

679670

"name": {

680671

"type": "string"

681672

},

682-

"path": {

683-

"type": "string"

684-

},

685673

"type": {

686674

"enum": ["image", "audio", "video", "file"],

687675

"type": "string"

688-

},

689-

"url": {

690-

"type": "string"

691676

}

692677

},

693678

"type": "object"

@@ -721,9 +706,6 @@

721706

"filename": {

722707

"type": "string"

723708

},

724-

"filePath": {

725-

"type": "string"

726-

},

727709

"forceDocument": {

728710

"description": "Send image/GIF/video as document; avoids compression.",

729711

"type": "boolean"

@@ -741,26 +723,12 @@

741723

"description": "Media URL/path. data: use buffer.",

742724

"type": "string"

743725

},

744-

"mediaUrl": {

745-

"description": "Alias for media.",

746-

"type": "string"

747-

},

748-

"mediaUrls": {

749-

"description": "Multiple media URLs/paths.",

750-

"items": {

751-

"type": "string"

752-

},

753-

"type": "array"

754-

},

755726

"message": {

756727

"type": "string"

757728

},

758729

"mimeType": {

759730

"type": "string"

760731

},

761-

"path": {

762-

"type": "string"

763-

},

764732

"quoteText": {

765733

"description": "Telegram reply quote text.",

766734

"type": "string"

Original file line numberDiff line numberDiff line change

@@ -658,36 +658,21 @@

658658

"type": "boolean"

659659

},

660660

"attachments": {

661-

"description": "Structured attachments; each needs media/mediaUrl/path/filePath/fileUrl/url.",

661+

"description": "Structured attachments; each entry uses media.",

662662

"items": {

663663

"properties": {

664-

"filePath": {

665-

"type": "string"

666-

},

667-

"fileUrl": {

668-

"type": "string"

669-

},

670664

"media": {

671665

"type": "string"

672666

},

673-

"mediaUrl": {

674-

"type": "string"

675-

},

676667

"mimeType": {

677668

"type": "string"

678669

},

679670

"name": {

680671

"type": "string"

681672

},

682-

"path": {

683-

"type": "string"

684-

},

685673

"type": {

686674

"enum": ["image", "audio", "video", "file"],

687675

"type": "string"

688-

},

689-

"url": {

690-

"type": "string"

691676

}

692677

},

693678

"type": "object"

@@ -721,9 +706,6 @@

721706

"filename": {

722707

"type": "string"

723708

},

724-

"filePath": {

725-

"type": "string"

726-

},

727709

"forceDocument": {

728710

"description": "Send image/GIF/video as document; avoids compression.",

729711

"type": "boolean"

@@ -741,26 +723,12 @@

741723

"description": "Media URL/path. data: use buffer.",

742724

"type": "string"

743725

},

744-

"mediaUrl": {

745-

"description": "Alias for media.",

746-

"type": "string"

747-

},

748-

"mediaUrls": {

749-

"description": "Multiple media URLs/paths.",

750-

"items": {

751-

"type": "string"

752-

},

753-

"type": "array"

754-

},

755726

"message": {

756727

"type": "string"

757728

},

758729

"mimeType": {

759730

"type": "string"

760731

},

761-

"path": {

762-

"type": "string"

763-

},

764732

"quoteText": {

765733

"description": "Telegram reply quote text.",

766734

"type": "string"

Original file line numberDiff line numberDiff line change

@@ -658,36 +658,21 @@

658658

"type": "boolean"

659659

},

660660

"attachments": {

661-

"description": "Structured attachments; each needs media/mediaUrl/path/filePath/fileUrl/url.",

661+

"description": "Structured attachments; each entry uses media.",

662662

"items": {

663663

"properties": {

664-

"filePath": {

665-

"type": "string"

666-

},

667-

"fileUrl": {

668-

"type": "string"

669-

},

670664

"media": {

671665

"type": "string"

672666

},

673-

"mediaUrl": {

674-

"type": "string"

675-

},

676667

"mimeType": {

677668

"type": "string"

678669

},

679670

"name": {

680671

"type": "string"

681672

},

682-

"path": {

683-

"type": "string"

684-

},

685673

"type": {

686674

"enum": ["image", "audio", "video", "file"],

687675

"type": "string"

688-

},

689-

"url": {

690-

"type": "string"

691676

}

692677

},

693678

"type": "object"

@@ -721,9 +706,6 @@

721706

"filename": {

722707

"type": "string"

723708

},

724-

"filePath": {

725-

"type": "string"

726-

},

727709

"forceDocument": {

728710

"description": "Send image/GIF/video as document; avoids compression.",

729711

"type": "boolean"

@@ -741,26 +723,12 @@

741723

"description": "Media URL/path. data: use buffer.",

742724

"type": "string"

743725

},

744-

"mediaUrl": {

745-

"description": "Alias for media.",

746-

"type": "string"

747-

},

748-

"mediaUrls": {

749-

"description": "Multiple media URLs/paths.",

750-

"items": {

751-

"type": "string"

752-

},

753-

"type": "array"

754-

},

755726

"message": {

756727

"type": "string"

757728

},

758729

"mimeType": {

759730

"type": "string"

760731

},

761-

"path": {

762-

"type": "string"

763-

},

764732

"quoteText": {

765733

"description": "Telegram reply quote text.",

766734

"type": "string"