@nesso-how/plugin 0.5.0 → 0.6.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.
@@ -0,0 +1,555 @@
1
+ import { z } from 'zod';
2
+ import type { ComponentType } from 'react';
3
+ import type { DeepReadonly, GraphSnapshot, NessoOperation, Selection, SavedView, VocabDefinition } from '@nesso-how/core';
4
+ import type { Locale } from '@nesso-how/i18n';
5
+ import { type Definition } from './definitions.ts';
6
+ import { type FileOpenOptions, type FileOpenResult, type FileSaveOptions } from './files.ts';
7
+ import { createWriteCommands } from '@nesso-how/core';
8
+ import { type LocalizedText } from './i18n.ts';
9
+ import { type PluginStorage, type PluginStorageRecord } from './storage.ts';
10
+ export { checkMessageSize } from './data.ts';
11
+ export { parsePluginStorageKey, parsePluginStorageRecord, parsePluginStorageSnapshot, pluginStorageLimits, } from './storage.ts';
12
+ export { resolvePluginText, type LocalizedText } from './i18n.ts';
13
+ export { fontFaces } from './theme-fonts.ts';
14
+ export { parseOrThrow, PluginError } from './errors.ts';
15
+ export { parseDefinition, themeColors, type Definition } from './definitions.ts';
16
+ export { parseFileOptions, fileTextLimit, type FileOpenOptions, type FileSaveOptions, type FileOpenResult, } from './files.ts';
17
+ export declare const runtimeLimits: {
18
+ readonly request: number;
19
+ readonly snapshot: number;
20
+ readonly pending: 64;
21
+ readonly deadline: 30000;
22
+ readonly interaction: 300000;
23
+ readonly initialization: 10000;
24
+ readonly action: 120000;
25
+ readonly heartbeat: 15000;
26
+ };
27
+ export declare const badgeLimits: {
28
+ readonly value: 999999;
29
+ readonly execution: 2000;
30
+ readonly refresh: 15000;
31
+ readonly rate: 1000;
32
+ };
33
+ declare const actionBadgeResult: z.ZodObject<{
34
+ value: z.ZodNullable<z.ZodNumber>;
35
+ refreshAt: z.ZodOptional<z.ZodNumber>;
36
+ }, z.core.$strict>;
37
+ export type ActionBadgeInput = {
38
+ readonly viewId: string | null;
39
+ readonly viewGraph: GraphSnapshot;
40
+ readonly records: readonly PluginStorageRecord[];
41
+ readonly now: number;
42
+ };
43
+ export type ActionBadgeResult = DeepReadonly<z.infer<typeof actionBadgeResult>>;
44
+ export declare const parseActionBadgeResult: (value: unknown) => ActionBadgeResult;
45
+ export declare const themeTokens: readonly ["background", "foreground", "canvas", "sidebar", "primary", "primary-hover", "primary-foreground", "muted", "muted-foreground", "hover", "pressed", "border", "ring", "selection-halo", "node-border", "edge", "handle", "font-sans", "font-mono", "radius-control", "radius-object", "duration-state"];
46
+ declare const metadata: z.ZodObject<{
47
+ name: z.ZodObject<{
48
+ en: z.ZodString;
49
+ it: z.ZodOptional<z.ZodString>;
50
+ 'zh-CN': z.ZodOptional<z.ZodString>;
51
+ }, z.core.$strict>;
52
+ description: z.ZodObject<{
53
+ en: z.ZodString;
54
+ it: z.ZodOptional<z.ZodString>;
55
+ 'zh-CN': z.ZodOptional<z.ZodString>;
56
+ }, z.core.$strict>;
57
+ documentation: z.ZodObject<{
58
+ en: z.ZodString;
59
+ it: z.ZodOptional<z.ZodString>;
60
+ 'zh-CN': z.ZodOptional<z.ZodString>;
61
+ }, z.core.$strict>;
62
+ }, z.core.$strict>;
63
+ export type PluginI18n = DeepReadonly<{
64
+ metadata: z.infer<typeof metadata>;
65
+ [key: string]: LocalizedText | z.infer<typeof metadata>;
66
+ }>;
67
+ export declare function parsePluginI18n(value: unknown): PluginI18n;
68
+ declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
69
+ apiVersion: z.ZodLiteral<1>;
70
+ kind: z.ZodLiteral<"actions">;
71
+ entry: z.ZodString;
72
+ writes: z.ZodArray<z.ZodEnum<{
73
+ "concept.add": "concept.add";
74
+ "concept.bold": "concept.bold";
75
+ "concept.color": "concept.color";
76
+ "concept.italic": "concept.italic";
77
+ "concept.label": "concept.label";
78
+ "concept.notes": "concept.notes";
79
+ "concept.position": "concept.position";
80
+ "concept.positions": "concept.positions";
81
+ "concept.remove": "concept.remove";
82
+ "relation.connect": "relation.connect";
83
+ "relation.reconnect": "relation.reconnect";
84
+ "relation.remove": "relation.remove";
85
+ "relation.type": "relation.type";
86
+ "relation.type.create": "relation.type.create";
87
+ "selection.set": "selection.set";
88
+ "view.membership": "view.membership";
89
+ }>>;
90
+ capabilities: z.ZodArray<z.ZodEnum<{
91
+ files: "files";
92
+ notifications: "notifications";
93
+ storage: "storage";
94
+ ui: "ui";
95
+ }>>;
96
+ }, z.core.$strict>, ...z.ZodObject<{
97
+ apiVersion: z.ZodLiteral<1>;
98
+ kind: z.ZodLiteral<"theme" | "vocab">;
99
+ entry: z.ZodString;
100
+ writes: z.ZodTuple<[], null>;
101
+ capabilities: z.ZodTuple<[], null>;
102
+ }, z.core.$strict>[]], "kind">;
103
+ export type PluginManifest = DeepReadonly<z.infer<typeof manifest>>;
104
+ export declare function parsePluginManifest(value: unknown): z.infer<typeof manifest>;
105
+ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
106
+ type: z.ZodLiteral<"request">;
107
+ id: z.ZodNumber;
108
+ contextId: z.ZodString;
109
+ method: z.ZodLiteral<"document.applyOperations">;
110
+ params: z.ZodObject<{
111
+ operations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
112
+ kind: z.ZodLiteral<"concept.label">;
113
+ id: z.ZodString;
114
+ value: z.ZodString;
115
+ }, z.core.$strict>, z.ZodObject<{
116
+ kind: z.ZodLiteral<"concept.notes">;
117
+ id: z.ZodString;
118
+ value: z.ZodString;
119
+ }, z.core.$strict>, z.ZodObject<{
120
+ kind: z.ZodLiteral<"concept.color">;
121
+ id: z.ZodString;
122
+ value: z.ZodString;
123
+ }, z.core.$strict>, z.ZodObject<{
124
+ kind: z.ZodLiteral<"concept.bold">;
125
+ id: z.ZodString;
126
+ value: z.ZodBoolean;
127
+ }, z.core.$strict>, z.ZodObject<{
128
+ kind: z.ZodLiteral<"concept.italic">;
129
+ id: z.ZodString;
130
+ value: z.ZodBoolean;
131
+ }, z.core.$strict>, z.ZodObject<{
132
+ kind: z.ZodLiteral<"concept.position">;
133
+ id: z.ZodString;
134
+ value: z.ZodObject<{
135
+ x: z.ZodNumber;
136
+ y: z.ZodNumber;
137
+ }, z.core.$strict>;
138
+ }, z.core.$strict>, z.ZodObject<{
139
+ kind: z.ZodLiteral<"concept.positions">;
140
+ updates: z.ZodArray<z.ZodObject<{
141
+ id: z.ZodString;
142
+ position: z.ZodObject<{
143
+ x: z.ZodNumber;
144
+ y: z.ZodNumber;
145
+ }, z.core.$strict>;
146
+ }, z.core.$strict>>;
147
+ }, z.core.$strict>, z.ZodObject<{
148
+ kind: z.ZodLiteral<"concept.add">;
149
+ id: z.ZodString;
150
+ position: z.ZodOptional<z.ZodObject<{
151
+ x: z.ZodNumber;
152
+ y: z.ZodNumber;
153
+ }, z.core.$strict>>;
154
+ }, z.core.$strict>, z.ZodObject<{
155
+ kind: z.ZodLiteral<"concept.remove">;
156
+ id: z.ZodString;
157
+ }, z.core.$strict>, z.ZodObject<{
158
+ kind: z.ZodLiteral<"relation.connect">;
159
+ source: z.ZodString;
160
+ target: z.ZodString;
161
+ type: z.ZodOptional<z.ZodObject<{
162
+ id: z.ZodString;
163
+ label: z.ZodString;
164
+ }, z.core.$strict>>;
165
+ }, z.core.$strict>, z.ZodObject<{
166
+ kind: z.ZodLiteral<"relation.reconnect">;
167
+ id: z.ZodString;
168
+ source: z.ZodString;
169
+ target: z.ZodString;
170
+ }, z.core.$strict>, z.ZodObject<{
171
+ kind: z.ZodLiteral<"relation.type">;
172
+ id: z.ZodString;
173
+ typeId: z.ZodString;
174
+ }, z.core.$strict>, z.ZodObject<{
175
+ kind: z.ZodLiteral<"relation.type.create">;
176
+ id: z.ZodString;
177
+ typeId: z.ZodString;
178
+ label: z.ZodString;
179
+ }, z.core.$strict>, z.ZodObject<{
180
+ kind: z.ZodLiteral<"relation.remove">;
181
+ id: z.ZodString;
182
+ }, z.core.$strict>, z.ZodObject<{
183
+ kind: z.ZodLiteral<"document.reset">;
184
+ id: z.ZodString;
185
+ }, z.core.$strict>, z.ZodObject<{
186
+ kind: z.ZodLiteral<"history.undo">;
187
+ }, z.core.$strict>, z.ZodObject<{
188
+ kind: z.ZodLiteral<"history.redo">;
189
+ }, z.core.$strict>, z.ZodObject<{
190
+ kind: z.ZodLiteral<"selection.set">;
191
+ value: z.ZodArray<z.ZodObject<{
192
+ kind: z.ZodEnum<{
193
+ concept: "concept";
194
+ relation: "relation";
195
+ }>;
196
+ id: z.ZodString;
197
+ }, z.core.$strict>>;
198
+ }, z.core.$strict>, z.ZodObject<{
199
+ kind: z.ZodLiteral<"view.activate">;
200
+ id: z.ZodNullable<z.ZodString>;
201
+ }, z.core.$strict>, z.ZodObject<{
202
+ kind: z.ZodLiteral<"view.create">;
203
+ id: z.ZodString;
204
+ name: z.ZodString;
205
+ conceptIds: z.ZodArray<z.ZodString>;
206
+ }, z.core.$strict>, z.ZodObject<{
207
+ kind: z.ZodLiteral<"view.rename">;
208
+ id: z.ZodString;
209
+ name: z.ZodString;
210
+ }, z.core.$strict>, z.ZodObject<{
211
+ kind: z.ZodLiteral<"view.pin">;
212
+ id: z.ZodString;
213
+ pinned: z.ZodBoolean;
214
+ }, z.core.$strict>, z.ZodObject<{
215
+ kind: z.ZodLiteral<"view.membership">;
216
+ viewId: z.ZodString;
217
+ conceptId: z.ZodString;
218
+ included: z.ZodBoolean;
219
+ }, z.core.$strict>, z.ZodObject<{
220
+ kind: z.ZodLiteral<"view.remove">;
221
+ id: z.ZodString;
222
+ }, z.core.$strict>, ...z.ZodObject<{
223
+ kind: z.ZodLiteral<"preferences.theme" | "preferences.vocab">;
224
+ id: z.ZodString;
225
+ }, z.core.$strict>[], z.ZodObject<{
226
+ kind: z.ZodLiteral<"preferences.locale">;
227
+ value: z.ZodEnum<{
228
+ en: "en";
229
+ it: "it";
230
+ "zh-CN": "zh-CN";
231
+ }>;
232
+ }, z.core.$strict>, z.ZodObject<{
233
+ kind: z.ZodLiteral<"preferences.panels">;
234
+ value: z.ZodObject<{
235
+ explorerWidth: z.ZodNumber;
236
+ inspectorWidth: z.ZodNumber;
237
+ }, z.core.$strict>;
238
+ }, z.core.$strict>, z.ZodObject<{
239
+ kind: z.ZodLiteral<"preferences.section">;
240
+ id: z.ZodEnum<{
241
+ inspector: "inspector";
242
+ "inspector.connections": "inspector.connections";
243
+ "inspector.nodes": "inspector.nodes";
244
+ "inspector.views": "inspector.views";
245
+ sidebar: "sidebar";
246
+ "sidebar.pinned-views": "sidebar.pinned-views";
247
+ "sidebar.views": "sidebar.views";
248
+ }>;
249
+ open: z.ZodBoolean;
250
+ }, z.core.$strict>], "kind">>;
251
+ revision: z.ZodNumber;
252
+ options: z.ZodOptional<z.ZodObject<{
253
+ historyGroup: z.ZodOptional<z.ZodString>;
254
+ }, z.core.$strict>>;
255
+ }, z.core.$strict>;
256
+ }, z.core.$strict>, z.ZodObject<{
257
+ type: z.ZodLiteral<"request">;
258
+ id: z.ZodNumber;
259
+ contextId: z.ZodString;
260
+ method: z.ZodLiteral<"document.refresh">;
261
+ params: z.ZodObject<{}, z.core.$strict>;
262
+ }, z.core.$strict>, z.ZodObject<{
263
+ type: z.ZodLiteral<"request">;
264
+ id: z.ZodNumber;
265
+ contextId: z.ZodString;
266
+ method: z.ZodLiteral<"storage.list">;
267
+ params: z.ZodObject<{}, z.core.$strict>;
268
+ }, z.core.$strict>, z.ZodObject<{
269
+ type: z.ZodLiteral<"request">;
270
+ id: z.ZodNumber;
271
+ contextId: z.ZodString;
272
+ method: z.ZodLiteral<"storage.set">;
273
+ params: z.ZodObject<{
274
+ key: z.ZodString;
275
+ conceptId: z.ZodOptional<z.ZodString>;
276
+ value: z.ZodPipe<z.ZodCustom<string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | /*elided*/ any | {
277
+ readonly [key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null;
278
+ } | null)[] | {
279
+ readonly [key: string]: string | number | boolean | any | any | null;
280
+ } | null)[] | {
281
+ readonly [key: string]: string | number | boolean | any | any | null;
282
+ } | null)[] | {
283
+ readonly [key: string]: string | number | boolean | any | any | null;
284
+ } | null)[] | {
285
+ readonly [key: string]: string | number | boolean | any | any | null;
286
+ } | null)[] | {
287
+ readonly [key: string]: string | number | boolean | any | any | null;
288
+ } | null)[] | {
289
+ readonly [key: string]: string | number | boolean | any | any | null;
290
+ } | null)[] | {
291
+ readonly [key: string]: string | number | boolean | any | any | null;
292
+ } | null)[] | {
293
+ readonly [key: string]: string | number | boolean | any | any | null;
294
+ } | null)[] | {
295
+ readonly [key: string]: string | number | boolean | any | any | null;
296
+ } | null)[] | {
297
+ readonly [key: string]: string | number | boolean | any | any | null;
298
+ } | null)[] | {
299
+ readonly [key: string]: string | number | boolean | any | any | null;
300
+ } | null, string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | {
301
+ readonly [key: string]: string | number | boolean | any | any | null;
302
+ } | null)[] | {
303
+ readonly [key: string]: string | number | boolean | any | any | null;
304
+ } | null)[] | {
305
+ readonly [key: string]: string | number | boolean | any | any | null;
306
+ } | null)[] | {
307
+ readonly [key: string]: string | number | boolean | any | any | null;
308
+ } | null)[] | {
309
+ readonly [key: string]: string | number | boolean | any | any | null;
310
+ } | null)[] | {
311
+ readonly [key: string]: string | number | boolean | any | any | null;
312
+ } | null)[] | {
313
+ readonly [key: string]: string | number | boolean | any | any | null;
314
+ } | null)[] | {
315
+ readonly [key: string]: string | number | boolean | any | any | null;
316
+ } | null)[] | {
317
+ readonly [key: string]: string | number | boolean | any | any | null;
318
+ } | null)[] | {
319
+ readonly [key: string]: string | number | boolean | any | any | null;
320
+ } | null)[] | {
321
+ readonly [key: string]: string | number | boolean | any | any | null;
322
+ } | null)[] | {
323
+ readonly [key: string]: string | number | boolean | any | any | null;
324
+ } | null>, z.ZodTransform<string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | {
325
+ readonly [key: string]: string | number | boolean | any | any | null;
326
+ } | null)[] | {
327
+ readonly [key: string]: string | number | boolean | any | any | null;
328
+ } | null)[] | {
329
+ readonly [key: string]: string | number | boolean | any | any | null;
330
+ } | null)[] | {
331
+ readonly [key: string]: string | number | boolean | any | any | null;
332
+ } | null)[] | {
333
+ readonly [key: string]: string | number | boolean | any | any | null;
334
+ } | null)[] | {
335
+ readonly [key: string]: string | number | boolean | any | any | null;
336
+ } | null)[] | {
337
+ readonly [key: string]: string | number | boolean | any | any | null;
338
+ } | null)[] | {
339
+ readonly [key: string]: string | number | boolean | any | any | null;
340
+ } | null)[] | {
341
+ readonly [key: string]: string | number | boolean | any | any | null;
342
+ } | null)[] | {
343
+ readonly [key: string]: string | number | boolean | any | any | null;
344
+ } | null)[] | {
345
+ readonly [key: string]: string | number | boolean | any | any | null;
346
+ } | null)[] | {
347
+ readonly [key: string]: string | number | boolean | any | any | null;
348
+ } | null, string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | {
349
+ readonly [key: string]: string | number | boolean | any | any | null;
350
+ } | null)[] | {
351
+ readonly [key: string]: string | number | boolean | any | any | null;
352
+ } | null)[] | {
353
+ readonly [key: string]: string | number | boolean | any | any | null;
354
+ } | null)[] | {
355
+ readonly [key: string]: string | number | boolean | any | any | null;
356
+ } | null)[] | {
357
+ readonly [key: string]: string | number | boolean | any | any | null;
358
+ } | null)[] | {
359
+ readonly [key: string]: string | number | boolean | any | any | null;
360
+ } | null)[] | {
361
+ readonly [key: string]: string | number | boolean | any | any | null;
362
+ } | null)[] | {
363
+ readonly [key: string]: string | number | boolean | any | any | null;
364
+ } | null)[] | {
365
+ readonly [key: string]: string | number | boolean | any | any | null;
366
+ } | null)[] | {
367
+ readonly [key: string]: string | number | boolean | any | any | null;
368
+ } | null)[] | {
369
+ readonly [key: string]: string | number | boolean | any | any | null;
370
+ } | null)[] | {
371
+ readonly [key: string]: string | number | boolean | any | any | null;
372
+ } | null>>;
373
+ revision: z.ZodNumber;
374
+ }, z.core.$strict>;
375
+ }, z.core.$strict>, z.ZodObject<{
376
+ type: z.ZodLiteral<"request">;
377
+ id: z.ZodNumber;
378
+ contextId: z.ZodString;
379
+ method: z.ZodLiteral<"storage.delete">;
380
+ params: z.ZodObject<{
381
+ key: z.ZodString;
382
+ conceptId: z.ZodOptional<z.ZodString>;
383
+ revision: z.ZodNumber;
384
+ }, z.core.$strict>;
385
+ }, z.core.$strict>, z.ZodObject<{
386
+ type: z.ZodLiteral<"request">;
387
+ id: z.ZodNumber;
388
+ contextId: z.ZodString;
389
+ method: z.ZodLiteral<"notifications.notify">;
390
+ params: z.ZodObject<{
391
+ tone: z.ZodEnum<{
392
+ info: "info";
393
+ warning: "warning";
394
+ }>;
395
+ title: z.ZodObject<{
396
+ en: z.ZodString;
397
+ it: z.ZodOptional<z.ZodString>;
398
+ 'zh-CN': z.ZodOptional<z.ZodString>;
399
+ }, z.core.$strict>;
400
+ description: z.ZodOptional<z.ZodObject<{
401
+ en: z.ZodString;
402
+ it: z.ZodOptional<z.ZodString>;
403
+ 'zh-CN': z.ZodOptional<z.ZodString>;
404
+ }, z.core.$strict>>;
405
+ }, z.core.$strict>;
406
+ }, z.core.$strict>, z.ZodObject<{
407
+ type: z.ZodLiteral<"request">;
408
+ id: z.ZodNumber;
409
+ contextId: z.ZodString;
410
+ method: z.ZodLiteral<"files.open">;
411
+ params: z.ZodObject<{
412
+ extensions: z.ZodArray<z.ZodString>;
413
+ mimeTypes: z.ZodArray<z.ZodString>;
414
+ }, z.core.$strict>;
415
+ }, z.core.$strict>, z.ZodObject<{
416
+ type: z.ZodLiteral<"request">;
417
+ id: z.ZodNumber;
418
+ contextId: z.ZodString;
419
+ method: z.ZodLiteral<"files.save">;
420
+ params: z.ZodObject<{
421
+ name: z.ZodString;
422
+ mediaType: z.ZodString;
423
+ text: z.ZodString;
424
+ }, z.core.$strict>;
425
+ }, z.core.$strict>], "method">, z.ZodObject<{
426
+ type: z.ZodLiteral<"panel-ready">;
427
+ }, z.core.$strict>, z.ZodObject<{
428
+ type: z.ZodLiteral<"pong">;
429
+ id: z.ZodNumber;
430
+ }, z.core.$strict>, z.ZodObject<{
431
+ type: z.ZodLiteral<"contribution">;
432
+ value: z.ZodUnknown;
433
+ }, z.core.$strict>, z.ZodObject<{
434
+ type: z.ZodLiteral<"badge-result">;
435
+ value: z.ZodObject<{
436
+ value: z.ZodNullable<z.ZodNumber>;
437
+ refreshAt: z.ZodOptional<z.ZodNumber>;
438
+ }, z.core.$strict>;
439
+ }, z.core.$strict>, z.ZodObject<{
440
+ type: z.ZodLiteral<"close">;
441
+ reason: z.ZodString;
442
+ }, z.core.$strict>, z.ZodObject<{
443
+ type: z.ZodLiteral<"complete">;
444
+ ok: z.ZodLiteral<true>;
445
+ }, z.core.$strict>, z.ZodObject<{
446
+ type: z.ZodLiteral<"complete">;
447
+ ok: z.ZodLiteral<false>;
448
+ error: z.ZodObject<{
449
+ code: z.ZodEnum<{
450
+ cancelled: "cancelled";
451
+ closed: "closed";
452
+ denied: "denied";
453
+ failed: "failed";
454
+ "invalid-input": "invalid-input";
455
+ "stale-context": "stale-context";
456
+ "stale-state": "stale-state";
457
+ timeout: "timeout";
458
+ unavailable: "unavailable";
459
+ }>;
460
+ issues: z.ZodArray<z.ZodObject<{
461
+ path: z.ZodString;
462
+ message: z.ZodString;
463
+ }, z.core.$strict>>;
464
+ displayMessage: z.ZodOptional<z.ZodObject<{
465
+ en: z.ZodString;
466
+ it: z.ZodOptional<z.ZodString>;
467
+ 'zh-CN': z.ZodOptional<z.ZodString>;
468
+ }, z.core.$strict>>;
469
+ }, z.core.$strict>;
470
+ }, z.core.$strict>]>;
471
+ declare const actionDescriptor: z.ZodObject<{
472
+ id: z.ZodString;
473
+ label: z.ZodObject<{
474
+ en: z.ZodString;
475
+ it: z.ZodOptional<z.ZodString>;
476
+ 'zh-CN': z.ZodOptional<z.ZodString>;
477
+ }, z.core.$strict>;
478
+ icon: z.ZodOptional<z.ZodString>;
479
+ ui: z.ZodOptional<z.ZodLiteral<true>>;
480
+ badge: z.ZodOptional<z.ZodLiteral<true>>;
481
+ }, z.core.$strict>;
482
+ export declare const actionIconNames: readonly ['arrow-right', 'book-open', 'clipboard-paste', 'copy', 'download', 'file-down', 'file-up', 'folder', 'glasses', 'globe', 'layers', 'pencil', 'play', 'plus', 'refresh', 'repeat', 'scissors', 'search', 'share', 'sparkles', 'upload', 'zap'];
483
+ export type ActionIconName = (typeof actionIconNames)[number];
484
+ export type ActionDescriptor = DeepReadonly<z.infer<typeof actionDescriptor>>;
485
+ export type ActionContribution = Omit<ActionDescriptor, 'ui' | 'badge'> & {
486
+ readonly badge?: (input: ActionBadgeInput) => ActionBadgeResult | Promise<ActionBadgeResult>;
487
+ } & ({
488
+ readonly ui: ComponentType<ActionContext>;
489
+ readonly run?: never;
490
+ } | {
491
+ readonly ui?: never;
492
+ readonly run: (context: ActionContext) => void | Promise<void>;
493
+ });
494
+ export declare function parseContribution(kind: 'theme' | 'vocab', value: unknown): Definition;
495
+ export declare function parseContribution(kind: 'actions', value: unknown): readonly ActionDescriptor[];
496
+ export type ActionState = {
497
+ readonly revision: number;
498
+ readonly contextId: string;
499
+ readonly locale: Locale;
500
+ readonly theme: Readonly<Record<string, string>>;
501
+ readonly conceptPlacementOffset: Readonly<{
502
+ x: number;
503
+ y: number;
504
+ }>;
505
+ readonly viewGraph: GraphSnapshot;
506
+ readonly selected: Selection;
507
+ readonly workspace: {
508
+ readonly activeViewId: string | null;
509
+ readonly savedViews: readonly Pick<SavedView, 'id' | 'name' | 'pinned'>[];
510
+ };
511
+ readonly targetViewId: string | null;
512
+ readonly activeVocab: VocabDefinition | null;
513
+ readonly history: {
514
+ readonly canUndo: boolean;
515
+ readonly canRedo: boolean;
516
+ };
517
+ };
518
+ type WriteOptions = {
519
+ readonly historyGroup?: string;
520
+ };
521
+ type PluginWrites = Omit<ReturnType<typeof createWriteCommands<Promise<void>, Promise<string>>>, 'undo' | 'redo' | 'setView' | 'setActiveVocab' | 'setActiveTheme' | 'setLocale' | 'setPanelSizes' | 'setSectionOpen' | 'createView' | 'renameView' | 'setViewPinned' | 'deleteView'>;
522
+ export type ActionContext = {
523
+ readonly viewId: string | null;
524
+ readonly document: PluginWrites & {
525
+ readonly getState: () => ActionState;
526
+ readonly subscribe: (listener: () => void) => () => void;
527
+ readonly refresh: () => Promise<ActionState>;
528
+ readonly applyOperations: (operations: readonly NessoOperation[], options?: WriteOptions) => Promise<{
529
+ readonly revision: number;
530
+ readonly changed: boolean;
531
+ }>;
532
+ };
533
+ readonly notifications: {
534
+ readonly notify: (value: {
535
+ readonly tone: 'info' | 'warning';
536
+ readonly title: LocalizedText;
537
+ readonly description?: LocalizedText;
538
+ }) => Promise<string>;
539
+ };
540
+ readonly files: {
541
+ readonly open: (options: FileOpenOptions) => Promise<FileOpenResult>;
542
+ readonly save: (options: FileSaveOptions) => Promise<{
543
+ readonly saved: boolean;
544
+ }>;
545
+ };
546
+ readonly storage: PluginStorage;
547
+ readonly signal: AbortSignal;
548
+ };
549
+ export declare function parsePluginMessage(value: unknown): z.infer<typeof message>;
550
+ export declare function sha256Hex(bytes: Uint8Array): Promise<string>;
551
+ export declare function createPluginClient(port: MessagePort, initial: unknown): {
552
+ context: ActionContext;
553
+ close: () => void;
554
+ getPresentation: () => Pick<ActionState, 'theme' | 'locale'>;
555
+ };