@misterhuydo/sentinel 1.4.44 → 1.4.46

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 CHANGED
@@ -1 +1 @@
1
- 2026-03-25T10:11:02.271Z
1
+ 2026-03-25T10:49:00.064Z
@@ -1,6 +1,6 @@
1
1
  {
2
- "message": "Auto-checkpoint at 2026-03-25T10:07:47.873Z",
3
- "checkpoint_at": "2026-03-25T10:07:47.874Z",
2
+ "message": "Auto-checkpoint at 2026-03-25T10:49:12.879Z",
3
+ "checkpoint_at": "2026-03-25T10:49:12.881Z",
4
4
  "active_files": [],
5
5
  "notes": [],
6
6
  "mtime_snapshot": {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@misterhuydo/sentinel",
3
- "version": "1.4.44",
3
+ "version": "1.4.46",
4
4
  "description": "Sentinel — Autonomous DevOps Agent installer and manager",
5
5
  "bin": {
6
6
  "sentinel": "./bin/sentinel.js"
@@ -129,6 +129,29 @@ def _build_prompt(event, repo: RepoConfig, log_file, marker: str, stale_markers:
129
129
  ]
130
130
  return "\n".join(lines_out)
131
131
 
132
+ def _fix_blank_context_lines(patch: str) -> str:
133
+ """
134
+ Ensure blank context lines inside hunks have a leading space.
135
+ Claude sometimes outputs empty lines in hunk bodies as bare '\\n'
136
+ instead of ' \\n', which causes git-apply to report 'corrupt patch'.
137
+ """
138
+ lines = patch.splitlines()
139
+ result = []
140
+ in_hunk = False
141
+ for line in lines:
142
+ if line.startswith("@@"):
143
+ in_hunk = True
144
+ result.append(line)
145
+ elif line.startswith(("diff ", "--- ", "+++ ", "index ")):
146
+ in_hunk = False
147
+ result.append(line)
148
+ elif in_hunk and line == "":
149
+ result.append(" ")
150
+ else:
151
+ result.append(line)
152
+ return "\n".join(result) + "\n"
153
+
154
+
132
155
  def _validate_patch(patch: str) -> tuple[bool, str]:
133
156
  files_changed = len(re.findall(r"^diff --git", patch, re.MULTILINE))
134
157
  lines_changed = len([
@@ -338,6 +361,8 @@ def generate_fix(
338
361
  logger.warning("No patch found in Claude output for %s", event.fingerprint)
339
362
  return "error", None, ""
340
363
 
364
+ patch = _fix_blank_context_lines(patch)
365
+
341
366
  ok, reason = _validate_patch(patch)
342
367
  if not ok:
343
368
  logger.warning("Patch rejected for %s: %s", event.fingerprint, reason)
@@ -134,15 +134,23 @@ async def run_slack_bot(cfg_loader, store) -> None:
134
134
 
135
135
  @app.event("message")
136
136
  async def on_message(event, client):
137
+ if event.get("bot_id"):
138
+ # Passive bot watcher — bot messages from DB-registered bots
139
+ if event.get("channel") and store.is_watched_bot(event["bot_id"]):
140
+ await _handle_bot_message(event, client, cfg_loader, store)
141
+ return
142
+
137
143
  # DMs from humans → Boss conversation
138
- if event.get("channel_type") == "im" and not event.get("bot_id"):
144
+ if event.get("channel_type") == "im":
139
145
  await _dispatch(event, client, cfg_loader, store)
140
146
  return
141
147
 
142
- # Passive bot watcherbot messages from DB-registered bots
143
- bot_id = event.get("bot_id", "")
144
- if bot_id and event.get("channel") and store.is_watched_bot(bot_id):
145
- await _handle_bot_message(event, client, cfg_loader, store)
148
+ # Thread replies in channels route to Boss if the user has an active session
149
+ # (so the user can reply "yes" / "go ahead" without typing @Sentinel each time)
150
+ if event.get("thread_ts") and not event.get("subtype"):
151
+ user_id = event.get("user", "")
152
+ if user_id and user_id in _sessions:
153
+ await _dispatch(event, client, cfg_loader, store)
146
154
 
147
155
  # ── Start ─────────────────────────────────────────────────────────────────
148
156