mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-09 09:54:40 +00:00
* feat(protocol): option controls, options patch, and provider.controls.list
Add AgentOptionControl descriptors, snapshot options/controls, an options patch on
agent.config.apply, provider.controls.list RPC, and server_info.features.providerOptionControls.
featureValues stays accepted on the wire (COMPAT).
* feat(server): fold featureValues into providerOptions and describe composer controls
Providers emit option controls over top-level providerOptions keys; the daemon stores one
options record per agent, merges config.json defaults as effective values, and applies patches
live via AgentSession.applyOptions. Legacy featureValues (wire, stored records, profiles,
schedules, hooks, MCP) fold into providerOptions; snapshots still carry features built from
controls. Snapshot options expose only keys that have a control.
* fix(server): address Phase 1 audit findings on option controls
- Removing auto_accept (OpenCode, ACP) turns live approval off; ACP selects return to their session default.
- agent.create.before hook featureValues edits override options the create already set.
- Claude commits fast_mode only after the runtime accepts it.
- Codex snapshots show a saved Fast preference as the tier the model resolves it to (AgentSession.displayOptions).
- Profiles are folded into options in the daemon config store; the config API still answers with featureValues.
- Snapshot options and provider.controls.list carry all effective options.
- Test: Claude fast_mode survives a restart through stored providerOptions.
* fix(server): keep snapshot options as configured, restore OMP baseline, cover options through public interfaces
- Codex: drop displayOptions; a select choice may carry aliases so a saved Fast preference selects the model's Fast tier from options + controls alone.
- OMP: removing fast_mode restores the runtime's starting setting.
- ACP/Cursor removal tests run through real session initialization.
- agent.config.apply of a non-control option reaches the provider and shows in the next snapshot (daemon e2e).
- Daemon config store persists legacy-featureValues profiles as options on the next profile save.
* fix(server): read a pre-v0.10 Codex fast_mode record as service_tier "fast" and store it that way
A record holding `fast_mode: true` without `service_tier` ran Fast but the speed control showed
Normal, and picking Normal then wrote "default". The Codex session now normalizes the old boolean
at construction and reports the new shape through its existing options_changed event.
* fix(server): show Fast for a stored Codex fast_mode: true without rewriting the record
Reverts the storage migration from a987b4a43. The Codex speed control now takes its default from
the session's current options with the same rule the runtime uses (an explicit service_tier wins;
fast_mode: true applies only while service_tier is absent). This holds on create, resume, live
apply and for config.json defaults, and stored options stay as set.
* chore(website): regenerate the config schema for profile options
* refactor(server): providers report option differences once, after create, resume and apply
Providers used to write their own reports into the agent's options while a session was being
created, resumed or updated, which needed a growing set of reconciliation, baseline and
suppression rules to stay in step with the daemon.
The contract is now transactional. A provider opens or updates with the options it is given and
emits nothing while doing so; if the result differs it says so once, afterwards, as
`options_changed`. Live apply hands the provider only the keys the patch sets and the daemon stores
them onto the agent's current options when the provider accepts, so the last write wins. A change
the provider makes on its own is stored and forwarded, not undone. Removing an option drops the key
and sends nothing live. Controls carry no state; `options` is the only option state.
A legacy `agent.create.before` hook's `featureValues` edits are applied as a patch over the
returned options, so its deletions and replacements hold. The unreleased `aliases` field on option
choices is gone; a pre-v0.10 Codex Fast preference is reported once as the model's tier id.
* refactor(server): providers return what apply and open ended with instead of reporting it afterwards
applyOptions returns the options the session ended up with and the session
exposes its open difference as openOptionsPatch, so the manager stores the
patch and the provider's answer in one step. Removal is an ordinary patch:
the provider receives the default the key falls back to, or null, and returns
what it kept. Controls no longer take a default from a stored legacy feature
value.
* fix(server): apply an old app's profile featureValues over the profile's stored options
The unchanged app's profile form only knows the controls, so a name-only
edit dropped options it never shows, such as sandbox_mode. Its
featureValues now apply as a patch over the options already stored for the
profile (null removes a key), and a write with no featureValues keeps them.
* fix(server): ACP reports the selects it moved during open or apply as that call's result
A config_option_update that arrived before the write response was emitted
as an event on top of the result the manager stores. Notifications during
open or apply now fold into the open patch or apply result, and a rejected
apply reports what the agent moved since nothing is stored. Live options
are validated with the creation schema. Tests drive a stdio ACP agent.
* fix(server): providers validate live option patches and Claude reports Fast dropped by a model switch
Live patches go through the schema used at creation. A Claude model switch
that cannot keep Fast reports fast_mode as removed so the stored options
match the session.
* fix(server): Claude reports Fast as off, not removed, when a model switch drops it
A removed key lets a config.json default of fast_mode: true fill back in
while Fast is off at runtime.
* fix(server): fold an old app's profile featureValues by the provider and options the write carries
A write with options folds featureValues over those options. A write
without them patches the stored options, unless the profile moved to
another provider, which starts from no options.
* docs(server): a rejected apply reports what the provider moved after the call ends
* test(server): a patch key is resolved against nested configured defaults
* test(server): a setting a plugin changes on its own is forwarded as options_changed
* test(server): assert the forwarded plugin setting without nesting callbacks
* test(server): removal of auto_accept returns ACP to asking; Claude keeps opening restrictions across a patch
* fix(server): Codex returns the tier it resolved and drops a speed the new model lacks
A live service_tier: fast is stored as the catalog's Fast tier id instead of
a value the control cannot show, and a model switch to a model without the
stored speed reports Normal so choosing a supporting model again does not
bring the paid tier back.
* fix(server): Claude applies only the keys a patch sets over its current options
A Fast patch kept a copy of the options taken before the runtime answered, and
assigning it afterwards dropped a patch that landed meanwhile.
* fix(server): a plugin that moves settings and then refuses an apply reports what moved
* refactor(server): the legacy featureValues folds take one named-input object
* fix(server): a live patch is rejected for an option the session only reads at start, and opening reports every option it ended up with
A stored option has to describe what runs. OpenCode, OMP and ACP now reject a live change
to a key they apply only when the agent opens; Claude applies such a change from the next
turn and rejects it while a turn is running. Opening reports every select or setting the
session came up with, including ones nobody set, so a native default (Cursor opening with
Fast on) is stored as option state like any other.
* fix(server): Claude rejects a live change to an option it reads when the query starts
Replacing a started query to apply the option would end its background shells and
tasks. Once the query exists only Fast can change; before the first prompt every option
still applies, because it is read when the query is built.
* fix(server): a live options patch is rejected when the session cannot apply it
A session with no applyOptions (Pi) now rejects a patch instead of storing a value that
fails on reopen. Codex applies only service_tier, plan_mode and fast_mode live, since the
approval policy and sandbox are fixed when the thread starts. Claude also rejects a launch
option change while its first query is starting, after the options have been copied.
* fix(server): plugins reject keys they do not report as settings, and Codex opening reports the speed it runs
A plugin session applied the settings it knew and silently stored the rest; it now rejects
a patch that names a key the plugin does not report. Codex opening on a model without the
saved speed ran Normal while the stored options still said priority; opening now reports
the tier it runs, as a later model switch does.
* refactor(server): option helpers take named inputs, control types come from their schemas, and a plugin accepts launch options it opened with
A whole profile is applied by the unchanged app, so a launch-only plugin option whose value
has not changed must not fail the apply. applyProviderOptionsPatch and featuresFromControls
take one object, and the protocol control types are inferred from the wire schemas.
* fix(server): ACP reports a select that appears after startup with its native value
A model switch can introduce a select (Cursor Fast) that the session did not have at open.
Its value is now stored like any other native selection instead of being skipped because
the previous snapshot did not name it.
* fix(server): a loaded agent's options stay what its session opened with when a provider default is edited
effectiveOptions was recomputed from the current config.json defaults on every state emission, so editing a default changed the snapshot of an agent whose session never received it. It is now computed when the session opens and moves only through an apply or an options_changed. Editing a default affects agents the next time they open.
* fix(server): a live apply shows the merged defaults the provider was given in the options snapshot
The snapshot took the raw patch, so a nested patch over configured defaults dropped the defaults the provider had accepted. The snapshot now takes what the provider was sent plus what it reports back; stored options still keep the raw patch.
* fix(server): an option a session drops when opening is not brought back by a configured default
The opening snapshot merged defaults over the options after the session's openOptionsPatch had removed a key. Defaults now merge into what the session was given and the patch applies after.
* fix(server): Codex keeps the speed it opened with when the legacy Fast key is removed
Opening moves a legacy fast_mode into service_tier, so removing fast_mode afterwards changed the runtime speed to Normal while the stored options still said Fast. Removing the alias now changes no speed.
* fix(server): opening snapshots keep the defaults the session launched with, and config-change pushes carry legacy profile values
An opening resolved defaults once for the session and again at registration; an edit in between showed options the session never received. Create, resume and reload now resolve once, before the provider opens, and registration starts from that. The daemon_config_changed push skipped the featureValues projection that config replies apply, so the unchanged app lost a profile's legacy values when any setting changed.
* fix(server): every opening path hands registration the options it launched with
Registration took the launch options as optional and reread the defaults when a path did not supply them, as provider-session import did. It is now required, so create, resume, reload and import each resolve once before opening. The option helpers take named inputs.
* fix(server): a saved legacy Codex Fast preference wins over a configured service_tier default
The defaults merge put a configured service_tier next to the agent's own legacy fast_mode, and Codex reads service_tier first, so the agent opened Normal. The agent's own alias now replaces the default of the key it stands for.
* fix(server): Codex keeps a Fast chosen by alias as the catalog's tier id
A live fast_mode or service_tier "fast" was stored as the alias while the apply reported the catalog id, so a later switch to a model with a different Fast id ran Fast under an option that said otherwise. The session now stores the id it accepted and drops the folded fast_mode.
* fix(server): the legacy Codex Fast alias folds into one speed on apply and in configured defaults
A patch with both speed keys left the alias in the stored options, so a reload started Fast again after the speed was removed; the apply now reports the folded alias. A configured fast_mode default now supplies the service_tier default, so removing an agent's own speed falls back to the configured Fast like opening does.
* fix(server): an OMP replacement runtime starts with the Fast the session has now
A restart (for example an approval-mode change) restored Fast from the options the session opened with, turning back on a Fast the user had switched off. The session now keeps the Fast it applied or the provider changed, which is what a replacement reads.
* refactor(server): Codex's legacy fast_mode converts to service_tier where old data enters
Stored records, config.json defaults, profiles, older clients' requests, MCP settings and
plugin hooks go through convertLegacyOptions as they come in. Past that point the defaults
merge, the manager and the Codex session never see fast_mode for Codex, so the alias branch
in the defaults merge and Codex's fast_mode handling are deleted.
* fix(server): a legacy hook's replaced speed and an apply request's options convert before they are compared or applied
A hook that swaps the canonical speed it was sent for fast_mode is diffed in canonical form, so
its replacement is not read as a deletion. An apply request carrying featureValues and options
sends one options patch with options winning, so a superseded legacy value is never applied.
* refactor(server): the agent manager converts Codex's legacy fast_mode for the adapter behind the provider id
The rename is adapter-specific, so it lives where the provider id resolves to its adapter:
AgentManager converts an agent's own options on create, resume, import, reload, apply and
draft controls, following derivedFromProviderId, so a custom provider extending codex keeps
working with a saved or requested fast_mode. Storage, MCP, schedules, hub and profiles pass
options through. The featureValues-to-options fold stays provider-agnostic at the legacy edges.
* fix(server): a rejected OpenCode auto_accept leaves the session asking for permission
applyOptions committed the new flag before approving pending requests, so a failed reply left
the session auto-approving while the stored option stayed off. The flag is restored when the
apply throws.
* fix(server): legacy Fast reaches draft discovery and saved profiles, and overlapping or replaced options keep the state they committed
Draft controls and commands convert the config they hand to the provider, so inspecting a
legacy Fast preference no longer fails Codex's strict options. A profile naming codex converts
its saved fast_mode for the app's controls. OpenCode serializes auto_accept applies so a failed
one restores exactly what it changed, and a replacement OMP runtime starts from the Fast the
session opened with.
* fix(server): an OMP replacement runtime that refuses the session's Fast publishes what it accepted
The approval-mode restart installed the new runtime's state without comparing its Fast result to the session's, so a refusal never reached options_changed, the remembered value, or storage. The replacement now goes through the same comparison as refreshState.
* fix(server): OMP turn completion publishes a Fast change, and Claude opens with Fast off on a model that has none
OMP installed runtime state in several places and only one compared Fast; every state read from the runtime now goes through one install step. Claude kept a Fast default on a model without Fast, which made unrelated options reject until the user cleared it; the session now opens with Fast off and reports it in openOptionsPatch, as the model-switch path already does.
* fix(server): a malformed Codex fast_mode is rejected, and profile options are renamed for clients by the agent manager's conversion
convertLegacyOptions read any truthy fast_mode as Fast, so the string "false" ran priority. It now accepts only true, false or null. The profile store no longer renames keys: a literal codex profile was renamed in storage while an extends-codex profile was not. The config API now converts each profile's options with the manager's adapter-aware conversion, so codex and my-codex profiles read the same.
* fix(server): a profile is stored in the current option keys, converted for the adapter its provider extends
Profiles in config.json are old data entering, so the store converts them (stored value and incoming patch) with the same conversion the agent manager uses. Storage and clients now share one vocabulary: resetting a legacy Codex profile's speed removes what was shown, and a malformed fast_mode rejects the write instead of breaking later config reads. The config API goes back to copying the field shape only. The extends chain is followed by one function over either the registry's definitions or config.json's providers.
* fix(server): profile options convert against the provider graph a write commits
A write that edited a provider and a profile together folded the profile against a shallow merge that dropped the provider's extends, so its legacy Fast was not converted. The fold now sees the same deep-merged providers the write commits.
* fix(server): draft speed shows the tier the first turn will run with
Draft discovery reported the options as requested, so a Fast configured as a legacy fast_mode or the fast alias read as Normal while creating sent the model's own Fast tier. The draft now reports the options the scratch session opened with, as registration does.
* fix(server): ACP option applies run one at a time
Two overlapping applies shared one transaction guard, so when the first was refused after the agent had moved a select, its report was dropped as 'still in a transaction' and the second saw no difference. Applies are serialized, as OpenCode's are, so each reconciles against the state the previous one left.
* fix(server): an ACP removal reports the choice the select lands on, and the Codex plan tests enable plan mode
A removal asks the select for its empty choice and compared the result against that
same empty choice, so applyOptions returned nothing and the manager stored the removal
as null while the session ran the Default choice. The difference is now computed against
what was asked (null), so the options hold the value the session runs with.
The Codex plan-mode end-to-end tests called the removed session.setFeature through an
optional call and silently skipped plan mode; they apply the option and fail loudly if
the method is gone. The MCP parity wrapper forwards listControls instead of the removed
listFeatures.
* fix(server): plugin option applies run one at a time, and OpenCode reports the Auto Accept legacy full-access turns on
Plugin sessions let two applyOptions overlap. The second finished and re-recorded the
settings the plugin held, which included a change the first had already made and not yet
reported; when the first then failed, nothing was left to report and the stored options
kept the old value while the plugin ran the new one. Applies now queue on the session,
the way the ACP adapter's do, so each reconciles against what the one before left.
OpenCode normalizes the legacy full-access mode to build with Auto Accept on, but the
session never said so, so the options the manager keeps did not hold Auto Accept and a
reopen turned it off. The session now reports it through openOptionsPatch on create and
resume.
* refactor(server): openCodeOpenOptionsPatch takes one named-fields object
* feat(app): the client and app work on options and controls
The agent snapshot's `options` are the state and `controls` only draw them.
Running and closed agents draw from the snapshot; drafts and profile forms ask
`provider.controls.list.request` with their `providerOptions`, so aliases such
as a legacy Fast profile's `service_tier: "fast"` are resolved once, by the
daemon, and the draft keeps Fast highlighted. A draft adds only the user's
edits and each provider's last-used control values; applying a profile seeds
its non-control options (e.g. `sandbox_mode`) into the draft, and a profile
form saves them back instead of pruning to the controls it can draw.
A daemon without `server_info.features.providerOptionControls` still sends
`features` and `featureValues`. `LegacyProviderOptions` in the client package
is the one place that translates snapshots, draft listings, create and apply
requests, and daemon-config profiles, so the app never branches on it.
Persisted preferences and tab layouts rename `featureValues` through tagged
COMPAT preprocessors.
The features/controls bridge moves from the server into the protocol package
so the client can reuse it.
* fix(app): drafts and profile forms send every option layer to the daemon
A cold create against a daemon without providerOptionControls routed control
options (Claude fast_mode, Codex service_tier) as providerOptions, which that
daemon does not read for them. The client now lists the provider's features
before the first create or workspace create that carries options, so callers
never prime a cache.
Draft options moved into a plain model. Applying a profile replaces provider
and options in one step, so the form's provider change that follows no longer
clears a cross-provider profile's non-control options; choosing a provider by
hand still starts over. The model sends its complete options (seed, last-used
values once the provider says it still draws them, edits) to the daemon and
the controls draw only the answer, so a remembered legacy fast is drawn as
what it runs as. A toggle shows over the last answer until its own arrives.
The profile form does the same: its edits go through resolution too.
* fix(client): a legacy create routes its options from the controls of its own config
Which options a legacy daemon exposes as features depends on the model, mode
and thinking level, not only the provider: a Haiku snapshot with no features
says nothing about Opus. The provider-keyed memory of control keys sent an
Opus create's fast_mode as providerOptions, which that daemon does not read.
A create that carries options now lists the controls for its own draft
config and splits on that answer. The memory, and the snapshot and listing
hooks that fed it, are gone.
* fix(app): a closed agent shows its stored options, and a provider switch asks about its own options
A closed agent's snapshot is projected from its stored record, which kept
controls and provider options but dropped them from the payload, so the
app drew no speed or other controls for it. The stored projection now
carries them, with the legacy features derived from the same source.
The draft read the form's provider and the model's options separately, so
for the render after a manual provider change it asked the new provider
about the previous provider's options. The request is now built from one
snapshot of the model and is absent until the model has observed the new
provider.
* fix: persisted options keep their full shape, and every legacy snapshot gains controls
Draft setups and form preferences validated option values as booleans,
strings or null, but the options they now receive come from agents and
profiles and can be objects, arrays or numbers. One such value failed
validation and wiped the whole saved layout or the saved preferences. Both
schemas now accept any JSON value.
The legacy-daemon translation skipped the snapshots carried by
agent_created, agent_resumed and timeline responses, so a created agent or
a timeline refresh left the SDK handle without options and controls.
The profile journey asserted the create request's options field; the wire
field is providerOptions.
* fix(client): a legacy profile with both featureValues and options keeps both
A legacy daemon keeps an unknown `options` field on a profile it stored
(profiles are passthrough), for example after a downgrade, while its own app
keeps editing `featureValues`. Reading such a profile took `options` and
dropped `featureValues`, so a Fast setting there was lost and the next save
replaced it. Both are merged on read with an explicit `options` key winning,
the same rule the daemon applies when it folds `featureValues`.
The draft form input of draftControlsRequest is a named type.
* fix(app): a draft stops sending a toggle the model in use does not offer
A toggle made on one model stayed in the draft's edits after the form moved
to a model whose controls do not include it, and was sent with the create.
On a legacy daemon that key is not a feature for the new model, so it went
out as a native provider option the daemon rejects. The draft now sends an
edit only while the latest answer draws a control for it, and sends it again
when a control for it returns.
* fix(server): a closed agent's options include the provider defaults, like a live one's
The stored snapshot projected only the options the agent owns, so an agent
that ran with a config.json default (for example Claude fast_mode: true)
showed the option as missing, and its legacy Fast control as off, until it
was resumed. The projection takes the same resolver the live agent uses
(the provider's defaults under the agent's own options).
* fix(app): a draft keeps sending an option no control has drawn
The previous change stopped sending any edit the latest answer drew no control
for, which also dropped options set without a control (a plugin setting a
token budget on the draft). Only an edit of a key an earlier answer for this
draft drew as a control stops applying when a later answer draws none; every
other edit always applies.
* test(server): the MCP test agent manager resolves effective options
* fix(app): a profile stops saving a toggle the model in use does not offer
Switching a profile from Opus to Haiku kept the Fast edit, so the saved
profile carried fast_mode that no control draws and an old daemon's
provider rejects at create. The profile editor now drops a key an earlier
answer drew as a control and the latest one does not, the rule the draft
already follows; options no control ever drew are never touched.
* fix(client): resetting an option on an old daemon writes the default it can take
setAgentOptions({ service_tier: null }) sent a feature write with value
null, which the old Codex setter rejects, leaving the paid Fast tier on.
A toggle now resets to off and a choice to its default; an option with
no control to name a default fails with the host-update message before
anything is written.
* fix(client): applying a config with a reset option on an old daemon writes the default it can take
applyAgentConfig({ options: { service_tier: null } }) reached an old
daemon as featureValues with null, which its Codex setter rejects. The
config now takes the same translation as setAgentOptions: a toggle goes
off, a choice goes to its default, and an option with no named default
fails with the host-update message before anything is sent.
* feat(plugin): provider plugins declare option controls and receive option changes
A provider plugin reports `controls` and the `providerOptions` it runs in
`session.config`, and receives running-session changes as
`session.configure` `changes.providerOptions` (null returns a key to its
default), under the same apply-or-throw contract as built-in providers.
A control may declare a `defaultValue`; a value a plugin reports at that
default for a key nobody set stays unset instead of being pinned to the agent.
A plugin that still reports `settings` keeps working: the daemon reads each
setting as a control plus an option and sends changes in both shapes
(COMPAT(plugin-provider-settings)).
The app resolves a control's icon as a Lucide name when it is not one of the
built-in kebab-case names, so a plugin's icon shows live and in drafts.
Public docs and the provider-direct example use only `providerOptions` and
controls; the migration doc gains the rows.
* fix(server): a plugin provider's reported options are stored like any provider's
A control's `defaultValue` only says what the control shows for a key with no
value. Opening and applying store every option the session reports, defaults
and values nobody set included, as built-in providers do; the special case that
left a value at the default unset is removed.
* fix(server): a plugin decides which options it applies live
A plugin reporting `controls` and `providerOptions` receives every key a live
change touches, with or without a control, and applies them or rejects the
whole request. The daemon's live-key guard now runs only for a plugin still
reporting `settings`, which cannot refuse a key.
* fix(server): a rewound plugin session reopens with its options as they stand
The reopen merged the plugin's reported options over the launch record, so a
key the plugin reset by leaving it out came back at its launch value. The
session now keeps the committed options, removals included. The provider-direct
example also refuses a combined request before changing anything.
* fix(server): a plugin that stops reporting an option has reset it
The adapter only visited keys present in a new report, so a key the plugin
dropped to return to its default kept its stored value and its rewind value.
A previously reported key that disappears is now reported as removed.
* fix(server): an apply reports the options the plugin reset along the way
Applying and unsolicited reports now share one conversion from the plugin's
report to a patch, so a key the plugin stops reporting is a removal on both.
* fix(server): an apply never reads a requested option as one the plugin dropped
A plugin may run an option it never reports. Only a key it reported before can be
reported as removed, and a rewind reopens with the accepted request plus what the
plugin reported back.
* test(server): an apply to a plugin that reports controls sends its changes as provider options
* feat(plugins): agents and workspaces carry plugin metadata
Plugins had nowhere to keep their own data on an agent or workspace, so
Phase 5 and 6 surfaces would each have invented a side store. Both now
hold an opaque Record<string, JsonValue> that Paseo stores, snapshots and
hands to hooks without reading a key.
Set at creation or changed with agent.metadata.update.request /
workspace.metadata.update.request (top-level keys replace, null removes).
Persisted on the agent and workspace records, so it survives a restart.
Reaches agent.create.before (which may add to it), agent.open.before
(read-only), agent.create.after and workspace.create.before/after.
Gated once on server_info.features.entityMetadata; the client throws
"Update the host" instead of sending to a host without it.
* fix(plugins): an agent.open.before result may omit metadata
The result schema required metadata, so a plugin written before metadata
existed that returns its own object instead of spreading the request
failed validation and the session open failed, even for agents with no
metadata. An omitted metadata now means unchanged and is filled back in
from the request so later plugins in the chain still see it; a present
value that differs is still rejected.
The restart test now sets metadata through the PaseoApi handles and
checks that agent.open.before sees the patched value after the restart.
* fix(plugins): omitted metadata in a hook result means unchanged
An agent.create.before hook that returned its own { config, env } dropped
metadata that an earlier hook in the chain had added, because only the
caller's original metadata was restored at the end. The omitted field is
now carried forward at each hook handoff, as agent.open.before already
does.
The agent.open.before result type also required metadata, so an older
TypeScript plugin that returned its own object no longer compiled even
though the daemon accepted it. The result type now makes it optional.
* fix(plugins): omitted metadata in a workspace.create.before result means unchanged
Same handoff as agent.create.before: a legacy hook that returned only
{ source, ... } dropped the caller's metadata and anything an earlier
hook added, and workspace provisioning then defaulted it to {}. The
omitted field is carried forward at each handoff; an explicit {} still
replaces.
* test(server): fixtures for agents and workspaces carry metadata
Agent snapshots and workspace records now always carry metadata, so the
hand-built fixtures and expectations in three existing suites name it.
* docs(plugins): the hook result comment names metadata as the field that stays
* fix(server): reopening a closed agent keeps metadata saved just before
The loader reads the agent record, then queues a resume. A setMetadata
queued ahead of that resume saves a newer record, and the open hooks saw
it, but registration took metadata from the loader's older read and wrote
it back over the saved patch. Registration now uses the metadata read
inside the lifecycle lane.
* docs(server): name the metadata gap when a handle-less agent is recreated on load
* docs(server): the handle-less recreate gap spans the agent.create.before hook
* docs(plugins): an agent.open.before hook starts writes to its own agent without awaiting
An agent.open.before hook that awaits setMetadata (or any write) on the
agent being opened deadlocks: the write joins the agent's lifecycle lane
behind the open, and the open waits on the hook until it times out. The
hooks reference now says so and shows the supported shape, a write
started without awaiting, which runs right after the open.
Deferred, not in this stack: reject such a write immediately instead of
letting the hook time out. The host knows which plugin hook it is
awaiting for the agent and which channel the write arrives on, so the
rejection can be keyed on "this plugin is inside an open hook for this
agent" without cross-process tagging, and an unrelated client's write
would still wait as it does today.
* feat(plugins): composer items and controls in all three composers
A plugin registers a component with addComposerItem and reads and changes the
composer through useComposer(): provider, model, mode, thinking, options,
prompt, attachments and agent metadata. The agent, draft and New workspace
composers provide the same ComposerInput and ComposerAgent halves, so a
command reaches the right model without the plugin knowing which composer
it sits in.
Toggle, Select and Action are drawn by one ComposerControl renderer that
the thinking select and provider option controls now use too. Controls sit in
the toolbar when there is room and become rows in the existing overflow sheet
otherwise, so on a phone they appear in the overflow. Plugin items count in
the density presence so the composer condenses to make room. Model and mode
stay specialized but share the trigger, density and overflow.
Draft metadata is kept locally, sent at creation and reset when the prompt is
sent. PluginAgentSnapshot.metadata, deferred from the metadata phase, lands
here. The unused provider badge is removed.
vitest resolves @floating-ui/react-native to its ESM build: the CJS entry
requires the real react-native, whose Flow sources do not parse.
* fix(plugins): composer commands run on current state, report failures, and reach the overflow sheet
Draft commands read the state captured at render, so a plugin's
`await setProvider(); await setModel()` acted on a stale provider. The draft
form and options are now plain stores that commands read live, and
`setProvider`/`setModel` reject an unavailable provider or a model the loaded
catalog does not list. Draft `options` include the plugin's pending edits.
Shared composer controls own the pending state and show a rejected command as
an error toast, like the built-in controls. Callback payloads are objects
(`{ value }`, `onPress(event)`) so they can grow without breaking plugins.
The overflow sheet's content portals to the app root and lost the composer's
agent, input, toast and query contexts, so plugin items drew nothing in it.
`useComposerSheetBridge` carries them across.
* test(plugins): composer commands tested on the models, overflow sheet in Playwright
The draft composer's command rules (unavailable provider, unlisted model,
edits belonging to the provider the form has now) moved from the React hooks
into the form store and the draft options model. They take the host's catalog
as a plain input, so the command tests run on the real models with no module
mocks and no renderer.
The overflow-sheet test faked the portal it was meant to verify. It is
replaced by a Playwright spec that installs the composer-controls example and
checks its rows in the narrow composer's Features sheet; it fails when the
sheet's context bridge is removed.
* test(plugins): lock draft option ownership without a subscription, name the overflow-sheet steps
The draft option test subscribed the options model to the form, which in the
app happens in a render effect, so it passed without the model observing the
form's provider itself. A case with no subscription now fails when that
observation is removed.
The overflow-sheet spec reads as steps through a helper.
* fix(plugins): composer option resets and model checks match the documented commands
A draft kept `null` as an option value, so `setOptions({ key: null })` sent the null to the
provider and creation failed. A null edit now removes the key from every draft layer, as the patch
does on a running agent. A running agent's `setModel` accepted ids its catalog does not list; it
now rejects them the way a draft does.
The composer controls imported the toast host through the toast context, which pulled the host's
animation module into every module that loads plugins. They use the API-only context instead.
The migration guide's registration table gets the `addComposerItem` row its test requires.
* fix(plugins): draft metadata survives a remount, plugin commands follow the composer lock
Draft metadata was component state while the prompt lived in the draft store, so a composer that
remounted across the compact breakpoint kept its text and lost the plugin's choices. It now lives
in the draft store beside the prompt, is cleared when the draft is sent, and is not cleared when
the prompt is emptied. It is not persisted across app restarts.
While the New workspace composer is creating the agent, the built-in controls are disabled but
plugin controls and commands were not. They read the composer's own lock: Paseo controls render
disabled, and setPrompt, insertText and the agent commands refuse.
The options and metadata a plugin reads are frozen copies, through the same helper the timeline
projection uses. The composer control test mounted components in JSDOM, which the testing rules
ban; it now runs in the browser project.
* fix(plugins): a kept command honors the composer lock, and useAgent metadata is frozen
A plugin action that awaits an RPC holds the composer it was created with. The lock was captured
at that render, so a submit that started meanwhile did not stop its insertText. Commands now ask
the composer whether it is locked when they run.
The agent snapshot a plugin gets from useAgent froze only the outer metadata record. It now uses
the same deep frozen copy as the composer.
* fix(plugins): attachment commands honor the composer lock
The creation request captures the attachments when it starts, so an attachment a plugin added or
removed afterwards was lost or left in the request. They refuse like the prompt commands.
* fix(plugins): a built-in select in the compact sheet keeps its action name
The shared control named every icon-only select by its value ("Speed: Fast"),
including in the compact sheet, where the row already shows the value. The sheet
row is named by its action again ("Select speed"), as before the shared renderer.
* test(app): composer item test installation carries the subscribe main added to InstalledPlugin
Main's plugin streaming (#8527) made subscribe a required field of InstalledPlugin; the
composer item model test builds its own installation and predates it.
* feat(plugins): New workspace items set the branch and workspace metadata
addNewWorkspaceItem mounts a plugin field on the New workspace screen, and
useNewWorkspace() exposes host, project, isolation, base ref, branch and
metadata with commands that follow the composer item rules: they act on the
screen's state when they run, resolve once applied, reject while the screen
is locked, and take JSON payloads. Host and project are read-only because a
command that switched them would unmount the item that called it.
The screen's pickable state (base selection, manual isolation, branch,
metadata) moves into one plain store so pickers and plugin commands write to
the same place; the screen reports derived facts to it on each render. The
branch is sent as source.branchName only for a branch-off worktree, and
metadata on workspace.create.
Items render through ComposerControl with a new "field" surface (badge on
desktop, full-width field when compact). Combobox ships here: Paseo owns the
loading and error states, keeps previous results, and drops superseded
searches.
* fix(plugins): New workspace commands work from mount effects, and branch and base ref match what creation uses
A command called from a New workspace item's mount effect rejected because the
setup model only received its inputs and the pickers' handlers from a passive
effect on the screen, which runs after a child's. The model now takes its
inputs at construction, picks the base and isolation itself, and is refreshed
in a layout effect; the screen supplies the side effects of a pick (the PR
attachment, the remembered isolation) as listeners.
The branch a plugin sets was dropped when no base was resolved, such as on a
detached HEAD, because it was sent only for an explicit branch-off. It now
applies whenever the worktree cuts a new branch, decided in one place that
mirrors the daemon.
baseRef.name was the display-shortened branch name, so setting back what was
read based the worktree on the local branch instead of the origin one. It is
now the exact ref creation uses, and host and baseRef are frozen like project
and metadata.
* fix(plugins): New workspace commands have the same effects as a pick, even from a mount effect
The screen attached the pick side effects (remembering the isolation, syncing the picker's PR
attachment) as listeners in its own useEffect, which runs after a child item's mount effect. A
mount-time setIsolation("worktree") switched the screen but was not saved, and setBaseRef skipped
the attachment sync. The effects are now injected when the setup model is built, so a command and
a pick run the same code from the first render. Closing the picker stays in the picker's handler.
* fix(plugins): a Combobox shows a failed refresh instead of the old results
The query keeps its cached data when a reopened list fails to refresh, so the old items stayed
selectable and the error never showed. A failed search now clears the list so its error shows.
The migration guide maps addNewWorkspaceItem, which its registration-coverage test requires, and
the superseded-search test waits on a later search instead of sleeping.
* fix(plugins): a branch and metadata chosen for one project are not sent for another
The setup model outlives the project and host it was chosen for, so an issue picked for project A
was sent on workspace.create after the user switched to project B. The model now drops the branch
and metadata when the project changes (project ids are host-scoped, so a host switch counts). A
project that is still resolving is not a switch. The base selection is left alone: the built-in
picker keeps a branch pick across a project switch, and that behavior is unchanged.
* test(plugins): the project-switch spec expects the other project's metadata to be empty
* fix(plugins): a host switch drops the branch and metadata even when the project id repeats
A remote repository keeps the same project id on every host, so comparing the project id alone
missed a switch from host A to host B for the same repository. The target is now the host and the
project id together.
* fix(server): a branch the caller named is not renamed from the first agent context
The daemon marked every new branch-off worktree for automatic naming, recording the chosen branch
as the placeholder, so the first agent's prompt could rename a branch a plugin or client had
named through branchName. Only a branch the daemon derived from the worktree slug is a
placeholder now.
* fix(plugins): New workspace items remount when the project or host changes
An item stayed mounted across a project switch, and its Combobox kept the previous project's
results (same query key, cached data) selectable until the next search returned, so an issue from
the old project could set the branch and metadata on the new one. A Combobox cannot detect that
its inline search now means another project, so the item host keys the items by host and project
id. Items and their search results start fresh for the new target, and a mount effect sets up
again after the model clears the branch and metadata.
* docs(plugins): a layout-effect command on mount also races the reset on a project switch
* fix(plugins): a New workspace item's commands stop working once its project or host is left
Every item received the same command functions, which act on the current screen state. A lookup
that finished after the user switched projects could still call setBranch or setMetadata and
overwrite the new project's choices; the reset on a switch only clears what was already written.
The setup model now hands out commands per target with commandsFor({ serverId, projectId }).
They reject with a "moved to another project or host" error when the screen is on another target,
like the lock rejects, so the promise only resolves when the change took effect.
* feat(plugins): reach a running agent's composer by reference
useComposers(selector) in any plugin component and composers(selector) on every command context return the composer of a running agent, named by id or by focus, whether or not its tab is open.
A running agent now has one store-backed composer model apart from any mounted tab. The mounted composer plugs its cursor-aware insert in while mounted; otherwise insertText and setPrompt write the agent's saved prompt. model and thinking resolve through the provider catalog with the picker's own function, so a read equals what the picker shows.
The host reads one ComposerModel from context and no longer knows whether it is in an agent, a draft or New workspace. The daemon rejects an unlisted model or thinking option for a running agent, replacing the app-side guard.
* fix(plugins): composers by reference follow the focused agent and reach retained composers
- `{ focused: true }` is the agent Command Center hands to agent items, published by its
registration through plugins/focused-agent.ts and empty outside a workspace. The composer source
reads that module instead of the remembered workspace selection, the navigation store and the
layout store, which also removes the require cycles those imports added.
- A composer the app retains in a workspace the user left has no live input. `insertText` and
`setPrompt` now store the text with `replaceDraftText`, which asks the mounted input to show it;
before, the text reached the store but the retained input never displayed it.
- `model` and `thinking` read exactly what the picker resolves before the catalog loads (no
models), then re-resolve when it lands, instead of reading null.
- The daemon validates a thinking option against the model the agent runs: the runtime model when
the provider lists it, else the configured one.
- The composer sources subscribe to query-cache updates only. A query another component creates
during its render is announced as `added`, and a subscriber that updates then made React warn
about updating a component while rendering a different one. A catalog read no longer starts its
load synchronously either.
* test(plugins): a Command Center agent item reaches the composer through the real client state
The command-path test now reads workspace and agent through
createPluginClientStateSource over seeded session stores, so an empty
lookup, which makes the Command Center return before calling the item,
would fail it. Also records at the focused-agent publisher that it
publishes in an effect.
* fix(plugins): a running agent's composer validates and refreshes against the agent's own catalog
setAgentModel and setAgentThinkingOption checked the provider's global catalog,
while the picker reads the catalog of the agent's directory, so a model only
the project lists was rejected. The validation input now carries the directory.
The composer read the catalog once with no observer, so reconnect repair, which
refetches only active queries, never refreshed it and a failed load never
retried. While anything watches, the composer now observes the catalog query.
The shared composer map kept every agent's composer for the session. It is now
dropped when nothing watches it and no composer is mounted.
* fix(plugins): useComposers holds the composer it names, and a composer lives as long as its agent
PluginComposersSource.subscribe watched the stores directly and never the
composer model, so a component using useComposers did not keep the model's
catalog observer alive and reconnect repair skipped it. subscribe now takes the
selector and holds the model it names, following focus.
Dropping a composer when it went idle left a command a plugin had saved calling
a dead model after the tab reopened. A composer is now dropped when its agent
leaves the session and nothing watches it or has one mounted.
* fix(plugins): a composer refreshes a stale catalog on resumed demand, shares its store watches, and is released with its last holder
Watching again, or reading once, after the catalog was invalidated or failed
while nothing watched now starts one deduplicated refresh; the observer
refetches on mount. Reconnect repair only refetches watched queries, so an
unwatched catalog stayed stale.
Each subscribe installed its own session and draft store callbacks, so N
watchers received N squared notifications, including for other agents' drafts.
One pair of subscriptions now serves all listeners, and the draft callback
ignores drafts of other agents.
A composer whose agent was removed while it was held was only released on the
next session change. The last holder letting go now checks too, and an archived
agent's idle composer is releasable.
* test(server): live model and thinking switches use values the provider lists
The daemon rejects a model or thinking option its provider does not list, so the live-preferences
e2e can no longer switch to a made-up id. A provider that lists nothing to switch to skips the case.
* test(server): the test providers list two models with thinking options, and the live switches run
The fake providers listed one model and no thinking options, so once the daemon validated
selections against the catalog the live model and thinking switches had nothing valid to switch to
and skipped. Every fake provider now lists two models with thinking options, and the switches run
for all three providers without depending on installed binaries.
* fix(plugins): a retained composer that is not showing takes plugin writes through the draft
On native a retained composer keeps its input mounted under display none, so the ref alone said
the input was live and a plugin insertText replaced the stale selection instead of appending to
the draft. The input is live only while its retained panel is showing.
* test(plugins): the retained input liveness test runs in real Chromium
* fix(plugins): a model or thinking change, an unreported option key, and a draft model reach the provider unchecked
Paseo no longer checks these in front of the provider. A running agent's model or thinking
change no longer waits for the catalog or checks it, a plugin provider is sent every option
key and refuses what it cannot apply, and a draft setModel keeps the id as the model picker
does.
* fix(plugins): a plugin reporting settings is sent every key of an options patch
* Run option, model, thinking and mode changes in the agent's lifecycle lane
The agent manager owns all sequencing for one agent: applyOptions, setModel,
setThinkingOption and setMode now run in the same lane as open, close, archive,
labels and metadata, so a provider session never sees two of them at once.
Provider-side serialization (the applying chains in the ACP, plugin and OpenCode
sessions, and Claude's apply-over-current-options handling) is deleted.
* Reopen a handleless agent inside its lifecycle lane
A stored agent with no resumable session is now reopened by
AgentManager.createAgentFromRecord, which rereads the record inside the agent's
lane before creating the first session. A metadata or label write queued ahead
is in the record it reads; one queued behind applies to the live agent. The
loader no longer passes a record it read outside the lane. createAgent itself
also runs in the lane, like resume.
* Return the draft's options from AgentClient.listControls
listControls now answers { controls, options } like AgentManager.listDraftControls:
the options a session opened from the draft would run with, with config
defaults merged in and anything the provider resolves natively for the ones
nobody set. ACP fills unset feature selects from the probe session's
currentValue, so a fresh Cursor draft shows the Fast selection the agent opens
with instead of no selection. The legacy features response and the MCP draft
listing already project from the manager's result, so they follow.
* Send a profile's options on every write, empty included
The profile form always sends options. The daemon reads a write without them as
one from an app that predates options and folds featureValues over the stored
ones; a write that carries them, empty included, replaces them. A profile left
with no options is stored without the key, so removing the last one persists.
* Read a remembered Codex fast_mode as its service tier
The create-agent preferences convert the legacy key on read, keyed on the
built-in codex provider id, so the Codex draft shows the Fast selection the user
last used. Tagged COMPAT(featureValues) with the other legacy-option shims.
* Document one option change at a time per agent
The agent manager runs option, model, thinking and mode changes in the agent's
lifecycle lane; providers do no sequencing. The hook deadlock warning now covers
agent.create.before and option writes.
* Flatten the profile fold's base selection and drop an unused import
* Carry the New workspace context through portal hosts and the draft's metadata through retry
* Convert legacy options when resolving a stored agent's effective options
* Keep stored-record reads tolerant of a legacy option the conversion rejects
* Keep plugin attachment items separate from the draft's own
* Hand plugin command inputs to the host as its own copies
945 lines
60 KiB
Markdown
945 lines
60 KiB
Markdown
# Plugins
|
||
|
||
Local plugins contribute daemon RPCs, native app surfaces, workspace panels, Command Center items,
|
||
client slash commands, timeline items, header buttons, composer pills, app themes, composer attachment sources, and settings screens.
|
||
Paseo executes `index.server.ts` in a subprocess and `index.client.tsx` in every connected app.
|
||
|
||
> **Trust every plugin you add.** `paseo plugin add` and `paseo plugin install` mean “I trust this codebase.” Plugins are unsandboxed: server code and preparation commands run with the daemon user's access on the daemon host, and client contributions run inside Paseo. The repository's dependencies and future updates are part of that trust decision. With `--host`, preparation runs on that remote daemon host.
|
||
|
||
## Install a directory source
|
||
|
||
Create a typecheckable plugin project, install its development dependencies, then install it into
|
||
the daemon. `init` only writes the project files; it does not run the package manager.
|
||
|
||
```bash
|
||
paseo plugin init /absolute/path/to/my-plugin
|
||
cd /absolute/path/to/my-plugin
|
||
npm install
|
||
npm run typecheck
|
||
paseo plugin install /absolute/path/to/my-plugin
|
||
paseo plugin install /absolute/path/to/my-plugin --id another-runtime-id
|
||
paseo plugin ls
|
||
```
|
||
|
||
The daemon stores directory sources under the root `plugins` object:
|
||
|
||
```json
|
||
{
|
||
"pluginsEnabled": true,
|
||
"plugins": {
|
||
"my-plugin": {
|
||
"source": "directory",
|
||
"path": "/absolute/path/to/my-plugin",
|
||
"enabled": true
|
||
}
|
||
}
|
||
}
|
||
```
|
||
|
||
Installed plugins are disabled unless `pluginsEnabled` is `true`. Built-in plugins remain active.
|
||
Changing that root field is
|
||
runtime-safe: run `paseo reload` after editing `config.json`. Enabling starts every configured,
|
||
enabled plugin; disabling tears them all down without restarting the daemon. Plugin source entries
|
||
remain lifecycle-owned and do not reload from manual config edits.
|
||
|
||
The directory contains a manifest declaring identity and Paseo requirements, one optional entry per runtime, runtime-owned
|
||
directories, and local typechecking support. At least one entry is required.
|
||
|
||
```text
|
||
my-plugin/
|
||
paseo-plugin.json
|
||
package.json
|
||
tsconfig.json
|
||
index.client.tsx
|
||
index.server.ts
|
||
client/greeting.tsx
|
||
server/greeting.ts
|
||
shared/greeting.ts
|
||
```
|
||
|
||
The generated `package.json` installs `@getpaseo/plugin` and the other host modules as development
|
||
dependencies for local typechecking and tests. Paseo compiles TypeScript and TSX and supplies the
|
||
runtime modules, so consumers do not install these packages when adding the plugin.
|
||
|
||
```json
|
||
{
|
||
"id": "my-plugin",
|
||
"requirements": { "paseo": ">=0.8.0" }
|
||
}
|
||
```
|
||
|
||
Declare the supported Paseo range and keep it current when adopting newer APIs. See the
|
||
[requirements contract](../public-docs/plugins/reference.md#requirements), including legacy
|
||
manifests and prerelease matching.
|
||
|
||
The config key is the runtime plugin ID. The manifest ID is the default selected during install;
|
||
`--id` overrides it. Existing configuration is not renamed when the manifest changes, and the
|
||
runtime does not compare the two IDs. The same directory can be installed under several config
|
||
keys.
|
||
|
||
Never enable plugins on a user's behalf without explicit permission. Before asking, check the
|
||
target daemon's current `pluginsEnabled` value. State that plugins are trusted, unsandboxed code:
|
||
backend code can access the daemon machine, while client contributions run inside the Paseo app.
|
||
|
||
Source changes are explicit. Run `paseo plugin reload <id>` to stop and fully tear down the old
|
||
plugin before compiling and starting from disk. A failed reload stays failed; Paseo does not restore
|
||
the old code. Use `enable`, `disable`, and `remove` to manage one plugin. Removing a directory source
|
||
never deletes it. The global `pluginsEnabled` switch remains available.
|
||
|
||
## Client translations
|
||
|
||
Plugin runtime translations follow the connected app, so never send a daemon locale through RPCs or add plugin resources to the app catalog. The installation owns the translation engine; native portal bridges must carry it alongside RPC and client-state contexts. Keep host label resolution at presentation time so language changes preserve the installation lifetime.
|
||
|
||
The author contract is in [runtime translations](../public-docs/plugins/reference.md#runtime-translations).
|
||
|
||
## Built-in plugins
|
||
|
||
Built-in plugins ship from `plugins/<id>/`, with `paseo-plugin.json`, `index.server.ts`,
|
||
`server/`, and optional client entry and icon. Add the plugin ID to `builtinPlugins` in
|
||
`packages/server/src/server/plugins/builtin/index.ts`; the workspace, build copy, and CI
|
||
checks cover that registry. Unlisted directories do not load.
|
||
|
||
The `worktree-include` built-in copies gitignored files selected by
|
||
[`.worktreeinclude`](../public-docs/worktrees.md#copy-local-files-with-worktreeinclude)
|
||
before setup and agents, through `worktree.create.after`.
|
||
|
||
Desktop packaging ships the entire built-in plugin directory as an external resource,
|
||
including declarations. The external esbuild compiler cannot read Electron's `app.asar`
|
||
filesystem, and packaging dependencies excludes `.d.ts` files needed for import validation.
|
||
Built-ins can import only host modules (`@getpaseo/plugin/*`, `zod`) and Node built-ins:
|
||
outside the archive, nothing resolves an npm dependency, and the dist build test cannot catch
|
||
one because it resolves through the repository's `node_modules`.
|
||
The packaged-app smoke check requires every listed built-in to start without relying on
|
||
account credentials.
|
||
|
||
Built-ins run in process and remain active independently of `pluginsEnabled`. They are
|
||
absent from the installed plugin list and source configuration; their client bundles
|
||
appear in the plugin catalog. Editing one in development requires a daemon restart.
|
||
Directory, Git, and npm installs cannot use a built-in ID.
|
||
|
||
A provider registration with `requiresConfiguration: true` participates only while its ID exists
|
||
under `agents.providers`. Hoplite uses this for catalog opt-in. Add writes `{ "enabled": true }`
|
||
without `extends`, so it selects the bundled adapter. Remove deletes the config entry; setting
|
||
`enabled: false` keeps the entry. The bundled JavaScript still loads at startup, but an absent
|
||
provider does not enter executable resolution or catalog discovery.
|
||
|
||
Provider plugins use separate installation and provider IDs. `muse-provider` registers the
|
||
selectable `muse` provider (Muse Code) and a usage source. Its `status({ launch })` reports
|
||
availability and a diagnostic after the daemon resolves the executable. Configure command,
|
||
environment, or enablement overrides under `agents.providers.muse`. Omit `extends` to keep
|
||
the bundled integration; an entry with `extends` shadows it with a custom provider. See
|
||
[provider contributions](#contribute-a-provider) for the contract and
|
||
[Muse Code](../public-docs/muse-code.md) for setup, per-agent options, and version limitations.
|
||
|
||
## Install from a registry
|
||
|
||
`paseo plugin add owner/slug` installs the registry's reviewed artifact by default.
|
||
Browse published plugins at [paseo.sh/plugins](https://paseo.sh/plugins).
|
||
Use `git:owner/repository` or a full Git URL for a Git source. Registry installs
|
||
keep the registry URL and ID, so update checks use its approved pin. Explicit version/ref
|
||
selection is unavailable for registry installs; install an explicit source to select your own.
|
||
|
||
Registry overviews are untrusted author content, even before installation. Render them with
|
||
`@getpaseo/protocol/plugin-overview`: no raw HTML, HTTPS-only links and images, no relative
|
||
URLs, and isolated external links. The website adapter and corpus tests live in
|
||
`packages/website/src/plugins/overview.tsx` and `overview.test.tsx`; the reusable corpus is
|
||
`packages/protocol/tests/fixtures/plugin-overview.json`. A future app overview must share
|
||
this policy. Installed-plugin descriptions in the app remain plain text.
|
||
|
||
Use `host/owner/slug` for a registry at `https://host`, or set
|
||
`PASEO_PLUGIN_REGISTRY` to change the default base (including a path prefix).
|
||
Private registry credentials live in daemon config under
|
||
`pluginRegistries: { "host": { "authorization": "Bearer token" } }`.
|
||
Restart your daemon after changing these startup settings. Credentials go only to the registry,
|
||
never artifact hosts or redirects. Git/npm use their own host authentication.
|
||
|
||
The [open registry protocol](https://github.com/getpaseo/plugins/blob/main/PROTOCOL.md)
|
||
owns static hosting, record shapes, pins, and advisory install counts.
|
||
|
||
## Install a Git source
|
||
|
||
GitHub repositories use `git:owner/repository` or `github:owner/repository`. Other hosts use a Git
|
||
URL.
|
||
|
||
```bash
|
||
paseo plugin install git:owner/repository
|
||
paseo plugin install https://gitlab.com/group/repository.git
|
||
paseo plugin install git:owner/monorepo:plugins/review
|
||
paseo plugin install github:owner/repository --ref main
|
||
```
|
||
|
||
Append `:relative/path` for a plugin below the repository root. `--ref` chooses the initial
|
||
branch, tag, or commit once. Updates of explicit Git sources resolve the remote's default HEAD
|
||
and ask for approval. `ls` reports the installed commit without contacting the remote.
|
||
|
||
## Managed source ownership
|
||
|
||
The [public source reference](../public-docs/plugins/reference.md#plugin-sources) owns identifier
|
||
syntax and npm prerequisites; the [publishing guide](../public-docs/plugins/publishing.md) owns distribution. The CLI resolves directory sources before
|
||
calling `installPluginSource`; see the public source reference for CLI and app path semantics.
|
||
Only the daemon reads plugin files and acquires sources.
|
||
|
||
`ManagedPluginSources` owns acquisition and offline source description. Config stores the active
|
||
directory; sources.json stores managed kind and the Git acquisition remote. The remote is needed
|
||
because authenticated clones may have a rewritten placeholder origin. Fixed owned directory layout
|
||
provides the selected subdirectory, npm package name and cleanup root. Git HEAD and the installed
|
||
npm package.json checked against package-lock.json provide the current revision. Keep the complete
|
||
npm dependency tree and lockfile after staging activation. No install selector governs updates.
|
||
|
||
The loader sees only the configured directory and never invokes npm. npm lifecycle scripts are
|
||
disabled during acquisition; manifest preparation owns required commands before validation.
|
||
|
||
List responses retain the closed `source: directory | git` enum. The optional `installation`
|
||
projection carries identity and current revision. Old npm metadata remains accepted but is no longer
|
||
emitted. Installation uses `features.pluginSourceInstallation`; reviewed preview/apply uses
|
||
`features.pluginSourceUpdates`, gated by the SDK and CLI entry. The old immediate-update request
|
||
returns update-client guidance. Basic management remains independently available.
|
||
|
||
Preview returns exact targets and expected installed identity/root/revision. Apply validates those
|
||
values, acquires the displayed artifact or commit, then rechecks state before activation. No review
|
||
session is stored in the daemon. PluginService owns activation/recovery and independent bulk results.
|
||
|
||
### Declare Git preparation
|
||
|
||
Most plugins should omit `build`. Use it only when the staged checkout must install a dependency
|
||
that Paseo does not provide, generate source or assets, or perform another required preparation
|
||
step:
|
||
|
||
```json
|
||
{
|
||
"id": "review",
|
||
"requirements": { "paseo": ">=0.8.0" },
|
||
"build": [
|
||
["npm", "ci"],
|
||
["npm", "run", "build"]
|
||
]
|
||
}
|
||
```
|
||
|
||
`build` is an optional list of argv arrays. Each array must contain at least one non-empty string;
|
||
shell command strings are rejected. Paseo starts the executable directly, without a shell, from the
|
||
plugin directory in the staged checkout. It never detects lockfiles or chooses a package manager.
|
||
|
||
On install and every update, Paseo resolves the exact Git revision and manifest, runs the declared
|
||
commands, then validates, compiles, and activates the candidate. It logs each argv command and its
|
||
output in the daemon log. If a command fails, the error includes its output, Paseo discards the
|
||
candidate, and the existing installed and running version stays untouched. On a remote daemon, all
|
||
of this happens on the remote daemon host.
|
||
|
||
Server contributions can write to stdout and stderr with normal Node logging. Paseo adds `[paseo]`
|
||
entries for loading, ready, stopping, and stopped transitions. Compilation and load failures are
|
||
recorded as stderr entries before a subprocess exists. Inspect the recent in-memory
|
||
tail from the host plugin settings or with `paseo plugin logs <id>`. Git preparation commands are
|
||
recorded in `$PASEO_HOME/daemon.log` before a plugin exists, rather than the plugin log tail. Reload, disable, and process
|
||
failure retain the tail; removing the plugin clears it. Daemon restarts do not retain the tail, but
|
||
structured copies remain in `$PASEO_HOME/daemon.log`. Plugin output can contain secrets, so do not
|
||
log credentials or tokens.
|
||
|
||
## Contribute behavior and UI
|
||
|
||
Default export one contribution function from each runtime entry. Keep the entries to registration
|
||
wiring. Runtime code lives behind directory boundaries:
|
||
|
||
| Path | Owns |
|
||
| -------------------------------- | -------------------------------------------------------------------- |
|
||
| `index.client.tsx` and `client/` | React, React Native, hooks, styles, surfaces, panels, and callbacks. |
|
||
| `index.server.ts` and `server/` | Node APIs, filesystem and process access, credentials, and handlers. |
|
||
| `shared/` | Zod RPC contracts and plain values used by both runtimes. |
|
||
|
||
Do not put any other code modules in the plugin root.
|
||
|
||
Shared files import contract helpers and types from `@getpaseo/plugin`. Server handler files import
|
||
`PluginHandlerContext` from `@getpaseo/plugin/server`. Client files import Paseo UI from
|
||
`@getpaseo/plugin/client/ui`. Its `Icon` draws a Lucide name from the client's installed
|
||
icon set, or any `PluginIcon` through its `icon` prop; an unknown name or unsafe SVG renders nothing
|
||
so it cannot break the plugin surface.
|
||
Its controlled modal keeps presentation metadata on `<Modal title="…" icon={…}>` and body UI in
|
||
`<Modal.Content>`. Body layout, sheet-aware scrolling, and clipboard actions follow the
|
||
[host UI contract](../public-docs/plugins/reference.md#host-ui).
|
||
Plugin UI runs on desktop and mobile across multiple themes: color every `Text` from
|
||
`theme.colors.foreground` or `theme.colors.foregroundMuted`, and size layout from `layout.compact`.
|
||
See `public-docs/plugins/reference.md`.
|
||
|
||
### SDK import boundaries
|
||
|
||
Classify every SDK export before adding it. All client entry points and implementations live under
|
||
`client/`; all server entry points and implementations live under `server/`. The package root is shared code: plain data types,
|
||
Zod schemas, and functions that run in both runtimes. A type-only import is still an architectural
|
||
dependency; shared types must not refer to React components, hooks, Node APIs, or server contexts.
|
||
|
||
| Entry | Owns | May depend on |
|
||
| ------------------------------------------------- | -------------------------------------------------------------------------- | ---------------------- |
|
||
| `@getpaseo/plugin` | Shared data, schemas, RPC/settings definitions, runtime-neutral helpers | Shared code only |
|
||
| `@getpaseo/plugin/server` | Server contexts, lifecycle contracts, and CLI process launch | Shared and server code |
|
||
| `@getpaseo/plugin/server/provider`, `/server/acp` | Server provider contracts and adapters | Shared and server code |
|
||
| `@getpaseo/plugin/client` | Client contribution contexts, hooks, navigation, and UI contribution types | Shared and client code |
|
||
| `@getpaseo/plugin/client/ui` | Host-provided UI components | Shared and client code |
|
||
| `@getpaseo/plugin/client/host` | App-owned rendering integration; not a plugin-author entry | Shared and client code |
|
||
|
||
Server code imports shared helpers from the root and server capabilities from `/server`. Client
|
||
code imports shared helpers from the root and client capabilities from `/client`. Neither runtime
|
||
imports the other. Re-exports follow the same rule; tree shaking does not establish a boundary.
|
||
React, React Native, JSX runtimes, and client hooks must never be reachable from the root or any
|
||
server entry. Node and platform-specific code must never be reachable from the shared root.
|
||
|
||
The SDK boundary checks and real plugin-subprocess tests enforce these rules. Every SDK change
|
||
must preserve them and update the public reference, migration guide, scaffold, and examples when
|
||
an author-facing import changes. The plugin compiler enforces the same runtime entry rules for
|
||
plugin-authored code. Keep the package export map and host-provided module maps consistent.
|
||
|
||
The compiler rejects imports across runtime directories or SDK entries, React dependencies in
|
||
server code, and Node imports in client code (including bare names such as `fs`). Shared modules
|
||
cannot import runtime-owned modules. Forbidden imports fail compilation; never replace them with
|
||
empty module stubs. A relative
|
||
import to any other code file in the plugin root is also rejected; move it into `client/`, `server/`,
|
||
or `shared/`. These are compile errors naming the importing file and boundary rule. Top-level React
|
||
Native calls such as `StyleSheet.create` belong in `client/`.
|
||
|
||
The scaffold omits `"DOM"` from `tsconfig.json` and does not use `/// <reference lib="dom" />`, so
|
||
browser globals are not available across the plugin. Put sanctioned web-only APIs in
|
||
`client/web.ts`, declare only the globals that module uses, gate each export with
|
||
`Platform.OS === "web"`, and provide a native implementation or no-op. See the
|
||
[public plugin reference](../public-docs/plugins/reference.md#works-on-mobile) for the complete
|
||
pattern.
|
||
|
||
```ts
|
||
// index.server.ts
|
||
import type { PluginServerContext } from "@getpaseo/plugin/server";
|
||
import { createGreeting } from "./server/greeting";
|
||
import { greetRpc } from "./shared/greeting";
|
||
|
||
export default function contribute(server: PluginServerContext) {
|
||
server.handle(greetRpc, createGreeting);
|
||
return () => {};
|
||
}
|
||
```
|
||
|
||
```tsx
|
||
// index.client.tsx
|
||
import type { PluginClientContext, PluginSidebarItemProps } from "@getpaseo/plugin/client";
|
||
import { SidebarRow } from "@getpaseo/plugin/client/ui";
|
||
import { Greeting } from "./client/greeting";
|
||
|
||
function GreetingItem({ currentScreen, openScreen }: PluginSidebarItemProps) {
|
||
return (
|
||
<SidebarRow
|
||
icon="MessageCircle"
|
||
active={currentScreen?.screenId === "main"}
|
||
onPress={() => openScreen({ screenId: "main" })}
|
||
/>
|
||
);
|
||
}
|
||
|
||
export default function contribute(client: PluginClientContext) {
|
||
client.addScreen({ id: "main", title: "Greeting", Component: Greeting });
|
||
client.addSidebarHeaderItem({ id: "main", title: "Greeting", Component: GreetingItem });
|
||
return () => {};
|
||
}
|
||
```
|
||
|
||
The contribution function must return cleanup for resources created by plugin code. Server cleanup
|
||
may be async; Paseo waits for it when stopping the server plugin. Cleanup errors are logged and do
|
||
not interrupt host teardown. Client installation retention and disposal follow the public
|
||
[hosts and lifecycle contract](../public-docs/plugins/reference.md#hosts-and-lifecycle).
|
||
|
||
Paseo owns the route, screen header, icon validation, close action, theme DTO, layout facts,
|
||
and render error boundary. The contributed component owns the complete body below the header.
|
||
The plugin owns the header's text through the screen's `title` (`resolvePluginScreenTitle` in
|
||
`plugins/surface-contribution.ts`). A legacy `addSidebarItem` route (`/sidebar/<id>`) shows the
|
||
item's title and icon instead, as before screens had titles; the `addSurface` alias titles its
|
||
screen with the id. A `/sidebar/<id>` route with no legacy item of that id opens the screen with
|
||
that id, so links saved before a plugin migrated keep working.
|
||
|
||
Screen params ride in the screen route's query string (`plugins/routes.ts`), not in app state, so
|
||
reload, history, links, and the host switcher keep them without a store. Expo Router merges the
|
||
route's segments (`serverId`, `pluginId`, ...) into the same search params as the query, so param
|
||
keys are stored under a `param.` prefix; plugins never see it and may use any key.
|
||
`openScreen` validates its input once (`parsePluginOpenScreenInput`); code past it trusts the
|
||
params.
|
||
|
||
RPC and subscription contracts validate inputs, outputs, and events in both the app and plugin
|
||
subprocess. `useRpc` returns a typed async function. Use the host-provided `@tanstack/react-query`
|
||
for request state and caching; Paseo gives each plugin installation its own query client.
|
||
|
||
A subscription is a session-owned observation (`plugin-rpc` delivery family): the session that
|
||
subscribed owns its lifetime, so release, disconnect, plugin stop, and reload need no plugin code.
|
||
Each subscriber gets its own handler call in the subprocess; there is no fan-out or replay. The
|
||
runtime buffers pushes until the session has sent `plugin.rpc.subscribe.response`, so a client
|
||
never sees an event for an unknown subscription. The app installation's lifetime aborts every
|
||
subscription its surfaces left open, and a reload replaces the installation, which resubscribes
|
||
mounted hooks.
|
||
|
||
The byte rule (a top-level `Uint8Array` is binary, a nested one is a validation error) is checked
|
||
once per hop by `assertPluginWireValue`. Bytes ride plugin binary frames, opcodes `0x20`-`0x2f`
|
||
(`packages/protocol/src/binary-frames/plugin.ts`); nothing on the path copies or re-encodes them,
|
||
and `plugin-subscriptions.perf.e2e.test.ts` locks that. Keep it that way: never stringify a plugin
|
||
payload for a log, and the client's bootstrap buffer holds bytes only until the first observer
|
||
attaches. Binary outputs reach only clients that send `pluginBinaryPayloads`. A binary input
|
||
frame (`0x22`) becomes a synthetic `plugin.rpc.invoke.request` and runs through the normal message
|
||
path, so it is authorized like any other invoke. The author contract, including the native upload
|
||
limit, is in [stream events from the daemon](../public-docs/plugins/reference.md#subscriptions).
|
||
|
||
`usePaseo()` and the handler's `{ paseo }` context expose the same `PaseoApi`: projects,
|
||
workspaces, agents, terminals, providers, and daemon config. They do not expose connection lifecycle.
|
||
|
||
`usePaseo()` is the plugin's one client: `InstalledPlugin.paseo`, created with the installation in
|
||
`packages/app/src/plugins/registry.ts` over the host's existing connection and passed to setup as
|
||
`client.paseo`. Authors release their subscriptions in their own cleanup, and teardown (disable,
|
||
reload, removal, host removal) disposes the client, which ends the rest; nothing is created or
|
||
disposed per mounted surface. See the
|
||
[public example](../public-docs/plugins/reference.md#use-the-paseo-sdk). Switching the screen's host
|
||
changes both `usePaseo()` and `useRpc()` to that host's installation. An offline selected host fails there and never falls through to another
|
||
installation. A server handler owns an IPC-backed daemon session for the life of its subprocess.
|
||
Use plugin RPC for plugin-specific backend behavior that is not a normal Paseo operation.
|
||
|
||
Host-targeted clients and discovery are owned by `packages/app/src/plugins/hosts`, with per-installation
|
||
bindings supplied by the bundle loader. Bind the imperative getter to that installation; do not
|
||
resolve ownership through a mutable current-plugin global. Keep observation ownership in this module
|
||
and transport ownership in the app host runtime. See the [public host API contract](../public-docs/plugins/reference.md#discover-hosts-and-target-another-host).
|
||
|
||
Each subprocess gets an exclusively owned `plugin:<id>` session. That identity is reserved from
|
||
normal clients, never resumes another session, and is cleaned immediately on exit without reconnect
|
||
grace. During daemon startup, plugin sessions may connect while application WebSockets remain
|
||
paused; the daemon accepts clients only after configured plugins have settled and the initial
|
||
catalog is complete.
|
||
|
||
The app retains client bundles per host in its file cache (IndexedDB on web), keyed by plugin ID
|
||
and the daemon's SHA-256. A cold client verifies stored contents before advertising their hashes;
|
||
missing or corrupt files request full bundles. Only the latest catalog's bundles remain. Hashing
|
||
uses Expo's native async digest on mobile, avoiding a JavaScript hash loop on Hermes; reading and
|
||
passing the bundle string still costs memory and time once per client lifetime.
|
||
Persistence runs after catalog reconstruction without delaying installation. One write runs at a
|
||
time; while storage is busy, only the newest pending catalog is kept. A failed write leaves the
|
||
in-memory bundles usable, and a later catalog retries persistence.
|
||
|
||
When the same plugin contribution exists on multiple hosts, Paseo shows it once in the sidebar and
|
||
adds a host picker to the screen header. The selected host supplies the bundle, RPC transport, and
|
||
query cache. Explicit SDK targets follow the [host API contract](../public-docs/plugins/reference.md#discover-hosts-and-target-another-host).
|
||
|
||
Workspace panels, Command Center items, and client slash commands are client contributions. The
|
||
daemon transports their compiled bundle without interpreting placement or callbacks. Panel props
|
||
contain workspace and agent IDs. Required-selector hooks read normalized client state synchronously
|
||
and use shallow equality, so a panel does not subscribe to fields it does not render. Command
|
||
callbacks materialize their snapshots only when invoked. Contribution discovery and panel opening
|
||
never fetch active context through plugin RPC. Snapshot DTOs are deeply readonly and frozen at
|
||
runtime so plugin code cannot mutate normalized app state or a memoized selection. Panels use one persisted
|
||
`plugin` workspace-tab target, so reload, disable, removal, and restoration resolve through the
|
||
current installed-plugin catalog. A missing contribution renders unavailable inside the tab.
|
||
Panels declare `locations: ["workspace", "explorer"]` to opt into Explorer hosting; omission means
|
||
workspace only. Location controls hosting, not context. An agent panel target keeps its `agentId`
|
||
when moved between hosts. Explorer configuration can create workspace-context panels and remove
|
||
existing agent-context instances, but it cannot create an agent panel without an agent-aware command.
|
||
|
||
Command Center callbacks use the selected host's existing `PaseoApi` for normal Paseo operations.
|
||
They use typed plugin RPC only for plugin-specific backend work. Surface and panel navigation
|
||
belongs to the app; plugins do not receive Expo Router or workspace-layout store access.
|
||
See the public [navigation fields](../public-docs/plugins/reference.md#screens-and-sidebar-items)
|
||
and [external links and workspace browsers](../public-docs/plugins/reference.md#external-links-and-workspace-browsers)
|
||
for the author-facing contract.
|
||
|
||
### Plugin icons
|
||
|
||
The [public reference](../public-docs/plugins/reference.md#icons) owns the author API: a contribution
|
||
`icon` is a Lucide name, `{ svg }`, or a component.
|
||
|
||
- `findSvgIconProblem` in the SDK root (`packages/plugin/src/icons.ts`) is the only SVG rule set.
|
||
The daemon applies it to provider and usage-source icon files; the app applies it to inline
|
||
icons. Change the rules there, never at a call site.
|
||
- The app validates each icon once, at registration, through `parsePluginIcon` in
|
||
`packages/app/src/plugins/icons.ts`. Rendering trusts the stored icon.
|
||
- That module is the only code that branches on the icon form. Surfaces draw with
|
||
`PluginIconView`, or take a stable component from `pluginIconComponent` when their slot expects
|
||
one. Lucide and SVG icons receive only size and color, so the host props a button passes to its
|
||
component icon never reach an SVG element.
|
||
- Attachment sources take `PluginSerializableIcon`: composer drafts persist the source's icon with
|
||
each attachment, and a component cannot be stored.
|
||
- The plugin compiler loads `.svg` imports as text, so `import icon from "./client/icon.svg"` is the
|
||
markup string.
|
||
|
||
## Lifecycle hooks
|
||
|
||
Server entries register async handlers with `server.addHook(name, handler)`, returning a cleanup
|
||
function. Names follow `subject.operation.position`, ending in `before` or `after`. Waiting is a per-hook
|
||
registry property, independent of position. The [hooks reference](../public-docs/plugins/hooks.md)
|
||
owns payloads, ordering, failure behavior, and examples. `agent.create.before` edits saved
|
||
configuration; `agent.open.before` contributes launch-only `env`, `tools`, and `mcpServers` on
|
||
every open. Executable tool definitions stay in the plugin process; only metadata crosses the boundary.
|
||
|
||
Worktree placement is resolved before Git source planning, so a hook can change the branch and base
|
||
without undoing fetched refs. Restores use the recorded destination and bypass creation hooks.
|
||
Workspace records decide ownership, including explicit non-ownership after recovery. Without a record,
|
||
ownership checks prefer the marker-verified worktree root over the legacy
|
||
path shape: a plugin can place a worktree several directories below the default worktrees root.
|
||
|
||
Emit from the operation owner, not a client subscription. Provider history replay must not trigger
|
||
live hooks. Notifications must not be awaited inside agent mutations: a handler can send a prompt
|
||
or answer a permission through its own daemon session. Awaiting it there deadlocks that command.
|
||
The same holds for a hook that runs inside an agent's lifecycle lane: an `agent.open.before` or
|
||
`agent.create.before` hook that awaits a write to the agent being opened (`setMetadata`, `setLabels`,
|
||
an option, model, thinking or mode change) waits on the open, which waits on the hook. The hooks
|
||
reference tells plugin authors to start such a write without awaiting it.
|
||
|
||
## Contribute a provider
|
||
|
||
Register a provider from `index.server.ts`. The provider connection is callback-based and owns all
|
||
of its sessions; plugin RPC is not part of the provider data path.
|
||
|
||
```ts
|
||
import type { PluginServerContext } from "@getpaseo/plugin/server";
|
||
import type { ProviderRegistration } from "@getpaseo/plugin/server/provider";
|
||
import { createProvider } from "./server/provider";
|
||
|
||
export default function contribute(server: PluginServerContext) {
|
||
server.registerProvider(createProvider() satisfies ProviderRegistration);
|
||
return () => {};
|
||
}
|
||
```
|
||
|
||
Declare `command: ["agent", "serve"]` when your provider launches an executable. The daemon applies
|
||
`agents.providers.<id>.command` and `env`, resolves the executable against the effective PATH, and
|
||
removes parent-session and daemon-control environment variables. `connect({ launch })` receives
|
||
`{ command, args, env }`: an executable path, effective arguments, and the complete sanitized
|
||
environment. Spawn with those values; do not merge the plugin process's environment back in.
|
||
The launch travels as data through the same provider protocol for built-in and subprocess plugins.
|
||
Without a declared command, existing providers keep their connection behavior and receive no launch.
|
||
|
||
Implement optional `status({ launch })` to check credentials, versions, or other prerequisites using
|
||
that effective launch. Return `{ available: true }` or
|
||
`{ available: false, diagnostic: "Run agent login" }`. The daemon checks executable availability
|
||
before calling status; it exposes your diagnostic through the normal provider diagnostic command.
|
||
A command-backed provider without status is available when its executable resolves. Providers with
|
||
neither command nor status retain connection-based availability.
|
||
|
||
A same-ID config entry without `extends` overrides the plugin's `enabled`, `command`, `env`, label,
|
||
description, and model configuration through the normal provider registry. `enabled: false` disables
|
||
selection and discovery. An entry with `extends` defines the user's own provider, shadows the plugin,
|
||
and logs a warning. Overrides validate before plugins load; an override for an absent plugin stays
|
||
inactive and logs a warning naming the unmatched ID after built-in and configured plugin startup
|
||
settles (including disabled plugins), then on each installed registry generation.
|
||
Use IDs matching `/^[a-z][a-z0-9-]*$/` for configurable providers. Dots and underscores
|
||
remain valid for plugin registration but cannot be used as config provider IDs.
|
||
|
||
Provider config changes rebuild the affected registry entry and invalidate its catalogue; the next
|
||
connection receives the new launch without restarting the daemon. Running sessions keep their
|
||
current launch until refreshed, as native providers do.
|
||
|
||
Implement optional `ProviderRegistration.getCatalogCacheKey(options)` to share equivalent catalogue
|
||
probes. The callback runs in the plugin process before discovery and receives the actual global or
|
||
workspace target plus the resolved `launch` when a command is declared. Return a key covering
|
||
effective configuration and execution environment, or
|
||
`undefined` for target-specific caching. Ignore `force` when choosing identity. Existing providers
|
||
need no change. See [catalogue ownership](providers.md#provider-snapshot-refresh-contract).
|
||
|
||
`send()` resolves after acceptance. Publish operation completion, prompt disposition, turn state,
|
||
configuration, permissions, persistence, and complete timeline snapshots through `onEvent()`.
|
||
Route messages, structured commands, steering, and command side effects through `session.prompt`.
|
||
A provider's configuration is the opaque `ProviderSessionConfig.providerOptions` object on
|
||
`session.open`. It contains the provider defaults and per-agent overrides merged by the daemon.
|
||
Validate and apply it inside the provider; core does not know your option shape.
|
||
See [provider options](custom-providers.md#provider-options) for configuration and
|
||
merge semantics.
|
||
|
||
The provider draws some of those keys in the composer by reporting `controls` and the values it runs
|
||
(`providerOptions`) in `session.config`. A running-agent change arrives as
|
||
`session.configure` with `changes.providerOptions` and follows the same apply-or-throw contract as
|
||
built-in providers ([options flow](providers.md#options-flow)). `PluginAgentSession` in
|
||
`packages/server/src/server/agent/plugin-provider.ts` is that adapter. A provider still reporting
|
||
`settings` is read through `plugin-provider-options.ts`, which turns each setting into a control and
|
||
its value into an option and is sent both shapes in `session.configure`; delete it with
|
||
`COMPAT(plugin-provider-settings)`. The ACP shim still reports `settings`.
|
||
|
||
Providers add an optional veto to daemon baseline cleanup through the per-session
|
||
[runtime safety query](../public-docs/plugins/providers.md#permit-idle-runtime-cleanup).
|
||
The daemon calls the same `AgentSession.canStopRuntime()` interface for built-ins and plugins;
|
||
the plugin bridge transports that query through the existing provider request/event protocol.
|
||
|
||
Agent refresh closes the current provider session and opens it again with current configuration and
|
||
persistence. Re-read credentials and provider-owned configuration on `session.open`; consume the
|
||
daemon launch from `connect` and the per-session env and MCP servers from `session.open`. There is
|
||
no provider reload input.
|
||
|
||
For an ACP command, register `runAcpProvider({ id, label, command })` from
|
||
`@getpaseo/plugin/server/acp`. Its transformer hooks cover narrow vendor differences; do not translate the
|
||
whole provider event stream. The shim uses the resolved launch for every probe and session, overlaying
|
||
only the supplied per-session env for sessions. The direct and ACP examples live in
|
||
`plugin-examples/provider-direct`
|
||
and `plugin-examples/provider-acp-transformer`.
|
||
|
||
Provider-emitted plugin timeline items use the same renderer registration as transformed and
|
||
daemon-appended plugin items. The direct example includes both sides. The renderer-only
|
||
`plugin-examples/inline-thinking` example shows that timeline presentation remains independent of a
|
||
provider implementation. The public [provider plugin guide](../public-docs/plugins/providers.md)
|
||
owns author workflow, lifecycle, testing, and distribution guidance.
|
||
|
||
`ProviderRegistration.icon` is a file path relative to the plugin directory, such as `icon.svg`.
|
||
It must resolve inside that directory to a regular file that passes the shared SVG icon rules
|
||
(see [Plugin icons](#plugin-icons)). Paseo reads and validates the file when the plugin starts; the
|
||
string is never inline SVG or a URL.
|
||
|
||
## Usage sources
|
||
|
||
Register a usage source from `index.server.ts` with `server.registerUsageSource()`. Import `UsageSourceRegistration` and normalization helpers from `@getpaseo/plugin/server/usage`. The plugin owns account discovery, harness labels, and credential-store reads; the daemon owns account grouping and the fetch cache. Agent popovers use only the agent's own login. The host-wide Usage modal falls back across an account's logins; any success shows usage only, and all failures show every login's labeled error and remedy. Follow the [usage source discovery contract](../public-docs/plugins/reference.md#usage-sources). The resolved launch environment crosses into the trusted, unsandboxed plugin subprocess for session discovery. Usage queries never run lifecycle hooks. Inputs are validated in the plugin process and remain daemon-side. `icon` uses the same SVG file rules as provider icons.
|
||
|
||
When the host’s **Check usage** switch is off, the daemon rejects usage requests before discovery, without reading logins or calling vendors. Otherwise, the daemon calls discovery for `usage.list_reports`; the client gates this RPC on `server_info.features.usageSources`. The old `provider.usage.list` RPC maps discovered reports for older clients.
|
||
|
||
## Replace sidebar content
|
||
|
||
The sidebar view slot is global across hosts, while header and footer contributions retain their
|
||
host selection. The slot owns selection loading, fallback and the error boundary; the plugin owns
|
||
its layout. This keeps plugin failures from removing navigation or recovery controls. The
|
||
[sidebar view guide](../public-docs/plugins/sidebar-views.md) owns the author API.
|
||
|
||
## Contribute sidebar items
|
||
|
||
Sidebar header and footer items are plugin components, not descriptors. The
|
||
[public reference](../public-docs/plugins/reference.md#sidebar-items) owns the author API. The host
|
||
lives in `packages/app/src/plugins/sidebar-items/`; `packages/app/src/sidebar-nav/model.ts` resolves
|
||
one section's order from built-ins, plugin groups, and the section's preference
|
||
(`sidebarNavItems` or `sidebarFooterItems`).
|
||
|
||
- The item's `Component` renders directly in the section, with no wrapper, so a fragment or array
|
||
of rows lays out like separate items while Settings keeps one entry for the block. Footer items
|
||
are rows between Add project and the footer's icon row. The icon row (Hosts,
|
||
Help and support, Settings) is fixed app code, not a contribution slot, so the kit has no icon
|
||
button.
|
||
- `openPopover` opens through the same `PluginPopoverSurface` as header buttons
|
||
(`plugins/popover.tsx`). Any press inside a `SidebarRow`, including its `trailing` content, moves
|
||
the menu anchor to that row: a capture-phase `onStartShouldSetResponderCapture` runs before the
|
||
pressed child claims the touch on native and web, and returns false. Keyboard activation skips
|
||
the responder system, so the row's own press anchors too. Until a press, the first mounted row
|
||
holds the anchor. An item that renders no kit component
|
||
anchors to its section container.
|
||
- `SidebarSeparator` reuses the app's separator and cancels the footer's horizontal padding, so
|
||
the line runs edge to edge in both sections.
|
||
- `SidebarRow.trailing` sits in a second `Pressable` beside the row's button, since web cannot nest
|
||
buttons. Its `onPress` is the row's, so a press on non-interactive trailing content presses the
|
||
row; a button inside it wins its own press because only the innermost pressable responds.
|
||
- A new-API item renders from the current route's host, else the host remembered under
|
||
`pluginScreensHostKey(pluginId)`, which the screen's host switcher and the item's `openScreen`
|
||
set. One key per plugin: switching host on any of its screens moves all its items.
|
||
- `addSurface`, `openSurface`, and `addSidebarItem` are undocumented aliases, tagged
|
||
`COMPAT(pluginSidebarAliases)`. `addSidebarItem` is recorded only in `legacySidebarItems` and
|
||
groups as a `legacy` sidebar group, which the app draws as its own row: its registered icon, in
|
||
the sidebar and in Settings > Sidebar, opening `/plugin/<id>/sidebar/<item>` on the host it
|
||
remembers under its own key. It shares header ids and the `plugin:<pluginId>:<id>` settings key
|
||
with new-API items.
|
||
|
||
## Contribute file panels
|
||
|
||
Client `addFilePanel` registrations become the body of a file tab. The tab stats the file, picks a
|
||
panel, and mounts it with a `PluginFile` handle; the panel reads, shows its own `Loading`, writes,
|
||
and resolves conflicts. The host has no bar and no notion of a panel's views: the Markdown and HTML
|
||
panels own their Preview and Source views, toolbar and editor buffer, and the tab only shows the
|
||
dot a panel sets through `tab.setModified`. Source is the floor for text files no other built-in
|
||
claims, never a candidate beside one. Built-in panels (Markdown, HTML, Image, and Source, Paseo's
|
||
editor) take exactly `PluginFilePanelProps`, including params and persisted tab state, so a fix to reading, watching, or writing lands in one place:
|
||
`packages/app/src/file-panels/file/`. Do not add a host-side read or loading gate for one panel;
|
||
make that panel faster instead. Source highlights a large file on native in idle-time slices,
|
||
the lines around the opening line first.
|
||
|
||
The handle checks every write against the version it last read or wrote, so two panels or a panel
|
||
and an agent cannot silently overwrite each other. The daemon reports the file's kind (text,
|
||
image, binary) with its stat from a bounded sniff, which is how Source claims text files without a
|
||
read. See the [public file panel reference](../public-docs/plugins/reference.md#file-panels) for
|
||
the author API, selection, `DocumentFrame`, and the version requirement. The examples live in
|
||
`plugin-examples/pdf-panel` and `plugin-examples/markdown-panel`.
|
||
|
||
## Contribute buttons
|
||
|
||
Header buttons and composer pills share the client-only descriptor and registration lifecycle in
|
||
`packages/app/src/plugins/buttons/`. The [public button reference](../public-docs/plugins/reference.md#header-buttons)
|
||
owns the author API and placement rules. Keep presentation policy in this module so another
|
||
placement can reuse behavior without copying registration or action state. The header overflow
|
||
and the compact workspace menu share one builder that turns buttons into menu rows and pages; the
|
||
workspace menu reaches it through `usePluginWorkspaceMenu`.
|
||
|
||
Native sheets teleport their children. Button surfaces rebuild the installation's SDK, state,
|
||
query, and toast providers inside the surface content. A host menu can hold buttons from several
|
||
installations, so each of its rows and pages resolves its own installation's runtime. Providers
|
||
only around the trigger do not reach those bodies.
|
||
|
||
Request observation with `client.paseo.agents.list({ subscribe: {} })` and consume the returned
|
||
`subscription` handle. Plain `list()` and agent/workspace directory `.subscribe(handler)` listeners create no daemon
|
||
demand. Provider and project `subscribe()` calls establish their own demand. On capable daemons, each
|
||
list-and-subscribe call has its own server ID, even for the same query. Older daemons retain
|
||
[shared delivery behavior](protocol-compatibility.md#owned-observations). Handle snapshots
|
||
also run after reconnect; replace your view before applying its subsequent updates. An installation
|
||
stays loaded during a dropped connection while the app retains its `DaemonClient` object. An
|
||
unchanged installation does not rerun setup on reconnect, so refresh state from those snapshots
|
||
rather than from setup. Switching connections replaces the client object and reinstalls plugins. The installation
|
||
owns every observation created through its API and releases them on unload, including setup failure.
|
||
Mounted surfaces and command invocations have shorter API lifetimes.
|
||
|
||
Keep the client entry synchronous: return its cleanup function immediately and start asynchronous
|
||
work inside it. See the maintained [composer pill example](../plugin-examples/local-plugin/client/main.tsx).
|
||
|
||
## Contribute composer items
|
||
|
||
`addComposerItem` mounts a plugin component in the agent, draft and New workspace composers. The
|
||
public contract is the [composer items reference](../public-docs/plugins/reference.md#composer-items).
|
||
|
||
A plugin reads one `ComposerModel` (`packages/app/src/composer/model.ts`): state, subscribe and
|
||
commands. `toPluginComposer` (`packages/app/src/plugins/composer-items/`) turns its state into the
|
||
`PluginComposer` an item reads, and the host never learns which kind of composer it got. Two
|
||
implementations provide it:
|
||
|
||
- A running agent's `agentComposer(serverId, agentId)` (`composer/agent-composer/`). It exists
|
||
without a mounted tab: the prompt and attachments are the agent's draft in the draft store, the
|
||
settings are the session store's agent, and `model` and `thinking` resolve through the provider
|
||
catalog with `resolveAgentModelSelection`, the picker's own function, so a read equals what the
|
||
picker shows. The model loads the catalog itself and resolves with no models until it lands, as the picker does,
|
||
so a read never differs from what the picker shows. While anything watches the model it holds a
|
||
`QueryObserver` on the agent's catalog: that is what lets reconnect repair, which refetches only
|
||
active queries, refresh a catalog nobody has a picker open for, and retry one that failed.
|
||
`PluginComposersSource.subscribe(selector, listener)` is what holds it for `useComposers`, so
|
||
the subscription must go through the model's own `subscribe`. Watching again after the catalog
|
||
was invalidated or failed refetches it, and a read with no watcher starts one deduplicated
|
||
refresh and shows the cached catalog until it lands. The model keeps one pair of store
|
||
subscriptions however many components watch it. It is shared for as long as its agent is in the
|
||
session and not archived, so a command a plugin saved keeps reaching the composer a later tab
|
||
mounts; it is dropped when the agent is gone or archived and nothing watches it or has one
|
||
mounted, checked on session changes and when the last holder lets go. The mounted
|
||
`AgentControls` plugs its input in with `attachInput` so `insertText` lands at the cursor.
|
||
Without a live input the model writes the stored prompt with `replaceDraftText`, which also asks
|
||
a mounted input to show it. A workspace the user left stays mounted, display none. Web
|
||
drops the input ref there; native keeps the input, with a stale cursor and selection.
|
||
`ComposerInput.isLive()` is how the model tells: it needs the ref and a retained panel that is
|
||
showing (`useRetainedPanelActive`). Closing a root agent's tab archives
|
||
it, so a running agent with no mounted composer at all only exists as a subagent whose tab was
|
||
closed. The daemon does not check `setModel` and `setThinking` against a catalog; the provider
|
||
decides and its refusal rejects the call.
|
||
- A draft or New workspace screen's `composerModelFromHalves`, an adapter over the two contexts
|
||
in `composer/session.tsx`: `Composer` provides `ComposerInput` (prompt, attachments),
|
||
`DraftAgentControls` provides `ComposerAgent` (settings), and the adapter enforces the lock.
|
||
|
||
`ComposerAgent` stays for the built-in controls. Add a capability to the `ComposerModel`, both
|
||
implementations and `toPluginComposer`; never branch on `context` in the host.
|
||
|
||
`useComposers` and `composers()` reach an agent's model by reference (`plugins/composer-items/source.ts`):
|
||
`PluginInstallationProvider` provides the plugin's source to every surface, and
|
||
`createPluginCapabilities` puts `composers` on every command context. `{ focused: true }` is the
|
||
agent Command Center registration hands to agent items, published through `plugins/focused-agent.ts`
|
||
(null outside a workspace route). The source reads that module, not the navigation or layout
|
||
stores, so the plugin runtime does not import them. The remembered workspace selection is
|
||
navigation restore state and is not the focused agent. The query-cache subscriptions react to
|
||
`updated` events only: a `useQuery` in another component's render announces `added`, and a
|
||
subscriber that updates then triggers React's "update a component while rendering a different one"
|
||
warning.
|
||
|
||
Plugin `Toggle`, `Select` and `Action`, the thinking select and provider option controls all
|
||
render through `ComposerControl` (`packages/app/src/composer/agent-controls/composer-control.tsx`),
|
||
a toolbar icon or a row in the overflow sheet. Model and mode stay specialized but share its trigger,
|
||
density and overflow. Plugin items count in the density presence in `layout.ts`, so a composer
|
||
condenses to make room for them. A custom component renders wherever its item is placed, and an
|
||
item that renders nothing still counts for density; there is no registration for either.
|
||
|
||
A command runs against the owner's current state, not the render that built the callback. The
|
||
draft's form (`openAgentForm`) and options (`openDraftOptions`) are plain stores for that reason,
|
||
and `draftComposerAgent` rejects a provider the host does not offer. It passes a model id to the form
|
||
as the picker does, with no catalog check; for a running agent the provider decides. `ComposerControl` owns the pending state and the error toast for callbacks that
|
||
return a promise.
|
||
|
||
The overflow sheet's content portals to the app root, away from the composer. Pass
|
||
`useComposerSheetBridge()` as the sheet's `contextBridge`, or `useComposer()` returns nothing and
|
||
the sheet draws no plugin rows.
|
||
|
||
## Contribute New workspace items
|
||
|
||
`addNewWorkspaceItem` mounts a plugin component on the New workspace screen. The public contract
|
||
is the [New workspace items reference](../public-docs/plugins/reference.md#new-workspace-items).
|
||
|
||
The screen's choices that a plugin may change live in one plain store,
|
||
`createNewWorkspaceSetup` (`packages/app/src/screens/new-workspace/setup-model.ts`): the base
|
||
picker selection, the manual isolation, the branch name and the workspace metadata. The pickers and
|
||
the plugin commands write to it, so a command sees what an earlier command left. Project and host
|
||
stay in the screen's hooks (`useNewWorkspaceHostSelector` reconciles them against each other), and
|
||
they are read-only to plugins; a command that switched them would unmount the item that called it.
|
||
|
||
The store is built in the render that creates the screen, with what the screen derives from its
|
||
hooks (the lock, the project, whether the project can make worktrees, whether the host supports
|
||
metadata), so a command is valid from a child's first effect, which runs before the screen's own
|
||
effects. `syncInputs` refreshes those inputs in a layout effect on every commit, and commands read
|
||
them when they run, never from the render that built them. The pickers and the commands pick
|
||
through the same `chooseBase` and `chooseIsolation`, so a plugin command has the effects of a
|
||
pick; the screen injects those effects when it builds the store (syncing the picker's PR attachment,
|
||
remembering the isolation), so a command from a mount effect does the same as a click. Closing the
|
||
picker stays in the picker's own handler. Add a capability by extending the store;
|
||
do not read screen state from a plugin component.
|
||
|
||
The item host (`PluginNewWorkspaceItems`) keys the items by `(serverId, project id)`, so a change of
|
||
project or host remounts them. That is what keeps an item's own state and a `Combobox`'s cached
|
||
results from outliving their project: the `Combobox` cannot tell that an author's inline `search`
|
||
now means another project, because its identity changes every render. The store clears `branch`
|
||
and `metadata` on the same change in `syncInputs`, and a remounted item's mount effect sets them
|
||
again.
|
||
|
||
An item's commands come from `setup.commandsFor({ serverId, projectId })`, bound to the target the
|
||
item was mounted for. Once `syncInputs` reports another target they reject with a "moved" error, so
|
||
a lookup that finishes after a project switch cannot write into the new project's choices. The
|
||
reset only clears what was already written; this check covers what is written later. Rejecting, not
|
||
ignoring, matches the lock: a command's promise resolves only when the change took effect.
|
||
|
||
Known limit: an item that issues a command from `useLayoutEffect` on mount after a project or host
|
||
switch runs before the screen's `syncInputs` layout effect, so its commands (bound to the new
|
||
target) still see the previous target and reject as moved. This applies to a project switch as well as a host switch, since items
|
||
remount per `(serverId, project id)`. Passive effects are not affected.
|
||
|
||
`ensureWorkspace` sends the store's `branch` as `source.branchName` whenever the worktree cuts a
|
||
new branch (`startsNewBranch`, which mirrors the daemon: anything but a checkout, including no base
|
||
at all on a detached HEAD), and its `metadata` on `workspace.create` when it is not empty. The
|
||
server uses `branchName ?? worktreeSlug` as the new branch. `baseRef.name` is the exact ref
|
||
creation uses; `branchNameFromRef` is for labels only.
|
||
|
||
Items render through `ComposerControl` with `surface="field"`: a `FieldTrigger` (a badge on
|
||
desktop, a full-width field when compact) and the same pending state, error toast and list as the
|
||
composer's controls. `ComposerControlLockProvider` carries the screen's lock to them. Plugin
|
||
`Combobox` is a `select` item with `remoteSearch`: the app `Combobox` does not filter locally, and
|
||
`PluginCombobox` (`plugins/react-native/composer-controls.tsx`) runs `search` through
|
||
`useFetchQuery` with `dataShape: "list"`, which keeps the previous results while a newer query runs.
|
||
`plugins/item-host.tsx` is the host shared by composer and New workspace items.
|
||
|
||
## Contribute timeline items
|
||
|
||
Timeline transformers and renderers are client contributions. The daemon's canonical rows and
|
||
built-in projection stay unchanged. The app transforms each source item while building the render
|
||
model, for both fetched history and live events, before native Markdown splitting and Overview
|
||
tool grouping. Assistant callbacks receive the accumulated source text, never display fragments.
|
||
Live assistant messages use `phase: "streaming"`; committing to history makes them `"complete"`.
|
||
Paseo memoizes by source-item reference and phase and derives replacement IDs from source identity, so
|
||
streaming updates preserve mounted component identity.
|
||
|
||
`query.itemType` selects one public `AgentTimelineItem.type`. The callback owns any detailed
|
||
recognition and returns plain plugin item objects. `undefined` keeps the source item, `items`
|
||
replaces it, and an empty array removes it. Output `data` must be JSON-compatible. Paseo adds the
|
||
runtime plugin ID, preserves the source timeline cursor and identity, validates renderer data with
|
||
its Zod schema, and mounts the component inside the normal plugin runtime and error boundary. An
|
||
optional output `id` distinguishes several stable replacements from the same source item; its output
|
||
index is the default.
|
||
|
||
Transformers run synchronously and must be deterministic. When several transformers match, the
|
||
first one that returns a result owns that source item. Plugin and registration ordering is stable.
|
||
See `plugin-examples/timeline-items` for the complete contract.
|
||
|
||
A plugin subprocess can also append a canonical plugin row from a server handler:
|
||
|
||
```ts
|
||
await paseo.agents.ref(agentId).timeline.append({
|
||
type: "plugin",
|
||
id: "review",
|
||
kind: "review-result",
|
||
version: 1,
|
||
data: { status: "ready" },
|
||
});
|
||
```
|
||
|
||
The daemon stamps the runtime `pluginId`; plugin code never supplies it. Reusing the same `id`
|
||
replaces the previous row from that plugin on live clients and fresh timeline fetches. Rows live in
|
||
the daemon's in-memory timeline and survive scroll, refetch, and reconnect, but not a daemon
|
||
restart. A row without an installed renderer shows an unavailable placeholder. Serialized `data`
|
||
must be at most 64 KiB; the daemon rejects a larger append instead of storing a payload that cannot
|
||
be rendered intact. The daemon advertises this RPC through
|
||
`server_info.features.pluginTimelineItems`.
|
||
|
||
## Contribute client slash commands
|
||
|
||
`addSlashCommand` registers an agent- or workspace-context command in the composer. The
|
||
callback runs in the app, receives the trimmed text after the command name as `args`, and receives
|
||
the same `paseo`, `rpc`, `openScreen`, workspace, agent, and `openPanel` capabilities as the matching
|
||
Command Center callback.
|
||
|
||
```ts
|
||
client.addSlashCommand({
|
||
name: "review",
|
||
description: "Run the review bot",
|
||
argumentHint: "[scope]",
|
||
context: "agent",
|
||
async onSubmit({ args, agent, rpc }) {
|
||
await rpc(startReview, { agentId: agent.id, scope: args });
|
||
},
|
||
});
|
||
```
|
||
|
||
Paseo owns the autocomplete row, input clearing, and error toast. It never sends the command text to
|
||
the agent. Built-in client commands win name and alias collisions, plugin commands win
|
||
provider-command collisions, and the first plugin in stable catalog order wins collisions between
|
||
plugins. Plugin slash commands do not run when the composer has attachments.
|
||
|
||
## Contribute composer attachments
|
||
|
||
Register a declarative attachment source backed by a plugin RPC. Paseo owns the attachment menu,
|
||
search picker, drafts, selected pill, and submission. The plugin returns complete text snapshots;
|
||
credentials and vendor API calls stay in the daemon handler.
|
||
|
||
```ts
|
||
// index.server.ts
|
||
import type { PluginServerContext } from "@getpaseo/plugin/server";
|
||
import { search } from "./server/issues";
|
||
import { searchIssues } from "./shared/issues";
|
||
|
||
export default function contribute(server: PluginServerContext) {
|
||
server.handle(searchIssues, search);
|
||
return () => {};
|
||
}
|
||
```
|
||
|
||
```tsx
|
||
// index.client.tsx
|
||
import type { PluginClientContext } from "@getpaseo/plugin/client";
|
||
import { issues } from "./shared/issues";
|
||
|
||
export default function contribute(client: PluginClientContext) {
|
||
client.addAttachmentSource(issues);
|
||
return () => {};
|
||
}
|
||
```
|
||
|
||
Attachment sources stay scoped to the composer's host. Unlike sidebar contributions, equal sources
|
||
on several hosts are not coalesced. The selected snapshot submits as a text attachment with neutral
|
||
external-resource presentation, so it remains readable if the plugin is removed or an older peer
|
||
drops the optional presentation fields.
|
||
|
||
## Contribute settings
|
||
|
||
Register ordinary components with `client.addSettingsScreen` and open them with `openSettings`.
|
||
The host settings shell owns navigation and layout; plugin content must not add another page
|
||
scroll view or header. See the [author contract](../public-docs/plugins/reference.md#settings-screens)
|
||
and `plugin-examples/settings` for the named UI components and persistence API.
|
||
|
||
Settings storage is scoped to the runtime installation ID, never the source path or manifest ID.
|
||
Its writer lives with the plugin subprocess, while its directory lives outside managed sources,
|
||
so updates and reloads retain values. Settings-change notifications must not enter the catalog
|
||
reload path: that path disposes the plugin and would destroy open drafts after every save.
|
||
|
||
`server.registerSettings(definition)` returns a server-side handle. Use `read()` for the current
|
||
`ready` or `invalid` state and `subscribe()` for successful saves, resets, and migrations. The
|
||
subscription cleanup belongs in the plugin's contribution cleanup when it outlives the entry.
|
||
|
||
## Contribute a theme
|
||
|
||
`addTheme` takes a small light or dark palette and a display name. Paseo expands it through the
|
||
same semantic builders as the built-in themes, so plugins do not depend on the complete app token
|
||
contract. Unistyles needs every theme name at `StyleSheet.configure` time, so
|
||
`packages/app/src/styles/theme.ts` reserves one light and one dark plugin slot. The appearance
|
||
provider rewrites the matching slot when the selection changes. See [unistyles.md](unistyles.md)
|
||
for the runtime-patching rules the appearance settings share.
|
||
|
||
`addTheme` is a client registration and belongs in `index.client.tsx`. A client that predates it
|
||
cannot evaluate that entry. Daemons advertise
|
||
`features.pluginThemes` in `server_info`; the plugin theme catalog is the one place the app reads it, and
|
||
a host without it contributes no themes.
|
||
|
||
The selection persists as `theme: "plugin"` plus a `pluginThemeId` of `<pluginId>/theme/<themeId>`,
|
||
so equal themes on several hosts coalesce the way sidebar contributions do. Two hosts can answer
|
||
that id with different palettes, so picking a theme records its host through
|
||
`rememberPluginContributionHost` and resolution prefers it; a peer connecting or dropping then does
|
||
not repaint the app. Without a preference the sorted registry snapshot decides, so the result is
|
||
stable rather than arrival-ordered. The app resolves that id
|
||
against the installed catalog on every change; an id nothing contributes falls back to the default
|
||
preference instead of painting the reserved slot's placeholder colors.
|
||
|
||
Existing plugin authors should follow the standalone [v0.8 runtime-entry migration guide](../public-docs/plugins/migration.md).
|
||
|
||
See `plugin-examples/local-plugin` for a native surface, `plugin-examples/linear` for a complete
|
||
attachment-source example, `plugin-examples/timeline-items` for timeline projection, and
|
||
`plugin-examples/catppuccin` for a theme.
|