@opencode/plugin 2.2.5 → 2.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -59,6 +59,18 @@ export interface SessionTitle extends SessionRequest {
59
59
  * hook identity but need to be told apart from the agent loop.
60
60
  */
61
61
  export type SessionRequestKind = "primary" | "compaction" | "title" | "generate";
62
+ /**
63
+ * Runs whenever a Session resolves the model for a request, before anything is built for it. `model` starts as the
64
+ * Session's or agent's selection; change it to serve this request with another model from the same provider, including
65
+ * models hidden from the picker. The Session keeps its selection, and the request and its records use the new model.
66
+ * Router models such as GitHub Copilot's Auto use it. Experimental.
67
+ */
68
+ export interface SessionModelResolve {
69
+ readonly sessionID: Session.ID;
70
+ readonly agent: Agent.ID;
71
+ readonly kind: SessionRequestKind;
72
+ model: Model.Ref;
73
+ }
62
74
  export interface SessionModelRequest {
63
75
  readonly sessionID: Session.ID;
64
76
  readonly agent: Agent.ID;
@@ -174,6 +186,7 @@ export interface SessionHooks {
174
186
  readonly compaction: SessionCompaction;
175
187
  readonly generate: SessionGenerate;
176
188
  readonly title: SessionTitle;
189
+ readonly "experimental.model.resolve": SessionModelResolve;
177
190
  readonly "model.request": SessionModelRequest;
178
191
  readonly "http.request": SessionHttpRequest;
179
192
  readonly "http.response": SessionHttpResponse;
@@ -177,8 +177,8 @@ export interface Context extends BaseContext {
177
177
  */
178
178
  readonly embeds: Embeds;
179
179
  /**
180
- * The app's own components: icons, buttons, tooltips, menus, the loading indicator, the dialog frame, switches,
181
- * text fields, keybind chips, Markdown and highlighted code.
180
+ * The app's own components: icons, buttons, tooltips, menus and menu rows, the loading indicator, the dialog frame,
181
+ * switches, text fields, selects, keybind chips, Markdown, highlighted code, and settings pages, sections and rows.
182
182
  *
183
183
  * @example
184
184
  * ```tsx
@@ -71,10 +71,10 @@ export interface OpenInAppProps {
71
71
  /** The session whose workspace opens. */
72
72
  readonly session: MountedSession;
73
73
  }
74
- /** The desktop "Open in" button, for a panel header that shows it in place of the tab strip's. */
74
+ /** The desktop "Open in" button, for a panel header such as the review's. */
75
75
  export interface OpenInApp {
76
76
  /**
77
- * Renders nothing on the web or for a remote server. While it is mounted, the tab strip leaves out its own.
77
+ * Renders nothing on the web or for a remote server.
78
78
  *
79
79
  * @param props - The workspace to open.
80
80
  * @returns The button.
@@ -839,6 +839,26 @@ export interface Layout {
839
839
  * ```
840
840
  */
841
841
  menu(): readonly SessionPanelMenuItem[];
842
+ /**
843
+ * The side region width the user dragged to, or `resize` stored, while one of your panel's tabs shows; undefined
844
+ * when none is stored, as before the app interface mounts. Reactive.
845
+ *
846
+ * @param panel - Your `Panel`'s id.
847
+ */
848
+ width(panel: string): number | undefined;
849
+ /**
850
+ * Stores the side region width for your panel, as a drag on one of its tabs does; it applies while the side pane
851
+ * shows one of the panel's tabs, and the user's next drag replaces it. Waits until the app interface mounts.
852
+ *
853
+ * @param panel - Your `Panel`'s id.
854
+ * @param width - CSS pixels. The host keeps the conversation at its minimum width and the region at its own.
855
+ *
856
+ * @example
857
+ * ```ts
858
+ * ctx.layout.side.resize("quota", 360)
859
+ * ```
860
+ */
861
+ resize(panel: string, width: number): void;
842
862
  };
843
863
  /**
844
864
  * The inner sidebar preference every side panel shares, which `usePanel().sidebar` also reads inside a panel render.
@@ -1132,7 +1152,8 @@ export interface Servers {
1132
1152
  * stay in the main process. The same ref for the same id; read its `client` each time you call it. Reactive.
1133
1153
  *
1134
1154
  * @param id - The server's id, as `list()` returns it.
1135
- * @returns Undefined while the app does not list the server, and before the app interface mounts.
1155
+ * @returns Undefined while the app does not list the server, before the app interface mounts, and while a server
1156
+ * that rejects the app's credentials has not connected in this window yet.
1136
1157
  *
1137
1158
  * @example
1138
1159
  * ```ts
@@ -1643,7 +1664,7 @@ export interface UiTooltipProps {
1643
1664
  /** The element that shows the tooltip while the pointer rests on it or it has keyboard focus. */
1644
1665
  readonly children: JSX.Element;
1645
1666
  }
1646
- /** An action in `UiMenuProps.items`. */
1667
+ /** An action in `UiMenuProps.items`, and the props of `Ui.MenuItem`. */
1647
1668
  export interface UiMenuItem {
1648
1669
  /** Marks the entry as an action. Optional: an entry without `type` is an action. */
1649
1670
  readonly type?: "item";
@@ -1693,6 +1714,26 @@ export interface UiMenuProps {
1693
1714
  /** The trigger cannot open the menu. Defaults to false. */
1694
1715
  readonly disabled?: boolean;
1695
1716
  }
1717
+ /** Props of `Ui.MenuGroup`. */
1718
+ export interface UiMenuGroupProps {
1719
+ /** The group's heading. Pass translated copy. */
1720
+ readonly label: string;
1721
+ /** The group's rows, such as `Ui.MenuItem` and `Ui.MenuSub`. */
1722
+ readonly children: JSX.Element;
1723
+ }
1724
+ /** Props of `Ui.MenuSub`. */
1725
+ export interface UiMenuSubProps {
1726
+ /** The text of the row that opens the submenu, which also names the submenu for screen readers. */
1727
+ readonly label: string;
1728
+ /** An icon before the text. Omit it for none. */
1729
+ readonly icon?: IconName;
1730
+ /** The row cannot open the submenu. Defaults to false. */
1731
+ readonly disabled?: boolean;
1732
+ /** Runs with true when the submenu opens and false when it closes, for example to load its rows only while open. */
1733
+ readonly onOpenChange?: (open: boolean) => void;
1734
+ /** The submenu's rows, such as `Ui.MenuItem`, `Ui.MenuSeparator` and `Ui.MenuGroup`. */
1735
+ readonly children: JSX.Element;
1736
+ }
1696
1737
  /** Props of `Ui.Loader`. */
1697
1738
  export interface UiLoaderProps {
1698
1739
  /**
@@ -1806,6 +1847,74 @@ export interface UiCodeProps {
1806
1847
  /** Classes of the code block, for layout. */
1807
1848
  readonly class?: string;
1808
1849
  }
1850
+ /** One choice in `UiSelectProps.options`. */
1851
+ export interface UiSelectOption<T extends string = string> {
1852
+ /** The value `onChange` receives. Unique among the options. */
1853
+ readonly value: T;
1854
+ /** The choice's text, in the list and on the closed select. Pass translated copy. */
1855
+ readonly label: string;
1856
+ }
1857
+ /** Props of `Ui.Select`. */
1858
+ export interface UiSelectProps<T extends string = string> {
1859
+ /** The choices, in order. */
1860
+ readonly options: readonly UiSelectOption<T>[];
1861
+ /** The selected choice's value. Undefined, or a value no option has, shows `placeholder`. */
1862
+ readonly value: T | undefined;
1863
+ /**
1864
+ * Runs with the value the user picks. Pass it on to `value` to keep the select in step. Picking the selected choice
1865
+ * again does not call it.
1866
+ */
1867
+ readonly onChange: (value: T) => void;
1868
+ /** The select's accessible name, which screen readers announce. Pass translated copy; it is not shown. */
1869
+ readonly label: string;
1870
+ /** Text the select shows while no choice is selected. Omit it for none. */
1871
+ readonly placeholder?: string;
1872
+ /** The select cannot be opened. Defaults to false. */
1873
+ readonly disabled?: boolean;
1874
+ /** Shows the select as invalid. Defaults to false. */
1875
+ readonly invalid?: boolean;
1876
+ /**
1877
+ * Where the list opens from the select. Defaults to `bottom-end`, as the app's settings rows open theirs; it flips
1878
+ * when there is no room.
1879
+ */
1880
+ readonly placement?: "bottom-start" | "bottom-end" | "top-start" | "top-end";
1881
+ /** Classes of the select, for layout. The app's styles give it its look. */
1882
+ readonly class?: string;
1883
+ }
1884
+ /** Props of `Ui.SettingsLayout`. */
1885
+ export interface UiSettingsLayoutProps {
1886
+ /** The page's title, at the top of the page. Pass translated copy, usually the `SettingsPage.title`. */
1887
+ readonly title: string;
1888
+ /** Text under the title. Omit it for none. */
1889
+ readonly description?: string;
1890
+ /** Controls at the end of the title row, such as a `Ui.Button` that opens a website. Omit it for none. */
1891
+ readonly actions?: JSX.Element;
1892
+ /** The page's sections, usually `Ui.SettingsSection`s. */
1893
+ readonly children: JSX.Element;
1894
+ }
1895
+ /** Props of `Ui.SettingsSection`. */
1896
+ export interface UiSettingsSectionProps {
1897
+ /** The section's heading, which also names it for screen readers. Omit it for a section without a heading. */
1898
+ readonly title?: string;
1899
+ /** The section's rows, usually `Ui.SettingsRow`s, in the app's bordered list. */
1900
+ readonly children: JSX.Element;
1901
+ /** Content under the list, outside its border, such as an error that concerns the rows. Omit it for none. */
1902
+ readonly footer?: JSX.Element;
1903
+ }
1904
+ /** Props of `Ui.SettingsRow`. */
1905
+ export interface UiSettingsRowProps {
1906
+ /** The setting's name. Pass translated copy. */
1907
+ readonly title: JSX.Element;
1908
+ /** Text under the title that says what the setting does. Omit it for none. */
1909
+ readonly description?: JSX.Element;
1910
+ /**
1911
+ * The `SettingEntry.id` that reveals this row: when the user picks the entry in settings search, the host scrolls
1912
+ * to the row and highlights it. Omit it for a row that search does not list.
1913
+ */
1914
+ readonly id?: string;
1915
+ /** The row's control at its end, such as a `Ui.Switch`, `Ui.Select` or `Ui.Button`. Omit it for none. */
1916
+ readonly children?: JSX.Element;
1917
+ }
1809
1918
  /**
1810
1919
  * The app's own components, so a plugin's UI looks and behaves like the app's: the same buttons, menus, dialogs and
1811
1920
  * fields, in the user's theme, fonts and language. Each takes a small set of props the SDK keeps stable. A component
@@ -1869,6 +1978,64 @@ export interface Ui {
1869
1978
  * ```
1870
1979
  */
1871
1980
  Menu(props: UiMenuProps): JSX.Element;
1981
+ /**
1982
+ * One action row of a menu the host renders, such as the `session.location.menu` slot, so your rows look and
1983
+ * behave like the host's: keyboard navigation, the muted icon, shortcut chips, and the menu closing on a pick. It
1984
+ * also renders inside `Ui.MenuGroup` and `Ui.MenuSub`. It takes the fields of an entry of `UiMenuProps.items`.
1985
+ * Outside a menu it throws, so the host records the error and the contribution renders nothing.
1986
+ *
1987
+ * @param props - The row's text, icon, keys and action.
1988
+ *
1989
+ * @example
1990
+ * ```tsx
1991
+ * ctx.add(Slot, {
1992
+ * at: "session.location.menu",
1993
+ * render: (input) => <ctx.ui.MenuItem label={ctx.t("usage")} icon="status" onSelect={() => open(input.session)} />,
1994
+ * })
1995
+ * ```
1996
+ */
1997
+ MenuItem(props: UiMenuItem): JSX.Element;
1998
+ /**
1999
+ * A line between rows of a menu the host renders, or of a `Ui.MenuSub`, with the menu's spacing and color.
2000
+ *
2001
+ * @example
2002
+ * ```tsx
2003
+ * <>
2004
+ * <ctx.ui.MenuSeparator />
2005
+ * <ctx.ui.MenuItem label={ctx.t("usage")} onSelect={open} />
2006
+ * </>
2007
+ * ```
2008
+ */
2009
+ MenuSeparator(): JSX.Element;
2010
+ /**
2011
+ * Rows of a menu the host renders under a heading, as `UiMenuGroup` groups the entries of `Ui.Menu`. Outside a menu
2012
+ * it throws, as `Ui.MenuItem` does.
2013
+ *
2014
+ * @param props - The heading and its rows.
2015
+ *
2016
+ * @example
2017
+ * ```tsx
2018
+ * <ctx.ui.MenuGroup label={ctx.t("usage")}>
2019
+ * <ctx.ui.MenuItem label={ctx.t("today")} onSelect={() => open("today")} />
2020
+ * <ctx.ui.MenuItem label={ctx.t("month")} onSelect={() => open("month")} />
2021
+ * </ctx.ui.MenuGroup>
2022
+ * ```
2023
+ */
2024
+ MenuGroup(props: UiMenuGroupProps): JSX.Element;
2025
+ /**
2026
+ * A row of a menu the host renders that opens a submenu beside it, with the host's chevron, as the location menu's
2027
+ * branch and folder rows do. Outside a menu it throws, as `Ui.MenuItem` does.
2028
+ *
2029
+ * @param props - The row's text and icon, and the submenu's rows.
2030
+ *
2031
+ * @example
2032
+ * ```tsx
2033
+ * <ctx.ui.MenuSub label={ctx.t("openIn")} icon="outline-share">
2034
+ * <For each={apps()}>{(app) => <ctx.ui.MenuItem label={app.name} onSelect={() => launch(app)} />}</For>
2035
+ * </ctx.ui.MenuSub>
2036
+ * ```
2037
+ */
2038
+ MenuSub(props: UiMenuSubProps): JSX.Element;
1872
2039
  /**
1873
2040
  * The app's loading indicator, for anything that loads, connects or runs that is not the AI working.
1874
2041
  *
@@ -1918,6 +2085,26 @@ export interface Ui {
1918
2085
  * ```
1919
2086
  */
1920
2087
  TextInput(props: UiTextInputProps): JSX.Element;
2088
+ /**
2089
+ * A select that opens a list of choices, as the app's settings rows pick a language or a width. The value is a
2090
+ * string; `T` narrows it to your choices' values.
2091
+ *
2092
+ * @param props - The choices, the selected value and its handler.
2093
+ *
2094
+ * @example
2095
+ * ```tsx
2096
+ * <ctx.ui.Select
2097
+ * label={ctx.t("period")}
2098
+ * options={[
2099
+ * { value: "day", label: ctx.t("period.day") },
2100
+ * { value: "month", label: ctx.t("period.month") },
2101
+ * ]}
2102
+ * value={period()}
2103
+ * onChange={setPeriod}
2104
+ * />
2105
+ * ```
2106
+ */
2107
+ Select<T extends string>(props: UiSelectProps<T>): JSX.Element;
1921
2108
  /**
1922
2109
  * Keys shown as chips, as menus and tooltips show shortcuts.
1923
2110
  *
@@ -1932,7 +2119,8 @@ export interface Ui {
1932
2119
  /**
1933
2120
  * Markdown rendered as the timeline renders a message: headings, lists, tables, links, math and highlighted code
1934
2121
  * blocks with a copy button. On the session screen, links to local files open through the LinkHandler
1935
- * contributions, as the timeline's do. Rendering is asynchronous: the block fills in shortly after it mounts.
2122
+ * contributions, and fenced code blocks show `CodeBlock` and `CodeBlockAction` contributions, as the timeline's do;
2123
+ * inside a `CodeBlock` render they do not. Rendering is asynchronous: the block fills in shortly after it mounts.
1936
2124
  *
1937
2125
  * @param props - The Markdown source.
1938
2126
  *
@@ -1943,8 +2131,9 @@ export interface Ui {
1943
2131
  */
1944
2132
  Markdown(props: UiMarkdownProps): JSX.Element;
1945
2133
  /**
1946
- * A read-only code block, highlighted as the timeline highlights code, with a copy button. Highlighting is
1947
- * asynchronous: the block fills in shortly after it mounts.
2134
+ * A read-only code block, highlighted as the timeline highlights code, with a copy button. It always shows the code:
2135
+ * `CodeBlock` and `CodeBlockAction` contributions do not apply, so a `CodeBlock` render can show its source through
2136
+ * it. Highlighting is asynchronous: the block fills in shortly after it mounts.
1948
2137
  *
1949
2138
  * @param props - The code and its language.
1950
2139
  *
@@ -1954,4 +2143,58 @@ export interface Ui {
1954
2143
  * ```
1955
2144
  */
1956
2145
  Code(props: UiCodeProps): JSX.Element;
2146
+ /**
2147
+ * The frame of a settings page of your own (a `SettingsPage` without `page`): the app's page header with the title,
2148
+ * then your sections, spaced as the app's pages are. Search that reveals the page itself highlights its header. The
2149
+ * settings components take their look from the Settings screen's styles, so render them from a `SettingsPage`.
2150
+ *
2151
+ * @param props - The page's title, header actions and sections.
2152
+ *
2153
+ * @example
2154
+ * ```tsx
2155
+ * ctx.add(SettingsPage, {
2156
+ * id: "acme",
2157
+ * get title() {
2158
+ * return ctx.t("title")
2159
+ * },
2160
+ * render: () => (
2161
+ * <ctx.ui.SettingsLayout title={ctx.t("title")} description={ctx.t("description")}>
2162
+ * <ctx.ui.SettingsSection title={ctx.t("sync")}>{rows()}</ctx.ui.SettingsSection>
2163
+ * </ctx.ui.SettingsLayout>
2164
+ * ),
2165
+ * })
2166
+ * ```
2167
+ */
2168
+ SettingsLayout(props: UiSettingsLayoutProps): JSX.Element;
2169
+ /**
2170
+ * A section of settings rows: an optional heading over the app's bordered list. Render it in `SettingsLayout`, or on
2171
+ * its own as a section on a host page (`SettingsPage.page`).
2172
+ *
2173
+ * @param props - The heading and rows.
2174
+ *
2175
+ * @example
2176
+ * ```tsx
2177
+ * <ctx.ui.SettingsSection title={ctx.t("sync")}>
2178
+ * <ctx.ui.SettingsRow id="acme-sync" title={ctx.t("sync")} description={ctx.t("sync.description")}>
2179
+ * <ctx.ui.Switch label={ctx.t("sync")} hideLabel checked={sync()} onChange={setSync} />
2180
+ * </ctx.ui.SettingsRow>
2181
+ * </ctx.ui.SettingsSection>
2182
+ * ```
2183
+ */
2184
+ SettingsSection(props: UiSettingsSectionProps): JSX.Element;
2185
+ /**
2186
+ * One setting, as the app's own settings rows show it: its title and description, and its control at the end. Render
2187
+ * it in a `SettingsSection`, or on its own as rows in a host section (`SettingsPage.section`), where it lines up
2188
+ * with the host's rows.
2189
+ *
2190
+ * @param props - The setting's text, search id and control.
2191
+ *
2192
+ * @example
2193
+ * ```tsx
2194
+ * <ctx.ui.SettingsRow id="acme-sync" title={ctx.t("sync")} description={ctx.t("sync.description")}>
2195
+ * <ctx.ui.Switch label={ctx.t("sync")} hideLabel checked={sync()} onChange={setSync} />
2196
+ * </ctx.ui.SettingsRow>
2197
+ * ```
2198
+ */
2199
+ SettingsRow(props: UiSettingsRowProps): JSX.Element;
1957
2200
  }
@@ -1,2 +1,2 @@
1
1
  /** An icon from the app's catalog, for SDK fields such as `SessionPanelMenuItem.icon`. */
2
- export type IconName = "align-right" | "appearance" | "archive" | "arrow-down-to-line" | "arrow-left" | "arrow-right" | "arrow-undo-down" | "arrow-up" | "arrow-up-right" | "brain" | "branch" | "branch-out" | "bubble-5" | "bullet-list" | "check" | "check-small" | "checklist" | "chevron-double-right" | "chevron-down" | "chevron-grabber-vertical" | "chevron-left" | "chevron-right" | "circle-ban-sign" | "circle-check" | "circle-exclamation" | "circle-x" | "circle-xmark" | "close" | "close-small" | "cloud-upload" | "code" | "code-lines" | "code-slash" | "collapse" | "comment" | "console" | "copy" | "cube" | "dash" | "discord" | "dot-grid" | "download" | "edit" | "edit-small-2" | "enter" | "expand" | "extensions" | "eye" | "file-document" | "file-tree" | "file-tree-active" | "filetree" | "fill-triangle-down" | "flask" | "folder" | "folder-add-left" | "fork" | "github" | "glasses" | "globe" | "graduation-cap" | "grid-plus" | "help" | "info" | "keyboard" | "layout-bottom" | "layout-bottom-full" | "layout-bottom-partial" | "layout-left" | "layout-left-full" | "layout-left-partial" | "layout-right" | "layout-right-full" | "layout-right-partial" | "link" | "lock" | "magnifying-glass" | "magnifying-glass-menu" | "mcp" | "menu" | "minus" | "models" | "monitor" | "new-session" | "new-session-active" | "notifications" | "open-file" | "outline-arrow-left" | "outline-arrow-right" | "outline-arrow-to-corner-top-right" | "outline-arrow-up-right" | "outline-audio" | "outline-brain" | "outline-browser-annotate" | "outline-chevron-down" | "outline-chevron-right" | "outline-code-brackets" | "outline-console" | "outline-cookie" | "outline-copy" | "outline-dots" | "outline-expand" | "outline-eye" | "outline-eye-slash" | "outline-globe" | "outline-globe-plus" | "outline-hexagonal-warning" | "outline-magnifier-minus" | "outline-magnifier-plus" | "outline-photo" | "outline-quote" | "outline-reset" | "outline-rotate-clockwise" | "outline-share" | "outline-sliders" | "outline-square-arrow" | "outline-steer" | "outline-text" | "outline-trash" | "outline-undo" | "outline-video" | "outline-wave-audio" | "outline-worktree" | "outline-xmark" | "pencil-line" | "photo" | "plus" | "plus-small" | "post-skill" | "prompt" | "providers" | "refresh" | "reset" | "review" | "review-active" | "select-element" | "selector" | "server" | "settings-gear" | "share" | "shield" | "sidebar" | "sidebar-active" | "sliders" | "speech-bubble" | "split" | "square-arrow-top-right" | "status" | "status-active" | "stop" | "task" | "terminal" | "terminal-active" | "trash" | "unified" | "warning" | "waveform" | "window-analytics" | "window-cursor" | "workspace" | "workspace-isolated" | "workspace-new" | "xmark-small";
2
+ export type IconName = "align-right" | "appearance" | "archive" | "arrow-down-to-line" | "arrow-left" | "arrow-right" | "arrow-undo-down" | "arrow-up" | "arrow-up-right" | "brain" | "branch" | "branch-out" | "bubble-5" | "bullet-list" | "check" | "check-small" | "checklist" | "chevron-double-right" | "chevron-down" | "chevron-grabber-vertical" | "chevron-left" | "chevron-right" | "circle-ban-sign" | "circle-check" | "circle-exclamation" | "circle-x" | "circle-xmark" | "close" | "close-small" | "cloud-upload" | "code" | "code-lines" | "code-slash" | "collapse" | "comment" | "console" | "copy" | "cube" | "dash" | "discord" | "dot-grid" | "download" | "edit" | "edit-small-2" | "enter" | "expand" | "extensions" | "eye" | "file-document" | "file-tree" | "file-tree-active" | "filetree" | "fill-triangle-down" | "flask" | "folder" | "folder-add-left" | "fork" | "github" | "glasses" | "globe" | "graduation-cap" | "grid-plus" | "help" | "info" | "keyboard" | "layout-bottom" | "layout-bottom-full" | "layout-bottom-partial" | "layout-left" | "layout-left-full" | "layout-left-partial" | "layout-right" | "layout-right-full" | "layout-right-partial" | "link" | "lock" | "magnifying-glass" | "magnifying-glass-menu" | "mcp" | "menu" | "minus" | "models" | "monitor" | "new-session" | "new-session-active" | "notifications" | "open-file" | "outline-arrow-left" | "outline-arrow-right" | "outline-arrow-to-corner-top-right" | "outline-arrow-up-right" | "outline-audio" | "outline-brain" | "outline-browser-annotate" | "outline-chevron-down" | "outline-chevron-right" | "outline-code-brackets" | "outline-console" | "outline-cookie" | "outline-copy" | "outline-dots" | "outline-expand" | "outline-eye" | "outline-eye-slash" | "outline-globe" | "outline-globe-plus" | "outline-hexagonal-warning" | "outline-list-changelog" | "outline-magnifier-minus" | "outline-magnifier-plus" | "outline-pair" | "outline-photo" | "outline-quote" | "outline-reset" | "outline-rotate-clockwise" | "outline-share" | "outline-sliders" | "outline-square-arrow" | "outline-steer" | "outline-text" | "outline-trash" | "outline-undo" | "outline-video" | "outline-wave-audio" | "outline-worktree" | "outline-xmark" | "pencil-line" | "photo" | "plus" | "plus-small" | "post-skill" | "prompt" | "providers" | "refresh" | "reset" | "review" | "review-active" | "select-element" | "selector" | "server" | "settings-gear" | "share" | "shield" | "sidebar" | "sidebar-active" | "sliders" | "speech-bubble" | "split" | "square-arrow-top-right" | "status" | "status-active" | "stop" | "task" | "terminal" | "terminal-active" | "trash" | "unified" | "warning" | "waveform" | "window-analytics" | "window-cursor" | "workspace" | "workspace-isolated" | "workspace-new" | "xmark-small";
@@ -254,6 +254,16 @@ export interface Panel {
254
254
  readonly region: "side";
255
255
  /** Asks for the wider session minimum while the side region is open. Reactive. */
256
256
  readonly wide?: boolean;
257
+ /**
258
+ * Gives the panel a side region width of its own, for content that wants less room or more than other tabs. While the
259
+ * side pane shows one of the panel's tabs, the region takes the width the user last dragged it to on this panel,
260
+ * app-wide, else this one; other tabs keep the conversation's width. The host keeps the conversation at its minimum
261
+ * width and the region at least `narrow`. Omit it to share the conversation's width, unless `Layout.side.resize`
262
+ * stored one for the panel.
263
+ * - A number: CSS pixels.
264
+ * - `narrow`: the narrowest the region goes.
265
+ */
266
+ readonly width?: number | "narrow";
257
267
  /** Tabs are not restored: stored keys this panel stops listing leave the strip. See also `PanelTab.transient`. */
258
268
  readonly transient?: boolean;
259
269
  /**
@@ -387,7 +397,8 @@ export interface SettingsPage {
387
397
  /** Search metadata, indexed without mounting the page. */
388
398
  readonly entries?: readonly SettingEntry[];
389
399
  /**
390
- * Renders the page, section or rows.
400
+ * Renders the page, section or rows: `Ui.SettingsLayout` frames a page, `Ui.SettingsSection` a section, and
401
+ * `Ui.SettingsRow` is one row, each as the app's own settings render them.
391
402
  *
392
403
  * @param input - `target` is the entry search is revealing.
393
404
  */
@@ -642,6 +653,171 @@ export interface ComposerPill {
642
653
  */
643
654
  menu?(input: ComposerPillMenuProps): JSX.Element;
644
655
  }
656
+ /**
657
+ * One complete fenced code block, as a `CodeBlock` render and a `CodeBlockAction` receive it. Do not destructure:
658
+ * `session` is a getter.
659
+ */
660
+ export interface CodeBlockProps {
661
+ /** The source between the fences, without the final line break. */
662
+ readonly code: string;
663
+ /**
664
+ * The fence's language: the first word of its info string, lowercased, without characters other than letters, digits
665
+ * and `_ # + . -`. For ```` ```Mermaid title="Flow" ```` it is `mermaid`; empty for a fence without one.
666
+ */
667
+ readonly language: string;
668
+ /**
669
+ * The routed session of the screen that shows the block; a new object when another session is routed. Undefined for
670
+ * Markdown outside a session screen, where the host does not offer code block content today.
671
+ */
672
+ readonly session?: MountedSession;
673
+ }
674
+ /**
675
+ * Renders the fenced code blocks of some languages as your own UI in place of the highlighted code, for example a
676
+ * diagram for ```` ```mermaid ```` or a table for ```` ```csv ````. Applies to Markdown on the session screen: the
677
+ * timeline (assistant text and tool output), side panels such as the file viewer's Markdown preview, and `ctx.ui.Markdown`
678
+ * rendered there. `ctx.ui.Code`, and Markdown your own render shows, keep the plain code, so a render never meets
679
+ * itself.
680
+ *
681
+ * The host renders a block only once its closing fence arrives: while it streams, and in a message that stopped
682
+ * mid-block, the user sees the highlighted code, then your UI replaces it in place. Blocks of other languages cost
683
+ * nothing. The block keeps its Copy button and `CodeBlockAction` buttons over the top end corner of your UI, and its
684
+ * height follows your UI as it grows; reserve the height you know (for example a minimum) so the timeline shifts less
685
+ * when asynchronous content arrives.
686
+ */
687
+ export interface CodeBlock {
688
+ /**
689
+ * The languages whose blocks you render, compared with `CodeBlockProps.language`, e.g. `["csv", "tsv"]`. The host
690
+ * resolves no aliases: list each name you accept. When several contributions list a language, the first contributed
691
+ * renders it.
692
+ */
693
+ readonly languages: readonly string[];
694
+ /**
695
+ * Renders one block once, under your plugin's context; its own reactivity updates it, also when another session is
696
+ * routed. Return `undefined` or `null` to keep the highlighted code, e.g. for a source you cannot parse. A render that
697
+ * throws records the error under your plugin and the block shows its code; the plugin keeps running. The host
698
+ * renders it again only when the block or the set of contributions changes.
699
+ *
700
+ * @param props - The block and its session. Do not destructure.
701
+ * @returns Your UI for the block, or `undefined` or `null` to keep the code.
702
+ */
703
+ render(props: CodeBlockProps): JSX.Element | undefined;
704
+ }
705
+ /**
706
+ * A button beside the Copy button of the fenced code blocks of some languages, for example "Run in terminal" for
707
+ * ```` ```sh ````. It shows where `CodeBlock` content shows, once the block's closing fence arrives, so it never acts on
708
+ * half a block. Buttons reveal with Copy on hover or focus.
709
+ */
710
+ export interface CodeBlockAction {
711
+ /** The action's id, unique within the plugin. */
712
+ readonly id: string;
713
+ /**
714
+ * The languages whose blocks show the button, compared with `CodeBlockProps.language`, e.g. `["sh", "bash", "shell"]`.
715
+ * The host resolves no aliases: list each name you accept.
716
+ */
717
+ readonly languages: readonly string[];
718
+ /** The button's icon. */
719
+ readonly icon: IconName;
720
+ /** The button's accessible name and tooltip. Read it from a getter so it follows the locale. */
721
+ readonly title: string;
722
+ /** Buttons list in ascending order, before Copy. Defaults to 0; ties keep contribution order. */
723
+ readonly order?: number;
724
+ /**
725
+ * Runs when the user clicks the button. A throw or a rejection is logged under your plugin and changes nothing else.
726
+ *
727
+ * @param input - The clicked block and its session. Do not destructure.
728
+ */
729
+ run(input: CodeBlockProps): void | Promise<void>;
730
+ }
731
+ /**
732
+ * The seed colors a theme variant generates its scales from. Each is a hex color: `#rgb`, `#rgba`, `#rrggbb` or
733
+ * `#rrggbbaa`.
734
+ */
735
+ export interface ThemeSeedColors {
736
+ /** Base of the gray scale. */
737
+ readonly neutral: string;
738
+ /** The brand and accent color. */
739
+ readonly primary: string;
740
+ /** Success states, usually green. */
741
+ readonly success: string;
742
+ /** Warning states, usually yellow or orange. */
743
+ readonly warning: string;
744
+ /** Error and critical states, usually red. */
745
+ readonly error: string;
746
+ /** Informational states, usually blue or purple. */
747
+ readonly info: string;
748
+ /** Links and interactive elements. */
749
+ readonly interactive: string;
750
+ /** Added lines in diffs. */
751
+ readonly diffAdd: string;
752
+ /** Deleted lines in diffs. */
753
+ readonly diffDelete: string;
754
+ }
755
+ /**
756
+ * The palette a theme variant derives its colors from, the form most of the app's own themes use. Each is a hex color:
757
+ * `#rgb`, `#rgba`, `#rrggbb` or `#rrggbbaa`.
758
+ */
759
+ export interface ThemePaletteColors {
760
+ /** The background the neutral scale starts from. */
761
+ readonly neutral: string;
762
+ /** The text color the neutral scale ends at. */
763
+ readonly ink: string;
764
+ /** The brand color. */
765
+ readonly primary: string;
766
+ /** Success states, usually green. */
767
+ readonly success: string;
768
+ /** Warning states, usually yellow or orange. */
769
+ readonly warning: string;
770
+ /** Error and critical states, usually red. */
771
+ readonly error: string;
772
+ /** Informational states, usually blue or purple. */
773
+ readonly info: string;
774
+ /** A secondary accent. Defaults to `info`. */
775
+ readonly accent?: string;
776
+ /** Links and interactive elements. Defaults to `primary`. */
777
+ readonly interactive?: string;
778
+ /** Added lines in diffs. Defaults to one derived from `success`. */
779
+ readonly diffAdd?: string;
780
+ /** Deleted lines in diffs. Defaults to one derived from `error`. */
781
+ readonly diffDelete?: string;
782
+ }
783
+ /** The fields every theme variant can have, whichever colors it starts from. */
784
+ interface ThemeVariantBase {
785
+ /** Exact values for single tokens, such as `syntax-keyword`: a hex color or a `var(--token)` reference. */
786
+ readonly overrides?: Readonly<Record<string, string>>;
787
+ /** Exact values for single tokens of the app's newer token set: a hex color, a `var(--token)` reference, or CSS. */
788
+ readonly v2Overrides?: Readonly<Record<string, string>>;
789
+ }
790
+ /** The colors of one color scheme of a `Theme`: generated from `seeds` or from a `palette`, never both. */
791
+ export type ThemeVariant = (ThemeVariantBase & {
792
+ /** The seed colors to generate from. */
793
+ readonly seeds: ThemeSeedColors;
794
+ /** Not allowed beside `seeds`. */
795
+ readonly palette?: never;
796
+ }) | (ThemeVariantBase & {
797
+ /** The palette to derive from. */
798
+ readonly palette: ThemePaletteColors;
799
+ /** Not allowed beside `palette`. */
800
+ readonly seeds?: never;
801
+ });
802
+ /**
803
+ * A color theme, in the format of the app's own themes (`https://opencode.ai/desktop-theme.json`), so a theme file
804
+ * imports as it is. The host lists it in Settings › Appearance › Theme among the app's themes, alphabetically by
805
+ * `name`, under the key `${plugin}:${id}`; withdrawing the theme takes it out of the list. A user who picked it keeps the choice: the window
806
+ * shows the theme's colors from the last run until the plugin contributes it again, and the default theme while it is
807
+ * withdrawn.
808
+ */
809
+ export interface Theme {
810
+ /** The JSON Schema reference of a theme file. Ignored. */
811
+ readonly $schema?: string;
812
+ /** The name the theme list shows. */
813
+ readonly name: string;
814
+ /** The theme's id, unique within the plugin, in lowercase letters, digits and hyphens. */
815
+ readonly id: string;
816
+ /** The light color scheme. */
817
+ readonly light: ThemeVariant;
818
+ /** The dark color scheme. */
819
+ readonly dark: ThemeVariant;
820
+ }
645
821
  /** The places a `Slot` renders, with the input each passes to `render`. */
646
822
  export interface SlotMap {
647
823
  /** Full-width strip under the window content, above toasts. */
@@ -661,7 +837,10 @@ export interface SlotMap {
661
837
  */
662
838
  readonly compact: boolean;
663
839
  };
664
- /** Items in the project/location menu, after its location details. Omitted on loading headers without a screen. */
840
+ /**
841
+ * Items in the project/location menu, after its location details. Omitted on loading headers without a screen.
842
+ * Render rows with `Ui.MenuItem`, `Ui.MenuSub`, `Ui.MenuGroup` and `Ui.MenuSeparator`, so they match the host's.
843
+ */
665
844
  readonly "session.location.menu": {
666
845
  /** The menu's owning session screen; always present. */
667
846
  readonly screen: SessionScreen;
@@ -786,6 +965,39 @@ export declare const TitlebarItem: Registry<TitlebarItem>;
786
965
  * ```
787
966
  */
788
967
  export declare const ComposerPill: Registry<ComposerPill>;
968
+ /**
969
+ * The registry of renderers for fenced code blocks, by language.
970
+ *
971
+ * @example
972
+ * ```tsx
973
+ * ctx.add(CodeBlock, {
974
+ * languages: ["csv"],
975
+ * render: (props) => {
976
+ * const rows = parseCsv(props.code)
977
+ *
978
+ * return rows ? <CsvTable rows={rows} /> : undefined
979
+ * },
980
+ * })
981
+ * ```
982
+ */
983
+ export declare const CodeBlock: Registry<CodeBlock>;
984
+ /**
985
+ * The registry of buttons beside a fenced code block's Copy button, by language.
986
+ *
987
+ * @example
988
+ * ```ts
989
+ * ctx.add(CodeBlockAction, {
990
+ * id: "run",
991
+ * languages: ["sh", "bash", "shell"],
992
+ * icon: "terminal",
993
+ * get title() {
994
+ * return ctx.t("run")
995
+ * },
996
+ * run: (input) => runInTerminal(input.code, input.session),
997
+ * })
998
+ * ```
999
+ */
1000
+ export declare const CodeBlockAction: Registry<CodeBlockAction>;
789
1001
  /**
790
1002
  * The registry of content for the host's slots (`SlotMap`).
791
1003
  *
@@ -805,3 +1017,13 @@ export declare const Slot: Registry<Slot>;
805
1017
  * ```
806
1018
  */
807
1019
  export declare const Style: Registry<string>;
1020
+ /**
1021
+ * The registry of color themes the user can pick in Settings › Appearance, in the format of the app's own theme files.
1022
+ *
1023
+ * @example
1024
+ * ```ts
1025
+ * import theme from "./midnight.json"
1026
+ * ctx.add(Theme, theme)
1027
+ * ```
1028
+ */
1029
+ export declare const Theme: Registry<Theme>;
@@ -89,6 +89,39 @@ export const TitlebarItem = Registry.define("titlebar-item");
89
89
  * ```
90
90
  */
91
91
  export const ComposerPill = Registry.define("composer-pill");
92
+ /**
93
+ * The registry of renderers for fenced code blocks, by language.
94
+ *
95
+ * @example
96
+ * ```tsx
97
+ * ctx.add(CodeBlock, {
98
+ * languages: ["csv"],
99
+ * render: (props) => {
100
+ * const rows = parseCsv(props.code)
101
+ *
102
+ * return rows ? <CsvTable rows={rows} /> : undefined
103
+ * },
104
+ * })
105
+ * ```
106
+ */
107
+ export const CodeBlock = Registry.define("code-block");
108
+ /**
109
+ * The registry of buttons beside a fenced code block's Copy button, by language.
110
+ *
111
+ * @example
112
+ * ```ts
113
+ * ctx.add(CodeBlockAction, {
114
+ * id: "run",
115
+ * languages: ["sh", "bash", "shell"],
116
+ * icon: "terminal",
117
+ * get title() {
118
+ * return ctx.t("run")
119
+ * },
120
+ * run: (input) => runInTerminal(input.code, input.session),
121
+ * })
122
+ * ```
123
+ */
124
+ export const CodeBlockAction = Registry.define("code-block-action");
92
125
  /**
93
126
  * The registry of content for the host's slots (`SlotMap`).
94
127
  *
@@ -108,3 +141,13 @@ export const Slot = Registry.define("slot");
108
141
  * ```
109
142
  */
110
143
  export const Style = Registry.define("style");
144
+ /**
145
+ * The registry of color themes the user can pick in Settings › Appearance, in the format of the app's own theme files.
146
+ *
147
+ * @example
148
+ * ```ts
149
+ * import theme from "./midnight.json"
150
+ * ctx.add(Theme, theme)
151
+ * ```
152
+ */
153
+ export const Theme = Registry.define("theme");
@@ -18,7 +18,8 @@ export interface Changes {
18
18
  */
19
19
  diffs(session: SessionRef): readonly FileDiffInfo[];
20
20
  /**
21
- * False while the current mode's diffs load.
21
+ * True once the current mode's diffs loaded, or the project has no repository. False while they load, after their
22
+ * request failed or timed out, while the server is unreachable, and before anything requested them.
22
23
  *
23
24
  * @param session - The session to read.
24
25
  * @returns Whether the diffs loaded.
@@ -59,6 +59,18 @@ export interface SessionTitle extends SessionRequest {
59
59
  * hook identity but need to be told apart from the agent loop.
60
60
  */
61
61
  export type SessionRequestKind = "primary" | "compaction" | "title" | "generate";
62
+ /**
63
+ * Runs whenever a Session resolves the model for a request, before anything is built for it. `model` starts as the
64
+ * Session's or agent's selection; change it to serve this request with another model from the same provider, including
65
+ * models hidden from the picker. The Session keeps its selection, and the request and its records use the new model.
66
+ * Router models such as GitHub Copilot's Auto use it. Experimental.
67
+ */
68
+ export interface SessionModelResolve {
69
+ readonly sessionID: Session.ID;
70
+ readonly agent: Agent.ID;
71
+ readonly kind: SessionRequestKind;
72
+ model: Model.Ref;
73
+ }
62
74
  export interface SessionModelRequest {
63
75
  readonly sessionID: Session.ID;
64
76
  readonly agent: Agent.ID;
@@ -174,6 +186,7 @@ export interface SessionHooks {
174
186
  readonly compaction: SessionCompaction;
175
187
  readonly generate: SessionGenerate;
176
188
  readonly title: SessionTitle;
189
+ readonly "experimental.model.resolve": SessionModelResolve;
177
190
  readonly "model.request": SessionModelRequest;
178
191
  readonly "http.request": SessionHttpRequest;
179
192
  readonly "http.response": SessionHttpResponse;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/plugin",
4
- "version": "2.2.5",
4
+ "version": "2.2.7",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -14,56 +14,56 @@
14
14
  },
15
15
  "exports": {
16
16
  ".": {
17
- "import": "./dist/promise/index.js",
18
- "types": "./dist/promise/index.d.ts"
17
+ "types": "./dist/promise/index.d.ts",
18
+ "import": "./dist/promise/index.js"
19
19
  },
20
20
  "./effect": {
21
- "import": "./dist/effect/index.js",
22
- "types": "./dist/effect/index.d.ts"
21
+ "types": "./dist/effect/index.d.ts",
22
+ "import": "./dist/effect/index.js"
23
23
  },
24
24
  "./host": {
25
- "import": "./dist/host.js",
26
- "types": "./dist/host.d.ts"
25
+ "types": "./dist/host.d.ts",
26
+ "import": "./dist/host.js"
27
27
  },
28
28
  "./runtime": {
29
- "import": "./dist/runtime.js",
30
- "types": "./dist/runtime.d.ts"
29
+ "types": "./dist/runtime.d.ts",
30
+ "import": "./dist/runtime.js"
31
31
  },
32
32
  "./tui": {
33
- "import": "./dist/tui/index.js",
34
- "types": "./dist/tui/index.d.ts"
33
+ "types": "./dist/tui/index.d.ts",
34
+ "import": "./dist/tui/index.js"
35
35
  },
36
36
  "./gui": {
37
- "import": "./dist/gui/index.js",
38
- "types": "./dist/gui/index.d.ts"
37
+ "types": "./dist/gui/index.d.ts",
38
+ "import": "./dist/gui/index.js"
39
39
  },
40
40
  "./gui/main": {
41
- "import": "./dist/gui/main.js",
42
- "types": "./dist/gui/main.d.ts"
41
+ "types": "./dist/gui/main.d.ts",
42
+ "import": "./dist/gui/main.js"
43
43
  },
44
44
  "./gui/host": null,
45
45
  "./gui/builtin": null,
46
46
  "./gui/file": {
47
- "import": "./dist/gui/file.js",
48
- "types": "./dist/gui/file.d.ts"
47
+ "types": "./dist/gui/file.d.ts",
48
+ "import": "./dist/gui/file.js"
49
49
  },
50
50
  "./gui/review": {
51
- "import": "./dist/gui/review.js",
52
- "types": "./dist/gui/review.d.ts"
51
+ "types": "./dist/gui/review.d.ts",
52
+ "import": "./dist/gui/review.js"
53
53
  },
54
54
  "./gui/browser": {
55
- "import": "./dist/gui/browser.js",
56
- "types": "./dist/gui/browser.d.ts"
55
+ "types": "./dist/gui/browser.d.ts",
56
+ "import": "./dist/gui/browser.js"
57
57
  },
58
58
  "./gui/updater": null,
59
59
  "./gui/vite": {
60
- "import": "./dist/gui/vite.js",
61
- "types": "./dist/gui/vite.d.ts"
60
+ "types": "./dist/gui/vite.d.ts",
61
+ "import": "./dist/gui/vite.js"
62
62
  },
63
63
  "./gui/*": null,
64
64
  "./*": {
65
- "import": "./dist/*.js",
66
- "types": "./dist/*.d.ts"
65
+ "types": "./dist/*.d.ts",
66
+ "import": "./dist/*.js"
67
67
  }
68
68
  },
69
69
  "imports": {
@@ -78,17 +78,17 @@
78
78
  ],
79
79
  "dependencies": {
80
80
  "@ai-sdk/provider": "3.0.8",
81
- "@opencode/ai": "2.2.5",
82
- "@opencode/client": "2.2.5",
83
- "@opencode/protocol": "2.2.5",
84
- "@opencode/schema": "2.2.5",
85
- "@opencode/util": "2.2.5",
86
- "effect": "4.0.6"
81
+ "@opencode/ai": "2.2.7",
82
+ "@opencode/client": "2.2.7",
83
+ "@opencode/protocol": "2.2.7",
84
+ "@opencode/schema": "2.2.7",
85
+ "@opencode/util": "2.2.7",
86
+ "effect": "4.1.0"
87
87
  },
88
88
  "peerDependencies": {
89
- "@opencode/theme": "2.2.5",
90
- "@opentui/core": ">=0.8.0",
91
- "@opentui/solid": ">=0.8.0",
89
+ "@opencode/theme": "2.2.7",
90
+ "@opentui/core": ">=0.8.1",
91
+ "@opentui/solid": ">=0.8.1",
92
92
  "electron": "*",
93
93
  "solid-js": ">=1.9.0",
94
94
  "vite": ">=6",
@@ -118,9 +118,9 @@
118
118
  }
119
119
  },
120
120
  "devDependencies": {
121
- "@opencode/theme": "2.2.5",
122
- "@opentui/core": "0.8.0",
123
- "@opentui/solid": "0.8.0",
121
+ "@opencode/theme": "2.2.7",
122
+ "@opentui/core": "0.8.1",
123
+ "@opentui/solid": "0.8.1",
124
124
  "@tsconfig/bun": "1.0.9",
125
125
  "@types/bun": "1.4.3",
126
126
  "@types/node": "24.12.2",