Skip to content

feat(agent): message people as an agent — connect, ask, replies and a signed webhook - #161

Closed
mauriciomdb wants to merge 3 commits into
mainfrom
feature__agent_messenger
Closed

mauriciomdb wants to merge 3 commits into
mainfrom
feature__agent_messenger

Conversation

@mauriciomdb

Copy link
Copy Markdown
Contributor

What

An agent can now message a person through Dailybot and read the answer — "use Dailybot to message me" just works.

  • dailybot agent connect "<name>" [--description] [-p] — needs dailybot login; mints an agent credential (dbagt_…) and stores it in ~/.config/dailybot/messenger.json (0600, per profile). The token is never printed, only its prefix. Same name again → same agent, fresh credential.
  • dailybot agent me — the agent behind the stored credential.
  • dailybot agent ask --to <email|usr_id> "<text>" [-o X ...] [--wait 30m] [--json] — 2–6 options for a one-tap decision; --wait long-polls replies for that question_id.
  • dailybot agent replies [--wait] [--follow] [--json] — new answers since the last call (cursor stored per profile; --follow streams JSON Lines).
  • dailybot agent webhook set <https-url> / show / remove — signed webhook; the secret is shown once.

Decisions

  • Credential isolation. Messenger commands send only Authorization: Agent <token>, never an API key or the login session, and only to the API host that minted the token. connect sends only the login session (the API key is not even a fallback, so a refusal names the real problem).
  • Webhook verbs side by side. webhook register/unregister keep the older API-key flow unchanged; set/show/remove are the messenger webhook. No behaviour switches on what the profile holds, so neither command changes meaning under an existing script.
  • Timeout exit code is 124, not 2: Click and this CLI use 2 for usage errors, and an agent must not read a typo as "nobody answered". 124 is the timeout(1) convention.
  • ask --wait reads from the stored cursor without moving it, so agent replies still lists every answer.
  • New file messenger.json instead of new keys in agents.json (Rule 16: stored schemas untouched).

Contract (API built in parallel)

POST /v1/messaging/agents/connect/, GET /agents/me/, POST /agents/me/ask/ ({person, text, options?}), GET /agents/me/replies/?after=&wait=, GET/PUT/DELETE /agents/me/webhook/; errors use the messaging envelope {code, message, detail, retry_after, request_id}. Documented in docs/API_REFERENCE.md.

Tests

tests/agent_messenger_test.py (38): storage mode and cursor rules, wire (Agent scheme, no fallback, connect never sends the key, wait clamp/timeout), every command incl. not-v4, revoked credential, rate limit, timeout exit, terminal-safe reply text. Full suite: 4352 passed; ruff check/format and mypy clean.

CHANGELOG is generated by semantic-release from the feat: commit, so it is not edited by hand.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AY6kxNxkCZG2pPJSh1Bxer

mauriciomdb and others added 3 commits December 3, 2026 17:20
… signed webhook

dailybot agent connect mints an agent credential with the login session and
stores it in messenger.json (0600, token never printed). agent ask asks one
person (options for a one-tap decision, --wait to block for the answer; exit
124 on timeout), agent replies returns new answers with a stored cursor, and
agent webhook set/show/remove manage the signed webhook. The older
API-key agent webhook and message commands are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AY6kxNxkCZG2pPJSh1Bxer
connect explains a name owned by someone else (409 name_taken, exit 2) and a
paused agent (403); replies asks for full pages (limit 50) and documents that
a first call returns the last 7 days.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AY6kxNxkCZG2pPJSh1Bxer
The API nests the agent as agent.participant {id, display_name}; connect now
stores and shows the real agent id and name, agent me renders the same shape,
and ask checks options locally (unique, at most 80 characters).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AY6kxNxkCZG2pPJSh1Bxer
@xergioalex
xergioalex marked this pull request as ready for review December 3, 2026 18:20
@xergioalex xergioalex added the Ready Trigger AI code review label Dec 3, 2026
@xergioalex

Copy link
Copy Markdown
Member

Continued in #163 (same commits, opened from a maintainer account so the AI review gate runs: it skipped this PR as author association CONTRIBUTOR).

@xergioalex xergioalex closed this Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready Trigger AI code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants