@whyshu/argent-engine 0.14.11 → 0.14.12

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/MANIFEST.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "schema": 1,
3
3
  "package": "@whyshu/argent-engine",
4
4
  "files": {
5
- "VERSION": "5842209fcec5576cc3cd523e5a25fd3ea442e28635adb3751466b0dde75d31c0",
5
+ "VERSION": "4ea2186b37b218d1cdc88a362c00e84909692bb579df3b640a9840b6fb2753a5",
6
6
  "agents/catalog.json": "5356a812f2554dfd3115370363d4c3f787a82c9e5928a85d05b2a07c9e4b324d",
7
7
  "configs/_aliases.proposed.json": "3a59edf80563bcc20d410d488decad6fd787bd3de9489321367b0783904cd3e5",
8
8
  "configs/_migration-plan.proposed.json": "dd9f90b0b9b2f217dd23367a618402e57997d44f7fddcfa88a7cadf52e056c0d",
@@ -14,7 +14,7 @@
14
14
  "configs/mcp-tools.snapshot.json": "cfa94a6ba64a7ae9d133a4a878ce3d5e0e85e554ccd3e3ebaf0d51ad750acf6a",
15
15
  "configs/notify.json": "cb9ef11c1c498fcf99af99ec50271b8a2598061b77ed73a6099032e837474ef0",
16
16
  "core/cli/argent.mjs": "9a8977324c238ca4e20435f9817eb7ec76157da32b1d510977dc03e0feb416a9",
17
- "core/contracts/argent.contracts.json": "67dee385fe36119835da11eae6d52e5637a31de73505e4cc6f2e3369bfaccd6f",
17
+ "core/contracts/argent.contracts.json": "40b1dabc2829502f4147f37833e5555679f9e4114497d4c5849cdc2a16f3498d",
18
18
  "core/contracts/verbs.schema.json": "54d726181c11536eb30bd25090584a7af103e4c0462f8ef078053c8177e19dcb",
19
19
  "core/lib/account-token.mjs": "35faad2c34e67755c1867f74a74885f0f268d5daabe01d339cf30dc747f86501",
20
20
  "core/lib/argent-datadir.mjs": "1fdd799c933382c4f9e36bd4af33d51b8ac4a466a9d67a8f2296bb267b5251ac",
@@ -297,7 +297,7 @@
297
297
  "scripts/ops-codefix-queue.mjs": "bf377ee88f0b5c0493067fe38fd7355bc081285dfd3b06f8a48c2efaa297f705",
298
298
  "scripts/ops-digest.mjs": "7fcb827d2ad258a9014c677d35be3222e7985894d483e6d18b8b089ac7f80e0d",
299
299
  "scripts/ops-verify.mjs": "cfe80ad4693c0ebc8c1782f7f09934529b98cd8edbdd9c980028754e370370f1",
300
- "scripts/orchestrator.py": "6faa9ff8b22645b003a1ebbb9a9ab29efec3f8deed84965f6ee582308a834b0d",
300
+ "scripts/orchestrator.py": "5f87527633e8b5fc07d18542cd27bfd891955dc748803cdef3689bf0657a6b28",
301
301
  "scripts/orchestrator_br.py": "103544e887add1f8d2bc7bfd0168fc8a0f2cd8a0547874e064a2465fd5626459",
302
302
  "scripts/p2-report-run.mjs": "86bd6b3005f1a5fca3f808f4ea77dcce43a11a4a9be7ee814a029daaae201fb5",
303
303
  "scripts/pack-plugins.mjs": "b1b42fb30ebd27f320af72bc28b5b8e2b76e54031b4ac1ba5c3909374990b38b",
package/engine/VERSION CHANGED
@@ -1 +1 @@
1
- 0.14.11
1
+ 0.14.12
@@ -1,6 +1,6 @@
1
1
  {
2
- "argentVersion": "0.14.11",
3
- "_syncNote": "argentVersion 必须与仓库根 VERSION 同批更新:发布前置校验 scripts/check-version-consistency.mjs;2026-11-24 按 VERSION=0.14.11 校正。",
2
+ "argentVersion": "0.14.12",
3
+ "_syncNote": "argentVersion 必须与仓库根 VERSION 同批更新:发布前置校验 scripts/check-version-consistency.mjs;2026-11-24 按 VERSION=0.14.12 校正。",
4
4
  "principle": "宿主无关:宿主只依赖 `argent <verb>`;确定性逻辑在 CLI/MCP,不在提示词里。",
5
5
  "verbs": {
6
6
  "version": {
@@ -2922,6 +2922,22 @@ def _is_page_dead_message(msg: str) -> bool:
2922
2922
  return any(k in m for k in PAGE_DEAD_MARKERS)
2923
2923
 
2924
2924
 
2925
+ def _env_delays(name: str, default: list[float]) -> list[float]:
2926
+ """解析「逗号分隔秒数」的 env(如 30,60,120);非法/空 ⇒ 用默认。"""
2927
+ raw = str(os.environ.get(name, "") or "").strip()
2928
+ if not raw:
2929
+ return list(default)
2930
+ out: list[float] = []
2931
+ for part in raw.split(","):
2932
+ try:
2933
+ v = float(part.strip())
2934
+ except Exception: # noqa: BLE001
2935
+ continue
2936
+ if v >= 0:
2937
+ out.append(v)
2938
+ return out or list(default)
2939
+
2940
+
2925
2941
  def _cancel_failure_stage(exc: "StepError") -> str:
2926
2942
  """KB-127:归类取消预约单次失败发生在哪个阶段(navigate/click/modal/verify)。"""
2927
2943
  msg = exc.message or ""
@@ -2937,7 +2953,7 @@ def _cancel_failure_stage(exc: "StepError") -> str:
2937
2953
 
2938
2954
 
2939
2955
  def _cancel_final_error(last_exc: Optional["StepError"], stages: list[str],
2940
- *, evidence: str = "") -> "StepError":
2956
+ *, evidence: str = "", total: int = 3) -> "StepError":
2941
2957
  """KB-127:按最后一次真实失败阶段生成**准确**的步骤8失败错误(保真 err_type/消息)。
2942
2958
 
2943
2959
  - NAV / CLICK → 取消**未执行**(预约可能仍有效,需重试取消),err_type 保留原类型;
@@ -2953,22 +2969,22 @@ def _cancel_final_error(last_exc: Optional["StepError"], stages: list[str],
2953
2969
  prev_recovery = list(base.recovery_attempted or [])
2954
2970
  if stage == CANCEL_STAGE_VERIFY:
2955
2971
  return StepError(8, "business",
2956
- f"预约失败:取消预约未生效({n}/3 次均在【{label}】阶段失败——已点到 "
2972
+ f"预约失败:取消预约未生效({n}/{total} 次均在【{label}】阶段失败——已点到 "
2957
2973
  f"Cancelar cita 但未验证到生效;最后一次:{base.message}){tail}",
2958
2974
  recovery_attempted=["cancel_modal_confirm", "cancel_verify_retry"])
2959
2975
  if stage == CANCEL_STAGE_CLICK:
2960
2976
  return StepError(8, base.err_type or "selector_not_found",
2961
- f"预约失败:取消预约**未执行**({n}/3 次在【{label}】阶段失败:页面未出现 "
2977
+ f"预约失败:取消预约**未执行**({n}/{total} 次在【{label}】阶段失败:页面未出现 "
2962
2978
  f"Cancelar reserva 按钮,可能本无有效预约/已取消(幂等)或页面异常;"
2963
2979
  f"最后一次:{base.message}){tail}",
2964
2980
  recovery_attempted=prev_recovery + ["cancel_btn_absent"])
2965
2981
  if stage == CANCEL_STAGE_MODAL:
2966
2982
  return StepError(8, base.err_type or "timeout",
2967
- f"预约失败:取消预约未完成({n}/3 次在【{label}】阶段失败:已点 "
2983
+ f"预约失败:取消预约未完成({n}/{total} 次在【{label}】阶段失败:已点 "
2968
2984
  f"Cancelar reserva 但确认弹窗未出现;最后一次:{base.message}){tail}",
2969
2985
  recovery_attempted=["cancel_modal_confirm"])
2970
2986
  return StepError(8, base.err_type or "timeout",
2971
- f"预约失败:取消预约**未执行**({n}/3 次在【{label}】阶段失败,未点到 "
2987
+ f"预约失败:取消预约**未执行**({n}/{total} 次在【{label}】阶段失败,未点到 "
2972
2988
  f"Cancelar reserva,预约可能仍有效、需重试取消;最后一次:{base.message}){tail}",
2973
2989
  recovery_attempted=prev_recovery + ["cancel_navigate_failed"])
2974
2990
 
@@ -11944,9 +11960,22 @@ class Orchestrator:
11944
11960
  # KB-127:旧实现无论何因都抛 business「取消预约未生效(Cancelar reserva 后未跳转
11945
11961
  # appointmentCancellationSuccess)」——把「3 次都卡在导航/页面已关闭」误报成
11946
11962
  # 「点到按钮但没生效」,既误导人工(以为取消已尝试)又错分失败类型(落 manual 初查)。
11963
+ # 2026-12-03:ML 限流页("Tenemos más tráfico de lo normal")会让 3×2s 的重试全灭
11964
+ # (实测 83670718:3 次都停在限流页,取消没执行、预约还活着 ⇒ 到期罚款风险)。
11965
+ # 前 3 次保持快重试(页面瞬时错误);之后对「可重试形态」(导航失败 / 按钮未渲染)
11966
+ # 追加长退避(默认 30/60/120/180/300s,总预算约 12 分钟),每次仍重新 visit(= 刷页)。
11967
+ # ⛔ 不是无限刷:总尝试有上限;MODAL/VERIFY(真实交互失败)不再拖长。
11968
+ quick_delays = _env_delays("ARGENT_CANCEL_QUICK_DELAYS", [0.0, 2.0, 2.0])
11969
+ slow_delays = _env_delays("ARGENT_CANCEL_SLOW_DELAYS", [30.0, 60.0, 120.0, 180.0, 300.0])
11947
11970
  last_exc: Optional[StepError] = None
11948
11971
  stages: list[str] = []
11949
- for attempt in range(3):
11972
+ queue: list[float] = list(quick_delays)
11973
+ slow_used = 0
11974
+ total = len(quick_delays)
11975
+ while queue:
11976
+ wait_s = queue.pop(0)
11977
+ if wait_s:
11978
+ await asyncio.sleep(wait_s)
11950
11979
  try:
11951
11980
  await self._cancel_appointment_once()
11952
11981
  self._mark_done(8)
@@ -11955,13 +11984,18 @@ class Orchestrator:
11955
11984
  last_exc = exc
11956
11985
  stage = _cancel_failure_stage(exc)
11957
11986
  stages.append(stage)
11958
- self._log(f" ⚠️ 取消预约第 {attempt + 1}/3 次尝试失败"
11987
+ self._log(f" ⚠️ 取消预约第 {len(stages)}/{total} 次尝试失败"
11959
11988
  f"[{CANCEL_STAGE_LABEL.get(stage, stage)}]: {exc.message}")
11960
- if attempt < 2:
11961
- await asyncio.sleep(2)
11989
+ retryable = stage in (CANCEL_STAGE_NAV, CANCEL_STAGE_CLICK)
11990
+ if not retryable:
11991
+ break
11992
+ if len(stages) >= len(quick_delays) and slow_used < len(slow_delays):
11993
+ queue.append(slow_delays[slow_used])
11994
+ slow_used += 1
11995
+ total += 1
11962
11996
  evidence = await self._cancel_page_evidence()
11963
11997
  self._log(f" 🔎 取消预约失败现场证据:{evidence}")
11964
- raise _cancel_final_error(last_exc, stages, evidence=evidence)
11998
+ raise _cancel_final_error(last_exc, stages, evidence=evidence, total=max(total, 1))
11965
11999
 
11966
12000
  async def _cancel_page_evidence(self) -> str:
11967
12001
  """KB-127:取消预约失败现场证据(URL + 按钮/弹窗/正文摘要)。
@@ -1 +1 @@
1
- export const VERSION = "0.14.11"
1
+ export const VERSION = "0.14.12"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whyshu/argent-engine",
3
- "version": "0.14.11",
3
+ "version": "0.14.12",
4
4
  "description": "Argent 引擎(L1):流程/台账/重试/守卫/审计/浏览器自动化 —— 逐字节来自 argent-dsh 仓库",
5
5
  "type": "module",
6
6
  "engines": {