@cotal-ai/connector-hermes 0.154.0 → 0.155.0
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/dist/bridge.d.ts.map +1 -1
- package/dist/docs-bundle.bin +0 -0
- package/dist/docs-index.bin +0 -0
- package/dist/index.js +1 -1
- package/dist/launch.js +10 -10
- package/package.json +3 -3
- package/plugin/cotal/_sidecar/docs-bundle.bin +0 -0
- package/plugin/cotal/_sidecar/docs-index.bin +0 -0
- package/plugin/cotal/_sidecar/standalone.cjs +10 -10
- package/plugin/cotal/adapter.py +8 -1
- package/plugin/cotal/framing.py +4 -0
package/plugin/cotal/adapter.py
CHANGED
|
@@ -40,11 +40,16 @@ class InjectionRefused(Exception):
|
|
|
40
40
|
sidecar offers it again later (``deferred``)."""
|
|
41
41
|
|
|
42
42
|
|
|
43
|
+
# The chat the delivery daemon's notices run in. It has no mesh target, so a turn's reply to a notice
|
|
44
|
+
# is not sent: a notice wants no answer, and its sender is the daemon, not a peer.
|
|
45
|
+
NOTICE_CHAT = "notice:anycast"
|
|
46
|
+
|
|
47
|
+
|
|
43
48
|
def chat_type_for(chat_id: str) -> Optional[str]:
|
|
44
49
|
"""The chat type of a chat_id minted on inbound, or None for an id this adapter did not mint."""
|
|
45
50
|
if chat_id.startswith("channel:"):
|
|
46
51
|
return "group"
|
|
47
|
-
if chat_id.startswith("dm:"):
|
|
52
|
+
if chat_id.startswith("dm:") or chat_id == NOTICE_CHAT:
|
|
48
53
|
return "dm"
|
|
49
54
|
return None
|
|
50
55
|
|
|
@@ -193,6 +198,8 @@ class CotalAdapter(BasePlatformAdapter):
|
|
|
193
198
|
if kind == "channel":
|
|
194
199
|
ch = msg.get("channel") or "general"
|
|
195
200
|
chat_id, chat_name = f"channel:{ch}", f"#{ch}"
|
|
201
|
+
elif msg.get("notice") == "anycast":
|
|
202
|
+
chat_id, chat_name = NOTICE_CHAT, "anycast notices"
|
|
196
203
|
else: # dm / anycast → a turn whose reply goes straight back to the sender
|
|
197
204
|
chat_id, chat_name = f"dm:{msg.get('fromId')}", sender
|
|
198
205
|
chat_type = chat_type_for(chat_id)
|
package/plugin/cotal/framing.py
CHANGED
|
@@ -57,4 +57,8 @@ def format_injection(msg: dict) -> str:
|
|
|
57
57
|
who = f"{sender} / {attribution_safe(role)}" if role else sender
|
|
58
58
|
# A backfilled item pre-dates this session; say so the way connector-core's fmtItem does (#2205).
|
|
59
59
|
history = "(history) " if msg.get("historical") is True else ""
|
|
60
|
+
# A notice is the mesh's own word about a request this seat sent, checked against the delivery
|
|
61
|
+
# lease, so it is labelled as that and not as a peer's DM, as connector-core's fmtItem does.
|
|
62
|
+
if msg.get("notice") == "anycast":
|
|
63
|
+
return f"[anycast notice from the delivery daemon] {history}{body_safe(msg.get('text'))}"
|
|
60
64
|
return f"[{kind} from {who}] {history}{body_safe(msg.get('text'))}"
|