lycheedev 1.0.0 → 1.0.2
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/bin/lycheedev.js +58 -8
- package/package.json +1 -1
- package/vendor/addon/Core/Bootstrap.lua +131 -131
- package/vendor/addon/Core/Clients/Mainline.lua +9 -9
- package/vendor/addon/Core/Clients/Mists.lua +9 -9
- package/vendor/addon/Core/Clients/Titan.lua +9 -9
- package/vendor/addon/Core/Compatibility.lua +43 -43
- package/vendor/addon/Core/Database.lua +859 -859
- package/vendor/addon/Core/Inspector.lua +647 -647
- package/vendor/addon/Core/Locale.lua +307 -307
- package/vendor/addon/Core/Locale_enUS.lua +318 -318
- package/vendor/addon/Core/Safety.lua +42 -42
- package/vendor/addon/Core/Serializer.lua +324 -324
- package/vendor/addon/Libs/AutomationQR.lua +1176 -1176
- package/vendor/addon/Lychee Dev_Mainline.toc +43 -43
- package/vendor/addon/Lychee Dev_Mists.toc +43 -43
- package/vendor/addon/Lychee Dev_Wrath.toc +43 -43
- package/vendor/addon/Modules/Automation/Controller.lua +757 -757
- package/vendor/addon/Modules/Automation/Report.lua +409 -409
- package/vendor/addon/Modules/Automation/auto/auto.lua +12 -12
- package/vendor/addon/Modules/Diagnostics.lua +238 -238
- package/vendor/addon/Modules/Events/Catalog.lua +184 -184
- package/vendor/addon/Modules/Events/CatalogData_Mainline.lua +1788 -1788
- package/vendor/addon/Modules/Events/CatalogData_Mists.lua +1489 -1489
- package/vendor/addon/Modules/Events/CatalogData_Titan.lua +1492 -1492
- package/vendor/addon/Modules/Events/Monitor.lua +181 -181
- package/vendor/addon/Modules/FunctionTrace.lua +85 -85
- package/vendor/addon/Modules/ObjectInspector.lua +329 -329
- package/vendor/addon/UI/AutomationOverlay.lua +183 -183
- package/vendor/addon/UI/Export.lua +140 -140
- package/vendor/addon/UI/Features.lua +890 -890
- package/vendor/addon/UI/MainWindow.lua +1145 -1145
- package/vendor/addon/UI/Pages/About.lua +223 -223
- package/vendor/addon/UI/Pages/Automation.lua +417 -417
- package/vendor/addon/UI/Pages/Diagnostics.lua +289 -289
- package/vendor/addon/UI/Pages/ExportRecords.lua +387 -387
- package/vendor/addon/UI/Pages/Object.lua +573 -573
- package/vendor/addon/UI/Pages/Trace.lua +165 -165
- package/vendor/skill/SKILL.md +94 -94
- package/vendor/skill/agents/openai.yaml +4 -4
- package/vendor/skill/references/automation.md +327 -327
- package/vendor/skill/references/runtime-investigations.md +97 -97
- package/vendor/skill/scripts/automation/__init__.py +1 -1
- package/vendor/skill/scripts/automation/registry.py +516 -516
- package/vendor/skill/scripts/automation/saved_variables.py +438 -438
- package/vendor/skill/scripts/automation/session.py +207 -207
- package/vendor/skill/scripts/automation/windows.py +573 -573
- package/vendor/skill/scripts/automation.py +865 -865
- package/vendor/skill/scripts/requirements.txt +13 -13
- package/vendor/skill/scripts/selftest_offline.py +981 -981
|
@@ -1,207 +1,207 @@
|
|
|
1
|
-
"""Host-side session state for the Lychee Dev automation loop.
|
|
2
|
-
|
|
3
|
-
Everything the host must remember across script restarts lives here: the
|
|
4
|
-
append-only host log, the ``(installation, requestId, ticket)`` reload dedup
|
|
5
|
-
key, bounded waits for the game to write its SavedVariables file, and the
|
|
6
|
-
per-ticket artifact directory. The host log and artifacts live under a local
|
|
7
|
-
data directory and never inside the versioned skill sources or the addon ZIP.
|
|
8
|
-
|
|
9
|
-
Every record carries its installation scope, and reads default to that scope so
|
|
10
|
-
``status``/``recover`` cannot mix two WoW installations or multi-account runs.
|
|
11
|
-
Artifacts are written byte-for-byte: the recorded byte count and SHA-256 must
|
|
12
|
-
describe the exact bytes on disk (no newline translation).
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
from __future__ import annotations
|
|
16
|
-
|
|
17
|
-
import json
|
|
18
|
-
import os
|
|
19
|
-
import tempfile
|
|
20
|
-
import time
|
|
21
|
-
from dataclasses import dataclass, field
|
|
22
|
-
|
|
23
|
-
ALL_INSTALLATIONS = "*"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def default_data_dir() -> str:
|
|
27
|
-
base = os.environ.get("LOCALAPPDATA") or os.path.expanduser("~")
|
|
28
|
-
return os.path.join(base, "LycheeDev", "automation")
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
@dataclass
|
|
32
|
-
class Session:
|
|
33
|
-
data_dir: str = field(default_factory=default_data_dir)
|
|
34
|
-
installation: str = "default"
|
|
35
|
-
|
|
36
|
-
def __post_init__(self) -> None:
|
|
37
|
-
os.makedirs(self.data_dir, exist_ok=True)
|
|
38
|
-
os.makedirs(self.received_dir, exist_ok=True)
|
|
39
|
-
|
|
40
|
-
@property
|
|
41
|
-
def log_path(self) -> str:
|
|
42
|
-
return os.path.join(self.data_dir, "session.log.jsonl")
|
|
43
|
-
|
|
44
|
-
@property
|
|
45
|
-
def received_dir(self) -> str:
|
|
46
|
-
return os.path.join(self.data_dir, "received")
|
|
47
|
-
|
|
48
|
-
# --- host log ---------------------------------------------------------
|
|
49
|
-
|
|
50
|
-
def log_event(self, event: str, **fields) -> None:
|
|
51
|
-
record = {
|
|
52
|
-
"ts": int(time.time()),
|
|
53
|
-
"installation": self.installation,
|
|
54
|
-
"event": event,
|
|
55
|
-
}
|
|
56
|
-
record.update(fields)
|
|
57
|
-
line = json.dumps(record, ensure_ascii=False, sort_keys=True) + "\n"
|
|
58
|
-
with open(self.log_path, "a", encoding="utf-8", newline="\n") as handle:
|
|
59
|
-
handle.write(line)
|
|
60
|
-
|
|
61
|
-
def read_events(self, event: str | None = None, *,
|
|
62
|
-
installation: str | None = None) -> list[dict]:
|
|
63
|
-
"""Read host log records, scoped to one installation by default.
|
|
64
|
-
|
|
65
|
-
``installation`` defaults to this session's scope; pass
|
|
66
|
-
``ALL_INSTALLATIONS`` to read every scope, or another name to inspect a
|
|
67
|
-
different one. A torn tail line is skipped, never fatal.
|
|
68
|
-
"""
|
|
69
|
-
|
|
70
|
-
scope = self.installation if installation is None else installation
|
|
71
|
-
if not os.path.exists(self.log_path):
|
|
72
|
-
return []
|
|
73
|
-
matches = []
|
|
74
|
-
with open(self.log_path, "r", encoding="utf-8") as handle:
|
|
75
|
-
for line in handle:
|
|
76
|
-
line = line.strip()
|
|
77
|
-
if not line:
|
|
78
|
-
continue
|
|
79
|
-
try:
|
|
80
|
-
record = json.loads(line)
|
|
81
|
-
except ValueError:
|
|
82
|
-
continue # a torn tail line must not break recovery
|
|
83
|
-
if not isinstance(record, dict):
|
|
84
|
-
continue
|
|
85
|
-
if event is not None and record.get("event") != event:
|
|
86
|
-
continue
|
|
87
|
-
if scope != ALL_INSTALLATIONS and record.get("installation") != scope:
|
|
88
|
-
continue
|
|
89
|
-
matches.append(record)
|
|
90
|
-
return matches
|
|
91
|
-
|
|
92
|
-
# --- reload dedup -----------------------------------------------------
|
|
93
|
-
|
|
94
|
-
def reload_already_requested(self, request_id: str, ticket: str) -> bool:
|
|
95
|
-
key = (self.installation, request_id, ticket)
|
|
96
|
-
for record in self.read_events("reload_requested"):
|
|
97
|
-
candidate = (record.get("installation"), record.get("requestId"),
|
|
98
|
-
record.get("ticket"))
|
|
99
|
-
if candidate == key:
|
|
100
|
-
return True
|
|
101
|
-
return False
|
|
102
|
-
|
|
103
|
-
def mark_reload_requested(self, request_id: str, ticket: str, **fields) -> bool:
|
|
104
|
-
"""Persist the intent before sending /reload; returns False when the
|
|
105
|
-
same static notice was already acted on (one notice, one reload)."""
|
|
106
|
-
|
|
107
|
-
if self.reload_already_requested(request_id, ticket):
|
|
108
|
-
return False
|
|
109
|
-
self.log_event("reload_requested", requestId=request_id, ticket=ticket, **fields)
|
|
110
|
-
return True
|
|
111
|
-
|
|
112
|
-
# --- artifacts --------------------------------------------------------
|
|
113
|
-
|
|
114
|
-
def artifact_dir(self, ticket: str) -> str:
|
|
115
|
-
path = os.path.join(self.received_dir, ticket)
|
|
116
|
-
os.makedirs(path, exist_ok=True)
|
|
117
|
-
return path
|
|
118
|
-
|
|
119
|
-
def save_artifact(self, ticket: str, name: str, content: str | bytes) -> str:
|
|
120
|
-
"""Write one artifact byte-for-byte, with no newline translation.
|
|
121
|
-
|
|
122
|
-
The on-disk bytes are exactly ``content`` encoded as UTF-8 (or the
|
|
123
|
-
bytes passed in), so a recorded byteCount/SHA-256 always matches.
|
|
124
|
-
"""
|
|
125
|
-
|
|
126
|
-
data = content.encode("utf-8") if isinstance(content, str) else bytes(content)
|
|
127
|
-
path = os.path.join(self.artifact_dir(ticket), name)
|
|
128
|
-
with open(path, "wb") as handle:
|
|
129
|
-
handle.write(data)
|
|
130
|
-
return path
|
|
131
|
-
|
|
132
|
-
# --- JSON state files -------------------------------------------------
|
|
133
|
-
|
|
134
|
-
def state_path(self, name: str) -> str:
|
|
135
|
-
return os.path.join(self.data_dir, name)
|
|
136
|
-
|
|
137
|
-
def load_json(self, name: str):
|
|
138
|
-
path = self.state_path(name)
|
|
139
|
-
if not os.path.exists(path):
|
|
140
|
-
return {}
|
|
141
|
-
with open(path, "r", encoding="utf-8") as handle:
|
|
142
|
-
return json.load(handle)
|
|
143
|
-
|
|
144
|
-
def save_json(self, name: str, payload) -> str:
|
|
145
|
-
"""Atomically replace one JSON state file inside the data directory."""
|
|
146
|
-
|
|
147
|
-
path = self.state_path(name)
|
|
148
|
-
text = json.dumps(payload, ensure_ascii=False, indent=2, sort_keys=True) + "\n"
|
|
149
|
-
directory = os.path.dirname(path) or "."
|
|
150
|
-
os.makedirs(directory, exist_ok=True)
|
|
151
|
-
handle = tempfile.NamedTemporaryFile(
|
|
152
|
-
"wb", dir=directory, delete=False, prefix=".state-", suffix=".tmp")
|
|
153
|
-
try:
|
|
154
|
-
with handle:
|
|
155
|
-
handle.write(text.encode("utf-8"))
|
|
156
|
-
handle.flush()
|
|
157
|
-
os.fsync(handle.fileno())
|
|
158
|
-
os.replace(handle.name, path)
|
|
159
|
-
except BaseException:
|
|
160
|
-
try:
|
|
161
|
-
os.unlink(handle.name)
|
|
162
|
-
except OSError:
|
|
163
|
-
pass
|
|
164
|
-
raise
|
|
165
|
-
return path
|
|
166
|
-
|
|
167
|
-
# --- waiting for the disk write ---------------------------------------
|
|
168
|
-
|
|
169
|
-
def wait_for_saved_variables(
|
|
170
|
-
self,
|
|
171
|
-
sv_path: str,
|
|
172
|
-
*,
|
|
173
|
-
timeout: float = 120.0,
|
|
174
|
-
poll_interval: float = 0.25,
|
|
175
|
-
baseline: tuple[int, int, float] | None = None,
|
|
176
|
-
) -> bool:
|
|
177
|
-
"""Wait until the file's identity/size/mtime moves from the baseline.
|
|
178
|
-
|
|
179
|
-
The change is only a wake-up hint, never proof of completion: callers
|
|
180
|
-
must still verify the expected ticket inside the parsed file.
|
|
181
|
-
"""
|
|
182
|
-
|
|
183
|
-
def snapshot() -> tuple[int, int, float]:
|
|
184
|
-
info = os.stat(sv_path)
|
|
185
|
-
return (info.st_dev, info.st_size, info.st_mtime)
|
|
186
|
-
|
|
187
|
-
if baseline is None:
|
|
188
|
-
try:
|
|
189
|
-
baseline = snapshot()
|
|
190
|
-
except OSError:
|
|
191
|
-
baseline = (0, 0, 0.0)
|
|
192
|
-
deadline = time.monotonic() + timeout
|
|
193
|
-
while time.monotonic() < deadline:
|
|
194
|
-
try:
|
|
195
|
-
if snapshot() != baseline:
|
|
196
|
-
return True
|
|
197
|
-
except OSError:
|
|
198
|
-
pass # replaced mid-write; keep polling until the deadline
|
|
199
|
-
time.sleep(poll_interval)
|
|
200
|
-
return False
|
|
201
|
-
|
|
202
|
-
def file_snapshot(self, sv_path: str) -> tuple[int, int, float]:
|
|
203
|
-
try:
|
|
204
|
-
info = os.stat(sv_path)
|
|
205
|
-
return (info.st_dev, info.st_size, info.st_mtime)
|
|
206
|
-
except OSError:
|
|
207
|
-
return (0, 0, 0.0)
|
|
1
|
+
"""Host-side session state for the Lychee Dev automation loop.
|
|
2
|
+
|
|
3
|
+
Everything the host must remember across script restarts lives here: the
|
|
4
|
+
append-only host log, the ``(installation, requestId, ticket)`` reload dedup
|
|
5
|
+
key, bounded waits for the game to write its SavedVariables file, and the
|
|
6
|
+
per-ticket artifact directory. The host log and artifacts live under a local
|
|
7
|
+
data directory and never inside the versioned skill sources or the addon ZIP.
|
|
8
|
+
|
|
9
|
+
Every record carries its installation scope, and reads default to that scope so
|
|
10
|
+
``status``/``recover`` cannot mix two WoW installations or multi-account runs.
|
|
11
|
+
Artifacts are written byte-for-byte: the recorded byte count and SHA-256 must
|
|
12
|
+
describe the exact bytes on disk (no newline translation).
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
import os
|
|
19
|
+
import tempfile
|
|
20
|
+
import time
|
|
21
|
+
from dataclasses import dataclass, field
|
|
22
|
+
|
|
23
|
+
ALL_INSTALLATIONS = "*"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def default_data_dir() -> str:
|
|
27
|
+
base = os.environ.get("LOCALAPPDATA") or os.path.expanduser("~")
|
|
28
|
+
return os.path.join(base, "LycheeDev", "automation")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass
|
|
32
|
+
class Session:
|
|
33
|
+
data_dir: str = field(default_factory=default_data_dir)
|
|
34
|
+
installation: str = "default"
|
|
35
|
+
|
|
36
|
+
def __post_init__(self) -> None:
|
|
37
|
+
os.makedirs(self.data_dir, exist_ok=True)
|
|
38
|
+
os.makedirs(self.received_dir, exist_ok=True)
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def log_path(self) -> str:
|
|
42
|
+
return os.path.join(self.data_dir, "session.log.jsonl")
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def received_dir(self) -> str:
|
|
46
|
+
return os.path.join(self.data_dir, "received")
|
|
47
|
+
|
|
48
|
+
# --- host log ---------------------------------------------------------
|
|
49
|
+
|
|
50
|
+
def log_event(self, event: str, **fields) -> None:
|
|
51
|
+
record = {
|
|
52
|
+
"ts": int(time.time()),
|
|
53
|
+
"installation": self.installation,
|
|
54
|
+
"event": event,
|
|
55
|
+
}
|
|
56
|
+
record.update(fields)
|
|
57
|
+
line = json.dumps(record, ensure_ascii=False, sort_keys=True) + "\n"
|
|
58
|
+
with open(self.log_path, "a", encoding="utf-8", newline="\n") as handle:
|
|
59
|
+
handle.write(line)
|
|
60
|
+
|
|
61
|
+
def read_events(self, event: str | None = None, *,
|
|
62
|
+
installation: str | None = None) -> list[dict]:
|
|
63
|
+
"""Read host log records, scoped to one installation by default.
|
|
64
|
+
|
|
65
|
+
``installation`` defaults to this session's scope; pass
|
|
66
|
+
``ALL_INSTALLATIONS`` to read every scope, or another name to inspect a
|
|
67
|
+
different one. A torn tail line is skipped, never fatal.
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
scope = self.installation if installation is None else installation
|
|
71
|
+
if not os.path.exists(self.log_path):
|
|
72
|
+
return []
|
|
73
|
+
matches = []
|
|
74
|
+
with open(self.log_path, "r", encoding="utf-8") as handle:
|
|
75
|
+
for line in handle:
|
|
76
|
+
line = line.strip()
|
|
77
|
+
if not line:
|
|
78
|
+
continue
|
|
79
|
+
try:
|
|
80
|
+
record = json.loads(line)
|
|
81
|
+
except ValueError:
|
|
82
|
+
continue # a torn tail line must not break recovery
|
|
83
|
+
if not isinstance(record, dict):
|
|
84
|
+
continue
|
|
85
|
+
if event is not None and record.get("event") != event:
|
|
86
|
+
continue
|
|
87
|
+
if scope != ALL_INSTALLATIONS and record.get("installation") != scope:
|
|
88
|
+
continue
|
|
89
|
+
matches.append(record)
|
|
90
|
+
return matches
|
|
91
|
+
|
|
92
|
+
# --- reload dedup -----------------------------------------------------
|
|
93
|
+
|
|
94
|
+
def reload_already_requested(self, request_id: str, ticket: str) -> bool:
|
|
95
|
+
key = (self.installation, request_id, ticket)
|
|
96
|
+
for record in self.read_events("reload_requested"):
|
|
97
|
+
candidate = (record.get("installation"), record.get("requestId"),
|
|
98
|
+
record.get("ticket"))
|
|
99
|
+
if candidate == key:
|
|
100
|
+
return True
|
|
101
|
+
return False
|
|
102
|
+
|
|
103
|
+
def mark_reload_requested(self, request_id: str, ticket: str, **fields) -> bool:
|
|
104
|
+
"""Persist the intent before sending /reload; returns False when the
|
|
105
|
+
same static notice was already acted on (one notice, one reload)."""
|
|
106
|
+
|
|
107
|
+
if self.reload_already_requested(request_id, ticket):
|
|
108
|
+
return False
|
|
109
|
+
self.log_event("reload_requested", requestId=request_id, ticket=ticket, **fields)
|
|
110
|
+
return True
|
|
111
|
+
|
|
112
|
+
# --- artifacts --------------------------------------------------------
|
|
113
|
+
|
|
114
|
+
def artifact_dir(self, ticket: str) -> str:
|
|
115
|
+
path = os.path.join(self.received_dir, ticket)
|
|
116
|
+
os.makedirs(path, exist_ok=True)
|
|
117
|
+
return path
|
|
118
|
+
|
|
119
|
+
def save_artifact(self, ticket: str, name: str, content: str | bytes) -> str:
|
|
120
|
+
"""Write one artifact byte-for-byte, with no newline translation.
|
|
121
|
+
|
|
122
|
+
The on-disk bytes are exactly ``content`` encoded as UTF-8 (or the
|
|
123
|
+
bytes passed in), so a recorded byteCount/SHA-256 always matches.
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
data = content.encode("utf-8") if isinstance(content, str) else bytes(content)
|
|
127
|
+
path = os.path.join(self.artifact_dir(ticket), name)
|
|
128
|
+
with open(path, "wb") as handle:
|
|
129
|
+
handle.write(data)
|
|
130
|
+
return path
|
|
131
|
+
|
|
132
|
+
# --- JSON state files -------------------------------------------------
|
|
133
|
+
|
|
134
|
+
def state_path(self, name: str) -> str:
|
|
135
|
+
return os.path.join(self.data_dir, name)
|
|
136
|
+
|
|
137
|
+
def load_json(self, name: str):
|
|
138
|
+
path = self.state_path(name)
|
|
139
|
+
if not os.path.exists(path):
|
|
140
|
+
return {}
|
|
141
|
+
with open(path, "r", encoding="utf-8") as handle:
|
|
142
|
+
return json.load(handle)
|
|
143
|
+
|
|
144
|
+
def save_json(self, name: str, payload) -> str:
|
|
145
|
+
"""Atomically replace one JSON state file inside the data directory."""
|
|
146
|
+
|
|
147
|
+
path = self.state_path(name)
|
|
148
|
+
text = json.dumps(payload, ensure_ascii=False, indent=2, sort_keys=True) + "\n"
|
|
149
|
+
directory = os.path.dirname(path) or "."
|
|
150
|
+
os.makedirs(directory, exist_ok=True)
|
|
151
|
+
handle = tempfile.NamedTemporaryFile(
|
|
152
|
+
"wb", dir=directory, delete=False, prefix=".state-", suffix=".tmp")
|
|
153
|
+
try:
|
|
154
|
+
with handle:
|
|
155
|
+
handle.write(text.encode("utf-8"))
|
|
156
|
+
handle.flush()
|
|
157
|
+
os.fsync(handle.fileno())
|
|
158
|
+
os.replace(handle.name, path)
|
|
159
|
+
except BaseException:
|
|
160
|
+
try:
|
|
161
|
+
os.unlink(handle.name)
|
|
162
|
+
except OSError:
|
|
163
|
+
pass
|
|
164
|
+
raise
|
|
165
|
+
return path
|
|
166
|
+
|
|
167
|
+
# --- waiting for the disk write ---------------------------------------
|
|
168
|
+
|
|
169
|
+
def wait_for_saved_variables(
|
|
170
|
+
self,
|
|
171
|
+
sv_path: str,
|
|
172
|
+
*,
|
|
173
|
+
timeout: float = 120.0,
|
|
174
|
+
poll_interval: float = 0.25,
|
|
175
|
+
baseline: tuple[int, int, float] | None = None,
|
|
176
|
+
) -> bool:
|
|
177
|
+
"""Wait until the file's identity/size/mtime moves from the baseline.
|
|
178
|
+
|
|
179
|
+
The change is only a wake-up hint, never proof of completion: callers
|
|
180
|
+
must still verify the expected ticket inside the parsed file.
|
|
181
|
+
"""
|
|
182
|
+
|
|
183
|
+
def snapshot() -> tuple[int, int, float]:
|
|
184
|
+
info = os.stat(sv_path)
|
|
185
|
+
return (info.st_dev, info.st_size, info.st_mtime)
|
|
186
|
+
|
|
187
|
+
if baseline is None:
|
|
188
|
+
try:
|
|
189
|
+
baseline = snapshot()
|
|
190
|
+
except OSError:
|
|
191
|
+
baseline = (0, 0, 0.0)
|
|
192
|
+
deadline = time.monotonic() + timeout
|
|
193
|
+
while time.monotonic() < deadline:
|
|
194
|
+
try:
|
|
195
|
+
if snapshot() != baseline:
|
|
196
|
+
return True
|
|
197
|
+
except OSError:
|
|
198
|
+
pass # replaced mid-write; keep polling until the deadline
|
|
199
|
+
time.sleep(poll_interval)
|
|
200
|
+
return False
|
|
201
|
+
|
|
202
|
+
def file_snapshot(self, sv_path: str) -> tuple[int, int, float]:
|
|
203
|
+
try:
|
|
204
|
+
info = os.stat(sv_path)
|
|
205
|
+
return (info.st_dev, info.st_size, info.st_mtime)
|
|
206
|
+
except OSError:
|
|
207
|
+
return (0, 0, 0.0)
|