@opencode/plugin 0.0.0-dev-552 → 0.0.0-dev-555

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.
@@ -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.
@@ -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
  /**
@@ -642,6 +652,96 @@ export interface ComposerPill {
642
652
  */
643
653
  menu?(input: ComposerPillMenuProps): JSX.Element;
644
654
  }
655
+ /**
656
+ * The seed colors a theme variant generates its scales from. Each is a hex color: `#rgb`, `#rgba`, `#rrggbb` or
657
+ * `#rrggbbaa`.
658
+ */
659
+ export interface ThemeSeedColors {
660
+ /** Base of the gray scale. */
661
+ readonly neutral: string;
662
+ /** The brand and accent color. */
663
+ readonly primary: string;
664
+ /** Success states, usually green. */
665
+ readonly success: string;
666
+ /** Warning states, usually yellow or orange. */
667
+ readonly warning: string;
668
+ /** Error and critical states, usually red. */
669
+ readonly error: string;
670
+ /** Informational states, usually blue or purple. */
671
+ readonly info: string;
672
+ /** Links and interactive elements. */
673
+ readonly interactive: string;
674
+ /** Added lines in diffs. */
675
+ readonly diffAdd: string;
676
+ /** Deleted lines in diffs. */
677
+ readonly diffDelete: string;
678
+ }
679
+ /**
680
+ * The palette a theme variant derives its colors from, the form most of the app's own themes use. Each is a hex color:
681
+ * `#rgb`, `#rgba`, `#rrggbb` or `#rrggbbaa`.
682
+ */
683
+ export interface ThemePaletteColors {
684
+ /** The background the neutral scale starts from. */
685
+ readonly neutral: string;
686
+ /** The text color the neutral scale ends at. */
687
+ readonly ink: string;
688
+ /** The brand color. */
689
+ readonly primary: string;
690
+ /** Success states, usually green. */
691
+ readonly success: string;
692
+ /** Warning states, usually yellow or orange. */
693
+ readonly warning: string;
694
+ /** Error and critical states, usually red. */
695
+ readonly error: string;
696
+ /** Informational states, usually blue or purple. */
697
+ readonly info: string;
698
+ /** A secondary accent. Defaults to `info`. */
699
+ readonly accent?: string;
700
+ /** Links and interactive elements. Defaults to `primary`. */
701
+ readonly interactive?: string;
702
+ /** Added lines in diffs. Defaults to one derived from `success`. */
703
+ readonly diffAdd?: string;
704
+ /** Deleted lines in diffs. Defaults to one derived from `error`. */
705
+ readonly diffDelete?: string;
706
+ }
707
+ /** The fields every theme variant can have, whichever colors it starts from. */
708
+ interface ThemeVariantBase {
709
+ /** Exact values for single tokens, such as `syntax-keyword`: a hex color or a `var(--token)` reference. */
710
+ readonly overrides?: Readonly<Record<string, string>>;
711
+ /** Exact values for single tokens of the app's newer token set: a hex color, a `var(--token)` reference, or CSS. */
712
+ readonly v2Overrides?: Readonly<Record<string, string>>;
713
+ }
714
+ /** The colors of one color scheme of a `Theme`: generated from `seeds` or from a `palette`, never both. */
715
+ export type ThemeVariant = (ThemeVariantBase & {
716
+ /** The seed colors to generate from. */
717
+ readonly seeds: ThemeSeedColors;
718
+ /** Not allowed beside `seeds`. */
719
+ readonly palette?: never;
720
+ }) | (ThemeVariantBase & {
721
+ /** The palette to derive from. */
722
+ readonly palette: ThemePaletteColors;
723
+ /** Not allowed beside `palette`. */
724
+ readonly seeds?: never;
725
+ });
726
+ /**
727
+ * A color theme, in the format of the app's own themes (`https://opencode.ai/desktop-theme.json`), so a theme file
728
+ * imports as it is. The host lists it in Settings › Appearance › Theme among the app's themes, alphabetically by
729
+ * `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
730
+ * shows the theme's colors from the last run until the plugin contributes it again, and the default theme while it is
731
+ * withdrawn.
732
+ */
733
+ export interface Theme {
734
+ /** The JSON Schema reference of a theme file. Ignored. */
735
+ readonly $schema?: string;
736
+ /** The name the theme list shows. */
737
+ readonly name: string;
738
+ /** The theme's id, unique within the plugin, in lowercase letters, digits and hyphens. */
739
+ readonly id: string;
740
+ /** The light color scheme. */
741
+ readonly light: ThemeVariant;
742
+ /** The dark color scheme. */
743
+ readonly dark: ThemeVariant;
744
+ }
645
745
  /** The places a `Slot` renders, with the input each passes to `render`. */
646
746
  export interface SlotMap {
647
747
  /** Full-width strip under the window content, above toasts. */
@@ -805,3 +905,13 @@ export declare const Slot: Registry<Slot>;
805
905
  * ```
806
906
  */
807
907
  export declare const Style: Registry<string>;
908
+ /**
909
+ * The registry of color themes the user can pick in Settings › Appearance, in the format of the app's own theme files.
910
+ *
911
+ * @example
912
+ * ```ts
913
+ * import theme from "./midnight.json"
914
+ * ctx.add(Theme, theme)
915
+ * ```
916
+ */
917
+ export declare const Theme: Registry<Theme>;
@@ -108,3 +108,13 @@ export const Slot = Registry.define("slot");
108
108
  * ```
109
109
  */
110
110
  export const Style = Registry.define("style");
111
+ /**
112
+ * The registry of color themes the user can pick in Settings › Appearance, in the format of the app's own theme files.
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * import theme from "./midnight.json"
117
+ * ctx.add(Theme, theme)
118
+ * ```
119
+ */
120
+ export const Theme = Registry.define("theme");
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": "0.0.0-dev-552",
4
+ "version": "0.0.0-dev-555",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -78,15 +78,15 @@
78
78
  ],
79
79
  "dependencies": {
80
80
  "@ai-sdk/provider": "3.0.8",
81
- "@opencode/ai": "0.0.0-dev-552",
82
- "@opencode/client": "0.0.0-dev-552",
83
- "@opencode/protocol": "0.0.0-dev-552",
84
- "@opencode/schema": "0.0.0-dev-552",
85
- "@opencode/util": "0.0.0-dev-552",
81
+ "@opencode/ai": "0.0.0-dev-555",
82
+ "@opencode/client": "0.0.0-dev-555",
83
+ "@opencode/protocol": "0.0.0-dev-555",
84
+ "@opencode/schema": "0.0.0-dev-555",
85
+ "@opencode/util": "0.0.0-dev-555",
86
86
  "effect": "4.1.0"
87
87
  },
88
88
  "peerDependencies": {
89
- "@opencode/theme": "0.0.0-dev-552",
89
+ "@opencode/theme": "0.0.0-dev-555",
90
90
  "@opentui/core": ">=0.8.1",
91
91
  "@opentui/solid": ">=0.8.1",
92
92
  "electron": "*",
@@ -118,7 +118,7 @@
118
118
  }
119
119
  },
120
120
  "devDependencies": {
121
- "@opencode/theme": "0.0.0-dev-552",
121
+ "@opencode/theme": "0.0.0-dev-555",
122
122
  "@opentui/core": "0.8.1",
123
123
  "@opentui/solid": "0.8.1",
124
124
  "@tsconfig/bun": "1.0.9",