Files
paseo/plugin-examples/agent-configuration
Mohamed Boudra a886bfbcdd Give plugins an agent's background work count and a background flag on hooks (#9362)
* feat(plugins): give plugins the agent's sidebar indicator and background flag

Plugin UI re-derived agent state from status and attention fields and could
not see background work, so it showed agents as done while a shell they left
running was still live. Agent snapshots now carry the sidebar's own bucket as
indicator/indicatorLabel, computed by the same function the sidebar uses so
the two cannot drift.

Lifecycle hooks and the agent.open.before request now carry `background`, so a
hook can skip a hidden helper agent without a lookup. A hook cannot change it;
an omitted value means unchanged, like metadata.

`finished` attention still means the turn finished; background work is the
indicator's concern.

* fix(plugins): keep session-open hooks that omit background typechecking

A hook that returns its own object instead of spreading the request has no
background field; the result type now treats it as optional, like metadata,
matching the runtime where an omitted value means unchanged.

* refactor(plugins): give agent snapshots the background work count instead of an indicator

* fix(plugins): keep legacy session-open hooks that omit background typechecking
2026-11-11 15:10:13 +07:00
..

Agent configuration

Sets saved Codex options through server.addHook("agent.create.before", async ...):

  • Sets config.providerOptions.sandbox_mode to workspace-write.
  • Sets config.providerOptions.approval_policy to on-request.
  • Preserves other configuration and provider options.

Adds the company MCP server to Codex launches, skipping background agents, through server.addHook("agent.open.before", async ...). The server is never saved in the agent's configuration; existing saved MCP servers are preserved. Existing agents receive the server through the session reopen behavior.

Replace https://tools.example.com/mcp in index.server.ts with your MCP server URL before using this example. A company name collision with a saved server or another plugin fails the session open and names both sources.

Install on a daemon with plugins enabled:

paseo plugin install /absolute/path/to/plugin-examples/agent-configuration

Each session-open callback receives only this plugin's MCP servers. The nested spreads preserve entries added by this plugin's earlier callbacks. The create callback receives configuration after earlier plugins have transformed it; its explicit Codex options replace the named fields in the saved configuration of new agents and remain after this plugin is disabled.

See Inject MCP servers for choosing between saved configuration and plugin-owned servers. Lifecycle actions demonstrates provider switching and environment injection. Its provider-switch callback clears provider options when changing Codex to Claude, so use these examples separately when trying the Codex-specific settings.