siyuan 1.2.1 → 1.2.2

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 CHANGED
@@ -1,20 +1,46 @@
1
1
  {
2
- "name": "siyuan",
3
- "contributors": [
4
- "zuoez02",
5
- "Vanessa"
6
- ],
7
- "types": "siyuan.d.ts",
8
- "files": [
9
- "types",
10
- "CHANGELOG.md",
11
- "package.json",
12
- "README.md",
13
- "siyuan.d.ts"
14
- ],
15
- "version": "1.2.1",
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/siyuan-note/petal.git"
2
+ "name": "siyuan",
3
+ "version": "1.2.2",
4
+ "contributors": [
5
+ "zuoez02",
6
+ "Vanessa",
7
+ "Zuoqiu-Yingyi"
8
+ ],
9
+ "types": "siyuan.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "import": {
13
+ "types": "./siyuan.d.ts"
14
+ },
15
+ "require": {
16
+ "types": "./siyuan.d.ts"
17
+ }
18
+ },
19
+ "./kernel": {
20
+ "import": {
21
+ "types": "./kernel.d.ts"
22
+ },
23
+ "require": {
24
+ "types": "./kernel.d.ts"
25
+ }
19
26
  }
27
+ },
28
+ "files": [
29
+ "types",
30
+ "CHANGELOG.md",
31
+ "kernel.d.ts",
32
+ "package.json",
33
+ "README.md",
34
+ "siyuan.d.ts"
35
+ ],
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/siyuan-note/petal.git"
39
+ },
40
+ "dependencies": {
41
+ "@dop251/types-goja_nodejs-buffer": "latest",
42
+ "@dop251/types-goja_nodejs-global": "latest",
43
+ "@dop251/types-goja_nodejs-url": "latest",
44
+ "zod": "latest"
45
+ }
20
46
  }
package/siyuan.d.ts CHANGED
@@ -1,32 +1,23 @@
1
1
  import type {
2
2
  IGetDocInfo,
3
3
  IGetTreeStat,
4
- IMenuBaseDetail,
4
+ IKernelPlugin,
5
+ IKernelPluginState,
5
6
  IMenu,
7
+ IMenuBaseDetail,
8
+ IMenuItem,
9
+ IModels,
6
10
  IObject,
7
11
  IPosition,
8
- ISiyuan,
9
- IWebSocketData,
10
12
  IProtyle,
11
13
  IProtyleOptions,
12
- TProtyleAction,
13
- IMenuItem,
14
14
  IRefDefs,
15
+ ISiyuan,
16
+ IWebSocketData,
15
17
  TEditorMode,
18
+ TProtyleAction,
16
19
  } from "./types";
17
- import {
18
- Config,
19
- Custom,
20
- Lute,
21
- Protyle,
22
- Toolbar,
23
- subMenu,
24
- App,
25
- Files,
26
- Tab,
27
- Model,
28
- MobileCustom,
29
- } from "./types";
20
+ import {App, Config, Custom, Files, Lute, MobileCustom, Model, Protyle, subMenu, Tab, Toolbar,} from "./types";
30
21
 
31
22
  export * from "./types";
32
23
 
@@ -35,7 +26,7 @@ declare global {
35
26
  }
36
27
  }
37
28
 
38
- export type TDock = "file" | "outline" | "inbox" | "bookmark" | "tag" | "graph" | "globalGraph" | "backlink"
29
+ export type TDock = "file" | "outline" | "inbox" | "bookmark" | "tag" | "graph" | "globalGraph" | "backlink" | "agentChat"
39
30
 
40
31
  export type TTab = "Outline" | "Graph" | "Backlink" | "Asset" | "Editor" | "Search" | "siyuan-card"
41
32
 
@@ -230,6 +221,7 @@ export interface IEventBusMap {
230
221
  languageElements: HTMLElement[],
231
222
  protyle: IProtyle
232
223
  };
224
+ "kernel-plugin-state-change": IKernelPluginState;
233
225
  }
234
226
 
