Skip to content

feat(plugins)!: Unify plugin APIs#457

Merged
dcramer merged 9 commits into
mainfrom
feat/plugin-registration-overhaul
Jun 2, 2026
Merged

feat(plugins)!: Unify plugin APIs#457
dcramer merged 9 commits into
mainfrom
feat/plugin-registration-overhaul

Conversation

@dcramer
Copy link
Copy Markdown
Member

@dcramer dcramer commented May 31, 2026

Adds explicit plugin sets as the single enablement gate for Junior plugins. Installing a package is not enough; package content is discovered only when a package name or trusted factory is listed in defineJuniorPlugins(...). Nitro now injects that enabled set through #junior/config, so the server entry no longer repeats the declaration.

Before

Trusted plugins had to split metadata and hooks, and apps had separate build/runtime declarations:

// nitro.config.ts
juniorNitro({
  plugins: {
    packages: ["@sentry/junior-github"],
  },
});
// server.ts
const app = await createApp({
  plugins: [
    githubPlugin({
      botNameEnv: "GITHUB_APP_BOT_NAME",
      botEmailEnv: "GITHUB_APP_BOT_EMAIL",
    }),
  ],
});

The first unification pass made that safer, but still required wiring the same set twice:

// nitro.config.ts
juniorNitro({ plugins });

// server.ts
const app = await createApp({ plugins });

After

Apps export one runtime-safe plugin set and point Nitro at that module. createApp() reads the same enabled set from Nitro's virtual module:

// plugins.ts
export const plugins = defineJuniorPlugins([
  "@sentry/junior-agent-browser",
  "@sentry/junior-datadog",
  githubPlugin({
    botNameEnv: "GITHUB_APP_BOT_NAME",
    botEmailEnv: "GITHUB_APP_BOT_EMAIL",
  }),
  schedulerPlugin(),
  "@sentry/junior-sentry",
]);
// nitro.config.ts
juniorNitro({ plugins: "./plugins" });

// server.ts
const app = await createApp();

Trusted Plugins

GitHub and Scheduler now provide JavaScript registrations with inline manifests and trusted hooks. Manifest-only packages remain package-name strings. The separate plugins.ts module stays intentional because trusted hooks are live functions; importing nitro.config.ts at runtime would pull build config into the server bundle, and serializing hooks is not viable.

junior check, docs, package READMEs, generated API reference, and specs now point users at the explicit defineJuniorPlugins(...) path instead of the removed pluginPackages / plugins.packages shapes. Validated locally with pnpm typecheck, pnpm --filter @sentry/junior test, pnpm docs:check, pnpm skills:check, pnpm release:check, and pnpm --filter @sentry/junior-example exec nitro build.

Fixes GH-453

@vercel
Copy link
Copy Markdown

vercel Bot commented May 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview, Comment Jun 2, 2026 9:28am

Request Review

Comment thread packages/junior/src/chat/plugins/registry.ts
Comment thread packages/junior/src/app.ts Outdated
Comment thread packages/junior/src/build/virtual-config.ts
dcramer added a commit that referenced this pull request Jun 2, 2026
Fail during juniorNitro setup when a direct defineJuniorPlugins set contains trusted runtime hooks. Those hooks cannot be recovered from the virtual config unless the set is exported from an importable runtime module.

Refs GH-457
Co-Authored-By: Codex GPT-5 <codex@openai.com>
dcramer added a commit that referenced this pull request Jun 2, 2026
Update generated API reference output after the plugin registration changes and docs check regeneration.

Refs GH-457
Co-Authored-By: Codex GPT-5 <codex@openai.com>
dcramer and others added 6 commits June 2, 2026 09:49
Let apps define one plugin set and pass it to both Nitro and createApp. Manifest-only plugins use package-name strings, while trusted plugins carry inline manifests and hooks from app code.

Remove split YAML registration for trusted hooks and move GitHub and Scheduler to JavaScript plugin definitions. This keeps trusted runtime behavior explicit without forcing manifest-only packages to write unused code.

Fixes GH-453
Co-Authored-By: GPT-5 Codex <codex@openai.com>
Let juniorNitro point at a runtime-safe plugin module so apps only declare enabled plugins once. createApp now reads that module through #junior/config while preserving explicit package enablement.

This keeps trusted hook functions available at runtime without importing nitro.config.ts into the server bundle.

Refs GH-453
Co-Authored-By: GPT-5 Codex <codex@openai.com>
Fail during juniorNitro setup when a direct defineJuniorPlugins set contains trusted runtime hooks. Those hooks cannot be recovered from the virtual config unless the set is exported from an importable runtime module.

Refs GH-457
Co-Authored-By: Codex GPT-5 <codex@openai.com>
Update generated API reference output after the plugin registration changes and docs check regeneration.

Refs GH-457
Co-Authored-By: Codex GPT-5 <codex@openai.com>
Use an explicit TypeScript extension for the dashboard config import so Node ESM can resolve the runtime plugin module during the Nitro example build.

Co-Authored-By: Codex GPT-5 <codex@openai.com>
Restore dashboard inline manifest registration and update tests to use defineJuniorPlugins after rebasing onto the latest plugin API contract.

Co-Authored-By: Codex GPT-5 <codex@openai.com>
Parse trusted JavaScript plugin manifests through the same effective manifest pipeline as plugin.yaml so install-level overrides and validation apply consistently.

Update dashboard and plugin registration docs to point at defineJuniorPlugins module registration after the plugin API changes.

Refs GH-457

Co-Authored-By: Codex GPT-5 <codex@openai.com>
Load runtime plugin modules only when the virtual config or compiled hook needs the plugin set. This keeps Nitro setup from starting asynchronous module imports early while preserving the shared plugin-set result.

Also remove a stale plugins.packages label from the generic package-name validator.

Refs GH-457

Co-Authored-By: Codex GPT-5 <codex@openai.com>
@dcramer dcramer changed the title feat(plugins): Add unified plugin registrations feat(plugins)!: Add unified plugin registrations Jun 2, 2026
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0d84269. Configure here.

Comment thread packages/junior/src/chat/plugins/registry.ts Outdated
Inline trusted plugin registrations should only own package skills when their declared package actually ships a skills directory. Do not assign app-level skills to package-less trusted plugins.

Refs GH-457

Co-Authored-By: Codex GPT-5 <codex@openai.com>
@dcramer dcramer changed the title feat(plugins)!: Add unified plugin registrations feat(plugins)!: Unify plugin APIs Jun 2, 2026
@dcramer dcramer merged commit 3599340 into main Jun 2, 2026
16 checks passed
@dcramer dcramer deleted the feat/plugin-registration-overhaul branch June 2, 2026 09:43
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.

feat(plugins): reconsider plugin.yaml + pluginInstance() dual-registration complexity

1 participant