mirror of
https://github.com/nexu-io/open-design.git
synced 2026-10-27 09:51:12 +01:00
* fix(plugins): route picked plugins through their own pipeline and trust local installs
Two related defects prevented an installed plugin from actually driving a
generation when the user picked it:
- HomeView "Use" attached the plugin as background context only (via
requestPluginContextUse), so submit fell back to the hidden od-default
scenario and the plugin's pipeline + SKILL.md/asset context never
applied. Route the picked plugin as the active driver instead
(usePlugin), preserving the use-with-query textarea seed behavior.
- resolvePluginFolder hard-coded trust='restricted' for every install,
ignoring sourceKind. A local scenario plugin could then never obtain the
pipeline:* capability it needs to run its own pipeline. Honor the
documented source-kind policy (local => trusted) via defaultTrustForRecord
and resolveCapabilitiesGranted.
* fix(plugins): preserve draft on use-with-query and update trust/route test coverage
Addresses review feedback on the plugin-use routing + local-trust change:
- use-with-query no longer discards the user's existing draft. routePluginUse
now APPENDS the rendered plugin query to the current prompt (matching the
legacy context-use semantics) before routing the plugin as the active
driver, instead of letting usePlugin replace the whole prompt.
- Update daemon trust coverage for the local-default flip: the installer
test asserts a local install is trusted by default, and the headless
pipeline fixture drops its ephemeral grantCaps to exercise the
stored/default grant path (local trusted => pipeline:* already granted).
- Update web + e2e tests for the new active-driver behavior: picking a
plugin now routes it as the run driver (its own pipeline) rather than
attaching it as background context. Drops two context-only `Use` regression
tests whose scenario no longer exists under active-driver routing.
* test(plugins): stabilize direct-Use e2e timing and cover plugin-use submit
The P0 "direct Use routes the plugin as the active driver" browser test could
race the in-flight apply: it submitted before `/api/plugins/:id/apply`
resolved, so the active snapshot was not yet bound and the create-project
request never fired (waitForRequest timed out). Wait for the apply response
and an enabled submit button before clicking.
Also extend the HomeView prefill unit test to drive the full plain-`use` →
type a draft → submit flow and assert the routed plugin (not od-default)
drives the run, so this path is covered at the unit layer too.
* test(e2e): assert plugin-use submit via the project request, not a run POST
The two P0 plugin-use flows ("direct Use" and "Use with query carries the
prompt") still waited on POST /api/runs after submit. Under active-driver
routing the picked plugin is a scenario pipeline whose run is fired from the
bound snapshot when the project page mounts — Home no longer posts a separate
/api/runs — so waitForRequest(isCreateRunRequest) timed out even though the
create-project request (which pins pluginId) succeeded. Assert on the project
request + navigation instead, and drop the now-unused message-listing helper.
* fix(plugins): preserve query template on use-with-query so edits flow into inputs
Routing use-with-query passed the rendered prompt as nextPrompt, which made
usePlugin null out active.queryTemplate (nextPrompt-set branch). handlePromptChange
then stopped extracting edited {{...}} values back into active.inputs, so a user
who edited the hydrated query before submit would send the stale default inputs
and the applied snapshot would disagree with the visible prompt.
routePluginUse now passes an explicit queryTemplate aligned with the combined
prompt (untouched draft prefix + raw placeholder-bearing plugin query), so
extraction keeps working. Adds a prefill test that edits a hydrated
use-with-query prompt and asserts the edited value reaches the submitted
pluginInputs.
Also stabilizes the two P0 plugin-use e2e flows: they asserted live navigation
after submit, but the real e2e daemon has no mocked plugin installed so the
live create-project call cannot complete. Assert on the create-project request
payload (which pins the routed pluginId) instead, and drop the now-unused
project-context/message helpers.
* fix(plugins): extract use-with-query inputs independent of the mutable draft prefix
The previous fix baked the user's draft prefix into the query template, so
extractPluginInputsFromPrompt anchored the whole prompt and editing that prefix
made extraction return null — a later placeholder edit then never reached
pluginInputs and the snapshot refreshed from stale defaults.
The template now carries the plugin query segment only. usePlugin/active gain a
queryTemplateAllowsPrefix flag (set by the use-with-query route when a draft
prefix exists) that tells extractPluginInputsFromPrompt to match the query as a
suffix after any leading text. Editing the draft prefix no longer breaks
placeholder extraction.
Adds a regression: existing draft -> use-with-query -> edit both the draft
prefix and a hydrated placeholder -> submit asserts pluginInputs reflects the
edited placeholder.
---------
Co-authored-by: qiongyu1999 <2694684348@qq.com>