Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ systemd and Hermes Desktop keep supervising it; chats running on that process st
| Apps tab | Files the agent recently made or changed, and the pictures and videos it delivered. | [Artifacts and media](docs/APPS_ARTIFACTS_AND_MEDIA.md) |
| Cards | Native cards in chat: summaries, metrics, lists, timelines, charts, forms, checklists, weather, scores, stock quotes and more, via the `bighelp_render_*` tools. Card templates can be saved and reused. | [Cards guide](docs/CARDS.md) |
| Reactions | Agents can react to your messages with an emoji (`bighelp_react_to_message`). | |
| Who's talking | When several people use bighelp with one host, agents see the name each person saved in the app, and can ask with `bighelp_people`. Names are labels, not logins. | [Who's talking](docs/PEOPLE.md) |
| Secure input | An agent can ask for a password, API key or other secret with `bighelp_request_secure_input`. bighelp shows a masked pop-up; Hermes saves what you type to the agent's `.env` and the agent can use it only as `$NAME` in commands. The AI never sees the value. Hermes' own AI provider keys are excluded. | |
| Agent templates | Save an agent's setup as a template and start new agents from it. | |
| iPhone tools | `iphone_health` (read-only), `iphone_calendar` and `iphone_reminders`. Each is off until you allow it for a host on your phone. They only work while bighelp is open and in the foreground. | [iPhone tools](docs/IPHONE_DEVICE_TOOLS.md) |
Expand Down
35 changes: 35 additions & 0 deletions docs/PEOPLE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Who's talking

Hermes knows who is writing in a Telegram or Slack chat, but every chat the
bighelp app opens looked like "the user". When several people use bighelp
with one host, agents now know which of them is writing.

## How it works

1. Just before each new turn, the app calls `POST /api/plugins/loopdy/native/people/speaking`
(feature `native-people-v1`, usual native headers: `If-Match` context ETag and a lowercase
`X-Loopdy-Request-ID`) with:
- `agentId`: the agent (Hermes profile) the chat belongs to
- `sessionId`: the chat's stored Hermes session ID
- `personId`: a random lowercase UUID the app keeps in iCloud Keychain, so one person's
iPhone, iPad and Vision Pro match
- `name`: the name the person saved in the app, or empty
2. The chat brief names whoever started the chat.
3. Once a second person writes in a chat, each message carries a one-line
`[bighelp] This message is from {"person":"Sam"}` note through Hermes'
`pre_llm_call` hook. Hermes keeps that note only in a hidden copy of the
message for the model, so the chat and its history show what was typed.
4. `bighelp_people` tells the agent who's writing now and who else has used
bighelp with it.

Everything is stored per agent in `plugin-data/loopdy/people.sqlite3`.

## Limits

- A name is a label someone typed, not a login: anyone who can sign in to the
host can type any name. The brief tells agents not to share one person's
chats or private details with someone else because they ask.
- Names are one line of at most 40 visible characters; invisible characters
are removed.
- A message from an app build without this, or one sent before the note
reached the host (the app waits at most 1.2 seconds), carries no name.
7 changes: 4 additions & 3 deletions loopdy_plugin/agent_guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
message, most important words first. Don't deliver to "loopdy"; that's the retired Link inbox.
- iphone_calendar, iphone_reminders and iphone_health work only after the user turns them on, while the app \
is open.
- Never schedule jobs or posts the user didn't ask for; runs spend their AI budget.
Full guide: skill_view("loopdy:bighelp").\
- Never schedule jobs or posts the user didn't ask for; runs spend their AI budget.\
"""
CHAT_BRIEF_GUIDE = 'Full guide: skill_view("loopdy:bighelp").'

ELSEWHERE_NOTE = """\
The user also has the bighelp app for this agent. To reach them there later (a reminder, a check-in, a \
Expand All @@ -63,7 +63,8 @@
def prompt_section(session: Mapping[str, Any]) -> str:
platform = str(session.get("platform") or "").strip().lower()
if platform == SESSION_SOURCE:
return CHAT_BRIEF
from .people import brief_line
return "\n".join((CHAT_BRIEF, brief_line(session), CHAT_BRIEF_GUIDE))
if not platform or platform in _UNATTENDED:
return ""
return ELSEWHERE_NOTE
Expand Down
30 changes: 30 additions & 0 deletions loopdy_plugin/native_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,36 @@ async def board_identity(request: Request) -> Response:
return await _board_request(request, _Body, "identity", _BOARD_LIST_BYTES)


class _Speaking(_Body):
sessionId: str = Field(pattern=r"^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$")
personId: str = Field(pattern=r"^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$")
name: str = Field(default="", max_length=400)


def _speaking(agent_id: str, body: _Speaking) -> dict:
from hermes_cli.profiles import profile_exists
from .people import clean_name, store_for_profile
if not profile_exists(agent_id):
raise NativeAPIError(404, "profile_not_found", "The selected profile no longer exists.")
store_for_profile(agent_id).note(body.sessionId, body.personId, body.name)
return {"agentId": agent_id, "sessionId": body.sessionId, "name": clean_name(body.name)}


@router.post("/people/speaking")
async def people_speaking(request: Request) -> Response:
"""The bighelp app is about to send a message in this chat for this person."""
from .people import CAPABILITY
owner = native_context(request)
request_id = _precondition(request, owner)
if CAPABILITY not in owner.features:
raise NativeAPIError(503, "people_unavailable", "Names aren't available on this host.")
body = await _body(request, _Speaking)
value = await run_in_threadpool(_speaking, body.agentId, body)
if native_context(request) != owner:
raise NativeAPIError(412, "context_changed", "The native context changed; refresh before retrying.")
return _response(value, owner, request_id)


class _Usage(_Body):
refresh: StrictBool = False

Expand Down
5 changes: 5 additions & 0 deletions loopdy_plugin/native_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ def skip(feature: str, reason: str) -> None:
features.append(restart_capability)
else:
skip(restart_capability, "in-place restart needs a POSIX host.")
from .people import CAPABILITY as people_capability, available as people_available
if people_available():
features.append(people_capability)
else:
skip(people_capability, "public profile helpers are unimportable.")
from .provider_usage import CAPABILITY as usage_capability, available as usage_available
if usage_available():
features.append(usage_capability)
Expand Down
Loading
Loading