Skip to content

feat(plugins): add plugin manager settings and operation locking - #10824

Open
iansherr wants to merge 15 commits into
TriliumNext:mainfrom
iansherr:agent/plugin-manager
Open

feat(plugins): add plugin manager settings and operation locking#10824
iansherr wants to merge 15 commits into
TriliumNext:mainfrom
iansherr:agent/plugin-manager

Conversation

@iansherr

@iansherr iansherr commented Aug 2, 2026

Copy link
Copy Markdown

Why this PR exists

Trilium's current main branch has no first-class plugin or addon ecosystem, no Plugins settings page, and no Community Packages manager. Before this work, extensions were commonly delivered by inserting or deploying JavaScript. During plugin development, a Community Packages note was created as a prototype catalog and manager, but it is not an upstream core capability or a durable plugin lifecycle boundary.

As the number of plugins grows, users need a lightweight way to discover trusted plugins, understand what is installed, configure package-specific settings, see update and health state, and recover from incomplete operations. This PR introduces the first core settings, validation, and operation-coordination layer for that plugin ecosystem manager, while keeping the prototype catalog/package format and the manager unobtrusive when no plugin administration is needed.

What changed

  • Adds a Plugins page to Settings.
  • Keeps the catalog as the discovery surface while providing a direct path back to Settings.
  • Supports multiple registry URLs and direct manifest URLs.
  • Uses one URL per line consistently for registries, manifests, and download hosts.
  • Separates plugin download-host restrictions from runtime network access.
  • Displays installed package health, compatibility, permissions, dependencies, settings, pinning, and update state.
  • Validates package identifiers, versions, artifacts, HTTPS sources, SHA-256 integrity values, and compatibility ranges before catalog data is accepted.
  • Includes direct manifests in scheduled update checks and compares prerelease versions using semver precedence.
  • Localizes the Plugins settings page and its hidden settings note through the existing translation system.
  • Adds a process-local lease lock for package operations, including owner validation, renewal, expiry, and release behavior.

Validation

  • pnpm typecheck
  • pnpm --filter=client test --coverage
  • pnpm --filter=server test --coverage
  • Focused plugin-manager tests: 9 passed
  • Focused hidden-subtree tests: 11 passed
  • Focused package-operation-lock tests included in the server suite
  • git diff --check

The repository ESLint configuration currently imports @stylistic/eslint-plugin, which is added by the separate development-harness PR; linting for this branch is therefore left to the corresponding repository/tooling check.

Manual verification

  • Open Settings → Plugins.
  • Confirm the catalog opens from the Settings page.
  • Confirm registry, direct-manifest, and download-host fields use one entry per line.
  • Confirm installed packages show health and configuration controls without requiring the catalog to be opened first.
  • Confirm invalid or insecure catalog metadata is rejected.

Scope

This PR is limited to the plugin settings experience, package metadata validation, and the package-operation coordination API. Docker artifact handling and development-harness changes are submitted separately.

The operation lock is intentionally process-local. A future multi-process deployment would require a shared coordination backend.

@greptile-apps

greptile-apps Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds the Plugins settings experience, package metadata validation, hidden-note integration, and a process-local package-operation lease API. It also addresses the previously reported direct-manifest scheduling, prerelease ordering, and hidden-title localization defects.

  • Adds installed-plugin health, configuration, pinning, update, source, and recovery controls.
  • Validates manifests, artifacts, integrity values, compatibility ranges, and secure source URLs.
  • Adds authenticated package-operation lock acquisition, renewal, release, expiry, and tests.
  • Adds client and server translation catalogs for the new settings surface and hidden Plugins note.

Confidence Score: 4/5

The PR should not merge until the remaining untranslated plugin statuses and error details on the settings page are localized.

The direct-manifest scheduling, prerelease ordering, and hidden-note title issues are resolved, but the Plugins page still renders compatibility, maintenance, security, validation, and optional-dependency status text directly from hardcoded English helpers.

Files Needing Attention: apps/client/src/widgets/type_widgets/options/plugins.tsx

Important Files Changed

Filename Overview
apps/client/src/widgets/type_widgets/options/plugins.tsx Adds the complete Plugins settings UI, manifest validation, update discovery, installed-package controls, and catalog caching.
apps/client/src/services/search.ts Adds hidden-note lookup through quick search for plugin-managed notes and transactions.
packages/trilium-core/src/services/hidden_subtree.ts Adds the localized Plugins settings note to the hidden options subtree.
apps/server/src/services/package_operation_lock.ts Implements a process-local renewable lease with owner validation and expiry handling.
apps/server/src/routes/api/package_operation_lock.ts Exposes package-operation lock acquire, renew, release, and status handlers.
apps/server/src/routes/routes.ts Registers the package-operation lock endpoints through the internal authenticated API routing layer.

Sequence Diagram

sequenceDiagram
  participant UI as Plugins settings
  participant Catalog as Registry/direct manifests
  participant Notes as Froca package notes
  participant Lock as Package-operation lock API
  UI->>Notes: Load installed packages and settings
  UI->>Catalog: Fetch and validate configured sources
  Catalog-->>UI: Valid packages and update state
  UI->>Lock: Acquire operation lease
  Lock-->>UI: Owner token and expiry
  UI->>Lock: Renew or release lease
Loading

Reviews (5): Last reviewed commit: "Merge branch 'main' into agent/plugin-ma..." | Re-trigger Greptile

Comment thread apps/client/src/widgets/type_widgets/options/plugins.tsx Outdated
Comment thread apps/client/src/widgets/type_widgets/options/plugins.tsx Outdated
Comment thread apps/client/src/widgets/type_widgets/options/plugins.tsx Outdated
Comment thread packages/trilium-core/src/services/hidden_subtree.ts
@iansherr
iansherr marked this pull request as ready for review August 6, 2026 23:00
@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant