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.
This commit is contained in:
Mohamed Boudra
2026-11-04 07:25:21 +01:00
parent d5e022e363
commit 14fc9b02f8
55 changed files with 1517 additions and 106 deletions
+27 -2
View File
@@ -210,10 +210,35 @@ export interface ActionPressEvent {}
export interface ActionProps extends ComposerControlProps {
onPress(event: ActionPressEvent): void | Promise<void>;
}
/** One result of a `Combobox` search. Extra fields ride along to `onSelect`. */
export interface ComboboxItem {
id: string;
label: string;
description?: string;
}
export interface ComboboxSearchEvent {
/** Empty when the list opens. */
query: string;
}
export interface ComboboxProps<
Item extends ComboboxItem = ComboboxItem,
> extends ComposerControlProps {
/** What the control shows. It need not be among the search results. */
value: ComboboxItem | null;
/**
* Called when the list opens and again, debounced, as the user types. Paseo shows the loading
* and error states, keeps the previous results while a search runs, and ignores a search that a
* newer one replaced.
*/
search(event: ComboboxSearchEvent): Promise<readonly Item[]>;
onSelect(event: { item: Item }): void | Promise<void>;
}
/**
* Composer controls. Render them from a composer item's `Component`. Paseo draws them inline when
* the composer has room and as rows in its overflow sheet when it does not.
* Paseo's controls. Render them from a composer item's or a New workspace item's `Component`.
* Paseo draws them where the item sits: inline when the composer has room and as rows in its
* overflow sheet when it does not, and as a field in the New workspace setup.
*/
export declare const Toggle: ComponentType<ToggleProps>;
export declare function Select<Value extends string>(props: SelectProps<Value>): ReactNode;
export declare const Action: ComponentType<ActionProps>;
export declare function Combobox<Item extends ComboboxItem>(props: ComboboxProps<Item>): ReactNode;