opencode-plugin-quota-resume 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,7 +5,7 @@ OpenCode **v2** 插件:当会话因第三方订阅(token plan)的额度/
5
5
  ## 工作原理
6
6
 
7
7
  1. 订阅 `session.execution.failed` 事件——这是内置重试全部耗尽后的终态失败,不受单次请求重试次数硬上限的约束;
8
- 2. 判断失败原因是否为限流/额度耗尽:HTTP 状态码匹配(默认 `429`)或错误信息正则匹配(默认 `rate limit / too many requests / quota / 额度 / 限流` 等);
8
+ 2. 判断失败原因是否为限流/额度耗尽:HTTP 状态码匹配(默认 `429`)或错误信息正则匹配(默认包含 `rate limit / too many requests / quota / extra usage / balance has run out / insufficient balance / 额度 / 限流 / 余额不足` 等,覆盖 Kimi `Extra Usage balance has run out`、OpenAI `insufficient_quota` 等常见文案);
9
9
  3. 计算到下一个额度窗口边界的等待时间(`窗口 - (now - 锚点) % 窗口 + 缓冲`);
10
10
  4. 定时器到期后调用 `ctx.session.prompt` 自动重新提交,继续执行;
11
11
  5. 若用户在等待期间手动继续任务,定时器自动取消。
@@ -64,7 +64,7 @@ opencode plugin add opencode-plugin-quota-resume
64
64
  "resumeText": "继续上一个任务", // 恢复时自动发送的 prompt
65
65
  "maxResumesPerSession": 12, // 每会话自动恢复次数上限
66
66
  "statusCodes": [429], // 视为限流的 HTTP 状态码
67
- "messagePatterns": ["rate.?limit", "too many requests", "quota", "额度", "限流"] // 错误信息正则
67
+ "messagePatterns": ["rate.?limit", "too many requests", "quota", "extra usage", "balance has run out", "insufficient balance", "额度", "限流", "余额不足"] // 错误信息正则
68
68
  }
69
69
  }
70
70
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-plugin-quota-resume",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "OpenCode v2 plugin: when a session dies on a provider rate/quota limit (HTTP 429 etc.), wait until the plan's quota window resets, then automatically re-prompt the session to continue on the same subscription model.",
5
5
  "type": "module",
6
6
  "exports": {
package/src/index.ts CHANGED
@@ -47,8 +47,16 @@ const DEFAULT_MESSAGE_PATTERN_SOURCES = [
47
47
  "too many requests",
48
48
  "resource exhausted",
49
49
  "quota",
50
+ "extra usage",
51
+ "balance has run out",
52
+ "insufficient balance",
53
+ "insufficient_quota",
54
+ "out of credits",
50
55
  "额度",
51
56
  "限流",
57
+ "余额不足",
58
+ "余额耗尽",
59
+ "欠费",
52
60
  ]
53
61
 
54
62
  const DEFAULTS = {