feat: 将 47 个 Operit TypeScript 脚本全面翻译为 Python

- 新增 operit_runtime.py: 跨平台 Python 运行时
  - 实现 Tools.System/Files/Net/UI/Memory/FFmpeg/Workflow/Chat/SoftwareSettings/Tasker
  - 实现 OkHttp 链式 HTTP 客户端兼容层
  - 实现 complete()/exports/console 全局对象
  - 实现 OperitScriptLoader 脚本加载器
  - 支持 Windows/macOS/Linux 三平台

- 新增 operit_py/ 目录: 47 个 Python 翻译脚本
  - 搜索类: duckduckgo, google_search, tavily, zhipu_search, various_search, crossref
  - 绘图类: openai_draw, qwen_draw, xai_draw, minimax_draw, siliconflow_draw, zhipu_draw, nanobanana_draw
  - 媒体类: ffmpeg, file_converter, douyin_download, bilibili_tools, jmcomic
  - 文件类: extended_file_tools, hex_editor, reader, beeimg_image_uploader
  - 网络类: extended_http_tools, network_test
  - 自动化类: browser, automatic_ui_base, automatic_ui_subagent, automatic_bilibili_assistant, automatic_xiaohongshu_assistant, automatic_baidu_map_assistant
  - 系统类: system_tools, super_admin, daily_life, operit_editor
  - 对话类: ai_chat, extended_chat, qq_intelligent
  - 工作流类: workflow, vflow_trigger, tasker
  - 工具类: time, code_runner, quick_start, extended_memory_tools, baidu_map, 12306, pdf_vision_parser

- 测试结果: 47/47 语法检查通过, 38 脚本加载成功, 280 个工具注册
- Android 专属功能已降级处理(保留接口,返回不支持提示)
This commit is contained in:
shuiyu1123 committed 2026-06-23 12:27:18 +00:00
1 parent 6fa759665d
commit dc77dfd304
48 files changed
+22273

No files matched your search

+66
View File
@@ -0,0 +1,66 @@
# METADATA
# {
# name: "vflow_trigger"
# display_name: {
# zh: "VFlow 触发器"
# en: "VFlow Trigger"
# }
# description: {
# zh: "触发vflow app的工作流。"
# en: "Trigger VFlow app workflows."
# }
# enabledByDefault: false
# category: "Workflow"
# tools: [
# {
# name: "trigger_vflow_workflow"
# description: {
# zh: "根据 workflow_id 触发 VFlow 工作流(需安装 com.chaomixian.vflow)。"
# en: "Trigger a VFlow workflow by workflow_id (requires com.chaomixian.vflow installed)."
# }
# parameters: [
# { name: "workflow_id", description: { zh: "工作流 ID", en: "Workflow ID" }, type: "string", required: true }
# ]
# }
# ]
# }
DEFAULT_ACTION = "com.chaomixian.vflow.EXECUTE_WORKFLOW_SHORTCUT"
DEFAULT_COMPONENT = "com.chaomixian.vflow/.ui.common.ShortcutExecutorActivity"
async def trigger_vflow_workflow(params):
if not params or not params.get("workflow_id"):
return {"success": False, "message": "workflow_id 不能为空"}
result = await Tools.System.intent({
"type": "activity",
"action": DEFAULT_ACTION,
"component": DEFAULT_COMPONENT,
"extras": {
"workflow_id": params["workflow_id"]
}
})
return {
"success": True,
"message": "已触发 VFlow 工作流",
"data": result
}
async def wrapToolExecution(func, params):
try:
result = await func(params)
complete(result)
except Exception as error:
console.error(f"Tool {func.__name__} failed unexpectedly", error)
msg = str(getattr(error, "message", error))
complete({"success": False, "message": msg})
async def trigger_vflow_workflow_wrapper(params):
await wrapToolExecution(trigger_vflow_workflow, params)
exports.trigger_vflow_workflow = trigger_vflow_workflow_wrapper