@misterhuydo/sentinel 1.5.59 → 1.5.61
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/.cairn/.hint-lock +1 -1
- package/.cairn/session.json +2 -2
- package/package.json +1 -1
- package/python/sentinel/__init__.py +1 -1
- package/python/sentinel/main.py +38 -18
package/.cairn/.hint-lock
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2026-04-
|
|
1
|
+
2026-04-21T09:15:18.249Z
|
package/.cairn/session.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"message": "Auto-checkpoint at 2026-04-
|
|
3
|
-
"checkpoint_at": "2026-04-
|
|
2
|
+
"message": "Auto-checkpoint at 2026-04-21T09:17:19.216Z",
|
|
3
|
+
"checkpoint_at": "2026-04-21T09:17:19.218Z",
|
|
4
4
|
"active_files": [
|
|
5
5
|
"J:\\Projects\\Sentinel\\cli\\bin\\sentinel.js",
|
|
6
6
|
"J:\\Projects\\Sentinel\\cli\\lib\\test.js",
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.5.
|
|
1
|
+
__version__ = "1.5.61"
|
package/python/sentinel/main.py
CHANGED
|
@@ -1846,27 +1846,47 @@ async def _execute_monitor(monitor: dict, cfg_loader: ConfigLoader, store: State
|
|
|
1846
1846
|
# Only post if there is something to show
|
|
1847
1847
|
if formatted_parts:
|
|
1848
1848
|
combined = "\n".join(formatted_parts)
|
|
1849
|
-
MAX_LEN = 3800
|
|
1850
|
-
if len(combined) > MAX_LEN:
|
|
1851
|
-
tail = combined[:MAX_LEN]
|
|
1852
|
-
# Close any unclosed code block before the truncation note
|
|
1853
|
-
if tail.count("```") % 2 == 1:
|
|
1854
|
-
tail += "\n```"
|
|
1855
|
-
combined = tail + f"\n_…truncated ({len(combined)} chars total)_"
|
|
1856
1849
|
header = f":repeat: *Monitor `{mon_id}`* ({mon_name}) — run #{runs_after}"
|
|
1857
1850
|
if done:
|
|
1858
1851
|
header += " _(final)_"
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1852
|
+
|
|
1853
|
+
# Split into 2900-char chunks (Slack section block limit is 3000).
|
|
1854
|
+
# Chunk on line boundaries where possible; preserve open/close ``` pairs.
|
|
1855
|
+
CHUNK = 2900
|
|
1856
|
+
chunks: list[str] = []
|
|
1857
|
+
remaining = combined
|
|
1858
|
+
while remaining:
|
|
1859
|
+
if len(remaining) <= CHUNK:
|
|
1860
|
+
chunks.append(remaining)
|
|
1861
|
+
break
|
|
1862
|
+
# Find last newline within the limit
|
|
1863
|
+
split_at = remaining.rfind("\n", 0, CHUNK)
|
|
1864
|
+
if split_at == -1:
|
|
1865
|
+
split_at = CHUNK
|
|
1866
|
+
piece = remaining[:split_at]
|
|
1867
|
+
rest = remaining[split_at:].lstrip("\n")
|
|
1868
|
+
# Close any unclosed code block so each chunk is self-contained,
|
|
1869
|
+
# and reopen it at the start of the next chunk
|
|
1870
|
+
if piece.count("```") % 2 == 1:
|
|
1871
|
+
piece += "\n```"
|
|
1872
|
+
rest = "```\n" + rest
|
|
1873
|
+
chunks.append(piece)
|
|
1874
|
+
remaining = rest
|
|
1875
|
+
|
|
1876
|
+
for i, chunk in enumerate(chunks):
|
|
1877
|
+
chunk_header = header if i == 0 else f"_{mon_name} continued ({i + 1}/{len(chunks)})_"
|
|
1878
|
+
try:
|
|
1879
|
+
await slack_client.chat_postMessage(
|
|
1880
|
+
channel=channel,
|
|
1881
|
+
text=chunk_header,
|
|
1882
|
+
blocks=[
|
|
1883
|
+
{"type": "section", "text": {"type": "mrkdwn", "text": chunk_header}},
|
|
1884
|
+
{"type": "section", "text": {"type": "mrkdwn", "text": chunk}},
|
|
1885
|
+
],
|
|
1886
|
+
)
|
|
1887
|
+
except Exception as e:
|
|
1888
|
+
logger.warning("Monitor %s: Slack post chunk %d failed: %s", mon_id, i, e)
|
|
1889
|
+
break
|
|
1870
1890
|
|
|
1871
1891
|
if done:
|
|
1872
1892
|
try:
|