@cortexkit/aft-opencode 0.45.1 → 0.46.0
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/config.d.ts +0 -9
- package/dist/config.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +347 -123
- package/dist/shared/ignored-message.d.ts +9 -7
- package/dist/shared/ignored-message.d.ts.map +1 -1
- package/dist/shared/rpc-client.d.ts +23 -1
- package/dist/shared/rpc-client.d.ts.map +1 -1
- package/dist/subc-tool-schemas.d.ts.map +1 -1
- package/dist/tools/hoisted.d.ts.map +1 -1
- package/dist/tools/permissions.d.ts +7 -0
- package/dist/tools/permissions.d.ts.map +1 -1
- package/dist/tools/semantic.d.ts.map +1 -1
- package/dist/tui/notification-socket.d.ts.map +1 -1
- package/package.json +17 -14
- package/src/shared/ignored-message.ts +38 -19
- package/src/shared/rpc-client.ts +116 -4
- package/src/tui/entry.mjs +16 -0
- package/src/tui/notification-socket.ts +28 -1
- package/src/tui-compiled/badge-contrast.ts +43 -0
- package/src/tui-compiled/index.tsx +992 -0
- package/src/tui-compiled/notification-socket.ts +448 -0
- package/src/tui-compiled/preferences.ts +243 -0
- package/src/tui-compiled/sidebar.tsx +936 -0
- package/src/tui-compiled/types/opencode-plugin-tui.d.ts +239 -0
- package/dist/tui.js +0 -13462
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
// Type declarations for @opencode-ai/plugin/tui
|
|
2
|
+
// These types are not yet exported by the installed @opencode-ai/plugin package
|
|
3
|
+
|
|
4
|
+
declare module "@opencode-ai/plugin/tui" {
|
|
5
|
+
import type {
|
|
6
|
+
createOpencodeClient as createOpencodeClientV2,
|
|
7
|
+
Event as TuiEvent,
|
|
8
|
+
Message,
|
|
9
|
+
Part,
|
|
10
|
+
Provider,
|
|
11
|
+
Config as SdkConfig,
|
|
12
|
+
} from "@opencode-ai/sdk/v2";
|
|
13
|
+
|
|
14
|
+
import type { CliRenderer, RGBA } from "@opentui/core";
|
|
15
|
+
import type { JSX, SolidPlugin } from "@opentui/solid";
|
|
16
|
+
|
|
17
|
+
type PluginOptions = Record<string, unknown>;
|
|
18
|
+
|
|
19
|
+
export type { CliRenderer };
|
|
20
|
+
|
|
21
|
+
export type TuiThemeCurrent = {
|
|
22
|
+
readonly primary: RGBA;
|
|
23
|
+
readonly secondary: RGBA;
|
|
24
|
+
readonly accent: RGBA;
|
|
25
|
+
readonly error: RGBA;
|
|
26
|
+
readonly warning: RGBA;
|
|
27
|
+
readonly success: RGBA;
|
|
28
|
+
readonly info: RGBA;
|
|
29
|
+
readonly text: RGBA;
|
|
30
|
+
readonly textMuted: RGBA;
|
|
31
|
+
readonly background: RGBA;
|
|
32
|
+
readonly backgroundPanel: RGBA;
|
|
33
|
+
readonly backgroundElement: RGBA;
|
|
34
|
+
readonly backgroundMenu: RGBA;
|
|
35
|
+
readonly border: RGBA;
|
|
36
|
+
readonly borderActive: RGBA;
|
|
37
|
+
readonly borderSubtle: RGBA;
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type TuiTheme = {
|
|
42
|
+
readonly current: TuiThemeCurrent;
|
|
43
|
+
has: (name: string) => boolean;
|
|
44
|
+
set: (name: string) => boolean;
|
|
45
|
+
mode: () => "dark" | "light";
|
|
46
|
+
readonly ready: boolean;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type TuiSlotMap = {
|
|
50
|
+
app: Record<string, never>;
|
|
51
|
+
home_logo: Record<string, never>;
|
|
52
|
+
home_bottom: Record<string, never>;
|
|
53
|
+
sidebar_title: {
|
|
54
|
+
session_id: string;
|
|
55
|
+
title: string;
|
|
56
|
+
share_url?: string;
|
|
57
|
+
};
|
|
58
|
+
sidebar_content: {
|
|
59
|
+
session_id: string;
|
|
60
|
+
};
|
|
61
|
+
sidebar_footer: {
|
|
62
|
+
session_id: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type TuiSlotContext = {
|
|
67
|
+
theme: TuiTheme;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export type TuiSlotPlugin = Omit<SolidPlugin<TuiSlotMap, TuiSlotContext>, "id"> & {
|
|
71
|
+
id?: never;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export type TuiToast = {
|
|
75
|
+
variant?: "info" | "success" | "warning" | "error";
|
|
76
|
+
title?: string;
|
|
77
|
+
message: string;
|
|
78
|
+
duration?: number;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export type TuiDialogProps = {
|
|
82
|
+
size?: "medium" | "large" | "xlarge";
|
|
83
|
+
onClose: () => void;
|
|
84
|
+
children?: JSX.Element;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export type TuiDialogStack = {
|
|
88
|
+
replace: (render: () => JSX.Element, onClose?: () => void) => void;
|
|
89
|
+
clear: () => void;
|
|
90
|
+
setSize: (size: "medium" | "large" | "xlarge") => void;
|
|
91
|
+
readonly size: "medium" | "large" | "xlarge";
|
|
92
|
+
readonly depth: number;
|
|
93
|
+
readonly open: boolean;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export type TuiDialogAlertProps = {
|
|
97
|
+
title: string;
|
|
98
|
+
message: string;
|
|
99
|
+
onConfirm?: () => void;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type TuiDialogConfirmProps = {
|
|
103
|
+
title: string;
|
|
104
|
+
message: string;
|
|
105
|
+
onConfirm?: () => void;
|
|
106
|
+
onCancel?: () => void;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export type TuiDialogPromptProps = {
|
|
110
|
+
title: string;
|
|
111
|
+
description?: () => JSX.Element;
|
|
112
|
+
placeholder?: string;
|
|
113
|
+
value?: string;
|
|
114
|
+
busy?: boolean;
|
|
115
|
+
busyText?: string;
|
|
116
|
+
onConfirm?: (value: string) => void;
|
|
117
|
+
onCancel?: () => void;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export type TuiDialogSelectOption<Value = unknown> = {
|
|
121
|
+
title: string;
|
|
122
|
+
value: Value;
|
|
123
|
+
description?: string;
|
|
124
|
+
footer?: JSX.Element | string;
|
|
125
|
+
category?: string;
|
|
126
|
+
disabled?: boolean;
|
|
127
|
+
onSelect?: () => void;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export type TuiDialogSelectProps<Value = unknown> = {
|
|
131
|
+
title: string;
|
|
132
|
+
placeholder?: string;
|
|
133
|
+
options: TuiDialogSelectOption<Value>[];
|
|
134
|
+
flat?: boolean;
|
|
135
|
+
onMove?: (option: TuiDialogSelectOption<Value>) => void;
|
|
136
|
+
onFilter?: (query: string) => void;
|
|
137
|
+
onSelect?: (option: TuiDialogSelectOption<Value>) => void;
|
|
138
|
+
skipFilter?: boolean;
|
|
139
|
+
current?: Value;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export type TuiState = {
|
|
143
|
+
readonly ready: boolean;
|
|
144
|
+
readonly config: SdkConfig;
|
|
145
|
+
readonly provider: ReadonlyArray<Provider>;
|
|
146
|
+
readonly path: {
|
|
147
|
+
state: string;
|
|
148
|
+
config: string;
|
|
149
|
+
worktree: string;
|
|
150
|
+
directory: string;
|
|
151
|
+
};
|
|
152
|
+
session: {
|
|
153
|
+
count: () => number;
|
|
154
|
+
messages: (sessionID: string) => ReadonlyArray<Message>;
|
|
155
|
+
};
|
|
156
|
+
part: (messageID: string) => ReadonlyArray<Part>;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export type TuiEventBus = {
|
|
160
|
+
on: <Type extends TuiEvent["type"]>(
|
|
161
|
+
type: Type,
|
|
162
|
+
handler: (event: Extract<TuiEvent, { type: Type }>) => void,
|
|
163
|
+
) => () => void;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export type TuiLifecycle = {
|
|
167
|
+
readonly signal: AbortSignal;
|
|
168
|
+
onDispose: (fn: () => void | Promise<void>) => () => void;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export type TuiPluginApi = {
|
|
172
|
+
app: { readonly version: string };
|
|
173
|
+
command: {
|
|
174
|
+
register: (
|
|
175
|
+
cb: () => Array<{
|
|
176
|
+
title: string;
|
|
177
|
+
value: string;
|
|
178
|
+
description?: string;
|
|
179
|
+
category?: string;
|
|
180
|
+
keybind?: string;
|
|
181
|
+
suggested?: boolean;
|
|
182
|
+
hidden?: boolean;
|
|
183
|
+
enabled?: boolean;
|
|
184
|
+
slash?: {
|
|
185
|
+
name: string;
|
|
186
|
+
aliases?: string[];
|
|
187
|
+
};
|
|
188
|
+
onSelect?: () => void;
|
|
189
|
+
}>,
|
|
190
|
+
) => () => void;
|
|
191
|
+
trigger: (value: string) => void;
|
|
192
|
+
};
|
|
193
|
+
route: {
|
|
194
|
+
register: (
|
|
195
|
+
routes: Array<{
|
|
196
|
+
name: string;
|
|
197
|
+
render: (input: { params?: Record<string, unknown> }) => JSX.Element;
|
|
198
|
+
}>,
|
|
199
|
+
) => () => void;
|
|
200
|
+
navigate: (name: string, params?: Record<string, unknown>) => void;
|
|
201
|
+
readonly current:
|
|
202
|
+
| { name: "home" }
|
|
203
|
+
| { name: "session"; params: { sessionID: string; initialPrompt?: unknown } }
|
|
204
|
+
| { name: string; params?: Record<string, unknown> };
|
|
205
|
+
};
|
|
206
|
+
ui: {
|
|
207
|
+
Dialog: (props: TuiDialogProps) => JSX.Element;
|
|
208
|
+
DialogAlert: (props: TuiDialogAlertProps) => JSX.Element;
|
|
209
|
+
DialogConfirm: (props: TuiDialogConfirmProps) => JSX.Element;
|
|
210
|
+
DialogPrompt: (props: TuiDialogPromptProps) => JSX.Element;
|
|
211
|
+
DialogSelect: <Value = unknown>(props: TuiDialogSelectProps<Value>) => JSX.Element;
|
|
212
|
+
toast: (input: TuiToast) => void;
|
|
213
|
+
dialog: TuiDialogStack;
|
|
214
|
+
};
|
|
215
|
+
state: TuiState;
|
|
216
|
+
theme: TuiTheme;
|
|
217
|
+
client: ReturnType<typeof createOpencodeClientV2>;
|
|
218
|
+
event: TuiEventBus;
|
|
219
|
+
renderer: CliRenderer;
|
|
220
|
+
slots: {
|
|
221
|
+
register: (plugin: TuiSlotPlugin) => string;
|
|
222
|
+
};
|
|
223
|
+
lifecycle: TuiLifecycle;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
export type TuiPluginMeta = {
|
|
227
|
+
state: "first" | "updated" | "same";
|
|
228
|
+
id: string;
|
|
229
|
+
source: "file" | "npm" | "internal";
|
|
230
|
+
spec: string;
|
|
231
|
+
target: string;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export type TuiPlugin = (
|
|
235
|
+
api: TuiPluginApi,
|
|
236
|
+
options: PluginOptions | undefined,
|
|
237
|
+
meta: TuiPluginMeta,
|
|
238
|
+
) => Promise<void>;
|
|
239
|
+
}
|