Repository navigation
Conversation
Collaborator
|
✅ Internal validation passed. A ZCode maintainer will review the change next; after acceptance, release checks run separately and this PR is closed automatically. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plugin type (required) / 插件类型(必填)
Affected plugin name(s) / 涉及的插件名称:
quota-auto-resumeWhat / 改动内容
New community plugin under
external_plugins/quota-auto-resume/, registered in the rootmarketplace.json(categoryproductivity, version0.1.0).Problem. A long agent task can exhaust the daily plan quota half way through and stop without a handoff.
Behavior. Three hooks and one command, all backed by a single Node script:
PreToolUse: when model quota reaches the threshold (default 80%), denies high-cost tools (subagents, image and video generation, browser automation, etc.) with a reason that tells the agent to write a handoff and stop. When the official MCP call quota reaches the threshold, deniesmcp__*tools. Lightweight tools stay available so the agent can wrap up.UserPromptSubmit: from a warning line (default 60%), injects a one-line quota status. If the session was paused and quota has recovered, tells the agent to continue. When the prompt carries the probe marker, it tells the agent which paused sessions to resume throughSendToSession.SessionStart: reports quota status; on first run asks the agent to create the 30-minute recovery probe./quota-auto-resume: status, probe setup or rebuild, interception dry run, threshold changes.How it is tested.
node test/run-tests.cjs: 9 tests over synthetic log fixtures and a temporary state directory, covering log parsing, threshold decisions, MCP-only denial, fail-open on stale or missing snapshots, recovery decisions and malformed input.node hooks/auto-resume-hook.cjs statusreads real quota from the local ZCode log.SendToSessionto deliver a message to an existing session, and the message arrived.python3 scripts/validate.pyandpython3 scripts/build_dist.pyboth pass when run from a tree that contains only this plugin (a full checkout of the repository could not be fetched from this network, so they were not run against all 59 entries; the diff tomarketplace.jsonis one appended entry and the original text is unchanged).Dependencies, permissions and side effects.
~/.zcode/quota-auto-resume/(an optionalconfig.json, a one-time setup flag, and pending-resume markers).Licensing. MIT, authored by
tech.leshang. No third-party material.Known limitation. The quota snapshot is read from the desktop client's log format, which is an internal detail and may change between client versions; in that case the snapshot goes stale and the plugin stops intercepting.
Self-check / 自查清单
external_plugins/<name>// 插件名唯一且 kebab-case,外部新增插件位于external_plugins/<name>/categoryis set independently of publisher ownership / 用途分类category已填写,与维护归属分开versionbumped in BOTHplugin.jsonandmarketplace.json(new plugin,0.1.0in both) /plugin.json与marketplace.json两处版本号已同步README.md(EN) andREADME_CN.md(中文) both updated and equivalent / 中英文 README 均已更新且语义一致description_i18nhas bothenandzh-CN/description_i18n包含en与zh-CNpython3 scripts/validate.pyandpython3 scripts/build_dist.pypass locally / 本地校验与构建均通过(scope stated above)