Skip to content

v1.5.0

Choose a tag to compare

@LucaGiardi20 LucaGiardi20 released this 18 Nov 17:48
db7b800

Upgrade notes

  • AI write tools are on by default (#766): after the upgrade, the in-app assistant can create and change collections, fields, items and files (each write still asks the user to approve it in the chat), and an API key with the mcp:write scope writes over MCP without in-app approval, once AI_MCP_ENABLED=true; for a read-only AI, add AI_TOOLS_WRITE_ENABLED=false to .env. What else to check before upgrading:
    • Your .env may keep the old behaviour by itself. An .env copied from the 1.4.0 .env.example has AI_WRITE_TOOLS=false and AI_MCP_WRITE_ENABLED=false, and those lines still win: such an install stays read-only until you delete them or set them to true. AI_WRITE_TOOLS, when present, takes precedence over AI_TOOLS_WRITE_ENABLED, as in 1.4.0.
    • MCP writes no longer wait for approval. In 1.4.0 every MCP write became a pending call in the "AI tool approvals" inbox. Now an mcp:write key is the consent and the write runs at once. An MCP client such as a chat connector asks before each call; an agent that drives a key headlessly does not. To keep the 1.4.0 approval gate, add AI_MCP_WRITE_REQUIRES_APPROVAL=true. AI_MCP_WRITE_ENABLED=false instead turns MCP writes off entirely.
    • Destructive actions are off, even where 1.4.0 allowed them. Deleting items, collections, fields or files, emptying the trash, rolling back an AI turn, and every change to users, roles or groups are now refused until you add AI_TOOLS_DESTRUCTIVE_ENABLED=true; then each one is approved one call at a time. An assistant that deleted items with approval in 1.4.0 now answers that it cannot. Changes to users, roles and groups never reach MCP.
    • The allowlist now defaults to every write tool. An empty AI_TOOLS_WRITE_ALLOW with no saved selection on Settings → AI write tools now allows every write tool (it allowed none). A list in AI_TOOLS_WRITE_ALLOW or a selection saved on that page still limits writes to exactly those tools, as before.
  • Breaking (API key IP allowlist): a request from an address outside a key's ip_allowlist is now refused with 403 and {"message": "API key is not allowed from this IP address.", "error": "ip_not_allowed"}; it used to be 401. A client that treats 401 as "the key is bad" and 403 as "the key may not do this" now sees the second. Unknown, expired and revoked keys stay 401, now with WWW-Authenticate: Bearer error="invalid_token" and {"message", "error": "invalid_token"}, the message saying which of the three it is; a missing scope is 403 with "error": "insufficient_scope" and the scope it needed (#781).
  • MCP calls awaiting approval from before the upgrade are refused, not run: a call an agent parked on 1.4.0 has no API key on record, so approving it after the upgrade returns "This MCP call has no API key on record…" and leaves it pending until it expires (AI_TOOLS_APPROVAL_TTL, default 15 minutes) or someone rejects it. Nothing is executed or dropped silently. Approve or reject open calls in Settings → AI tool approvals before upgrading, or ask the agent to send them again afterwards (#441).
  • API key permissions are migrated, not reset: php artisan externa:upgrade (or migrate) rewrites every key's read_only, files_scope and MCP scopes into the new <resource>:(read|write) scopes and drops the two old columns (see Changed). Each key keeps exactly what it could do in 1.4.0, never more, so existing integrations keep working; revoked and expired keys stay revoked and expired. The migration is forward-only (#781).

Added

  • MCP schema tools (#766): create_collection (list or singleton), create_field and update_field (name, type, per-locale flag, settings such as required, validation and relations) and reorder_fields, so an agent can build a collection and then fill it with create_item. They run on the collection builder's own requests and actions, with the same validation as the UI. They need an mcp:write key with collections:write, and also the permission on the key's role and the collection inside the key's collection_slugs: the owner's permissions alone are not enough. The assistant's ManageCollections gains reorder_fields, and its create and field actions now use the same requests and actions; a collection whose slug is taken is refused instead of returning the existing one. A key's role has no grant on a collection created after the role was set up: grant it in Roles before the key writes items there.
  • AI drafts in the item editor: an "AI draft" button turns a short brief into proposed values for the collection's text fields (structured output, checked against each field's rules; invalid values are left out and listed), previewed before they fill the unsaved form. Off by default (AI_ITEM_DRAFTS, AI_ITEM_DRAFTS_MODEL, AI_ITEM_DRAFTS_MAX_TOKENS); needs can-use-ai, the new ai.draft permission and create or update on the collection. Each draft is logged as an ai_prompt (surface item_draft, token usage, no content) and counts towards the daily prompt cap and token budget (#210).
  • Opt-in structured logging: LOG_CHANNEL=structured (or structured in LOG_STACK) writes one JSON object per line to stderr with request_id, user_id / api_key_id, route, queued job class and attempt, environment and app version, and redacts authorization headers, cookies, tokens, passwords and secrets. Every response now carries an X-Request-Id header (a valid incoming id is kept, otherwise one is generated); the default stack output is unchanged (#209).
  • AI model catalog (config/ai-models.php): curated models per provider with capabilities and a recommended / supported / deprecated status. The AI settings page lists the configured models and the catalog with status badges (models outside the catalog, such as LOCAL_AI_MODEL, stay allowed as "unverified"), saving the page while a configured model is deprecated adds a non-blocking warning, and php artisan ai:models prints the same overview (#370).
  • Live Preview on the create form: the unsaved form state is validated, stripped by the field ACL and stashed for the preview token TTL (5 minutes) without creating an item; GET /api/v1/preview returns it like a draft item (data.id null, meta.unsaved true), and saving or leaving the form revokes the token (#368).
  • API key tokens have a fleet-wide, scannable shape: new keys are issued as ext_<live|test>_<id><secret> (live in production, test elsewhere; an 8-character public id and a 32-character secret, base62). The list and the logs show only the public ext_<env>_<id> part, and only the SHA-256 of the whole token is stored. Keys issued before this release keep their ek_ + 40 characters token and keep working unchanged; a secret scanner must look for both shapes, ^ext_(live|test)_[A-Za-z0-9]{40,}$ and ^ek_[A-Za-z0-9]{40}$. Token-shaped values are redacted in the structured log, keeping the public prefix (#781).
  • API key rotation (POST /settings/api-keys/{apiKey}/rotate): a new secret for the same key (same id, prefix, scopes and audit trail), shown once. The old secret keeps working for 24 hours (API_KEY_ROTATION_GRACE_HOURS) so the integration can switch without downtime; revoking the key ends that window at once, for both secrets. A ek_ key rotates within its ek_ shape; to move an integration to the new format, issue a new key (#781).
  • API key expiry notice: seven days before a key expires (API_KEY_EXPIRY_NOTICE_DAYS), its owner, and its issuer when that is someone else, get a bell notification and a mail, once, from the daily api-keys:notify-expiring command. Keys also record the address they were last used from (last_used_ip), and every AI tool entry in the activity log names the API key that authorised it (api_key_id), including calls a human approved later. Creating, rotating and revoking a key is logged in the api-keys activity log (#781).

Security

  • AI tool approvals: two concurrent approve or reject clicks can no longer both decide (and run) the same call; the decision is one conditional update (#441).
  • An approved MCP call runs under the API key that asked for it (new pending_tool_calls.api_key_id), so the key's role, collection_slugs, read-only and files scope still apply, and a key revoked or narrowed while the call waited cannot run it. An MCP call with no key on record (parked before the upgrade, or whose key row was deleted) is refused instead of running with the requester's full permissions (#441).
  • Rejecting a pending tool call needs the same tool permission as approving it; the requester can still withdraw their own call (#441).
  • AI tool approvals stay open to the requester on purpose: the requester is the human who owns the agent's API key, and a key cannot approve (approval is a signed-in, CSRF-protected admin action), so blocking it would leave a single-admin install unable to approve anything. Instead, the activity log entry of an approved call names the requester (causer), the approver_id and, new, is_self_approval (#441).
  • Public API cost budget: a batch create, update or delete is charged once per entry (API_COST_MUTATION × the number of items / ids), so a 100-item batch costs like 100 writes, not one (#441).
  • Deploy hooks: the delivery is pinned to the address the SSRF guard resolved (CURLOPT_RESOLVE), so a DNS change between the check and the request cannot reach a private host; publish-triggered builds wait 30 s and queue one delivery per hook, so a scheduled publish of N items no longer queues N builds per hook (#441).
  • MCP: /mcp accepts only an owned API key (Bearer). The session-user path is gone: /mcp is outside the web group and exempt from CSRF, so it was unreachable and would have been unsafe to wire. Failed authentications are limited per IP (AI_MCP_AUTH_FAILURES_PER_MINUTE, default 20) before the per-key throttle:mcp (#441).
  • Collections: restoring a revision needs the collection Update grant (a Read grant was enough), and restoring a trashed item, alone or in bulk, needs the item inside the actor's write filter (#710).
  • AI daily budget: an optional per-user daily token budget (AI_DAILY_TOKEN_BUDGET, default 0 = off) next to the prompt cap (AI_DAILY_PROMPT_LIMIT); both now also cover field translation, which is logged as an AI prompt (field keys only) with its token usage, and today's usage shows under the AI composer when a limit is set. The chat route uses a named ai limiter (AI_RATE_LIMIT_PER_MINUTE, default 30; AI_RATE_LIMIT_PER_DAY, default 0 = off) (#275).
  • Chat: a user with a collection grant on some collections no longer sees the others in the chat pickers and mention lists, and can no longer be mentioned in their item chats; chat now uses the collection policy's Read rule, like the item list (#703).
  • Collections: "Save as copy" checks the create permission like creating an item: a can-create-collections inherited from a user group now counts (it gave a 403), and a role with collection grants needs the Create grant on the collection (an Update grant was enough) (#704).
  • Roles and groups: the AI ManageRoles tool now follows the role policy like the admin UI, so it can no longer delete or rename locked system roles (is_system, public), also for a super-admin; restoring a trashed group that grants super-admin needs a super-admin on the web too, as it already did through AI. An update of the super-admin role that keeps its name (permissions or matrices only) is no longer refused with a 403 (#707).

Changed

  • AI tool defaults (#766): AI_TOOLS_WRITE_ENABLED and AI_MCP_WRITE_ENABLED default to true, the write allowlist defaults to every write tool, and destructive actions have their own switch, AI_TOOLS_DESTRUCTIVE_ENABLED (default false). The executor gates each call by the kind of its action (read, write or destructive) rather than by the tool as a whole. MCP writes run directly, destructive MCP calls park for approval, and AI_MCP_WRITE_REQUIRES_APPROVAL=true parks every MCP write. A tool refusal over MCP (Error: …) is now returned as an MCP error, not as a success. Saving Settings → AI write tools with every tool ticked stores "all", so tools added later are allowed too.
  • API key permissions use the shared <resource>:(read|write) vocabulary: collections, files and mcp, where write implies read. The read_only flag and the files_scope setting are gone. The upgrade translates each key: read_only off becomes collections:write, on becomes collections:read and turns every other scope into its :read form; files_scope all becomes files:write, read becomes files:read, none (or any other value) gives no files access; mcp:read stays, mcp:read with mcp:write becomes mcp:write. Two edge cases resolve to the narrower reading, as 1.4.0 already enforced them: read_only with files_scope all becomes files:read, and mcp:write without mcp:read (which 1.4.0 refused at /mcp) gives no MCP access. A key left with no scopes is kept and refused on every request. New keys need at least one scope, and only scopes their creator holds; collection_slugs still narrows which collections a key reaches (#781).
  • app-ui upgraded from v0.4.0 to v0.9.0 (#776): the synced qiick standards follow (local development no longer tied to one tool, AI writes on by default, the PHP quality floor), and the registry fixes come in.
    • List pagination stays compact at large page counts: first, last and the current page with its neighbours, gaps as ellipses; below sm it reads "Page 3 of 120". Page numbers and the row counter follow the UI language's number format.
    • Wide tables on small screens fade out on the side that hides columns, and their scroller is a named, keyboard-focusable region ("Scrollable table").
    • Dark mode status badges (success, warning) meet WCAG AA on popovers and muted rows.
  • Local setup no longer assumes Laravel Herd: Vite's Wayfinder step runs PHP_BINARY or the php on PATH, Vite HTTPS uses laravel-vite-plugin's VITE_DEV_SERVER_KEY / VITE_DEV_SERVER_CERT instead of HERD_SITE, and .env.example / README describe Reverb via php artisan reverb:start with a neutral example key (#774).
  • Larastan baseline down from 152 to 64 errors with type and annotation fixes only: Larastan now reads Model::casts() (parseModelCastsMethod), so datetime columns are typed as CarbonImmutable instead of string; model timestamps are documented as CarbonImmutable; a stub types the laravel/ai Conversation columns; the field-settings rules and normalization move into App\Traits\NormalizesCollectionFieldSettingsTrait so the AI settings pipeline no longer inherits request-only methods (#601).
  • qiick standards pack and @qiick registry pinned to app-ui v0.4.0 (core and optional UI patterns; none adopted yet); the confirmation and reasoning overrides are gone, as both files match the registry again (#666).
  • .env.example now documents every Externa setting read by config/ (first super-admin, CORS origins, security headers, activity log, Git export author, hosted AI provider keys, …), and CI checks that new env() keys are documented (npm run lint:env) (#291).
  • The frontend toolchain is Vite+ (vite-plus 1.4.0): vp dev / vp build, Oxlint for lint (the same rules as before, including jsx-a11y and externa's own rules for hard-coded UI text and admin paths) and Oxfmt for formatting, replacing ESLint and Prettier (#609). The qiick ratcheted rules run in Oxlint (npm run lint:standards, new qiick-lint-baseline.json). Contributors: run npm ci after pulling; editors use the Oxc extension instead of the ESLint and Prettier ones.
  • spatie/laravel-permission 8 (from 7.4). Its only breaking change is that the Role and Permission contracts accept a BackedEnum in findByName() / findOrCreate(); externa's Role model does not override them, and the migrations and config are unchanged (#667). Run composer install after pulling.
  • Tests run on Pest 5 (PHPUnit 13), with the Laravel and browser plugins at 5. Contributors: composer install after pulling (#611).
  • Inertia 3 (inertiajs/inertia-laravel 3, @inertiajs/react 3). config/inertia.php follows the v3 layout (page settings under pages); the root template marks the title with data-inertia. php artisan externa:upgrade already clears the compiled views the new @inertia output needs. If you customised config/inertia.php or resources/views/app.blade.php, re-apply your changes on the new files (#611).
  • TypeScript 7 (the Go-native compiler); npm run types:check is about ten times faster. Contributors: npm ci after pulling (#611).

Fixed

  • Sidebar toggle: its hover background and focus ring are no longer cut at the header's left edge, and its tooltip says what a click does ("Collapse sidebar" / "Expand sidebar") with the ⌘B / Ctrl+B shortcut; the header gains app-ui's leading slot for icon controls after the toggle (#776).
  • Field list: a field dragged from a group up to the root list is restored to its pre-drag position before React reconciles, so the drop no longer fails with a removeChild NotFoundError (#762).
  • Frontend build: the React Compiler now actually runs (@vitejs/plugin-react 6 ignores its old babel option; it now goes through @rolldown/plugin-babel with reactCompilerPreset(), like excubia-app), and the rich text toolbar reads its active marks with TipTap's useEditorState, so the Bold / Italic / … toggles follow the selection under memoization (#751).
  • File manager: saving or replacing a file no longer empties its "where used" list in the detail panel (#758).
  • externa:upgrade --sync-upstream works on a composer create-project install in its own repository: when the repository shares no history with upstream, the first sync links it at the installed version's tag (git merge -s ours, no file changes) before the normal merge, --dry-run shows that step, and a version without a tag stops with the manual command (#768).
  • Field settings drawer: the duplicate-key error and the "Update settings for …" subtitle are translated (en, it, de), and the duplicate-key check no longer waits again from zero each time the drawer re-renders; the unreachable key-format message is gone, since the key is checked as its slug (#744).
  • Preview as role: the "Preview failed" message is translated (en, it, de) and the request URL comes from the generated route helper (#744).
  • Field forms, item table cells and field conditions no longer turn an object-valued setting or option into the text "[object Object]": non-scalar values fall back to the field's default (#671).
  • Converting a field type on a large collection keeps only ids and values between the read and write phases, and writes chunk by chunk, instead of holding every item with its relations in memory (#441).
  • The AI import status poll retries a failed check with backoff (4 s up to 30 s, five attempts) instead of stopping for good at the first network error (#441).
  • The TypeScript SDK package builds itself on npm pack / npm publish (prepack) and declares its repository, so it can no longer be published without dist/ (#441).
  • Chat: deleting a message logs the chat's UUID as chat_id in the activity log instead of an integer cast of it (0 or its leading digits) (#723).
  • Item chat drawer: deleting your own message lowers the message count once with realtime on (the delete reply and its echo no longer both count it); a reaction toggled in another tab of the same user now shows in this one (the reaction request sends X-Socket-ID and the server skips only the tab that sent it); edit, add-to-field and attachments no longer assume a thread scope; the reset-on-open state is derived during render instead of in effects (#726).
  • The Lucide icon picker test renders a small mocked catalog instead of all ~1,700 icons (about 0.1 s instead of up to 26 s under load) and checks the real catalog's names without rendering it (#734).
  • Item editor: the activity log honours only the list page sizes (10, 20, 50, 100; default 10), so ?per_page=100000 no longer loads the whole log, and "Preview as…" without a role answers with a translated message (#738).
  • Item editor: the stale-save guard keeps catching saves over a peer's newer version after the form remounts (discard, or fields → activity → fields), the published read-only banner and the revision toasts are translated, and the schedule requests use the Wayfinder route (#741).
  • Collection form layouts: a tab or section label sent as a plain string is stored under the project's default content locale instead of failing with an error (the normalizer called a resolver method that does not exist) (#755).