Skip to content

PhoenixKit 2.64.0: Dates by country, public libraries and a neutral machine API

PhoenixKit 2.64.0 shows dates in each viewer’s country format, lets chosen users publish a library, moves the public machine API to module-neutral paths, and fixes HDR phone videos. It must be installed together with AI 0.26.0 or later.

Dates follow the viewer’s country

Users and company accounts get a country, editable on the profile page and the admin user form. Where a date is shown in the user’s format, the country now decides: 09.11.2026 for a German viewer, 09/11/2026 for a British one, 11/9/2026 for an American. A new setting, Default Country for Formats under Settings → General, covers visitors and accounts without one. It is empty by default, and anyone without a country keeps the Date Format setting, so nothing changes on upgrade. Existing accounts are not given a country automatically.

Libraries: public, backed up, rebuilt

A user with the new storage.public_library permission, given to nobody by default, can create a Public library that anyone can read, signed in or not. Owners and Admins can suspend one from the admin list. A library can also use up to three of a user’s own integrations, the first as main storage and the others as copies. The profile’s Media tab is rebuilt as a table with a row menu, and the create form asks only for an integration and a bucket, with a List buckets button.

The machine API

The public API moves to /api/public/v1 and /mcp/public. The old /api/shop/v1 and /mcp/shop still answer, with deprecation headers. Settings → API is split into tabs: Switches and modules, Keys and service users, Approvals and limits and API guide, with per-module switches. API tools can act for a signed-in person with their own rights, and for modules ticked Agent may act, writes wait for confirmation. A key marked Needs approval now holds every write, not only dangerous ones. Anthropic and Z.ai are new integration providers.

Video and photo fixes

HDR videos from phones were encoded into renditions most browsers refuse, with washed-out posters. HDR sources are now tone-mapped to ordinary video for every rendition and the poster, and an iPhone video’s poster can be an HDR photo. Clips about one second long, such as a Live Photo’s, get a thumbnail. iPhone HEIC photos zoom to full resolution, and large files are no longer read whole into memory to be hashed. <.time_ago> reads in the user’s language.

Upgrading

Run mix phoenix_kit.update for V221 to V223, and upgrade phoenix_kit_ai to 0.26.0 or later at the same time: V223 renames the AI cost column, and an older AI release fails on every usage insert. V223 rewrites the AI request journal under an exclusive lock, so allow a maintenance window on a large one. Behind a proxy, set config :phoenix_kit, :trusted_proxies to its ranges; unset, any loopback or private peer is trusted as before. On the machine API, a query parameter ending in _token is now refused with 400 token_in_url.

Full release notes: PhoenixKit 2.64.0

2.64.0 · 24 October 2026

Migrations V221–V223. Run mix phoenix_kit.update after upgrading.

