Skip to content

Add trusted-agent login recovery and direct conversation links - #5

Merged
jayforgex merged 2 commits into
mainfrom
feature/owner-login-links
Oct 16, 2026
Merged

jayforgex merged 2 commits into
mainfrom
feature/owner-login-links

Conversation

@jayforgex

Copy link
Copy Markdown
Contributor

Owners who forget their access key currently cannot ask a connected agent for a usable login path, and agents cannot provide direct links to a conversation. Add agentpeerchat web [THREAD_ID] for stable chat links and web --login [THREAD_ID] for one-use owner sign-in links, plus bilingual recovery help and agent instructions.

The owner must explicitly enable the separate, default-off “Allow helping me sign in” Contact permission for a trusted agent. The UI explains that this grants owner-account access. Links expire after ten minutes, redeem atomically once via a same-origin POST, and create a browser session for at most 24 hours without exposing a persistent owner key. Withdrawal, issuer disablement, and issuer-key revocation invalidate links and their sessions; regranting cannot revive an old session. Migration 0009 is additive. Existing keys and ordinary sessions remain valid.

Validation: Node 24 full suite passes (130 tests plus 45 SQLite checks), typecheck and app build pass. Independent HTTP checks verified an eight-way redemption race and permanent revocation. Actual 390px browser acceptance verified a signed-out owner can open a CLI-generated link and reach the requested chat without entering a token, used-link rejection, manual-login target preservation, and language switching. Source and packaged CLI HTTP tests cover subdirectory deployments, private key handling, and invalid instance overrides.

CLI 0.1.15 and bundled skill 1.1.2; README, guides, OpenAPI and generated assets updated. Hosted Dots/Muse runtimes still need the updated CLI/skill and their own tool execution support.

jayforgex and others added 2 commits October 16, 2026 14:15
Forgotten owner tokens can no longer be read back, so add an explicit,
default-off per-Agent delegation that lets one trusted Agent help the
owner sign in with short-lived single-use links.

Backend
- migrations/0009: principals.can_help_owner_login (0/1, default 0) and
  owner_login_grants (hashed 256-bit code, issuer id + issuer access-key
  id, owner id, optional thread, expiry, redeem mark, session binding);
  tokens gain a nullable owner_login_grant_id.
- POST /owner-login-links (Agent access key only, issuer-thread
  membership check, quota 10 unresolved, permission/key/quota rechecked
  inside the insert), GET for the issuer's own links (no codes), and
  public same-origin POST /owner-login/redeem: one atomic use under
  concurrency, 24h HttpOnly session, no access key, GET never signs in.
- authenticate dynamically rechecks delegation, issuer liveness and the
  minting key for grant-bound sessions; withdrawing the permission,
  disabling the issuer or revoking the minting key deletes unresolved
  links and revokes their sessions in the same transaction — a re-grant
  never revives an old session. Ordinary owner keys/sessions are
  unaffected. Expired rows and their dead sessions are cleaned up on
  every write (FK-safe).

CLI (web)
- agentpeerchat web [THREAD_ID] prints a stable secret-free link;
  web --login [THREAD_ID] mints a one-use link from the validated
  private profile base (origin + subpath), with clear guidance to the
  Contact grant when permission is missing. No token on the command
  line or in output.

Web app
- Mobile Contact switch "Allow helping me sign in" with a
  high-privilege confirmation; withdrawal without ceremony.
- #owner-login=…&thread=… deep links: fragment cleared before the
  same-origin POST, understandable expired/used errors, deliberate
  confirm when already signed in; #thread=… targets survive manual
  login and navigate on hash change. Honest forgotten-key help on the
  login page. All new strings bilingual.

Docs/version
- Skill 1.1.2, bilingual agent guides, protocol + OpenAPI (3 new
  operations), README/README.zh-CN, CHANGELOG, package 0.1.15,
  regenerated public artifacts and lockfile.

Tests: 180 passing (Miniflare + real SQLite backends, including the
new owner-login suite, frontend regressions, and CLI web HTTP tests).

Co-Authored-By: Claude Code <noreply@anthropic.com>
@jayforgex
jayforgex merged commit 1e067c6 into main Oct 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant