Add QR pairing (terminal QR, in-app scanner, iris://pair deep link)
This commit is contained in:
1 parent
27dc7917f2
commit
7a6d922d12
63 files changed
+2073
-630
No files matched your search
@@ -3,9 +3,9 @@
|
||||
Maps app concepts onto hermes' existing ``chat_id`` / ``thread_id`` primitives
|
||||
(docs/06-channels-cron-search.md §6.1):
|
||||
|
||||
* **default chat** -> the home channel (``ANDROID_HOME_CHANNEL``, default
|
||||
``android:default``), ``kind="default"``, ``is_default=1``.
|
||||
* **user channel** -> a minted ``chat_id = android:chan_<n>``, ``kind="channel"``.
|
||||
* **default chat** -> the home channel (``IRIS_HOME_CHANNEL``, default
|
||||
``default``), ``kind="default"``, ``is_default=1``.
|
||||
* **user channel** -> a minted ``chat_id = chan_<n>``, ``kind="channel"``.
|
||||
* **thread** -> a minted ``thread_id = t_<n>`` under a ``chat_id``,
|
||||
``kind="thread"`` (stored with its ``parent_chat_id``).
|
||||
|
||||
@@ -15,7 +15,7 @@ directory (``gateway/channel_directory.py``) via the adapter's
|
||||
``list_channels()`` hook, so ``send_message`` / cron can resolve a friendly
|
||||
name (e.g. "Cron Reports") to a chat_id.
|
||||
|
||||
Storage: ``get_hermes_home()/"android"/channels.db``.
|
||||
Storage: ``get_hermes_home()/"iris"/channels.db``.
|
||||
|
||||
Milestone M3.
|
||||
"""
|
||||
@@ -37,12 +37,12 @@ KIND_CHANNEL = "channel"
|
||||
KIND_THREAD = "thread"
|
||||
|
||||
# chat_id / thread_id minting prefixes.
|
||||
CHANNEL_PREFIX = "android:chan_"
|
||||
CHANNEL_PREFIX = "chan_"
|
||||
THREAD_PREFIX = "t_"
|
||||
|
||||
|
||||
class ChannelDirectory:
|
||||
"""Persistent channel directory under ``get_hermes_home()/"android"``.
|
||||
"""Persistent channel directory under ``get_hermes_home()/"iris"``.
|
||||
|
||||
Thread-safe (single connection + lock); all operations are small and fast
|
||||
enough to run inline on the gateway's asyncio loop. Mirrors the
|
||||
@@ -127,7 +127,7 @@ class ChannelDirectory:
|
||||
when it was still the auto default); if another row is marked default
|
||||
it is cleared so exactly one default exists.
|
||||
"""
|
||||
chat_id = (chat_id or "android:default").strip() or "android:default"
|
||||
chat_id = (chat_id or "default").strip() or "default"
|
||||
name = (name or "Default").strip() or "Default"
|
||||
with self._lock:
|
||||
existing = self._conn.execute(
|
||||
@@ -443,6 +443,6 @@ def get_directory() -> ChannelDirectory:
|
||||
# failure is not actionable.
|
||||
with contextlib.suppress(Exception):
|
||||
_directory.close()
|
||||
_directory = ChannelDirectory(home / "android" / "channels.db")
|
||||
_directory = ChannelDirectory(home / "iris" / "channels.db")
|
||||
_directory_home = home
|
||||
return _directory
|
||||
Reference in new issue
Block a user