Upgrade notes

  • phoenix_kit_ai must be upgraded together with core, to 0.26.0 or later. V223 renames phoenix_kit_ai_requests.cost_cents to cost; an older AI release writes the removed column and every usage insert fails. V223 rewrites the request journal under an ACCESS EXCLUSIVE lock and drops the unused legacy phoenix_kit_ai_accounts table (its rows are not restored by a rollback); allow a maintenance window for a large journal.
  • The public machine API moved to /api/public/v1 and /mcp/public (#953). /api/shop/v1 and /mcp/shop still answer, with Deprecation and Link: rel="successor-version" headers, until 3.0.0. PhoenixKit.API.Actor.cart_token_hash is renamed to client_token_hash (no alias); the api_public_cart_* limits become api_public_token_rate_per_min, api_public_new_rows_per_ip_hour and api_public_new_rows_global_hour, the old keys read as a fallback.
  • Forwarded headers follow config :phoenix_kit, :trusted_proxies (#943, #955). Unset, any loopback or private peer is trusted as before. Set it to your proxy’s ranges to stop another container on the network from choosing the client IP (API allowed_ips, rate limits, audit) or the scheme (X-Forwarded-Proto for the API context and the OAuth callback — EnsureOAuthScheme used to believe it from any peer).
  • A key marked “Needs approval” now holds every write (#961), not only dangerous ones; reads and dry runs are unchanged.
  • A query parameter ending in _token answers 400 token_in_url on the machine API (#953), e.g. ?page_token=.

Changed

  • AI request costs are stored as dollars (V223, #981). cost_cents (an integer that held millionths of a dollar, so a cheap call was stored as 0) becomes cost, numeric(28,18) US dollars, with existing costs converted. The requests’ model widens to varchar(150) (the endpoints’ width; a longer id failed the usage insert). The pre-V34 phoenix_kit_ai_accounts table and phoenix_kit_ai_requests.account_uuid are dropped, and the unique uuid indexes beside the AI tables’ primary keys are removed, the foreign keys bound to them re-added on the primary keys. A rollback restores the V222 shape with an empty accounts table.

  • The public machine API is module-neutral (#953). Core no longer names a shop: a tool names the input carrying its anonymous caller’s token with Tool.client_token and its secret output fields with Tool.credentials (core’s rule: a known name or any name ending in _token), a module adds error codes with the optional api_problems/0 callback, and RateLimit.check_new_rows/1 is the shared new-rows quota. Every deprecated name lives in PhoenixKit.API.Legacy, deleted in 3.0.0. The guide is renamed dev_docs/guides/2026-10-11-machine-api.md.

  • Settings → API is built from core’s components and split into URL-held tabs (#976, #979): Access, Keys, Approvals and the API guide (?tab=…), the guide moving in from its own page. Module rows show each tool’s availability to an agent.

  • Template usage counts delivered messages only (#972), including a provider’s queue handoff; failed, blocked and development-suppressed messages no longer increment it.

  • integration_encryption_warn_on_boot: false silences only encryption switched off on purpose (#954). A missing key (:disabled_no_key) is reported regardless, and Encryption.encrypt_value/1’s plaintext warning is logged once per VM instead of on every save.

  • MCP echoes of client text are clipped by code points, not graphemes (#963, #980) — “Method not found”, the protocol-version echo and approval reasons — so one letter with thousands of combining marks is no longer echoed whole.

  • Dates follow the viewer’s country (PhoenixKit.Users.FormatCountry). Where a date is shown in “the user’s format” (Utils.Date.format_date_with_user_format/1, format_datetime_with_user_format/1, format_datetime_full_with_user_format/1, format_date_with_cached_settings/2, format_datetime_with_cached_settings/2, and the *_with_user_timezone / *_with_user_timezone_cached ones for the user they are given) a country now wins over the site-wide date_format: 09.11.2026 for a German viewer, 09/11/2026 for a British one, 11/9/2026 for an American. It is written by BeamLabCountries.Formats.format_date/2 (beamlab_countries ~> 2.1). Anyone without a country, and no site default country, sees date_format exactly as before, so nothing changes on upgrade until users get a country. The viewer is set when the scope is mounted (the fetch_phoenix_kit_current_* plugs and the mount_phoenix_kit_current_* hooks) and resolved on first use. The time format and the date picker (<.date_input>, which parses what is typed) still follow the settings. Utils.Date.format_date/2 also accepts {:country, "DE"} as a format.

  • The profile’s Media tab is rebuilt on core’s own components. The libraries are a table_default (name with its Default badge, where it is stored, visibility: Public or Private) with the usual toolbar (count, Create library) and a ⋮ row menu (Open, Rename, Make default, Members, Renditions, Trash; Leave for a shared one), as the Integrations tab. Rename, members, renditions and the new-library form are <.modal> dialogs with <.input> / <.select>; an empty list is an <.empty_state> with the create button; the trash is a small table with Restore. With own storage the form asks for what the integration does not already know: an integration (the word is used throughout; the form said “connection”) and a bucket. The provider, region and endpoint fields are gone: the bucket takes them from the integration, and the integration’s service and endpoint are shown under its select. With one integration it is already chosen; with none the form sends the user to add one (new tab) and picks the list up again when the window regains focus.

  • Libraries.create_user_library/3 / probe_own_storage/3: the "storage" map takes "targets" (a list, or the targets[0] map a form posts); a single bucket given flat (integration_uuid, bucket_name, …) still works, and a provider, region or endpoint sent anyway wins over the integration’s.

  • Profiles.user_storage_for/1 adds buckets (every one of the user’s buckets, main first) beside bucket; mode is :only when one of them is the primary. Profiles.create_user_profile/3 takes a bucket or a list.

  • The admin menu offers Approvals only while the site uses them (AdminTabs.approvals_visible?/1, Approvals.in_use?/0): a key that is not revoked or expired (a revocation or expiry still in the future does not count as one) is marked “requires approval”, or an approval of any status is still kept. A site where no key asks for approval no longer shows an empty entry; /admin/approvals itself and the link on Settings -> API answer as before.

Added

  • API tools run on behalf of a live session (#948, #974, V222). Executor.visible_for/3 / execute_as/5 take a SessionRef (Users.Auth.SessionRef.from_session/1) and act with that person’s current rights (actor kind :user). Reads run directly; with allow: :all, for modules an admin ticks under Settings → API (“Agent may act”, api_session_write_modules), a write is held in a confirmation row bound to the person (phoenix_kit_api_confirmations.actor_user_uuid, V222) and runs once through Executor.redeem_as/6, which repeats the whole request path.

  • Public API discovery (#944): a guide at GET /mcp (HTML, or Markdown for Accept: text/markdown), an RFC 9727 catalog at /.well-known/api-catalog, Link headers and an API section in /llms.txt, all shown only while the public API is on and has a tool, and none naming the admin API.

  • An admin guide to the machine API (#945), generated from this installation’s tools and error codes, with connection snippets for Claude Code, Claude Desktop, VS Code and a generic client (now a Settings → API tab).

  • An Approvals menu entry and a readable approvals page (#946) at /admin/approvals, for api holders, with a per-viewer badge and previews rendered as fields instead of JSON; offered only while a key requires approval or an approval is kept (#970).

  • Per-module API switches (#940) on Settings → API (api_disabled_modules, empty = all on) and an API badge on the Modules page; a switched-off module’s tools are withheld everywhere, core’s system.* tools never.

  • replay: false on a PhoenixKit.API.Tool (#941) for a write whose answer always carries a credential: it stops advertising idempotency_key in MCP and OpenAPI and refuses one with 422.

  • Per-language public URLs through the canonical host resolver (#939): new PhoenixKit.Utils.Routes helpers, so modules stop calling :canonical_host_resolver themselves.

  • Header widgets for modules and an optional dock column (#950). The optional header_widgets/0 callback returns sticky nested LiveViews rendered before the notifications bell; dock: true adds a third admin-layout column (--pk-dock-width). Without a widget the layout is unchanged.

  • Module-supplied connection checks (#962): a module contributing an integration provider names a PhoenixKit.Integrations.Validator (validate_connection/1, or the owner-aware /2), run under a deadline with credential-safe crash logging.

  • Anthropic (#958) and Z.ai (#967) integration providers (:ai_completions, site-wide and personal connections, a key check).

  • An opt-in address policy for personal SMTP integrations (#956): config :phoenix_kit, :personal_smtp_policy, :restricted refuses a user’s SMTP host on a non-public address at Test Connection and before every send. Off by default; site-wide connections are never checked.

  • Storage.direct_urls/1 (#964) resolves many file variants at once to the public bucket’s object URL, with a fixed number of queries; private and ineligible files keep the app URL.

  • Hidden system libraries (#949): Libraries.create_system_library(attrs, hidden: true) for a module’s own files — private, time-window URLs only, absent from Media, settings lists and pickers.

  • dedup: false on Storage.store_file_in_buckets/7 (#938): each call gets its own file row, for a host storing files of independent records under one owner (form attachments). The checksum backfill keeps the opt-out.

  • A gallery mode for the media viewer (#965): Photos-style swiping between neighbours (Fresco 0.15), steady controls and a picture that stays put.

  • <.date_input> (#936): a date in the site format with a clear button and a calendar in the UI language, submitting an ISO date (and working before the socket connects).

  • Boot-time Admin permission grants retry and report failures (#973). The grants return {:error, _} instead of :ok, a supervised Permissions.AdminGrants retries failed keys, and a host can wait with Permissions.await_admin_grants/1.

  • Docs: core’s admin building blocks in usage-rules.md (#947), host application API tools (#952), host-neutral examples (#966).

  • Tabs of your own on the profile settings strip (PhoenixKit.ProfileSettingsTab). A host lists them in config :phoenix_kit, :profile_settings_tabs, a module returns them from the new optional c:PhoenixKit.Module.profile_settings_tabs/0 (offered only while the module is enabled). Each has an id (its URL, /profile/settings/<id>; core’s ids are refused), a label (a string, or an {m, f, a} / function called on render, so it can be the host’s own gettext), an icon, after: (the tab it follows; the end otherwise), and an optional permission: and visible: check of the scope (a check that raises hides the tab). With live_view: core declares the page’s route in its authenticated live_session, in both the locale-prefixed and plain URL shapes, ahead of /profile/settings/:tab; the router recompiles when the config changes. Without it the host routes the page itself, before phoenix_kit_routes(). The page renders <ProfileSettingsTabs.profile_tabs active="<id>"> itself; from there every tab navigates. tab_ids/1, tab_label/1 and tab_icon/1 read the registry; an id that is not routed still lands on the first tab.

  • A country on the user (V221, phoenix_kit_users.country). The ISO 3166-1 alpha-2 code of a person’s or a company account’s country, checked against BeamLabCountries and stored upper-case. Editable on the profile page and on the admin user form, shown on the user details page. A new account starts with its registration_country when that is a known code; nothing is backfilled for existing accounts (the resolver falls back to registration_country at read time). country is deliberately not in Auth.updatable_profile_fields/0, so a host’s custom field named country stays a custom field.

  • FormatCountry.resolve/1: the country whose formats a user reads: their own country, else their company’s (organization_uuid), else registration_country, else the site default; a source holding an unknown code is skipped. for_user/1, viewer/0 and put_viewer/1 serve the date helpers; a host rendering for someone other than the process’s viewer (an email) calls for_user/1.

  • Settings -> General -> “Default Country for Formats” (format_country). The country used for visitors and accounts with none of their own. Empty by default: they keep the Date Format setting.

  • A library can use several of the user’s integrations (V206 storage). In “only here” the first is the main storage and the others hold a copy of every file (never served); in “the site’s storage, backed up here” each is a backup. Up to Profiles.max_user_buckets/0 (3), five copies in all. The library row says Your bucket: a (+1 copy); purge and the object clean-up already covered every bucket of a library’s profile.

  • Public user libraries (phase 1 of dev_docs/plans/2026-10-18-public-user-libraries.md). A user with the new storage.public_library sub-permission (granted to nobody by default) can create a library as Public (a Private or Public choice in the create dialog, with a warning; final once made). Anyone, signed in or not, can read what is in it (Libraries.can?/3 with a nil scope, can_read_library?/2, public?/1); editing is unchanged. Its files get ordinary links; it never appears in site media (Libraries.exclude_user_libraries/1 replaces exclude_private/1, which still works, in the media browser, the pickers, the folder listing and the orphan cleanup). An Owner or Admin can suspend one (suspend_library/3, unsuspend_library/2, a Suspend/Restore button in the admin list): it answers as private until restored. Publishing and suspending are in the history. Nothing is public unless a user with the permission makes it so.

  • Libraries.ensure_personal_library/2 and backfill_personal_libraries/1 — for a host that wants every account to have a private library of its own. The system makes it (no permission, no room under the per-user limit), marked so a user who trashed theirs is not given another. Nothing in PhoenixKit calls them, they make nothing while “Allow user libraries” is off ({:error, :user_libraries_off}), and registration is unchanged; the host decides whether, when and what to call it.

  • A “List buckets” button on the create form: Libraries.list_own_buckets/3 asks the integration’s key for its buckets (S3 ListBuckets, under the integration check’s deadline, via S3.list_remote_buckets/1) and the bucket field becomes a dropdown. A key limited to one bucket is usually refused; the text field stays and the message says to type the name.

  • Libraries.integration_summary/2: what a user’s integration says about itself (service, bucket provider, region, endpoint), never a secret.

  • A module can keep its own settings for a library (Libraries.module_setting/3, put_module_setting/5). A package that is not core has settings of its own for a library (the photos package’s choice of viewer, say), and core should not have to name them. put_module_setting(library, "photos", "viewer", "classic") keeps the value under the module’s namespace in the library’s settings (settings["modules"]["photos"]["viewer"]), nil removes it (and the namespace when it was the last key). Core keeps the namespacing, the update of only that key, the lock and the history (photos.viewer, from and to); it knows no key and checks no value beyond a boolean, a number or a string of at most 255 bytes. The namespace and key are lowercase words ({:error, :invalid_namespace | :invalid_key | :invalid_value} otherwise). Needs no migration.

  • The poster of an HDR video is an HDR photo. For an HLG video (every iPhone recording) whose video_thumbnail size keeps HDR, the poster is a JPEG with a gain map (Ultra HDR, ISO 21496-1): an HDR screen shows the highlights above white, any other shows the ordinary picture. VideoHdrPoster makes it with libvips’ uhdrsave (in the library vix ships; nothing to install): ffmpeg writes the frame as linear-light floats, scaled so SDR white (203 nits) is 1.0, and libvips computes the map. The switches are the photos’ own: the size’s keep_hdr option (now on by default for video_thumbnail, and offered in the size form for a video JPEG size) and config :phoenix_kit, hdr_renditions. Without vix, with a libvips older than 8.17, or if anything fails, the ordinary tone-mapped poster is made and a warning logged. PQ sources and Dolby Vision profile 5 keep the ordinary poster. Existing sites keep what their size says until keep_hdr is turned on; videos already made are remade by regenerating them.

Fixed

  • Integration secrets stay out of logs, and key rotation re-encrypts bucket secrets (#942). Settings and bucket writes run with log: false, Setting.value/value_json are redact: true, and a failed save logs the changeset’s errors only. KeyRotation.rotate/2 now re-encrypts buckets’ own secret_access_key in the same transaction — before, every such bucket failed to decrypt its secret after a rotation and a restart.

  • An object storage key limited to buckets passes Test Connection (#977) with the note “not allowed to list buckets — bucket access was not verified”; invalid keys still fail.

  • Storage endpoint checks refuse IPv6 forms that reach non-public addresses (#957): IPv4-compatible ::a.b.c.d, 6to4, the local-use NAT64 prefix, site-local, Teredo and documentation ranges passed a personal endpoint’s check.

  • A base language’s own dialect URL redirects to the base code (#968): with en-US the only English, /en-US/… goes to /en/… instead of serving a duplicate page (Languages.url_locale_segment/1).

  • EnsureOAuthScheme no longer forces https on port 443 when oauth_base_url is unset (#971): the endpoint’s url: config applies again, its port read whether it is an integer, a string or an environment tuple.

  • The integration picker lit every card’s check (#975): glued CSS classes are separated. Dashboard overview grids size by their container (#978), not the window.

  • Storage.direct_urls/1 skips a malformed uuid or variant instead of failing the whole batch.

  • Switching back to a remembered account works again, and the country select’s type-ahead matches names (the flag now follows the name).

  • Country format preferences stay current. Viewers without a personal country follow changes to the site default in an open LiveView; embedded identity mounts and scope refreshes also set the viewer’s country. The default-country setting trims and uppercases its saved code, and a successful profile save redraws the country select from the saved values. V221’s regression test now applies the migration to an existing account to verify that GeoIP data is not backfilled.

  • An HDR video no longer makes renditions a browser cannot play, nor a washed-out poster. A phone records HDR as 10-bit HEVC (HLG or PQ, BT.2020). Its renditions were encoded as 10-bit H.264 (“High 10”), which most browsers refuse, and its poster was a raw frame grab with the HDR signal squeezed into an SDR picture (flat colours, blown highlights). VideoSource.probe/1 reads the source once with ffprobe; an HDR source is tone-mapped to SDR (zscale/tonemap, Hable, 203 nit reference white, BT.709, 8-bit) after the resize, for every rendition and the poster. Every H.264 and VP9 rendition is now yuv420p whatever the source (a 10-bit video that is not HDR no longer comes out as High 10). If the tone-mapping fails the ordinary rendition is made and a warning logged. The original is stored untouched. SDR sources are unchanged apart from yuv420p. Keeping the HDR in a rendition (10-bit HEVC) is not done.

  • A video thumbnail of a clip about a second long is made. The poster was always taken at 1.000 s; a clip of exactly one second (a Live Photo’s) has no frame there, and FFmpeg answered success without writing a file, so the variant failed later as a bare :enoent. It is taken one second in, or halfway for a clip under two seconds, and an FFmpeg run that wrote no file is now an error that says so.

  • Large files are no longer read into memory to be hashed. Every checksum of a file on disk (the original’s SHA-256 and MD5 at upload, each rendition’s, a URL import, the dedup backfill, POST /api/upload) read the whole file with File.read!/1 and held it, twice over, while it hashed; a video of a few gigabytes cost a few gigabytes. They go through the new PhoenixKit.Utils.FileHash (1 MiB chunks, several digests in one pass), so what a hash costs in memory is the chunk. A test stores a 160 MiB file and fails if binary memory rises by more than 64 MiB (the old code rose by 293 MiB).

  • An iPhone’s HEIC (and HEIF, AVIF) zooms to the last pixel. libvips as shipped with vix reads a HEIC’s size but has no HEVC decoder, so no deep-zoom tile could be cut from one and the viewer stopped at the 1920 px rendition. The first tile request now makes one full-resolution JPEG of the original with ImageMagick (ImageProcessor.full_jpeg/3), keeps it beside the tiles (TileSource), and cuts every tile from it.

  • POST /api/upload takes HEIC, HEIF, AVIF, TIFF and BMP (it turned them away as “not allowed”), and its size cap follows the storage_max_upload_size_mb setting (default 500) instead of a fixed 100 MB.

  • <.time_ago> reads in the user’s language (#969). Its TimeAgo client hook rewrote the text in English once the page was live; the component now has no hook and is rendered by the server alone, with ngettext plural forms (“1 день назад”, “2 дня назад”, “5 дней назад”; “1 päev tagasi”, “3 päeva tagasi”). The tooltip is the moment in the site time zone as YYYY-MM-DD HH:MM instead of an English date in UTC. A moment ahead of the clock reads “0s ago”. The text no longer ticks in the browser; it is what it was at the last render. The hook stays in phoenix_kit.js for host markup that uses phx-hook="TimeAgo" directly. i18n: "%{count}s ago" is a plural entry in every catalogue; the day forms in et, ru, uk and pl are full words with their plural forms.


PhoenixKit 2.64.0. Install or update: {:phoenix_kit, "~> 2.64"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.