mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-11 10:57:07 +00:00
* 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
37 lines
2.0 KiB
Markdown
37 lines
2.0 KiB
Markdown
# Lifecycle actions
|
|
|
|
Small callbacks using the existing SDK:
|
|
|
|
- Send `Try again.` when the latest output contains `out of credits`, except to background agents.
|
|
- Decline a shell request matching `rm -rf`; approve exactly `git status`; leave other requests alone.
|
|
- Inject `PASEO_HOOK_CREATE_EXAMPLE=created` on creation and `PASEO_HOOK_OPEN_EXAMPLE=opened` on each session opening.
|
|
- Change requested Codex agents to Claude Haiku before creation.
|
|
- Create a worktree when a directory creation request is titled `Isolated lifecycle example`.
|
|
|
|
This is a demonstration plugin: installing it enables all these behaviors on its host. Install it
|
|
alongside `lifecycle-logger` on a test daemon with plugins enabled:
|
|
|
|
```bash
|
|
paseo plugin install /absolute/path/to/plugin-examples/lifecycle-actions
|
|
paseo plugin install /absolute/path/to/plugin-examples/lifecycle-logger
|
|
paseo plugin logs lifecycle-logger
|
|
```
|
|
|
|
Outside the Paseo repository, `server/inspect.ts` needs `@getpaseo/protocol` installed for its
|
|
type imports. Add it to your plugin development dependencies at the same version as
|
|
`@getpaseo/plugin` before installing this example.
|
|
|
|
Copy the callbacks you need into your own plugin. The follow-up example sends a new message; it does
|
|
not replay attachments or undo previous tool effects. If the provider keeps returning the matching
|
|
phrase, it keeps sending follow-ups. Add limits or delay in your plugin when your workflow needs them.
|
|
The command regex illustrates a policy; it does not parse shell syntax or cover every deletion command.
|
|
|
|
`server/inspect.ts` joins provider text chunks and excludes earlier turns and the current user prompt
|
|
from the phrase match. The failing-first regression test records the split text observed with a real
|
|
Claude agent.
|
|
|
|
See [agent configuration](../agent-configuration) for a focused example that injects MCP servers and
|
|
changes Codex sandbox and approval options while preserving other settings.
|
|
|
|
See the [lifecycle reference](../../public-docs/plugins/reference.md#lifecycle-hooks) for the API.
|