@nesso-how/plugin 0.0.0-stage → 0.1.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,739 @@
1
+ import { ZodType, z } from "zod";
2
+ //#region ../errors/src/index.d.ts
3
+ type ErrorIssue = {
4
+ path: string;
5
+ message: string;
6
+ };
7
+ declare class NessoError extends Error {
8
+ name: string;
9
+ readonly issues: ErrorIssue[];
10
+ constructor(issues: ErrorIssue[]);
11
+ }
12
+ //#endregion
13
+ //#region ../schema/src/types.d.ts
14
+ type Position = {
15
+ x: number;
16
+ y: number;
17
+ };
18
+ type Concept = {
19
+ id: string;
20
+ label: string;
21
+ description?: string;
22
+ color?: string;
23
+ position: Position;
24
+ };
25
+ type RelationType = {
26
+ id: string;
27
+ label: string;
28
+ };
29
+ type Relation = {
30
+ source: string;
31
+ predicate: string;
32
+ target: string;
33
+ };
34
+ type Graph = {
35
+ concepts: Concept[];
36
+ relationTypes: RelationType[];
37
+ relations: Relation[];
38
+ };
39
+ //#endregion
40
+ //#region ../i18n/src/locale.d.ts
41
+ declare const locales: readonly ['en', 'it', 'zh-CN'];
42
+ type Locale = typeof locales[number];
43
+ //#endregion
44
+ //#region src/definitions.d.ts
45
+ declare const themeColors: readonly ['background', 'foreground', 'canvas', 'sidebar', 'primary', 'primary-hover', 'primary-foreground', 'muted', 'muted-foreground', 'hover', 'pressed', 'border', 'ring', 'selection-halo', 'node-border', 'edge', 'handle'];
46
+ declare const themeDefinition: z.ZodObject<{
47
+ id: z.ZodString;
48
+ colors: z.ZodObject<{
49
+ background: z.ZodString;
50
+ border: z.ZodString;
51
+ canvas: z.ZodString;
52
+ edge: z.ZodString;
53
+ foreground: z.ZodString;
54
+ handle: z.ZodString;
55
+ hover: z.ZodString;
56
+ muted: z.ZodString;
57
+ "muted-foreground": z.ZodString;
58
+ "node-border": z.ZodString;
59
+ pressed: z.ZodString;
60
+ primary: z.ZodString;
61
+ "primary-foreground": z.ZodString;
62
+ "primary-hover": z.ZodString;
63
+ ring: z.ZodString;
64
+ "selection-halo": z.ZodString;
65
+ sidebar: z.ZodString;
66
+ }, z.core.$strict>;
67
+ metrics: z.ZodObject<{
68
+ 'radius-control': z.ZodNumber;
69
+ 'radius-object': z.ZodNumber;
70
+ 'duration-state': z.ZodNumber;
71
+ }, z.core.$strict>;
72
+ fonts: z.ZodObject<{
73
+ sans: z.ZodObject<{
74
+ faces: z.ZodArray<z.ZodObject<{
75
+ path: z.ZodString;
76
+ weight: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
77
+ style: z.ZodEnum<{
78
+ italic: "italic";
79
+ normal: "normal";
80
+ }>;
81
+ unicodeRange: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
82
+ }, z.core.$strict>>;
83
+ }, z.core.$strict>;
84
+ mono: z.ZodObject<{
85
+ faces: z.ZodArray<z.ZodObject<{
86
+ path: z.ZodString;
87
+ weight: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
88
+ style: z.ZodEnum<{
89
+ italic: "italic";
90
+ normal: "normal";
91
+ }>;
92
+ unicodeRange: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
93
+ }, z.core.$strict>>;
94
+ }, z.core.$strict>;
95
+ }, z.core.$strict>;
96
+ }, z.core.$strict>;
97
+ type ThemeDefinition = DeepReadonly<z.infer<typeof themeDefinition>>;
98
+ type Definition = ThemeDefinition | VocabDefinition;
99
+ declare function parseDefinition(kind: 'theme', value: unknown): ThemeDefinition;
100
+ declare function parseDefinition(kind: 'vocab', value: unknown): VocabDefinition;
101
+ declare function parseDefinition(kind: 'theme' | 'vocab', value: unknown): Definition;
102
+ //#endregion
103
+ //#region src/types.d.ts
104
+ type DeepReadonly<T> = T extends readonly (infer U)[] ? readonly DeepReadonly<U>[] : T extends object ? { readonly [K in keyof T]: DeepReadonly<T[K]>; } : T;
105
+ type Selection = readonly {
106
+ readonly kind: 'concept' | 'relation';
107
+ readonly id: string;
108
+ }[];
109
+ type GraphSnapshot = DeepReadonly<Graph>;
110
+ type NessoOperation = {
111
+ readonly kind: 'concept.label';
112
+ readonly id: string;
113
+ readonly value: string;
114
+ } | {
115
+ readonly kind: 'concept.description';
116
+ readonly id: string;
117
+ readonly value: string;
118
+ } | {
119
+ readonly kind: 'concept.color';
120
+ readonly id: string;
121
+ readonly value: string;
122
+ } | {
123
+ readonly kind: 'concept.position';
124
+ readonly id: string;
125
+ readonly value: Readonly<Position>;
126
+ } | {
127
+ readonly kind: 'concept.positions';
128
+ readonly updates: readonly {
129
+ readonly id: string;
130
+ readonly position: Readonly<Position>;
131
+ }[];
132
+ } | {
133
+ readonly kind: 'concept.add';
134
+ readonly id: string;
135
+ readonly position?: Readonly<Position>;
136
+ } | {
137
+ readonly kind: 'concept.remove';
138
+ readonly id: string;
139
+ } | {
140
+ readonly kind: 'relation.connect';
141
+ readonly source: string;
142
+ readonly target: string;
143
+ readonly type?: Readonly<RelationType>;
144
+ } | {
145
+ readonly kind: 'relation.reconnect';
146
+ readonly id: string;
147
+ readonly source: string;
148
+ readonly target: string;
149
+ } | {
150
+ readonly kind: 'relation.type';
151
+ readonly id: string;
152
+ readonly typeId: string;
153
+ } | {
154
+ readonly kind: 'relation.type.create';
155
+ readonly id: string;
156
+ readonly typeId: string;
157
+ readonly label: string;
158
+ } | {
159
+ readonly kind: 'relation.remove';
160
+ readonly id: string;
161
+ } | {
162
+ readonly kind: 'document.reset';
163
+ readonly id: string;
164
+ } | {
165
+ readonly kind: 'history.undo';
166
+ } | {
167
+ readonly kind: 'history.redo';
168
+ } | {
169
+ readonly kind: 'selection.set';
170
+ readonly value: Selection;
171
+ } | {
172
+ readonly kind: 'view.activate';
173
+ readonly id: string | null;
174
+ } | {
175
+ readonly kind: 'view.create';
176
+ readonly id: string;
177
+ readonly name: string;
178
+ readonly conceptIds: readonly string[];
179
+ } | {
180
+ readonly kind: 'view.rename';
181
+ readonly id: string;
182
+ readonly name: string;
183
+ } | {
184
+ readonly kind: 'view.pin';
185
+ readonly id: string;
186
+ readonly pinned: boolean;
187
+ } | {
188
+ readonly kind: 'view.membership';
189
+ readonly viewId: string;
190
+ readonly conceptId: string;
191
+ readonly included: boolean;
192
+ } | {
193
+ readonly kind: 'view.remove';
194
+ readonly id: string;
195
+ } | {
196
+ readonly kind: 'viewport.set';
197
+ readonly rendererId: string;
198
+ readonly value: Viewport;
199
+ } | {
200
+ readonly kind: 'preferences.vocab';
201
+ readonly id: string;
202
+ } | {
203
+ readonly kind: 'preferences.renderer';
204
+ readonly id: string;
205
+ } | {
206
+ readonly kind: 'preferences.theme';
207
+ readonly id: string;
208
+ } | {
209
+ readonly kind: 'preferences.locale';
210
+ readonly value: Locale;
211
+ } | {
212
+ readonly kind: 'preferences.panels';
213
+ readonly value: PanelSizes;
214
+ } | {
215
+ readonly kind: 'preferences.section';
216
+ readonly id: SectionId;
217
+ readonly open: boolean;
218
+ };
219
+ type VocabDefinition = {
220
+ readonly id: string;
221
+ readonly relationTypes: readonly Readonly<RelationType>[];
222
+ readonly defaultTypeId: string;
223
+ };
224
+ type SavedView = {
225
+ readonly id: string;
226
+ readonly name: string;
227
+ readonly conceptIds: readonly string[];
228
+ readonly pinned: boolean;
229
+ };
230
+ type Viewport = {
231
+ readonly x: number;
232
+ readonly y: number;
233
+ readonly zoom: number;
234
+ };
235
+ type WorkspaceState = {
236
+ readonly activeViewId: string | null;
237
+ readonly savedViews: readonly SavedView[];
238
+ readonly viewports: Readonly<Partial<Record<string, Viewport>>>;
239
+ };
240
+ type PanelSizes = {
241
+ readonly explorerWidth: number;
242
+ readonly inspectorWidth: number;
243
+ };
244
+ type SectionId = 'sidebar' | 'sidebar.pinned-views' | 'sidebar.views' | 'inspector' | 'inspector.connections' | 'inspector.views' | 'inspector.nodes';
245
+ type Preferences = {
246
+ readonly locale?: Locale;
247
+ readonly introSeen?: boolean;
248
+ readonly activeVocabId: string;
249
+ readonly activeRendererId: string;
250
+ readonly activeThemeId: string;
251
+ readonly panels: PanelSizes;
252
+ readonly inspectorTab?: 'details' | 'chat';
253
+ readonly collapsedSections?: readonly SectionId[];
254
+ };
255
+ type NessoState = {
256
+ readonly graph: GraphSnapshot;
257
+ readonly workspace: WorkspaceState;
258
+ readonly preferences: Preferences;
259
+ readonly viewGraph: GraphSnapshot;
260
+ readonly selected: Selection;
261
+ readonly vocabs: readonly VocabDefinition[];
262
+ readonly history: {
263
+ readonly canUndo: boolean;
264
+ readonly canRedo: boolean;
265
+ };
266
+ };
267
+ type NessoStore = {
268
+ readonly getState: () => NessoState;
269
+ readonly subscribe: (listener: () => void) => () => void;
270
+ readonly conceptPlacementOffset: Readonly<Position>;
271
+ readonly setSelection: (selection: Selection) => void;
272
+ readonly setView: (id: string | null) => void;
273
+ readonly setViewport: (rendererId: string, viewport: Viewport) => void;
274
+ readonly setConceptPosition: (id: string, position: Readonly<Position>, historyGroup?: string) => void;
275
+ readonly setConceptPositions: (updates: readonly {
276
+ readonly id: string;
277
+ readonly position: Readonly<Position>;
278
+ }[], historyGroup?: string) => void;
279
+ readonly setConceptLabel: (id: string, label: string, historyGroup?: string) => void;
280
+ readonly setConceptDescription: (id: string, description: string, historyGroup?: string) => void;
281
+ readonly setConceptColor: (id: string, color: string, historyGroup?: string) => void;
282
+ readonly addConcept: (position?: Readonly<Position>, historyGroup?: string) => string;
283
+ readonly connect: (source: string, target: string) => void;
284
+ readonly reconnectRelation: (id: string, source: string, target: string) => void;
285
+ readonly setRelationType: (id: string, typeId: string) => void;
286
+ readonly createRelationType: (id: string, label: string) => void;
287
+ readonly removeConcept: (id: string) => void;
288
+ readonly removeRelation: (id: string) => void;
289
+ readonly applyOperations: (operations: readonly NessoOperation[], options?: {
290
+ readonly historyGroup?: string;
291
+ }) => void;
292
+ readonly undo: () => void;
293
+ readonly redo: () => void;
294
+ readonly setActiveVocab: (id: string) => void;
295
+ readonly setActiveRenderer: (id: string) => void;
296
+ readonly setActiveTheme: (id: string) => void;
297
+ readonly setLocale: (locale: Locale) => void;
298
+ readonly setPanelSizes: (sizes: PanelSizes) => void;
299
+ readonly setSectionOpen: (id: SectionId, open: boolean) => void;
300
+ readonly resetGraph: () => void;
301
+ readonly createView: (name: string, conceptIds: readonly string[]) => string;
302
+ readonly renameView: (id: string, name: string) => void;
303
+ readonly setViewPinned: (id: string, pinned: boolean) => void;
304
+ readonly setViewMembership: (viewId: string, conceptId: string, included: boolean) => void;
305
+ readonly deleteView: (id: string) => void;
306
+ readonly getViewGraph: (id: string) => GraphSnapshot;
307
+ };
308
+ type NotificationAction = {
309
+ readonly label: string;
310
+ readonly onClick: () => void;
311
+ };
312
+ type Notification = {
313
+ readonly title: string;
314
+ readonly description?: string;
315
+ } & ({
316
+ readonly tone: 'info' | 'warning';
317
+ } | {
318
+ readonly tone: 'confirmation';
319
+ readonly action: NotificationAction;
320
+ readonly cancelAction: NotificationAction;
321
+ });
322
+ type Notifications = {
323
+ readonly notify: (notification: Notification) => string;
324
+ readonly dismiss: (id: string) => void;
325
+ };
326
+ //#endregion
327
+ //#region src/i18n.d.ts
328
+ type LocalizedText = Readonly<{
329
+ en: string;
330
+ } & Partial<Record<Locale, string>>>;
331
+ declare const resolvePluginText: (value: LocalizedText, locale: Locale) => string;
332
+ //#endregion
333
+ //#region src/errors.d.ts
334
+ declare class PluginError extends NessoError {
335
+ name: string;
336
+ readonly code: string;
337
+ readonly displayMessage?: LocalizedText;
338
+ constructor(code: string, issues: ErrorIssue[], displayMessage?: LocalizedText);
339
+ }
340
+ declare function parseOrThrow(schema: ZodType, value: unknown, prefix?: string): any;
341
+ //#endregion
342
+ //#region src/commands.d.ts
343
+ type WriteMethods = Omit<NessoStore, 'getState' | 'subscribe' | 'getViewGraph' | 'conceptPlacementOffset' | 'applyOperations' | 'setViewport' | 'setActiveRenderer' | 'resetGraph'>;
344
+ declare function createWriteCommands<Commit, Created>(applyOperations: (...args: Parameters<NessoStore['applyOperations']>) => Commit, created: (id: string, commit: Commit) => Created): { readonly [K in keyof WriteMethods]: (...args: Parameters<WriteMethods[K]>) => K extends 'addConcept' | 'createView' ? Created : Commit; };
345
+ //#endregion
346
+ //#region src/files.d.ts
347
+ declare const fileTextLimit: number;
348
+ declare const fileOpenOptions: z.ZodObject<{
349
+ extensions: z.ZodArray<z.ZodString>;
350
+ mimeTypes: z.ZodArray<z.ZodString>;
351
+ }, z.core.$strict>;
352
+ declare const fileSaveOptions: z.ZodObject<{
353
+ name: z.ZodString;
354
+ mediaType: z.ZodString;
355
+ text: z.ZodString;
356
+ }, z.core.$strict>;
357
+ declare const fileOpenResult: z.ZodNullable<z.ZodObject<{
358
+ name: z.ZodString;
359
+ mediaType: z.ZodString;
360
+ text: z.ZodString;
361
+ }, z.core.$strict>>;
362
+ type FileOpenOptions = z.infer<typeof fileOpenOptions>;
363
+ type FileSaveOptions = z.infer<typeof fileSaveOptions>;
364
+ type FileOpenResult = z.infer<typeof fileOpenResult>;
365
+ declare function parseFileOptions<K extends 'open' | 'save'>(kind: K, value: unknown): K extends 'open' ? FileOpenOptions : FileSaveOptions;
366
+ //#endregion
367
+ //#region src/runtime.d.ts
368
+ declare const runtimeLimits: {
369
+ readonly request: number;
370
+ readonly snapshot: number;
371
+ readonly pending: 64;
372
+ readonly deadline: 30000;
373
+ readonly interaction: 300000;
374
+ readonly initialization: 10000;
375
+ readonly action: 120000;
376
+ };
377
+ 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"];
378
+ declare const metadata: z.ZodObject<{
379
+ name: z.ZodObject<{
380
+ en: z.ZodString;
381
+ it: z.ZodOptional<z.ZodString>;
382
+ 'zh-CN': z.ZodOptional<z.ZodString>;
383
+ }, z.core.$strict>;
384
+ description: z.ZodObject<{
385
+ en: z.ZodString;
386
+ it: z.ZodOptional<z.ZodString>;
387
+ 'zh-CN': z.ZodOptional<z.ZodString>;
388
+ }, z.core.$strict>;
389
+ documentation: z.ZodObject<{
390
+ en: z.ZodString;
391
+ it: z.ZodOptional<z.ZodString>;
392
+ 'zh-CN': z.ZodOptional<z.ZodString>;
393
+ }, z.core.$strict>;
394
+ }, z.core.$strict>;
395
+ type PluginI18n = DeepReadonly<{
396
+ metadata: z.infer<typeof metadata>;
397
+ [key: string]: LocalizedText | z.infer<typeof metadata>;
398
+ }>;
399
+ declare function parsePluginI18n(value: unknown): PluginI18n;
400
+ declare const manifest: z.ZodDiscriminatedUnion<[z.ZodObject<{
401
+ apiVersion: z.ZodLiteral<1>;
402
+ kind: z.ZodLiteral<"actions">;
403
+ entry: z.ZodString;
404
+ writes: z.ZodArray<z.ZodEnum<{
405
+ "concept.add": "concept.add";
406
+ "concept.color": "concept.color";
407
+ "concept.description": "concept.description";
408
+ "concept.label": "concept.label";
409
+ "concept.position": "concept.position";
410
+ "concept.positions": "concept.positions";
411
+ "concept.remove": "concept.remove";
412
+ "relation.connect": "relation.connect";
413
+ "relation.reconnect": "relation.reconnect";
414
+ "relation.remove": "relation.remove";
415
+ "relation.type": "relation.type";
416
+ "relation.type.create": "relation.type.create";
417
+ "selection.set": "selection.set";
418
+ "view.membership": "view.membership";
419
+ }>>;
420
+ capabilities: z.ZodArray<z.ZodEnum<{
421
+ "files.open": "files.open";
422
+ "files.save": "files.save";
423
+ "notifications.notify": "notifications.notify";
424
+ }>>;
425
+ }, z.core.$strict>, ...z.ZodObject<{
426
+ apiVersion: z.ZodLiteral<1>;
427
+ kind: z.ZodLiteral<"theme" | "vocab">;
428
+ entry: z.ZodString;
429
+ writes: z.ZodTuple<[], null>;
430
+ capabilities: z.ZodTuple<[], null>;
431
+ }, z.core.$strict>[]], "kind">;
432
+ type PluginManifest = DeepReadonly<z.infer<typeof manifest>>;
433
+ declare function parsePluginManifest(value: unknown): z.infer<typeof manifest>;
434
+ declare const message: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
435
+ type: z.ZodLiteral<"request">;
436
+ id: z.ZodNumber;
437
+ contextId: z.ZodString;
438
+ method: z.ZodLiteral<"store.applyOperations">;
439
+ params: z.ZodObject<{
440
+ operations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
441
+ kind: z.ZodLiteral<"concept.label">;
442
+ id: z.ZodString;
443
+ value: z.ZodString;
444
+ }, z.core.$strict>, z.ZodObject<{
445
+ kind: z.ZodLiteral<"concept.description">;
446
+ id: z.ZodString;
447
+ value: z.ZodString;
448
+ }, z.core.$strict>, z.ZodObject<{
449
+ kind: z.ZodLiteral<"concept.color">;
450
+ id: z.ZodString;
451
+ value: z.ZodString;
452
+ }, z.core.$strict>, z.ZodObject<{
453
+ kind: z.ZodLiteral<"concept.position">;
454
+ id: z.ZodString;
455
+ value: z.ZodObject<{
456
+ x: z.ZodNumber;
457
+ y: z.ZodNumber;
458
+ }, z.core.$strict>;
459
+ }, z.core.$strict>, z.ZodObject<{
460
+ kind: z.ZodLiteral<"concept.positions">;
461
+ updates: z.ZodArray<z.ZodObject<{
462
+ id: z.ZodString;
463
+ position: z.ZodObject<{
464
+ x: z.ZodNumber;
465
+ y: z.ZodNumber;
466
+ }, z.core.$strict>;
467
+ }, z.core.$strict>>;
468
+ }, z.core.$strict>, z.ZodObject<{
469
+ kind: z.ZodLiteral<"concept.add">;
470
+ id: z.ZodString;
471
+ position: z.ZodOptional<z.ZodObject<{
472
+ x: z.ZodNumber;
473
+ y: z.ZodNumber;
474
+ }, z.core.$strict>>;
475
+ }, z.core.$strict>, z.ZodObject<{
476
+ kind: z.ZodLiteral<"concept.remove">;
477
+ id: z.ZodString;
478
+ }, z.core.$strict>, z.ZodObject<{
479
+ kind: z.ZodLiteral<"relation.connect">;
480
+ source: z.ZodString;
481
+ target: z.ZodString;
482
+ type: z.ZodOptional<z.ZodObject<{
483
+ id: z.ZodString;
484
+ label: z.ZodString;
485
+ }, z.core.$strict>>;
486
+ }, z.core.$strict>, z.ZodObject<{
487
+ kind: z.ZodLiteral<"relation.reconnect">;
488
+ id: z.ZodString;
489
+ source: z.ZodString;
490
+ target: z.ZodString;
491
+ }, z.core.$strict>, z.ZodObject<{
492
+ kind: z.ZodLiteral<"relation.type">;
493
+ id: z.ZodString;
494
+ typeId: z.ZodString;
495
+ }, z.core.$strict>, z.ZodObject<{
496
+ kind: z.ZodLiteral<"relation.type.create">;
497
+ id: z.ZodString;
498
+ typeId: z.ZodString;
499
+ label: z.ZodString;
500
+ }, z.core.$strict>, z.ZodObject<{
501
+ kind: z.ZodLiteral<"relation.remove">;
502
+ id: z.ZodString;
503
+ }, z.core.$strict>, z.ZodObject<{
504
+ kind: z.ZodLiteral<"document.reset">;
505
+ id: z.ZodString;
506
+ }, z.core.$strict>, z.ZodObject<{
507
+ kind: z.ZodLiteral<"history.undo">;
508
+ }, z.core.$strict>, z.ZodObject<{
509
+ kind: z.ZodLiteral<"history.redo">;
510
+ }, z.core.$strict>, z.ZodObject<{
511
+ kind: z.ZodLiteral<"selection.set">;
512
+ value: z.ZodArray<z.ZodObject<{
513
+ kind: z.ZodEnum<{
514
+ concept: "concept";
515
+ relation: "relation";
516
+ }>;
517
+ id: z.ZodString;
518
+ }, z.core.$strict>>;
519
+ }, z.core.$strict>, z.ZodObject<{
520
+ kind: z.ZodLiteral<"view.activate">;
521
+ id: z.ZodNullable<z.ZodString>;
522
+ }, z.core.$strict>, z.ZodObject<{
523
+ kind: z.ZodLiteral<"view.create">;
524
+ id: z.ZodString;
525
+ name: z.ZodString;
526
+ conceptIds: z.ZodArray<z.ZodString>;
527
+ }, z.core.$strict>, z.ZodObject<{
528
+ kind: z.ZodLiteral<"view.rename">;
529
+ id: z.ZodString;
530
+ name: z.ZodString;
531
+ }, z.core.$strict>, z.ZodObject<{
532
+ kind: z.ZodLiteral<"view.pin">;
533
+ id: z.ZodString;
534
+ pinned: z.ZodBoolean;
535
+ }, z.core.$strict>, z.ZodObject<{
536
+ kind: z.ZodLiteral<"view.membership">;
537
+ viewId: z.ZodString;
538
+ conceptId: z.ZodString;
539
+ included: z.ZodBoolean;
540
+ }, z.core.$strict>, z.ZodObject<{
541
+ kind: z.ZodLiteral<"view.remove">;
542
+ id: z.ZodString;
543
+ }, z.core.$strict>, ...z.ZodObject<{
544
+ kind: z.ZodLiteral<"preferences.theme" | "preferences.vocab">;
545
+ id: z.ZodString;
546
+ }, z.core.$strict>[], z.ZodObject<{
547
+ kind: z.ZodLiteral<"preferences.locale">;
548
+ value: z.ZodEnum<{
549
+ en: "en";
550
+ it: "it";
551
+ "zh-CN": "zh-CN";
552
+ }>;
553
+ }, z.core.$strict>, z.ZodObject<{
554
+ kind: z.ZodLiteral<"preferences.panels">;
555
+ value: z.ZodObject<{
556
+ explorerWidth: z.ZodNumber;
557
+ inspectorWidth: z.ZodNumber;
558
+ }, z.core.$strict>;
559
+ }, z.core.$strict>, z.ZodObject<{
560
+ kind: z.ZodLiteral<"preferences.section">;
561
+ id: z.ZodEnum<{
562
+ inspector: "inspector";
563
+ "inspector.connections": "inspector.connections";
564
+ "inspector.nodes": "inspector.nodes";
565
+ "inspector.views": "inspector.views";
566
+ sidebar: "sidebar";
567
+ "sidebar.pinned-views": "sidebar.pinned-views";
568
+ "sidebar.views": "sidebar.views";
569
+ }>;
570
+ open: z.ZodBoolean;
571
+ }, z.core.$strict>], "kind">>;
572
+ options: z.ZodOptional<z.ZodObject<{
573
+ historyGroup: z.ZodOptional<z.ZodString>;
574
+ atRevision: z.ZodOptional<z.ZodNumber>;
575
+ }, z.core.$strict>>;
576
+ }, z.core.$strict>;
577
+ }, z.core.$strict>, z.ZodObject<{
578
+ type: z.ZodLiteral<"request">;
579
+ id: z.ZodNumber;
580
+ contextId: z.ZodString;
581
+ method: z.ZodLiteral<"store.refresh">;
582
+ params: z.ZodObject<{}, z.core.$strict>;
583
+ }, z.core.$strict>, z.ZodObject<{
584
+ type: z.ZodLiteral<"request">;
585
+ id: z.ZodNumber;
586
+ contextId: z.ZodString;
587
+ method: z.ZodLiteral<"notifications.notify">;
588
+ params: z.ZodObject<{
589
+ tone: z.ZodEnum<{
590
+ info: "info";
591
+ warning: "warning";
592
+ }>;
593
+ title: z.ZodObject<{
594
+ en: z.ZodString;
595
+ it: z.ZodOptional<z.ZodString>;
596
+ 'zh-CN': z.ZodOptional<z.ZodString>;
597
+ }, z.core.$strict>;
598
+ description: z.ZodOptional<z.ZodObject<{
599
+ en: z.ZodString;
600
+ it: z.ZodOptional<z.ZodString>;
601
+ 'zh-CN': z.ZodOptional<z.ZodString>;
602
+ }, z.core.$strict>>;
603
+ }, z.core.$strict>;
604
+ }, z.core.$strict>, z.ZodObject<{
605
+ type: z.ZodLiteral<"request">;
606
+ id: z.ZodNumber;
607
+ contextId: z.ZodString;
608
+ method: z.ZodLiteral<"files.open">;
609
+ params: z.ZodObject<{
610
+ extensions: z.ZodArray<z.ZodString>;
611
+ mimeTypes: z.ZodArray<z.ZodString>;
612
+ }, z.core.$strict>;
613
+ }, z.core.$strict>, z.ZodObject<{
614
+ type: z.ZodLiteral<"request">;
615
+ id: z.ZodNumber;
616
+ contextId: z.ZodString;
617
+ method: z.ZodLiteral<"files.save">;
618
+ params: z.ZodObject<{
619
+ name: z.ZodString;
620
+ mediaType: z.ZodString;
621
+ text: z.ZodString;
622
+ }, z.core.$strict>;
623
+ }, z.core.$strict>], "method">, z.ZodObject<{
624
+ type: z.ZodLiteral<"contribution">;
625
+ value: z.ZodUnknown;
626
+ }, z.core.$strict>, z.ZodObject<{
627
+ type: z.ZodLiteral<"close">;
628
+ reason: z.ZodString;
629
+ }, z.core.$strict>, z.ZodObject<{
630
+ type: z.ZodLiteral<"complete">;
631
+ ok: z.ZodLiteral<true>;
632
+ }, z.core.$strict>, z.ZodObject<{
633
+ type: z.ZodLiteral<"complete">;
634
+ ok: z.ZodLiteral<false>;
635
+ error: z.ZodObject<{
636
+ code: z.ZodEnum<{
637
+ cancelled: "cancelled";
638
+ closed: "closed";
639
+ denied: "denied";
640
+ failed: "failed";
641
+ "invalid-input": "invalid-input";
642
+ "stale-context": "stale-context";
643
+ "stale-state": "stale-state";
644
+ timeout: "timeout";
645
+ unavailable: "unavailable";
646
+ }>;
647
+ issues: z.ZodArray<z.ZodObject<{
648
+ path: z.ZodString;
649
+ message: z.ZodString;
650
+ }, z.core.$strict>>;
651
+ displayMessage: z.ZodOptional<z.ZodObject<{
652
+ en: z.ZodString;
653
+ it: z.ZodOptional<z.ZodString>;
654
+ 'zh-CN': z.ZodOptional<z.ZodString>;
655
+ }, z.core.$strict>>;
656
+ }, z.core.$strict>;
657
+ }, z.core.$strict>]>;
658
+ declare const actionDescriptor: z.ZodObject<{
659
+ id: z.ZodString;
660
+ label: z.ZodObject<{
661
+ en: z.ZodString;
662
+ it: z.ZodOptional<z.ZodString>;
663
+ 'zh-CN': z.ZodOptional<z.ZodString>;
664
+ }, z.core.$strict>;
665
+ supportsViews: z.ZodBoolean;
666
+ }, z.core.$strict>;
667
+ type ActionDescriptor = DeepReadonly<z.infer<typeof actionDescriptor>>;
668
+ type ActionContribution = ActionDescriptor & {
669
+ readonly run: (invocation: {
670
+ readonly viewId: string | null;
671
+ }) => void | Promise<void>;
672
+ };
673
+ declare function parseContribution(kind: 'theme' | 'vocab', value: unknown): Definition;
674
+ declare function parseContribution(kind: 'actions', value: unknown): readonly ActionDescriptor[];
675
+ type BaseState = {
676
+ readonly revision: number;
677
+ readonly contextId: string;
678
+ readonly locale: Locale;
679
+ readonly theme: Readonly<Record<string, string>>;
680
+ readonly conceptPlacementOffset: Readonly<{
681
+ x: number;
682
+ y: number;
683
+ }>;
684
+ };
685
+ type ViewState = BaseState & {
686
+ readonly viewGraph: GraphSnapshot;
687
+ readonly selected: Selection;
688
+ readonly workspace: {
689
+ readonly activeViewId: string | null;
690
+ readonly savedViews: readonly Pick<SavedView, 'id' | 'name' | 'pinned'>[];
691
+ };
692
+ readonly targetViewId: string | null;
693
+ readonly activeVocab: VocabDefinition | null;
694
+ readonly history: {
695
+ readonly canUndo: boolean;
696
+ readonly canRedo: boolean;
697
+ };
698
+ };
699
+ type ActionState = BaseState | ViewState;
700
+ type WriteOptions = {
701
+ readonly historyGroup?: string;
702
+ readonly atRevision?: number;
703
+ };
704
+ type PluginWrites = Omit<ReturnType<typeof createWriteCommands<Promise<void>, Promise<string>>>, 'undo' | 'redo' | 'setView' | 'setActiveVocab' | 'setActiveTheme' | 'setLocale' | 'setPanelSizes' | 'setSectionOpen' | 'createView' | 'renameView' | 'setViewPinned' | 'deleteView'>;
705
+ type PluginContext<S extends BaseState = BaseState> = {
706
+ readonly store: PluginWrites & {
707
+ readonly getState: () => S;
708
+ readonly subscribe: (listener: () => void) => () => void;
709
+ readonly refresh: () => Promise<S>;
710
+ readonly applyOperations: (operations: readonly NessoOperation[], options?: WriteOptions) => Promise<{
711
+ readonly revision: number;
712
+ readonly changed: boolean;
713
+ }>;
714
+ };
715
+ readonly notifications: {
716
+ readonly notify: (value: {
717
+ readonly tone: 'info' | 'warning';
718
+ readonly title: LocalizedText;
719
+ readonly description?: LocalizedText;
720
+ }) => Promise<string>;
721
+ };
722
+ readonly files: {
723
+ readonly open: (options: FileOpenOptions) => Promise<FileOpenResult>;
724
+ readonly save: (options: FileSaveOptions) => Promise<{
725
+ readonly saved: boolean;
726
+ }>;
727
+ };
728
+ readonly signal: AbortSignal;
729
+ };
730
+ type ActionContext = PluginContext<ActionState>;
731
+ declare function parsePluginMessage(value: unknown): z.infer<typeof message>;
732
+ declare function sha256Hex(bytes: Uint8Array): Promise<string>;
733
+ declare function checkMessageSize(value: unknown, limit: number): void;
734
+ declare function createPluginClient<S extends BaseState>(port: MessagePort, initial: S): {
735
+ context: PluginContext<S>;
736
+ close: () => void;
737
+ };
738
+ //#endregion
739
+ export { NessoOperation as A, Selection as B, parseFileOptions as C, LocalizedText as D, parseOrThrow as E, Notifications as F, ThemeDefinition as G, VocabDefinition as H, PanelSizes as I, parseDefinition as K, Preferences as L, NessoStore as M, Notification as N, resolvePluginText as O, NotificationAction as P, SavedView as R, fileTextLimit as S, PluginError as T, WorkspaceState as U, Viewport as V, Definition as W, sha256Hex as _, BaseState as a, FileOpenResult as b, PluginManifest as c, createPluginClient as d, parseContribution as f, runtimeLimits as g, parsePluginMessage as h, ActionState as i, NessoState as j, GraphSnapshot as k, ViewState as l, parsePluginManifest as m, ActionContribution as n, PluginContext as o, parsePluginI18n as p, themeColors as q, ActionDescriptor as r, PluginI18n as s, ActionContext as t, checkMessageSize as u, themeTokens as v, createWriteCommands as w, FileSaveOptions as x, FileOpenOptions as y, SectionId as z };