Expand description
The Codex desktop app’s hook-plugin manifests, as templates.
Capturing the desktop app needs a Codex plugin: a manifest naming the
plugin plus a hooks file subscribing a command to the five lifecycle
boundaries crate::attribution::codex_app parses. Unlike pi’s extension
(a fixed file, installed by copying), a Codex plugin is installed by
Codex’s own plugin manager from a consumer-packaged source directory, and
two of its ingredients are irreducibly the consumer’s:
- The hook command line. Each hook runs an executable that receives
the lifecycle payload on stdin and reports it to the consumer’s local
runtime. Which executable, and how it is located without depending on
the app’s
PATH, is deployment knowledge — the branded launcher script a consumer ships is exactly the part that cannot live here. - The plugin’s identity. The name, description, and developer strings Codex shows the user must say who is actually asking for hook trust.
So the crate ships the manifests as templates: the JSON structure and
the event set are crate-owned (and pinned against the attribution module’s
event list), while the command and identity are slots the consumer fills
through render_hooks_manifest and render_plugin_manifest. Both
installers — a closed-source one today, a tapesctl installer later — render
the same
bytes around their own strings, which is the same anti-drift bargain the
pi asset struck, adapted to a plugin that cannot be vendor-complete.
The templates carry no endpoint and read no environment: a hook plugin is
inert until the rendered command does something, so the inertness
obligation crate::plugin::GATEWAY_URL_ENV discharges for pi rests here
on the consumer’s command instead.
Rendered manifests are still not an installed plugin. manager owns
the rest: the marketplace wrapper that makes them installable, and the
codex CLI invocation that installs them.
Modules§
- manager
- Codex’s own plugin manager: the source layout it consumes and the
codexsubcommands that register and install from it.
Structs§
- Hook
Plugin Identity - The consumer-supplied identity a rendered plugin manifest presents to the user in Codex’s plugin UI.
- Hook
Plugin Templates - The two manifests a consumer packages into its plugin source directory, as the registry hands them out.
Constants§
- CODEX_
APP_ TEMPLATES - The Codex desktop app’s manifest templates.
- HOOKS_
MANIFEST_ TEMPLATE - The hooks manifest template —
hooks/hooks.jsonin the packaged plugin. - HOOK_
COMMAND_ SLOT - Slot in
HOOKS_MANIFEST_TEMPLATEthat a consumer’s hook command line replaces. The slot is the entire JSON string value, so substitution is JSON-escaped byrender_hooks_manifest; a consumer never edits the template text itself. - PLUGIN_
MANIFEST_ TEMPLATE - The plugin manifest template —
.codex-plugin/plugin.jsonin the packaged plugin. Identity fields are slots forHookPluginIdentity; the manifest deliberately registers no tool, app, or skill, so an installed plugin is hook-only by construction.
Functions§
- render_
hooks_ manifest - Render the hooks manifest with the consumer’s hook command line.
- render_
plugin_ manifest - Render the plugin manifest with the consumer’s identity strings.
- shell_
quote valueas a single POSIX shell word.