Skip to content

Resolve short names on the caller's domain with FMSG_DEFAULT_DOMAIN=caller - #11

Merged
markmnl merged 1 commit into
mainfrom
caller-domain
Oct 9, 2026
Merged

markmnl merged 1 commit into
mainfrom
caller-domain

Conversation

@markmnl

@markmnl markmnl commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Summary

A server that serves callers on several domains can't use one server-wide FMSG_DEFAULT_DOMAIN. This adds a reserved value, FMSG_DEFAULT_DOMAIN=caller (case-insensitive). With it, short names resolve on the domain of the address the server acts as for each request. For example, bob becomes @bob@example.org for @mark@example.org and @bob@example.net for a caller on example.net.

  • HTTP (API key, OAuth, combined): uses the per-request caller address.
  • stdio: uses the configured key's address. send_message, reply, add_recipients and wait_for_message (from) already resolve the caller first. In caller mode, resolve_address now does the same, which can trigger the token exchange. It resolves locally in every other mode, as before.
  • whoami: default_domain and the line "Short names resolve to @name@." show the caller's domain.
  • Server instructions: name the caller's domain when the address is known: always for HTTP sessions, and for stdio once the startup address lookup succeeds. Otherwise they say short names resolve on the caller's own domain.
  • Precedence: directory entries still come first. A fixed or unset FMSG_DEFAULT_DOMAIN behaves as before, and the resolution value stays default_domain.

Implementation: CALLER_DOMAIN and effectiveDefaultDomain() in src/address.ts. AddressResolver gains an optional callerAddress, and resolverFor(deps, caller) in src/tools/common.ts builds the per-caller resolver.

Docs: README env table, --help, docs/http-deployment.md and CHANGELOG (Unreleased).

Tests

New test/default-domain.test.ts covers:

  • config parsing of caller, CALLER and @Caller, plus real and empty values
  • resolveAddress with a caller domain, directory precedence, a missing caller address, and a fixed or unset domain
  • instruction text for each case
  • stdio resolution after the token exchange
  • HTTP with two API-key callers and with two OAuth callers on different domains: each one's whoami, resolve_address, send_message and instructions use its own domain
  • a fixed domain and an unset domain over HTTP, both unchanged

npm run typecheck and npm test pass (165 tests).

🤖 Generated with Claude Code

…aller

A server serving callers on several domains cannot use one fixed default
domain. The reserved value `caller` (case-insensitive) resolves short names
on the domain of the address the server acts as for each request: the
per-request caller over HTTP (API key or OAuth) and the configured key's
address over stdio. whoami's default_domain and the server instructions show
that domain when known. Directory entries still take precedence; a fixed or
unset default domain behaves as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@markmnl
markmnl merged commit 892a26b into main Oct 9, 2026
4 checks passed
@markmnl
markmnl deleted the caller-domain branch October 9, 2026 09:52
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