@whyshu/argent-engine 0.14.12 → 0.14.13

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": "4ea2186b37b218d1cdc88a362c00e84909692bb579df3b640a9840b6fb2753a5",
5
+ "VERSION": "7045910e40778ec30164699afe7c2aabe87c6a295103701b91bb08bd403c3ea7",
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": "40b1dabc2829502f4147f37833e5555679f9e4114497d4c5849cdc2a16f3498d",
17
+ "core/contracts/argent.contracts.json": "b92204be79c91af9cca4522c8334f714ca9003ba35d48066a7465972b38f3aa0",
18
18
  "core/contracts/verbs.schema.json": "54d726181c11536eb30bd25090584a7af103e4c0462f8ef078053c8177e19dcb",
19
19
  "core/lib/account-token.mjs": "35faad2c34e67755c1867f74a74885f0f268d5daabe01d339cf30dc747f86501",
20
20
  "core/lib/argent-datadir.mjs": "1fdd799c933382c4f9e36bd4af33d51b8ac4a466a9d67a8f2296bb267b5251ac",
@@ -58,7 +58,7 @@
58
58
  "scripts/appointment-stop.mjs": "2e0a965346d33ef8683da5473c48df7f4e66ee8a3167526ee6b568e1adf5c91d",
59
59
  "scripts/appointment-worker.mjs": "9d705a59b1056c4527d44c57552e156e6d365fd49a7856e86ce92a598fec455b",
60
60
  "scripts/appointment_grab.py": "cb03f0b2533c7640719a145952ae01f3c6e12e7a96ccf21bd32adea495ea1d55",
61
- "scripts/appointment_rules.py": "0c2b8f40af3ae711b005c0852d630194c2737a7ef040490d3cf1ec22de6c1c13",
61
+ "scripts/appointment_rules.py": "15c4219876190c1220b056f774ae6c83a3128e7ce7bd93ed4e17f50d8e32d422",
62
62
  "scripts/archive/feishu-bridge.js": "e6714c72022892d0c527d1fc9ae0f8ff99f9ab3bd0363329979b423246684885",
63
63
  "scripts/argent-agents.mjs": "73f4a058df2cd6d62b285ea48a5e32881db678b63007d1ac2f218005cb28c18d",
64
64
  "scripts/argent-capabilities.mjs": "7186d7c19f733d987a7afe2355dd7d788333a15c0f80811c4cde4e7a32584c4e",
package/engine/VERSION CHANGED
@@ -1 +1 @@
1
- 0.14.12
1
+ 0.14.13
@@ -1,6 +1,6 @@
1
1
  {
2
- "argentVersion": "0.14.12",
3
- "_syncNote": "argentVersion 必须与仓库根 VERSION 同批更新:发布前置校验 scripts/check-version-consistency.mjs;2026-11-24 按 VERSION=0.14.12 校正。",
2
+ "argentVersion": "0.14.13",
3
+ "_syncNote": "argentVersion 必须与仓库根 VERSION 同批更新:发布前置校验 scripts/check-version-consistency.mjs;2026-11-24 按 VERSION=0.14.13 校正。",
4
4
  "principle": "宿主无关:宿主只依赖 `argent <verb>`;确定性逻辑在 CLI/MCP,不在提示词里。",
5
5
  "verbs": {
6
6
  "version": {
@@ -1,9 +1,10 @@
1
1
  """抢预约「时间规则」在引擎侧的编译(2026-11-19)。
2
2
 
3
3
  与 ERP `appointmentRuleService.compileRulePreview` 同一口径:
4
- · 工作日 = 周一至周五(周末不计入「工作日后 N 天」)
5
- · leadWorkdays=0 从今天开始;N>0 往后数 N 个工作日
6
- · dailyAdvanceAt 到点后起点 +1 天(按墨西哥时间)
4
+ · T+N 口径(2026-12-03 改回国际惯例):T=业务日(当天为 T+0),往后数第 N 个工作日
5
+ · 工作日 = 周一至周五(周末不计入 N;窗口内的周末仍按 windows 可约)
6
+ · dailyAdvanceAt 只决定业务日何时翻页:到点后业务日=今天,未到点=昨天(**不再额外 +1 天**)
7
+ · minLeadHours:时段起点距现在不足 N 小时的,不计入可约时段
7
8
  · horizonDays 只约 N 天内(含起点)
8
9
  · windows 按 ISO 周几(1=周一…7=周日)配置,可多段;空=当天不约
9
10
  · skipDates 跳过
@@ -36,17 +37,11 @@ def _minutes(hhmm: str) -> int | None:
36
37
  return None
37
38
 
38
39
 
39
- def _is_workday(d: date, skip: set[str], windows: dict | None = None) -> bool:
40
- """工作日:周一至周五;周末只有配置了可约时段才算工作日(旧工具口径)。"""
40
+ def _is_workday(d: date, skip: set[str]) -> bool:
41
+ """工作日 = 周一至周五(国际惯例 T+N:周末不计入 N,但窗口内的周末仍可约)。"""
41
42
  if d.isoformat() in skip:
42
43
  return False
43
- wd = d.isoweekday()
44
- if wd <= 5:
45
- return True
46
- if not windows:
47
- return False
48
- segs = windows.get(wd) or windows.get(str(wd)) or []
49
- return bool(segs)
44
+ return d.isoweekday() <= 5
50
45
 
51
46
 
52
47
  def compile_rule(spec: dict | None, today: date, *, now: datetime | None = None) -> dict[str, list[dict]]:
@@ -66,15 +61,24 @@ def compile_rule(spec: dict | None, today: date, *, now: datetime | None = None)
66
61
  advance = _minutes(advance_raw) if advance_raw else None
67
62
  clock = mexico_now(now)
68
63
 
69
- start = today
64
+ # T+N:T=业务日(当天为 T+0),往后数第 N 个工作日。
65
+ # 「每天推进」只决定业务日翻页:未到推进点 ⇒ 业务日仍是昨天;到点后 ⇒ 今天。⛔ 不再额外 +1 天
66
+ # (旧实现「已过推进点就 +1」把 N 变成 N+1,预览与抢号一起偏一天)。
67
+ base = today
68
+ if advance is not None and (clock.hour * 60 + clock.minute) < advance:
69
+ base = base - timedelta(days=1)
70
+ start = base
70
71
  if lead > 0:
71
72
  counted = 0
72
73
  while counted < lead:
73
74
  start = start + timedelta(days=1)
74
- if _is_workday(start, skip, windows):
75
+ if _is_workday(start, skip):
75
76
  counted += 1
76
- if advance is not None and (clock.hour * 60 + clock.minute) >= advance:
77
- start = start + timedelta(days=1)
77
+ try:
78
+ min_lead_h = float(spec.get('minLeadHours') or 0)
79
+ except Exception: # noqa: BLE001
80
+ min_lead_h = 0.0
81
+ cutoff = clock + timedelta(hours=min_lead_h) if min_lead_h > 0 else None
78
82
 
79
83
  out: dict[str, list[dict]] = {}
80
84
  for i in range(horizon):
@@ -88,6 +92,10 @@ def compile_rule(spec: dict | None, today: date, *, now: datetime | None = None)
88
92
  frm = str((seg or {}).get('from') or '').strip()
89
93
  to = str((seg or {}).get('to') or '').strip()
90
94
  fm, tm = _minutes(frm), _minutes(to)
95
+ if cutoff is not None and fm is not None:
96
+ seg_start = datetime(d.year, d.month, d.day, fm // 60, fm % 60, tzinfo=MX_TZ)
97
+ if seg_start < cutoff:
98
+ continue
91
99
  if fm is None or tm is None or fm >= tm:
92
100
  continue
93
101
  segs.append({'from': frm, 'to': to})
@@ -1 +1 @@
1
- export const VERSION = "0.14.12"
1
+ export const VERSION = "0.14.13"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whyshu/argent-engine",
3
- "version": "0.14.12",
3
+ "version": "0.14.13",
4
4
  "description": "Argent 引擎(L1):流程/台账/重试/守卫/审计/浏览器自动化 —— 逐字节来自 argent-dsh 仓库",
5
5
  "type": "module",
6
6
  "engines": {