@opencode-ai/plugin 0.0.0-snapshot-node-pty-202602201113 → 0.0.0-snapshot-tui-plugins-202603112046
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.
- package/dist/index.d.ts +6 -2
- package/dist/tui.d.ts +198 -0
- package/dist/tui.js +0 -0
- package/package.json +15 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Event, createOpencodeClient, Project, Model, Provider, Permission, UserMessage, Message, Part, Auth, Config } from "@opencode-ai/sdk";
|
|
1
|
+
import type { Event, createOpencodeClient, Project, Model, Provider, Permission, UserMessage, Message, Part, Auth, Config as SDKConfig } from "@opencode-ai/sdk";
|
|
2
2
|
import type { BunShell } from "./shell";
|
|
3
3
|
import { type ToolDefinition } from "./tool";
|
|
4
4
|
export * from "./tool";
|
|
@@ -15,7 +15,11 @@ export type PluginInput = {
|
|
|
15
15
|
serverUrl: URL;
|
|
16
16
|
$: BunShell;
|
|
17
17
|
};
|
|
18
|
-
export type
|
|
18
|
+
export type PluginOptions = Record<string, unknown>;
|
|
19
|
+
export type Config = Omit<SDKConfig, "plugin"> & {
|
|
20
|
+
plugin?: Array<string | [string, PluginOptions]>;
|
|
21
|
+
};
|
|
22
|
+
export type Plugin = (input: PluginInput, options?: PluginOptions) => Promise<Hooks>;
|
|
19
23
|
export type AuthHook = {
|
|
20
24
|
provider: string;
|
|
21
25
|
loader?: (auth: () => Promise<Auth>, provider: Provider) => Promise<Record<string, any>>;
|
package/dist/tui.d.ts
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import type { createOpencodeClient as createOpencodeClientV2, Event as TuiEvent } from "@opencode-ai/sdk/v2";
|
|
2
|
+
import type { CliRenderer, ParsedKey, Plugin as CorePlugin } from "@opentui/core";
|
|
3
|
+
import type { Plugin as ServerPlugin, PluginOptions } from "./index";
|
|
4
|
+
export type { CliRenderer, SlotMode } from "@opentui/core";
|
|
5
|
+
export type TuiRouteCurrent = {
|
|
6
|
+
name: "home";
|
|
7
|
+
} | {
|
|
8
|
+
name: "session";
|
|
9
|
+
params: {
|
|
10
|
+
sessionID: string;
|
|
11
|
+
initialPrompt?: unknown;
|
|
12
|
+
};
|
|
13
|
+
} | {
|
|
14
|
+
name: string;
|
|
15
|
+
params?: Record<string, unknown>;
|
|
16
|
+
};
|
|
17
|
+
export type TuiRouteDefinition<Node = unknown> = {
|
|
18
|
+
name: string;
|
|
19
|
+
render: (input: {
|
|
20
|
+
params?: Record<string, unknown>;
|
|
21
|
+
}) => Node;
|
|
22
|
+
};
|
|
23
|
+
export type TuiCommand = {
|
|
24
|
+
title: string;
|
|
25
|
+
value: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
category?: string;
|
|
28
|
+
keybind?: string;
|
|
29
|
+
suggested?: boolean;
|
|
30
|
+
hidden?: boolean;
|
|
31
|
+
enabled?: boolean;
|
|
32
|
+
slash?: {
|
|
33
|
+
name: string;
|
|
34
|
+
aliases?: string[];
|
|
35
|
+
};
|
|
36
|
+
onSelect?: () => void;
|
|
37
|
+
};
|
|
38
|
+
export type TuiKeybind = {
|
|
39
|
+
name: string;
|
|
40
|
+
ctrl: boolean;
|
|
41
|
+
meta: boolean;
|
|
42
|
+
shift: boolean;
|
|
43
|
+
super?: boolean;
|
|
44
|
+
leader: boolean;
|
|
45
|
+
};
|
|
46
|
+
export type TuiKeybindMap = Record<string, string>;
|
|
47
|
+
export type TuiKeybindSet = {
|
|
48
|
+
readonly all: TuiKeybindMap;
|
|
49
|
+
get: (name: string) => string;
|
|
50
|
+
parse: (evt: ParsedKey) => TuiKeybind;
|
|
51
|
+
match: (name: string, evt: ParsedKey) => boolean;
|
|
52
|
+
print: (name: string) => string;
|
|
53
|
+
};
|
|
54
|
+
export type TuiDialogProps<Node = unknown> = {
|
|
55
|
+
size?: "medium" | "large";
|
|
56
|
+
onClose: () => void;
|
|
57
|
+
children?: Node;
|
|
58
|
+
};
|
|
59
|
+
export type TuiDialogStack<Node = unknown> = {
|
|
60
|
+
replace: (render: () => Node, onClose?: () => void) => void;
|
|
61
|
+
clear: () => void;
|
|
62
|
+
setSize: (size: "medium" | "large") => void;
|
|
63
|
+
readonly size: "medium" | "large";
|
|
64
|
+
readonly depth: number;
|
|
65
|
+
readonly open: boolean;
|
|
66
|
+
};
|
|
67
|
+
export type TuiDialogAlertProps = {
|
|
68
|
+
title: string;
|
|
69
|
+
message: string;
|
|
70
|
+
onConfirm?: () => void;
|
|
71
|
+
};
|
|
72
|
+
export type TuiDialogConfirmProps = {
|
|
73
|
+
title: string;
|
|
74
|
+
message: string;
|
|
75
|
+
onConfirm?: () => void;
|
|
76
|
+
onCancel?: () => void;
|
|
77
|
+
};
|
|
78
|
+
export type TuiDialogPromptProps<Node = unknown> = {
|
|
79
|
+
title: string;
|
|
80
|
+
description?: () => Node;
|
|
81
|
+
placeholder?: string;
|
|
82
|
+
value?: string;
|
|
83
|
+
onConfirm?: (value: string) => void;
|
|
84
|
+
onCancel?: () => void;
|
|
85
|
+
};
|
|
86
|
+
export type TuiDialogSelectOption<Value = unknown, Node = unknown> = {
|
|
87
|
+
title: string;
|
|
88
|
+
value: Value;
|
|
89
|
+
description?: string;
|
|
90
|
+
footer?: Node | string;
|
|
91
|
+
category?: string;
|
|
92
|
+
disabled?: boolean;
|
|
93
|
+
onSelect?: () => void;
|
|
94
|
+
};
|
|
95
|
+
export type TuiDialogSelectProps<Value = unknown, Node = unknown> = {
|
|
96
|
+
title: string;
|
|
97
|
+
placeholder?: string;
|
|
98
|
+
options: TuiDialogSelectOption<Value, Node>[];
|
|
99
|
+
flat?: boolean;
|
|
100
|
+
onMove?: (option: TuiDialogSelectOption<Value, Node>) => void;
|
|
101
|
+
onFilter?: (query: string) => void;
|
|
102
|
+
onSelect?: (option: TuiDialogSelectOption<Value, Node>) => void;
|
|
103
|
+
skipFilter?: boolean;
|
|
104
|
+
current?: Value;
|
|
105
|
+
};
|
|
106
|
+
export type TuiToast = {
|
|
107
|
+
variant?: "info" | "success" | "warning" | "error";
|
|
108
|
+
title?: string;
|
|
109
|
+
message: string;
|
|
110
|
+
duration?: number;
|
|
111
|
+
};
|
|
112
|
+
export type TuiTheme = {
|
|
113
|
+
readonly current: Record<string, unknown>;
|
|
114
|
+
readonly selected: string;
|
|
115
|
+
has: (name: string) => boolean;
|
|
116
|
+
set: (name: string) => boolean;
|
|
117
|
+
install: (jsonPath: string) => Promise<void>;
|
|
118
|
+
mode: () => "dark" | "light";
|
|
119
|
+
readonly ready: boolean;
|
|
120
|
+
};
|
|
121
|
+
export type TuiApi<Node = unknown> = {
|
|
122
|
+
command: {
|
|
123
|
+
register: (cb: () => TuiCommand[]) => void;
|
|
124
|
+
trigger: (value: string) => void;
|
|
125
|
+
};
|
|
126
|
+
route: {
|
|
127
|
+
register: (routes: TuiRouteDefinition<Node>[]) => () => void;
|
|
128
|
+
navigate: (name: string, params?: Record<string, unknown>) => void;
|
|
129
|
+
readonly current: TuiRouteCurrent;
|
|
130
|
+
};
|
|
131
|
+
ui: {
|
|
132
|
+
Dialog: (props: TuiDialogProps<Node>) => Node;
|
|
133
|
+
DialogAlert: (props: TuiDialogAlertProps) => Node;
|
|
134
|
+
DialogConfirm: (props: TuiDialogConfirmProps) => Node;
|
|
135
|
+
DialogPrompt: (props: TuiDialogPromptProps<Node>) => Node;
|
|
136
|
+
DialogSelect: <Value = unknown>(props: TuiDialogSelectProps<Value, Node>) => Node;
|
|
137
|
+
toast: (input: TuiToast) => void;
|
|
138
|
+
dialog: TuiDialogStack<Node>;
|
|
139
|
+
};
|
|
140
|
+
keybind: {
|
|
141
|
+
parse: (evt: ParsedKey) => TuiKeybind;
|
|
142
|
+
match: (key: string, evt: ParsedKey) => boolean;
|
|
143
|
+
print: (key: string) => string;
|
|
144
|
+
create: (defaults: TuiKeybindMap, overrides?: Record<string, unknown>) => TuiKeybindSet;
|
|
145
|
+
};
|
|
146
|
+
theme: TuiTheme;
|
|
147
|
+
};
|
|
148
|
+
export type TuiSlotMap = {
|
|
149
|
+
app: {};
|
|
150
|
+
home_logo: {};
|
|
151
|
+
sidebar_top: {
|
|
152
|
+
session_id: string;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
export type TuiSlotContext = {
|
|
156
|
+
theme: TuiTheme;
|
|
157
|
+
};
|
|
158
|
+
export type TuiSlotPlugin<Node = unknown> = CorePlugin<Node, TuiSlotMap, TuiSlotContext>;
|
|
159
|
+
export type TuiSlots = {
|
|
160
|
+
register: (plugin: TuiSlotPlugin) => () => void;
|
|
161
|
+
};
|
|
162
|
+
export type TuiEventBus = {
|
|
163
|
+
on: <Type extends TuiEvent["type"]>(type: Type, handler: (event: Extract<TuiEvent, {
|
|
164
|
+
type: Type;
|
|
165
|
+
}>) => void) => () => void;
|
|
166
|
+
};
|
|
167
|
+
export type TuiPluginState = "first" | "updated" | "same";
|
|
168
|
+
export type TuiPluginMeta = {
|
|
169
|
+
name: string;
|
|
170
|
+
source: "file" | "npm";
|
|
171
|
+
spec: string;
|
|
172
|
+
target: string;
|
|
173
|
+
requested?: string;
|
|
174
|
+
version?: string;
|
|
175
|
+
modified?: number;
|
|
176
|
+
first_time: number;
|
|
177
|
+
last_time: number;
|
|
178
|
+
time_changed: number;
|
|
179
|
+
load_count: number;
|
|
180
|
+
fingerprint: string;
|
|
181
|
+
};
|
|
182
|
+
export type TuiPluginInit = {
|
|
183
|
+
state: TuiPluginState;
|
|
184
|
+
entry: TuiPluginMeta;
|
|
185
|
+
};
|
|
186
|
+
export type TuiPluginInput<Renderer = CliRenderer, Node = unknown> = {
|
|
187
|
+
client: ReturnType<typeof createOpencodeClientV2>;
|
|
188
|
+
event: TuiEventBus;
|
|
189
|
+
renderer: Renderer;
|
|
190
|
+
slots: TuiSlots;
|
|
191
|
+
api: TuiApi<Node>;
|
|
192
|
+
};
|
|
193
|
+
export type TuiPlugin<Renderer = CliRenderer, Node = unknown> = (input: TuiPluginInput<Renderer, Node>, options: PluginOptions | null, init: TuiPluginInit) => Promise<void>;
|
|
194
|
+
export type TuiPluginModule<Renderer = CliRenderer, Node = unknown> = {
|
|
195
|
+
server?: ServerPlugin;
|
|
196
|
+
tui?: TuiPlugin<Renderer, Node>;
|
|
197
|
+
slots?: TuiSlotPlugin;
|
|
198
|
+
};
|
package/dist/tui.js
ADDED
|
File without changes
|
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-snapshot-
|
|
4
|
+
"version": "0.0.0-snapshot-tui-plugins-202603112046",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -16,16 +16,29 @@
|
|
|
16
16
|
"./tool": {
|
|
17
17
|
"import": "./dist/tool.js",
|
|
18
18
|
"types": "./dist/tool.d.ts"
|
|
19
|
+
},
|
|
20
|
+
"./tui": {
|
|
21
|
+
"import": "./dist/tui.js",
|
|
22
|
+
"types": "./dist/tui.d.ts"
|
|
19
23
|
}
|
|
20
24
|
},
|
|
21
25
|
"files": [
|
|
22
26
|
"dist"
|
|
23
27
|
],
|
|
24
28
|
"dependencies": {
|
|
25
|
-
"@opencode-ai/sdk": "0.0.0-snapshot-
|
|
29
|
+
"@opencode-ai/sdk": "0.0.0-snapshot-tui-plugins-202603112046",
|
|
26
30
|
"zod": "4.1.8"
|
|
27
31
|
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@opentui/core": ">=0.1.87"
|
|
34
|
+
},
|
|
35
|
+
"peerDependenciesMeta": {
|
|
36
|
+
"@opentui/core": {
|
|
37
|
+
"optional": true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
28
40
|
"devDependencies": {
|
|
41
|
+
"@opentui/core": "0.0.0-20260310-a34fbfd3",
|
|
29
42
|
"@tsconfig/node22": "22.0.2",
|
|
30
43
|
"@types/node": "22.13.9",
|
|
31
44
|
"typescript": "5.8.2",
|