@wox-launcher/wox-plugin 0.0.66 → 0.0.68
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/package.json +7 -7
- package/types/index.d.ts +24 -5
- package/types/llm.d.ts +12 -0
- package/types/setting.d.ts +97 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wox-launcher/wox-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.68",
|
|
4
4
|
"description": "All nodejs plugin for Wox should use types in this package",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"types"
|
|
15
15
|
],
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
18
|
-
"@typescript-eslint/parser": "^
|
|
19
|
-
"eslint": "^
|
|
20
|
-
"eslint-config-prettier": "9.
|
|
21
|
-
"prettier": "3.
|
|
22
|
-
"typescript": "^5.
|
|
17
|
+
"@typescript-eslint/eslint-plugin": "^7.13.1",
|
|
18
|
+
"@typescript-eslint/parser": "^7.13.1",
|
|
19
|
+
"eslint": "^9.5.0",
|
|
20
|
+
"eslint-config-prettier": "9.1.0",
|
|
21
|
+
"prettier": "3.3.2",
|
|
22
|
+
"typescript": "^5.4.5"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {},
|
|
25
25
|
"scripts": {
|
package/types/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { llm } from "./llm.js"
|
|
2
|
+
import { MetadataCommand, PluginSettingDefinitionItem } from "./setting.js"
|
|
3
|
+
|
|
4
|
+
export type Platform = "windows" | "darwin" | "linux"
|
|
5
|
+
|
|
1
6
|
export interface Plugin {
|
|
2
7
|
init: (ctx: Context, initParams: PluginInitParams) => Promise<void>
|
|
3
8
|
query: (ctx: Context, query: Query) => Promise<Result[]>
|
|
@@ -69,7 +74,6 @@ export interface Query {
|
|
|
69
74
|
IsGlobalQuery(): boolean
|
|
70
75
|
}
|
|
71
76
|
|
|
72
|
-
|
|
73
77
|
export interface Result {
|
|
74
78
|
Id?: string
|
|
75
79
|
Title: string
|
|
@@ -179,6 +183,21 @@ export interface PublicAPI {
|
|
|
179
183
|
* Register setting changed callback
|
|
180
184
|
*/
|
|
181
185
|
OnSettingChanged: (ctx: Context, callback: (key: string, value: string) => void) => Promise<void>
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Get dynamic setting definition
|
|
189
|
+
*/
|
|
190
|
+
OnGetDynamicSetting: (ctx: Context, callback: (key: string) => PluginSettingDefinitionItem) => Promise<void>
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Register query commands
|
|
194
|
+
*/
|
|
195
|
+
RegisterQueryCommands: (ctx: Context, commands: MetadataCommand[]) => Promise<void>
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Chat using LLM
|
|
199
|
+
*/
|
|
200
|
+
LLMStream: (ctx: Context, conversations: llm.Conversation[], callback: llm.ChatStreamFunc) => Promise<void>
|
|
182
201
|
}
|
|
183
202
|
|
|
184
203
|
export type WoxImageType = "absolute" | "relative" | "base64" | "svg" | "url" | "emoji"
|
|
@@ -188,7 +207,7 @@ export interface WoxImage {
|
|
|
188
207
|
ImageData: string
|
|
189
208
|
}
|
|
190
209
|
|
|
191
|
-
export type WoxPreviewType = "markdown" | "text" | "image" | "url" | "
|
|
210
|
+
export type WoxPreviewType = "markdown" | "text" | "image" | "url" | "file"
|
|
192
211
|
|
|
193
212
|
export interface WoxPreview {
|
|
194
213
|
PreviewType: WoxPreviewType
|
|
@@ -203,8 +222,8 @@ export declare interface Context {
|
|
|
203
222
|
Exists: (key: string) => boolean
|
|
204
223
|
}
|
|
205
224
|
|
|
206
|
-
export function NewContext(): Context
|
|
225
|
+
export function NewContext(): Context
|
|
207
226
|
|
|
208
|
-
export function NewContextWithValue(key: string, value: string): Context
|
|
227
|
+
export function NewContextWithValue(key: string, value: string): Context
|
|
209
228
|
|
|
210
|
-
export function NewBase64WoxImage(imageData: string): WoxImage
|
|
229
|
+
export function NewBase64WoxImage(imageData: string): WoxImage
|
package/types/llm.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export namespace llm {
|
|
2
|
+
export type ConversationRole = "user" | "system"
|
|
3
|
+
export type ChatStreamDataType = "streaming" | "finished" | "error"
|
|
4
|
+
|
|
5
|
+
export interface Conversation {
|
|
6
|
+
Role: ConversationRole
|
|
7
|
+
Text: string
|
|
8
|
+
Timestamp: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type ChatStreamFunc = (dataType: ChatStreamDataType, data: string) => void
|
|
12
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Context, Platform } from "./index.js"
|
|
2
|
+
|
|
3
|
+
export type PluginSettingDefinitionType = "head" | "textbox" | "checkbox" | "select" | "label" | "newline" | "table" | "dynamic"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export interface PluginSettingValueStyle {
|
|
7
|
+
PaddingLeft: number
|
|
8
|
+
PaddingTop: number
|
|
9
|
+
PaddingRight: number
|
|
10
|
+
PaddingBottom: number
|
|
11
|
+
|
|
12
|
+
Width: number
|
|
13
|
+
LabelWidth: number // if has label, E.g. select, checkbox, textbox
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface PluginSettingDefinitionValue {
|
|
17
|
+
GetKey: () => string
|
|
18
|
+
GetDefaultValue: () => string
|
|
19
|
+
Translate: (translator: (ctx: Context, key: string) => string) => void
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface PluginSettingDefinitionItem {
|
|
23
|
+
Type: PluginSettingDefinitionType
|
|
24
|
+
Value: PluginSettingDefinitionValue
|
|
25
|
+
DisabledInPlatforms: Platform[]
|
|
26
|
+
IsPlatformSpecific: boolean // if true, this setting may be different in different platforms
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface MetadataCommand {
|
|
30
|
+
Command: string
|
|
31
|
+
Description: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface PluginSettingValueCheckBox extends PluginSettingDefinitionValue {
|
|
35
|
+
Key: string
|
|
36
|
+
Label: string
|
|
37
|
+
DefaultValue: string
|
|
38
|
+
Tooltip: string
|
|
39
|
+
Style: PluginSettingValueStyle
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface PluginSettingValueDynamic extends PluginSettingDefinitionValue {
|
|
43
|
+
Key: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface PluginSettingValueHead extends PluginSettingDefinitionValue {
|
|
47
|
+
Content: string
|
|
48
|
+
Tooltip: string
|
|
49
|
+
Style: PluginSettingValueStyle
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface PluginSettingValueLabel extends PluginSettingDefinitionValue {
|
|
53
|
+
Content: string
|
|
54
|
+
Tooltip: string
|
|
55
|
+
Style: PluginSettingValueStyle
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface PluginSettingValueNewline extends PluginSettingDefinitionValue {
|
|
59
|
+
Style: PluginSettingValueStyle
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface PluginSettingValueSelect extends PluginSettingDefinitionValue {
|
|
63
|
+
Key: string
|
|
64
|
+
Label: string
|
|
65
|
+
Suffix: string
|
|
66
|
+
DefaultValue: string
|
|
67
|
+
Tooltip: string
|
|
68
|
+
Options: PluginSettingValueSelectOption[]
|
|
69
|
+
Validators: PluginSettingValidator[] // validators for this setting, every validator should be satisfied
|
|
70
|
+
|
|
71
|
+
Style: PluginSettingValueStyle
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface PluginSettingValueSelectOption {
|
|
75
|
+
Label: string
|
|
76
|
+
Value: string
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type PluginSettingValidatorType = "is_number" | "not_empty"
|
|
80
|
+
|
|
81
|
+
export interface PluginSettingValidator {
|
|
82
|
+
Type: PluginSettingValidatorType
|
|
83
|
+
Value: PluginSettingValidatorValue
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface PluginSettingValidatorValue {
|
|
87
|
+
GetValidatorType(): PluginSettingValidatorType
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface PluginSettingValidatorIsNumber extends PluginSettingValidatorValue {
|
|
91
|
+
IsInteger: boolean
|
|
92
|
+
IsFloat: boolean
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface PluginSettingValidatorNotEmpty extends PluginSettingValidatorValue {
|
|
96
|
+
|
|
97
|
+
}
|