feat: multimodal image clients, workspaces, Tushare skill, test fixes

- Replace monolithic image_message_client with HTTP/OCR/legacy modules; tighten OpenAI transport + tool schemas for multimodal downgrade to OCR specialist path.
- Add image/stock workspace prompts (META/SOUL/ROLE_SYSTEM); register experts; tweak specialist agent/direct loop/query_image_attachment.
- Add bundled runtime/skills/tushare-finance (references, api_client, SKILL metadata).
- Document OCR-related env vars; admin chat tweaks; README; weixin_install Ensure-OfficialPluginRuntimeDeps helper.
- Tests: multimodal downgrade + OCR coverage, strict tool pairing in attachment replay guard, workspace contract skips _internal/_system dirs, router/trace/prompt guards.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-05-10 04:41:42 +08:00
parent 6307ade480
commit d1bcc4debe
266 changed files with 57024 additions and 839 deletions

View file

@ -79,7 +79,19 @@ def test_large_image_tool_result_is_guarded_in_history_context(tmp_path: Path) -
"text": long_text,
"backend_shape": "multi",
}
store.add_message(session_id=sess.id, role="tool", content=json.dumps(payload, ensure_ascii=False))
tc_id = "c_img_hist_guard"
store.add_message(
session_id=sess.id,
role="assistant",
content="",
tool_calls=[{"id": tc_id, "name": "query_image_attachment", "arguments": {}}],
)
store.add_message(
session_id=sess.id,
role="tool",
content=json.dumps(payload, ensure_ascii=False),
tool_calls={"tool_call_id": tc_id, "name": "query_image_attachment"},
)
msgs = _build_model_context(
store=store,
@ -111,7 +123,19 @@ def test_small_image_tool_result_not_guarded(tmp_path: Path) -> None:
"attachment_id": "c" * 64,
"text": "A concise description of an icon.",
}
store.add_message(session_id=sess.id, role="tool", content=json.dumps(payload, ensure_ascii=False))
tc_id = "c_img_small_ok"
store.add_message(
session_id=sess.id,
role="assistant",
content="",
tool_calls=[{"id": tc_id, "name": "query_image_attachment", "arguments": {}}],
)
store.add_message(
session_id=sess.id,
role="tool",
content=json.dumps(payload, ensure_ascii=False),
tool_calls={"tool_call_id": tc_id, "name": "query_image_attachment"},
)
msgs = _build_model_context(
store=store,
@ -143,7 +167,19 @@ def test_large_video_transcript_tool_result_is_guarded_in_history_context(tmp_pa
"attachment_id": "d" * 64,
"text": long_text,
}
store.add_message(session_id=sess.id, role="tool", content=json.dumps(payload, ensure_ascii=False))
tc_id = "c_vid_hist_guard"
store.add_message(
session_id=sess.id,
role="assistant",
content="",
tool_calls=[{"id": tc_id, "name": "query_video_attachment", "arguments": {}}],
)
store.add_message(
session_id=sess.id,
role="tool",
content=json.dumps(payload, ensure_ascii=False),
tool_calls={"tool_call_id": tc_id, "name": "query_video_attachment"},
)
msgs = _build_model_context(
store=store,