@inline-chat/hermes-agent-adapter 0.0.5-alpha.1 → 0.0.5-alpha.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inline-chat/hermes-agent-adapter",
3
- "version": "0.0.5-alpha.1",
3
+ "version": "0.0.5-alpha.3",
4
4
  "description": "Hermes Agent platform adapter for Inline, with a native Python plugin and bundled Inline realtime sidecar.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -1390,6 +1390,12 @@ class InlineAdapter(BasePlatformAdapter):
1390
1390
  event = json.loads(line)
1391
1391
  except json.JSONDecodeError:
1392
1392
  return
1393
+ # Chat snapshots include mutable dialog and routing fields such as
1394
+ # followMode and lastMsgId. Invalidating here intentionally makes the
1395
+ # next group-message dispatch perform an extra GET_CHAT; correctness
1396
+ # across missed/reordered updates is worth that fetch until the sidecar
1397
+ # owns a coherent client-state cache.
1398
+ self._invalidate_chat_info(event.get("chatId"))
1393
1399
  kind = event.get("kind")
1394
1400
  if kind == "message.action.invoke":
1395
1401
  if await self._handle_action(event):
@@ -2438,6 +2444,11 @@ class InlineAdapter(BasePlatformAdapter):
2438
2444
  if len(self._visible_reply_thread_targets) > _CHAT_INFO_CACHE_MAX_SIZE:
2439
2445
  self._visible_reply_thread_targets.popitem(last=False)
2440
2446
 
2447
+ def _invalidate_chat_info(self, chat_id: Any) -> None:
2448
+ key = self._chat_key(chat_id)
2449
+ if key:
2450
+ self._chat_info_cache.pop(key, None)
2451
+
2441
2452
  def _reply_to_for_target(self, reply_to: Optional[str], target: Dict[str, str]) -> Optional[str]:
2442
2453
  if not reply_to:
2443
2454
  return None
@@ -3001,7 +3012,6 @@ class InlineAdapter(BasePlatformAdapter):
3001
3012
  ) -> SendResult:
3002
3013
  target = self._target_for(chat_id, metadata)
3003
3014
  reply_to = self._reply_to_for_target(reply_to, target)
3004
- parse_markdown = self._parse_markdown and not self._expects_edits(metadata)
3005
3015
  chunks = self.truncate_message(self.format_message(content), self.MAX_MESSAGE_LENGTH)
3006
3016
  message_ids: List[str] = []
3007
3017
  raw_responses: List[Any] = []
@@ -3011,7 +3021,7 @@ class InlineAdapter(BasePlatformAdapter):
3011
3021
  body: Dict[str, Any] = {
3012
3022
  "target": target,
3013
3023
  "text": chunk,
3014
- "parseMarkdown": parse_markdown,
3024
+ "parseMarkdown": self._parse_markdown,
3015
3025
  }
3016
3026
  if reply_to and index == 0:
3017
3027
  body["replyToMsgId"] = str(reply_to)
@@ -3052,7 +3062,6 @@ class InlineAdapter(BasePlatformAdapter):
3052
3062
  metadata: Optional[Dict[str, Any]] = None,
3053
3063
  ) -> SendResult:
3054
3064
  text = self.format_message(content)
3055
- parse_markdown = self._parse_markdown if finalize else False
3056
3065
  if len(text) > self.MAX_MESSAGE_LENGTH:
3057
3066
  if finalize:
3058
3067
  return await self._edit_overflow_split(chat_id, message_id, content, metadata=metadata)
@@ -3062,7 +3071,7 @@ class InlineAdapter(BasePlatformAdapter):
3062
3071
  "target": target,
3063
3072
  "messageId": str(message_id),
3064
3073
  "text": text,
3065
- "parseMarkdown": parse_markdown,
3074
+ "parseMarkdown": self._parse_markdown,
3066
3075
  }
3067
3076
  result = await self._send_sidecar("/edit", body)
3068
3077
  if result.success:
@@ -3480,10 +3489,6 @@ class InlineAdapter(BasePlatformAdapter):
3480
3489
  def format_message(self, content: str) -> str:
3481
3490
  return content if self._parse_markdown else strip_markdown(content)
3482
3491
 
3483
- @staticmethod
3484
- def _expects_edits(metadata: Optional[Dict[str, Any]]) -> bool:
3485
- return bool((metadata or {}).get("expect_edits"))
3486
-
3487
3492
  def _target_for(self, chat_id: str, metadata: Optional[Dict[str, Any]] = None) -> Dict[str, str]:
3488
3493
  thread_id = (metadata or {}).get("thread_id")
3489
3494
  if thread_id:
@@ -3517,6 +3522,9 @@ class InlineAdapter(BasePlatformAdapter):
3517
3522
  try:
3518
3523
  data = await self._sidecar_call(path, body)
3519
3524
  result = data.get("result") or {}
3525
+ target = body.get("target")
3526
+ if isinstance(target, dict):
3527
+ self._invalidate_chat_info(target.get("chatId"))
3520
3528
  return _send_result(
3521
3529
  success=True,
3522
3530
  message_id=str(result.get("messageId") or "") or None,
@@ -73,6 +73,7 @@ def gateway_setup() -> None:
73
73
  if not owner_user_id:
74
74
  owner_user_id = _inline_cli_user_id(shutil.which("inline"))
75
75
  _configure_access(hermes_gateway, hermes_setup, owner_user_id)
76
+ hermes_gateway.write_platform_config_field("inline", "enabled", True, raw=True)
76
77
 
77
78
  print()
78
79
  hermes_setup.print_success("💬 Inline is configured!")
@@ -1,7 +1,7 @@
1
1
  name: inline-platform
2
2
  label: Inline
3
3
  kind: platform
4
- version: 0.0.5-alpha.1
4
+ version: 0.0.5-alpha.3
5
5
  description: >
6
6
  Inline platform adapter for Hermes Agent. The adapter runs as a native
7
7
  Hermes Python platform plugin and supervises a local Node sidecar that uses