feat(channel): deliver generated files on WhatsApp and honor user tool policy

Add save_deliverable_attachment for explicit document outbound, pass channel user_id into tool risk gating so write_file/run_command respect per-user allow_high settings, and document the workflow in channel-file-delivery skill.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-07-13 10:10:51 +08:00
parent 61d54b10fd
commit 19f4d285ce
9 changed files with 346 additions and 37 deletions

View file

@ -3,6 +3,21 @@ from __future__ import annotations
from runtime.chat.tool_runtime import _attachments_from_tool_result
def test_attachments_from_tool_result_preserves_deliverable_flag() -> None:
result = {
"ok": True,
"attachment_id": "att-doc-1",
"mime": "text/plain",
"name": "out.txt",
"bytes": 12,
"deliverable": True,
}
out = _attachments_from_tool_result(result)
assert len(out) == 1
assert out[0]["type"] == "text_ref"
assert out[0].get("deliverable") is True
def test_attachments_from_tool_result_preserves_non_image_ref_types() -> None:
result = {
"attachments": [