@appsoftwareltd/etherpk-extension-api 0.12.0 → 0.14.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.
- package/README.md +165 -13
- package/controls.css +391 -0
- package/dist/assets.d.ts +26 -0
- package/dist/assets.js +5 -0
- package/dist/client-commands.d.ts +11 -0
- package/dist/client-commands.js +11 -0
- package/dist/context.d.ts +88 -48
- package/dist/documents.d.ts +149 -0
- package/dist/documents.js +15 -0
- package/dist/editor.d.ts +78 -0
- package/dist/graph-index.d.ts +7 -7
- package/dist/index.d.ts +10 -4
- package/dist/index.js +3 -1
- package/dist/manifest.d.ts +3 -5
- package/dist/manifest.js +1 -1
- package/dist/menus.d.ts +34 -13
- package/dist/records.d.ts +31 -0
- package/dist/records.js +7 -0
- package/dist/settings-sections.d.ts +62 -0
- package/dist/settings-sections.js +1 -0
- package/package.json +4 -2
package/dist/context.d.ts
CHANGED
|
@@ -3,18 +3,23 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Everything an extension adds through it sits under the extension's id and is removed when the
|
|
5
5
|
* graph closes or the extension is switched off, so an extension never has to undo its own
|
|
6
|
-
* registrations. It holds no document store, no keys and no sync
|
|
7
|
-
*
|
|
8
|
-
* the blocks it puts at the caret
|
|
6
|
+
* registrations. It holds no document store, no keys and no sync. An extension reads documents
|
|
7
|
+
* through the index's answers, `documents` (which leaves out every Protected Document) and its own
|
|
8
|
+
* fences, and changes them only through its fences, the blocks it puts at the caret, the images it
|
|
9
|
+
* keeps as assets and the Commands it may run.
|
|
9
10
|
*/
|
|
11
|
+
import type { ExtensionAssets } from './assets';
|
|
10
12
|
import type { ExtensionAuth } from './auth';
|
|
11
13
|
import type { ExtensionDialogs } from './dialogs';
|
|
14
|
+
import type { ExtensionDocuments } from './documents';
|
|
12
15
|
import type { ExtensionEditor } from './editor';
|
|
13
16
|
import type { ExtensionEmbeds } from './embeds';
|
|
14
17
|
import type { ExtensionEvents } from './events';
|
|
15
18
|
import type { ExtensionIndex } from './graph-index';
|
|
16
19
|
import type { ExtensionJournalPanels } from './journal';
|
|
17
|
-
import type { CommandMenuItem, ContextMenuItem, GraphSidebarButton } from './menus';
|
|
20
|
+
import type { CommandBarButton, CommandMenuItem, ContextMenuItem, GraphSidebarButton } from './menus';
|
|
21
|
+
import type { ExtensionGraphRecords } from './records';
|
|
22
|
+
import type { SettingsSection } from './settings-sections';
|
|
18
23
|
import type { ViewContribution, ViewRef } from './views';
|
|
19
24
|
/**
|
|
20
25
|
* A Command's handler. What it returns, or resolves to, is what `execute` resolves to.
|
|
@@ -31,16 +36,12 @@ export interface ExtensionCommands {
|
|
|
31
36
|
/** Add a Command, its id under the extension's id. Throws if the id is taken or outside it. */
|
|
32
37
|
register(id: string, handler: CommandHandler): () => void;
|
|
33
38
|
/**
|
|
34
|
-
* Run
|
|
35
|
-
*
|
|
36
|
-
*
|
|
39
|
+
* Run a Command: the extension's own, another running extension's, or one of the Client's that
|
|
40
|
+
* {@link CLIENT_COMMANDS} names. Rejects if no Command has the id, or if it is one of the
|
|
41
|
+
* Client's that the list does not name. An extension that comes with EtherPK may run any.
|
|
37
42
|
*/
|
|
38
43
|
execute(id: string, arg?: unknown): Promise<unknown>;
|
|
39
|
-
/**
|
|
40
|
-
* Whether any Command has the id.
|
|
41
|
-
*
|
|
42
|
-
* @beta
|
|
43
|
-
*/
|
|
44
|
+
/** Whether a Command the extension may run has the id. */
|
|
44
45
|
has(id: string): boolean;
|
|
45
46
|
}
|
|
46
47
|
/**
|
|
@@ -58,7 +59,7 @@ export interface ExtensionViews {
|
|
|
58
59
|
/**
|
|
59
60
|
* Adding Context Menu rows.
|
|
60
61
|
*
|
|
61
|
-
* @
|
|
62
|
+
* @public
|
|
62
63
|
*/
|
|
63
64
|
export interface ExtensionContextMenu {
|
|
64
65
|
/** Add a row, its id under the extension's id. */
|
|
@@ -73,6 +74,16 @@ export interface ExtensionCommandMenu {
|
|
|
73
74
|
/** Add a row, its id under the extension's id. */
|
|
74
75
|
register(item: CommandMenuItem): () => void;
|
|
75
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Adding buttons to the Command Bar, the row of buttons across the bottom of a phone's screen:
|
|
79
|
+
* after the editing buttons that scroll, or in the pinned group at its right end.
|
|
80
|
+
*
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
export interface ExtensionCommandBar {
|
|
84
|
+
/** Add a button, its id under the extension's id. */
|
|
85
|
+
register(button: CommandBarButton): () => void;
|
|
86
|
+
}
|
|
76
87
|
/**
|
|
77
88
|
* Adding buttons to the Graph Sidebar's group of action buttons, after Search and today's date.
|
|
78
89
|
*
|
|
@@ -85,7 +96,7 @@ export interface ExtensionGraphSidebar {
|
|
|
85
96
|
/**
|
|
86
97
|
* A key chord that runs a Command.
|
|
87
98
|
*
|
|
88
|
-
* @
|
|
99
|
+
* @public
|
|
89
100
|
*/
|
|
90
101
|
export interface Keybinding {
|
|
91
102
|
/** `Alt+M`, `Mod+Shift+K`: `Mod` is Cmd on Apple devices and Ctrl elsewhere. */
|
|
@@ -100,10 +111,15 @@ export interface Keybinding {
|
|
|
100
111
|
/**
|
|
101
112
|
* Adding key chords.
|
|
102
113
|
*
|
|
103
|
-
* @
|
|
114
|
+
* @public
|
|
104
115
|
*/
|
|
105
116
|
export interface ExtensionKeybindings {
|
|
106
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* Add a chord for one of the extension's own Commands. Throws for another's Command. When the
|
|
119
|
+
* Client or another extension binds the chord already, the chord is left to them and this one
|
|
120
|
+
* does nothing: the call still succeeds, and the Client says so in the browser's console. So a
|
|
121
|
+
* shortcut the Client adds in a later release never stops an extension from starting.
|
|
122
|
+
*/
|
|
107
123
|
register(binding: Keybinding): () => void;
|
|
108
124
|
}
|
|
109
125
|
/**
|
|
@@ -122,9 +138,8 @@ export interface ExtensionLayout {
|
|
|
122
138
|
beside?: string;
|
|
123
139
|
}): void;
|
|
124
140
|
/**
|
|
125
|
-
* Bring
|
|
126
|
-
*
|
|
127
|
-
* @beta
|
|
141
|
+
* Bring one of the extension's own Sidebar residents (a View kind its manifest declares with a
|
|
142
|
+
* `resident` side) to the front of its expanded Sidebar. Does nothing for any other kind.
|
|
128
143
|
*/
|
|
129
144
|
reveal(kind: string): void;
|
|
130
145
|
/**
|
|
@@ -139,21 +154,42 @@ export interface ExtensionLayout {
|
|
|
139
154
|
beside?: string;
|
|
140
155
|
}): void;
|
|
141
156
|
/**
|
|
142
|
-
* The document the
|
|
143
|
-
*
|
|
144
|
-
* @beta
|
|
157
|
+
* The name of the document the person is working in, as its tab names it (a page's title, or a
|
|
158
|
+
* journal entry's day, `YYYY-MM-DD`), or null when no document's tab is in front.
|
|
145
159
|
*/
|
|
146
160
|
activeDocument(): string | null;
|
|
147
161
|
/** True while the desktop presenter is showing, 1024 pixels wide and more. */
|
|
148
162
|
isDesktop(): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Draw something over the whole EtherPK window, with a heading and a close button the Client
|
|
165
|
+
* draws, as a fence's widget opens over the window. One at a time: opening another closes the
|
|
166
|
+
* one before. The close button, Escape and `close` all close it, and `onClose` is told once.
|
|
167
|
+
*/
|
|
168
|
+
openWindow(options: {
|
|
169
|
+
/** The heading the Client draws beside the close button. */
|
|
170
|
+
title: string;
|
|
171
|
+
/** Draw into `host`, which fills the window under the heading. */
|
|
172
|
+
mount(host: HTMLElement, window: {
|
|
173
|
+
close(): void;
|
|
174
|
+
}): {
|
|
175
|
+
destroy(): void;
|
|
176
|
+
};
|
|
177
|
+
onClose?(): void;
|
|
178
|
+
}): {
|
|
179
|
+
close(): void;
|
|
180
|
+
};
|
|
149
181
|
}
|
|
150
182
|
/**
|
|
151
183
|
* The rules for naming a concept, which every index answer follows.
|
|
152
184
|
*
|
|
153
|
-
* @
|
|
185
|
+
* @public
|
|
154
186
|
*/
|
|
155
187
|
export interface ExtensionConcepts {
|
|
156
|
-
/**
|
|
188
|
+
/**
|
|
189
|
+
* The key the Client tells two names apart by: two names with the same key are one concept.
|
|
190
|
+
* How it is made may change in a later release, so compare keys from this, and never make
|
|
191
|
+
* one another way.
|
|
192
|
+
*/
|
|
157
193
|
key(name: string): string;
|
|
158
194
|
/** The name a concept resolves to: an alias's page, a page's own title, or the name itself. */
|
|
159
195
|
canonicalName(name: string): string;
|
|
@@ -203,15 +239,15 @@ export interface ExtensionSettings {
|
|
|
203
239
|
}
|
|
204
240
|
/**
|
|
205
241
|
* The extension's own records, kept with the person (ADR 0140): on this device, and where the
|
|
206
|
-
* person's account syncs a graph, in that account's
|
|
207
|
-
* person's own devices can read them. So a record follows the person to their other devices, as
|
|
242
|
+
* person's account syncs a graph, in that account's Settings Vault too, encrypted on the device so
|
|
243
|
+
* only the person's own devices can read them. So a record follows the person to their other devices, as
|
|
208
244
|
* Extension Settings do, such as what signing in to another service gave the extension. The person
|
|
209
245
|
* never sees these records, and uninstalling the extension clears them on every device.
|
|
210
246
|
*
|
|
211
247
|
* Each record is kept as JSON, at most 64 KB of it. Between two devices the later change to a
|
|
212
248
|
* record wins, record by record. A record is readable on the device by any code in the page, as
|
|
213
|
-
* localStorage is
|
|
214
|
-
* the
|
|
249
|
+
* localStorage is. A Headless Client signed in to the same account cannot read it: the Sync Server
|
|
250
|
+
* never gives an agent token the Settings Vault (ADR 0148).
|
|
215
251
|
*
|
|
216
252
|
* @public
|
|
217
253
|
*/
|
|
@@ -247,7 +283,7 @@ export interface ExtensionTheme {
|
|
|
247
283
|
* it goes into the page as it is. A string built from it is a plain string again, which the
|
|
248
284
|
* Client's default policy sanitizes.
|
|
249
285
|
*
|
|
250
|
-
* @
|
|
286
|
+
* @public
|
|
251
287
|
*/
|
|
252
288
|
export interface IconMarkup {
|
|
253
289
|
/** Never present at run time. It marks the type, so a plain string is not one. */
|
|
@@ -256,7 +292,7 @@ export interface IconMarkup {
|
|
|
256
292
|
/**
|
|
257
293
|
* Drawing the Client's icons and the extension's own.
|
|
258
294
|
*
|
|
259
|
-
* @
|
|
295
|
+
* @public
|
|
260
296
|
*/
|
|
261
297
|
export interface ExtensionIcons {
|
|
262
298
|
/**
|
|
@@ -299,26 +335,18 @@ export interface ExtensionContributions {
|
|
|
299
335
|
export interface ExtensionContext {
|
|
300
336
|
/**
|
|
301
337
|
* The extension's id, from its manifest.
|
|
302
|
-
*
|
|
303
|
-
* @beta
|
|
304
338
|
*/
|
|
305
339
|
readonly extensionId: string;
|
|
306
340
|
/**
|
|
307
341
|
* The open graph.
|
|
308
|
-
*
|
|
309
|
-
* @beta
|
|
310
342
|
*/
|
|
311
343
|
readonly graphId: string;
|
|
312
344
|
/**
|
|
313
345
|
* The Client's version, `x.y.z`.
|
|
314
|
-
*
|
|
315
|
-
* @beta
|
|
316
346
|
*/
|
|
317
347
|
readonly clientVersion: string;
|
|
318
348
|
/**
|
|
319
349
|
* True in a development build of the Client, where tests may reach in.
|
|
320
|
-
*
|
|
321
|
-
* @beta
|
|
322
350
|
*/
|
|
323
351
|
readonly dev: boolean;
|
|
324
352
|
/** Supplying the Views the manifest declares. */
|
|
@@ -327,20 +355,20 @@ export interface ExtensionContext {
|
|
|
327
355
|
readonly commands: ExtensionCommands;
|
|
328
356
|
/**
|
|
329
357
|
* Adding Context Menu rows.
|
|
330
|
-
*
|
|
331
|
-
* @beta
|
|
332
358
|
*/
|
|
333
359
|
readonly contextMenu: ExtensionContextMenu;
|
|
334
360
|
/** Adding Command Menu rows. */
|
|
335
361
|
readonly commandMenu: ExtensionCommandMenu;
|
|
336
362
|
/** Adding buttons to the Graph Sidebar. */
|
|
337
363
|
readonly graphSidebar: ExtensionGraphSidebar;
|
|
364
|
+
/**
|
|
365
|
+
* Adding buttons to the phone's Command Bar.
|
|
366
|
+
*/
|
|
367
|
+
readonly commandBar: ExtensionCommandBar;
|
|
338
368
|
/** Adding panels beneath each Journal Entry. */
|
|
339
369
|
readonly journalPanels: ExtensionJournalPanels;
|
|
340
370
|
/**
|
|
341
371
|
* Adding key chords.
|
|
342
|
-
*
|
|
343
|
-
* @beta
|
|
344
372
|
*/
|
|
345
373
|
readonly keybindings: ExtensionKeybindings;
|
|
346
374
|
/**
|
|
@@ -353,16 +381,24 @@ export interface ExtensionContext {
|
|
|
353
381
|
readonly events: ExtensionEvents;
|
|
354
382
|
/**
|
|
355
383
|
* Questions to the open graph's index.
|
|
356
|
-
*
|
|
357
|
-
* @beta
|
|
358
384
|
*/
|
|
359
385
|
readonly index: ExtensionIndex;
|
|
386
|
+
/**
|
|
387
|
+
* Reading the open graph's documents, with every Protected Document left out, name and all.
|
|
388
|
+
*/
|
|
389
|
+
readonly documents: ExtensionDocuments;
|
|
390
|
+
/**
|
|
391
|
+
* The extension's records for the open graph, kept on this device only.
|
|
392
|
+
*/
|
|
393
|
+
readonly records: ExtensionGraphRecords;
|
|
394
|
+
/**
|
|
395
|
+
* Images kept as the open graph's assets.
|
|
396
|
+
*/
|
|
397
|
+
readonly assets: ExtensionAssets;
|
|
360
398
|
/** Opening Views and documents. */
|
|
361
399
|
readonly layout: ExtensionLayout;
|
|
362
400
|
/**
|
|
363
401
|
* The rules for naming a concept.
|
|
364
|
-
*
|
|
365
|
-
* @beta
|
|
366
402
|
*/
|
|
367
403
|
readonly concepts: ExtensionConcepts;
|
|
368
404
|
/** The extension's own storage on this device. */
|
|
@@ -377,8 +413,6 @@ export interface ExtensionContext {
|
|
|
377
413
|
readonly theme: ExtensionTheme;
|
|
378
414
|
/**
|
|
379
415
|
* The Client's icons and the extension's own.
|
|
380
|
-
*
|
|
381
|
-
* @beta
|
|
382
416
|
*/
|
|
383
417
|
readonly icons: ExtensionIcons;
|
|
384
418
|
/** Widgets over the extension's own fences, and blocks put at the caret. */
|
|
@@ -402,4 +436,10 @@ export interface ExtensionModule {
|
|
|
402
436
|
* called after that, for anything else the extension holds.
|
|
403
437
|
*/
|
|
404
438
|
activate(context: ExtensionContext): void | (() => void);
|
|
439
|
+
/**
|
|
440
|
+
* Sections the extension adds to the Client's settings, which the Client mounts while the
|
|
441
|
+
* extension is switched on: in a graph's Settings and Extensions, and, for an extension that
|
|
442
|
+
* comes with EtherPK, on the Graphs page with no graph open (see {@link SettingsSection}).
|
|
443
|
+
*/
|
|
444
|
+
settingsSections?: readonly SettingsSection[];
|
|
405
445
|
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading the open graph's documents, as a language model may read them for a person (ADR 0147).
|
|
3
|
+
*
|
|
4
|
+
* Every answer leaves out a [[Protected Document]] entirely: not its content, and not its name
|
|
5
|
+
* either, even while the person holds the Protection Key. That is stricter than the index's
|
|
6
|
+
* answers (`context.index`), which list a Protected Document by name, because what an extension
|
|
7
|
+
* reads here may be sent to a model provider. A document whose text holds an encrypted fence
|
|
8
|
+
* anywhere counts as protected here too.
|
|
9
|
+
*
|
|
10
|
+
* Every answer is bounded: a list is paged, and a document's text is cut at a cap and says so. A
|
|
11
|
+
* page of a listing holds at most 200 documents or tasks, and a page of a search 50 results. A
|
|
12
|
+
* document's text is cut after 200,000 characters. The format guide's wording changes as the format
|
|
13
|
+
* does, so an extension passes it on and never reads meaning into its words.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* A document as a listing names it.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export interface DocumentSummary {
|
|
21
|
+
/** The document's name: a page's title, or a journal entry's day, `YYYY-MM-DD`. */
|
|
22
|
+
name: string;
|
|
23
|
+
/** A page or a journal entry. */
|
|
24
|
+
kind: 'page' | 'journal';
|
|
25
|
+
/** The page's other names. */
|
|
26
|
+
aliases: string[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A document's text, as {@link ExtensionDocuments.read} answers.
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export interface DocumentText extends DocumentSummary {
|
|
34
|
+
/** The body: the text after the frontmatter block, cut at the cap. */
|
|
35
|
+
text: string;
|
|
36
|
+
/** True when the text was cut at the cap. */
|
|
37
|
+
truncated: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* One document a search matched, with the lines that matched.
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
export interface DocumentSearchResult extends Omit<DocumentSummary, 'aliases'> {
|
|
45
|
+
/** How many lines matched. */
|
|
46
|
+
matches: number;
|
|
47
|
+
/** The matching lines, best first. */
|
|
48
|
+
hits: {
|
|
49
|
+
/** The line's number in the document's text, from 0. */
|
|
50
|
+
line: number;
|
|
51
|
+
/** The labels of the blocks the line sits under, outermost first. */
|
|
52
|
+
breadcrumb: string[];
|
|
53
|
+
/** The line's text around the match. */
|
|
54
|
+
snippet: string;
|
|
55
|
+
}[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* One document whose text links to the concept asked about, with each place it does.
|
|
59
|
+
*
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
export interface DocumentBacklink extends Omit<DocumentSummary, 'aliases'> {
|
|
63
|
+
references: {
|
|
64
|
+
/** The line's number in the source's text, from 0. */
|
|
65
|
+
line: number;
|
|
66
|
+
/** The labels of the blocks the reference sits under, outermost first. */
|
|
67
|
+
breadcrumb: string[];
|
|
68
|
+
/** The block holding the link with its children, or the prose around it. */
|
|
69
|
+
text: string;
|
|
70
|
+
}[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* One task, as the Tasks View lists it.
|
|
74
|
+
*
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
export interface DocumentTask extends Omit<DocumentSummary, 'aliases'> {
|
|
78
|
+
/** The task's line in the document's text, from 0. */
|
|
79
|
+
line: number;
|
|
80
|
+
/** The task's words, without the checkbox. */
|
|
81
|
+
text: string;
|
|
82
|
+
status: 'open' | 'doing' | 'waiting' | 'done' | 'cancelled';
|
|
83
|
+
/** 1 is the highest; null when the task has none. */
|
|
84
|
+
priority: 1 | 2 | 3 | null;
|
|
85
|
+
/** `YYYY-MM-DD`, or null. */
|
|
86
|
+
due: string | null;
|
|
87
|
+
/** `YYYY-MM-DD`, or null. */
|
|
88
|
+
scheduled: string | null;
|
|
89
|
+
/** The labels of the blocks the task sits under, outermost first. */
|
|
90
|
+
breadcrumb: string[];
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Reading the open graph's documents.
|
|
94
|
+
*
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
export interface ExtensionDocuments {
|
|
98
|
+
/** Pages and journal entries, journals newest first and then pages by name, a page at a time. */
|
|
99
|
+
list(options?: {
|
|
100
|
+
kind?: 'page' | 'journal';
|
|
101
|
+
offset?: number;
|
|
102
|
+
limit?: number;
|
|
103
|
+
}): Promise<{
|
|
104
|
+
documents: DocumentSummary[];
|
|
105
|
+
total: number;
|
|
106
|
+
hasMore: boolean;
|
|
107
|
+
}>;
|
|
108
|
+
/**
|
|
109
|
+
* A document's text by its name or an alias, or null when there is no such document or it is
|
|
110
|
+
* protected. The text is the document as it is now, edits not yet saved included.
|
|
111
|
+
*/
|
|
112
|
+
read(name: string): Promise<DocumentText | null>;
|
|
113
|
+
/**
|
|
114
|
+
* The names of the documents a document's wikilinks name directly, in the order they first
|
|
115
|
+
* appear, each once. Names with no document, and protected documents, are left out. Null when
|
|
116
|
+
* the document cannot be read.
|
|
117
|
+
*/
|
|
118
|
+
links(name: string): Promise<string[] | null>;
|
|
119
|
+
/** The documents whose text matches the words, best first, a page at a time. */
|
|
120
|
+
search(query: string, options?: {
|
|
121
|
+
offset?: number;
|
|
122
|
+
limit?: number;
|
|
123
|
+
}): Promise<{
|
|
124
|
+
results: DocumentSearchResult[];
|
|
125
|
+
total: number;
|
|
126
|
+
hasMore: boolean;
|
|
127
|
+
}>;
|
|
128
|
+
/** The documents that link to a concept, or null when the concept is a protected document. */
|
|
129
|
+
backlinks(name: string): Promise<DocumentBacklink[] | null>;
|
|
130
|
+
/**
|
|
131
|
+
* How the graph's documents are written, as the Client describes it to agents: names and
|
|
132
|
+
* wikilinks, the outline, tasks and the rest of the syntax, in markdown. The same words the
|
|
133
|
+
* `AGENTS.md` of a graph folder carries, less what is about files on a disk, so a model reading
|
|
134
|
+
* the graph's text understands it and names documents as `[[Name]]`.
|
|
135
|
+
*/
|
|
136
|
+
formatGuide(): string;
|
|
137
|
+
/** Tasks, open ones unless asked otherwise, of one concept or of the whole graph, a page at a time. */
|
|
138
|
+
tasks(options?: {
|
|
139
|
+
/** Only the tasks that answer to this concept. */
|
|
140
|
+
concept?: string;
|
|
141
|
+
statuses?: DocumentTask['status'][];
|
|
142
|
+
offset?: number;
|
|
143
|
+
limit?: number;
|
|
144
|
+
}): Promise<{
|
|
145
|
+
tasks: DocumentTask[];
|
|
146
|
+
total: number;
|
|
147
|
+
hasMore: boolean;
|
|
148
|
+
}>;
|
|
149
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading the open graph's documents, as a language model may read them for a person (ADR 0147).
|
|
3
|
+
*
|
|
4
|
+
* Every answer leaves out a [[Protected Document]] entirely: not its content, and not its name
|
|
5
|
+
* either, even while the person holds the Protection Key. That is stricter than the index's
|
|
6
|
+
* answers (`context.index`), which list a Protected Document by name, because what an extension
|
|
7
|
+
* reads here may be sent to a model provider. A document whose text holds an encrypted fence
|
|
8
|
+
* anywhere counts as protected here too.
|
|
9
|
+
*
|
|
10
|
+
* Every answer is bounded: a list is paged, and a document's text is cut at a cap and says so. A
|
|
11
|
+
* page of a listing holds at most 200 documents or tasks, and a page of a search 50 results. A
|
|
12
|
+
* document's text is cut after 200,000 characters. The format guide's wording changes as the format
|
|
13
|
+
* does, so an extension passes it on and never reads meaning into its words.
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
package/dist/editor.d.ts
CHANGED
|
@@ -236,6 +236,72 @@ export interface FenceOptions {
|
|
|
236
236
|
*/
|
|
237
237
|
keepsHistory?: boolean;
|
|
238
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* A panel an extension draws in a document, beneath one of its lines, which is not part of the
|
|
241
|
+
* document's text: nothing of it is saved, synced or seen on another device (ADR 0147).
|
|
242
|
+
*
|
|
243
|
+
* The panel follows its line as the document changes, here or on another device, and moves with
|
|
244
|
+
* the editor when the editor is rebuilt (a Draft becoming a document, say). It closes when the
|
|
245
|
+
* person closes it, or when the document's editor closes for good: the panel lasts for the visit.
|
|
246
|
+
*
|
|
247
|
+
* @public
|
|
248
|
+
*/
|
|
249
|
+
export interface InlinePanel {
|
|
250
|
+
/** The document the panel is in, by its concept. */
|
|
251
|
+
readonly document: string | null;
|
|
252
|
+
/** False once the panel has closed. */
|
|
253
|
+
readonly isOpen: boolean;
|
|
254
|
+
/**
|
|
255
|
+
* Put a block at the panel's line, by the rule {@link ExtensionEditor.insertBlock} follows at the
|
|
256
|
+
* caret: an empty line is replaced, an empty bullet takes an outline's place at its own
|
|
257
|
+
* indentation (or any other block as its content), and after any other line the block goes on new
|
|
258
|
+
* lines beneath at the line's content column. The panel then sits beneath the block, and the next
|
|
259
|
+
* block goes after it at the indentation of its first line. One undoable change. False where
|
|
260
|
+
* nothing was put in: the panel is closed, its editor has closed, or its line is now in the
|
|
261
|
+
* frontmatter, a fenced block or a table.
|
|
262
|
+
*/
|
|
263
|
+
insertBlock(text: string): boolean;
|
|
264
|
+
/** Bring the panel into view. */
|
|
265
|
+
focus(): void;
|
|
266
|
+
/**
|
|
267
|
+
* Give the panel a new height in CSS pixels, which its content scrolls inside: the lines below
|
|
268
|
+
* it move once. Grow it when there is more to show, rather than on every change.
|
|
269
|
+
*/
|
|
270
|
+
resize(height: number): void;
|
|
271
|
+
/**
|
|
272
|
+
* The outline around the panel's line, as the document writes it: the line's ancestors, each its
|
|
273
|
+
* own lines without its other children, and its siblings with their branches, the line's own
|
|
274
|
+
* branch among them while the line has text. A block the panel put in is left out. Null when
|
|
275
|
+
* the line is not a bullet, or the panel is closed or under the document's last line.
|
|
276
|
+
*/
|
|
277
|
+
outline(): string | null;
|
|
278
|
+
/** Close the panel. Its `onClose` is told. */
|
|
279
|
+
close(): void;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* What an inline panel is drawn with.
|
|
283
|
+
*
|
|
284
|
+
* @public
|
|
285
|
+
*/
|
|
286
|
+
export interface InlinePanelOptions {
|
|
287
|
+
/**
|
|
288
|
+
* The panel's height in CSS pixels, which its content scrolls inside, so the lines below never
|
|
289
|
+
* move as its content grows. {@link InlinePanel.resize} changes it.
|
|
290
|
+
*/
|
|
291
|
+
height?: number;
|
|
292
|
+
/**
|
|
293
|
+
* Draw the panel into `host`, which the Client owns and places. Called once, when the panel is
|
|
294
|
+
* first drawn: the host keeps its content while the panel is scrolled out of view and when the
|
|
295
|
+
* editor is rebuilt, and `destroy` is called when the panel closes. Events inside the host are
|
|
296
|
+
* the panel's own: the editor neither types nor moves its caret for them, but Mod+Z and Mod+Y
|
|
297
|
+
* outside a text field undo and redo in the document.
|
|
298
|
+
*/
|
|
299
|
+
mount(host: HTMLElement, panel: InlinePanel): {
|
|
300
|
+
destroy(): void;
|
|
301
|
+
};
|
|
302
|
+
/** Told once, when the panel closes for any reason. */
|
|
303
|
+
onClose?(): void;
|
|
304
|
+
}
|
|
239
305
|
/**
|
|
240
306
|
* The document editor, as far as an extension may reach it.
|
|
241
307
|
*
|
|
@@ -263,4 +329,16 @@ export interface ExtensionEditor {
|
|
|
263
329
|
insertBlock(text: string, options?: {
|
|
264
330
|
focus?: boolean;
|
|
265
331
|
}): boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Draw a panel beneath the caret's line in the editor the person is working in, from where the
|
|
334
|
+
* line's text starts, or beside the dot of an empty bullet, as a code block opened there is. With
|
|
335
|
+
* `at` `end`, it is drawn beneath the document's last line, at the editor's left edge, a line's
|
|
336
|
+
* height clear of it. With `caret-or-end`, at the caret while the person is typing in the
|
|
337
|
+
* document (the editor has the keyboard, as a Command Bar button leaves it), else at the end: for
|
|
338
|
+
* a button pressed from outside the text. Null where no panel can go: no editor, a Protected
|
|
339
|
+
* Document, or a caret in the frontmatter, a fenced block or a table.
|
|
340
|
+
*/
|
|
341
|
+
openPanel(options: InlinePanelOptions & {
|
|
342
|
+
at?: 'caret' | 'end' | 'caret-or-end';
|
|
343
|
+
}): InlinePanel | null;
|
|
266
344
|
}
|
package/dist/graph-index.d.ts
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* What kind of name a concept is.
|
|
8
8
|
*
|
|
9
|
-
* @
|
|
9
|
+
* @public
|
|
10
10
|
*/
|
|
11
11
|
export type ConceptKind = 'page' | 'journal' | 'alias' | 'pageless';
|
|
12
12
|
/**
|
|
13
13
|
* One name the index knows: a page, a journal entry, an alias, or a Pageless Concept (a name
|
|
14
14
|
* wikilinks use that has no page).
|
|
15
15
|
*
|
|
16
|
-
* @
|
|
16
|
+
* @public
|
|
17
17
|
*/
|
|
18
18
|
export interface ConceptCandidate {
|
|
19
19
|
/** The name as written. */
|
|
@@ -32,7 +32,7 @@ export interface ConceptCandidate {
|
|
|
32
32
|
/**
|
|
33
33
|
* One concept in the link graph.
|
|
34
34
|
*
|
|
35
|
-
* @
|
|
35
|
+
* @public
|
|
36
36
|
*/
|
|
37
37
|
export interface LinkGraphConcept {
|
|
38
38
|
/** The case-insensitive key every other answer uses. */
|
|
@@ -50,7 +50,7 @@ export interface LinkGraphConcept {
|
|
|
50
50
|
* One line, from the document whose text holds the wikilinks to the concept they name. Both ends
|
|
51
51
|
* are positions in {@link LinkGraph.concepts}.
|
|
52
52
|
*
|
|
53
|
-
* @
|
|
53
|
+
* @public
|
|
54
54
|
*/
|
|
55
55
|
export interface LinkGraphLink {
|
|
56
56
|
/** The document whose text holds the wikilinks, by its position in `concepts`. */
|
|
@@ -65,7 +65,7 @@ export interface LinkGraphLink {
|
|
|
65
65
|
/**
|
|
66
66
|
* Every concept and every line a wikilink draws between two of them.
|
|
67
67
|
*
|
|
68
|
-
* @
|
|
68
|
+
* @public
|
|
69
69
|
*/
|
|
70
70
|
export interface LinkGraph {
|
|
71
71
|
/** Sorted by key, so two answers over the same index are identical. */
|
|
@@ -76,7 +76,7 @@ export interface LinkGraph {
|
|
|
76
76
|
/**
|
|
77
77
|
* What changed in one update the index committed.
|
|
78
78
|
*
|
|
79
|
-
* @
|
|
79
|
+
* @public
|
|
80
80
|
*/
|
|
81
81
|
export interface IndexUpdate {
|
|
82
82
|
/** The whole index was read again, so anything may have changed. */
|
|
@@ -91,7 +91,7 @@ export interface IndexUpdate {
|
|
|
91
91
|
/**
|
|
92
92
|
* The questions an extension may ask the open graph's index.
|
|
93
93
|
*
|
|
94
|
-
* @
|
|
94
|
+
* @public
|
|
95
95
|
*/
|
|
96
96
|
export interface ExtensionIndex {
|
|
97
97
|
/** Every name the index knows, aliases and Pageless Concepts included. */
|
package/dist/index.d.ts
CHANGED
|
@@ -9,20 +9,26 @@
|
|
|
9
9
|
*
|
|
10
10
|
* A declaration, or a member of one, is Stable (`@public`) or Proposed (`@beta`). A Stable one never
|
|
11
11
|
* breaks: it is deprecated and kept. A Proposed one may change in any release, and only the
|
|
12
|
-
* extensions that come with EtherPK may use it.
|
|
12
|
+
* extensions that come with EtherPK may use it. Since 0.14.0 everything is Stable but
|
|
13
|
+
* `contributions`, the Client's own registries. An extension from the Extension Directory uses the
|
|
13
14
|
* Stable part alone, which `etc/etherpk-extension-api.public.api.md` lists.
|
|
14
15
|
*
|
|
15
16
|
* @packageDocumentation
|
|
16
17
|
*/
|
|
17
|
-
export type { CommandHandler, ExtensionCommandMenu, ExtensionCommands, ExtensionConcepts, ExtensionContext, ExtensionContextMenu, ExtensionContributions, ExtensionGraphSidebar, ExtensionIcons, ExtensionKeybindings, ExtensionLayout, ExtensionModule, ExtensionPersonStorage, ExtensionSettings, ExtensionStorage, ExtensionTheme, ExtensionViews, IconMarkup, Keybinding, } from './context';
|
|
18
|
+
export type { CommandHandler, ExtensionCommandBar, ExtensionCommandMenu, ExtensionCommands, ExtensionConcepts, ExtensionContext, ExtensionContextMenu, ExtensionContributions, ExtensionGraphSidebar, ExtensionIcons, ExtensionKeybindings, ExtensionLayout, ExtensionModule, ExtensionPersonStorage, ExtensionSettings, ExtensionStorage, ExtensionTheme, ExtensionViews, IconMarkup, Keybinding, } from './context';
|
|
19
|
+
export type { ExtensionAssets } from './assets';
|
|
18
20
|
export type { AuthorizeOptions, ExtensionAuth } from './auth';
|
|
19
21
|
export type { ExtensionDialogs, PromptOptions } from './dialogs';
|
|
20
|
-
export type {
|
|
22
|
+
export type { DocumentBacklink, DocumentSearchResult, DocumentSummary, DocumentTask, DocumentText, ExtensionDocuments } from './documents';
|
|
23
|
+
export type { ExtensionEditor, FenceContext, FenceEdit, FenceInfo, FenceOptions, FencePresentation, FenceWidget, InlinePanel, InlinePanelOptions, MountedFence, PublishedFence, PublishFenceRequest, QuoteFenceRequest, } from './editor';
|
|
21
24
|
export type { ExtensionEmbeds, FrameOptions } from './embeds';
|
|
22
25
|
export type { ExtensionEventName, ExtensionEventPayloads, ExtensionEvents } from './events';
|
|
23
26
|
export type { ConceptCandidate, ConceptKind, ExtensionIndex, IndexUpdate, LinkGraph, LinkGraphConcept, LinkGraphLink } from './graph-index';
|
|
24
27
|
export type { ExtensionJournalPanels, JournalPanel, JournalPanelProps, MountedJournalPanel } from './journal';
|
|
25
28
|
export type { ExtensionIsolation, ExtensionManifest, ExtensionPackage, ReadExtensionPackageResult, SettingDeclaration, ViewDeclaration, ViewRegion, } from './manifest';
|
|
26
29
|
export { readExtensionPackage } from './manifest';
|
|
27
|
-
export
|
|
30
|
+
export { CLIENT_COMMANDS } from './client-commands';
|
|
31
|
+
export type { CommandBarButton, CommandMenuContext, CommandMenuItem, ContextMenuItem, DocumentMenuTarget, ExtensionMenuTarget, GraphSidebarButton, MenuTarget, TabMenuTarget, WikilinkMenuTarget, } from './menus';
|
|
32
|
+
export type { ExtensionGraphRecords } from './records';
|
|
33
|
+
export type { MountedSettingsSection, SettingsSection, SettingsSectionContext, SettingsSectionTab } from './settings-sections';
|
|
28
34
|
export type { MountedView, ViewContribution, ViewMountProps, ViewRef, ViewVisibility } from './views';
|
package/dist/index.js
CHANGED
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
*
|
|
10
10
|
* A declaration, or a member of one, is Stable (`@public`) or Proposed (`@beta`). A Stable one never
|
|
11
11
|
* breaks: it is deprecated and kept. A Proposed one may change in any release, and only the
|
|
12
|
-
* extensions that come with EtherPK may use it.
|
|
12
|
+
* extensions that come with EtherPK may use it. Since 0.14.0 everything is Stable but
|
|
13
|
+
* `contributions`, the Client's own registries. An extension from the Extension Directory uses the
|
|
13
14
|
* Stable part alone, which `etc/etherpk-extension-api.public.api.md` lists.
|
|
14
15
|
*
|
|
15
16
|
* @packageDocumentation
|
|
16
17
|
*/
|
|
17
18
|
export { readExtensionPackage } from './manifest';
|
|
19
|
+
export { CLIENT_COMMANDS } from './client-commands';
|