235
227
  export interface IPluginDockTab {
@@ -378,21 +370,11 @@ export function exitSiYuan(): void
378
370
 
379
371
  export function getAllEditor(): Protyle[]
380
372
 
373
+ export function saveExportFile(uri: string, msgId?: string): Promise<void>;
374
+
381
375
  export function getAllTabs(type?: TTab | string): Tab[]
382
376
 
383
- export function getAllModels(): {
384
- editor: [],
385
- graph: [],
386
- asset: [],
387
- outline: [],
388
- backlink: [],
389
- search: [],
390
- inbox: [],
391
- files: [],
392
- bookmark: [],
393
- tag: [],
394
- custom: [],
395
- }
377
+ export function getAllModels(): IModels
396
378
 
397
379
  export function openSetting(app: App): Dialog | undefined;
398
380
 
@@ -443,6 +425,7 @@ export function hideMessage(id?: string): void;
443
425
  export abstract class Plugin {
444
426
  eventBus: EventBus;
445
427
  i18n: IObject;
428
+ kernel: IKernelPlugin;
446
429
  data: any;
447
430
  displayName: string;
448
431
  readonly name: string;
@@ -534,6 +517,24 @@ export abstract class Plugin {
534
517
 
535
518
  addCommand(options: ICommand): void;
536
519
 
520
+ /**
521
+ * 按名称取密钥值(来自「设置 → 密钥和变量」的密钥库)。找不到时返回空字符串。
522
+ * 密钥在内核侧加密存储,此处读到的是运行时明文;仅在本地管理员身份下可用。
523
+ */
524
+ getSecret(name: string): string;
525
+
526
+ /**
527
+ * 按名称取变量值(来自「设置 → 密钥和变量」的变量库)。找不到时返回空字符串。
528
+ * 变量以明文存储,用于非敏感配置。
529
+ */
530
+ getVariable(name: string): string;
531
+
532
+ addAgentAction(options: {
533
+ name: string,
534
+ description: string,
535
+ handler: (args: Record<string, unknown>, app: App) => Promise<{ result?: string, error?: string }>,
536
+ }): string;
537
+
537
538
  addFloatLayer(options: {
538
539
  refDefs: IRefDefs[],
539
540
  x?: number,
package/types/config.d.ts CHANGED
@@ -55,9 +55,9 @@ export namespace Config {
55
55
  */
56
56
  langs: ILang[];
57
57
  /**
58
- * A list of the IP addresses of the devices on which the kernel resides
58
+ * A list of the kernel server addresses
59
59
  */
60
- localIPs: string[];
60
+ serverAddrs: string[];
61
61
  /**
62
62
  * Log level
63
63
  */
@@ -117,69 +117,89 @@ export namespace Config {
117
117
  * Artificial Intelligence (AI) related configuration
118
118
  */
119
119
  export interface IAI {
120
- openAI: IOpenAI;
120
+ providers: IProvider[];
121
+ editing: IEditing;
122
+ agent: IAgent;
123
+ mcp: IMCP;
124
+ embedding: IEmbedding;
121
125
  }
122
126
 
123
127
  /**
124
- * Open AI related configuration
128
+ * AI agent global settings
125
129
  */
126
- export interface IOpenAI {
127
- /**
128
- * API base URL
129
- */
130
- apiBaseURL: string;
131
- /**
132
- * API key
133
- */
130
+ export interface IAgent {
131
+ modelId: string;
132
+ sessionTimeout: number;
133
+ confirmTimeout: number;
134
+ maxRetries: number;
135
+ temperature: number;
136
+ maxCompletionTokens: number;
137
+ maxToolCallRounds: number;
138
+ }
139
+
140
+ /**
141
+ * AI in-editor chat scenario behavior settings (mirrors IAgent)
142
+ */
143
+ export interface IEditing {
144
+ modelId: string;
145
+ maxHistoryMessages: number;
146
+ temperature: number;
147
+ maxCompletionTokens: number;
148
+ }
149
+
150
+ /**
151
+ * Embedding model configuration
152
+ */
153
+ export interface IEmbedding {
154
+ id: string;
155
+ enabled: boolean;
156
+ baseURL: string;
134
157
  apiKey: string;
135
- /**
136
- * The maximum number of contexts passed when requesting the API
137
- */
138
- apiMaxContexts: number;
139
- /**
140
- * Maximum number of tokens (0 means no limit)
141
- */
142
- apiMaxTokens: number;
143
- /**
144
- * The model name called by the API
145
- */
146
- apiModel: TOpenAIAPIModel;
147
- /**
148
- * API Provider
149
- * OpenAI, Azure
150
- */
151
- apiProvider: TOpenAAPIProvider;
152
- /**
153
- * API request proxy address
154
- */
155
- apiProxy: string;
156
- /**
157
- * Parameter `temperature` that controls the randomness of the generated text
158
- */
159
- apiTemperature: number;
160
- /**
161
- * API request timeout (unit: seconds)
162
- */
163
- apiTimeout: number;
164
- /**
165
- * API request additional user agent field
166
- */
167
- apiUserAgent: string;
168
- /**
169
- * API version number
170
- */
171
- apiVersion: string;
158
+ name: string;
159
+ timeout: number;
172
160
  }
173
161
 
174
162
  /**
175
- * The model name called by the API
163
+ * AI provider configuration
176
164
  */
177
- export type TOpenAIAPIModel = "gpt-4" | "gpt-4-32k" | "gpt-3.5-turbo" | "gpt-3.5-turbo-16k";
165
+ export interface IProvider {
166
+ id: string;
167
+ enabled: boolean;
168
+ displayName?: string;
169
+ baseURL: string;
170
+ apiKey: string;
171
+ requestTimeout: number;
172
+ models: IModel[];
173
+ }
178
174
 
179
175
  /**
180
- * API Provider
176
+ * AI model configuration. Behavior params (maxTokens/temperature/maxContexts)
177
+ * live on IEditing; Model holds only identity fields.
181
178
  */
182
- export type TOpenAAPIProvider = "OpenAI" | "Azure";
179
+ export interface IModel {
180
+ id: string;
181
+ enabled: boolean;
182
+ name: string;
183
+ displayName?: string;
184
+ }
185
+
186
+ /**
187
+ * MCP (Model Context Protocol) configuration
188
+ */
189
+ export interface IMCP {
190
+ servers: IMCPServer[];
191
+ }
192
+
193
+ export interface IMCPServer {
194
+ enabled: boolean;
195
+ name: string;
196
+ url: string;
197
+ type: string;
198
+ command: string;
199
+ args?: string[];
200
+ headers?: Record<string, string>;
201
+ timeout: number;
202
+ }
183
203
 
184
204
  /**
185
205
  * SiYuan API related configuration
@@ -210,9 +230,9 @@ export namespace Config {
210
230
  */
211
231
  codeBlockThemeLight: string;
212
232
  /**
213
- * List of installed dark themes
233
+ * Whether to hide toolbar
214
234
  */
215
- darkThemes: string[];
235
+ hideToolbar: boolean;
216
236
  /**
217
237
  * Whether to hide status bar
218
238
  */
@@ -224,7 +244,7 @@ export namespace Config {
224
244
  /**
225
245
  * List of installed icon names
226
246
  */
227
- icons: string[];
247
+ icons: { label: string; name: string }[];
228
248
  /**
229
249
  * The version number of the icon currently in use
230
250
  */
@@ -236,7 +256,11 @@ export namespace Config {
236
256
  /**
237
257
  * List of installed light themes
238
258
  */
239
- lightThemes: string[];
259
+ lightThemes: { label: string; name: string }[];
260
+ /**
261
+ * List of installed dark themes
262
+ */
263
+ darkThemes: { label: string; name: string }[];
240
264
  /**
241
265
  * The current theme mode
242
266
  * - `0`: Light theme
@@ -280,19 +304,27 @@ export namespace Config {
280
304
  * Same as {@link IAppearance.lang}
281
305
  */
282
306
  export type TLang =
283
- "en_US"
284
- | "ar_SA"
285
- | "de_DE"
286
- | "es_ES"
287
- | "fr_FR"
288
- | "he_IL"
289
- | "it_IT"
290
- | "ja_JP"
291
- | "pl_PL"
292
- | "pt_BR"
293
- | "ru_RU"
294
- | "zh_CN"
295
- | "zh_CHT";
307
+ "en"
308
+ | "ar"
309
+ | "de"
310
+ | "es"
311
+ | "fr"
312
+ | "he"
313
+ | "hi"
314
+ | "id"
315
+ | "it"
316
+ | "ja"
317
+ | "ko"
318
+ | "pl"
319
+ | "pt-BR"
320
+ | "ru"
321
+ | "sk"
322
+ | "tr"
323
+ | "uk"
324
+ | "th"
325
+ | "nl"
326
+ | "zh-CN"
327
+ | "zh-TW";
296
328
 
297
329
  /**
298
330
  * SiYuan bazaar related configuration
@@ -351,6 +383,11 @@ export namespace Config {
351
383
  */
352
384
  export interface IEditor {
353
385
 
386
+ /**
387
+ * Whether to allow to execute javascript in the SVG
388
+ */
389
+ allowSVGScript: boolean;
390
+
354
391
  /**
355
392
  * Whether to allow to execute javascript in the HTML block
356
393
  */
@@ -436,10 +473,23 @@ export namespace Config {
436
473
  * - `2`: Do not trigger the floating window
437
474
  */
438
475
  floatWindowMode: number;
476
+ /**
477
+ * Hover delay of the floating window in milliseconds.
478
+ * Only takes effect when `floatWindowMode` is `0`.
479
+ */
480
+ floatWindowDelay: number;
439
481
  /**
440
482
  * The font used in the editor
441
483
  */
442
484
  fontFamily: string;
485
+ /**
486
+ * The font weight used in the editor, 0 means not set
487
+ */
488
+ fontWeight: number;
489
+ /**
490
+ * Label shown in Settings for the selected editor font (e.g. PostScript name + subfamily). May be empty; falls back to fontFamily in UI when empty.
491
+ */
492
+ fontFamilyDisplay: string;
443
493
  /**
444
494
  * The font size used in the editor
445
495
  */
@@ -485,6 +535,10 @@ export namespace Config {
485
535
  * PlantUML rendering service address
486
536
  */
487
537
  plantUMLServePath: string;
538
+ /**
539
+ * Whether to auto-convert pasted URLs to links
540
+ */
541
+ pasteURLAutoConvert: boolean;
488
542
  /**
489
543
  * Whether to enable read-only mode
490
544
  */
@@ -497,6 +551,10 @@ export namespace Config {
497
551
  * Whether to enable spell checking
498
552
  */
499
553
  spellcheck: boolean;
554
+ /**
555
+ * Support spell check languages
556
+ */
557
+ spellcheckLanguages: string[];
500
558
  /**
501
559
  * Whether to enable virtual references
502
560
  */
@@ -544,10 +602,6 @@ export namespace Config {
544
602
  * The symbol on the right side of the block reference anchor text during export
545
603
  */
546
604
  blockRefTextRight: string;
547
- /**
548
- * The path of the template file used when exporting to Docx
549
- */
550
- docxTemplate: string;
551
605
  /**
552
606
  * File annotation reference export mode
553
607
  * - `0`: File name - page number - anchor text
@@ -566,14 +620,30 @@ export namespace Config {
566
620
  * Whether to add YAML Front Matter when exporting to Markdown
567
621
  */
568
622
  markdownYFM: boolean;
623
+ /**
624
+ * Whether to remove the asset ID when exporting to Markdown
625
+ */
626
+ removeAssetsID: boolean;
569
627
  /**
570
628
  * Whether to export the inline memo
571
629
  */
572
630
  inlineMemo: boolean;
631
+ /**
632
+ * Whether to include sub-documents when exporting
633
+ */
634
+ includeSubDocs: boolean;
635
+ /**
636
+ * Whether to include related documents when exporting
637
+ */
638
+ includeRelatedDocs: boolean;
573
639
  /**
574
640
  * Pandoc executable file path
575
641
  */
576
642
  pandocBin: string;
643
+ /**
644
+ * Pandoc parameters
645
+ */
646
+ pandocParams: string;
577
647
  /**
578
648
  * Whether the beginning of the paragraph is empty two spaces.
579
649
  * Insert two full-width spaces `U+3000` at the beginning of the paragraph.
@@ -609,6 +679,10 @@ export namespace Config {
609
679
  * Whether to allow the creation of sub-documents deeper than 7 levels
610
680
  */
611
681
  allowCreateDeeper: boolean;
682
+ /**
683
+ * Don't automatically split the screen when opening search, PDF and other tabs
684
+ */
685
+ noSplitScreenWhenOpenTab: boolean;
612
686
  /**
613
687
  * Whether to automatically locate the currently open document in the document tree
614
688
  */
@@ -638,6 +712,14 @@ export namespace Config {
638
712
  */
639
713
  refCreateSavePath: string;
640
714
  refCreateSaveBox: string;
715
+ /**
716
+ * Shorthand save notebook
717
+ */
718
+ shorthandSaveBox: string;
719
+ /**
720
+ * Shorthand save path
721
+ */
722
+ shorthandSavePath: string;
641
723
  docCreateSaveBox: string;
642
724
  /**
643
725
  * Close the secondary confirmation when deleting a document
@@ -677,6 +759,10 @@ export namespace Config {
677
759
  * Whether to create new documents at the top of the document tree
678
760
  */
679
761
  createDocAtTop: boolean;
762
+ /**
763
+ * The maximum number of recent documents listed
764
+ */
765
+ recentDocsMaxListCount: number;
680
766
  }
681
767
 
682
768
  /**
@@ -806,6 +892,10 @@ export namespace Config {
806
892
  * Display quote block
807
893
  */
808
894
  blockquote: boolean;
895
+ /**
896
+ * Display callout
897
+ */
898
+ callout: boolean;
809
899
  /**
810
900
  * Display code block
811
901
  */
@@ -887,6 +977,7 @@ export namespace Config {
887
977
  attr: IKey;
888
978
  backlinks: IKey;
889
979
  collapse: IKey;
980
+ foldRecursive: IKey;
890
981
  copyBlockEmbed: IKey;
891
982
  copyBlockRef: IKey;
892
983
  copyHPath: IKey;
@@ -1219,6 +1310,10 @@ export namespace Config {
1219
1310
  * Whether to search quote blocks
1220
1311
  */
1221
1312
  blockquote: boolean;
1313
+ /**
1314
+ * Whether to search callout
1315
+ */
1316
+ callout: boolean;
1222
1317
  /**
1223
1318
  * Whether to distinguish between uppercase and lowercase letters when searching
1224
1319
  */
@@ -1239,6 +1334,10 @@ export namespace Config {
1239
1334
  * Whether to search embedded blocks
1240
1335
  */
1241
1336
  embedBlock: boolean;
1337
+ /**
1338
+ * Whether to distinguish between Simplified and Traditional Chinese characters when searching
1339
+ */
1340
+ hanSensitive: boolean;
1242
1341
  /**
1243
1342
  * Whether to search heading blocks
1244
1343
  */
@@ -1412,7 +1511,7 @@ export namespace Config {
1412
1511
  * - `3`: Network storage service using WebDAV protocol
1413
1512
  * - `4`: Local file system
1414
1513
  */
1415
- provider: number;
1514
+ provider: 0 | 2 | 3 | 4;
1416
1515
  s3: ISyncS3;
1417
1516
  /**
1418
1517
  * The prompt information of the last synchronization
@@ -1591,6 +1690,10 @@ export namespace Config {
1591
1690
  * Whether to enable network serve (whether to allow connections from other devices)
1592
1691
  */
1593
1692
  networkServe: boolean;
1693
+ /**
1694
+ * Whether to enable HTTPS for network serve (TLS encryption)
1695
+ */
1696
+ networkServeTLS: boolean;
1594
1697
  /**
1595
1698
  * The operating system name determined at compile time (obtained using the command `go tool
1596
1699
  * dist list`)
@@ -2124,6 +2227,7 @@ export namespace Config {
2124
2227
  * - `1`: Query syntax
2125
2228
  * - `2`: SQL
2126
2229
  * - `3`: Regular expression
2230
+ * - `4`: Fuzzy search
2127
2231
  * @default 0
2128
2232
  */
2129
2233
  method?: number;
@@ -2159,6 +2263,26 @@ export namespace Config {
2159
2263
  */
2160
2264
  sort?: number;
2161
2265
  types?: IUILayoutTabSearchConfigTypes;
2266
+ subTypes?: IUILayoutTabSearchConfigSubTypes;
2267
+ }
2268
+
2269
+ /**
2270
+ * Search subtype filtering. When all flags within a category (heading or
2271
+ * list) are false, that category is not subtype-filtered (parent type
2272
+ * filter applies as before). When at least one flag is true, only blocks
2273
+ * matching the selected subtypes are returned for that category.
2274
+ */
2275
+ export interface IUILayoutTabSearchConfigSubTypes {
2276
+ h1: boolean;
2277
+ h2: boolean;
2278
+ h3: boolean;
2279
+ h4: boolean;
2280
+ h5: boolean;
2281
+ h6: boolean;
2282
+ // List subtypes — apply to both list and listItem
2283
+ o: boolean;
2284
+ u: boolean;
2285
+ t: boolean;
2162
2286
  }
2163
2287
 
2164
2288
  /**
@@ -2305,6 +2429,11 @@ export namespace Config {
2305
2429
  * @default false
2306
2430
  */
2307
2431
  blockquote: boolean;
2432
+ /**
2433
+ * Search results contain callout blocks
2434
+ * @default false
2435
+ */
2436
+ callout: boolean;
2308
2437
  /**
2309
2438
  * Search results contain code blocks
2310
2439
  * @default false