@opencode-ai/plugin 0.0.0-next-16391 → 0.0.0-next-16413

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.
@@ -96,7 +96,20 @@ export interface Page {
96
96
  readonly data?: Record<string, any>;
97
97
  }) => JSX.Element;
98
98
  }
99
- export type Slot = (props: Record<string, any>) => JSX.Element;
99
+ export interface SlotMap {
100
+ readonly app: Readonly<Record<string, never>>;
101
+ readonly "home.footer": Readonly<Record<string, never>>;
102
+ readonly "sidebar.content": {
103
+ readonly sessionID: string;
104
+ };
105
+ readonly "sidebar.footer": Readonly<Record<string, never>>;
106
+ }
107
+ export type SlotName = keyof SlotMap;
108
+ export type Slot<Name extends SlotName = SlotName> = (props: SlotMap[Name]) => JSX.Element;
109
+ export interface App {
110
+ readonly version: string;
111
+ readonly channel: string;
112
+ }
100
113
  export type ToastVariant = "info" | "success" | "warning" | "error";
101
114
  export interface ToastOptions {
102
115
  readonly title?: string;
@@ -257,16 +270,20 @@ export interface Keymap {
257
270
  export interface UI {
258
271
  readonly dialog: Dialog;
259
272
  readonly toast: Toast;
273
+ readonly format: {
274
+ path(value: string): string;
275
+ };
260
276
  readonly router: {
261
277
  register(page: Page): () => void;
262
278
  navigate(destination: Destination): void;
263
279
  current(): Route;
264
280
  };
265
- readonly slot: (name: string, render: Slot) => () => void;
281
+ readonly slot: <Name extends SlotName>(name: Name, render: Slot<Name>) => () => void;
266
282
  }
267
283
  export interface Context {
268
284
  readonly options: Readonly<Record<string, any>>;
269
285
  readonly location: LocationRef | undefined;
286
+ readonly app: App;
270
287
  readonly renderer: CliRenderer;
271
288
  readonly client: OpenCodeClient;
272
289
  readonly data: Data;
@@ -1 +1,2 @@
1
1
  export * as Plugin from "./plugin.js";
2
+ export { PluginContextProvider, usePlugin } from "./solid.js";
package/dist/tui/index.js CHANGED
@@ -1 +1,2 @@
1
1
  export * as Plugin from "./plugin.js";
2
+ export { PluginContextProvider, usePlugin } from "./solid.js";
@@ -0,0 +1,7 @@
1
+ import { type JSX } from "solid-js";
2
+ import type { Context } from "./context.js";
3
+ export declare function PluginContextProvider(props: {
4
+ readonly value: Context;
5
+ readonly children: JSX.Element;
6
+ }): JSX.Element;
7
+ export declare function usePlugin(): Context;
@@ -0,0 +1,16 @@
1
+ import { createComponent, createContext, useContext } from "solid-js";
2
+ const PluginContext = createContext();
3
+ export function PluginContextProvider(props) {
4
+ return createComponent(PluginContext.Provider, {
5
+ value: props.value,
6
+ get children() {
7
+ return props.children;
8
+ },
9
+ });
10
+ }
11
+ export function usePlugin() {
12
+ const context = useContext(PluginContext);
13
+ if (!context)
14
+ throw new Error("PluginContextProvider is missing");
15
+ return context;
16
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode-ai/plugin",
4
- "version": "0.0.0-next-16391",
4
+ "version": "0.0.0-next-16413",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -36,9 +36,9 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@ai-sdk/provider": "3.0.8",
39
- "@opencode-ai/ai": "0.0.0-next-16391",
40
- "@opencode-ai/client": "0.0.0-next-16391",
41
- "@opencode-ai/schema": "0.0.0-next-16391",
39
+ "@opencode-ai/ai": "0.0.0-next-16413",
40
+ "@opencode-ai/client": "0.0.0-next-16413",
41
+ "@opencode-ai/schema": "0.0.0-next-16413",
42
42
  "@opencode-ai/sdk": "1.18.5",
43
43
  "@standard-schema/spec": "1.1.0",
44
44
  "effect": "4.0.0-beta.101",
@@ -47,7 +47,8 @@
47
47
  "peerDependencies": {
48
48
  "@opentui/core": ">=0.4.5",
49
49
  "@opentui/keymap": ">=0.4.5",
50
- "@opentui/solid": ">=0.4.5"
50
+ "@opentui/solid": ">=0.4.5",
51
+ "solid-js": ">=1.9.0"
51
52
  },
52
53
  "peerDependenciesMeta": {
53
54
  "@opentui/core": {
@@ -58,6 +59,9 @@
58
59
  },
59
60
  "@opentui/solid": {
60
61
  "optional": true
62
+ },
63
+ "solid-js": {
64
+ "optional": true
61
65
  }
62
66
  },
63
67
  "devDependencies": {
@@ -67,6 +71,7 @@
67
71
  "@tsconfig/bun": "1.0.9",
68
72
  "@tsconfig/node22": "22.0.2",
69
73
  "@types/node": "24.12.2",
74
+ "solid-js": "1.9.10",
70
75
  "typescript": "5.8.2",
71
76
  "@typescript/native-preview": "7.0.0-dev.20251207.1"
72
77
  }