Skip to content

Add external plugin hook registration and worker invocation - #2399

Merged
jonathanKingston merged 2 commits into
mainfrom
codex/external-hook-registration
Sep 9, 2026
Merged

Add external plugin hook registration and worker invocation#2399
jonathanKingston merged 2 commits into
mainfrom
codex/external-hook-registration

Conversation

@jonathanKingston

Copy link
Copy Markdown
Collaborator

External plugins can now declare and register function hooks through the existing isolated runtime. A hook-only copse-plugin.json can declare runtime.hooks, and its activate(api) can call registerHook({ id, event }, handler) without providing tools or model routes.

The host validates the exact declared registration IDs and canonical events before enabling the plugin. Explicit invokeHook calls travel through the worker protocol with cancellation and error propagation. Handlers receive only { event, signal }; existing API-v1 workers may omit hook registrations.

This is SDK stage 1: hooks load and register, but canonical agent events do not automatically dispatch them yet. Event-specific payload/result validation, result transformations and next() composition remain follow-up work. The SDK guide and binding decision 15 document this boundary.

Validation:

  • pnpm run check — typecheck, lint, formatting, dead-code and test-selection guards, E2E syntax, and all 8,561 unit tests passed.
  • pnpm run build.
  • pnpm run test:e2e --spec tests/e2e/plugin-hook-loading.e2e.ts — passed in real Electron on macOS with production seatbelt, snapshot materialization and the built worker. Verifies loading a hook-only plugin, sibling module/asset reads, disable/re-enable and restoration after relaunch; activation fails unless outside-file reads and workspace/snapshot writes are denied. The selected source is seeded into an isolated profile; the native folder picker is not exercised.
  • Real worker integration tests cover invocation, mismatches, cancellation, handler errors and non-serializable results.

Screenshot: enabled hook-only plugin after relaunch.

@copse-release-bot

copse-release-bot Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Reference screenshots ready for review

Review GitHub’s image diffs in screenshot PR #2601.
Merge it (or enable auto-merge) to apply the accepted PNGs to codex/external-hook-registration.

Rendered for 8217103a86fb by CI run 34299700628; the immutable artifact is reference-screenshot-candidates-34299700628.

If this source branch moves, a later successful render closes the stale review PR and replaces this link.

@jonathanKingston
jonathanKingston force-pushed the codex/external-hook-registration branch from 7ff20f2 to ca4f440 Compare September 6, 2026 09:19
github-actions Bot added a commit that referenced this pull request Sep 6, 2026
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

🖥️ PR preview

github-actions Bot added a commit that referenced this pull request Sep 9, 2026
@jonathanKingston
jonathanKingston merged commit 4560a41 into main Sep 9, 2026
24 checks passed
@jonathanKingston
jonathanKingston deleted the codex/external-hook-registration branch September 9, 2026 01:56
github-actions Bot added a commit that referenced this pull request Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant