Skip to content

feat: add runtime observation APIs for plugins and tooling - #1622

Open
MistEO wants to merge 22 commits into
mainfrom
feat/plugin-runtime-observability
Open

MistEO wants to merge 22 commits into
mainfrom
feat/plugin-runtime-observability

Conversation

@MistEO

@MistEO MistEO commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

插件和外部调试工具目前只能依靠零散回调及事后查询推断执行过程;嵌套调用、重试、取消和配置覆盖容易产生歧义。本 PR 增加通用运行时观测接口,让 MaaTrace、编辑器和调试工具能够直接获取框架确认的执行信息。

  • 执行事件:补充 Context、父任务和父操作关联,NextList 执行 ID、轮次及选中项,以及节点转移和取消终态;回调前写入结果缓存。
  • 资源诊断:新增按加载 ID 查询的结构化加载结果,保留错误码及已知的文件、节点、字段、JSON Pointer 和引用目标;终态回调与查询使用同一快照。
  • 证据采集:按 Tasker 控制原图、标注图、数量和字节预算;提供当前图片保留状态,以及识别/动作实际使用的配置快照。
  • 插件管理:插件订阅独立于用户 sink,增加对象创建/销毁通知、已加载插件查询和可选的 Init/Flush/Shutdown hook;回调不持有管理器锁。

同步覆盖 C API、C++ 模块导出、Python/NodeJS、MaaAgent、中英文文档和回归测试。Windows/Linux/macOS 的 test workflow 增加插件生命周期测试。

兼容性:

  • 插件 ABI 保持 v1,新 hook 均可选;插件需在创建框架对象之前加载,Shutdown 要求所有对象已销毁。
  • 未设置的采集选项沿用全局行为;配置快照默认关闭。取消保留原有 Tasker 状态语义,通过 reason 和新增 Cancelled 子事件表达。
  • MaaAgent 协议升级为 9,两端需要一起升级。

验证:

  • Linux 完整 Debug 编译,包含 NodeJS/QuickJS 和 Agent。
  • Python 423 项单元测试,以及 binding、pipeline、Agent IPC/TCP 集成套件通过。
  • 原生 PipelineTesting、DlopenTesting、CTest 13/13 通过。
  • NodeJS binding/server 集成与 TypeScript 类型检查通过。
  • 将 MaaTrace 动态库直接挂载到本分支的 PipelineTesting:生成 8,780 条事件、29 个任务、43 份配置快照,校验 0 错误、0 警告;配套生命周期/取消事件适配见 fix: handle framework lifecycle and cancellation events MaaTrace#1。

AI 使用信息:

  • Agent:Codex
  • 模型:gpt-6-astra
  • 思考强度:ultra

Copilot AI balanced review requested due to automatic review settings November 13, 2026 09:55
@sourcery-ai

sourcery-ai Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Sorry @MistEO, your pull request is larger than the review limit of 150,000 diff characters

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T09:58:29.100873Z 56a0af4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 56a0af41a7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

LogError << "handle or buffer is null";
return false;
}
auto result = tasker->get_reco_result(reco_id);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Query image retention without fetching the image payloads

When image capture is enabled, this status-only query copies every retained raw and annotation image because RuntimeCache::get_reco_result populates those buffers. Through MaaAgent, RemoteTasker::get_reco_result additionally invokes handle_tasker_get_reco_result, which transmits all those images to the remote process before they are discarded here. Consequently, polling retention for large screenshots incurs image-sized allocations and IPC/network transfers despite only needing a short status string. Add a metadata-only lookup and corresponding remote request so status checks do not retrieve the evidence itself.

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants