@wox-launcher/wox-plugin 0.0.66 → 0.0.67
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 +1 -1
- package/types/index.d.ts +20 -0
- package/types/llm.d.ts +12 -0
- package/types/setting.d.ts +97 -0
package/package.json
CHANGED
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[]>
|
|
@@ -179,6 +184,21 @@ export interface PublicAPI {
|
|
|
179
184
|
* Register setting changed callback
|
|
180
185
|
*/
|
|
181
186
|
OnSettingChanged: (ctx: Context, callback: (key: string, value: string) => void) => Promise<void>
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Get dynamic setting definition
|
|
190
|
+
*/
|
|
191
|
+
OnGetDynamicSetting: (ctx: Context, callback: (key: string) => PluginSettingDefinitionItem) => Promise<void>
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Register query commands
|
|
195
|
+
*/
|
|
196
|
+
RegisterQueryCommands: (ctx: Context, commands: MetadataCommand[]) => Promise<void>
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Chat using LLM
|
|
200
|
+
*/
|
|
201
|
+
LLMStream: (ctx: Context, conversations: llm.Conversation[], callback: llm.ChatStreamFunc) => Promise<void>
|
|
182
202
|
}
|
|
183
203
|
|
|
184
204
|
export type WoxImageType = "absolute" | "relative" | "base64" | "svg" | "url" | "emoji"
|
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
|
+
}
|